Skip to content

Commit

Permalink
fix(pox-3): include pox-3 error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed May 10, 2023
1 parent a2aac09 commit c72d82a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/stacking/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}
4 changes: 4 additions & 0 deletions packages/stacking/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

Expand Down

0 comments on commit c72d82a

Please sign in to comment.