Merge pull request #3057 from G8XSU/2024-05-08-claimable-persist-3049
[rust-lightning] / fuzz / src / router.rs
index bf94c910531573335f2db2594ce1df41304b0f3d..e801510b0addb12bd821a01b969b1e4310b5ff60 100644 (file)
@@ -7,11 +7,12 @@
 // You may not use this file except in accordance with one or both of these
 // licenses.
 
+use bitcoin::amount::Amount;
 use bitcoin::blockdata::constants::ChainHash;
 use bitcoin::blockdata::script::Builder;
 use bitcoin::blockdata::transaction::TxOut;
 
-use lightning::blinded_path::{BlindedHop, BlindedPath};
+use lightning::blinded_path::{BlindedHop, BlindedPath, IntroductionNode};
 use lightning::chain::transaction::OutPoint;
 use lightning::ln::ChannelId;
 use lightning::ln::channelmanager::{self, ChannelDetails, ChannelCounterparty};
@@ -28,7 +29,7 @@ use lightning::util::ser::Readable;
 
 use bitcoin::hashes::Hash;
 use bitcoin::secp256k1::PublicKey;
-use bitcoin::network::constants::Network;
+use bitcoin::network::Network;
 
 use crate::utils::test_logger;
 
@@ -94,8 +95,8 @@ impl<Out: test_logger::Output> UtxoLookup for FuzzChainSource<'_, '_, Out> {
                if input_slice.is_none() { return UtxoResult::Sync(Err(UtxoLookupError::UnknownTx)); }
                let input_slice = input_slice.unwrap();
                let txo_res = TxOut {
-                       value: if input_slice[0] % 2 == 0 { 1_000_000 } else { 1_000 },
-                       script_pubkey: Builder::new().push_int(input_slice[1] as i64).into_script().to_v0_p2wsh(),
+                       value: Amount::from_sat(if input_slice[0] % 2 == 0 { 1_000_000 } else { 1_000 }),
+                       script_pubkey: Builder::new().push_int(input_slice[1] as i64).into_script().to_p2wsh(),
                };
                match input_slice {
                        &[0, _] => UtxoResult::Sync(Err(UtxoLookupError::UnknownChain)),
@@ -157,6 +158,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
                                        msgs::DecodeError::ShortRead => panic!("We picked the length..."),
                                        msgs::DecodeError::Io(e) => panic!("{:?}", e),
                                        msgs::DecodeError::UnsupportedCompression => return,
+                                       msgs::DecodeError::DangerousValue => return,
                                }
                        }
                }}
@@ -362,7 +364,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
                                                });
                                        }
                                        (payinfo, BlindedPath {
-                                               introduction_node_id: hop.src_node_id,
+                                               introduction_node: IntroductionNode::NodeId(hop.src_node_id),
                                                blinding_point: dummy_pk,
                                                blinded_hops,
                                        })