Skip to content

Commit 62c9f13

Browse files
committed
chore: add docstrings, and (to test) disable the check_burn_view_change() function
1 parent 792fcfc commit 62c9f13

File tree

1 file changed

+19
-5
lines changed
  • testnet/stacks-node/src/nakamoto_node

1 file changed

+19
-5
lines changed

testnet/stacks-node/src/nakamoto_node/miner.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ const ABORT_TRY_AGAIN_MS: u64 = 200;
7878
pub enum MinerDirective {
7979
/// The miner won sortition so they should begin a new tenure
8080
BeginTenure {
81+
/// This is the block ID of the first block in the parent tenure
8182
parent_tenure_start: StacksBlockId,
83+
/// This is the snapshot that this miner won, and will produce a tenure for
8284
burnchain_tip: BlockSnapshot,
85+
/// This is `true` if the snapshot above is known not to be the the latest burnchain tip,
86+
/// but an ancestor of it (for example, the burnchain tip could be an empty flash block, but the
87+
/// miner may nevertheless need to produce a Stacks block with a BlockFound tenure-change
88+
/// transaction for the tenure began by winning `burnchain_tip`'s sortition).
8389
late: bool,
8490
},
8591
/// The miner should try to continue their tenure if they are the active miner
@@ -110,7 +116,17 @@ struct ParentStacksBlockInfo {
110116
#[derive(PartialEq, Clone, Debug)]
111117
pub enum MinerReason {
112118
/// The miner thread was spawned to begin a new tenure
113-
BlockFound { late: bool },
119+
BlockFound {
120+
/// `late` indicates whether or not the tenure that is about to be started corresponds to
121+
/// an ancestor of the canonical tip. This can happen if this miner won the highest
122+
/// sortition, but that sortition's snapshot is not the canonical tip (e.g. the canonical
123+
/// tip may have no sortition, but its parent (or Nth ancestor) would have had a sortition
124+
/// that this miner won, and it would be the latest non-empty sortition ancestor of the
125+
/// tip). This indication is important because the miner would issue a BlockFound
126+
/// tenure-change, and then issue an Extended tenure-change right afterwards in order to
127+
/// update the burnchain view exposed to Clarity for the highest sortition.
128+
late: bool
129+
},
114130
/// The miner thread was spawned to extend an existing tenure
115131
Extended {
116132
/// Current consensus hash on the underlying burnchain. Corresponds to the last-seen
@@ -1015,7 +1031,7 @@ impl BlockMinerThread {
10151031
} else {
10161032
self.keychain.generate_proof(
10171033
self.registered_key.target_block_height,
1018-
self.burn_block.sortition_hash.as_bytes(),
1034+
self.burn_election_block.sortition_hash.as_bytes(),
10191035
)
10201036
};
10211037

@@ -1372,7 +1388,7 @@ impl BlockMinerThread {
13721388
// ongoing tenure is not an ancestor of the given burn view, so it must have
13731389
// advanced (or forked) relative to the given burn view. Either way, this burn
13741390
// view has changed.
1375-
info!("Nakamoto chainstate burn view has changed from miner burn view";
1391+
info!("Nakamoto chainstate burn view has advanced from miner burn view";
13761392
"nakamoto_burn_view" => %ongoing_tenure_id.burn_view_consensus_hash,
13771393
"miner_burn_view" => %burn_view.consensus_hash);
13781394

@@ -1390,8 +1406,6 @@ impl BlockMinerThread {
13901406
sortdb: &SortitionDB,
13911407
chain_state: &mut StacksChainState,
13921408
) -> Result<(), NakamotoNodeError> {
1393-
Self::check_burn_view_changed(sortdb, chain_state, &self.burn_block)?;
1394-
13951409
if let MinerReason::BlockFound { late } = &self.reason {
13961410
if *late && self.last_block_mined.is_none() {
13971411
// this is a late BlockFound tenure change that ought to be appended to the Stacks

0 commit comments

Comments
 (0)