add_future_tx should return success

This commit is contained in:
ThomasV 2020-02-22 17:20:05 +01:00
parent 64a8de8bae
commit 9616333b39
2 changed files with 9 additions and 5 deletions

View file

@ -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:

View file

@ -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)