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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user