4242from .lnaddr import lndecode
4343from .json_db import StoredObject , stored_in
4444from . import constants
45- from .address_synchronizer import TX_HEIGHT_LOCAL , TX_HEIGHT_FUTURE
45+ from .address_synchronizer import (TX_HEIGHT_LOCAL , TX_HEIGHT_FUTURE , TX_HEIGHT_UNCONFIRMED ,
46+ TX_HEIGHT_UNCONF_PARENT )
4647from .fee_policy import FeePolicy
4748from .invoices import Invoice , PR_PAID
4849from .lnonion import OnionRoutingFailure , OnionFailureCode
@@ -553,9 +554,9 @@ async def _claim_to_output(self, swap: SwapData, claim_txin: PartialTxInput):
553554 assert swap .claim_to_output , swap
554555 txout = PartialTxOutput .from_address_and_value (swap .claim_to_output [0 ], swap .claim_to_output [1 ])
555556 tx = PartialTransaction .from_io ([claim_txin ], [txout ])
556- can_be_broadcast = self .wallet .adb .get_tx_height (swap .funding_txid ).height () > 0
557- already_broadcast = self .wallet .adb .get_tx_height (tx .txid ()).height () >= 0
558- self .logger .debug (f"_claim_to_output: { can_be_broadcast = } { already_broadcast = } " )
557+ funding_tx_confirmed = self .wallet .adb .get_tx_height (swap .funding_txid ).height () > TX_HEIGHT_UNCONFIRMED
558+ already_broadcast = self .wallet .adb .get_tx_height (tx .txid ()).height () >= TX_HEIGHT_UNCONF_PARENT
559+ self .logger .debug (f"_claim_to_output: { funding_tx_confirmed = } { already_broadcast = } " )
559560
560561 # add tx to db so it can be shown as future tx
561562 if not self .wallet .adb .get_transaction (tx .txid ()):
@@ -572,7 +573,7 @@ async def _claim_to_output(self, swap: SwapData, claim_txin: PartialTxInput):
572573 if not already_broadcast and self .wallet .adb .future_tx .get (tx .txid (), 0 ) < wanted_height :
573574 self .wallet .adb .set_future_tx (tx .txid (), wanted_height = wanted_height )
574575
575- if can_be_broadcast and not already_broadcast :
576+ if funding_tx_confirmed and not already_broadcast :
576577 tx = self .wallet .sign_transaction (tx , password = None , ignore_warnings = True )
577578 assert tx and tx .is_complete (), tx
578579 try :
0 commit comments