@@ -99,6 +99,7 @@ async def check_onchain_situation(self, address: str, funding_outpoint: str) ->
9999 if not self .adb .is_mine (address ):
100100 return
101101 # inspect_tx_candidate might have added new addresses, in which case we return early
102+ # TODO why don't we wait until adb.is_up_to_date ?!
102103 funding_txid = funding_outpoint .split (':' )[0 ]
103104 funding_height = self .adb .get_tx_height (funding_txid )
104105 closing_txid = self .adb .get_spender (funding_outpoint )
@@ -159,9 +160,9 @@ async def sweep_commitment_transaction(self, funding_outpoint: str, closing_tx:
159160 return False
160161 # detect who closed and get information about how to claim outputs
161162 is_local_ctx , sweep_info_dict = chan .get_ctx_sweep_info (closing_tx )
162- keep_watching = False if sweep_info_dict else not self .adb .is_deeply_mined (closing_tx .txid ())
163+ keep_watching = False if sweep_info_dict else not self .adb .is_deeply_mined (closing_tx .txid ()) #
163164 # create and broadcast transactions
164- for prevout , sweep_info in sweep_info_dict .items ():
165+ for prevout , sweep_info in sweep_info_dict .items (): #
165166 prev_txid , prev_index = prevout .split (':' )
166167 name = sweep_info .name + ' ' + chan .get_id_for_log ()
167168 self .lnworker .wallet .set_default_label (prevout , name )
@@ -170,7 +171,7 @@ async def sweep_commitment_transaction(self, funding_outpoint: str, closing_tx:
170171 self .logger .info (f'prevout does not exist for { name } : { prevout } ' )
171172 continue
172173 was_added = self .maybe_redeem (sweep_info )
173- spender_txid = self .adb .get_spender (prevout )
174+ spender_txid = self .adb .get_spender (prevout ) # note: LOCAL spenders don't count
174175 spender_tx = self .adb .get_transaction (spender_txid ) if spender_txid else None
175176 if spender_tx :
176177 # the spender might be the remote, revoked or not
@@ -188,7 +189,7 @@ async def sweep_commitment_transaction(self, funding_outpoint: str, closing_tx:
188189 self .maybe_extract_preimage (chan , spender_tx , prevout )
189190 self .maybe_add_accounting_address (spender_txid , sweep_info )
190191 else :
191- keep_watching |= was_added
192+ keep_watching |= was_added #
192193 self .maybe_add_pending_forceclose (
193194 chan = chan , spender_txid = spender_txid , is_local_ctx = is_local_ctx , sweep_info = sweep_info , was_added = was_added )
194195 return keep_watching
0 commit comments