Skip to content

Commit

Permalink
chore: Add explicit panic if stacks-inspect try-mine tries to mine …
Browse files Browse the repository at this point in the history
…on Nakamoto chainstate
  • Loading branch information
jbencin committed Dec 13, 2024
1 parent 1767ee0 commit 1eef7e8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions stackslib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,15 @@ pub fn command_try_mine(argv: &[String], conf: Option<&Config>) {
.unwrap_or_else(|e| panic!("Error looking up chain tip: {e}"))
.expect("No chain tip found");

// Fail if Nakamoto chainstate detected. `try-mine` cannot mine Nakamoto blocks yet
// TODO: Add Nakamoto block support
if matches!(
&tip_header.anchored_header,
StacksBlockHeaderTypes::Nakamoto(..)
) {
panic!("Attempting to mine Nakamoto block. Nakamoto blocks not supported yet!");
};

let sk = StacksPrivateKey::new();
let mut tx_auth = TransactionAuth::from_p2pkh(&sk).unwrap();
tx_auth.set_origin_nonce(0);
Expand Down

0 comments on commit 1eef7e8

Please sign in to comment.