Skip to content

Commit e77ed49

Browse files
committed
Test feature bits in InvoiceBuilder
1 parent fc0e0c2 commit e77ed49

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightning-invoice/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,14 +1682,16 @@ mod test {
16821682
.route(route_1.clone())
16831683
.route(route_2.clone())
16841684
.description_hash(sha256::Hash::from_slice(&[3;32][..]).unwrap())
1685-
.payment_hash(sha256::Hash::from_slice(&[21;32][..]).unwrap());
1685+
.payment_hash(sha256::Hash::from_slice(&[21;32][..]).unwrap())
1686+
.payment_secret(PaymentSecret([42; 32]))
1687+
.basic_mpp();
16861688

16871689
let invoice = builder.clone().build_signed(|hash| {
16881690
secp_ctx.sign_recoverable(hash, &private_key)
16891691
}).unwrap();
16901692

16911693
assert!(invoice.check_signature().is_ok());
1692-
assert_eq!(invoice.tagged_fields().count(), 8);
1694+
assert_eq!(invoice.tagged_fields().count(), 10);
16931695

16941696
assert_eq!(invoice.amount_pico_btc(), Some(123));
16951697
assert_eq!(invoice.currency(), Currency::BitcoinTestnet);
@@ -1707,6 +1709,8 @@ mod test {
17071709
InvoiceDescription::Hash(&Sha256(sha256::Hash::from_slice(&[3;32][..]).unwrap()))
17081710
);
17091711
assert_eq!(invoice.payment_hash(), &sha256::Hash::from_slice(&[21;32][..]).unwrap());
1712+
assert_eq!(invoice.payment_secret(), Some(&PaymentSecret([42; 32])));
1713+
assert_eq!(invoice.features(), Some(&InvoiceFeatures::known()));
17101714

17111715
let raw_invoice = builder.build_raw().unwrap();
17121716
assert_eq!(raw_invoice, *invoice.into_signed_raw().raw_invoice())

0 commit comments

Comments
 (0)