@@ -154,8 +154,14 @@ async fn main() -> Result<(), anyhow::Error> {
154154 wallet. apply_update ( resp) ?;
155155 wallet. persist ( & mut conn) ?;
156156
157- assert_eq ! ( wallet. balance( ) . total( ) , Amount :: ONE_BTC ) ;
158- println ! ( "Balance after send tx1: {}" , wallet. balance( ) . total( ) ) ;
157+ assert_eq ! (
158+ wallet. balance( wallet. include_unbroadcasted( ) ) . total( ) ,
159+ Amount :: ONE_BTC
160+ ) ;
161+ println ! (
162+ "Balance after send tx1: {}" ,
163+ wallet. balance( wallet. include_unbroadcasted( ) ) . total( )
164+ ) ;
159165 // We should expect tx1 to occur in a future sync
160166 let exp_spk_txids = wallet
161167 . tx_graph ( )
@@ -189,8 +195,14 @@ async fn main() -> Result<(), anyhow::Error> {
189195 wallet. apply_update ( resp) ?;
190196 wallet. persist ( & mut conn) ?;
191197
192- println ! ( "Balance after send tx2: {}" , wallet. balance( ) . total( ) ) ;
193- assert_eq ! ( wallet. balance( ) . total( ) , Amount :: ZERO ) ;
198+ println ! (
199+ "Balance after send tx2: {}" ,
200+ wallet. balance( wallet. include_unbroadcasted( ) ) . total( )
201+ ) ;
202+ assert_eq ! (
203+ wallet. balance( wallet. include_unbroadcasted( ) ) . total( ) ,
204+ Amount :: ZERO
205+ ) ;
194206
195207 // Load the persisted wallet
196208 {
@@ -201,13 +213,21 @@ async fn main() -> Result<(), anyhow::Error> {
201213 // tx1 is there, but is not canonical
202214 assert ! ( wallet. tx_graph( ) . full_txs( ) . any( |node| node. txid == txid1) ) ;
203215 assert ! ( wallet
204- . tx_graph( )
205- . list_canonical_txs( wallet. local_chain( ) , wallet. local_chain( ) . tip( ) . block_id( ) )
216+ . transactions( wallet. include_unbroadcasted( ) )
217+ . next( )
218+ . is_none( ) ) ;
219+ assert ! ( wallet
220+ . list_unspent( wallet. include_unbroadcasted( ) )
206221 . next( )
207222 . is_none( ) ) ;
208- assert ! ( wallet. list_unspent( ) . next( ) . is_none( ) ) ;
209- assert_eq ! ( wallet. balance( ) . total( ) , Amount :: ZERO ) ;
210- println ! ( "Balance after load wallet: {}" , wallet. balance( ) . total( ) ) ;
223+ assert_eq ! (
224+ wallet. balance( wallet. include_unbroadcasted( ) ) . total( ) ,
225+ Amount :: ZERO
226+ ) ;
227+ println ! (
228+ "Balance after load wallet: {}" ,
229+ wallet. balance( wallet. include_unbroadcasted( ) ) . total( )
230+ ) ;
211231 }
212232
213233 Ok ( ( ) )
0 commit comments