Receive payment: remove MRH BIP21 amount validation (#448)

* Receive payment: remove MRH BIP21 amount validation

* Fix CI: bump dependency in pubspec.lock
This commit is contained in:
ok300
2024-08-15 17:47:19 +00:00
committed by GitHub
parent dc0e347e2b
commit 44ee969e43
2 changed files with 3 additions and 12 deletions

View File

@@ -1227,23 +1227,14 @@ impl LiquidSdk {
let create_response = self.swapper.create_receive_swap(v2_req)?;
// Check if correct MRH was added to the invoice by Boltz
let (bip21_lbtc_address, bip21_amount_btc) = self
let (bip21_lbtc_address, _bip21_amount_btc) = self
.swapper
.check_for_mrh(&create_response.invoice)?
.ok_or(PaymentError::receive_error("Invoice has no MRH"))?;
let received_bip21_amount_sat: u64 = (bip21_amount_btc * 100_000_000.0) as u64;
ensure_sdk!(
bip21_lbtc_address == mrh_addr_str,
PaymentError::receive_error("Invoice has incorrect address in MRH")
);
// The swap fee savings are passed on to the Sender: MRH amount = invoice amount - fees
let expected_bip21_amount_sat = payer_amount_sat - fees_sat;
ensure_sdk!(
received_bip21_amount_sat == expected_bip21_amount_sat,
PaymentError::receive_error(&format!(
"Invoice has incorrect amount in MRH: expected {expected_bip21_amount_sat} sat, MRH has {received_bip21_amount_sat} sat",
))
);
let swap_id = create_response.id.clone();
let invoice = Bolt11Invoice::from_str(&create_response.invoice).map_err(|err| {