commit 79681c90e024d5a714861886a4bd56ac308878ee
parent 880bd168835a703832dccb368099ec3cd2bdbb63
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 17 Dec 2019 22:12:51 +0100
wallet._is_onchain_invoice_paid: support "zero amount" invoice
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/electrum/wallet.py b/electrum/wallet.py
@@ -679,6 +679,10 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
prevouts_and_values = self.db.get_prevouts_by_scripthash(scripthash)
relevant_txs += [prevout.txid.hex() for prevout, v in prevouts_and_values]
total_received = sum([v for prevout, v in prevouts_and_values])
+ # check that there is at least one TXO, and that they pay enough.
+ # note: "at least one TXO" check is needed for zero amount invoice (e.g. OP_RETURN)
+ if len(prevouts_and_values) == 0:
+ return False, []
if total_received < invoice_amt:
return False, []
return True, relevant_txs