electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9616333b39b93388def4f133614c5122fafc00a6
parent 64a8de8bae437c76535eec663f8d2f1d07561241
Author: ThomasV <thomasv@electrum.org>
Date:   Sat, 22 Feb 2020 17:20:05 +0100

add_future_tx should return success

Diffstat:
Melectrum/address_synchronizer.py | 6++++--
Melectrum/lnwatcher.py | 8+++++---
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py @@ -587,8 +587,10 @@ class AddressSynchronizer(Logger): def add_future_tx(self, tx: Transaction, num_blocks: int) -> None: assert num_blocks > 0, num_blocks with self.lock: - self.add_transaction(tx) - self.future_tx[tx.txid()] = num_blocks + tx_was_added = self.add_transaction(tx) + if tx_was_added: + self.future_tx[tx.txid()] = num_blocks + return tx_was_added def get_tx_height(self, tx_hash: str) -> TxMinedInfo: with self.lock: diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py @@ -407,8 +407,10 @@ class LNWalletWatcher(LNWatcher): else: # it's OK to add local transaction, the fee will be recomputed try: - self.lnworker.wallet.add_future_tx(tx, remaining) - self.logger.info(f'adding future tx: {name}. prevout: {prevout}') - self.network.trigger_callback('wallet_updated', self.lnworker.wallet) + tx_was_added = self.lnworker.wallet.add_future_tx(tx, remaining) except Exception as e: self.logger.info(f'could not add future tx: {name}. prevout: {prevout} {str(e)}') + tx_was_added = False + if tx_was_added: + self.logger.info(f'added future tx: {name}. prevout: {prevout}') + self.network.trigger_callback('wallet_updated', self.lnworker.wallet)