Documentation ¶
Index ¶
Constants ¶
const HashSize = 32
HashSize of array used to store hashes.
const PreimageSize = 32
PreimageSize of array used to store preimagees.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChannelParty ¶
type ChannelParty uint8
ChannelParty is a type used to have an unambiguous description of which node is being referred to. This eliminates the need to describe as "local" or "remote" using bool.
const ( // Local is a ChannelParty constructor that is used to refer to the // node that is running. Local ChannelParty = iota // Remote is a ChannelParty constructor that is used to refer to the // node on the other end of the peer connection. Remote )
func (ChannelParty) CounterParty ¶
func (p ChannelParty) CounterParty() ChannelParty
CounterParty inverts the role of the ChannelParty.
func (ChannelParty) IsLocal ¶
func (p ChannelParty) IsLocal() bool
IsLocal returns true if the ChannelParty is Local.
func (ChannelParty) IsRemote ¶
func (p ChannelParty) IsRemote() bool
IsRemote returns true if the ChannelParty is Remote.
func (ChannelParty) String ¶
func (p ChannelParty) String() string
String provides a string representation of ChannelParty (useful for logging).
type Hash ¶
Hash is used in several of the lightning messages and common structures. It typically represents a payment hash.
var ZeroHash Hash
ZeroHash is a predefined hash containing all zeroes.
func MakeHash ¶
MakeHash returns a new Hash from a byte slice. An error is returned if the number of bytes passed in is not HashSize.
func MakeHashFromStr ¶
MakeHashFromStr creates a Hash from a hex hash string.
type Number ¶
type Number interface { constraints.Integer | constraints.Float }
Number defines a type constraint for numbers.
type Preimage ¶
type Preimage [PreimageSize]byte
Preimage is used in several of the lightning messages and common structures. It represents a payment preimage.
func MakePreimage ¶
MakePreimage returns a new Preimage from a bytes slice. An error is returned if the number of bytes passed in is not PreimageSize.
func MakePreimageFromStr ¶
MakePreimageFromStr creates a Preimage from a hex preimage string.
type VByte ¶
type VByte uint64
VByte defines a unit to express the transaction size. One virtual byte is 1/4th of a weight unit. The tx virtual bytes is calculated using `TxWeight / 4`.
func (VByte) ToWU ¶
func (vb VByte) ToWU() WeightUnit
ToWU converts a value expressed in virtual bytes to weight units.
type WeightUnit ¶
type WeightUnit uint64
WeightUnit defines a unit to express the transaction size. One weight unit is 1/4_000_000 of the max block size. The tx weight is calculated using `Base tx size * 3 + Total tx size`.
- Base tx size is size of the transaction serialized without the witness data.
- Total tx size is the transaction size in bytes serialized according #BIP144.
func (WeightUnit) String ¶
func (wu WeightUnit) String() string
String returns the string representation of the weight unit.
func (WeightUnit) ToVB ¶
func (wu WeightUnit) ToVB() VByte
ToVB converts a value expressed in weight units to virtual bytes.