Skip to content

Commit c678a9a

Browse files
committed
test(invoice): add new BOLT11 test vector to test public-key recovery high-S signature
1 parent f63aebb commit c678a9a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lightning-invoice/tests/ser_de.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,26 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
373373
false, // Different features than set in InvoiceBuilder
374374
true, // Some unknown fields
375375
),
376+
(
377+
"lnbc1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq9qrsgq357wnc5r2ueh7ck6q93dj32dlqnls087fxdwk8qakdyafkq3yap2r09nt4ndd0unm3z9u5t48y6ucv4r5sg7lk98c77ctvjczkspk5qprc90gx".to_owned(),
378+
InvoiceBuilder::new(Currency::Bitcoin)
379+
.duration_since_epoch(Duration::from_secs(1496314658))
380+
.payment_secret(PaymentSecret([0x11; 32]))
381+
.payment_hash(sha256::Hash::from_str(
382+
"0001020304050607080900010203040506070809000102030405060708090102"
383+
).unwrap())
384+
.description("Please consider supporting this project".to_owned())
385+
.build_raw()
386+
.unwrap()
387+
.sign(|_| {
388+
RecoverableSignature::from_compact(
389+
&<Vec<u8>>::from_hex("8d3ce9e28357337f62da0162d9454df827f83cfe499aeb1c1db349d4d8112742a1bcb35d66d6bf93dc445e51753935cc32a3a411efd8a7c7bd85b25815a01b50").unwrap(),
390+
RecoveryId::from_i32(1).unwrap()
391+
)
392+
}).unwrap(),
393+
false, // Different features than set in InvoiceBuilder
394+
false, // Some unknown fields
395+
),
376396

377397
]
378398
}

0 commit comments

Comments
 (0)