]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Include signature check in BOLT 12 signature test
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 2 Jun 2023 19:46:00 +0000 (14:46 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 7 Jun 2023 21:57:24 +0000 (16:57 -0500)
The BOLT 12 test vectors had inadvertently left out a signature, but it
has since been added. Include a signature check in the corresponding
test for completeness.

lightning/src/offers/merkle.rs

index 3b05899a8f59214872a1075179fc9428b48412fa..f7c33902c51441cd3e2a358637c9ddb4d2cc31e6 100644 (file)
@@ -226,6 +226,7 @@ mod tests {
 
        use bitcoin::hashes::{Hash, sha256};
        use bitcoin::secp256k1::{KeyPair, Secp256k1, SecretKey};
+       use bitcoin::secp256k1::schnorr::Signature;
        use core::convert::Infallible;
        use crate::offers::offer::{Amount, OfferBuilder};
        use crate::offers::invoice_request::InvoiceRequest;
@@ -280,6 +281,10 @@ mod tests {
                        super::root_hash(&invoice_request.bytes[..]),
                        sha256::Hash::from_slice(&hex::decode("608407c18ad9a94d9ea2bcdbe170b6c20c462a7833a197621c916f78cf18e624").unwrap()).unwrap(),
                );
+               assert_eq!(
+                       invoice_request.signature(),
+                       Signature::from_slice(&hex::decode("b8f83ea3288cfd6ea510cdb481472575141e8d8744157f98562d162cc1c472526fdb24befefbdebab4dbb726bbd1b7d8aec057f8fa805187e5950d2bbe0e5642").unwrap()).unwrap(),
+               );
        }
 
        #[test]