diff --git a/electrum/wallet.py b/electrum/wallet.py index 2ef1eaa28..3683eae8f 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -1258,7 +1258,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): return candidate def get_change_addresses_for_new_transaction( - self, preferred_change_addr=None, *, allow_reuse: bool = True, + self, preferred_change_addr=None, *, allow_reusing_used_change_addrs: bool = True, ) -> List[str]: change_addrs = [] if preferred_change_addr: @@ -1276,7 +1276,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): change_addrs = addrs else: # if there are none, take one randomly from the last few - if not allow_reuse: + if not allow_reusing_used_change_addrs: return [] addrs = self.get_change_addresses(slice_start=-self.gap_limit_for_change) change_addrs = [random.choice(addrs)] if addrs else [] @@ -1289,11 +1289,11 @@ class Abstract_Wallet(AddressSynchronizer, ABC): return change_addrs[:max_change] def get_single_change_address_for_new_transaction( - self, preferred_change_addr=None, *, allow_reuse: bool = True, + self, preferred_change_addr=None, *, allow_reusing_used_change_addrs: bool = True, ) -> Optional[str]: addrs = self.get_change_addresses_for_new_transaction( preferred_change_addr=preferred_change_addr, - allow_reuse=allow_reuse, + allow_reusing_used_change_addrs=allow_reusing_used_change_addrs, ) if addrs: return addrs[0] @@ -1801,7 +1801,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): if not item: raise CannotCPFP(_("Could not find coins for output")) 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_used_change_addrs=False) or self.get_unused_address() or address) output_value = value - fee