Stop generating V1-V3 transactions for non-finalized state proptests (#2159)

These transactions cause a test panic in `UpdateWith`, in the rare cases
where the test gets that far.
This commit is contained in:
teor 2021-05-20 08:53:44 +10:00 committed by GitHub
parent bf72d6dbc0
commit 55e398c10a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -0,0 +1 @@
cc 693962399f2771634758dccac882604c14751015ac280113fa9127fa96376c3a # entered unreachable code: older transaction versions only exist in finalized blocks pre sapling; PreparedBlock { .. , Block { .. , transactions: [V2 { .. }, .. ] } };

View File

@ -49,18 +49,11 @@ impl Strategy for PreparedChain {
fn new_tree(&self, runner: &mut TestRunner) -> NewTree<Self> {
let mut chain = self.chain.lock().unwrap();
if chain.is_none() {
let ledger_strategy = LedgerState::coinbase_strategy();
// Only generate blocks from the most recent network upgrade
let mut ledger_state = LedgerState::default();
ledger_state.network_upgrade_override = None;
// Disable the NU5 override until UpdateWith is implemented for Tx v5 (#1982)
let ledger_strategy = ledger_strategy.prop_map(|mut ledger_state| {
ledger_state.network_upgrade_override = None;
ledger_state
});
let blocks = ledger_strategy
.prop_flat_map(|ledger_state| {
Block::partial_chain_strategy(ledger_state, MAX_PARTIAL_CHAIN_BLOCKS)
})
let blocks = Block::partial_chain_strategy(ledger_state, MAX_PARTIAL_CHAIN_BLOCKS)
.prop_map(|vec| vec.into_iter().map(|blk| blk.prepare()).collect::<Vec<_>>())
.new_tree(runner)?
.current();