@@ -455,7 +455,7 @@ macro_rules! bdk_blockchain_tests {
455
455
assert!( wallet. database( ) . deref( ) . get_sync_time( ) . unwrap( ) . is_some( ) , "sync_time hasn't been updated" ) ;
456
456
457
457
assert_eq!( wallet. get_balance( ) . unwrap( ) . untrusted_pending, 50_000 , "incorrect balance" ) ;
458
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) [ 0 ] . keychain, KeychainKind :: External , "incorrect keychain kind" ) ;
458
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . next ( ) . unwrap ( ) . keychain, KeychainKind :: External , "incorrect keychain kind" ) ;
459
459
460
460
let list_tx_item = & wallet. list_transactions( false ) . unwrap( ) [ 0 ] ;
461
461
assert_eq!( list_tx_item. txid, txid, "incorrect txid" ) ;
@@ -518,7 +518,7 @@ macro_rules! bdk_blockchain_tests {
518
518
519
519
assert_eq!( wallet. get_balance( ) . unwrap( ) . untrusted_pending, 105_000 , "incorrect balance" ) ;
520
520
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 1 , "incorrect number of txs" ) ;
521
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 3 , "incorrect number of unspents" ) ;
521
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 3 , "incorrect number of unspents" ) ;
522
522
523
523
let list_tx_item = & wallet. list_transactions( false ) . unwrap( ) [ 0 ] ;
524
524
assert_eq!( list_tx_item. txid, txid, "incorrect txid" ) ;
@@ -542,7 +542,7 @@ macro_rules! bdk_blockchain_tests {
542
542
543
543
assert_eq!( wallet. get_balance( ) . unwrap( ) . untrusted_pending, 75_000 , "incorrect balance" ) ;
544
544
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 2 , "incorrect number of txs" ) ;
545
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 2 , "incorrect number of unspent" ) ;
545
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 2 , "incorrect number of unspent" ) ;
546
546
}
547
547
548
548
#[ test]
@@ -576,7 +576,7 @@ macro_rules! bdk_blockchain_tests {
576
576
577
577
assert_eq!( wallet. get_balance( ) . unwrap( ) . untrusted_pending, 50_000 , "incorrect balance" ) ;
578
578
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 1 , "incorrect number of txs" ) ;
579
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 1 , "incorrect unspent" ) ;
579
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 1 , "incorrect unspent" ) ;
580
580
581
581
let list_tx_item = & wallet. list_transactions( false ) . unwrap( ) [ 0 ] ;
582
582
assert_eq!( list_tx_item. txid, txid, "incorrect txid" ) ;
@@ -590,7 +590,7 @@ macro_rules! bdk_blockchain_tests {
590
590
591
591
assert_eq!( wallet. get_balance( ) . unwrap( ) . untrusted_pending, 50_000 , "incorrect balance after bump" ) ;
592
592
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 1 , "incorrect number of txs after bump" ) ;
593
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 1 , "incorrect unspent after bump" ) ;
593
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 1 , "incorrect unspent after bump" ) ;
594
594
595
595
let list_tx_item = & wallet. list_transactions( false ) . unwrap( ) [ 0 ] ;
596
596
assert_eq!( list_tx_item. txid, new_txid, "incorrect txid after bump" ) ;
@@ -613,7 +613,7 @@ macro_rules! bdk_blockchain_tests {
613
613
wallet. sync( & blockchain, SyncOptions :: default ( ) ) . unwrap( ) ;
614
614
assert_eq!( wallet. get_balance( ) . unwrap( ) . get_spendable( ) , 50_000 , "incorrect balance" ) ;
615
615
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 1 , "incorrect number of txs" ) ;
616
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 1 , "incorrect number of unspents" ) ;
616
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 1 , "incorrect number of unspents" ) ;
617
617
618
618
let list_tx_item = & wallet. list_transactions( false ) . unwrap( ) [ 0 ] ;
619
619
assert_eq!( list_tx_item. txid, txid, "incorrect txid" ) ;
@@ -661,7 +661,7 @@ macro_rules! bdk_blockchain_tests {
661
661
assert_eq!( wallet. get_balance( ) . unwrap( ) . confirmed, details. received, "incorrect balance after send" ) ;
662
662
663
663
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 2 , "incorrect number of txs" ) ;
664
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 1 , "incorrect number of unspents" ) ;
664
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 1 , "incorrect number of unspents" ) ;
665
665
}
666
666
667
667
// Syncing wallet should not result in wallet address index to decrement.
@@ -1178,7 +1178,7 @@ macro_rules! bdk_blockchain_tests {
1178
1178
wallet. sync( & blockchain, SyncOptions :: default ( ) ) . unwrap( ) ;
1179
1179
assert_eq!( wallet. get_balance( ) . unwrap( ) . get_spendable( ) , details. received, "wallet has incorrect balance after send" ) ;
1180
1180
assert_eq!( wallet. list_transactions( false ) . unwrap( ) . len( ) , 2 , "wallet has incorrect number of txs" ) ;
1181
- assert_eq!( wallet. list_unspent ( ) . unwrap( ) . len ( ) , 1 , "wallet has incorrect number of unspents" ) ;
1181
+ assert_eq!( wallet. iter_unspent ( ) . unwrap( ) . count ( ) , 1 , "wallet has incorrect number of unspents" ) ;
1182
1182
test_client. generate( 1 , None ) ;
1183
1183
1184
1184
// 5. Verify 25_000 sats are received by test bitcoind node taproot wallet
@@ -1249,7 +1249,7 @@ macro_rules! bdk_blockchain_tests {
1249
1249
let initial_tx = psbt. extract_tx( ) ;
1250
1250
let _sent_txid = blockchain. broadcast( & initial_tx) . unwrap( ) ;
1251
1251
wallet. sync( & blockchain, SyncOptions :: default ( ) ) . unwrap( ) ;
1252
- for utxo in wallet. list_unspent ( ) . unwrap( ) {
1252
+ for utxo in wallet. iter_unspent ( ) . unwrap( ) {
1253
1253
// Making sure the TXO we just spent is not returned by list_unspent
1254
1254
assert!( utxo. outpoint != initial_tx. input[ 0 ] . previous_output, "wallet displays spent txo in unspents" ) ;
1255
1255
}
@@ -1265,7 +1265,7 @@ macro_rules! bdk_blockchain_tests {
1265
1265
builder
1266
1266
. add_utxo( initial_tx. input[ 0 ] . previous_output)
1267
1267
. expect( "Can't manually add an UTXO spent" ) ;
1268
- for utxo in wallet. list_unspent ( ) . unwrap( ) {
1268
+ for utxo in wallet. iter_unspent ( ) . unwrap( ) {
1269
1269
// Making sure the TXO we just spent is not returned by list_unspent
1270
1270
assert!( utxo. outpoint != initial_tx. input[ 0 ] . previous_output, "wallet displays spent txo in unspents" ) ;
1271
1271
}
0 commit comments