X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=4fccba37212ce8584af1ce83e8bddc697a68f5ae;hb=fd2db4028a8b88ee6dcda73608b2e74945c1b01f;hp=cce8c3d0b121722ff4b3ec24f592cc89067687de;hpb=9098240e341cf09578819cdf1d2950303478b137;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index cce8c3d0..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 @@ -25,7 +34,6 @@ use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures}; use std::{cmp, fmt}; use std::io::Read; -use std::result::Result; use util::events; use util::ser::{Readable, Writeable, Writer, FixedLengthReader, HighZeroBytesDroppedVarInt}; @@ -97,7 +105,7 @@ pub struct OpenChannel { pub(crate) max_accepted_htlcs: u16, pub(crate) funding_pubkey: PublicKey, pub(crate) revocation_basepoint: PublicKey, - pub(crate) payment_basepoint: PublicKey, + pub(crate) payment_point: PublicKey, pub(crate) delayed_payment_basepoint: PublicKey, pub(crate) htlc_basepoint: PublicKey, pub(crate) first_per_commitment_point: PublicKey, @@ -118,7 +126,7 @@ pub struct AcceptChannel { pub(crate) max_accepted_htlcs: u16, pub(crate) funding_pubkey: PublicKey, pub(crate) revocation_basepoint: PublicKey, - pub(crate) payment_basepoint: PublicKey, + pub(crate) payment_point: PublicKey, pub(crate) delayed_payment_basepoint: PublicKey, pub(crate) htlc_basepoint: PublicKey, pub(crate) first_per_commitment_point: PublicKey, @@ -391,7 +399,7 @@ pub struct UnsignedNodeAnnouncement { pub(crate) excess_address_data: Vec, pub(crate) excess_data: Vec, } -#[derive(PartialEq, Clone)] +#[derive(PartialEq, Clone, Debug)] /// A node_announcement message to be sent or received from a peer pub struct NodeAnnouncement { pub(crate) signature: Signature, @@ -428,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, @@ -462,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, } @@ -518,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), @@ -702,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()) } } @@ -743,6 +752,26 @@ impl Readable for OptionalField