From c72d82ab0b0de30bb54541064c97bcd44171f5de Mon Sep 17 00:00:00 2001 From: janniks Date: Wed, 10 May 2023 16:14:21 +0200 Subject: [PATCH] fix(pox-3): include pox-3 error codes --- packages/stacking/src/constants.ts | 4 +++- packages/stacking/src/utils.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/stacking/src/constants.ts b/packages/stacking/src/constants.ts index 18d59dc61..dfef52f36 100644 --- a/packages/stacking/src/constants.ts +++ b/packages/stacking/src/constants.ts @@ -93,7 +93,7 @@ export enum PoxOperationPeriod { } export enum StackingErrors { - // taken from https://github.com/stacks-network/stacks-blockchain/blob/4f6d7d416f6af641f838f154dc54a3baa9cd8d48/src/chainstate/stacks/boot/pox-2.clar + // taken from https://github.com/stacks-network/stacks-blockchain/blob/088ff00761b27a12bfaf19dab5743e77e8ca4d0c/src/chainstate/stacks/boot/pox-3.clar ERR_STACKING_UNREACHABLE = 255, ERR_STACKING_CORRUPTED_STATE = 254, ERR_STACKING_INSUFFICIENT_FUNDS = 1, @@ -119,4 +119,6 @@ export enum StackingErrors { ERR_STACK_INCREASE_NOT_LOCKED = 27, ERR_DELEGATION_NO_REWARD_SLOT = 28, ERR_DELEGATION_WRONG_REWARD_SLOT = 29, + ERR_STACKING_IS_DELEGATED = 30, + ERR_STACKING_NOT_DELEGATED = 31, } diff --git a/packages/stacking/src/utils.ts b/packages/stacking/src/utils.ts index c6a0fffc1..362a7f5dd 100644 --- a/packages/stacking/src/utils.ts +++ b/packages/stacking/src/utils.ts @@ -207,6 +207,10 @@ export function getErrorString(error: StackingErrors): string { return 'Invalid reward-cycle and reward-cycle-index'; case StackingErrors.ERR_DELEGATION_WRONG_REWARD_SLOT: return 'PoX address must match the one on record'; + case StackingErrors.ERR_STACKING_IS_DELEGATED: + return 'Stacker must be directly stacking and not delegating'; + case StackingErrors.ERR_STACKING_NOT_DELEGATED: + return 'Stacker must be delegating and not be directly stacking'; } }