mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-28 16:01:30 +00:00
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)
This commit is contained in:
parent
f9f1805cdf
commit
795ba1f99d
1 changed files with 5 additions and 3 deletions
|
@ -15,7 +15,7 @@ from .util import PrintError, bh2u, bfh, log_exceptions, ignore_exceptions
|
||||||
from .lnutil import EncumberedTransaction
|
from .lnutil import EncumberedTransaction
|
||||||
from . import wallet
|
from . import wallet
|
||||||
from .storage import WalletStorage
|
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:
|
if TYPE_CHECKING:
|
||||||
from .network import Network
|
from .network import Network
|
||||||
|
@ -182,6 +182,8 @@ class LNWatcher(PrintError):
|
||||||
keep_watching_this = True
|
keep_watching_this = True
|
||||||
if conflict_mined_depth == TxMinedDepth.FREE:
|
if conflict_mined_depth == TxMinedDepth.FREE:
|
||||||
tx_height = self.addr_sync.get_tx_height(prev_txid).height
|
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
|
num_conf = local_height - tx_height + 1
|
||||||
broadcast = True
|
broadcast = True
|
||||||
if e_tx.cltv_expiry:
|
if e_tx.cltv_expiry:
|
||||||
|
@ -229,9 +231,9 @@ class LNWatcher(PrintError):
|
||||||
return TxMinedDepth.DEEP
|
return TxMinedDepth.DEEP
|
||||||
elif conf > 0:
|
elif conf > 0:
|
||||||
return TxMinedDepth.SHALLOW
|
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
|
return TxMinedDepth.MEMPOOL
|
||||||
elif height == wallet.TX_HEIGHT_LOCAL:
|
elif height == TX_HEIGHT_LOCAL:
|
||||||
return TxMinedDepth.FREE
|
return TxMinedDepth.FREE
|
||||||
elif height > 0 and conf == 0:
|
elif height > 0 and conf == 0:
|
||||||
# unverified but claimed to be mined
|
# unverified but claimed to be mined
|
||||||
|
|
Loading…
Add table
Reference in a new issue