diff --git a/src/lib/bolt11.test.ts b/src/lib/bolt11.test.ts index ca303b1..efe762d 100644 --- a/src/lib/bolt11.test.ts +++ b/src/lib/bolt11.test.ts @@ -26,9 +26,9 @@ describe('getSatoshisFromBolt11', () => { expect(getSatoshisFromBolt11('lnbc1pvjluezpp5abcdef')).toBe(0); }); - it('handles a 21-sat zap (2100n)', () => { - // 2100n → 2100 * 1e-9 BTC = 21 sats - expect(getSatoshisFromBolt11('lnbc2100n1pvjluezpp5abcdef')).toBe(21); + it('handles a 21-sat zap (210n)', () => { + // 210n → 210 * 1e-9 BTC = 2.1e-7 BTC = 21 sats + expect(getSatoshisFromBolt11('lnbc210n1pvjluezpp5abcdef')).toBe(21); }); it('is case-insensitive (uppercase invoice)', () => { diff --git a/src/lib/verifyInvoice.test.ts b/src/lib/verifyInvoice.test.ts index 2e3c8c3..09fa8a4 100644 --- a/src/lib/verifyInvoice.test.ts +++ b/src/lib/verifyInvoice.test.ts @@ -3,13 +3,13 @@ import { assertInvoiceAmount } from './verifyInvoice'; describe('assertInvoiceAmount', () => { it('accepts an invoice whose amount matches the expected sats', () => { - // lnbc2100n… = 21 sats - expect(() => assertInvoiceAmount('lnbc2100n1pvjluez', 21)).not.toThrow(); + // lnbc210n… = 210 * 1e-9 BTC = 21 sats + expect(() => assertInvoiceAmount('lnbc210n1pvjluez', 21)).not.toThrow(); }); it('accepts a 1-sat rounding difference (millisat↔sat slack)', () => { - // lnbc2100n… = 21 sats, expected 22 → diff of 1 is allowed - expect(() => assertInvoiceAmount('lnbc2100n1pvjluez', 22)).not.toThrow(); + // lnbc210n… = 21 sats, expected 22 → diff of 1 is allowed + expect(() => assertInvoiceAmount('lnbc210n1pvjluez', 22)).not.toThrow(); }); it('rejects an over-charging invoice (the core attack it defends against)', () => {