Documentation ¶
Index ¶
- Constants
- func EncodeFailure(w io.Writer, failure FailureMessage, pver uint32) error
- func WriteMessage(w io.Writer, msg Message, pver uint32) (int, error)
- type AcceptChannel
- type Alias
- type AnnounceSignatures
- type ChannelAnnouncement
- func (a *ChannelAnnouncement) DataToSign() ([]byte, error)
- func (a *ChannelAnnouncement) Decode(r io.Reader, pver uint32) error
- func (a *ChannelAnnouncement) Encode(w io.Writer, pver uint32) error
- func (a *ChannelAnnouncement) MaxPayloadLength(pver uint32) uint32
- func (a *ChannelAnnouncement) MsgType() MessageType
- type ChannelID
- type ChannelUpdate
- type ClosingSigned
- type CommitSig
- type DeliveryAddress
- type Error
- type ErrorCode
- type ErrorData
- type FailAmountBelowMinimum
- type FailChannelDisabled
- type FailCode
- type FailExpiryTooSoon
- type FailFeeInsufficient
- type FailFinalExpiryTooSoon
- type FailFinalIncorrectCltvExpiry
- type FailFinalIncorrectHtlcAmount
- type FailIncorrectCltvExpiry
- type FailIncorrectPaymentAmount
- type FailInvalidOnionHmac
- type FailInvalidOnionKey
- type FailInvalidOnionVersion
- type FailInvalidRealm
- type FailPermanentChannelFailure
- type FailPermanentNodeFailure
- type FailRequiredChannelFeatureMissing
- type FailRequiredNodeFeatureMissing
- type FailTemporaryChannelFailure
- type FailTemporaryNodeFailure
- type FailUnknownNextPeer
- type FailUnknownPaymentHash
- type FailureMessage
- type Feature
- type FeatureVector
- type FundingCreated
- type FundingLocked
- type FundingSigned
- type Init
- type Message
- type MessageType
- type NetAddress
- type NodeAnnouncement
- func (a *NodeAnnouncement) DataToSign() ([]byte, error)
- func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error
- func (a *NodeAnnouncement) Encode(w io.Writer, pver uint32) error
- func (a *NodeAnnouncement) MaxPayloadLength(pver uint32) uint32
- func (a *NodeAnnouncement) MsgType() MessageType
- type OpaqueReason
- type OpenChannel
- type Ping
- type PingPayload
- type PkScript
- type Pong
- type PongPayload
- type RGB
- type RevokeAndAck
- type Serializable
- type SharedFeatures
- type ShortChannelID
- type Shutdown
- type UnknownMessage
- type UpdateAddHTLC
- type UpdateFailHTLC
- type UpdateFailMalformedHTLC
- type UpdateFee
- type UpdateFufillHTLC
Constants ¶
const ( // OptionalFlag represent the feature which we already have but it // isn't required yet, and if remote peer doesn't have this feature we // may turn it off without disconnecting with peer. OptionalFlag featureFlag = 2 // 0b10 // RequiredFlag represent the features which is required for proper // peer interaction, we disconnect with peer if it doesn't have this // particular feature. RequiredFlag featureFlag = 1 // 0b01 )
const ( MsgInit MessageType = 16 MsgError = 17 MsgPing = 18 MsgPong = 19 MsgOpenChannel = 32 MsgAcceptChannel = 33 MsgFundingCreated = 34 MsgFundingSigned = 35 MsgFundingLocked = 36 MsgShutdown = 39 MsgClosingSigned = 40 MsgUpdateAddHTLC = 128 MsgUpdateFufillHTLC = 130 MsgUpdateFailHTLC = 131 MsgCommitSig = 132 MsgRevokeAndAck = 133 MsgUpdateFailMalformedHTLC = 135 MsgUpdateFee = 137 MsgChannelAnnouncement = 256 MsgNodeAnnouncement = 257 MsgChannelUpdate = 258 MsgAnnounceSignatures = 259 )
The currently defined message types within this current version of the Lightning protocol.
const ( CodeNone FailCode = 0 CodeInvalidRealm = FlagBadOnion | 1 CodeTemporaryNodeFailure = FlagNode | 2 CodePermanentNodeFailure = FlagPerm | FlagNode | 2 CodeRequiredNodeFeatureMissing = FlagPerm | FlagNode | 3 CodeInvalidOnionVersion = FlagBadOnion | FlagPerm | 4 CodeInvalidOnionHmac = FlagBadOnion | FlagPerm | 5 CodeInvalidOnionKey = FlagBadOnion | FlagPerm | 6 CodeTemporaryChannelFailure = FlagUpdate | 7 CodePermanentChannelFailure = FlagPerm | 8 CodeRequiredChannelFeatureMissing = FlagPerm | 9 CodeUnknownNextPeer = FlagPerm | 10 CodeAmountBelowMinimum = FlagUpdate | 11 CodeFeeInsufficient = FlagUpdate | 12 CodeIncorrectCltvExpiry = FlagUpdate | 13 CodeExpiryTooSoon = FlagUpdate | 14 CodeChannelDisabled = FlagUpdate | 20 CodeUnknownPaymentHash = FlagPerm | 15 CodeIncorrectPaymentAmount = FlagPerm | 16 CodeFinalExpiryTooSoon FailCode = 17 CodeFinalIncorrectCltvExpiry FailCode = 18 CodeFinalIncorrectHtlcAmount FailCode = 19 )
The currently defined onion failure types within this current version of the Lightning protocol.
const ( // MaxFundingTxOutputs is the maximum number of allowed outputs on a // funding transaction within the protocol. This is due to the fact // that we use 2-bytes to encode the index within the funding output // during the funding workflow. Funding transaction with more outputs // than this are considered invalid within the protocol. MaxFundingTxOutputs = math.MaxUint16 )
const MaxMessagePayload = 65535 // 65KB
MaxMessagePayload is the maximum bytes a message can be regardless of other individual limits imposed by messages themselves.
const MaxSliceLength = 65535
MaxSliceLength is the maximum allowed lenth for any opaque byte slices in the wire protocol.
const OnionPacketSize = 1366
OnionPacketSize is the size of the serialized Sphinx onion packet included in each UpdateAddHTLC message. The breakdown of the onion packet is as follows: 1-byte version, 33-byte ephemeral public key (for ECDH), 1300-bytes of per-hop data, and a 32-byte HMAC over the entire packet.
Variables ¶
This section is empty.
Functions ¶
func EncodeFailure ¶
func EncodeFailure(w io.Writer, failure FailureMessage, pver uint32) error
EncodeFailure encodes, including the necessary onion failure header information.
Types ¶
type AcceptChannel ¶
type AcceptChannel struct { // PendingChannelID serves to uniquely identify the future channel // created by the initiated single funder workflow. PendingChannelID [32]byte // DustLimit is the specific dust limit the sender of this message // would like enforced on their version of the commitment transaction. // Any output below this value will be "trimmed" from the commitment // transaction, with the amount of the HTLC going to dust. DustLimit btcutil.Amount // MaxValueInFlight represents the maximum amount of coins that can be // pending within the channel at any given time. If the amount of funds // in limbo exceeds this amount, then the channel will be failed. // // TODO(roasbeef): is msat MaxValueInFlight btcutil.Amount // ChannelReserve is the amount of BTC that the receiving party MUST // maintain a balance above at all times. This is a safety mechanism to // ensure that both sides always have skin in the game during the // channel's lifetime. ChannelReserve btcutil.Amount // MinAcceptDepth is the minimum depth that the initiator of the // channel should wait before considering the channel open. MinAcceptDepth uint32 // HtlcMinimum is the smallest HTLC that the sender of this message // will accept. // // TODO(roasbeef): is msat HtlcMinimum uint32 // CsvDelay is the number of blocks to use for the relative time lock // in the pay-to-self output of both commitment transactions. CsvDelay uint16 // MaxAcceptedHTLCs is the total number of incoming HTLC's that the // sender of this channel will accept. // // TODO(roasbeef): acks the initiator's, same with max in flight? MaxAcceptedHTLCs uint16 // FundingKey is the key that should be used on behalf of the sender // within the 2-of-2 multi-sig output that it contained within the // funding transaction. FundingKey *btcec.PublicKey // RevocationPoint is the base revocation point for the sending party. // Any commitment transaction belonging to the receiver of this message // should use this key and their per-commitment point to derive the // revocation key for the commitment transaction. RevocationPoint *btcec.PublicKey // PaymentPoint is the base payment point for the sending party. This // key should be combined with the per commitment point for a // particular commitment state in order to create the key that should // be used in any output that pays directly to the sending party, and // also within the HTLC covenant transactions. PaymentPoint *btcec.PublicKey // DelayedPaymentPoint is the delay point for the sending party. This // key should be combined with the per commitment point to derive the // keys that are used in outputs of the sender's commitment transaction // where they claim funds. DelayedPaymentPoint *btcec.PublicKey // FirstCommitmentPoint is the first commitment point for the sending // party. This value should be combined with the receiver's revocation // base point in order to derive the revocation keys that are placed // within the commitment transaction of the sender. FirstCommitmentPoint *btcec.PublicKey }
AcceptChannel is the message Bob sends to Alice after she initiates the single funder channel workflow via a AcceptChannel message. Once Alice receives Bob's response, then she has all the items necessary to construct the funding transaction, and both commitment transactions.
func (*AcceptChannel) Decode ¶
func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error
Decode deserializes the serialized AcceptChannel stored in the passed io.Reader into the target AcceptChannel using the deserialization rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*AcceptChannel) Encode ¶
func (a *AcceptChannel) Encode(w io.Writer, pver uint32) error
Encode serializes the target AcceptChannel into the passed io.Writer implementation. Serialization will observe the rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*AcceptChannel) MaxPayloadLength ¶
func (a *AcceptChannel) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload length for a AcceptChannel message.
This is part of the lnwire.Message interface.
func (*AcceptChannel) MsgType ¶
func (a *AcceptChannel) MsgType() MessageType
MsgType returns the MessageType code which uniquely identifies this message as a AcceptChannel on the wire.
This is part of the lnwire.Message interface.
type Alias ¶
type Alias struct {
// contains filtered or unexported fields
}
Alias a hex encoded UTF-8 string that may be displayed as an alternative to the node's ID. Notice that aliases are not unique and may be freely chosen by the node operators.
type AnnounceSignatures ¶
type AnnounceSignatures struct { // ChannelID is the unique description of the funding transaction. // Channel id is better for users and debugging and short channel id is // used for quick test on existence of the particular utxo inside the // block chain, because it contains information about block. ChannelID ChannelID // ShortChannelID is the unique description of the funding // transaction. It is constructed with the most significant 3 bytes // as the block height, the next 3 bytes indicating the transaction // index within the block, and the least significant two bytes // indicating the output index which pays to the channel. ShortChannelID ShortChannelID // NodeSignature is the signature which contains the signed announce // channel message, by this signature we proof that we posses of the // node pub key and creating the reference node_key -> bitcoin_key. NodeSignature *btcec.Signature // BitcoinSignature is the signature which contains the signed node // public key, by this signature we proof that we posses of the // bitcoin key and and creating the reverse reference bitcoin_key -> // node_key. BitcoinSignature *btcec.Signature }
AnnounceSignatures this is a direct message between two endpoints of a channel and serves as an opt-in mechanism to allow the announcement of the channel to the rest of the network. It contains the necessary signatures by the sender to construct the channel announcement message.
func (*AnnounceSignatures) Decode ¶
func (a *AnnounceSignatures) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized AnnounceSignatures stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*AnnounceSignatures) Encode ¶
func (a *AnnounceSignatures) Encode(w io.Writer, pver uint32) error
Encode serializes the target AnnounceSignatures into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*AnnounceSignatures) MaxPayloadLength ¶
func (a *AnnounceSignatures) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for this message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*AnnounceSignatures) MsgType ¶
func (a *AnnounceSignatures) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type ChannelAnnouncement ¶
type ChannelAnnouncement struct { // This signatures are used by nodes in order to create cross // references between node's channel and node. Requiring both nodes // to sign indicates they are both willing to route other payments via // this node. NodeSig1 *btcec.Signature NodeSig2 *btcec.Signature // This signatures are used by nodes in order to create cross // references between node's channel and node. Requiring the bitcoin // signatures proves they control the channel. BitcoinSig1 *btcec.Signature BitcoinSig2 *btcec.Signature // ShortChannelID is the unique description of the funding transaction. ShortChannelID ShortChannelID // The public keys of the two nodes who are operating the channel, such // that is NodeID1 the numerically-lesser than NodeID2 (ascending // numerical order). NodeID1 *btcec.PublicKey NodeID2 *btcec.PublicKey // Public keys which corresponds to the keys which was declared in // multisig funding transaction output. BitcoinKey1 *btcec.PublicKey BitcoinKey2 *btcec.PublicKey }
ChannelAnnouncement message is used to announce the existence of a channel between two peers in the overlay, which is propagated by the discovery service over broadcast handler.
func (*ChannelAnnouncement) DataToSign ¶
func (a *ChannelAnnouncement) DataToSign() ([]byte, error)
DataToSign is used to retrieve part of the announcement message which should be signed.
func (*ChannelAnnouncement) Decode ¶
func (a *ChannelAnnouncement) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized ChannelAnnouncement stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*ChannelAnnouncement) Encode ¶
func (a *ChannelAnnouncement) Encode(w io.Writer, pver uint32) error
Encode serializes the target ChannelAnnouncement into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*ChannelAnnouncement) MaxPayloadLength ¶
func (a *ChannelAnnouncement) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for this message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*ChannelAnnouncement) MsgType ¶
func (a *ChannelAnnouncement) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type ChannelID ¶
type ChannelID [32]byte
ChannelID is a series of 32-bytes that uniquely identifies all channels within the network. The ChannelID is computed using the outpoint of the funding transaction (the txid, and output index). Given a funding output the ChannelID can be calculated by XOR'ing the big-endian serialization of the
func NewChanIDFromOutPoint ¶
NewChanIDFromOutPoint converts a target OutPoint into a ChannelID that is usable within the network. In order to covert the OutPoint into a ChannelID, we XOR the lower 2-bytes of the txid within the OutPoint with the big-endian serialization of the Index of the OutPoint, truncated to 2-bytes.
func (*ChannelID) GenPossibleOutPoints ¶
func (c *ChannelID) GenPossibleOutPoints() [MaxFundingTxOutputs]wire.OutPoint
GenPossibleOutPoints generates all the possible outputs given a channel ID. In order to generate these possible outpoints, we perform a brute-force search through the candidate output index space, performing a reverse mapping from channelID back to OutPoint.
func (ChannelID) IsChanPoint ¶
IsChanPoint returns true if the OutPoint passed corresponds to the target ChannelID.
type ChannelUpdate ¶
type ChannelUpdate struct { // Signature is used to validate the announced data and prove the // ownership of node id. Signature *btcec.Signature // ShortChannelID is the unique description of the funding transaction. ShortChannelID ShortChannelID // Timestamp allows ordering in the case of multiple announcements. // We should ignore the message if timestamp is not greater than // the last-received. Timestamp uint32 // Flags least-significant bit must be set to 0 if the creating node // corresponds to the first node in the previously sent channel // announcement and 1 otherwise. Flags uint16 // TimeLockDelta is the minimum number of blocks this node requires to // be added to the expiry of HTLCs. This is a security parameter // determined by the node operator. This value represents the required // gap between the time locks of the incoming and outgoing HTLC's set // to this node. TimeLockDelta uint16 // HtlcMinimumMsat is the minimum HTLC value which will be accepted. HtlcMinimumMsat uint64 // BaseFee is the base fee that must be used for incoming HTLC's to // this particular channel. This value will be tacked onto the required // for a payment independent of the size of the payment. BaseFee uint32 // FeeRate is the fee rate that will be charged per millionth of a // satoshi. FeeRate uint32 }
ChannelUpdate message is used after channel has been initially announced. Each side independently announces its fees and minimum expiry for HTLCs and other parameters. Also this message is used to redeclare initially setted channel parameters.
func (*ChannelUpdate) DataToSign ¶
func (a *ChannelUpdate) DataToSign() ([]byte, error)
DataToSign is used to retrieve part of the announcement message which should be signed.
func (*ChannelUpdate) Decode ¶
func (a *ChannelUpdate) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized ChannelUpdate stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*ChannelUpdate) Encode ¶
func (a *ChannelUpdate) Encode(w io.Writer, pver uint32) error
Encode serializes the target ChannelUpdate into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*ChannelUpdate) MaxPayloadLength ¶
func (a *ChannelUpdate) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for this message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*ChannelUpdate) MsgType ¶
func (a *ChannelUpdate) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type ClosingSigned ¶
type ClosingSigned struct { // ChannelID serves to identify which channel is to be closed. ChannelID ChannelID // FeeSatoshis is the fee that the party to the channel would like to // propose for the close transaction. FeeSatoshis uint64 // Signature is for the proposed channel close transaction. Signature *btcec.Signature }
ClosingSigned is sent by both parties to a channel once the channel is clear of HTLCs, and is primarily concerned with negotiating fees for the close transaction. Each party provides a signature for a transaction with a fee that they believe is fair. The process terminates when both sides agree on the same fee, or when one side force closes the channel.
NOTE: The responder is able to send a signature without any additional messages as all transactions are assembled observing BIP 69 which defines a cannonical ordering for input/outputs. Therefore, both sides are able to arrive at an identical closure transaction as they know the order of the inputs/outputs.
func NewClosingSigned ¶
func NewClosingSigned(cid ChannelID, fs uint64, sig *btcec.Signature) *ClosingSigned
NewClosingSigned creates a new empty ClosingSigned message.
func (*ClosingSigned) Decode ¶
func (c *ClosingSigned) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized ClosingSigned message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*ClosingSigned) Encode ¶
func (c *ClosingSigned) Encode(w io.Writer, pver uint32) error
Encode serializes the target ClosingSigned into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*ClosingSigned) MaxPayloadLength ¶
func (c *ClosingSigned) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for a ClosingSigned complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*ClosingSigned) MsgType ¶
func (c *ClosingSigned) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type CommitSig ¶
type CommitSig struct { // ChanID uniquely identifies to which currently active channel this // CommitSig applies to. ChanID ChannelID // CommitSig is Alice's signature for Bob's new commitment transaction. // Alice is able to send this signature without requesting any // additional data due to the piggybacking of Bob's next revocation // hash in his prior RevokeAndAck message, as well as the canonical // ordering used for all inputs/outputs within commitment transactions. // If initiating a new commitment state, this signature shoud ONLY // cover all of the sending party's pending log updates, and the log // updates of the remote party that have been ACK'd. CommitSig *btcec.Signature // HtlcSigs is a signature for each relevant HTLC output within the // created commitment. The order of the signatures is expected to be // identical to the placement of the HTLC's within the BIP 69 sorted // commitment transaction. For each outgoing HTLC (from the PoV of the // sender of this message), a signature for a HTLC timeout transaction // should be signed, for each incoming HTLC the HTLC timeout // transaction should be signed. HtlcSigs []*btcec.Signature }
CommitSig is sent by either side to stage any pending HTLC's in the receiver's pending set into a new commitment state. Implicitly, the new commitment transaction constructed which has been signed by CommitSig includes all HTLC's in the remote node's pending set. A CommitSig message may be sent after a series of UpdateAddHTLC/UpdateFufillHTLC messages in order to batch add several HTLC's with a single signature covering all implicitly accepted HTLC's.
func NewCommitSig ¶
func NewCommitSig() *CommitSig
NewCommitSig creates a new empty CommitSig message.
func (*CommitSig) Decode ¶
Decode deserializes a serialized CommitSig message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*CommitSig) Encode ¶
Encode serializes the target CommitSig into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*CommitSig) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for a CommitSig complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*CommitSig) MsgType ¶
func (c *CommitSig) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type DeliveryAddress ¶
type DeliveryAddress []byte
DeliveryAddress is used to communicate the address to which funds from a closed channel should be sent. The address can be a p2wsh, p2pkh, p2sh or p2wpkh.
type Error ¶
type Error struct { // ChanID references the active channel in which the error occurred // within. If the ChanID is all zeroes, then this error applies to the // entire established connection. ChanID ChannelID // Code is the short error code that succinctly identifies the error // code. This is similar field is similar to HTTP error codes. // // TODO(roasbeef): make PR to repo to add error codes, in addition to // what's there atm Code ErrorCode // Data is the attached error data that describes the exact failure // which caused the error message to be sent. Data ErrorData }
Error represents a generic error bound to an exact channel. The message format is purposefully general in order to allow expression of a wide array of possible errors. Each Error message is directed at a particular open channel referenced by ChannelPoint.
func (*Error) Decode ¶
Decode deserializes a serialized Error message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Error) Encode ¶
Encode serializes the target Error into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*Error) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for a Error complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Error) MsgType ¶
func (c *Error) MsgType() MessageType
MsgType returns the integer uniquely identifying an Error message on the wire.
This is part of the lnwire.Message interface.
type ErrorCode ¶
type ErrorCode uint16
ErrorCode represents the short error code for each of the defined errors within the Lightning Network protocol spec.
const ( // ErrMaxPendingChannels is returned by remote peer when the number of // active pending channels exceeds their maximum policy limit. ErrMaxPendingChannels ErrorCode = 1 // ErrSynchronizingChain is returned by a remote peer that receives a // channel update or a funding request while their still syncing to the // latest state of the blockchain. ErrSynchronizingChain ErrorCode = 2 )
func (ErrorCode) ToGrpcCode ¶
ToGrpcCode is used to generate gRPC specific code which will be propagated to the ln rpc client. This code is used to have more detailed view of what goes wrong and also in order to have the ability pragmatically determine the error and take specific actions on the client side.
type ErrorData ¶
type ErrorData []byte
ErrorData is a set of bytes associated with a particular sent error. A receiving node SHOULD only print out data verbatim if the string is composed solely of printable ASCII characters. For reference, the printable character set includes byte values 32 through 127 inclusive.
type FailAmountBelowMinimum ¶
type FailAmountBelowMinimum struct { // HtlcMsat is the wrong amount of the incoming HTLC. HtlcMsat btcutil.Amount // Update is used to update information about state of the channel which // caused the failure. Update ChannelUpdate }
FailAmountBelowMinimum is returned if the HTLC does not reach the current minimum amount, we tell them the amount of the incoming HTLC and the current channel setting for the outgoing channel.
NOTE: May only be returned by the intermediate nodes in the path.
func NewAmountBelowMinimum ¶
func NewAmountBelowMinimum(htlcMsat btcutil.Amount, update ChannelUpdate) *FailAmountBelowMinimum
NewAmountBelowMinimum creates new instance of the FailAmountBelowMinimum.
func (*FailAmountBelowMinimum) Code ¶
func (f *FailAmountBelowMinimum) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailChannelDisabled ¶
type FailChannelDisabled struct { // Flags least-significant bit must be set to 0 if the creating node // corresponds to the first node in the previously sent channel // announcement and 1 otherwise. Flags uint16 // Update is used to update information about state of the channel // which caused the failure. Update ChannelUpdate }
FailChannelDisabled is returned if the channel is disabled, we tell them the current channel setting for the outgoing channel.
NOTE: May only be returned by intermediate nodes.
func NewChannelDisabled ¶
func NewChannelDisabled(flags uint16, update ChannelUpdate) *FailChannelDisabled
NewChannelDisabled creates new instance of the FailChannelDisabled.
func (*FailChannelDisabled) Code ¶
func (f *FailChannelDisabled) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailCode ¶
type FailCode uint16
FailCode specifies the precise reason that an upstream HTLC was cancelled. Each UpdateFailHTLC message carries a FailCode which is to be passed backwards, encrypted at each step back to the source of the HTLC within the route.
const ( // FlagBadOnion error flag describes an unparseable, encrypted by // previous node. FlagBadOnion FailCode = 0x8000 // FlagPerm error flag indicates a permanent failure. FlagPerm FailCode = 0x4000 // FlagNode error flag indicates anode failure. FlagNode FailCode = 0x2000 // FlagUpdate error flag indicates a new channel update is enclosed // within the error. FlagUpdate FailCode = 0x1000 )
type FailExpiryTooSoon ¶
type FailExpiryTooSoon struct { // Update is used to update information about state of the channel // which caused the failure. Update ChannelUpdate }
FailExpiryTooSoon is returned if the ctlv-expiry is too near, we tell them the current channel setting for the outgoing channel.
NOTE: May only be returned by intermediate nodes.
func NewExpiryTooSoon ¶
func NewExpiryTooSoon(update ChannelUpdate) *FailExpiryTooSoon
NewExpiryTooSoon creates new instance of the FailExpiryTooSoon.
func (*FailExpiryTooSoon) Code ¶
func (f *FailExpiryTooSoon) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailFeeInsufficient ¶
type FailFeeInsufficient struct { // HtlcMsat is the wrong amount of the incoming HTLC. HtlcMsat btcutil.Amount // Update is used to update information about state of the channel // which caused the failure. Update ChannelUpdate }
FailFeeInsufficient is returned if the HTLC does not pay sufficient fee, we tell them the amount of the incoming HTLC and the current channel setting for the outgoing channel.
NOTE: May only be returned by intermediate nodes.
func NewFeeInsufficient ¶
func NewFeeInsufficient(htlcMsat btcutil.Amount, update ChannelUpdate) *FailFeeInsufficient
NewFeeInsufficient creates new instance of the FailFeeInsufficient.
func (*FailFeeInsufficient) Code ¶
func (f *FailFeeInsufficient) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailFinalExpiryTooSoon ¶
type FailFinalExpiryTooSoon struct{}
FailFinalExpiryTooSoon is returned if the cltv_expiry is too low, the final node MUST fail the HTLC.
NOTE: May only be returned by the final node in the path.
func (FailFinalExpiryTooSoon) Code ¶
func (f FailFinalExpiryTooSoon) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailFinalIncorrectCltvExpiry ¶
type FailFinalIncorrectCltvExpiry struct { // CltvExpiry is the wrong absolute timeout in blocks, after which // outgoing HTLC expires. CltvExpiry uint32 }
FailFinalIncorrectCltvExpiry is returned if the outgoing_cltv_value does not match the ctlv_expiry of the HTLC at the final hop.
NOTE: might be returned by final node only.
func NewFinalIncorrectCltvExpiry ¶
func NewFinalIncorrectCltvExpiry(cltvExpiry uint32) *FailFinalIncorrectCltvExpiry
NewFinalIncorrectCltvExpiry creates new instance of the FailFinalIncorrectCltvExpiry.
func (*FailFinalIncorrectCltvExpiry) Code ¶
func (f *FailFinalIncorrectCltvExpiry) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailFinalIncorrectHtlcAmount ¶
type FailFinalIncorrectHtlcAmount struct { // IncomingHTLCAmount is the wrong forwarded htlc amount. IncomingHTLCAmount btcutil.Amount }
FailFinalIncorrectHtlcAmount is returned if the amt_to_forward is higher than incoming_htlc_amt of the HTLC at the final hop.
NOTE: May only be returned by the final node.
func NewFinalIncorrectHtlcAmount ¶
func NewFinalIncorrectHtlcAmount(amount btcutil.Amount) *FailFinalIncorrectHtlcAmount
NewFinalIncorrectHtlcAmount creates new instance of the FailFinalIncorrectHtlcAmount.
func (*FailFinalIncorrectHtlcAmount) Code ¶
func (f *FailFinalIncorrectHtlcAmount) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailIncorrectCltvExpiry ¶
type FailIncorrectCltvExpiry struct { // CltvExpiry is the wrong absolute timeout in blocks, after which // outgoing HTLC expires. CltvExpiry uint32 // Update is used to update information about state of the channel // which caused the failure. Update ChannelUpdate }
FailIncorrectCltvExpiry is returned if outgoing cltv value does not match the update add htlc's cltv expiry minus cltv expiry delta for the outgoing channel, we tell them the cltv expiry and the current channel setting for the outgoing channel.
NOTE: May only be returned by intermediate nodes.
func NewIncorrectCltvExpiry ¶
func NewIncorrectCltvExpiry(cltvExpiry uint32, update ChannelUpdate) *FailIncorrectCltvExpiry
NewIncorrectCltvExpiry creates new instance of the FailIncorrectCltvExpiry.
func (*FailIncorrectCltvExpiry) Code ¶
func (f *FailIncorrectCltvExpiry) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailIncorrectPaymentAmount ¶
type FailIncorrectPaymentAmount struct{}
FailIncorrectPaymentAmount is returned if the amount paid is less than the amount expected, the final node MUST fail the HTLC. If the amount paid is more than twice the amount expected, the final node SHOULD fail the HTLC. This allows the sender to reduce information leakage by altering the amount, without allowing accidental gross overpayment.
NOTE: May only be returned by the final node in the path.
func (FailIncorrectPaymentAmount) Code ¶
func (f FailIncorrectPaymentAmount) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailInvalidOnionHmac ¶
type FailInvalidOnionHmac struct { // OnionSHA256 hash of the onion blob which haven't been proceeded. OnionSHA256 [sha256.Size]byte }
FailInvalidOnionHmac is return if the onion HMAC is incorrect.
NOTE: May only be returned by intermediate nodes.
func NewInvalidOnionHmac ¶
func NewInvalidOnionHmac(onion []byte) *FailInvalidOnionHmac
NewInvalidOnionHmac creates new instance of the FailInvalidOnionHmac.
func (*FailInvalidOnionHmac) Code ¶
func (f *FailInvalidOnionHmac) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailInvalidOnionKey ¶
type FailInvalidOnionKey struct { // OnionSHA256 hash of the onion blob which haven't been proceeded. OnionSHA256 [sha256.Size]byte }
FailInvalidOnionKey is return if the ephemeral key in the onion is unparsable.
NOTE: May only be returned by intermediate nodes.
func NewInvalidOnionKey ¶
func NewInvalidOnionKey(onion []byte) *FailInvalidOnionKey
NewInvalidOnionKey creates new instance of the FailInvalidOnionKey.
func (*FailInvalidOnionKey) Code ¶
func (f *FailInvalidOnionKey) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailInvalidOnionVersion ¶
type FailInvalidOnionVersion struct { // OnionSHA256 hash of the onion blob which haven't been proceeded. OnionSHA256 [sha256.Size]byte }
FailInvalidOnionVersion is returned if the onion version byte is unknown.
NOTE: May be returned only by intermediate nodes.
func NewInvalidOnionVersion ¶
func NewInvalidOnionVersion(onion []byte) *FailInvalidOnionVersion
NewInvalidOnionVersion creates new instance of the FailInvalidOnionVersion.
func (*FailInvalidOnionVersion) Code ¶
func (f *FailInvalidOnionVersion) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailInvalidRealm ¶
type FailInvalidRealm struct{}
FailInvalidRealm is returned if the realm byte is unknown.
NOTE: May be returned by any node in the payment route.
func (FailInvalidRealm) Code ¶
func (f FailInvalidRealm) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailPermanentChannelFailure ¶
type FailPermanentChannelFailure struct{}
FailPermanentChannelFailure is return if an otherwise unspecified permanent error occurs for the outgoing channel (eg. channel (recently).
NOTE: May be returned by any node in the payment route.
func (FailPermanentChannelFailure) Code ¶
func (f FailPermanentChannelFailure) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailPermanentNodeFailure ¶
type FailPermanentNodeFailure struct{}
FailPermanentNodeFailure is returned if an otherwise unspecified permanent error occurs for the entire node.
NOTE: May be returned by any node in the payment route.
func (FailPermanentNodeFailure) Code ¶
func (f FailPermanentNodeFailure) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailRequiredChannelFeatureMissing ¶
type FailRequiredChannelFeatureMissing struct{}
FailRequiredChannelFeatureMissing is returned if the outgoing channel has a requirement advertised in its channel announcement features which were not present in the onion.
NOTE: May only be returned by intermediate nodes.
func (FailRequiredChannelFeatureMissing) Code ¶
func (f FailRequiredChannelFeatureMissing) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailRequiredNodeFeatureMissing ¶
type FailRequiredNodeFeatureMissing struct{}
FailRequiredNodeFeatureMissing is returned if a node has requirement advertised in its node_announcement features which were not present in the onion.
NOTE: May be returned by any node in the payment route.
func (FailRequiredNodeFeatureMissing) Code ¶
func (f FailRequiredNodeFeatureMissing) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailTemporaryChannelFailure ¶
type FailTemporaryChannelFailure struct { // Update is used to update information about state of the channel // which caused the failure. // // NOTE: This field is optional. Update *ChannelUpdate }
FailTemporaryChannelFailure is if an otherwise unspecified transient error occurs for the outgoing channel (eg. channel capacity reached, too many in-flight htlcs)
NOTE: May only be returned by intermediate nodes.
func NewTemporaryChannelFailure ¶
func NewTemporaryChannelFailure(update *ChannelUpdate) *FailTemporaryChannelFailure
NewTemporaryChannelFailure creates new instance of the FailTemporaryChannelFailure.
func (*FailTemporaryChannelFailure) Code ¶
func (f *FailTemporaryChannelFailure) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailTemporaryNodeFailure ¶
type FailTemporaryNodeFailure struct{}
FailTemporaryNodeFailure is returned if an otherwise unspecified transient error occurs for the entire node.
NOTE: May be returned by any node in the payment route.
func (FailTemporaryNodeFailure) Code ¶
func (f FailTemporaryNodeFailure) Code() FailCode
Code returns the failure unique code. NOTE: Part of the FailureMessage interface.
type FailUnknownNextPeer ¶
type FailUnknownNextPeer struct{}
FailUnknownNextPeer is returned if the next peer specified by the onion is not known.
NOTE: May only be returned by intermediate nodes.
func (FailUnknownNextPeer) Code ¶
func (f FailUnknownNextPeer) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailUnknownPaymentHash ¶
type FailUnknownPaymentHash struct{}
FailUnknownPaymentHash is returned If the payment hash has already been paid, the final node MAY treat the payment hash as unknown, or may succeed in accepting the HTLC. If the payment hash is unknown, the final node MUST fail the HTLC.
NOTE: May only be returned by the final node in the path.
func (FailUnknownPaymentHash) Code ¶
func (f FailUnknownPaymentHash) Code() FailCode
Code returns the failure unique code.
NOTE: Part of the FailureMessage interface.
type FailureMessage ¶
type FailureMessage interface {
Code() FailCode
}
FailureMessage represents the onion failure object identified by its unique failure code.
func DecodeFailure ¶
func DecodeFailure(r io.Reader, pver uint32) (FailureMessage, error)
DecodeFailure decodes, validates, and parses the lnwire onion failure, for the provided protocol version.
type Feature ¶
type Feature struct { Name featureName Flag featureFlag }
Feature represent the feature which is used on stage of initialization of feature vector. Initial feature flags might be changed dynamically later.
type FeatureVector ¶
type FeatureVector struct {
// contains filtered or unexported fields
}
FeatureVector represents the global/local feature vector. With this structure you may set/get the feature by name and compare feature vector with remote one.
func NewFeatureVector ¶
func NewFeatureVector(features []Feature) *FeatureVector
NewFeatureVector creates new instance of feature vector.
func NewFeatureVectorFromReader ¶
func NewFeatureVectorFromReader(r io.Reader) (*FeatureVector, error)
NewFeatureVectorFromReader decodes the feature vector from binary representation and creates the instance of it. Every feature decoded as 2 bits where odd bit determine whether the feature is "optional" and even bit told us whether the feature is "required". The even/odd semantic allows future incompatible changes, or backward compatible changes. Bits generally assigned in pairs, so that optional features can later become compulsory.
func (*FeatureVector) Compare ¶
func (f *FeatureVector) Compare(f2 *FeatureVector) (*SharedFeatures, error)
Compare checks that features are compatible and returns the features which were present in both remote and local feature vectors. If remote/local node doesn't have the feature and local/remote node require it than such vectors are incompatible.
func (*FeatureVector) Copy ¶
func (f *FeatureVector) Copy() *FeatureVector
Copy generate new distinct instance of the feature vector.
func (*FeatureVector) Encode ¶
func (f *FeatureVector) Encode(w io.Writer) error
Encode encodes the features vector into bytes representation, every feature encoded as 2 bits where odd bit determine whether the feature is "optional" and even bit told us whether the feature is "required". The even/odd semantic allows future incompatible changes, or backward compatible changes. Bits generally assigned in pairs, so that optional features can later become compulsory.
func (*FeatureVector) SetFeatureFlag ¶
func (f *FeatureVector) SetFeatureFlag(name featureName, flag featureFlag) error
SetFeatureFlag assign flag to the feature.
type FundingCreated ¶
type FundingCreated struct { // PendingChannelID serves to uniquely identify the future channel // created by the initiated single funder workflow. PendingChannelID [32]byte // FundingPoint is the outpoint of the funding transaction created by // Alice. With this, Bob is able to generate both his version and // Alice's version of the commitment transaction. FundingPoint wire.OutPoint // CommitSig is Alice's signature from Bob's version of the commitment // transaction. CommitSig *btcec.Signature }
FundingCreated is sent from Alice (the initiator) to Bob (the responder), once Alice receives Bob's contributions as well as his channel constraints. Once bob receives this message, he'll gain access to an immediately broadcastable commitment transaction and will reply with a signature for Alice's version of the commitment transaction.
func (*FundingCreated) Decode ¶
func (f *FundingCreated) Decode(r io.Reader, pver uint32) error
Decode deserializes the serialized FundingCreated stored in the passed io.Reader into the target FundingCreated using the deserialization rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*FundingCreated) Encode ¶
func (f *FundingCreated) Encode(w io.Writer, pver uint32) error
Encode serializes the target FundingCreated into the passed io.Writer implementation. Serialization will observe the rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*FundingCreated) MaxPayloadLength ¶
func (f *FundingCreated) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload length for a FundingCreated message.
This is part of the lnwire.Message interface.
func (*FundingCreated) MsgType ¶
func (f *FundingCreated) MsgType() MessageType
MsgType returns the uint32 code which uniquely identifies this message as a FundingCreated on the wire.
This is part of the lnwire.Message interface.
type FundingLocked ¶
type FundingLocked struct { // ChanID is the outpoint of the channel's funding transaction. This // can be used to query for the channel in the database. ChanID ChannelID // NextPerCommitmentPoint is the secret that can be used to revoke the // next commitment transaction for the channel. NextPerCommitmentPoint *btcec.PublicKey }
FundingLocked is the message that both parties to a new channel creation send once they have observed the funding transaction being confirmed on the blockchain. FundingLocked contains the signatures necessary for the channel participants to advertise the existence of the channel to the rest of the network.
func NewFundingLocked ¶
func NewFundingLocked(cid ChannelID, npcp *btcec.PublicKey) *FundingLocked
NewFundingLocked creates a new FundingLocked message, populating it with the necessary IDs and revocation secret.
func (*FundingLocked) Decode ¶
func (c *FundingLocked) Decode(r io.Reader, pver uint32) error
Decode deserializes the serialized FundingLocked message stored in the passed io.Reader into the target FundingLocked using the deserialization rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*FundingLocked) Encode ¶
func (c *FundingLocked) Encode(w io.Writer, pver uint32) error
Encode serializes the target FundingLocked message into the passed io.Writer implementation. Serialization will observe the rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*FundingLocked) MaxPayloadLength ¶
func (c *FundingLocked) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload length for a FundingLocked message. This is calculated by summing the max length of all the fields within a FundingLocked message.
This is part of the lnwire.Message interface.
func (*FundingLocked) MsgType ¶
func (c *FundingLocked) MsgType() MessageType
MsgType returns the uint32 code which uniquely identifies this message as a FundingLocked message on the wire.
This is part of the lnwire.Message interface.
type FundingSigned ¶
type FundingSigned struct { // ChannelPoint is the particular active channel that this // FundingSigned is bound to. ChanID ChannelID // CommitSig is Bob's signature for Alice's version of the commitment // transaction. CommitSig *btcec.Signature }
FundingSigned is sent from Bob (the responder) to Alice (the initiator) after receiving the funding outpoint and her signature for Bob's version of the commitment transaction.
func (*FundingSigned) Decode ¶
func (f *FundingSigned) Decode(r io.Reader, pver uint32) error
Decode deserializes the serialized FundingSigned stored in the passed io.Reader into the target FundingSigned using the deserialization rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*FundingSigned) Encode ¶
func (f *FundingSigned) Encode(w io.Writer, pver uint32) error
Encode serializes the target FundingSigned into the passed io.Writer implementation. Serialization will observe the rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*FundingSigned) MaxPayloadLength ¶
func (f *FundingSigned) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload length for a FundingSigned message.
This is part of the lnwire.Message interface.
func (*FundingSigned) MsgType ¶
func (f *FundingSigned) MsgType() MessageType
MsgType returns the uint32 code which uniquely identifies this message as a FundingSigned on the wire.
This is part of the lnwire.Message interface.
type Init ¶
type Init struct { // GlobalFeatures is feature vector which affects HTLCs and thus are // also advertised to other nodes. GlobalFeatures *FeatureVector // LocalFeatures is feature vector which only affect the protocol // between two nodes. LocalFeatures *FeatureVector }
Init is the first message reveals the features supported or required by this node. Nodes wait for receipt of the other's features to simplify error diagnosis where features are incompatible. Each node MUST wait to receive init before sending any other messages.
func NewInitMessage ¶
func NewInitMessage(gf, lf *FeatureVector) *Init
NewInitMessage creates new instance of init message object.
func (*Init) Decode ¶
Decode deserializes a serialized Init message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Init) Encode ¶
Encode serializes the target Init into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*Init) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for a Init complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Init) MsgType ¶
func (msg *Init) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type Message ¶
type Message interface { Serializable MsgType() MessageType MaxPayloadLength(uint32) uint32 }
Message is an interface that defines a lightning wire protocol message. The interface is general in order to allow implementing types full control over the representation of its data.
type MessageType ¶
type MessageType uint16
MessageType is the unique 2 byte big-endian integer that indicates the type of message on the wire. All messages have a very simple header which consists simply of 2-byte message type. We omit a length field, and checksum as the Lighting Protocol is intended to be encapsulated within a confidential+authenticated cryptographic messaging protocol.
func (MessageType) String ¶
func (t MessageType) String() string
String return the string representation of message type.
type NetAddress ¶
type NetAddress struct { // IdentityKey is the long-term static public key for a node. This node is // used throughout the network as a node's identity key. It is used to // authenticate any data sent to the network on behalf of the node, and // additionally to establish a confidential+authenticated connection with // the node. IdentityKey *btcec.PublicKey // Address is is the IP address and port of the node. Address *net.TCPAddr // ChainNet is the Bitcoin network this node is associated with. // TODO(roasbeef): make a slice in the future for multi-chain ChainNet wire.BitcoinNet }
NetAddress represents information pertaining to the identity and network reachability of a peer. Information stored includes the node's identity public key for establishing a confidential+authenticated connection, the service bits it supports, and a TCP address the node is reachable at.
TODO(roasbeef): merge with LinkNode in some fashion
func (*NetAddress) Network ¶
func (n *NetAddress) Network() string
Network returns the name of the network this address is binded to.
This part of the net.Addr interface.
func (*NetAddress) String ¶
func (n *NetAddress) String() string
String returns a human readable string describing the target NetAddress. The current string format is: <pubkey>@host.
This part of the net.Addr interface.
type NodeAnnouncement ¶
type NodeAnnouncement struct { // Signature is used to prove the ownership of node id. Signature *btcec.Signature // Timestamp allows ordering in the case of multiple // announcements. Timestamp uint32 // NodeID is a public key which is used as node identification. NodeID *btcec.PublicKey // RGBColor is used to customize their node's appearance in // maps and graphs RGBColor RGB // Alias is used to customize their node's appearance in maps and graphs Alias Alias // Features is the list of protocol features this node supports. Features *FeatureVector // Address includes two specification fields: 'ipv6' and 'port' on which // the node is accepting incoming connections. Addresses []net.Addr }
NodeAnnouncement message is used to announce the presence of a Lightning node and also to signal that the node is accepting incoming connections. Each NodeAnnouncement authenticating the advertised information within the announcement via a signature using the advertised node pubkey.
func (*NodeAnnouncement) DataToSign ¶
func (a *NodeAnnouncement) DataToSign() ([]byte, error)
DataToSign returns the part of the message that should be signed.
func (*NodeAnnouncement) Decode ¶
func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized NodeAnnouncement stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*NodeAnnouncement) Encode ¶
func (a *NodeAnnouncement) Encode(w io.Writer, pver uint32) error
Encode serializes the target NodeAnnouncement into the passed io.Writer observing the protocol version specified.
func (*NodeAnnouncement) MaxPayloadLength ¶
func (a *NodeAnnouncement) MaxPayloadLength(pver uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for this message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*NodeAnnouncement) MsgType ¶
func (a *NodeAnnouncement) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type OpaqueReason ¶
type OpaqueReason []byte
OpaqueReason is an opaque encrypted byte slice that encodes the exact failure reason and additional some supplemental data. The contents of this slice can only be decrypted by the sender of the original HTLC.
type OpenChannel ¶
type OpenChannel struct { // ChainHash is the target chain that the initiator wishes to open a // channel within. ChainHash chainhash.Hash // PendingChannelID serves to uniquely identify the future channel // created by the initiated single funder workflow. PendingChannelID [32]byte // FundingAmount is the amount of satoshis that the initiator of the // channel wishes to use as the total capacity of the channel. The // initial balance of the funding will be this value minus the push // amount (if set). FundingAmount btcutil.Amount // PushAmount is the value that the initiating party wishes to "push" // to the responding as part of the first commitment state. If the // responder accepts, then this will be their initial balance. // // TODO(roasbeef): is msat PushAmount btcutil.Amount // DustLimit is the specific dust limit the sender of this message // would like enforced on their version of the commitment transaction. // Any output below this value will be "trimmed" from the commitment // transaction, with the amount of the HTLC going to dust. DustLimit btcutil.Amount // MaxValueInFlight represents the maximum amount of coins that can be // pending within the channel at any given time. If the amount of funds // in limbo exceeds this amount, then the channel will be failed. MaxValueInFlight btcutil.Amount // ChannelReserve is the amount of BTC that the receiving party MUST // maintain a balance above at all times. This is a safety mechanism to // ensure that both sides always have skin in the game during the // channel's lifetime. ChannelReserve btcutil.Amount // HtlcMinimum is the smallest HTLC that the sender of this message // will accept. // // TODO(roasbeef): is msat HtlcMinimum uint32 // FeePerKiloWeight is the initial fee rate that the initiator suggests // for both commitment transaction. This value is expressed in sat per // kilo-weight. FeePerKiloWeight uint32 // CsvDelay is the number of blocks to use for the relative time lock // in the pay-to-self output of both commitment transactions. CsvDelay uint16 // MaxAcceptedHTLCs is the total number of incoming HTLC's that the // sender of this channel will accept. MaxAcceptedHTLCs uint16 // FundingKey is the key that should be used on behalf of the sender // within the 2-of-2 multi-sig output that it contained within the // funding transaction. FundingKey *btcec.PublicKey // RevocationPoint is the base revocation point for the sending party. // Any commitment transaction belonging to the receiver of this message // should use this key and their per-commitment point to derive the // revocation key for the commitment transaction. RevocationPoint *btcec.PublicKey // PaymentPoint is the base payment point for the sending party. This // key should be combined with the per commitment point for a // particular commitment state in order to create the key that should // be used in any output that pays directly to the sending party, and // also within the HTLC covenant transactions. PaymentPoint *btcec.PublicKey // DelayedPaymentPoint is the delay point for the sending party. This // key should be combined with the per commitment point to derive the // keys that are used in outputs of the sender's commitment transaction // where they claim funds. DelayedPaymentPoint *btcec.PublicKey // FirstCommitmentPoint is the first commitment point for the sending // party. This value should be combined with the receiver's revocation // base point in order to derive the revocation keys that are placed // within the commitment transaction of the sender. FirstCommitmentPoint *btcec.PublicKey // ChannelFlags is a bit-field which allows the initiator of the // channel to specify further behavior surrounding the channel. // Currently, the least significant bit of this bit field indicates the // initiator of the channel wishes to advertise this channel publicly. ChannelFlags byte }
OpenChannel is the message Alice sends to Bob if we should like to create a channel with Bob where she's the sole provider of funds to the channel. Single funder channels simplify the initial funding workflow, are supported by nodes backed by SPV Bitcoin clients, and have a simpler security models than dual funded channels.
func (*OpenChannel) Decode ¶
func (o *OpenChannel) Decode(r io.Reader, pver uint32) error
Decode deserializes the serialized OpenChannel stored in the passed io.Reader into the target OpenChannel using the deserialization rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*OpenChannel) Encode ¶
func (o *OpenChannel) Encode(w io.Writer, pver uint32) error
Encode serializes the target OpenChannel into the passed io.Writer implementation. Serialization will observe the rules defined by the passed protocol version.
This is part of the lnwire.Message interface.
func (*OpenChannel) MaxPayloadLength ¶
func (o *OpenChannel) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload length for a OpenChannel message.
This is part of the lnwire.Message interface.
func (*OpenChannel) MsgType ¶
func (o *OpenChannel) MsgType() MessageType
MsgType returns the MessageType code which uniquely identifies this message as a OpenChannel on the wire.
This is part of the lnwire.Message interface.
type Ping ¶
type Ping struct { // NumPongBytes is the number of bytes the pong response to this // message should carry. NumPongBytes uint16 // PaddingBytes is a set of opaque bytes used to pad out this ping // message. Using this field in conjunction to the one above, it's // possible for node to generate fake cover traffic. PaddingBytes PingPayload }
Ping defines a message which is sent by peers periodically to determine if the connection is still valid. Each ping message carries the number of bytes to pad the pong response with, and also a number of bytes to be ignored at the end of the ping message (which is padding).
func (*Ping) Decode ¶
Decode deserializes a serialized Ping message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Ping) Encode ¶
Encode serializes the target Ping into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (Ping) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for a Ping complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Ping) MsgType ¶
func (p *Ping) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type PingPayload ¶
type PingPayload []byte
PingPayload is a set of opaque bytes used to pad out a ping message.
type PkScript ¶
type PkScript []byte
PkScript is simple type definition which represents a raw serialized public key script.
type Pong ¶
type Pong struct { // PongBytes is a set of opaque bytes that corresponds to the // NumPongBytes defined in the ping message that this this pong is // replying to. PongBytes PongPayload }
Pong defines a message which is the direct response to a received Ping message. A Pong reply indicates that a connection is still active. The Pong reply to a Ping message should contain the nonce carried in the original Pong message.
func (*Pong) Decode ¶
Decode deserializes a serialized Pong message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Pong) Encode ¶
Encode serializes the target Pong into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*Pong) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for a Pong complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Pong) MsgType ¶
func (p *Pong) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type PongPayload ¶
type PongPayload []byte
PongPayload is a set of opaque bytes sent in response to a ping message.
type RGB ¶
type RGB struct {
// contains filtered or unexported fields
}
RGB is used to represent the color.
type RevokeAndAck ¶
type RevokeAndAck struct { // ChanID uniquely identifies to which currently active channel this // RevokeAndAck applies to. ChanID ChannelID // Revocation is the preimage to the revocation hash of the now prior // commitment transaction. Revocation [32]byte // NextRevocationKey is the next commitment point which should be used // for the next commitment transaction the remote peer creates for us. // This, in conjunction without revocation base point will be used to // create the proper revocation key used within the commitment // transaction. NextRevocationKey *btcec.PublicKey }
RevokeAndAck is sent by either side once a CommitSig message has been received, and validated. This message serves to revoke the prior commitment transaction, which was the most up to date version until a CommitSig message referencing the specified ChannelPoint was received. Additionally, this message also piggyback's the next revocation hash that Alice should use when constructing the Bob's version of the next commitment transaction (which would be done before sending a CommitSig message). This piggybacking allows Alice to send the next CommitSig message modifying Bob's commitment transaction without first asking for a revocation hash initially.
func NewRevokeAndAck ¶
func NewRevokeAndAck() *RevokeAndAck
NewRevokeAndAck creates a new RevokeAndAck message.
func (*RevokeAndAck) Decode ¶
func (c *RevokeAndAck) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized RevokeAndAck message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*RevokeAndAck) Encode ¶
func (c *RevokeAndAck) Encode(w io.Writer, pver uint32) error
Encode serializes the target RevokeAndAck into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*RevokeAndAck) MaxPayloadLength ¶
func (c *RevokeAndAck) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for a RevokeAndAck complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*RevokeAndAck) MsgType ¶
func (c *RevokeAndAck) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type Serializable ¶
type Serializable interface { // Decode reads the bytes stream and converts it to the object. Decode(io.Reader, uint32) error // Encode converts object to the bytes stream and write it into the // writer. Encode(io.Writer, uint32) error }
Serializable is an interface which defines a lightning wire serializable object.
type SharedFeatures ¶
type SharedFeatures struct {
}SharedFeatures is a product of comparison of two features vector which consist of features which are present in both local and remote features vectors.
func (*SharedFeatures) IsActive ¶
func (f *SharedFeatures) IsActive(name featureName) bool
IsActive checks is feature active or not, it might be disabled during comparision with remote feature vector if it was optional and remote peer doesn't support it.
type ShortChannelID ¶
type ShortChannelID struct { // BlockHeight is the height of the block where funding transaction // located. // // NOTE: This field is limited to 3 bytes. BlockHeight uint32 // TxIndex is a position of funding transaction within a block. // // NOTE: This field is limited to 3 bytes. TxIndex uint32 // TxPosition indicating transaction output which pays to the channel. TxPosition uint16 }
ShortChannelID represent the set of data which is needed to retrieve all necessary data to validate the channel existence.
func NewShortChanIDFromInt ¶
func NewShortChanIDFromInt(chanID uint64) ShortChannelID
NewShortChanIDFromInt returns a new ShortChannelID which is the decoded version of the compact channel ID encoded within the uint64. The format of the compact channel ID is as follows: 3 bytes for the block height, 3 bytes for the transaction index, and 2 bytes for the output index.
func (*ShortChannelID) ToUint64 ¶
func (c *ShortChannelID) ToUint64() uint64
ToUint64 converts the ShortChannelID into a compact format encoded within a uint64 (8 bytes).
type Shutdown ¶
type Shutdown struct { // ChannelID serves to identify which channel is to be closed. ChannelID ChannelID // Address is the script to which the channel funds will be paid. Address DeliveryAddress }
Shutdown is sent by either side in order to initiate the cooperative closure of a channel. This message is sparse as both sides implicitly have the information necessary to construct a transaction that will send the settled funds of both parties to the final delivery addresses negotiated during the funding workflow.
func NewShutdown ¶
func NewShutdown(cid ChannelID, addr DeliveryAddress) *Shutdown
NewShutdown creates a new Shutdown message.
func (*Shutdown) Decode ¶
Decode deserializes a serialized Shutdown stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Shutdown) Encode ¶
Encode serializes the target Shutdown into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*Shutdown) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for this message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*Shutdown) MsgType ¶
func (s *Shutdown) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type UnknownMessage ¶
type UnknownMessage struct {
// contains filtered or unexported fields
}
UnknownMessage is an implementation of the error interface that allows the creation of an error in response to an unknown message.
func (*UnknownMessage) Error ¶
func (u *UnknownMessage) Error() string
Error returns a human readable string describing the error.
This is part of the error interface.
type UpdateAddHTLC ¶
type UpdateAddHTLC struct { // ChanID is the particular active channel that this UpdateAddHTLC is // bound to. ChanID ChannelID // ID is the identification server for this HTLC. This value is // explicitly included as it allows nodes to survive single-sided // restarts. The ID value for this sides starts at zero, and increases // with each offered HTLC. ID uint64 // Expiry is the number of blocks after which this HTLC should expire. // It is the receiver's duty to ensure that the outgoing HTLC has a // sufficient expiry value to allow her to redeem the incoming HTLC. Expiry uint32 // Amount is the amount of satoshis this HTLC is worth. Amount btcutil.Amount // PaymentHash is the payment hash to be included in the HTLC this // request creates. The pre-image to this HTLC must be revelaed by the // upstream peer in order to fully settle the HTLC. PaymentHash [32]byte // OnionBlob is the raw serialized mix header used to route an HTLC in // a privacy-preserving manner. The mix header is defined currently to // be parsed as a 4-tuple: (groupElement, routingInfo, headerMAC, // body). First the receiving node should use the groupElement, and // its current onion key to derive a shared secret with the source. // Once the shared secret has been derived, the headerMAC should be // checked FIRST. Note that the MAC only covers the routingInfo field. // If the MAC matches, and the shared secret is fresh, then the node // should strip off a layer of encryption, exposing the next hop to be // used in the subsequent UpdateAddHTLC message. OnionBlob [OnionPacketSize]byte }
UpdateAddHTLC is the message sent by Alice to Bob when she wishes to add an HTLC to his remote commitment transaction. In addition to information detailing the value, the ID, expiry, and the onion blob is also included which allows Bob to derive the next hop in the route. The HTLC added by this message is to be added to the remote node's "pending" HTLC's. A subsequent CommitSig message will move the pending HTLC to the newly created commitment transaction, marking them as "staged".
func NewUpdateAddHTLC ¶
func NewUpdateAddHTLC() *UpdateAddHTLC
NewUpdateAddHTLC returns a new empty UpdateAddHTLC message.
func (*UpdateAddHTLC) Decode ¶
func (c *UpdateAddHTLC) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized UpdateAddHTLC message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateAddHTLC) Encode ¶
func (c *UpdateAddHTLC) Encode(w io.Writer, pver uint32) error
Encode serializes the target UpdateAddHTLC into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*UpdateAddHTLC) MaxPayloadLength ¶
func (c *UpdateAddHTLC) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for a UpdateAddHTLC complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateAddHTLC) MsgType ¶
func (c *UpdateAddHTLC) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type UpdateFailHTLC ¶
type UpdateFailHTLC struct { // ChanIDPoint is the particular active channel that this UpdateFailHTLC // is bound to. ChanID ChannelID // ID references which HTLC on the remote node's commitment transaction // has timed out. ID uint64 // Reason is an onion-encrypted blob that details why the HTLC was // failed. This blob is only fully decryptable by the initiator of the // HTLC message. Reason OpaqueReason }
UpdateFailHTLC is sent by Alice to Bob in order to remove a previously added HTLC. Upon receipt of an UpdateFailHTLC the HTLC should be removed from the next commitment transaction, with the UpdateFailHTLC propagated backwards in the route to fully undo the HTLC.
func (*UpdateFailHTLC) Decode ¶
func (c *UpdateFailHTLC) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized UpdateFailHTLC message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFailHTLC) Encode ¶
func (c *UpdateFailHTLC) Encode(w io.Writer, pver uint32) error
Encode serializes the target UpdateFailHTLC into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*UpdateFailHTLC) MaxPayloadLength ¶
func (c *UpdateFailHTLC) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for a UpdateFailHTLC complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFailHTLC) MsgType ¶
func (c *UpdateFailHTLC) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type UpdateFailMalformedHTLC ¶
type UpdateFailMalformedHTLC struct { // ChanID is the particular active channel that this // UpdateFailMalformedHTLC is bound to. ChanID ChannelID // ID references which HTLC on the remote node's commitment transaction // has timed out. ID uint64 // ShaOnionBlob hash of the onion blob on which can't be parsed by the // node in the payment path. ShaOnionBlob [sha256.Size]byte // FailureCode the exact reason why onion blob haven't been parsed. FailureCode FailCode }
UpdateFailMalformedHTLC is sent by either the payment forwarder or by payment receiver to the payment sender in order to notify it that the onion blob can't be parsed. For that reason we send this message instead of obfuscate the onion failure.
func (*UpdateFailMalformedHTLC) Decode ¶
func (c *UpdateFailMalformedHTLC) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized UpdateFailMalformedHTLC message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFailMalformedHTLC) Encode ¶
func (c *UpdateFailMalformedHTLC) Encode(w io.Writer, pver uint32) error
Encode serializes the target UpdateFailMalformedHTLC into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*UpdateFailMalformedHTLC) MaxPayloadLength ¶
func (c *UpdateFailMalformedHTLC) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for a UpdateFailMalformedHTLC complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFailMalformedHTLC) MsgType ¶
func (c *UpdateFailMalformedHTLC) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type UpdateFee ¶
type UpdateFee struct { // ChanID is the channel that this UpdateFee is meant for. ChanID ChannelID // FeePerKw is the fee-per-kw on commit transactions that the sender of // this message wants to use for this channel. FeePerKw btcutil.Amount }
UpdateFee is the message the channel initiator sends to the other peer if the channel commitment fee needs to be updated.
func NewUpdateFee ¶
NewUpdateFee creates a new UpdateFee message.
func (*UpdateFee) Decode ¶
Decode deserializes a serialized UpdateFee message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFee) Encode ¶
Encode serializes the target UpdateFee into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*UpdateFee) MaxPayloadLength ¶
MaxPayloadLength returns the maximum allowed payload size for a UpdateFee complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFee) MsgType ¶
func (c *UpdateFee) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
type UpdateFufillHTLC ¶
type UpdateFufillHTLC struct { // ChanID references an active channel which holds the HTLC to be // settled. ChanID ChannelID // ID denotes the exact HTLC stage within the receiving node's // commitment transaction to be removed. ID uint64 // PaymentPreimage is the R-value preimage required to fully settle an // HTLC. PaymentPreimage [32]byte }
UpdateFufillHTLC is sent by Alice to Bob when she wishes to settle a particular HTLC referenced by its HTLCKey within a specific active channel referenced by ChannelPoint. A subsequent CommitSig message will be sent by Alice to "lock-in" the removal of the specified HTLC, possible containing a batch signature covering several settled HTLC's.
func NewUpdateFufillHTLC ¶
func NewUpdateFufillHTLC(chanID ChannelID, id uint64, preimage [32]byte) *UpdateFufillHTLC
NewUpdateFufillHTLC returns a new empty UpdateFufillHTLC.
func (*UpdateFufillHTLC) Decode ¶
func (c *UpdateFufillHTLC) Decode(r io.Reader, pver uint32) error
Decode deserializes a serialized UpdateFufillHTLC message stored in the passed io.Reader observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFufillHTLC) Encode ¶
func (c *UpdateFufillHTLC) Encode(w io.Writer, pver uint32) error
Encode serializes the target UpdateFufillHTLC into the passed io.Writer observing the protocol version specified.
This is part of the lnwire.Message interface.
func (*UpdateFufillHTLC) MaxPayloadLength ¶
func (c *UpdateFufillHTLC) MaxPayloadLength(uint32) uint32
MaxPayloadLength returns the maximum allowed payload size for a UpdateFufillHTLC complete message observing the specified protocol version.
This is part of the lnwire.Message interface.
func (*UpdateFufillHTLC) MsgType ¶
func (c *UpdateFufillHTLC) MsgType() MessageType
MsgType returns the integer uniquely identifying this message type on the wire.
This is part of the lnwire.Message interface.
Source Files ¶
- accept_channel.go
- announcement_signatures.go
- channel_announcement.go
- channel_id.go
- channel_update.go
- closing_signed.go
- commit_sig.go
- error.go
- features.go
- funding_created.go
- funding_locked.go
- funding_signed.go
- init_message.go
- lnwire.go
- message.go
- netaddress.go
- node_announcement.go
- onion_error.go
- open_channel.go
- ping.go
- pong.go
- revoke_and_ack.go
- short_channel_id.go
- shutdown.go
- signature.go
- update_add_htlc.go
- update_fail_htlc.go
- update_fail_malformed_htlc.go
- update_fee.go
- update_fulfill_htlc.go