]> Untitled Git - bdk/commitdiff
test(chain): Add scenario: coinbase tx must not become unconfirmed
author志宇 <hello@evanlinjin.me>
Fri, 13 Jun 2025 03:12:59 +0000 (13:12 +1000)
committer志宇 <hello@evanlinjin.me>
Thu, 10 Jul 2025 03:04:24 +0000 (03:04 +0000)
crates/chain/tests/test_tx_graph_conflicts.rs

index 862eb9b4bc148b29a77f6a51e5c68706f596b29b..71944e404b9fbf7a9f8bc1f1183246f01ee1c04b 100644 (file)
@@ -943,6 +943,28 @@ fn test_tx_conflict_handling() {
                 confirmed: Amount::ZERO,
             },
         },
+        Scenario {
+            name: "coinbase tx must not become unconfirmed",
+            tx_templates: &[
+                TxTemplate {
+                    tx_name: "coinbase",
+                    inputs: &[TxInTemplate::Coinbase],
+                    outputs: &[TxOutTemplate::new(21_000, Some(0))],
+                    // Stale block
+                    anchors: &[block_id!(1, "B-prime")],
+                    ..Default::default()
+                }
+            ],
+            exp_chain_txs: HashSet::from([]),
+            exp_chain_txouts: HashSet::from([]),
+            exp_unspents: HashSet::from([]),
+            exp_balance: Balance {
+                immature: Amount::ZERO,
+                trusted_pending: Amount::ZERO,
+                untrusted_pending: Amount::ZERO,
+                confirmed: Amount::ZERO,
+            }
+        }
     ];
 
     for scenario in scenarios {