Merge pull request #332 from shocknet/fix/amount-mismatch
check the same type
This commit is contained in:
commit
fddd2fa8eb
1 changed files with 6 additions and 4 deletions
|
|
@ -1089,16 +1089,18 @@ const sendSpontaneousPayment = async (
|
|||
|
||||
const { num_satoshis: decodedAmt } = await decodePayReq(encodedInvoice)
|
||||
|
||||
if (decodedAmt !== amount.toString()) {
|
||||
if (decodedAmt.toString() !== amount.toString()) {
|
||||
throw new Error(
|
||||
`Invoice amount mismatch got: ${decodedAmt} expected: ${amount.toString()}`
|
||||
`Invoice amount mismatch got: ${decodedAmt.toString()} expected: ${amount.toString()}`
|
||||
)
|
||||
}
|
||||
|
||||
// double check
|
||||
if (Number(decodedAmt) !== amount) {
|
||||
if (Number(decodedAmt) !== Number(amount)) {
|
||||
throw new Error(
|
||||
`Invoice amount mismatch got:${decodedAmt} expected:${amount.toString()}`
|
||||
`Invoice amount mismatch got:${Number(decodedAmt)} expected:${Number(
|
||||
amount
|
||||
)}`
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue