X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Finvoice_request_deser.rs;h=1aad5bfd897b77f9eab9363611354e56e1f88def;hb=d792afb08cdc20a30786728c3bfe816dd3b59e47;hp=22a2258f4e25f9df7f413bec0b1ab3d07d9a847d;hpb=8866ed35330bae1af2237c1951d9c4025938aa65;p=rust-lightning diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs index 22a2258f..1aad5bfd 100644 --- a/fuzz/src/invoice_request_deser.rs +++ b/fuzz/src/invoice_request_deser.rs @@ -9,8 +9,9 @@ use bitcoin::secp256k1::{KeyPair, Parity, PublicKey, Secp256k1, SecretKey, self}; use crate::utils::test_logger; -use core::convert::{Infallible, TryFrom}; +use core::convert::TryFrom; use lightning::blinded_path::BlindedPath; +use lightning::blinded_path::message::ForwardNode; use lightning::sign::EntropySource; use lightning::ln::PaymentHash; use lightning::ln::features::BlindedHopFeatures; @@ -37,16 +38,16 @@ pub fn do_test(data: &[u8], _out: Out) { let even_pubkey = x_only_pubkey.public_key(Parity::Even); if signing_pubkey == odd_pubkey || signing_pubkey == even_pubkey { unsigned_invoice - .sign::<_, Infallible>( - |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) + .sign(|message: &UnsignedBolt12Invoice| + Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) ) .unwrap() .write(&mut buffer) .unwrap(); } else { unsigned_invoice - .sign::<_, Infallible>( - |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) + .sign(|message: &UnsignedBolt12Invoice| + Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) ) .unwrap_err(); } @@ -73,9 +74,19 @@ fn build_response( invoice_request: &InvoiceRequest, secp_ctx: &Secp256k1 ) -> Result { let entropy_source = Randomness {}; + let intermediate_nodes = [ + [ + ForwardNode { node_id: pubkey(43), short_channel_id: None }, + ForwardNode { node_id: pubkey(44), short_channel_id: None }, + ], + [ + ForwardNode { node_id: pubkey(45), short_channel_id: None }, + ForwardNode { node_id: pubkey(46), short_channel_id: None }, + ], + ]; let paths = vec![ - BlindedPath::new_for_message(&[pubkey(43), pubkey(44), pubkey(42)], &entropy_source, secp_ctx).unwrap(), - BlindedPath::new_for_message(&[pubkey(45), pubkey(46), pubkey(42)], &entropy_source, secp_ctx).unwrap(), + BlindedPath::new_for_message(&intermediate_nodes[0], pubkey(42), &entropy_source, secp_ctx).unwrap(), + BlindedPath::new_for_message(&intermediate_nodes[1], pubkey(42), &entropy_source, secp_ctx).unwrap(), ]; let payinfo = vec![