Skip to content

Commit 7591cff

Browse files
committed
Hide the shame! call get block_tenure_b AFTER wiaitng for block b
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent c6f128f commit 7591cff

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,9 +3279,6 @@ fn forked_tenure_is_ignored() {
32793279
// Unpause the broadcast of Tenure B's block, do not submit commits.
32803280
TEST_SKIP_COMMIT_OP.lock().unwrap().replace(true);
32813281
TEST_BROADCAST_STALL.lock().unwrap().replace(false);
3282-
let block_tenure_b = NakamotoChainState::get_canonical_block_header(chainstate.db(), &sortdb)
3283-
.unwrap()
3284-
.unwrap();
32853282

32863283
// Wait for a stacks block to be broadcasted
32873284
let start_time = Instant::now();
@@ -3293,6 +3290,10 @@ fn forked_tenure_is_ignored() {
32933290
thread::sleep(Duration::from_secs(1));
32943291
}
32953292

3293+
let block_tenure_b = NakamotoChainState::get_canonical_block_header(chainstate.db(), &sortdb)
3294+
.unwrap()
3295+
.unwrap();
3296+
32963297
info!("Tenure B broadcasted a block. Issue the next bitcon block and unstall block commits.");
32973298

32983299
info!("Starting tenure C.");
@@ -3312,14 +3313,14 @@ fn forked_tenure_is_ignored() {
33123313
.unwrap()
33133314
.unwrap();
33143315

3316+
assert_ne!(block_tenure_b, block_tenure_a);
33153317
assert_ne!(block_tenure_b, block_tenure_c);
3316-
// TODO: I don't understand this. Shouldn't it be also one block past block tenure a's block height? Why is it the same as block tenure A's height?
3318+
// Block B was built atop block A
33173319
assert_eq!(
33183320
block_tenure_b.stacks_block_height,
3319-
block_tenure_a.stacks_block_height
3321+
block_tenure_a.stacks_block_height + 1
33203322
);
3321-
// Block C was built AFTER block A, but before block B, so it should be built off of block A
3322-
// therefore it will be one ahead of its block height
3323+
// Block C was built AFTER Block B was built, but BEFORE it was broadcasted, so it should be built off of Block A
33233324
assert_eq!(
33243325
block_tenure_c.stacks_block_height,
33253326
block_tenure_a.stacks_block_height + 1

0 commit comments

Comments
 (0)