Skip to content

Commit 77cc93e

Browse files
committed
Sep block processing and commit processing in mine_nakamoto_block and wait for block commit at correct height
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent b14efd5 commit 77cc93e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

stacks-node/src/tests/signer/mod.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,6 @@ impl<Z: SpawnedSignerTrait> SignerTest<Z> {
11171117

11181118
let commits_before = commits_submitted.load(Ordering::SeqCst);
11191119
let commit_burn_height_before = commits_last_burn_height.load(Ordering::SeqCst);
1120-
let commits_stacks_tip_before = commits_last_stacks_tip.load(Ordering::SeqCst);
11211120
let mined_before = mined_blocks.load(Ordering::SeqCst);
11221121

11231122
let mined_btc_block_time = Instant::now();
@@ -1141,17 +1140,23 @@ impl<Z: SpawnedSignerTrait> SignerTest<Z> {
11411140
info!("Unpausing stacks block mining");
11421141
let mined_block_time = Instant::now();
11431142
TEST_MINE_SKIP.set(false);
1144-
// Ensure that the tenure change transaction is mined and that the subsequent block commit confirms it
1143+
// Do these wait for's in two steps not only for increased timeout but for easier debugging.
1144+
// Ensure that the tenure change transaction is mined
11451145
wait_for(timeout.as_secs(), || {
1146-
Ok(commits_submitted.load(Ordering::SeqCst) > commits_before
1147-
&& commits_last_burn_height.load(Ordering::SeqCst) > commit_burn_height_before
1148-
&& commits_last_stacks_tip.load(Ordering::SeqCst) > commits_stacks_tip_before
1149-
&& get_chain_info(&self.running_nodes.conf).stacks_tip_height
1150-
> info_before.stacks_tip_height
1146+
Ok(get_chain_info(&self.running_nodes.conf).stacks_tip_height
1147+
> info_before.stacks_tip_height
11511148
&& (!use_nakamoto_blocks_mined
11521149
|| mined_blocks.load(Ordering::SeqCst) > mined_before))
11531150
})
11541151
.expect("Failed to mine Tenure Change block");
1152+
// Ensure the subsequent block commit confirms the previous Tenure Change block
1153+
let stacks_tip_height = get_chain_info(&self.running_nodes.conf).stacks_tip_height;
1154+
wait_for(timeout.as_secs(), || {
1155+
Ok(commits_submitted.load(Ordering::SeqCst) > commits_before
1156+
&& commits_last_burn_height.load(Ordering::SeqCst) > commit_burn_height_before
1157+
&& commits_last_stacks_tip.load(Ordering::SeqCst) >= stacks_tip_height)
1158+
})
1159+
.expect("Failed to update Block Commit");
11551160
info!(
11561161
"Nakamoto block mine time elapsed: {:?}",
11571162
mined_block_time.elapsed()

stacks-node/src/tests/signer/v0.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17658,7 +17658,8 @@ fn rollover_signer_protocol_version() {
1765817658
let block = wait_for_block_pushed_by_miner_key(60, info.stacks_tip_height + 1, &expected_miner)
1765917659
.expect("Failed to mine block after downgraded version number.");
1766017660
// Expect ALL signers even after downgrade to approve the proposed blocks
17661-
wait_for_block_acceptance_from_signers(30, &block.header.signer_signature_hash(), &all_signers);
17661+
wait_for_block_acceptance_from_signers(30, &block.header.signer_signature_hash(), &all_signers)
17662+
.expect("Failed to confirm all signers accepted last block");
1766217663

1766317664
info!("------------------------- Reset All Signers to {SUPPORTED_SIGNER_PROTOCOL_VERSION} -------------------------");
1766417665
TEST_PIN_SUPPORTED_SIGNER_PROTOCOL_VERSION.set(HashMap::new());

0 commit comments

Comments
 (0)