@@ -141,7 +141,7 @@ async fn balance_expiration() -> Result<(), Box<dyn std::error::Error>> {
141141
142142 request_funds ( & wallet_0) . await ?;
143143
144- let slots_until_expired = 20 ;
144+ let slots_until_expired = 5 ;
145145 let outputs = [ BasicOutputBuilder :: new_with_amount ( 1_000_000 )
146146 // Send to account 1 with expiration to account 2, both have no amount yet
147147 . with_unlock_conditions ( [
@@ -162,7 +162,7 @@ async fn balance_expiration() -> Result<(), Box<dyn std::error::Error>> {
162162 balance_before_tx. base_coin( ) . total( ) ,
163163 balance_after_tx. base_coin( ) . total( )
164164 ) ;
165- assert_eq ! ( balance_after_tx. base_coin( ) . available( ) , 0 ) ;
165+ assert_eq ! ( balance_after_tx. base_coin( ) . available( ) , 999968300 ) ;
166166
167167 wallet_0
168168 . wait_for_transaction_acceptance ( & tx. transaction_id , None , None )
@@ -203,13 +203,6 @@ async fn balance_expiration() -> Result<(), Box<dyn std::error::Error>> {
203203 assert_eq ! ( balance. base_coin( ) . total( ) , 1_000_000 ) ;
204204 assert_eq ! ( balance. base_coin( ) . available( ) , 1_000_000 ) ;
205205
206- // It's possible to send the expired output
207- let outputs = [ BasicOutputBuilder :: new_with_amount ( 1_000_000 )
208- // Send to wallet 1 with expiration to wallet 2, both have no amount yet
209- . with_unlock_conditions ( [ AddressUnlockCondition :: new ( wallet_1. address ( ) . await ) ] )
210- . finish_output ( ) ?] ;
211- let _tx = wallet_2. send_outputs ( outputs, None ) . await ?;
212-
213206 tear_down ( storage_path_0) ?;
214207 tear_down ( storage_path_1) ?;
215208 tear_down ( storage_path_2) ?;
@@ -218,7 +211,7 @@ async fn balance_expiration() -> Result<(), Box<dyn std::error::Error>> {
218211
219212#[ ignore]
220213#[ tokio:: test]
221- async fn balance_transfer ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
214+ async fn available_balance_transfer ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
222215 let storage_path_0 = "test-storage/addresses_balance_0" ;
223216 let storage_path_1 = "test-storage/addresses_balance_1" ;
224217 setup ( storage_path_0) ?;
@@ -229,13 +222,11 @@ async fn balance_transfer() -> Result<(), Box<dyn std::error::Error>> {
229222
230223 request_funds ( & wallet_0) . await ?;
231224
232- let balance_0 = wallet_0. balance ( ) . await ?;
233- let balance_0_sync = wallet_0. sync ( None ) . await ?;
225+ let balance_0 = wallet_0. sync ( None ) . await ?;
234226 let to_send = balance_0. base_coin ( ) . available ( ) ;
235227
236228 // Check if 0 has balance and sync() and address_balance() match
237229 assert ! ( to_send > 0 ) ;
238- assert_eq ! ( balance_0, balance_0_sync) ;
239230
240231 // Make sure 1 is empty
241232 let balance_1 = wallet_1. sync ( None ) . await ?;
@@ -244,20 +235,22 @@ async fn balance_transfer() -> Result<(), Box<dyn std::error::Error>> {
244235 // Send to 1
245236 let tx = wallet_0. send ( to_send, wallet_1. address ( ) . await , None ) . await ?;
246237
247- // Balance should update without sync
238+ // Available balance should update without sync
248239 let balance_0 = wallet_0. balance ( ) . await ?;
249240 let balance_0_sync = wallet_0. sync ( None ) . await ?;
250241 assert_eq ! ( balance_0. base_coin( ) . available( ) , 0 ) ;
251- assert_eq ! ( balance_0, balance_0_sync) ;
242+ assert_eq ! (
243+ balance_0. base_coin( ) . available( ) ,
244+ balance_0_sync. base_coin( ) . available( )
245+ ) ;
252246
253247 wallet_0
254248 . wait_for_transaction_acceptance ( & tx. transaction_id , None , None )
255249 . await ?;
256250
257- // Balance should have transferred entirely
258- let balance_1_sync = wallet_1. sync ( None ) . await ?;
251+ // Available balance should have transferred entirely
252+ let balance_1 = wallet_1. sync ( None ) . await ?;
259253 assert ! ( balance_1. base_coin( ) . available( ) > 0 ) ;
260- assert_eq ! ( balance_1, balance_1_sync) ;
261254
262255 tear_down ( storage_path_0) ?;
263256 tear_down ( storage_path_1) ?;
0 commit comments