X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=4fccba37212ce8584af1ce83e8bddc697a68f5ae;hb=1d2d39325872a553335bee4a71ac89f7512db4fb;hp=24e8120de6cc4e14c32fd07d95903621b1f9a2eb;hpb=0133739e9e585ebe966ba4a1d41b003f4f4769bf;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 24e8120d..4fccba37 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -1,3 +1,12 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + //! Wire messages, traits representing wire message handlers, and a few error types live here. //! //! For a normal node you probably don't need to use anything here, however, if you wish to split a @@ -427,9 +436,10 @@ pub(crate) struct UnsignedChannelUpdate { pub(crate) chain_hash: BlockHash, pub(crate) short_channel_id: u64, pub(crate) timestamp: u32, - pub(crate) flags: u16, + pub(crate) flags: u8, pub(crate) cltv_expiry_delta: u16, pub(crate) htlc_minimum_msat: u64, + pub(crate) htlc_maximum_msat: OptionalField, pub(crate) fee_base_msat: u32, pub(crate) fee_proportional_millionths: u32, pub(crate) excess_data: Vec, @@ -461,7 +471,7 @@ pub enum ErrorAction { /// An Err type for failure to process messages. pub struct LightningError { /// A human-readable message describing the error - pub err: &'static str, + pub err: String, /// The action which should be taken against the offending peer. pub action: ErrorAction, } @@ -517,7 +527,7 @@ pub enum HTLCFailChannelUpdate { /// As we wish to serialize these differently from Options (Options get a tag byte, but /// OptionalFeild simply gets Present if there are enough bytes to read into it), we have a /// separate enum type for them. -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Debug)] pub enum OptionalField { /// Optional field is included in message Present(T), @@ -701,7 +711,7 @@ impl fmt::Display for DecodeError { impl fmt::Debug for LightningError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str(self.err) + f.write_str(self.err.as_str()) } } @@ -742,6 +752,26 @@ impl Readable for OptionalField