github.com/decred/dcrlnd@v0.7.6/channeldb/migration/lnwire21/funding_signed.go (about)

     1  package lnwire
     2  
     3  import "io"
     4  
     5  // FundingSigned is sent from Bob (the responder) to Alice (the initiator)
     6  // after receiving the funding outpoint and her signature for Bob's version of
     7  // the commitment transaction.
     8  type FundingSigned struct {
     9  	// ChannelPoint is the particular active channel that this
    10  	// FundingSigned is bound to.
    11  	ChanID ChannelID
    12  
    13  	// CommitSig is Bob's signature for Alice's version of the commitment
    14  	// transaction.
    15  	CommitSig Sig
    16  }
    17  
    18  // A compile time check to ensure FundingSigned implements the lnwire.Message
    19  // interface.
    20  var _ Message = (*FundingSigned)(nil)
    21  
    22  // Encode serializes the target FundingSigned into the passed io.Writer
    23  // implementation. Serialization will observe the rules defined by the passed
    24  // protocol version.
    25  //
    26  // This is part of the lnwire.Message interface.
    27  func (f *FundingSigned) Encode(w io.Writer, pver uint32) error {
    28  	return WriteElements(w, f.ChanID, f.CommitSig)
    29  }
    30  
    31  // Decode deserializes the serialized FundingSigned stored in the passed
    32  // io.Reader into the target FundingSigned using the deserialization rules
    33  // defined by the passed protocol version.
    34  //
    35  // This is part of the lnwire.Message interface.
    36  func (f *FundingSigned) Decode(r io.Reader, pver uint32) error {
    37  	return ReadElements(r, &f.ChanID, &f.CommitSig)
    38  }
    39  
    40  // MsgType returns the uint32 code which uniquely identifies this message as a
    41  // FundingSigned on the wire.
    42  //
    43  // This is part of the lnwire.Message interface.
    44  func (f *FundingSigned) MsgType() MessageType {
    45  	return MsgFundingSigned
    46  }
    47  
    48  // MaxPayloadLength returns the maximum allowed payload length for a
    49  // FundingSigned message.
    50  //
    51  // This is part of the lnwire.Message interface.
    52  func (f *FundingSigned) MaxPayloadLength(uint32) uint32 {
    53  	// 32 + 64
    54  	return 96
    55  }