Skip to content

Commit

Permalink
Ensure block_assembler's Snapshot.tip_number reach over
Browse files Browse the repository at this point in the history
`shared.Snapshot.tip_number` before `tx_pool.plug_entry`
  • Loading branch information
eval-exec committed Dec 25, 2023
1 parent 5c3e0bb commit 9b4fd38
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions chain/src/tests/block_assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,19 @@ fn test_package_multi_best_scores() {
TxEntry::dummy_resolve(tx3_1.clone(), 0, Capacity::shannons(1000), 1000),
TxEntry::dummy_resolve(tx4_1.clone(), 0, Capacity::shannons(300), 250),
];

let shared_tip_number = shared.snapshot().tip_number().into();
while {
let template_tip_number = tx_pool
.get_block_template(None, None, None)
.expect("must fetch block template result")
.expect("must have block template")
.number;
template_tip_number <= shared_tip_number
} {
std::thread::sleep(std::time::Duration::from_millis(100));
}

tx_pool.plug_entry(entries, PlugTarget::Proposed).unwrap();

// 250 size best scored txs
Expand Down

0 comments on commit 9b4fd38

Please sign in to comment.