Skip to content

Commit 1eef7e8

Browse files
committed
chore: Add explicit panic if stacks-inspect try-mine tries to mine on Nakamoto chainstate
1 parent 1767ee0 commit 1eef7e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stackslib/src/cli.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,15 @@ pub fn command_try_mine(argv: &[String], conf: Option<&Config>) {
443443
.unwrap_or_else(|e| panic!("Error looking up chain tip: {e}"))
444444
.expect("No chain tip found");
445445

446+
// Fail if Nakamoto chainstate detected. `try-mine` cannot mine Nakamoto blocks yet
447+
// TODO: Add Nakamoto block support
448+
if matches!(
449+
&tip_header.anchored_header,
450+
StacksBlockHeaderTypes::Nakamoto(..)
451+
) {
452+
panic!("Attempting to mine Nakamoto block. Nakamoto blocks not supported yet!");
453+
};
454+
446455
let sk = StacksPrivateKey::new();
447456
let mut tx_auth = TransactionAuth::from_p2pkh(&sk).unwrap();
448457
tx_auth.set_origin_nonce(0);

0 commit comments

Comments
 (0)