From 3f327eea079986fe557b931c52f58f32710db0cf Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 11 Mar 2025 16:03:20 +0000 Subject: [PATCH] wallet: fix wallet.make_unsigned_transaction method signature - "fee_policy" arg is actually mandatory - and fix test/stdio guis following fee_policy/config split follow-up https://github.com/spesmilo/electrum/commit/840243e0290e1550927d7d91b8c62dc00e40dede --- electrum/gui/stdio.py | 5 +++-- electrum/gui/text.py | 4 +++- electrum/wallet.py | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/electrum/gui/stdio.py b/electrum/gui/stdio.py index bd1958531..e6abc0866 100644 --- a/electrum/gui/stdio.py +++ b/electrum/gui/stdio.py @@ -13,6 +13,7 @@ from electrum.util import format_satoshis, EventListener, event_listener from electrum.bitcoin import is_address, COIN from electrum.transaction import PartialTxOutput from electrum.network import TxBroadcastError, BestEffortRequestFailed +from electrum.fee_policy import FixedFeePolicy _ = lambda x:x # i18n @@ -33,7 +34,7 @@ class ElectrumGui(BaseElectrumGui, EventListener): password = getpass.getpass('Password:', stream=None) storage.decrypt(password) - db = WalletDB(storage.read(), storage=storage, manual_upgrades=False) + db = WalletDB(storage.read(), storage=storage, upgrade=True) self.done = 0 self.last_balance = "" @@ -214,7 +215,7 @@ class ElectrumGui(BaseElectrumGui, EventListener): tx = self.wallet.create_transaction( outputs=[PartialTxOutput.from_address_and_value(self.str_recipient, amount)], password=password, - fee=fee, + fee_policy=FixedFeePolicy(fee), ) except Exception as e: print(repr(e)) diff --git a/electrum/gui/text.py b/electrum/gui/text.py index 9063e5181..e009a8012 100644 --- a/electrum/gui/text.py +++ b/electrum/gui/text.py @@ -26,6 +26,7 @@ from electrum.storage import WalletStorage from electrum.network import NetworkParameters, TxBroadcastError, BestEffortRequestFailed, ProxySettings from electrum.interface import ServerAddr from electrum.invoices import Invoice +from electrum.fee_policy import FeePolicy if TYPE_CHECKING: from electrum.daemon import Daemon @@ -688,11 +689,12 @@ class ElectrumGui(BaseElectrumGui, EventListener): return else: password = None + fee_policy = FeePolicy(self.config.FEE_POLICY) try: tx = self.wallet.create_transaction( outputs=invoice.outputs, password=password, - fee=None, + fee_policy=fee_policy, ) except Exception as e: self.show_message(repr(e)) diff --git a/electrum/wallet.py b/electrum/wallet.py index e2df92148..8b3e92dd4 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -1821,12 +1821,12 @@ class Abstract_Wallet(ABC, Logger, EventListener): coins: Sequence[PartialTxInput], outputs: List[PartialTxOutput], inputs: Optional[List[PartialTxInput]] = None, - fee_policy: FeePolicy = None, + fee_policy: FeePolicy, change_addr: str = None, is_sweep: bool = False, # used by Wallet_2fa subclass rbf: bool = True, BIP69_sort: Optional[bool] = True, - base_tx: Optional[PartialTransaction] = None, + base_tx: Optional[Transaction] = None, send_change_to_lightning: bool = False, merge_duplicate_outputs: bool = False, ) -> PartialTransaction: @@ -3069,7 +3069,7 @@ class Abstract_Wallet(ABC, Logger, EventListener): self, outputs, *, - fee_policy: FeePolicy=None, + fee_policy: FeePolicy, change_addr=None, domain_addr=None, domain_coins=None,