Documentation ¶
Overview ¶
Code derived from https:// github.com/btcsuite/btcd/blob/master/wire/message.go
Index ¶
- Constants
- Variables
- func ValidatePkScript(pkScript PkScript) error
- func WriteMessage(w io.Writer, msg Message, pver uint32, btcnet wire.BitcoinNet) (int, error)
- type CloseComplete
- func (c *CloseComplete) Command() uint32
- func (c *CloseComplete) Decode(r io.Reader, pver uint32) error
- func (c *CloseComplete) Encode(w io.Writer, pver uint32) error
- func (c *CloseComplete) MaxPayloadLength(uint32) uint32
- func (c *CloseComplete) String() string
- func (c *CloseComplete) Validate() error
- type CloseRequest
- type CommitHeight
- type CommitRevocation
- func (c *CommitRevocation) Command() uint32
- func (c *CommitRevocation) Decode(r io.Reader, pver uint32) error
- func (c *CommitRevocation) Encode(w io.Writer, pver uint32) error
- func (c *CommitRevocation) MaxPayloadLength(uint32) uint32
- func (c *CommitRevocation) String() string
- func (c *CommitRevocation) Validate() error
- type CommitSignature
- func (c *CommitSignature) Command() uint32
- func (c *CommitSignature) Decode(r io.Reader, pver uint32) error
- func (c *CommitSignature) Encode(w io.Writer, pver uint32) error
- func (c *CommitSignature) MaxPayloadLength(uint32) uint32
- func (c *CommitSignature) String() string
- func (c *CommitSignature) Validate() error
- type CreditsAmount
- type ErrorGeneric
- type FundingRequest
- func (c *FundingRequest) Command() uint32
- func (c *FundingRequest) Decode(r io.Reader, pver uint32) error
- func (c *FundingRequest) Encode(w io.Writer, pver uint32) error
- func (c *FundingRequest) MaxPayloadLength(uint32) uint32
- func (c *FundingRequest) String() string
- func (c *FundingRequest) Validate() error
- type FundingResponse
- func (c *FundingResponse) Command() uint32
- func (c *FundingResponse) Decode(r io.Reader, pver uint32) error
- func (c *FundingResponse) Encode(w io.Writer, pver uint32) error
- func (c *FundingResponse) MaxPayloadLength(uint32) uint32
- func (c *FundingResponse) String() string
- func (c *FundingResponse) Validate() error
- type FundingSignAccept
- func (c *FundingSignAccept) Command() uint32
- func (c *FundingSignAccept) Decode(r io.Reader, pver uint32) error
- func (c *FundingSignAccept) Encode(w io.Writer, pver uint32) error
- func (c *FundingSignAccept) MaxPayloadLength(uint32) uint32
- func (c *FundingSignAccept) String() string
- func (c *FundingSignAccept) Validate() error
- type FundingSignComplete
- func (c *FundingSignComplete) Command() uint32
- func (c *FundingSignComplete) Decode(r io.Reader, pver uint32) error
- func (c *FundingSignComplete) Encode(w io.Writer, pver uint32) error
- func (c *FundingSignComplete) MaxPayloadLength(uint32) uint32
- func (c *FundingSignComplete) String() string
- func (c *FundingSignComplete) Validate() error
- type HTLCAddAccept
- func (c *HTLCAddAccept) Command() uint32
- func (c *HTLCAddAccept) Decode(r io.Reader, pver uint32) error
- func (c *HTLCAddAccept) Encode(w io.Writer, pver uint32) error
- func (c *HTLCAddAccept) MaxPayloadLength(uint32) uint32
- func (c *HTLCAddAccept) String() string
- func (c *HTLCAddAccept) Validate() error
- type HTLCAddReject
- func (c *HTLCAddReject) Command() uint32
- func (c *HTLCAddReject) Decode(r io.Reader, pver uint32) error
- func (c *HTLCAddReject) Encode(w io.Writer, pver uint32) error
- func (c *HTLCAddReject) MaxPayloadLength(uint32) uint32
- func (c *HTLCAddReject) String() string
- func (c *HTLCAddReject) Validate() error
- type HTLCAddRequest
- func (c *HTLCAddRequest) Command() uint32
- func (c *HTLCAddRequest) Decode(r io.Reader, pver uint32) error
- func (c *HTLCAddRequest) Encode(w io.Writer, pver uint32) error
- func (c *HTLCAddRequest) MaxPayloadLength(uint32) uint32
- func (c *HTLCAddRequest) String() string
- func (c *HTLCAddRequest) Validate() error
- type HTLCKey
- type HTLCSettleAccept
- func (c *HTLCSettleAccept) Command() uint32
- func (c *HTLCSettleAccept) Decode(r io.Reader, pver uint32) error
- func (c *HTLCSettleAccept) Encode(w io.Writer, pver uint32) error
- func (c *HTLCSettleAccept) MaxPayloadLength(uint32) uint32
- func (c *HTLCSettleAccept) String() string
- func (c *HTLCSettleAccept) Validate() error
- type HTLCSettleRequest
- func (c *HTLCSettleRequest) Command() uint32
- func (c *HTLCSettleRequest) Decode(r io.Reader, pver uint32) error
- func (c *HTLCSettleRequest) Encode(w io.Writer, pver uint32) error
- func (c *HTLCSettleRequest) MaxPayloadLength(uint32) uint32
- func (c *HTLCSettleRequest) String() string
- func (c *HTLCSettleRequest) Validate() error
- type HTLCTimeoutAccept
- func (c *HTLCTimeoutAccept) Command() uint32
- func (c *HTLCTimeoutAccept) Decode(r io.Reader, pver uint32) error
- func (c *HTLCTimeoutAccept) Encode(w io.Writer, pver uint32) error
- func (c *HTLCTimeoutAccept) MaxPayloadLength(uint32) uint32
- func (c *HTLCTimeoutAccept) String() string
- func (c *HTLCTimeoutAccept) Validate() error
- type HTLCTimeoutRequest
- func (c *HTLCTimeoutRequest) Command() uint32
- func (c *HTLCTimeoutRequest) Decode(r io.Reader, pver uint32) error
- func (c *HTLCTimeoutRequest) Encode(w io.Writer, pver uint32) error
- func (c *HTLCTimeoutRequest) MaxPayloadLength(uint32) uint32
- func (c *HTLCTimeoutRequest) String() string
- func (c *HTLCTimeoutRequest) Validate() error
- type Message
- type PkScript
Constants ¶
const ( MSGID_FUNDREQUEST = 0x30 MSGID_FUNDRESPONSE = 0x31 MSGID_CLOSEREQUEST = 0x40 MSGID_CLOSERESPONSE = 0x41 MSGID_TEXTCHAT = 0x70 MSGID_FWDMSG = 0x20 MSGID_FWDAUTHREQ = 0x21 )
message type identifyer bytes
const ( // Funding channel open CmdFundingRequest = uint32(200) CmdFundingResponse = uint32(210) CmdFundingSignAccept = uint32(220) CmdFundingSignComplete = uint32(230) // Close channel CmdCloseRequest = uint32(300) CmdCloseComplete = uint32(310) // TODO Renumber to 1100 // HTLC payment CmdHTLCAddRequest = uint32(1000) CmdHTLCAddAccept = uint32(1010) CmdHTLCAddReject = uint32(1020) // TODO Renumber to 1200 // HTLC settlement CmdHTLCSettleRequest = uint32(1100) CmdHTLCSettleAccept = uint32(1110) // HTLC timeout CmdHTLCTimeoutRequest = uint32(1300) CmdHTLCTimeoutAccept = uint32(1310) // Commitments CmdCommitSignature = uint32(2000) CmdCommitRevocation = uint32(2010) // Error CmdErrorGeneric = uint32(4000) )
const MaxMessagePayload = 1024 * 1024 * 32 // 32MB
const MessageHeaderSize = 12
4-byte network + 4-byte message id + payload-length 4-byte
Variables ¶
var MAX_SLICE_LENGTH = 65535
Functions ¶
func ValidatePkScript ¶
Validates whether a PkScript byte array is P2SH or P2PKH
func WriteMessage ¶
Types ¶
type CloseComplete ¶
type CloseComplete struct { ReservationID uint64 ResponderCloseSig *btcec.Signature // Requester's Commitment CloseShaHash *wire.ShaHash // TxID of the Close Tx }
func (*CloseComplete) Command ¶
func (c *CloseComplete) Command() uint32
func (*CloseComplete) Encode ¶
func (c *CloseComplete) Encode(w io.Writer, pver uint32) error
Serializes the item from the CloseComplete struct Writes the data to w
func (*CloseComplete) MaxPayloadLength ¶
func (c *CloseComplete) MaxPayloadLength(uint32) uint32
func (*CloseComplete) String ¶
func (c *CloseComplete) String() string
func (*CloseComplete) Validate ¶
func (c *CloseComplete) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type CloseRequest ¶
type CloseRequest struct { ReservationID uint64 RequesterCloseSig *btcec.Signature // Requester's Commitment Fee btcutil.Amount }
func (*CloseRequest) Command ¶
func (c *CloseRequest) Command() uint32
func (*CloseRequest) Encode ¶
func (c *CloseRequest) Encode(w io.Writer, pver uint32) error
Serializes the item from the CloseRequest struct Writes the data to w
func (*CloseRequest) MaxPayloadLength ¶
func (c *CloseRequest) MaxPayloadLength(uint32) uint32
func (*CloseRequest) String ¶
func (c *CloseRequest) String() string
func (*CloseRequest) Validate ¶
func (c *CloseRequest) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type CommitHeight ¶
type CommitHeight uint64
type CommitRevocation ¶
type CommitRevocation struct { // We can use a different data type for this if necessary... ChannelID uint64 // Height of the commitment // You should have the most recent commitment height stored locally // This should be validated! // This is used for shachain. // Each party increments their own CommitmentHeight, they can differ for // each part of the Commitment. CommitmentHeight uint64 // Revocation to use RevocationProof [20]byte }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func NewCommitRevocation ¶
func NewCommitRevocation() *CommitRevocation
Creates a new CommitRevocation
func (*CommitRevocation) Command ¶
func (c *CommitRevocation) Command() uint32
func (*CommitRevocation) Encode ¶
func (c *CommitRevocation) Encode(w io.Writer, pver uint32) error
Serializes the item from the CommitRevocation struct Writes the data to w
func (*CommitRevocation) MaxPayloadLength ¶
func (c *CommitRevocation) MaxPayloadLength(uint32) uint32
func (*CommitRevocation) String ¶
func (c *CommitRevocation) String() string
func (*CommitRevocation) Validate ¶
func (c *CommitRevocation) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type CommitSignature ¶
type CommitSignature struct { // We can use a different data type for this if necessary... ChannelID uint64 // Height of the commitment // You should have the most recent commitment height stored locally // This should be validated! // This is used for shachain. // Each party increments their own CommitmentHeight, they can differ for // each part of the Commitment. CommitmentHeight uint64 // List of HTLC Keys which are updated from all parties UpdatedHTLCKeys []uint64 // Hash of the revocation to use RevocationHash [20]byte // Total miners' fee that was used Fee btcutil.Amount // Signature for the new Commitment CommitSig *btcec.Signature // Requester's Commitment }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func (*CommitSignature) Command ¶
func (c *CommitSignature) Command() uint32
func (*CommitSignature) Encode ¶
func (c *CommitSignature) Encode(w io.Writer, pver uint32) error
Serializes the item from the CommitSignature struct Writes the data to w
func (*CommitSignature) MaxPayloadLength ¶
func (c *CommitSignature) MaxPayloadLength(uint32) uint32
func (*CommitSignature) String ¶
func (c *CommitSignature) String() string
func (*CommitSignature) Validate ¶
func (c *CommitSignature) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type CreditsAmount ¶
type CreditsAmount int32 // Credits (XCB, accountants should use XCB :^)
Subsatoshi amount (Micro-Satoshi, 1/1000th) Should be a signed int to account for negative fees
"In any science-fiction movie, anywhere in the galaxy, currency is referred to as 'credits.'"
--Sam Humphries. Ebert, Roger (1999). Ebert's bigger little movie glossary. Andrews McMeel. p. 172.
https:// en.wikipedia.org/wiki/List_of_fictional_currencies https:// en.wikipedia.org/wiki/Fictional_currency#Trends_in_the_use_of_fictional_currencies http:// tvtropes.org/pmwiki/pmwiki.php/Main/WeWillSpendCreditsInTheFuture
type ErrorGeneric ¶
type ErrorGeneric struct { // We can use a different data type for this if necessary... ChannelID uint64 // Some kind of message // Max length 8192 Problem string }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func (*ErrorGeneric) Command ¶
func (c *ErrorGeneric) Command() uint32
func (*ErrorGeneric) Encode ¶
func (c *ErrorGeneric) Encode(w io.Writer, pver uint32) error
Serializes the item from the ErrorGeneric struct Writes the data to w
func (*ErrorGeneric) MaxPayloadLength ¶
func (c *ErrorGeneric) MaxPayloadLength(uint32) uint32
func (*ErrorGeneric) String ¶
func (c *ErrorGeneric) String() string
func (*ErrorGeneric) Validate ¶
func (c *ErrorGeneric) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type FundingRequest ¶
type FundingRequest struct { ReservationID uint64 ChannelType uint8 RequesterFundingAmount btcutil.Amount RequesterReserveAmount btcutil.Amount MinFeePerKb btcutil.Amount // The funding requester can request payment // This wallet only allows positive values, // which is a payment to the responder // (This can be used to fund the Reserve) // If the responder disagrees, then the funding request fails // THIS VALUE GOES INTO THE RESPONDER'S FUNDING AMOUNT // total requester input value = RequesterFundingAmount + PaymentAmount + "Total Change" + Fees(?) // RequesterFundingAmount = "Available Balance" + RequesterReserveAmount // Payment SHOULD NOT be acknowledged until the minimum confirmation has elapsed // (Due to double-spend risks the recipient will not want to acknolwedge confirmation until later) // This is to make a payment as part of opening the channel PaymentAmount btcutil.Amount // Minimum number of confirmations to validate transaction MinDepth uint32 // Should double-check the total funding later MinTotalFundingAmount btcutil.Amount // CLTV/CSV lock-time to use LockTime uint32 // Who pays the fees // 0: (default) channel initiator // 1: split // 2: channel responder FeePayer uint8 RevocationHash [20]byte Pubkey *btcec.PublicKey DeliveryPkScript PkScript // *MUST* be either P2PKH or P2SH ChangePkScript PkScript // *MUST* be either P2PKH or P2SH Inputs []*wire.TxIn }
func (*FundingRequest) Command ¶
func (c *FundingRequest) Command() uint32
func (*FundingRequest) Encode ¶
func (c *FundingRequest) Encode(w io.Writer, pver uint32) error
Serializes the item from the FundingRequest struct Writes the data to w
func (*FundingRequest) MaxPayloadLength ¶
func (c *FundingRequest) MaxPayloadLength(uint32) uint32
func (*FundingRequest) String ¶
func (c *FundingRequest) String() string
func (*FundingRequest) Validate ¶
func (c *FundingRequest) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type FundingResponse ¶
type FundingResponse struct { ChannelType uint8 ReservationID uint64 ResponderFundingAmount btcutil.Amount // Responder's funding amount ResponderReserveAmount btcutil.Amount // Responder's reserve amount MinFeePerKb btcutil.Amount // Lock-in min fee // Minimum depth MinDepth uint32 // CLTV/CSV lock-time to use LockTime uint32 // Who pays the fees // 0: (default) channel initiator // 1: split // 2: channel responder FeePayer uint8 RevocationHash [20]byte Pubkey *btcec.PublicKey CommitSig *btcec.Signature // Requester's Commitment DeliveryPkScript PkScript // *MUST* be either P2PKH or P2SH ChangePkScript PkScript // *MUST* be either P2PKH or P2SH Inputs []*wire.TxIn }
func (*FundingResponse) Command ¶
func (c *FundingResponse) Command() uint32
func (*FundingResponse) Encode ¶
func (c *FundingResponse) Encode(w io.Writer, pver uint32) error
Serializes the item from the FundingResponse struct Writes the data to w
func (*FundingResponse) MaxPayloadLength ¶
func (c *FundingResponse) MaxPayloadLength(uint32) uint32
func (*FundingResponse) String ¶
func (c *FundingResponse) String() string
func (*FundingResponse) Validate ¶
func (c *FundingResponse) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type FundingSignAccept ¶
type FundingSignAccept struct { ReservationID uint64 CommitSig *btcec.Signature // Requester's Commitment FundingTXSigs []*btcec.Signature }
func NewFundingSignAccept ¶
func NewFundingSignAccept() *FundingSignAccept
Creates a new FundingSignAccept
func (*FundingSignAccept) Command ¶
func (c *FundingSignAccept) Command() uint32
func (*FundingSignAccept) Decode ¶
func (c *FundingSignAccept) Decode(r io.Reader, pver uint32) error
func (*FundingSignAccept) Encode ¶
func (c *FundingSignAccept) Encode(w io.Writer, pver uint32) error
Serializes the item from the FundingSignAccept struct Writes the data to w
func (*FundingSignAccept) MaxPayloadLength ¶
func (c *FundingSignAccept) MaxPayloadLength(uint32) uint32
func (*FundingSignAccept) String ¶
func (c *FundingSignAccept) String() string
func (*FundingSignAccept) Validate ¶
func (c *FundingSignAccept) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type FundingSignComplete ¶
type FundingSignComplete struct { ReservationID uint64 TxID *wire.ShaHash FundingTXSigs []*btcec.Signature }
func NewFundingSignComplete ¶
func NewFundingSignComplete() *FundingSignComplete
Creates a new FundingSignComplete
func (*FundingSignComplete) Command ¶
func (c *FundingSignComplete) Command() uint32
func (*FundingSignComplete) Decode ¶
func (c *FundingSignComplete) Decode(r io.Reader, pver uint32) error
func (*FundingSignComplete) Encode ¶
func (c *FundingSignComplete) Encode(w io.Writer, pver uint32) error
Serializes the item from the FundingSignComplete struct Writes the data to w
func (*FundingSignComplete) MaxPayloadLength ¶
func (c *FundingSignComplete) MaxPayloadLength(uint32) uint32
func (*FundingSignComplete) String ¶
func (c *FundingSignComplete) String() string
func (*FundingSignComplete) Validate ¶
func (c *FundingSignComplete) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCAddAccept ¶
func (*HTLCAddAccept) Command ¶
func (c *HTLCAddAccept) Command() uint32
func (*HTLCAddAccept) Encode ¶
func (c *HTLCAddAccept) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCAddAccept struct Writes the data to w
func (*HTLCAddAccept) MaxPayloadLength ¶
func (c *HTLCAddAccept) MaxPayloadLength(uint32) uint32
func (*HTLCAddAccept) String ¶
func (c *HTLCAddAccept) String() string
func (*HTLCAddAccept) Validate ¶
func (c *HTLCAddAccept) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCAddReject ¶
func (*HTLCAddReject) Command ¶
func (c *HTLCAddReject) Command() uint32
func (*HTLCAddReject) Encode ¶
func (c *HTLCAddReject) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCAddReject struct Writes the data to w
func (*HTLCAddReject) MaxPayloadLength ¶
func (c *HTLCAddReject) MaxPayloadLength(uint32) uint32
func (*HTLCAddReject) String ¶
func (c *HTLCAddReject) String() string
func (*HTLCAddReject) Validate ¶
func (c *HTLCAddReject) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCAddRequest ¶
type HTLCAddRequest struct { // We can use a different data type for this if necessary... ChannelID uint64 // ID of this request HTLCKey HTLCKey // When the HTLC expires Expiry uint32 // Amount to pay in the hop // Difference between hop and first item in blob is the fee to complete Amount CreditsAmount // RefundContext is for payment cancellation // TODO (j): not currently in use, add later RefundContext HTLCKey // Contract Type // first 4 bits is n, second for is m, in n-of-m "multisig" ContractType uint8 // Redemption Hashes RedemptionHashes []*[20]byte // Data to parse&pass on to the next node // Eventually, we need to make this into a group of 2 nested structs? Blob []byte }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func (*HTLCAddRequest) Command ¶
func (c *HTLCAddRequest) Command() uint32
func (*HTLCAddRequest) Encode ¶
func (c *HTLCAddRequest) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCAddRequest struct Writes the data to w
func (*HTLCAddRequest) MaxPayloadLength ¶
func (c *HTLCAddRequest) MaxPayloadLength(uint32) uint32
func (*HTLCAddRequest) String ¶
func (c *HTLCAddRequest) String() string
func (*HTLCAddRequest) Validate ¶
func (c *HTLCAddRequest) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCSettleAccept ¶
type HTLCSettleAccept struct { // We can use a different data type for this if necessary... ChannelID uint64 // ID of this request HTLCKey HTLCKey }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func NewHTLCSettleAccept ¶
func NewHTLCSettleAccept() *HTLCSettleAccept
Creates a new HTLCSettleAccept
func (*HTLCSettleAccept) Command ¶
func (c *HTLCSettleAccept) Command() uint32
func (*HTLCSettleAccept) Encode ¶
func (c *HTLCSettleAccept) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCSettleAccept struct Writes the data to w
func (*HTLCSettleAccept) MaxPayloadLength ¶
func (c *HTLCSettleAccept) MaxPayloadLength(uint32) uint32
func (*HTLCSettleAccept) String ¶
func (c *HTLCSettleAccept) String() string
func (*HTLCSettleAccept) Validate ¶
func (c *HTLCSettleAccept) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCSettleRequest ¶
type HTLCSettleRequest struct { // We can use a different data type for this if necessary... ChannelID uint64 // ID of this request HTLCKey HTLCKey // Redemption Proofs (R-Values) RedemptionProofs []*[20]byte }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func NewHTLCSettleRequest ¶
func NewHTLCSettleRequest() *HTLCSettleRequest
Creates a new HTLCSettleRequest
func (*HTLCSettleRequest) Command ¶
func (c *HTLCSettleRequest) Command() uint32
func (*HTLCSettleRequest) Decode ¶
func (c *HTLCSettleRequest) Decode(r io.Reader, pver uint32) error
func (*HTLCSettleRequest) Encode ¶
func (c *HTLCSettleRequest) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCSettleRequest struct Writes the data to w
func (*HTLCSettleRequest) MaxPayloadLength ¶
func (c *HTLCSettleRequest) MaxPayloadLength(uint32) uint32
func (*HTLCSettleRequest) String ¶
func (c *HTLCSettleRequest) String() string
func (*HTLCSettleRequest) Validate ¶
func (c *HTLCSettleRequest) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCTimeoutAccept ¶
type HTLCTimeoutAccept struct { // We can use a different data type for this if necessary... ChannelID uint64 // ID of this request HTLCKey HTLCKey }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func NewHTLCTimeoutAccept ¶
func NewHTLCTimeoutAccept() *HTLCTimeoutAccept
Creates a new HTLCTimeoutAccept
func (*HTLCTimeoutAccept) Command ¶
func (c *HTLCTimeoutAccept) Command() uint32
func (*HTLCTimeoutAccept) Decode ¶
func (c *HTLCTimeoutAccept) Decode(r io.Reader, pver uint32) error
func (*HTLCTimeoutAccept) Encode ¶
func (c *HTLCTimeoutAccept) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCTimeoutAccept struct Writes the data to w
func (*HTLCTimeoutAccept) MaxPayloadLength ¶
func (c *HTLCTimeoutAccept) MaxPayloadLength(uint32) uint32
func (*HTLCTimeoutAccept) String ¶
func (c *HTLCTimeoutAccept) String() string
func (*HTLCTimeoutAccept) Validate ¶
func (c *HTLCTimeoutAccept) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type HTLCTimeoutRequest ¶
type HTLCTimeoutRequest struct { // We can use a different data type for this if necessary... ChannelID uint64 // ID of this request HTLCKey HTLCKey }
Multiple Clearing Requests are possible by putting this inside an array of clearing requests
func NewHTLCTimeoutRequest ¶
func NewHTLCTimeoutRequest() *HTLCTimeoutRequest
Creates a new HTLCTimeoutRequest
func (*HTLCTimeoutRequest) Command ¶
func (c *HTLCTimeoutRequest) Command() uint32
func (*HTLCTimeoutRequest) Decode ¶
func (c *HTLCTimeoutRequest) Decode(r io.Reader, pver uint32) error
func (*HTLCTimeoutRequest) Encode ¶
func (c *HTLCTimeoutRequest) Encode(w io.Writer, pver uint32) error
Serializes the item from the HTLCTimeoutRequest struct Writes the data to w
func (*HTLCTimeoutRequest) MaxPayloadLength ¶
func (c *HTLCTimeoutRequest) MaxPayloadLength(uint32) uint32
func (*HTLCTimeoutRequest) String ¶
func (c *HTLCTimeoutRequest) String() string
func (*HTLCTimeoutRequest) Validate ¶
func (c *HTLCTimeoutRequest) Validate() error
Makes sure the struct data is valid (e.g. no negatives or invalid pkscripts)
type Message ¶
type Message interface { Decode(io.Reader, uint32) error // (io, protocol version) Encode(io.Writer, uint32) error // (io, protocol version) Command() uint32 // returns ID of the message MaxPayloadLength(uint32) uint32 // (version) maxpayloadsize Validate() error // Validates the data struct String() string }
Every message has these functions:
Source Files ¶
- close_complete.go
- close_request.go
- commit_revocation.go
- commit_signature.go
- error_generic.go
- funding_request.go
- funding_response.go
- funding_signaccept.go
- funding_signcomplete.go
- htlc_addaccept.go
- htlc_addreject.go
- htlc_addrequest.go
- htlc_settleaccept.go
- htlc_settlerequest.go
- htlc_timeoutaccept.go
- htlc_timeoutrequest.go
- lnwire.go
- message.go