@@ -154,8 +154,14 @@ async fn main() -> Result<(), anyhow::Error> {
154
154
wallet. apply_update ( resp) ?;
155
155
wallet. persist ( & mut conn) ?;
156
156
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
+ ) ;
159
165
// We should expect tx1 to occur in a future sync
160
166
let exp_spk_txids = wallet
161
167
. tx_graph ( )
@@ -189,8 +195,14 @@ async fn main() -> Result<(), anyhow::Error> {
189
195
wallet. apply_update ( resp) ?;
190
196
wallet. persist ( & mut conn) ?;
191
197
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
+ ) ;
194
206
195
207
// Load the persisted wallet
196
208
{
@@ -201,13 +213,21 @@ async fn main() -> Result<(), anyhow::Error> {
201
213
// tx1 is there, but is not canonical
202
214
assert ! ( wallet. tx_graph( ) . full_txs( ) . any( |node| node. txid == txid1) ) ;
203
215
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( ) )
206
221
. next( )
207
222
. 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
+ ) ;
211
231
}
212
232
213
233
Ok ( ( ) )
0 commit comments