Skip to content

Commit

Permalink
fix: invoice payment hash
Browse files Browse the repository at this point in the history
  • Loading branch information
DhananjayPurohit committed Aug 15, 2024
1 parent a53f6be commit d9dee91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions clients/libs/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ const verifyInvoice = async (clientConfig, batchId, paymentRequest) => {

const decodedInvoice = lightningPayReq.decode(paymentRequest);
let paymentHash = await getPaymentHash(clientConfig, batchId);
console.log(decodedInvoice);

return paymentHash === decodedInvoice.tagsObject.payment_hash;
}
Expand Down
4 changes: 2 additions & 2 deletions clients/tests/web/test/tb04-simple-lightning-latch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ describe('TB04 - Receiver tries to transfer invoice amount to another invoice be

expect(hashPreImage).toEqual(paymentHash.hash);

const paymentHashSecond = "4f67f0a4bc4a8a6a8ecb944e9b748ed7c27655fbdb4c4d3f045d7f18c1e4de64"
const paymentHashSecond = "f768c404215f9fb5731c32c00fe7a057fc181d7695de447b334380d90674db34"
const invoiceSecond = await generateInvoice(paymentHashSecond, amount);

try {
Expand Down Expand Up @@ -695,7 +695,7 @@ describe('Coin receiver creates a non hold invoice, and sends to sender (i.e. an

const paymentHash = await mercuryweblib.paymentHash(clientConfig, wallet1.name, statechainId);

const paymentHashSecond = "b4eab5e663aebe5fc645865b27b33c04c4e057e7c844fa61519df6de1398cdb3"
const paymentHashSecond = "ddddf1cd1e2ca1986e29b20401b555fbaa4a8502626a7afc37c47ae06a46d918"
const invoiceSecond = await generateInvoice(paymentHashSecond, amount);

const isInvoiceValid = await mercuryweblib.verifyInvoice(clientConfig, paymentHash.batchId, invoiceSecond.payment_request);
Expand Down

0 comments on commit d9dee91

Please sign in to comment.