Skip to content

Commit 819daca

Browse files
evanlinjinruben
authored andcommitted
test(chain): Add canonicalization test
Tx anchored in orphaned block and not seen in the mempool should be canon.
1 parent 2e2df01 commit 819daca

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

crates/chain/tests/test_tx_graph_conflicts.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,29 @@ fn test_tx_conflict_handling() {
663663
confirmed: Amount::from_sat(8000),
664664
..Default::default()
665665
}
666+
},
667+
Scenario {
668+
name: "tx anchored in orphaned block and not seen in mempool should be canon",
669+
tx_templates: &[
670+
TxTemplate {
671+
tx_name: "root",
672+
inputs: &[TxInTemplate::Bogus],
673+
outputs: &[TxOutTemplate::new(10_000, None)],
674+
anchors: &[block_id!(1, "B")],
675+
..Default::default()
676+
},
677+
TxTemplate {
678+
tx_name: "tx",
679+
inputs: &[TxInTemplate::PrevTx("root", 0)],
680+
outputs: &[TxOutTemplate::new(9000, Some(0))],
681+
anchors: &[block_id!(6, "not G")],
682+
..Default::default()
683+
},
684+
],
685+
exp_chain_txs: HashSet::from(["root", "tx"]),
686+
exp_chain_txouts: HashSet::from([("tx", 0)]),
687+
exp_unspents: HashSet::from([("tx", 0)]),
688+
exp_balance: Balance { trusted_pending: Amount::from_sat(9000), ..Default::default() }
666689
}
667690
];
668691

0 commit comments

Comments
 (0)