@@ -177,9 +177,9 @@ impl RpcWallet {
177
177
dust : unspent
178
178
. into_iter ( )
179
179
. filter ( |output|
180
- ( output . is_spaceout || output . output . txout . value <= SpacesAwareCoinSelection :: DUST_THRESHOLD ) &&
181
- // trusted pending only
182
- ( output. output . confirmation_time . is_confirmed ( ) || output. output . keychain == KeychainKind :: Internal )
180
+ // confirmed or trusted pending only
181
+ ( output . output . confirmation_time . is_confirmed ( ) || output . output . keychain == KeychainKind :: Internal ) &&
182
+ ( output. space . is_some ( ) || output. output . txout . value <= SpacesAwareCoinSelection :: DUST_THRESHOLD )
183
183
)
184
184
. map ( |output| output. output . txout . value )
185
185
. sum ( ) ,
@@ -449,17 +449,22 @@ impl RpcWallet {
449
449
state : & mut LiveSnapshot ,
450
450
confirmed_only : bool ,
451
451
) -> anyhow:: Result < SpacesAwareCoinSelection > {
452
- // Filters out all "space outs" from the selection.
453
- // Note: This exclusion only applies to confirmed space outs; unconfirmed ones are not excluded.
452
+ // Filters out all "spaceouts" with value higher than DUST threshold && all spaceouts representing
453
+ // spaces.
454
+ //
455
+ // Note: This exclusion only applies to confirmed spaceouts; unconfirmed ones are not excluded
456
+ // as we cannot easily detect them for now.
454
457
// In practice, this should be fine since Spaces coin selection skips dust by default,
455
- // so explicitly excluding space outs may be redundant.
458
+ // so explicitly excluding spaceouts may be redundant.
456
459
let excluded = Self :: list_unspent ( wallet, state) ?
457
460
. into_iter ( )
458
- . filter ( |out| out. is_spaceout )
461
+ . filter ( |out| out. space . is_some ( ) ||
462
+ ( out. is_spaceout && out. output . txout . value <= SpacesAwareCoinSelection :: DUST_THRESHOLD )
463
+ )
459
464
. map ( |out| SelectionOutput {
460
465
outpoint : out. output . outpoint ,
461
466
is_space : out. space . is_some ( ) ,
462
- is_spaceout : true ,
467
+ is_spaceout : out . is_spaceout ,
463
468
} )
464
469
. collect :: < Vec < _ > > ( ) ;
465
470
@@ -641,14 +646,14 @@ impl RpcWallet {
641
646
match store. get_space_info ( & spacehash) ? {
642
647
None => return Err ( anyhow ! ( "sendspaces: you don't own `{}`" , space) ) ,
643
648
Some ( full)
644
- if full. spaceout . space . is_none ( )
645
- || !full. spaceout . space . as_ref ( ) . unwrap ( ) . is_owned ( )
646
- || !wallet
647
- . spaces
648
- . is_mine ( full. spaceout . script_pubkey . as_script ( ) ) =>
649
- {
650
- return Err ( anyhow ! ( "sendspaces: you don't own `{}`" , space) ) ;
651
- }
649
+ if full. spaceout . space . is_none ( )
650
+ || !full. spaceout . space . as_ref ( ) . unwrap ( ) . is_owned ( )
651
+ || !wallet
652
+ . spaces
653
+ . is_mine ( full. spaceout . script_pubkey . as_script ( ) ) =>
654
+ {
655
+ return Err ( anyhow ! ( "sendspaces: you don't own `{}`" , space) ) ;
656
+ }
652
657
Some ( full) => {
653
658
builder =
654
659
builder. add_transfer ( TransferRequest :: Space ( SpaceTransfer {
0 commit comments