X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=22bca6ee19c4e71624cbe20d33dec1d248945fde;hb=b9707da1382bcebe066c0c26b15a975991bf81e2;hp=24e8120de6cc4e14c32fd07d95903621b1f9a2eb;hpb=8fae0c0d0586c34852f3da666b3ee49a7f4eca8e;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 24e8120d..22bca6ee 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 @@ -65,185 +74,278 @@ pub struct Init { /// An error message to be sent or received from a peer #[derive(Clone)] pub struct ErrorMessage { - pub(crate) channel_id: [u8; 32], - pub(crate) data: String, + /// The channel ID involved in the error + pub channel_id: [u8; 32], + /// A possibly human-readable error description. + /// The string should be sanitized before it is used (e.g. emitted to logs + /// or printed to stdout). Otherwise, a well crafted error message may trigger a security + /// vulnerability in the terminal emulator or the logging subsystem. + pub data: String, } /// A ping message to be sent or received from a peer pub struct Ping { - pub(crate) ponglen: u16, - pub(crate) byteslen: u16, + /// The desired response length + pub ponglen: u16, + /// The ping packet size. + /// This field is not sent on the wire. byteslen zeros are sent. + pub byteslen: u16, } /// A pong message to be sent or received from a peer pub struct Pong { - pub(crate) byteslen: u16, + /// The pong packet size. + /// This field is not sent on the wire. byteslen zeros are sent. + pub byteslen: u16, } /// An open_channel message to be sent or received from a peer #[derive(Clone)] pub struct OpenChannel { - pub(crate) chain_hash: BlockHash, - pub(crate) temporary_channel_id: [u8; 32], - pub(crate) funding_satoshis: u64, - pub(crate) push_msat: u64, - pub(crate) dust_limit_satoshis: u64, - pub(crate) max_htlc_value_in_flight_msat: u64, - pub(crate) channel_reserve_satoshis: u64, - pub(crate) htlc_minimum_msat: u64, - pub(crate) feerate_per_kw: u32, - pub(crate) to_self_delay: u16, - pub(crate) max_accepted_htlcs: u16, - pub(crate) funding_pubkey: PublicKey, - pub(crate) revocation_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, - pub(crate) channel_flags: u8, - pub(crate) shutdown_scriptpubkey: OptionalField