Dont return an Err from Channel::get_accept_channel that can't fail
[rust-lightning] / fuzz / fuzz_targets / channel_target.rs
index 04a3caccadcb85d08389acede83112729c63d6d0..7b3b7df1ce2ec3ddcc039212e92352bddef8b246 100644 (file)
@@ -124,6 +124,7 @@ pub fn do_test(data: &[u8]) {
                                Ok(msg) => msg,
                                Err(e) => match e {
                                        msgs::DecodeError::UnknownRealmByte => return,
+                                       msgs::DecodeError::UnknownRequiredFeature => return,
                                        msgs::DecodeError::BadPublicKey => return,
                                        msgs::DecodeError::BadSignature => return,
                                        msgs::DecodeError::BadText => return,
@@ -146,6 +147,7 @@ pub fn do_test(data: &[u8]) {
                                        Ok(msg) => msg,
                                        Err(e) => match e {
                                                msgs::DecodeError::UnknownRealmByte => return,
+                                               msgs::DecodeError::UnknownRequiredFeature => return,
                                                msgs::DecodeError::BadPublicKey => return,
                                                msgs::DecodeError::BadSignature => return,
                                                msgs::DecodeError::BadText => return,
@@ -228,7 +230,7 @@ pub fn do_test(data: &[u8]) {
                        Ok(chan) => chan,
                        Err(_) => return,
                };
-               chan.get_accept_channel().unwrap();
+               chan.get_accept_channel();
 
                tx.output.push(TxOut{ value: open_chan.funding_satoshis, script_pubkey: chan.get_funding_redeemscript().to_v0_p2wsh() });
                let funding_output = OutPoint::new(Sha256dHash::from_data(&serialize(&tx).unwrap()[..]), 0);
@@ -269,7 +271,7 @@ pub fn do_test(data: &[u8]) {
                        0 => {
                                test_err!(channel.send_htlc(slice_to_be64(get_slice!(8)), [42; 32], slice_to_be32(get_slice!(4)), msgs::OnionPacket {
                                        version: get_slice!(1)[0],
-                                       public_key: get_pubkey!(),
+                                       public_key: PublicKey::from_slice(&secp_ctx, get_slice!(33)),
                                        hop_data: [0; 20*65],
                                        hmac: [0; 32],
                                }));