X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=515dcbba2d2e136846697dc990d582270e07e1d4;hb=83f0dbc0021335dce183450d7dce7e9f284ff0b6;hp=cb857ed5ee6004d9e98d96c935c253f835d30d2e;hpb=a9534fe6b53ee5a35bcedb897f03804dc17f2d39;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index cb857ed5..515dcbba 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -24,9 +24,10 @@ //! raw socket events into your non-internet-facing system and then send routing events back to //! track the network on the less-secure system. +use bitcoin::blockdata::constants::ChainHash; use bitcoin::secp256k1::PublicKey; use bitcoin::secp256k1::ecdsa::Signature; -use bitcoin::secp256k1; +use bitcoin::{secp256k1, Witness}; use bitcoin::blockdata::script::Script; use bitcoin::hash_types::{Txid, BlockHash}; @@ -42,15 +43,20 @@ use crate::io_extras::read_to_end; use crate::events::{MessageSendEventsProvider, OnionMessageProvider}; use crate::util::logger; -use crate::util::ser::{LengthReadable, Readable, ReadableArgs, Writeable, Writer, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname}; +use crate::util::ser::{LengthReadable, Readable, ReadableArgs, Writeable, Writer, WithoutLength, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname, TransactionU16LenLimited, BigSize}; use crate::ln::{PaymentPreimage, PaymentHash, PaymentSecret}; -use crate::routing::gossip::NodeId; +use crate::routing::gossip::{NodeAlias, NodeId}; /// 21 million * 10^8 * 1000 pub(crate) const MAX_VALUE_MSAT: u64 = 21_000_000_0000_0000_000; +#[cfg(taproot)] +/// A partial signature that also contains the Musig2 nonce its signer used +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct PartialSignatureWithNonce(pub musig2::types::PartialSignature, pub musig2::types::PublicNonce); + /// An error in decoding a message or struct. #[derive(Clone, Debug, PartialEq, Eq)] pub enum DecodeError { @@ -83,6 +89,10 @@ pub enum DecodeError { pub struct Init { /// The relevant features which the sender supports. pub features: InitFeatures, + /// Indicates chains the sender is interested in. + /// + /// If there are no common chains, the connection will be closed. + pub networks: Option>, /// The receipient's network address. /// /// This adds the option to report a remote IP address back to a connecting peer using the init @@ -153,6 +163,8 @@ pub struct Pong { /// An [`open_channel`] message to be sent to or received from a peer. /// +/// Used in V1 channel establishment +/// /// [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message #[derive(Clone, Debug, PartialEq, Eq)] pub struct OpenChannel { @@ -194,8 +206,8 @@ pub struct OpenChannel { pub first_per_commitment_point: PublicKey, /// The channel flags to be used pub channel_flags: u8, - /// Optionally, a request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close - pub shutdown_scriptpubkey: OptionalField