Merge pull request #332 from shocknet/fix/amount-mismatch

check the same type
This commit is contained in:
CapDog 2021-04-10 11:15:31 -04:00 committed by GitHub
commit fddd2fa8eb

View file

@ -1089,16 +1089,18 @@ const sendSpontaneousPayment = async (
const { num_satoshis: decodedAmt } = await decodePayReq(encodedInvoice) const { num_satoshis: decodedAmt } = await decodePayReq(encodedInvoice)
if (decodedAmt !== amount.toString()) { if (decodedAmt.toString() !== amount.toString()) {
throw new Error( throw new Error(
`Invoice amount mismatch got: ${decodedAmt} expected: ${amount.toString()}` `Invoice amount mismatch got: ${decodedAmt.toString()} expected: ${amount.toString()}`
) )
} }
// double check // double check
if (Number(decodedAmt) !== amount) { if (Number(decodedAmt) !== Number(amount)) {
throw new Error( throw new Error(
`Invoice amount mismatch got:${decodedAmt} expected:${amount.toString()}` `Invoice amount mismatch got:${Number(decodedAmt)} expected:${Number(
amount
)}`
) )
} }