1
0

lnwatcher: add field for onchain htlc settlement control

This commit is contained in:
bitromortac
2021-09-13 14:48:48 +02:00
committed by ThomasV
parent 18f81d0080
commit b6e224c864
2 changed files with 6 additions and 0 deletions

View File

@@ -539,6 +539,11 @@ class LNWalletWatcher(LNWatcher):
# self.logger.debug(
# f"pending redeem for {prevout}. waiting for {name}: CSV "
# f"({local_height=}, {wanted_height=}, {prev_height.height=}, {sweep_info.csv_delay=})")
if not (sweep_info.cltv_abs or sweep_info.csv_delay):
# used to control settling of htlcs onchain for testing purposes
# careful, this prevents revocation as well
if not self.lnworker.enable_htlc_settle_onchain:
return
if can_broadcast:
self.logger.info(f'we can broadcast: {name}')
tx_was_added = await self.network.try_broadcasting(new_tx, name)

View File

@@ -845,6 +845,7 @@ class LNWallet(LNWorker):
self.logs = defaultdict(list) # type: Dict[str, List[HtlcLog]] # key is RHASH # (not persisted)
# used in tests
self.enable_htlc_settle = True
self.enable_htlc_settle_onchain = True
self.enable_htlc_forwarding = True
# note: accessing channels (besides simple lookup) needs self.lock!