Skip to content

Commit d537741

Browse files
committed
chore: replace reject code InvalidParentTenure with ReorgNotAllowed
1 parent 040eeab commit d537741

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

libsigner/src/v0/messages.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,12 @@ RejectCodeTypePrefix {
553553
NotLatestSortitionWinner = 10,
554554
/// The block does not confirm the expected parent block
555555
InvalidParentBlock = 11,
556-
/// The block does not confirm the expected parent tenure
557-
InvalidParentTenure = 12,
558556
/// The block contains a block found tenure change, but we've already seen
559557
/// a block found
560-
DuplicateBlockFound = 13,
558+
DuplicateBlockFound = 12,
561559
/// The block attempted a tenure extend but the burn view has not changed
562560
/// and not enough time has passed for a time-based tenure extend
563-
InvalidTenureExtend = 14
561+
InvalidTenureExtend = 13
564562
});
565563

566564
impl TryFrom<u8> for RejectCodeTypePrefix {
@@ -587,7 +585,6 @@ impl From<&RejectCode> for RejectCodeTypePrefix {
587585
RejectCode::InvalidMiner => RejectCodeTypePrefix::InvalidMiner,
588586
RejectCode::NotLatestSortitionWinner => RejectCodeTypePrefix::NotLatestSortitionWinner,
589587
RejectCode::InvalidParentBlock => RejectCodeTypePrefix::InvalidParentBlock,
590-
RejectCode::InvalidParentTenure => RejectCodeTypePrefix::InvalidParentTenure,
591588
RejectCode::DuplicateBlockFound => RejectCodeTypePrefix::DuplicateBlockFound,
592589
RejectCode::InvalidTenureExtend => RejectCodeTypePrefix::InvalidTenureExtend,
593590
}
@@ -622,8 +619,6 @@ pub enum RejectCode {
622619
NotLatestSortitionWinner,
623620
/// The block does not confirm the expected parent block
624621
InvalidParentBlock,
625-
/// The block does not confirm the expected parent tenure
626-
InvalidParentTenure,
627622
/// The block contains a block found tenure change, but we've already seen
628623
/// a block found
629624
DuplicateBlockFound,
@@ -1132,7 +1127,6 @@ impl StacksMessageCodec for RejectCode {
11321127
| RejectCode::InvalidMiner
11331128
| RejectCode::NotLatestSortitionWinner
11341129
| RejectCode::InvalidParentBlock
1135-
| RejectCode::InvalidParentTenure
11361130
| RejectCode::DuplicateBlockFound
11371131
| RejectCode::InvalidTenureExtend => {
11381132
// No additional data to serialize / deserialize
@@ -1166,7 +1160,6 @@ impl StacksMessageCodec for RejectCode {
11661160
RejectCodeTypePrefix::InvalidMiner => RejectCode::InvalidMiner,
11671161
RejectCodeTypePrefix::NotLatestSortitionWinner => RejectCode::NotLatestSortitionWinner,
11681162
RejectCodeTypePrefix::InvalidParentBlock => RejectCode::InvalidParentBlock,
1169-
RejectCodeTypePrefix::InvalidParentTenure => RejectCode::InvalidParentTenure,
11701163
RejectCodeTypePrefix::DuplicateBlockFound => RejectCode::DuplicateBlockFound,
11711164
RejectCodeTypePrefix::InvalidTenureExtend => RejectCode::InvalidTenureExtend,
11721165
};
@@ -1202,7 +1195,7 @@ impl std::fmt::Display for RejectCode {
12021195
RejectCode::ReorgNotAllowed => {
12031196
write!(
12041197
f,
1205-
"The block attempted to reorg the previous tenure but was not allowed."
1198+
"The block attempted to reorg the previous tenure(s) but was not allowed."
12061199
)
12071200
}
12081201
RejectCode::InvalidBitvec => {
@@ -1226,9 +1219,6 @@ impl std::fmt::Display for RejectCode {
12261219
RejectCode::InvalidParentBlock => {
12271220
write!(f, "The block does not confirm the expected parent block.")
12281221
}
1229-
RejectCode::InvalidParentTenure => {
1230-
write!(f, "The block does not confirm the expected parent tenure.")
1231-
}
12321222
RejectCode::DuplicateBlockFound => {
12331223
write!(
12341224
f,

stacks-signer/src/chainstate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ impl SortitionsView {
679679
&self.config.first_proposal_burn_block_timing,
680680
)?;
681681
if !is_valid_parent_tenure {
682-
return Err(RejectCode::InvalidParentTenure);
682+
return Err(RejectCode::ReorgNotAllowed);
683683
}
684684
let last_in_current_tenure = signer_db
685685
.get_last_globally_accepted_block(&block.header.consensus_hash)

0 commit comments

Comments
 (0)