X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Frefund_deser.rs;h=fd273d7e0284573e13899db7e8f510a0da49e0a7;hb=50eba2624f8f6f6eeb02690f70a6ac725bf44d81;hp=9adaa3e953cb63c97152eef3ea3ce8f339968f26;hpb=a0c65c32a53077d548935835a8c2d211e91ce2cb;p=rust-lightning diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs index 9adaa3e9..fd273d7e 100644 --- a/fuzz/src/refund_deser.rs +++ b/fuzz/src/refund_deser.rs @@ -10,13 +10,13 @@ use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey, self}; use crate::utils::test_logger; use core::convert::{Infallible, TryFrom}; -use lightning::chain::keysinterface::EntropySource; +use lightning::blinded_path::BlindedPath; +use lightning::sign::EntropySource; use lightning::ln::PaymentHash; use lightning::ln::features::BlindedHopFeatures; -use lightning::offers::invoice::{BlindedPayInfo, UnsignedInvoice}; -use lightning::offers::parse::SemanticError; +use lightning::offers::invoice::{BlindedPayInfo, UnsignedBolt12Invoice}; +use lightning::offers::parse::Bolt12SemanticError; use lightning::offers::refund::Refund; -use lightning::onion_message::BlindedPath; use lightning::util::ser::Writeable; #[inline] @@ -34,7 +34,7 @@ pub fn do_test(data: &[u8], _out: Out) { if let Ok(invoice) = build_response(&refund, pubkey, &secp_ctx) { invoice .sign::<_, Infallible>( - |digest| Ok(secp_ctx.sign_schnorr_no_aux_rand(digest, &keys)) + |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) ) .unwrap() .write(&mut buffer) @@ -58,13 +58,13 @@ fn privkey(byte: u8) -> SecretKey { SecretKey::from_slice(&[byte; 32]).unwrap() } -fn build_response<'a, T: secp256k1::Signing + secp256k1::Verification>( - refund: &'a Refund, signing_pubkey: PublicKey, secp_ctx: &Secp256k1 -) -> Result, SemanticError> { +fn build_response( + refund: &Refund, signing_pubkey: PublicKey, secp_ctx: &Secp256k1 +) -> Result { let entropy_source = Randomness {}; let paths = vec![ - BlindedPath::new(&[pubkey(43), pubkey(44), pubkey(42)], &entropy_source, secp_ctx).unwrap(), - BlindedPath::new(&[pubkey(45), pubkey(46), pubkey(42)], &entropy_source, secp_ctx).unwrap(), + 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(), ]; let payinfo = vec![ @@ -86,7 +86,7 @@ fn build_response<'a, T: secp256k1::Signing + secp256k1::Verification>( }, ]; - let payment_paths = paths.into_iter().zip(payinfo.into_iter()).collect(); + let payment_paths = payinfo.into_iter().zip(paths.into_iter()).collect(); let payment_hash = PaymentHash([42; 32]); refund.respond_with(payment_paths, payment_hash, signing_pubkey)?.build() }