X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Frefund_deser.rs;h=7937ca1efc60f8ef8e87049b7956acc16c7c1d60;hb=a8bd4c097f7ae6620eee66c1cb49144e38568439;hp=14b136ec35b6d06837c09e997523fc5d093944c1;hpb=9277166a8b10bc0eff18fadc8fcff8a4a6a5673e;p=rust-lightning diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs index 14b136ec..7937ca1e 100644 --- a/fuzz/src/refund_deser.rs +++ b/fuzz/src/refund_deser.rs @@ -7,10 +7,11 @@ // You may not use this file except in accordance with one or both of these // licenses. -use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey, self}; +use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, SecretKey, self}; use crate::utils::test_logger; 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; @@ -27,7 +28,7 @@ pub fn do_test(data: &[u8], _out: Out) { assert_eq!(data, bytes); let secp_ctx = Secp256k1::new(); - let keys = KeyPair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap()); + let keys = Keypair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap()); let pubkey = PublicKey::from(keys); let mut buffer = Vec::new(); @@ -62,9 +63,19 @@ fn build_response( refund: &Refund, signing_pubkey: PublicKey, 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![