File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -552,3 +552,30 @@ fn chain_update(
552
552
}
553
553
Ok ( tip)
554
554
}
555
+
556
+ #[ cfg( test) ]
557
+ mod test {
558
+ use crate :: { bdk_electrum_client:: TxUpdate , BdkElectrumClient } ;
559
+ use bdk_testenv:: { utils:: new_tx, TestEnv } ;
560
+
561
+ #[ cfg( feature = "default" ) ]
562
+ #[ test]
563
+ fn test_populate_with_txids_without_output ( ) {
564
+ let env = TestEnv :: new ( ) . unwrap ( ) ;
565
+ let electrum_client =
566
+ electrum_client:: Client :: new ( env. electrsd . electrum_url . as_str ( ) ) . unwrap ( ) ;
567
+ let client = BdkElectrumClient :: new ( electrum_client) ;
568
+
569
+ // Setup transaction with no outputs.
570
+ let tx = new_tx ( 0 ) ;
571
+
572
+ // Populate tx_cache with `tx` to make it fetchable.
573
+ client. populate_tx_cache ( vec ! [ tx. clone( ) ] ) ;
574
+
575
+ // Test that populate_with_txids does not panic or process a tx with no output.
576
+ let mut tx_update = TxUpdate :: default ( ) ;
577
+ let _ = client. populate_with_txids ( & mut tx_update, vec ! [ tx. compute_txid( ) ] ) ;
578
+
579
+ assert_eq ! ( tx_update. txs, Vec :: new( ) ) ;
580
+ }
581
+ }
You can’t perform that action at this time.
0 commit comments