swaps: cleanup data after swap gets failed

Removes the persisted payment info from lnworker once a swap got failed.
Stops persisting the OnionRoutingFailure as it is sufficient to delete
the payment info to fail potential incoming htlcs.
Deletes stored swap leftovers in lnworker and SwapManager
This commit is contained in:
f321x
2025-08-21 16:29:19 +02:00
committed by ThomasV
parent c1d2fc2b42
commit c623cca654
2 changed files with 19 additions and 6 deletions
+7
View File
@@ -2318,6 +2318,13 @@ class LNWallet(LNWorker):
return key_list
return []
def delete_payment_bundle(self, payment_hash: bytes) -> None:
payment_key = self._get_payment_key(payment_hash)
for key_list in self.payment_bundles:
if payment_key in key_list:
self.payment_bundles.remove(key_list)
return
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")