1
0

regtests: rm sleep from "swapserver_forceclose" test

less reliance on timing
(OTOH it hardcodes the output index of the commitment tx... meh)
This commit is contained in:
SomberNight
2025-05-15 14:19:49 +00:00
parent f3551f3c25
commit 6320597f2c
3 changed files with 13 additions and 3 deletions

View File

@@ -1639,7 +1639,8 @@ class Commands(Logger):
@command('wnpl')
async def close_channel(self, channel_point, force=False, password=None, wallet: Abstract_Wallet = None):
"""
Close a lightning channel
Close a lightning channel.
Returns txid of closing tx.
arg:str:channel_point:channel point
arg:bool:force:Force closes (broadcast local commitment transaction)

View File

@@ -2288,6 +2288,9 @@ class LNWallet(LNWorker):
def save_preimage(self, payment_hash: bytes, preimage: bytes, *, write_to_disk: bool = True):
if sha256(preimage) != payment_hash:
raise Exception("tried to save incorrect preimage for payment_hash")
if self._preimages.get(payment_hash.hex()) is not None:
return # we already have this preimage
self.logger.debug(f"saving preimage for {payment_hash.hex()}")
self._preimages[payment_hash.hex()] = preimage.hex()
if write_to_disk:
self.wallet.save_db()