From f5ab4b0f18d0178faf49833014d9e4be0c0b20ee Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 27 Aug 2023 20:56:49 +0200 Subject: [PATCH] swapserver: sanity check amount in new flow --- electrum/submarine_swaps.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py index d3d1345f5..af3d8901f 100644 --- a/electrum/submarine_swaps.py +++ b/electrum/submarine_swaps.py @@ -513,10 +513,11 @@ class SwapManager(Logger): key = invoice.rhash payment_hash = bytes.fromhex(key) assert key in self.swaps + swap = self.swaps[key] + assert swap.lightning_amount == int(invoice.get_amount_sat()) self.wallet.save_invoice(invoice) if pay_now: # check that we have the preimage - swap = self.get_swap(payment_hash) assert sha256(swap.preimage) == payment_hash assert swap.spending_txid is None self.invoices_to_pay[key] = 0