X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=7295c40d5442dd87639d08bbe6a6a3b2c1d5a873;hb=252280d6bfda49a7ed4fd5d427eed5c74af65ae5;hp=7233bed28d82da8c56e798b34b091299f8ed168e;hpb=6d7ae6e174fff61545d04b75b01c3cf36e9101c1;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 7233bed2..7295c40d 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -943,9 +943,9 @@ mod fuzzy_internal_msgs { pub(crate) pad: Vec, } } -#[cfg(feature = "fuzztarget")] +#[cfg(fuzzing)] pub use self::fuzzy_internal_msgs::*; -#[cfg(not(feature = "fuzztarget"))] +#[cfg(not(fuzzing))] pub(crate) use self::fuzzy_internal_msgs::*; #[derive(Clone)] @@ -1299,10 +1299,6 @@ impl Readable for FinalOnionHopData { impl Writeable for OnionHopData { fn write(&self, w: &mut W) -> Result<(), io::Error> { - // Note that this should never be reachable if Rust-Lightning generated the message, as we - // check values are sane long before we get here, though its possible in the future - // user-generated messages may hit this. - if self.amt_to_forward > MAX_VALUE_MSAT { panic!("We should never be sending infinite/overflow onion payments"); } match self.format { OnionHopDataFormat::Legacy { short_channel_id } => { 0u8.write(w)?; @@ -1319,9 +1315,6 @@ impl Writeable for OnionHopData { }); }, OnionHopDataFormat::FinalNode { ref payment_data, ref keysend_preimage } => { - if let Some(final_data) = payment_data { - if final_data.total_msat > MAX_VALUE_MSAT { panic!("We should never be sending infinite/overflow onion payments"); } - } encode_varint_length_prefixed_tlv!(w, { (2, HighZeroBytesDroppedVarInt(self.amt_to_forward), required), (4, HighZeroBytesDroppedVarInt(self.outgoing_cltv_value), required),