@@ -101,13 +101,18 @@ async fn it_should_allow_outbidding(rig: &TestRig) -> anyhow::Result<()> {
101
101
let alices_balance_updated = rig. spaced . client . wallet_get_balance ( ALICE ) . await ?;
102
102
103
103
assert_eq ! (
104
- alices_spaces. len( ) - 1 ,
105
- alice_spaces_updated. len( ) ,
104
+ alices_spaces. winning . len( ) - 1 ,
105
+ alice_spaces_updated. winning . len( ) ,
106
106
"alice must have one less space"
107
107
) ;
108
+ // assert_eq!(
109
+ // alices_spaces.outbid.len() + 1,
110
+ // alice_spaces_updated.outbid.len(),
111
+ // "alice must have one less space"
112
+ // );
108
113
assert_eq ! (
109
- bobs_spaces. len( ) + 1 ,
110
- bob_spaces_updated. len( ) ,
114
+ bobs_spaces. winning . len( ) + 1 ,
115
+ bob_spaces_updated. winning . len( ) ,
111
116
"bob must have a new space"
112
117
) ;
113
118
assert_eq ! (
@@ -254,8 +259,8 @@ async fn it_should_only_accept_forced_zero_value_bid_increments_and_revoke(
254
259
let eve_spaces_updated = rig. spaced . client . wallet_list_spaces ( EVE ) . await ?;
255
260
256
261
assert_eq ! (
257
- bob_spaces. len( ) - 1 ,
258
- bob_spaces_updated. len( ) ,
262
+ bob_spaces. winning . len( ) - 1 ,
263
+ bob_spaces_updated. winning . len( ) ,
259
264
"bob must have one less space"
260
265
) ;
261
266
assert_eq ! (
@@ -264,8 +269,8 @@ async fn it_should_only_accept_forced_zero_value_bid_increments_and_revoke(
264
269
"alice must be refunded this exact amount"
265
270
) ;
266
271
assert_eq ! (
267
- eve_spaces_updated. len( ) ,
268
- eve_spaces. len( ) ,
272
+ eve_spaces_updated. winning . len( ) ,
273
+ eve_spaces. winning . len( ) ,
269
274
"eve must have the same number of spaces"
270
275
) ;
271
276
@@ -319,7 +324,7 @@ async fn it_should_allow_claim_on_or_after_claim_height(rig: &TestRig) -> anyhow
319
324
rig. wait_until_wallet_synced ( wallet) . await ?;
320
325
let all_spaces_2 = rig. spaced . client . wallet_list_spaces ( wallet) . await ?;
321
326
322
- assert_eq ! ( all_spaces. len( ) , all_spaces_2. len( ) , "must be equal" ) ;
327
+ assert_eq ! ( all_spaces. owned . len( ) + 1 , all_spaces_2. owned . len( ) , "must be equal" ) ;
323
328
324
329
let space = rig
325
330
. spaced
@@ -343,14 +348,9 @@ async fn it_should_allow_batch_transfers_refreshing_expire_height(
343
348
rig. wait_until_synced ( ) . await ?;
344
349
let all_spaces = rig. spaced . client . wallet_list_spaces ( ALICE ) . await ?;
345
350
let registered_spaces: Vec < _ > = all_spaces
351
+ . owned
346
352
. iter ( )
347
- . filter_map ( |s| {
348
- let space = s. space . as_ref ( ) . expect ( "space" ) ;
349
- match space. covenant {
350
- Covenant :: Transfer { .. } => Some ( space. name . to_string ( ) ) ,
351
- _ => None ,
352
- }
353
- } )
353
+ . map ( |out| out. spaceout . space . as_ref ( ) . expect ( "space" ) . name . to_string ( ) )
354
354
. collect ( ) ;
355
355
356
356
let space_address = rig
@@ -380,14 +380,12 @@ async fn it_should_allow_batch_transfers_refreshing_expire_height(
380
380
rig. wait_until_wallet_synced ( ALICE ) . await ?;
381
381
let all_spaces_2 = rig. spaced . client . wallet_list_spaces ( ALICE ) . await ?;
382
382
383
- assert_eq ! ( all_spaces. len( ) , all_spaces_2. len( ) , "must be equal" ) ;
383
+ assert_eq ! ( all_spaces. owned . len( ) , all_spaces_2. owned . len( ) , "must be equal" ) ;
384
384
385
- let mut count = 0 ;
386
- all_spaces_2. iter ( ) . for_each ( |s| {
387
- let space = s. space . as_ref ( ) . expect ( "space" ) ;
385
+ let _ = all_spaces_2. owned . iter ( ) . for_each ( |s| {
386
+ let space = s. spaceout . space . as_ref ( ) . expect ( "space" ) ;
388
387
match space. covenant {
389
388
Covenant :: Transfer { expire_height, .. } => {
390
- count += 1 ;
391
389
assert_eq ! (
392
390
expire_height, expected_expire_height,
393
391
"must refresh expire height"
@@ -396,14 +394,10 @@ async fn it_should_allow_batch_transfers_refreshing_expire_height(
396
394
_ => { }
397
395
}
398
396
} ) ;
397
+
399
398
assert_eq ! (
400
- count,
401
- registered_spaces. len( ) ,
402
- "must keep the exact number of registered spaces"
403
- ) ;
404
- assert_eq ! (
405
- all_spaces. len( ) ,
406
- all_spaces_2. len( ) ,
399
+ all_spaces. winning. len( ) ,
400
+ all_spaces_2. winning. len( ) ,
407
401
"shouldn't change number of held spaces"
408
402
) ;
409
403
@@ -414,16 +408,8 @@ async fn it_should_allow_applying_script_in_batch(rig: &TestRig) -> anyhow::Resu
414
408
rig. wait_until_wallet_synced ( ALICE ) . await ?;
415
409
rig. wait_until_synced ( ) . await ?;
416
410
let all_spaces = rig. spaced . client . wallet_list_spaces ( ALICE ) . await ?;
417
- let registered_spaces: Vec < _ > = all_spaces
418
- . iter ( )
419
- . filter_map ( |s| {
420
- let space = s. space . as_ref ( ) . expect ( "space" ) ;
421
- match space. covenant {
422
- Covenant :: Transfer { .. } => Some ( space. name . to_string ( ) ) ,
423
- _ => None ,
424
- }
425
- } )
426
- . collect ( ) ;
411
+ let registered_spaces: Vec < _ > = all_spaces. owned . iter ( ) . map ( |out|
412
+ out. spaceout . space . as_ref ( ) . expect ( "space" ) . name . to_string ( ) ) . collect ( ) ;
427
413
428
414
let result = wallet_do (
429
415
rig,
@@ -452,17 +438,16 @@ async fn it_should_allow_applying_script_in_batch(rig: &TestRig) -> anyhow::Resu
452
438
rig. wait_until_wallet_synced ( ALICE ) . await ?;
453
439
let all_spaces_2 = rig. spaced . client . wallet_list_spaces ( ALICE ) . await ?;
454
440
455
- assert_eq ! ( all_spaces. len( ) , all_spaces_2. len( ) , "must be equal" ) ;
441
+ assert_eq ! ( all_spaces. owned. len( ) , all_spaces_2. owned. len( ) , "must be equal" ) ;
442
+ assert_eq ! ( all_spaces. winning. len( ) , all_spaces_2. winning. len( ) , "must be equal" ) ;
456
443
457
- let mut count = 0 ;
458
- all_spaces_2. iter ( ) . for_each ( |s| {
459
- let space = s. space . as_ref ( ) . expect ( "space" ) ;
444
+ all_spaces_2. owned . iter ( ) . for_each ( |s| {
445
+ let space = s. spaceout . space . as_ref ( ) . expect ( "space" ) ;
460
446
match & space. covenant {
461
447
Covenant :: Transfer {
462
448
expire_height,
463
449
data,
464
450
} => {
465
- count += 1 ;
466
451
assert_eq ! (
467
452
* expire_height, expected_expire_height,
468
453
"must refresh expire height"
@@ -477,17 +462,6 @@ async fn it_should_allow_applying_script_in_batch(rig: &TestRig) -> anyhow::Resu
477
462
_ => { }
478
463
}
479
464
} ) ;
480
- assert_eq ! (
481
- count,
482
- registered_spaces. len( ) ,
483
- "must keep the exact number of registered spaces"
484
- ) ;
485
- assert_eq ! (
486
- all_spaces. len( ) ,
487
- all_spaces_2. len( ) ,
488
- "shouldn't change number of held spaces"
489
- ) ;
490
-
491
465
Ok ( ( ) )
492
466
}
493
467
@@ -911,25 +885,25 @@ async fn it_can_batch_txs(rig: &TestRig) -> anyhow::Result<()> {
911
885
rig. wait_until_wallet_synced ( BOB ) . await . expect ( "synced" ) ;
912
886
913
887
let bob_spaces = rig. spaced . client . wallet_list_spaces ( BOB ) . await . expect ( "bob spaces" ) ;
914
- assert ! ( bob_spaces. iter( ) . find( |output|
915
- output. space. as_ref( ) . is_some_and( |s| s. name. to_string( ) == "@test9996" ) ) . is_some( ) ,
888
+ assert ! ( bob_spaces. owned . iter( ) . find( |output|
889
+ output. spaceout . space. as_ref( ) . is_some_and( |s| s. name. to_string( ) == "@test9996" ) ) . is_some( ) ,
916
890
"expected bob to own the space name"
917
891
) ;
918
892
919
893
let alice_spaces = rig. spaced . client . wallet_list_spaces ( ALICE ) . await . expect ( "alice spaces" ) ;
920
- let batch1 = alice_spaces. iter ( ) . find ( |output|
921
- output. space . as_ref ( ) . is_some_and ( |s| s. name . to_string ( ) == "@batch1" ) )
922
- . expect ( "exists" ) . space . clone ( ) . expect ( "space exists" ) ;
894
+ let batch1 = alice_spaces. winning . iter ( ) . find ( |output|
895
+ output. spaceout . space . as_ref ( ) . is_some_and ( |s| s. name . to_string ( ) == "@batch1" ) )
896
+ . expect ( "exists" ) . spaceout . space . clone ( ) . expect ( "space exists" ) ;
923
897
924
898
match batch1. covenant {
925
899
Covenant :: Bid { total_burned, .. } => {
926
900
assert_eq ! ( total_burned. to_sat( ) , 1000 , "incorrect burn value" )
927
901
}
928
902
_ => panic ! ( "must be a bid" )
929
903
}
930
- let batch2 = alice_spaces. iter ( ) . find ( |output|
931
- output. space . as_ref ( ) . is_some_and ( |s| s. name . to_string ( ) == "@batch2" ) )
932
- . expect ( "exists" ) . space . clone ( ) . expect ( "space exists" ) ;
904
+ let batch2 = alice_spaces. winning . iter ( ) . find ( |output|
905
+ output. spaceout . space . as_ref ( ) . is_some_and ( |s| s. name . to_string ( ) == "@batch2" ) )
906
+ . expect ( "exists" ) . spaceout . space . clone ( ) . expect ( "space exists" ) ;
933
907
match batch2. covenant {
934
908
Covenant :: Bid { total_burned, .. } => {
935
909
assert_eq ! ( total_burned. to_sat( ) , 1000 , "incorrect burn value" )
@@ -942,9 +916,9 @@ async fn it_can_batch_txs(rig: &TestRig) -> anyhow::Result<()> {
942
916
"@test9999" . to_string( ) ,
943
917
"@test9998" . to_string( )
944
918
] {
945
- let space = alice_spaces. iter ( ) . find ( |output|
946
- output. space . as_ref ( ) . is_some_and ( |s| s. name . to_string ( ) == space) )
947
- . expect ( "exists" ) . space . clone ( ) . expect ( "space exists" ) ;
919
+ let space = alice_spaces. owned . iter ( ) . find ( |output|
920
+ output. spaceout . space . as_ref ( ) . is_some_and ( |s| s. name . to_string ( ) == space) )
921
+ . expect ( "exists" ) . spaceout . space . clone ( ) . expect ( "space exists" ) ;
948
922
949
923
match space. covenant {
950
924
Covenant :: Transfer { data, .. } => {
0 commit comments