From 6823b8f3bed5f2007ac305ea3ced6dbcd9d386c0 Mon Sep 17 00:00:00 2001 From: hatim boufnichel Date: Sat, 10 Apr 2021 17:13:47 +0200 Subject: [PATCH] check the same type --- services/gunDB/contact-api/actions.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index ec8c66fe..9efeb482 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -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 + )}` ) }