1
0

swapserver: sanity check amount in new flow

This commit is contained in:
ThomasV
2023-08-27 20:56:49 +02:00
parent e06df2cb69
commit f5ab4b0f18

View File

@@ -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