tfix #6859: height is must be passed to OnchainInvoice constructor - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit b08f9f3581794b32c5c34a1a8433a47beb20c152 DIR parent d44581e07225fd16eba6854c5618079311060c63 HTML Author: ThomasV <thomasv@electrum.org> Date: Fri, 18 Dec 2020 10:49:45 +0100 fix #6859: height is must be passed to OnchainInvoice constructor Diffstat: M electrum/invoices.py | 3 ++- M electrum/wallet.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) --- DIR diff --git a/electrum/invoices.py b/electrum/invoices.py t@@ -128,7 +128,7 @@ class OnchainInvoice(Invoice): return self.amount_sat or 0 @classmethod - def from_bip70_payreq(cls, pr: 'PaymentRequest') -> 'OnchainInvoice': + def from_bip70_payreq(cls, pr: 'PaymentRequest', height:int) -> 'OnchainInvoice': return OnchainInvoice( type=PR_TYPE_ONCHAIN, amount_sat=pr.get_amount(), t@@ -139,6 +139,7 @@ class OnchainInvoice(Invoice): exp=pr.get_expiration_date() - pr.get_time(), bip70=pr.raw.hex(), requestor=pr.get_requestor(), + height=height, ) @attr.s DIR diff --git a/electrum/wallet.py b/electrum/wallet.py t@@ -704,8 +704,9 @@ class Abstract_Wallet(AddressSynchronizer, ABC): } def create_invoice(self, *, outputs: List[PartialTxOutput], message, pr, URI) -> Invoice: + height=self.get_local_height() if pr: - return OnchainInvoice.from_bip70_payreq(pr) + return OnchainInvoice.from_bip70_payreq(pr, height) if '!' in (x.value for x in outputs): amount = '!' else: t@@ -728,7 +729,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): exp=exp, bip70=None, requestor=None, - height=self.get_local_height(), + height=height, ) return invoice