Skip to content

Commit 19e32d6

Browse files
committed
lnwatcher/txbatcher: more logging
log more clearly if an input is considered dust, this makes the logs more helpful when debugging sweeping of lightning utxos.
1 parent 80ea7be commit 19e32d6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

electrum/lnwatcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,12 @@ def maybe_redeem(self, sweep_info: 'SweepInfo') -> bool:
210210
try:
211211
self.lnworker.wallet.txbatcher.add_sweep_input('lnwatcher', sweep_info)
212212
except BelowDustLimit:
213+
self.logger.debug(f"maybe_redeem: BelowDustLimit: {sweep_info.name}")
213214
# utxo is considered dust at *current* fee estimates.
214215
# but maybe the fees atm are very high? We will retry later.
215216
pass
216217
except NoDynamicFeeEstimates:
218+
self.logger.debug(f"maybe_redeem: NoDynamicFeeEstimates: {sweep_info.name}")
217219
pass # will retry later
218220
if sweep_info.is_anchor():
219221
return False

electrum/txbatcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,10 @@ def is_dust(self, sweep_info: SweepInfo) -> bool:
272272
value = sweep_info.txin.value_sats()
273273
witness_size = len(sweep_info.txin.make_witness(71*b'\x00'))
274274
tx_size_vbytes = 84 + witness_size//4 # assumes no batching, sweep to p2wpkh
275-
self.logger.info(f'{sweep_info.name} size = {tx_size_vbytes}')
276275
fee = self.fee_policy.estimate_fee(tx_size_vbytes, network=self.wallet.network)
277-
return value - fee <= dust_threshold()
276+
is_dust = value - fee <= dust_threshold()
277+
self.logger.info(f'{sweep_info.name} size = {tx_size_vbytes}: {is_dust=}')
278+
return is_dust
278279

279280
@locked
280281
def add_sweep_input(self, sweep_info: 'SweepInfo') -> None:

0 commit comments

Comments
 (0)