@ -1258,7 +1258,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
return candidate
return candidate
def get_change_addresses_for_new_transaction (
def get_change_addresses_for_new_transaction (
self , preferred_change_addr = None , * , allow_reuse : bool = True ,
self , preferred_change_addr = None , * , allow_reusing_us ed_change_addrs : bool = True ,
) - > List [ str ] :
) - > List [ str ] :
change_addrs = [ ]
change_addrs = [ ]
if preferred_change_addr :
if preferred_change_addr :
@ -1276,7 +1276,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
change_addrs = addrs
change_addrs = addrs
else :
else :
# if there are none, take one randomly from the last few
# if there are none, take one randomly from the last few
if not allow_reuse :
if not allow_reusing_us ed_change_addrs :
return [ ]
return [ ]
addrs = self . get_change_addresses ( slice_start = - self . gap_limit_for_change )
addrs = self . get_change_addresses ( slice_start = - self . gap_limit_for_change )
change_addrs = [ random . choice ( addrs ) ] if addrs else [ ]
change_addrs = [ random . choice ( addrs ) ] if addrs else [ ]
@ -1289,11 +1289,11 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
return change_addrs [ : max_change ]
return change_addrs [ : max_change ]
def get_single_change_address_for_new_transaction (
def get_single_change_address_for_new_transaction (
self , preferred_change_addr = None , * , allow_reuse : bool = True ,
self , preferred_change_addr = None , * , allow_reusing_us ed_change_addrs : bool = True ,
) - > Optional [ str ] :
) - > Optional [ str ] :
addrs = self . get_change_addresses_for_new_transaction (
addrs = self . get_change_addresses_for_new_transaction (
preferred_change_addr = preferred_change_addr ,
preferred_change_addr = preferred_change_addr ,
allow_reuse = allow_reuse ,
allow_reusing_us ed_change_addrs = allow_reusing_us ed_change_addrs ,
)
)
if addrs :
if addrs :
return addrs [ 0 ]
return addrs [ 0 ]
@ -1801,7 +1801,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
if not item :
if not item :
raise CannotCPFP ( _ ( " Could not find coins for output " ) )
raise CannotCPFP ( _ ( " Could not find coins for output " ) )
inputs = [ item ]
inputs = [ item ]
out_address = ( self . get_single_change_address_for_new_transaction ( allow_reuse = False )
out_address = ( self . get_single_change_address_for_new_transaction ( allow_reusing_us ed_change_addrs = False )
or self . get_unused_address ( )
or self . get_unused_address ( )
or address )
or address )
output_value = value - fee
output_value = value - fee