electrum

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

commit 795ba1f99d36aaeab7dd83023530dff214189e10
parent f9f1805cdf6eded3ceec74420af7397a2ea9b9e3
Author: Janus <ysangkok@gmail.com>
Date:   Tue, 30 Oct 2018 20:25:56 +0100

lnwatcher: ensure probable spendability of prev_tx

previously, we would try to publish the second_stage
even if we couldn't, because a conflicting transaction
was published (like an htlc success when we close with
htlcs pending with a 1-hop payment and an online
counterparty)

Diffstat:
Melectrum/lnwatcher.py | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/electrum/lnwatcher.py b/electrum/lnwatcher.py @@ -15,7 +15,7 @@ from .util import PrintError, bh2u, bfh, log_exceptions, ignore_exceptions from .lnutil import EncumberedTransaction from . import wallet from .storage import WalletStorage -from .address_synchronizer import AddressSynchronizer +from .address_synchronizer import AddressSynchronizer, TX_HEIGHT_LOCAL, TX_HEIGHT_UNCONF_PARENT, TX_HEIGHT_UNCONFIRMED if TYPE_CHECKING: from .network import Network @@ -182,6 +182,8 @@ class LNWatcher(PrintError): keep_watching_this = True if conflict_mined_depth == TxMinedDepth.FREE: tx_height = self.addr_sync.get_tx_height(prev_txid).height + if tx_height == TX_HEIGHT_LOCAL: + continue num_conf = local_height - tx_height + 1 broadcast = True if e_tx.cltv_expiry: @@ -229,9 +231,9 @@ class LNWatcher(PrintError): return TxMinedDepth.DEEP elif conf > 0: return TxMinedDepth.SHALLOW - elif height in (wallet.TX_HEIGHT_UNCONFIRMED, wallet.TX_HEIGHT_UNCONF_PARENT): + elif height in (TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT): return TxMinedDepth.MEMPOOL - elif height == wallet.TX_HEIGHT_LOCAL: + elif height == TX_HEIGHT_LOCAL: return TxMinedDepth.FREE elif height > 0 and conf == 0: # unverified but claimed to be mined