id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
129,100
lightningnetwork/lnd
routing/chainview/neutrino.go
chainFilterer
func (c *CfFilteredChainView) chainFilterer() { defer c.wg.Done() for { select { case err := <-c.rescanErrChan: log.Errorf("Error encountered during rescan: %v", err) case <-c.quit: return } } }
go
func (c *CfFilteredChainView) chainFilterer() { defer c.wg.Done() for { select { case err := <-c.rescanErrChan: log.Errorf("Error encountered during rescan: %v", err) case <-c.quit: return } } }
[ "func", "(", "c", "*", "CfFilteredChainView", ")", "chainFilterer", "(", ")", "{", "defer", "c", ".", "wg", ".", "Done", "(", ")", "\n\n", "for", "{", "select", "{", "case", "err", ":=", "<-", "c", ".", "rescanErrChan", ":", "log", ".", "Errorf", "...
// chainFilterer is the primary coordination goroutine within the // CfFilteredChainView. This goroutine handles errors from the running rescan.
[ "chainFilterer", "is", "the", "primary", "coordination", "goroutine", "within", "the", "CfFilteredChainView", ".", "This", "goroutine", "handles", "errors", "from", "the", "running", "rescan", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/chainview/neutrino.go#L196-L207
129,101
lightningnetwork/lnd
tor/onionaddr.go
String
func (o *OnionAddr) String() string { return net.JoinHostPort(o.OnionService, strconv.Itoa(o.Port)) }
go
func (o *OnionAddr) String() string { return net.JoinHostPort(o.OnionService, strconv.Itoa(o.Port)) }
[ "func", "(", "o", "*", "OnionAddr", ")", "String", "(", ")", "string", "{", "return", "net", ".", "JoinHostPort", "(", "o", ".", "OnionService", ",", "strconv", ".", "Itoa", "(", "o", ".", "Port", ")", ")", "\n", "}" ]
// String returns the string representation of an onion address.
[ "String", "returns", "the", "string", "representation", "of", "an", "onion", "address", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/tor/onionaddr.go#L55-L57
129,102
lightningnetwork/lnd
lnwire/gossip_timestamp_range.go
Decode
func (g *GossipTimestampRange) Decode(r io.Reader, pver uint32) error { return ReadElements(r, g.ChainHash[:], &g.FirstTimestamp, &g.TimestampRange, ) }
go
func (g *GossipTimestampRange) Decode(r io.Reader, pver uint32) error { return ReadElements(r, g.ChainHash[:], &g.FirstTimestamp, &g.TimestampRange, ) }
[ "func", "(", "g", "*", "GossipTimestampRange", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "g", ".", "ChainHash", "[", ":", "]", ",", "&", "g", ".", "FirstTimestamp"...
// Decode deserializes a serialized GossipTimestampRange message stored in the // passed io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "GossipTimestampRange", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "inter...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/gossip_timestamp_range.go#L42-L48
129,103
lightningnetwork/lnd
lnwire/gossip_timestamp_range.go
Encode
func (g *GossipTimestampRange) Encode(w io.Writer, pver uint32) error { return WriteElements(w, g.ChainHash[:], g.FirstTimestamp, g.TimestampRange, ) }
go
func (g *GossipTimestampRange) Encode(w io.Writer, pver uint32) error { return WriteElements(w, g.ChainHash[:], g.FirstTimestamp, g.TimestampRange, ) }
[ "func", "(", "g", "*", "GossipTimestampRange", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "g", ".", "ChainHash", "[", ":", "]", ",", "g", ".", "FirstTimestamp", ",...
// Encode serializes the target GossipTimestampRange into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "GossipTimestampRange", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/gossip_timestamp_range.go#L54-L60
129,104
lightningnetwork/lnd
build/log_nolog.go
Write
func (w *LogWriter) Write(b []byte) (int, error) { return len(b), nil }
go
func (w *LogWriter) Write(b []byte) (int, error) { return len(b), nil }
[ "func", "(", "w", "*", "LogWriter", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "len", "(", "b", ")", ",", "nil", "\n", "}" ]
// Write is a noop.
[ "Write", "is", "a", "noop", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/build/log_nolog.go#L9-L11
129,105
lightningnetwork/lnd
watchtower/wtdb/session_state_update.go
Encode
func (u *SessionStateUpdate) Encode(w io.Writer) error { return WriteElements(w, u.ID, u.SeqNum, u.LastApplied, u.Hint, u.EncryptedBlob, ) }
go
func (u *SessionStateUpdate) Encode(w io.Writer) error { return WriteElements(w, u.ID, u.SeqNum, u.LastApplied, u.Hint, u.EncryptedBlob, ) }
[ "func", "(", "u", "*", "SessionStateUpdate", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "u", ".", "ID", ",", "u", ".", "SeqNum", ",", "u", ".", "LastApplied", ",", "u", ".", "Hint", ...
// Encode serializes the state update into the provided io.Writer.
[ "Encode", "serializes", "the", "state", "update", "into", "the", "provided", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/session_state_update.go#L28-L36
129,106
lightningnetwork/lnd
watchtower/wtdb/session_state_update.go
Decode
func (u *SessionStateUpdate) Decode(r io.Reader) error { return ReadElements(r, &u.ID, &u.SeqNum, &u.LastApplied, &u.Hint, &u.EncryptedBlob, ) }
go
func (u *SessionStateUpdate) Decode(r io.Reader) error { return ReadElements(r, &u.ID, &u.SeqNum, &u.LastApplied, &u.Hint, &u.EncryptedBlob, ) }
[ "func", "(", "u", "*", "SessionStateUpdate", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "u", ".", "ID", ",", "&", "u", ".", "SeqNum", ",", "&", "u", ".", "LastApplied", ",", "&",...
// Decode deserializes the target state update from the provided io.Reader.
[ "Decode", "deserializes", "the", "target", "state", "update", "from", "the", "provided", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/session_state_update.go#L39-L47
129,107
lightningnetwork/lnd
channeldb/forwarding_package.go
NewPkgFilter
func NewPkgFilter(count uint16) *PkgFilter { // We add 7 to ensure that the integer division yields properly rounded // values. filterLen := (count + 7) / 8 return &PkgFilter{ count: count, filter: make([]byte, filterLen), } }
go
func NewPkgFilter(count uint16) *PkgFilter { // We add 7 to ensure that the integer division yields properly rounded // values. filterLen := (count + 7) / 8 return &PkgFilter{ count: count, filter: make([]byte, filterLen), } }
[ "func", "NewPkgFilter", "(", "count", "uint16", ")", "*", "PkgFilter", "{", "// We add 7 to ensure that the integer division yields properly rounded", "// values.", "filterLen", ":=", "(", "count", "+", "7", ")", "/", "8", "\n\n", "return", "&", "PkgFilter", "{", "c...
// NewPkgFilter initializes an empty PkgFilter supporting `count` elements.
[ "NewPkgFilter", "initializes", "an", "empty", "PkgFilter", "supporting", "count", "elements", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L80-L89
129,108
lightningnetwork/lnd
channeldb/forwarding_package.go
Equal
func (f *PkgFilter) Equal(f2 *PkgFilter) bool { if f == f2 { return true } if f.count != f2.count { return false } return bytes.Equal(f.filter, f2.filter) }
go
func (f *PkgFilter) Equal(f2 *PkgFilter) bool { if f == f2 { return true } if f.count != f2.count { return false } return bytes.Equal(f.filter, f2.filter) }
[ "func", "(", "f", "*", "PkgFilter", ")", "Equal", "(", "f2", "*", "PkgFilter", ")", "bool", "{", "if", "f", "==", "f2", "{", "return", "true", "\n", "}", "\n", "if", "f", ".", "count", "!=", "f2", ".", "count", "{", "return", "false", "\n", "}"...
// Equal checks two PkgFilters for equality.
[ "Equal", "checks", "two", "PkgFilters", "for", "equality", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L119-L128
129,109
lightningnetwork/lnd
channeldb/forwarding_package.go
IsFull
func (f *PkgFilter) IsFull() bool { // Batch validate bytes that are fully used. for i := uint16(0); i < f.count/8; i++ { if f.filter[i] != 0xFF { return false } } // If the count is not a multiple of 8, check that the filter contains // all remaining bits. rem := f.count % 8 for idx := f.count - rem; id...
go
func (f *PkgFilter) IsFull() bool { // Batch validate bytes that are fully used. for i := uint16(0); i < f.count/8; i++ { if f.filter[i] != 0xFF { return false } } // If the count is not a multiple of 8, check that the filter contains // all remaining bits. rem := f.count % 8 for idx := f.count - rem; id...
[ "func", "(", "f", "*", "PkgFilter", ")", "IsFull", "(", ")", "bool", "{", "// Batch validate bytes that are fully used.", "for", "i", ":=", "uint16", "(", "0", ")", ";", "i", "<", "f", ".", "count", "/", "8", ";", "i", "++", "{", "if", "f", ".", "f...
// IsFull returns true if every element in the filter has been Set, and false // otherwise.
[ "IsFull", "returns", "true", "if", "every", "element", "in", "the", "filter", "has", "been", "Set", "and", "false", "otherwise", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L132-L150
129,110
lightningnetwork/lnd
channeldb/forwarding_package.go
Encode
func (f *PkgFilter) Encode(w io.Writer) error { if err := binary.Write(w, binary.BigEndian, f.count); err != nil { return err } _, err := w.Write(f.filter) return err }
go
func (f *PkgFilter) Encode(w io.Writer) error { if err := binary.Write(w, binary.BigEndian, f.count); err != nil { return err } _, err := w.Write(f.filter) return err }
[ "func", "(", "f", "*", "PkgFilter", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "if", "err", ":=", "binary", ".", "Write", "(", "w", ",", "binary", ".", "BigEndian", ",", "f", ".", "count", ")", ";", "err", "!=", "nil", "{"...
// Encode writes the filter to the provided io.Writer.
[ "Encode", "writes", "the", "filter", "to", "the", "provided", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L160-L168
129,111
lightningnetwork/lnd
channeldb/forwarding_package.go
Decode
func (f *PkgFilter) Decode(r io.Reader) error { if err := binary.Read(r, binary.BigEndian, &f.count); err != nil { return err } f.filter = make([]byte, f.Size()-2) _, err := io.ReadFull(r, f.filter) return err }
go
func (f *PkgFilter) Decode(r io.Reader) error { if err := binary.Read(r, binary.BigEndian, &f.count); err != nil { return err } f.filter = make([]byte, f.Size()-2) _, err := io.ReadFull(r, f.filter) return err }
[ "func", "(", "f", "*", "PkgFilter", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "if", "err", ":=", "binary", ".", "Read", "(", "r", ",", "binary", ".", "BigEndian", ",", "&", "f", ".", "count", ")", ";", "err", "!=", "nil",...
// Decode reads the filter from the provided io.Reader.
[ "Decode", "reads", "the", "filter", "from", "the", "provided", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L171-L180
129,112
lightningnetwork/lnd
channeldb/forwarding_package.go
NewFwdPkg
func NewFwdPkg(source lnwire.ShortChannelID, height uint64, addUpdates, settleFailUpdates []LogUpdate) *FwdPkg { nAddUpdates := uint16(len(addUpdates)) nSettleFailUpdates := uint16(len(settleFailUpdates)) return &FwdPkg{ Source: source, Height: height, State: FwdStateLockedIn,...
go
func NewFwdPkg(source lnwire.ShortChannelID, height uint64, addUpdates, settleFailUpdates []LogUpdate) *FwdPkg { nAddUpdates := uint16(len(addUpdates)) nSettleFailUpdates := uint16(len(settleFailUpdates)) return &FwdPkg{ Source: source, Height: height, State: FwdStateLockedIn,...
[ "func", "NewFwdPkg", "(", "source", "lnwire", ".", "ShortChannelID", ",", "height", "uint64", ",", "addUpdates", ",", "settleFailUpdates", "[", "]", "LogUpdate", ")", "*", "FwdPkg", "{", "nAddUpdates", ":=", "uint16", "(", "len", "(", "addUpdates", ")", ")",...
// NewFwdPkg initializes a new forwarding package in FwdStateLockedIn. This // should be used to create a package at the time we receive a revocation.
[ "NewFwdPkg", "initializes", "a", "new", "forwarding", "package", "in", "FwdStateLockedIn", ".", "This", "should", "be", "used", "to", "create", "a", "package", "at", "the", "time", "we", "receive", "a", "revocation", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L234-L250
129,113
lightningnetwork/lnd
channeldb/forwarding_package.go
ID
func (f *FwdPkg) ID() []byte { var id = make([]byte, 16) byteOrder.PutUint64(id[:8], f.Source.ToUint64()) byteOrder.PutUint64(id[8:], f.Height) return id }
go
func (f *FwdPkg) ID() []byte { var id = make([]byte, 16) byteOrder.PutUint64(id[:8], f.Source.ToUint64()) byteOrder.PutUint64(id[8:], f.Height) return id }
[ "func", "(", "f", "*", "FwdPkg", ")", "ID", "(", ")", "[", "]", "byte", "{", "var", "id", "=", "make", "(", "[", "]", "byte", ",", "16", ")", "\n", "byteOrder", ".", "PutUint64", "(", "id", "[", ":", "8", "]", ",", "f", ".", "Source", ".", ...
// ID returns an unique identifier for this package, used to ensure that sphinx // replay processing of this batch is idempotent.
[ "ID", "returns", "an", "unique", "identifier", "for", "this", "package", "used", "to", "ensure", "that", "sphinx", "replay", "processing", "of", "this", "batch", "is", "idempotent", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L254-L259
129,114
lightningnetwork/lnd
channeldb/forwarding_package.go
String
func (f *FwdPkg) String() string { return fmt.Sprintf("%T(src=%v, height=%v, nadds=%v, nfailsettles=%v)", f, f.Source, f.Height, len(f.Adds), len(f.SettleFails)) }
go
func (f *FwdPkg) String() string { return fmt.Sprintf("%T(src=%v, height=%v, nadds=%v, nfailsettles=%v)", f, f.Source, f.Height, len(f.Adds), len(f.SettleFails)) }
[ "func", "(", "f", "*", "FwdPkg", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ",", "f", ".", "Source", ",", "f", ".", "Height", ",", "len", "(", "f", ".", "Adds", ")", ",", "len", "(", ...
// String returns a human-readable description of the forwarding package.
[ "String", "returns", "a", "human", "-", "readable", "description", "of", "the", "forwarding", "package", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L262-L265
129,115
lightningnetwork/lnd
channeldb/forwarding_package.go
Encode
func (a *AddRef) Encode(w io.Writer) error { if err := binary.Write(w, binary.BigEndian, a.Height); err != nil { return err } return binary.Write(w, binary.BigEndian, a.Index) }
go
func (a *AddRef) Encode(w io.Writer) error { if err := binary.Write(w, binary.BigEndian, a.Height); err != nil { return err } return binary.Write(w, binary.BigEndian, a.Index) }
[ "func", "(", "a", "*", "AddRef", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "if", "err", ":=", "binary", ".", "Write", "(", "w", ",", "binary", ".", "BigEndian", ",", "a", ".", "Height", ")", ";", "err", "!=", "nil", "{", ...
// Encode serializes the AddRef to the given io.Writer.
[ "Encode", "serializes", "the", "AddRef", "to", "the", "given", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L280-L286
129,116
lightningnetwork/lnd
channeldb/forwarding_package.go
Decode
func (a *AddRef) Decode(r io.Reader) error { if err := binary.Read(r, binary.BigEndian, &a.Height); err != nil { return err } return binary.Read(r, binary.BigEndian, &a.Index) }
go
func (a *AddRef) Decode(r io.Reader) error { if err := binary.Read(r, binary.BigEndian, &a.Height); err != nil { return err } return binary.Read(r, binary.BigEndian, &a.Index) }
[ "func", "(", "a", "*", "AddRef", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "if", "err", ":=", "binary", ".", "Read", "(", "r", ",", "binary", ".", "BigEndian", ",", "&", "a", ".", "Height", ")", ";", "err", "!=", "nil", ...
// Decode deserializes the AddRef from the given io.Reader.
[ "Decode", "deserializes", "the", "AddRef", "from", "the", "given", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L289-L295
129,117
lightningnetwork/lnd
channeldb/forwarding_package.go
LoadChannelFwdPkgs
func (*SwitchPackager) LoadChannelFwdPkgs(tx *bbolt.Tx, source lnwire.ShortChannelID) ([]*FwdPkg, error) { return loadChannelFwdPkgs(tx, source) }
go
func (*SwitchPackager) LoadChannelFwdPkgs(tx *bbolt.Tx, source lnwire.ShortChannelID) ([]*FwdPkg, error) { return loadChannelFwdPkgs(tx, source) }
[ "func", "(", "*", "SwitchPackager", ")", "LoadChannelFwdPkgs", "(", "tx", "*", "bbolt", ".", "Tx", ",", "source", "lnwire", ".", "ShortChannelID", ")", "(", "[", "]", "*", "FwdPkg", ",", "error", ")", "{", "return", "loadChannelFwdPkgs", "(", "tx", ",", ...
// LoadChannelFwdPkgs loads all forwarding packages for a particular channel.
[ "LoadChannelFwdPkgs", "loads", "all", "forwarding", "packages", "for", "a", "particular", "channel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L367-L371
129,118
lightningnetwork/lnd
channeldb/forwarding_package.go
AddFwdPkg
func (*ChannelPackager) AddFwdPkg(tx *bbolt.Tx, fwdPkg *FwdPkg) error { fwdPkgBkt, err := tx.CreateBucketIfNotExists(fwdPackagesKey) if err != nil { return err } source := makeLogKey(fwdPkg.Source.ToUint64()) sourceBkt, err := fwdPkgBkt.CreateBucketIfNotExists(source[:]) if err != nil { return err } heigh...
go
func (*ChannelPackager) AddFwdPkg(tx *bbolt.Tx, fwdPkg *FwdPkg) error { fwdPkgBkt, err := tx.CreateBucketIfNotExists(fwdPackagesKey) if err != nil { return err } source := makeLogKey(fwdPkg.Source.ToUint64()) sourceBkt, err := fwdPkgBkt.CreateBucketIfNotExists(source[:]) if err != nil { return err } heigh...
[ "func", "(", "*", "ChannelPackager", ")", "AddFwdPkg", "(", "tx", "*", "bbolt", ".", "Tx", ",", "fwdPkg", "*", "FwdPkg", ")", "error", "{", "fwdPkgBkt", ",", "err", ":=", "tx", ".", "CreateBucketIfNotExists", "(", "fwdPackagesKey", ")", "\n", "if", "err"...
// AddFwdPkg writes a newly locked in forwarding package to disk.
[ "AddFwdPkg", "writes", "a", "newly", "locked", "in", "forwarding", "package", "to", "disk", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L423-L485
129,119
lightningnetwork/lnd
channeldb/forwarding_package.go
putLogUpdate
func putLogUpdate(bkt *bbolt.Bucket, idx uint16, htlc *LogUpdate) error { var b bytes.Buffer if err := htlc.Encode(&b); err != nil { return err } return bkt.Put(uint16Key(idx), b.Bytes()) }
go
func putLogUpdate(bkt *bbolt.Bucket, idx uint16, htlc *LogUpdate) error { var b bytes.Buffer if err := htlc.Encode(&b); err != nil { return err } return bkt.Put(uint16Key(idx), b.Bytes()) }
[ "func", "putLogUpdate", "(", "bkt", "*", "bbolt", ".", "Bucket", ",", "idx", "uint16", ",", "htlc", "*", "LogUpdate", ")", "error", "{", "var", "b", "bytes", ".", "Buffer", "\n", "if", "err", ":=", "htlc", ".", "Encode", "(", "&", "b", ")", ";", ...
// putLogUpdate writes an htlc to the provided `bkt`, using `index` as the key.
[ "putLogUpdate", "writes", "an", "htlc", "to", "the", "provided", "bkt", "using", "index", "as", "the", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L488-L495
129,120
lightningnetwork/lnd
channeldb/forwarding_package.go
LoadFwdPkgs
func (p *ChannelPackager) LoadFwdPkgs(tx *bbolt.Tx) ([]*FwdPkg, error) { return loadChannelFwdPkgs(tx, p.source) }
go
func (p *ChannelPackager) LoadFwdPkgs(tx *bbolt.Tx) ([]*FwdPkg, error) { return loadChannelFwdPkgs(tx, p.source) }
[ "func", "(", "p", "*", "ChannelPackager", ")", "LoadFwdPkgs", "(", "tx", "*", "bbolt", ".", "Tx", ")", "(", "[", "]", "*", "FwdPkg", ",", "error", ")", "{", "return", "loadChannelFwdPkgs", "(", "tx", ",", "p", ".", "source", ")", "\n", "}" ]
// LoadFwdPkgs scans the forwarding log for any packages that haven't been // processed, and returns their deserialized log updates in a map indexed by the // remote commitment height at which the updates were locked in.
[ "LoadFwdPkgs", "scans", "the", "forwarding", "log", "for", "any", "packages", "that", "haven", "t", "been", "processed", "and", "returns", "their", "deserialized", "log", "updates", "in", "a", "map", "indexed", "by", "the", "remote", "commitment", "height", "a...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L500-L502
129,121
lightningnetwork/lnd
channeldb/forwarding_package.go
loadChannelFwdPkgs
func loadChannelFwdPkgs(tx *bbolt.Tx, source lnwire.ShortChannelID) ([]*FwdPkg, error) { fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return nil, nil } sourceKey := makeLogKey(source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceKey[:]) if sourceBkt == nil { return nil, nil } var heights...
go
func loadChannelFwdPkgs(tx *bbolt.Tx, source lnwire.ShortChannelID) ([]*FwdPkg, error) { fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return nil, nil } sourceKey := makeLogKey(source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceKey[:]) if sourceBkt == nil { return nil, nil } var heights...
[ "func", "loadChannelFwdPkgs", "(", "tx", "*", "bbolt", ".", "Tx", ",", "source", "lnwire", ".", "ShortChannelID", ")", "(", "[", "]", "*", "FwdPkg", ",", "error", ")", "{", "fwdPkgBkt", ":=", "tx", ".", "Bucket", "(", "fwdPackagesKey", ")", "\n", "if",...
// loadChannelFwdPkgs loads all forwarding packages owned by `source`.
[ "loadChannelFwdPkgs", "loads", "all", "forwarding", "packages", "owned", "by", "source", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L505-L542
129,122
lightningnetwork/lnd
channeldb/forwarding_package.go
loadFwdPkg
func loadFwdPkg(fwdPkgBkt *bbolt.Bucket, source lnwire.ShortChannelID, height uint64) (*FwdPkg, error) { sourceKey := makeLogKey(source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceKey[:]) if sourceBkt == nil { return nil, ErrCorruptedFwdPkg } heightKey := makeLogKey(height) heightBkt := sourceBkt.Bucket(...
go
func loadFwdPkg(fwdPkgBkt *bbolt.Bucket, source lnwire.ShortChannelID, height uint64) (*FwdPkg, error) { sourceKey := makeLogKey(source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceKey[:]) if sourceBkt == nil { return nil, ErrCorruptedFwdPkg } heightKey := makeLogKey(height) heightBkt := sourceBkt.Bucket(...
[ "func", "loadFwdPkg", "(", "fwdPkgBkt", "*", "bbolt", ".", "Bucket", ",", "source", "lnwire", ".", "ShortChannelID", ",", "height", "uint64", ")", "(", "*", "FwdPkg", ",", "error", ")", "{", "sourceKey", ":=", "makeLogKey", "(", "source", ".", "ToUint64", ...
// loadFwPkg reads the packager's fwd pkg at a given height, and determines the // appropriate FwdState.
[ "loadFwPkg", "reads", "the", "packager", "s", "fwd", "pkg", "at", "a", "given", "height", "and", "determines", "the", "appropriate", "FwdState", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L546-L648
129,123
lightningnetwork/lnd
channeldb/forwarding_package.go
loadHtlcs
func loadHtlcs(bkt *bbolt.Bucket) ([]LogUpdate, error) { var htlcs []LogUpdate if err := bkt.ForEach(func(_, v []byte) error { var htlc LogUpdate if err := htlc.Decode(bytes.NewReader(v)); err != nil { return err } htlcs = append(htlcs, htlc) return nil }); err != nil { return nil, err } return h...
go
func loadHtlcs(bkt *bbolt.Bucket) ([]LogUpdate, error) { var htlcs []LogUpdate if err := bkt.ForEach(func(_, v []byte) error { var htlc LogUpdate if err := htlc.Decode(bytes.NewReader(v)); err != nil { return err } htlcs = append(htlcs, htlc) return nil }); err != nil { return nil, err } return h...
[ "func", "loadHtlcs", "(", "bkt", "*", "bbolt", ".", "Bucket", ")", "(", "[", "]", "LogUpdate", ",", "error", ")", "{", "var", "htlcs", "[", "]", "LogUpdate", "\n", "if", "err", ":=", "bkt", ".", "ForEach", "(", "func", "(", "_", ",", "v", "[", ...
// loadHtlcs retrieves all serialized htlcs in a bucket, returning // them in order of the indexes they were written under.
[ "loadHtlcs", "retrieves", "all", "serialized", "htlcs", "in", "a", "bucket", "returning", "them", "in", "order", "of", "the", "indexes", "they", "were", "written", "under", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L652-L668
129,124
lightningnetwork/lnd
channeldb/forwarding_package.go
SetFwdFilter
func (p *ChannelPackager) SetFwdFilter(tx *bbolt.Tx, height uint64, fwdFilter *PkgFilter) error { fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return ErrCorruptedFwdPkg } source := makeLogKey(p.source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(source[:]) if sourceBkt == nil { return ErrCorru...
go
func (p *ChannelPackager) SetFwdFilter(tx *bbolt.Tx, height uint64, fwdFilter *PkgFilter) error { fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return ErrCorruptedFwdPkg } source := makeLogKey(p.source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(source[:]) if sourceBkt == nil { return ErrCorru...
[ "func", "(", "p", "*", "ChannelPackager", ")", "SetFwdFilter", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint64", ",", "fwdFilter", "*", "PkgFilter", ")", "error", "{", "fwdPkgBkt", ":=", "tx", ".", "Bucket", "(", "fwdPackagesKey", ")", "\n", ...
// SetFwdFilter writes the set of indexes corresponding to Adds at the // `height` that are to be forwarded to the switch. Calling this method causes // the forwarding package at `height` to be in FwdStateProcessed. We write this // forwarding decision so that we always arrive at the same behavior for HTLCs // leaving ...
[ "SetFwdFilter", "writes", "the", "set", "of", "indexes", "corresponding", "to", "Adds", "at", "the", "height", "that", "are", "to", "be", "forwarded", "to", "the", "switch", ".", "Calling", "this", "method", "causes", "the", "forwarding", "package", "at", "h...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L677-L711
129,125
lightningnetwork/lnd
channeldb/forwarding_package.go
AckAddHtlcs
func (p *ChannelPackager) AckAddHtlcs(tx *bbolt.Tx, addRefs ...AddRef) error { if len(addRefs) == 0 { return nil } fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return ErrCorruptedFwdPkg } sourceKey := makeLogKey(p.source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceKey[:]) if sourceBkt ...
go
func (p *ChannelPackager) AckAddHtlcs(tx *bbolt.Tx, addRefs ...AddRef) error { if len(addRefs) == 0 { return nil } fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return ErrCorruptedFwdPkg } sourceKey := makeLogKey(p.source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceKey[:]) if sourceBkt ...
[ "func", "(", "p", "*", "ChannelPackager", ")", "AckAddHtlcs", "(", "tx", "*", "bbolt", ".", "Tx", ",", "addRefs", "...", "AddRef", ")", "error", "{", "if", "len", "(", "addRefs", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "fwdPkgBkt", ...
// AckAddHtlcs accepts a list of references to add htlcs, and updates the // AckAddFilter of those forwarding packages to indicate that a settle or fail // has been received in response to the add.
[ "AckAddHtlcs", "accepts", "a", "list", "of", "references", "to", "add", "htlcs", "and", "updates", "the", "AckAddFilter", "of", "those", "forwarding", "packages", "to", "indicate", "that", "a", "settle", "or", "fail", "has", "been", "received", "in", "response...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L716-L752
129,126
lightningnetwork/lnd
channeldb/forwarding_package.go
ackAddHtlcsAtHeight
func ackAddHtlcsAtHeight(sourceBkt *bbolt.Bucket, height uint64, indexes []uint16) error { heightKey := makeLogKey(height) heightBkt := sourceBkt.Bucket(heightKey[:]) if heightBkt == nil { // If the height bucket isn't found, this could be because the // forwarding package was already removed. We'll return nil...
go
func ackAddHtlcsAtHeight(sourceBkt *bbolt.Bucket, height uint64, indexes []uint16) error { heightKey := makeLogKey(height) heightBkt := sourceBkt.Bucket(heightKey[:]) if heightBkt == nil { // If the height bucket isn't found, this could be because the // forwarding package was already removed. We'll return nil...
[ "func", "ackAddHtlcsAtHeight", "(", "sourceBkt", "*", "bbolt", ".", "Bucket", ",", "height", "uint64", ",", "indexes", "[", "]", "uint16", ")", "error", "{", "heightKey", ":=", "makeLogKey", "(", "height", ")", "\n", "heightBkt", ":=", "sourceBkt", ".", "B...
// ackAddHtlcsAtHeight updates the AddAckFilter of a single forwarding package // with a list of indexes, writing the resulting filter back in its place.
[ "ackAddHtlcsAtHeight", "updates", "the", "AddAckFilter", "of", "a", "single", "forwarding", "package", "with", "a", "list", "of", "indexes", "writing", "the", "resulting", "filter", "back", "in", "its", "place", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L756-L793
129,127
lightningnetwork/lnd
channeldb/forwarding_package.go
ackSettleFails
func ackSettleFails(tx *bbolt.Tx, settleFailRefs []SettleFailRef) error { if len(settleFailRefs) == 0 { return nil } fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return ErrCorruptedFwdPkg } // Organize the forward references such that we just get a single slice // of indexes for each unique...
go
func ackSettleFails(tx *bbolt.Tx, settleFailRefs []SettleFailRef) error { if len(settleFailRefs) == 0 { return nil } fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return ErrCorruptedFwdPkg } // Organize the forward references such that we just get a single slice // of indexes for each unique...
[ "func", "ackSettleFails", "(", "tx", "*", "bbolt", ".", "Tx", ",", "settleFailRefs", "[", "]", "SettleFailRef", ")", "error", "{", "if", "len", "(", "settleFailRefs", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "fwdPkgBkt", ":=", "tx", "."...
// ackSettleFails persistently acknowledges a batch of settle fail references.
[ "ackSettleFails", "persistently", "acknowledges", "a", "batch", "of", "settle", "fail", "references", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L804-L854
129,128
lightningnetwork/lnd
channeldb/forwarding_package.go
ackSettleFailsAtHeight
func ackSettleFailsAtHeight(destBkt *bbolt.Bucket, height uint64, indexes []uint16) error { heightKey := makeLogKey(height) heightBkt := destBkt.Bucket(heightKey[:]) if heightBkt == nil { // If the height bucket isn't found, this could be because the // forwarding package was already removed. We'll return nil ...
go
func ackSettleFailsAtHeight(destBkt *bbolt.Bucket, height uint64, indexes []uint16) error { heightKey := makeLogKey(height) heightBkt := destBkt.Bucket(heightKey[:]) if heightBkt == nil { // If the height bucket isn't found, this could be because the // forwarding package was already removed. We'll return nil ...
[ "func", "ackSettleFailsAtHeight", "(", "destBkt", "*", "bbolt", ".", "Bucket", ",", "height", "uint64", ",", "indexes", "[", "]", "uint16", ")", "error", "{", "heightKey", ":=", "makeLogKey", "(", "height", ")", "\n", "heightBkt", ":=", "destBkt", ".", "Bu...
// ackSettleFailsAtHeight given a destination bucket, acks the provided indexes // at particular a height by updating the settle fail filter.
[ "ackSettleFailsAtHeight", "given", "a", "destination", "bucket", "acks", "the", "provided", "indexes", "at", "particular", "a", "height", "by", "updating", "the", "settle", "fail", "filter", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L858-L894
129,129
lightningnetwork/lnd
channeldb/forwarding_package.go
RemovePkg
func (p *ChannelPackager) RemovePkg(tx *bbolt.Tx, height uint64) error { fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return nil } sourceBytes := makeLogKey(p.source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceBytes[:]) if sourceBkt == nil { return ErrCorruptedFwdPkg } heightKey := mak...
go
func (p *ChannelPackager) RemovePkg(tx *bbolt.Tx, height uint64) error { fwdPkgBkt := tx.Bucket(fwdPackagesKey) if fwdPkgBkt == nil { return nil } sourceBytes := makeLogKey(p.source.ToUint64()) sourceBkt := fwdPkgBkt.Bucket(sourceBytes[:]) if sourceBkt == nil { return ErrCorruptedFwdPkg } heightKey := mak...
[ "func", "(", "p", "*", "ChannelPackager", ")", "RemovePkg", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint64", ")", "error", "{", "fwdPkgBkt", ":=", "tx", ".", "Bucket", "(", "fwdPackagesKey", ")", "\n", "if", "fwdPkgBkt", "==", "nil", "{", ...
// RemovePkg deletes the forwarding package at the given height from the // packager's source bucket.
[ "RemovePkg", "deletes", "the", "forwarding", "package", "at", "the", "given", "height", "from", "the", "packager", "s", "source", "bucket", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L898-L913
129,130
lightningnetwork/lnd
channeldb/forwarding_package.go
uint16Key
func uint16Key(i uint16) []byte { key := make([]byte, 2) byteOrder.PutUint16(key, i) return key }
go
func uint16Key(i uint16) []byte { key := make([]byte, 2) byteOrder.PutUint16(key, i) return key }
[ "func", "uint16Key", "(", "i", "uint16", ")", "[", "]", "byte", "{", "key", ":=", "make", "(", "[", "]", "byte", ",", "2", ")", "\n", "byteOrder", ".", "PutUint16", "(", "key", ",", "i", ")", "\n", "return", "key", "\n", "}" ]
// uint16Key writes the provided 16-bit unsigned integer to a 2-byte slice.
[ "uint16Key", "writes", "the", "provided", "16", "-", "bit", "unsigned", "integer", "to", "a", "2", "-", "byte", "slice", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_package.go#L916-L920
129,131
lightningnetwork/lnd
walletunlocker/service.go
New
func New(chainDir string, params *chaincfg.Params, macaroonFiles []string) *UnlockerService { return &UnlockerService{ InitMsgs: make(chan *WalletInitMsg, 1), UnlockMsgs: make(chan *WalletUnlockMsg, 1), chainDir: chainDir, netParams: params, macaroonFiles: macaroonFiles, } }
go
func New(chainDir string, params *chaincfg.Params, macaroonFiles []string) *UnlockerService { return &UnlockerService{ InitMsgs: make(chan *WalletInitMsg, 1), UnlockMsgs: make(chan *WalletUnlockMsg, 1), chainDir: chainDir, netParams: params, macaroonFiles: macaroonFiles, } }
[ "func", "New", "(", "chainDir", "string", ",", "params", "*", "chaincfg", ".", "Params", ",", "macaroonFiles", "[", "]", "string", ")", "*", "UnlockerService", "{", "return", "&", "UnlockerService", "{", "InitMsgs", ":", "make", "(", "chan", "*", "WalletIn...
// New creates and returns a new UnlockerService.
[ "New", "creates", "and", "returns", "a", "new", "UnlockerService", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/walletunlocker/service.go#L105-L115
129,132
lightningnetwork/lnd
walletunlocker/service.go
GenSeed
func (u *UnlockerService) GenSeed(ctx context.Context, in *lnrpc.GenSeedRequest) (*lnrpc.GenSeedResponse, error) { // Before we start, we'll ensure that the wallet hasn't already created // so we don't show a *new* seed to the user if one already exists. netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) loa...
go
func (u *UnlockerService) GenSeed(ctx context.Context, in *lnrpc.GenSeedRequest) (*lnrpc.GenSeedResponse, error) { // Before we start, we'll ensure that the wallet hasn't already created // so we don't show a *new* seed to the user if one already exists. netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) loa...
[ "func", "(", "u", "*", "UnlockerService", ")", "GenSeed", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "GenSeedRequest", ")", "(", "*", "lnrpc", ".", "GenSeedResponse", ",", "error", ")", "{", "// Before we start, we'll ensure that the ...
// GenSeed is the first method that should be used to instantiate a new lnd // instance. This method allows a caller to generate a new aezeed cipher seed // given an optional passphrase. If provided, the passphrase will be necessary // to decrypt the cipherseed to expose the internal wallet seed. // // Once the ciphers...
[ "GenSeed", "is", "the", "first", "method", "that", "should", "be", "used", "to", "instantiate", "a", "new", "lnd", "instance", ".", "This", "method", "allows", "a", "caller", "to", "generate", "a", "new", "aezeed", "cipher", "seed", "given", "an", "optiona...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/walletunlocker/service.go#L125-L190
129,133
lightningnetwork/lnd
walletunlocker/service.go
extractChanBackups
func extractChanBackups(chanBackups *lnrpc.ChanBackupSnapshot) *ChannelsToRecover { // If there aren't any populated channel backups, then we can exit // early as there's nothing to extract. if chanBackups == nil || (chanBackups.SingleChanBackups == nil && chanBackups.MultiChanBackup == nil) { return nil } //...
go
func extractChanBackups(chanBackups *lnrpc.ChanBackupSnapshot) *ChannelsToRecover { // If there aren't any populated channel backups, then we can exit // early as there's nothing to extract. if chanBackups == nil || (chanBackups.SingleChanBackups == nil && chanBackups.MultiChanBackup == nil) { return nil } //...
[ "func", "extractChanBackups", "(", "chanBackups", "*", "lnrpc", ".", "ChanBackupSnapshot", ")", "*", "ChannelsToRecover", "{", "// If there aren't any populated channel backups, then we can exit", "// early as there's nothing to extract.", "if", "chanBackups", "==", "nil", "||", ...
// extractChanBackups is a helper function that extracts the set of channel // backups from the proto into a format that we'll pass to higher level // sub-systems.
[ "extractChanBackups", "is", "a", "helper", "function", "that", "extracts", "the", "set", "of", "channel", "backups", "from", "the", "proto", "into", "a", "format", "that", "we", "ll", "pass", "to", "higher", "level", "sub", "-", "systems", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/walletunlocker/service.go#L195-L227
129,134
lightningnetwork/lnd
walletunlocker/service.go
InitWallet
func (u *UnlockerService) InitWallet(ctx context.Context, in *lnrpc.InitWalletRequest) (*lnrpc.InitWalletResponse, error) { // Make sure the password meets our constraints. password := in.WalletPassword if err := ValidatePassword(password); err != nil { return nil, err } // Require that the recovery window be...
go
func (u *UnlockerService) InitWallet(ctx context.Context, in *lnrpc.InitWalletRequest) (*lnrpc.InitWalletResponse, error) { // Make sure the password meets our constraints. password := in.WalletPassword if err := ValidatePassword(password); err != nil { return nil, err } // Require that the recovery window be...
[ "func", "(", "u", "*", "UnlockerService", ")", "InitWallet", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "InitWalletRequest", ")", "(", "*", "lnrpc", ".", "InitWalletResponse", ",", "error", ")", "{", "// Make sure the password meets o...
// InitWallet is used when lnd is starting up for the first time to fully // initialize the daemon and its internal wallet. At the very least a wallet // password must be provided. This will be used to encrypt sensitive material // on disk. // // In the case of a recovery scenario, the user can also specify their aezee...
[ "InitWallet", "is", "used", "when", "lnd", "is", "starting", "up", "for", "the", "first", "time", "to", "fully", "initialize", "the", "daemon", "and", "its", "internal", "wallet", ".", "At", "the", "very", "least", "a", "wallet", "password", "must", "be", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/walletunlocker/service.go#L241-L305
129,135
lightningnetwork/lnd
walletunlocker/service.go
UnlockWallet
func (u *UnlockerService) UnlockWallet(ctx context.Context, in *lnrpc.UnlockWalletRequest) (*lnrpc.UnlockWalletResponse, error) { password := in.WalletPassword recoveryWindow := uint32(in.RecoveryWindow) netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) loader := wallet.NewLoader(u.netParams, netDir, recov...
go
func (u *UnlockerService) UnlockWallet(ctx context.Context, in *lnrpc.UnlockWalletRequest) (*lnrpc.UnlockWalletResponse, error) { password := in.WalletPassword recoveryWindow := uint32(in.RecoveryWindow) netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) loader := wallet.NewLoader(u.netParams, netDir, recov...
[ "func", "(", "u", "*", "UnlockerService", ")", "UnlockWallet", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "UnlockWalletRequest", ")", "(", "*", "lnrpc", ".", "UnlockWalletResponse", ",", "error", ")", "{", "password", ":=", "in", ...
// UnlockWallet sends the password provided by the incoming UnlockWalletRequest // over the UnlockMsgs channel in case it successfully decrypts an existing // wallet found in the chain's wallet database directory.
[ "UnlockWallet", "sends", "the", "password", "provided", "by", "the", "incoming", "UnlockWalletRequest", "over", "the", "UnlockMsgs", "channel", "in", "case", "it", "successfully", "decrypts", "an", "existing", "wallet", "found", "in", "the", "chain", "s", "wallet"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/walletunlocker/service.go#L310-L359
129,136
lightningnetwork/lnd
walletunlocker/service.go
ChangePassword
func (u *UnlockerService) ChangePassword(ctx context.Context, in *lnrpc.ChangePasswordRequest) (*lnrpc.ChangePasswordResponse, error) { netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) loader := wallet.NewLoader(u.netParams, netDir, 0) // First, we'll make sure the wallet exists for the specific chain and ...
go
func (u *UnlockerService) ChangePassword(ctx context.Context, in *lnrpc.ChangePasswordRequest) (*lnrpc.ChangePasswordResponse, error) { netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) loader := wallet.NewLoader(u.netParams, netDir, 0) // First, we'll make sure the wallet exists for the specific chain and ...
[ "func", "(", "u", "*", "UnlockerService", ")", "ChangePassword", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "ChangePasswordRequest", ")", "(", "*", "lnrpc", ".", "ChangePasswordResponse", ",", "error", ")", "{", "netDir", ":=", "b...
// ChangePassword changes the password of the wallet and sends the new password // across the UnlockPasswords channel to automatically unlock the wallet if // successful.
[ "ChangePassword", "changes", "the", "password", "of", "the", "wallet", "and", "sends", "the", "new", "password", "across", "the", "UnlockPasswords", "channel", "to", "automatically", "unlock", "the", "wallet", "if", "successful", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/walletunlocker/service.go#L364-L432
129,137
lightningnetwork/lnd
htlcswitch/mock.go
intersect
func (s *mockServer) intersect(f messageInterceptor) { s.interceptorFuncs = append(s.interceptorFuncs, f) }
go
func (s *mockServer) intersect(f messageInterceptor) { s.interceptorFuncs = append(s.interceptorFuncs, f) }
[ "func", "(", "s", "*", "mockServer", ")", "intersect", "(", "f", "messageInterceptor", ")", "{", "s", ".", "interceptorFuncs", "=", "append", "(", "s", ".", "interceptorFuncs", ",", "f", ")", "\n", "}" ]
// Record is used to set the function which will be triggered when new // lnwire message was received.
[ "Record", "is", "used", "to", "set", "the", "function", "which", "will", "be", "triggered", "when", "new", "lnwire", "message", "was", "received", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/mock.go#L496-L498
129,138
lightningnetwork/lnd
htlcswitch/mock.go
completeCircuit
func (f *mockChannelLink) completeCircuit(pkt *htlcPacket) error { switch htlc := pkt.htlc.(type) { case *lnwire.UpdateAddHTLC: pkt.outgoingChanID = f.shortChanID pkt.outgoingHTLCID = f.htlcID htlc.ID = f.htlcID keystone := Keystone{pkt.inKey(), pkt.outKey()} if err := f.htlcSwitch.openCircuits(keystone); ...
go
func (f *mockChannelLink) completeCircuit(pkt *htlcPacket) error { switch htlc := pkt.htlc.(type) { case *lnwire.UpdateAddHTLC: pkt.outgoingChanID = f.shortChanID pkt.outgoingHTLCID = f.htlcID htlc.ID = f.htlcID keystone := Keystone{pkt.inKey(), pkt.outKey()} if err := f.htlcSwitch.openCircuits(keystone); ...
[ "func", "(", "f", "*", "mockChannelLink", ")", "completeCircuit", "(", "pkt", "*", "htlcPacket", ")", "error", "{", "switch", "htlc", ":=", "pkt", ".", "htlc", ".", "(", "type", ")", "{", "case", "*", "lnwire", ".", "UpdateAddHTLC", ":", "pkt", ".", ...
// completeCircuit is a helper method for adding the finalized payment circuit // to the switch's circuit map. In testing, this should be executed after // receiving an htlc from the downstream packets channel.
[ "completeCircuit", "is", "a", "helper", "method", "for", "adding", "the", "finalized", "payment", "circuit", "to", "the", "switch", "s", "circuit", "map", ".", "In", "testing", "this", "should", "be", "executed", "after", "receiving", "an", "htlc", "from", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/mock.go#L620-L644
129,139
lightningnetwork/lnd
nursery_store.go
prefixChainKey
func prefixChainKey(sysPrefix []byte, hash *chainhash.Hash) ([]byte, error) { // Create a buffer to which we will write the system prefix, e.g. // "utxn", followed by the provided chain hash. var pfxChainBuffer bytes.Buffer if _, err := pfxChainBuffer.Write(sysPrefix); err != nil { return nil, err } if _, err ...
go
func prefixChainKey(sysPrefix []byte, hash *chainhash.Hash) ([]byte, error) { // Create a buffer to which we will write the system prefix, e.g. // "utxn", followed by the provided chain hash. var pfxChainBuffer bytes.Buffer if _, err := pfxChainBuffer.Write(sysPrefix); err != nil { return nil, err } if _, err ...
[ "func", "prefixChainKey", "(", "sysPrefix", "[", "]", "byte", ",", "hash", "*", "chainhash", ".", "Hash", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Create a buffer to which we will write the system prefix, e.g.", "// \"utxn\", followed by the provided chai...
// prefixChainKey creates the root level keys for the nursery store. The keys // are comprised of a nursery-specific prefix and the intended chain hash that // this nursery store will be used for. This allows multiple nursery stores to // isolate their state when operating on multiple chains or forks.
[ "prefixChainKey", "creates", "the", "root", "level", "keys", "for", "the", "nursery", "store", ".", "The", "keys", "are", "comprised", "of", "a", "nursery", "-", "specific", "prefix", "and", "the", "intended", "chain", "hash", "that", "this", "nursery", "sto...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L196-L209
129,140
lightningnetwork/lnd
nursery_store.go
newNurseryStore
func newNurseryStore(chainHash *chainhash.Hash, db *channeldb.DB) (*nurseryStore, error) { // Prefix the provided chain hash with "utxn" to create the key for the // nursery store's root bucket, ensuring each one has proper chain // segmentation. pfxChainKey, err := prefixChainKey(utxnChainPrefix, chainHash) if ...
go
func newNurseryStore(chainHash *chainhash.Hash, db *channeldb.DB) (*nurseryStore, error) { // Prefix the provided chain hash with "utxn" to create the key for the // nursery store's root bucket, ensuring each one has proper chain // segmentation. pfxChainKey, err := prefixChainKey(utxnChainPrefix, chainHash) if ...
[ "func", "newNurseryStore", "(", "chainHash", "*", "chainhash", ".", "Hash", ",", "db", "*", "channeldb", ".", "DB", ")", "(", "*", "nurseryStore", ",", "error", ")", "{", "// Prefix the provided chain hash with \"utxn\" to create the key for the", "// nursery store's ro...
// newNurseryStore accepts a chain hash and a channeldb.DB instance, returning // an instance of nurseryStore who's database is properly segmented for the // given chain.
[ "newNurseryStore", "accepts", "a", "chain", "hash", "and", "a", "channeldb", ".", "DB", "instance", "returning", "an", "instance", "of", "nurseryStore", "who", "s", "database", "is", "properly", "segmented", "for", "the", "given", "chain", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L244-L260
129,141
lightningnetwork/lnd
nursery_store.go
CribToKinder
func (ns *nurseryStore) CribToKinder(bby *babyOutput) error { return ns.db.Update(func(tx *bbolt.Tx) error { // First, retrieve or create the channel bucket corresponding to // the baby output's origin channel point. chanPoint := bby.OriginChanPoint() chanBucket, err := ns.createChannelBucket(tx, chanPoint) ...
go
func (ns *nurseryStore) CribToKinder(bby *babyOutput) error { return ns.db.Update(func(tx *bbolt.Tx) error { // First, retrieve or create the channel bucket corresponding to // the baby output's origin channel point. chanPoint := bby.OriginChanPoint() chanBucket, err := ns.createChannelBucket(tx, chanPoint) ...
[ "func", "(", "ns", "*", "nurseryStore", ")", "CribToKinder", "(", "bby", "*", "babyOutput", ")", "error", "{", "return", "ns", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "// First, retrieve or create the...
// CribToKinder atomically moves a babyOutput in the crib bucket to the // kindergarten bucket. The now mature kidOutput contained in the babyOutput // will be stored as it waits out the kidOutput's CSV delay.
[ "CribToKinder", "atomically", "moves", "a", "babyOutput", "in", "the", "crib", "bucket", "to", "the", "kindergarten", "bucket", ".", "The", "now", "mature", "kidOutput", "contained", "in", "the", "babyOutput", "will", "be", "stored", "as", "it", "waits", "out"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L292-L369
129,142
lightningnetwork/lnd
nursery_store.go
PreschoolToKinder
func (ns *nurseryStore) PreschoolToKinder(kid *kidOutput, lastGradHeight uint32) error { return ns.db.Update(func(tx *bbolt.Tx) error { // Create or retrieve the channel bucket corresponding to the // kid output's origin channel point. chanPoint := kid.OriginChanPoint() chanBucket, err := ns.createChannelBuc...
go
func (ns *nurseryStore) PreschoolToKinder(kid *kidOutput, lastGradHeight uint32) error { return ns.db.Update(func(tx *bbolt.Tx) error { // Create or retrieve the channel bucket corresponding to the // kid output's origin channel point. chanPoint := kid.OriginChanPoint() chanBucket, err := ns.createChannelBuc...
[ "func", "(", "ns", "*", "nurseryStore", ")", "PreschoolToKinder", "(", "kid", "*", "kidOutput", ",", "lastGradHeight", "uint32", ")", "error", "{", "return", "ns", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error",...
// PreschoolToKinder atomically moves a kidOutput from the preschool bucket to // the kindergarten bucket. This transition should be executed after receiving // confirmation of the preschool output's commitment transaction.
[ "PreschoolToKinder", "atomically", "moves", "a", "kidOutput", "from", "the", "preschool", "bucket", "to", "the", "kindergarten", "bucket", ".", "This", "transition", "should", "be", "executed", "after", "receiving", "confirmation", "of", "the", "preschool", "output"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L374-L467
129,143
lightningnetwork/lnd
nursery_store.go
GraduateKinder
func (ns *nurseryStore) GraduateKinder(height uint32, kid *kidOutput) error { return ns.db.Update(func(tx *bbolt.Tx) error { hghtBucket := ns.getHeightBucket(tx, height) if hghtBucket == nil { // Nothing to delete, bucket has already been removed. return nil } // For the kindergarten output, delete its...
go
func (ns *nurseryStore) GraduateKinder(height uint32, kid *kidOutput) error { return ns.db.Update(func(tx *bbolt.Tx) error { hghtBucket := ns.getHeightBucket(tx, height) if hghtBucket == nil { // Nothing to delete, bucket has already been removed. return nil } // For the kindergarten output, delete its...
[ "func", "(", "ns", "*", "nurseryStore", ")", "GraduateKinder", "(", "height", "uint32", ",", "kid", "*", "kidOutput", ")", "error", "{", "return", "ns", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "...
// GraduateKinder atomically moves an output at the provided height into the // graduated status. This involves removing the kindergarten entries from both // the height and channel indexes. The height bucket will be opportunistically // pruned from the height index as outputs are removed.
[ "GraduateKinder", "atomically", "moves", "an", "output", "at", "the", "provided", "height", "into", "the", "graduated", "status", ".", "This", "involves", "removing", "the", "kindergarten", "entries", "from", "both", "the", "height", "and", "channel", "indexes", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L473-L530
129,144
lightningnetwork/lnd
nursery_store.go
FetchClass
func (ns *nurseryStore) FetchClass( height uint32) ([]kidOutput, []babyOutput, error) { // Construct list of all crib and kindergarten outputs that need to be // processed at the provided block height. var kids []kidOutput var babies []babyOutput if err := ns.db.View(func(tx *bbolt.Tx) error { // Append each c...
go
func (ns *nurseryStore) FetchClass( height uint32) ([]kidOutput, []babyOutput, error) { // Construct list of all crib and kindergarten outputs that need to be // processed at the provided block height. var kids []kidOutput var babies []babyOutput if err := ns.db.View(func(tx *bbolt.Tx) error { // Append each c...
[ "func", "(", "ns", "*", "nurseryStore", ")", "FetchClass", "(", "height", "uint32", ")", "(", "[", "]", "kidOutput", ",", "[", "]", "babyOutput", ",", "error", ")", "{", "// Construct list of all crib and kindergarten outputs that need to be", "// processed at the pro...
// FetchClass returns a list of babyOutputs in the crib bucket whose CLTV // delay expires at the provided block height. // FetchClass returns a list of the kindergarten and crib outputs whose timeouts // are expiring
[ "FetchClass", "returns", "a", "list", "of", "babyOutputs", "in", "the", "crib", "bucket", "whose", "CLTV", "delay", "expires", "at", "the", "provided", "block", "height", ".", "FetchClass", "returns", "a", "list", "of", "the", "kindergarten", "and", "crib", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L536-L591
129,145
lightningnetwork/lnd
nursery_store.go
FetchPreschools
func (ns *nurseryStore) FetchPreschools() ([]kidOutput, error) { var kids []kidOutput if err := ns.db.View(func(tx *bbolt.Tx) error { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Load the existing channel ...
go
func (ns *nurseryStore) FetchPreschools() ([]kidOutput, error) { var kids []kidOutput if err := ns.db.View(func(tx *bbolt.Tx) error { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Load the existing channel ...
[ "func", "(", "ns", "*", "nurseryStore", ")", "FetchPreschools", "(", ")", "(", "[", "]", "kidOutput", ",", "error", ")", "{", "var", "kids", "[", "]", "kidOutput", "\n", "if", "err", ":=", "ns", ".", "db", ".", "View", "(", "func", "(", "tx", "*"...
// FetchPreschools returns a list of all outputs currently stored in the // preschool bucket.
[ "FetchPreschools", "returns", "a", "list", "of", "all", "outputs", "currently", "stored", "in", "the", "preschool", "bucket", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L595-L664
129,146
lightningnetwork/lnd
nursery_store.go
HeightsBelowOrEqual
func (ns *nurseryStore) HeightsBelowOrEqual(height uint32) ([]uint32, error) { var activeHeights []uint32 err := ns.db.View(func(tx *bbolt.Tx) error { // Ensure that the chain bucket for this nursery store exists. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Ensure th...
go
func (ns *nurseryStore) HeightsBelowOrEqual(height uint32) ([]uint32, error) { var activeHeights []uint32 err := ns.db.View(func(tx *bbolt.Tx) error { // Ensure that the chain bucket for this nursery store exists. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Ensure th...
[ "func", "(", "ns", "*", "nurseryStore", ")", "HeightsBelowOrEqual", "(", "height", "uint32", ")", "(", "[", "]", "uint32", ",", "error", ")", "{", "var", "activeHeights", "[", "]", "uint32", "\n", "err", ":=", "ns", ".", "db", ".", "View", "(", "func...
// HeightsBelowOrEqual returns a slice of all non-empty heights in the height // index at or below the provided upper bound.
[ "HeightsBelowOrEqual", "returns", "a", "slice", "of", "all", "non", "-", "empty", "heights", "in", "the", "height", "index", "at", "or", "below", "the", "provided", "upper", "bound", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L668-L703
129,147
lightningnetwork/lnd
nursery_store.go
ListChannels
func (ns *nurseryStore) ListChannels() ([]wire.OutPoint, error) { var activeChannels []wire.OutPoint if err := ns.db.View(func(tx *bbolt.Tx) error { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Retrieve the...
go
func (ns *nurseryStore) ListChannels() ([]wire.OutPoint, error) { var activeChannels []wire.OutPoint if err := ns.db.View(func(tx *bbolt.Tx) error { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Retrieve the...
[ "func", "(", "ns", "*", "nurseryStore", ")", "ListChannels", "(", ")", "(", "[", "]", "wire", ".", "OutPoint", ",", "error", ")", "{", "var", "activeChannels", "[", "]", "wire", ".", "OutPoint", "\n", "if", "err", ":=", "ns", ".", "db", ".", "View"...
// ListChannels returns all channels the nursery is currently tracking.
[ "ListChannels", "returns", "all", "channels", "the", "nursery", "is", "currently", "tracking", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L721-L752
129,148
lightningnetwork/lnd
nursery_store.go
IsMatureChannel
func (ns *nurseryStore) IsMatureChannel(chanPoint *wire.OutPoint) (bool, error) { err := ns.db.View(func(tx *bbolt.Tx) error { // Iterate over the contents of the channel bucket, computing // both total number of outputs, and those that have the grad // prefix. return ns.forChanOutputs(tx, chanPoint, func(p...
go
func (ns *nurseryStore) IsMatureChannel(chanPoint *wire.OutPoint) (bool, error) { err := ns.db.View(func(tx *bbolt.Tx) error { // Iterate over the contents of the channel bucket, computing // both total number of outputs, and those that have the grad // prefix. return ns.forChanOutputs(tx, chanPoint, func(p...
[ "func", "(", "ns", "*", "nurseryStore", ")", "IsMatureChannel", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "(", "bool", ",", "error", ")", "{", "err", ":=", "ns", ".", "db", ".", "View", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ...
// IsMatureChannel determines the whether or not all of the outputs in a // particular channel bucket have been marked as graduated.
[ "IsMatureChannel", "determines", "the", "whether", "or", "not", "all", "of", "the", "outputs", "in", "a", "particular", "channel", "bucket", "have", "been", "marked", "as", "graduated", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L756-L775
129,149
lightningnetwork/lnd
nursery_store.go
enterCrib
func (ns *nurseryStore) enterCrib(tx *bbolt.Tx, baby *babyOutput) error { // First, retrieve or create the channel bucket corresponding to the // baby output's origin channel point. chanPoint := baby.OriginChanPoint() chanBucket, err := ns.createChannelBucket(tx, chanPoint) if err != nil { return err } // Sin...
go
func (ns *nurseryStore) enterCrib(tx *bbolt.Tx, baby *babyOutput) error { // First, retrieve or create the channel bucket corresponding to the // baby output's origin channel point. chanPoint := baby.OriginChanPoint() chanBucket, err := ns.createChannelBucket(tx, chanPoint) if err != nil { return err } // Sin...
[ "func", "(", "ns", "*", "nurseryStore", ")", "enterCrib", "(", "tx", "*", "bbolt", ".", "Tx", ",", "baby", "*", "babyOutput", ")", "error", "{", "// First, retrieve or create the channel bucket corresponding to the", "// baby output's origin channel point.", "chanPoint", ...
// Helper Methods // enterCrib accepts a new htlc output that the nursery will incubate through // its two-stage process of sweeping funds back to the user's wallet. These // outputs are persisted in the nursery store in the crib state, and will be // revisited after the first-stage output's CLTV has expired.
[ "Helper", "Methods", "enterCrib", "accepts", "a", "new", "htlc", "output", "that", "the", "nursery", "will", "incubate", "through", "its", "two", "-", "stage", "process", "of", "sweeping", "funds", "back", "to", "the", "user", "s", "wallet", ".", "These", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L848-L899
129,150
lightningnetwork/lnd
nursery_store.go
enterPreschool
func (ns *nurseryStore) enterPreschool(tx *bbolt.Tx, kid *kidOutput) error { // First, retrieve or create the channel bucket corresponding to the // baby output's origin channel point. chanPoint := kid.OriginChanPoint() chanBucket, err := ns.createChannelBucket(tx, chanPoint) if err != nil { return err } // S...
go
func (ns *nurseryStore) enterPreschool(tx *bbolt.Tx, kid *kidOutput) error { // First, retrieve or create the channel bucket corresponding to the // baby output's origin channel point. chanPoint := kid.OriginChanPoint() chanBucket, err := ns.createChannelBucket(tx, chanPoint) if err != nil { return err } // S...
[ "func", "(", "ns", "*", "nurseryStore", ")", "enterPreschool", "(", "tx", "*", "bbolt", ".", "Tx", ",", "kid", "*", "kidOutput", ")", "error", "{", "// First, retrieve or create the channel bucket corresponding to the", "// baby output's origin channel point.", "chanPoint...
// enterPreschool accepts a new commitment output that the nursery will incubate // through a single stage before sweeping. Outputs are stored in the preschool // bucket until the commitment transaction has been confirmed, at which point // they will be moved to the kindergarten bucket.
[ "enterPreschool", "accepts", "a", "new", "commitment", "output", "that", "the", "nursery", "will", "incubate", "through", "a", "single", "stage", "before", "sweeping", ".", "Outputs", "are", "stored", "in", "the", "preschool", "bucket", "until", "the", "commitme...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L905-L934
129,151
lightningnetwork/lnd
nursery_store.go
createChannelBucket
func (ns *nurseryStore) createChannelBucket(tx *bbolt.Tx, chanPoint *wire.OutPoint) (*bbolt.Bucket, error) { // Ensure that the chain bucket for this nursery store exists. chainBucket, err := tx.CreateBucketIfNotExists(ns.pfxChainKey) if err != nil { return nil, err } // Ensure that the channel index has been...
go
func (ns *nurseryStore) createChannelBucket(tx *bbolt.Tx, chanPoint *wire.OutPoint) (*bbolt.Bucket, error) { // Ensure that the chain bucket for this nursery store exists. chainBucket, err := tx.CreateBucketIfNotExists(ns.pfxChainKey) if err != nil { return nil, err } // Ensure that the channel index has been...
[ "func", "(", "ns", "*", "nurseryStore", ")", "createChannelBucket", "(", "tx", "*", "bbolt", ".", "Tx", ",", "chanPoint", "*", "wire", ".", "OutPoint", ")", "(", "*", "bbolt", ".", "Bucket", ",", "error", ")", "{", "// Ensure that the chain bucket for this n...
// createChannelBucket creates or retrieves a channel bucket for the provided // channel point.
[ "createChannelBucket", "creates", "or", "retrieves", "a", "channel", "bucket", "for", "the", "provided", "channel", "point", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L938-L964
129,152
lightningnetwork/lnd
nursery_store.go
getChannelBucket
func (ns *nurseryStore) getChannelBucket(tx *bbolt.Tx, chanPoint *wire.OutPoint) *bbolt.Bucket { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Retrieve the existing channel index. chanIndex := chainBucket.Bucket(...
go
func (ns *nurseryStore) getChannelBucket(tx *bbolt.Tx, chanPoint *wire.OutPoint) *bbolt.Bucket { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil } // Retrieve the existing channel index. chanIndex := chainBucket.Bucket(...
[ "func", "(", "ns", "*", "nurseryStore", ")", "getChannelBucket", "(", "tx", "*", "bbolt", ".", "Tx", ",", "chanPoint", "*", "wire", ".", "OutPoint", ")", "*", "bbolt", ".", "Bucket", "{", "// Retrieve the existing chain bucket for this nursery store.", "chainBucke...
// getChannelBucket retrieves an existing channel bucket from the nursery store, // using the given channel point. If the bucket does not exist, or any bucket // along its path does not exist, a nil value is returned.
[ "getChannelBucket", "retrieves", "an", "existing", "channel", "bucket", "from", "the", "nursery", "store", "using", "the", "given", "channel", "point", ".", "If", "the", "bucket", "does", "not", "exist", "or", "any", "bucket", "along", "its", "path", "does", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L969-L992
129,153
lightningnetwork/lnd
nursery_store.go
createHeightBucket
func (ns *nurseryStore) createHeightBucket(tx *bbolt.Tx, height uint32) (*bbolt.Bucket, error) { // Ensure that the chain bucket for this nursery store exists. chainBucket, err := tx.CreateBucketIfNotExists(ns.pfxChainKey) if err != nil { return nil, err } // Ensure that the height index has been properly ini...
go
func (ns *nurseryStore) createHeightBucket(tx *bbolt.Tx, height uint32) (*bbolt.Bucket, error) { // Ensure that the chain bucket for this nursery store exists. chainBucket, err := tx.CreateBucketIfNotExists(ns.pfxChainKey) if err != nil { return nil, err } // Ensure that the height index has been properly ini...
[ "func", "(", "ns", "*", "nurseryStore", ")", "createHeightBucket", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ")", "(", "*", "bbolt", ".", "Bucket", ",", "error", ")", "{", "// Ensure that the chain bucket for this nursery store exists.", "chai...
// createHeightBucket creates or retrieves an existing bucket from the height // index, corresponding to the provided height.
[ "createHeightBucket", "creates", "or", "retrieves", "an", "existing", "bucket", "from", "the", "height", "index", "corresponding", "to", "the", "provided", "height", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L996-L1019
129,154
lightningnetwork/lnd
nursery_store.go
getHeightBucketPath
func (ns *nurseryStore) getHeightBucketPath(tx *bbolt.Tx, height uint32) (*bbolt.Bucket, *bbolt.Bucket, *bbolt.Bucket) { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil, nil, nil } // Retrieve the existing channel index....
go
func (ns *nurseryStore) getHeightBucketPath(tx *bbolt.Tx, height uint32) (*bbolt.Bucket, *bbolt.Bucket, *bbolt.Bucket) { // Retrieve the existing chain bucket for this nursery store. chainBucket := tx.Bucket(ns.pfxChainKey) if chainBucket == nil { return nil, nil, nil } // Retrieve the existing channel index....
[ "func", "(", "ns", "*", "nurseryStore", ")", "getHeightBucketPath", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ")", "(", "*", "bbolt", ".", "Bucket", ",", "*", "bbolt", ".", "Bucket", ",", "*", "bbolt", ".", "Bucket", ")", "{", "/...
// getHeightBucketPath retrieves an existing height bucket from the nursery // store, using the provided block height. If the bucket does not exist, or any // bucket along its path does not exist, a nil value is returned.
[ "getHeightBucketPath", "retrieves", "an", "existing", "height", "bucket", "from", "the", "nursery", "store", "using", "the", "provided", "block", "height", ".", "If", "the", "bucket", "does", "not", "exist", "or", "any", "bucket", "along", "its", "path", "does...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1024-L1045
129,155
lightningnetwork/lnd
nursery_store.go
getHeightBucket
func (ns *nurseryStore) getHeightBucket(tx *bbolt.Tx, height uint32) *bbolt.Bucket { _, _, hghtBucket := ns.getHeightBucketPath(tx, height) return hghtBucket }
go
func (ns *nurseryStore) getHeightBucket(tx *bbolt.Tx, height uint32) *bbolt.Bucket { _, _, hghtBucket := ns.getHeightBucketPath(tx, height) return hghtBucket }
[ "func", "(", "ns", "*", "nurseryStore", ")", "getHeightBucket", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ")", "*", "bbolt", ".", "Bucket", "{", "_", ",", "_", ",", "hghtBucket", ":=", "ns", ".", "getHeightBucketPath", "(", "tx", "...
// getHeightBucket retrieves an existing height bucket from the nursery store, // using the provided block height. If the bucket does not exist, or any bucket // along its path does not exist, a nil value is returned.
[ "getHeightBucket", "retrieves", "an", "existing", "height", "bucket", "from", "the", "nursery", "store", "using", "the", "provided", "block", "height", ".", "If", "the", "bucket", "does", "not", "exist", "or", "any", "bucket", "along", "its", "path", "does", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1050-L1055
129,156
lightningnetwork/lnd
nursery_store.go
createHeightChanBucket
func (ns *nurseryStore) createHeightChanBucket(tx *bbolt.Tx, height uint32, chanPoint *wire.OutPoint) (*bbolt.Bucket, error) { // Ensure that the height bucket for this nursery store exists. hghtBucket, err := ns.createHeightBucket(tx, height) if err != nil { return nil, err } // Serialize the provided channe...
go
func (ns *nurseryStore) createHeightChanBucket(tx *bbolt.Tx, height uint32, chanPoint *wire.OutPoint) (*bbolt.Bucket, error) { // Ensure that the height bucket for this nursery store exists. hghtBucket, err := ns.createHeightBucket(tx, height) if err != nil { return nil, err } // Serialize the provided channe...
[ "func", "(", "ns", "*", "nurseryStore", ")", "createHeightChanBucket", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ",", "chanPoint", "*", "wire", ".", "OutPoint", ")", "(", "*", "bbolt", ".", "Bucket", ",", "error", ")", "{", "// Ensur...
// createHeightChanBucket creates or retrieves an existing height-channel bucket // for the provided block height and channel point. This method will attempt to // instantiate all buckets along the path if required.
[ "createHeightChanBucket", "creates", "or", "retrieves", "an", "existing", "height", "-", "channel", "bucket", "for", "the", "provided", "block", "height", "and", "channel", "point", ".", "This", "method", "will", "attempt", "to", "instantiate", "all", "buckets", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1060-L1080
129,157
lightningnetwork/lnd
nursery_store.go
getHeightChanBucket
func (ns *nurseryStore) getHeightChanBucket(tx *bbolt.Tx, height uint32, chanPoint *wire.OutPoint) *bbolt.Bucket { // Retrieve the existing height bucket from this nursery store. hghtBucket := ns.getHeightBucket(tx, height) if hghtBucket == nil { return nil } // Serialize the provided channel point, which gen...
go
func (ns *nurseryStore) getHeightChanBucket(tx *bbolt.Tx, height uint32, chanPoint *wire.OutPoint) *bbolt.Bucket { // Retrieve the existing height bucket from this nursery store. hghtBucket := ns.getHeightBucket(tx, height) if hghtBucket == nil { return nil } // Serialize the provided channel point, which gen...
[ "func", "(", "ns", "*", "nurseryStore", ")", "getHeightChanBucket", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ",", "chanPoint", "*", "wire", ".", "OutPoint", ")", "*", "bbolt", ".", "Bucket", "{", "// Retrieve the existing height bucket from...
// getHeightChanBucket retrieves an existing height-channel bucket from the // nursery store, using the provided block height and channel point. if the // bucket does not exist, or any bucket along its path does not exist, a nil // value is returned.
[ "getHeightChanBucket", "retrieves", "an", "existing", "height", "-", "channel", "bucket", "from", "the", "nursery", "store", "using", "the", "provided", "block", "height", "and", "channel", "point", ".", "if", "the", "bucket", "does", "not", "exist", "or", "an...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1086-L1106
129,158
lightningnetwork/lnd
nursery_store.go
forEachHeightPrefix
func (ns *nurseryStore) forEachHeightPrefix(tx *bbolt.Tx, prefix []byte, height uint32, callback func([]byte) error) error { // Start by retrieving the height bucket corresponding to the provided // block height. chainBucket, _, hghtBucket := ns.getHeightBucketPath(tx, height) if hghtBucket == nil { return nil ...
go
func (ns *nurseryStore) forEachHeightPrefix(tx *bbolt.Tx, prefix []byte, height uint32, callback func([]byte) error) error { // Start by retrieving the height bucket corresponding to the provided // block height. chainBucket, _, hghtBucket := ns.getHeightBucketPath(tx, height) if hghtBucket == nil { return nil ...
[ "func", "(", "ns", "*", "nurseryStore", ")", "forEachHeightPrefix", "(", "tx", "*", "bbolt", ".", "Tx", ",", "prefix", "[", "]", "byte", ",", "height", "uint32", ",", "callback", "func", "(", "[", "]", "byte", ")", "error", ")", "error", "{", "// Sta...
// forEachHeightPrefix enumerates all outputs at the given height whose state // prefix matches that which is provided. This is used as a subroutine to help // enumerate crib and kindergarten outputs at a particular height. The callback // is invoked with serialized bytes retrieved for each output of interest, // allow...
[ "forEachHeightPrefix", "enumerates", "all", "outputs", "at", "the", "given", "height", "whose", "state", "prefix", "matches", "that", "which", "is", "provided", ".", "This", "is", "used", "as", "a", "subroutine", "to", "help", "enumerate", "crib", "and", "kind...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1113-L1195
129,159
lightningnetwork/lnd
nursery_store.go
forChanOutputs
func (ns *nurseryStore) forChanOutputs(tx *bbolt.Tx, chanPoint *wire.OutPoint, callback func([]byte, []byte) error) error { chanBucket := ns.getChannelBucket(tx, chanPoint) if chanBucket == nil { return ErrContractNotFound } return chanBucket.ForEach(callback) }
go
func (ns *nurseryStore) forChanOutputs(tx *bbolt.Tx, chanPoint *wire.OutPoint, callback func([]byte, []byte) error) error { chanBucket := ns.getChannelBucket(tx, chanPoint) if chanBucket == nil { return ErrContractNotFound } return chanBucket.ForEach(callback) }
[ "func", "(", "ns", "*", "nurseryStore", ")", "forChanOutputs", "(", "tx", "*", "bbolt", ".", "Tx", ",", "chanPoint", "*", "wire", ".", "OutPoint", ",", "callback", "func", "(", "[", "]", "byte", ",", "[", "]", "byte", ")", "error", ")", "error", "{...
// forChanOutputs enumerates the outputs contained in a channel bucket to the // provided callback. The callback accepts a key-value pair of byte slices // corresponding to the prefixed-output key and the serialized output, // respectively.
[ "forChanOutputs", "enumerates", "the", "outputs", "contained", "in", "a", "channel", "bucket", "to", "the", "provided", "callback", ".", "The", "callback", "accepts", "a", "key", "-", "value", "pair", "of", "byte", "slices", "corresponding", "to", "the", "pref...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1201-L1210
129,160
lightningnetwork/lnd
nursery_store.go
removeOutputFromHeight
func (ns *nurseryStore) removeOutputFromHeight(tx *bbolt.Tx, height uint32, chanPoint *wire.OutPoint, pfxKey []byte) error { // Retrieve the height-channel bucket and delete the prefixed output. hghtChanBucket := ns.getHeightChanBucket(tx, height, chanPoint) if hghtChanBucket == nil { // Height-channel bucket al...
go
func (ns *nurseryStore) removeOutputFromHeight(tx *bbolt.Tx, height uint32, chanPoint *wire.OutPoint, pfxKey []byte) error { // Retrieve the height-channel bucket and delete the prefixed output. hghtChanBucket := ns.getHeightChanBucket(tx, height, chanPoint) if hghtChanBucket == nil { // Height-channel bucket al...
[ "func", "(", "ns", "*", "nurseryStore", ")", "removeOutputFromHeight", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ",", "chanPoint", "*", "wire", ".", "OutPoint", ",", "pfxKey", "[", "]", "byte", ")", "error", "{", "// Retrieve the height-...
// removeOutputFromHeight will delete the given output from the specified // height-channel bucket, and attempt to prune the upstream directories if they // are empty.
[ "removeOutputFromHeight", "will", "delete", "the", "given", "output", "from", "the", "specified", "height", "-", "channel", "bucket", "and", "attempt", "to", "prune", "the", "upstream", "directories", "if", "they", "are", "empty", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1219-L1265
129,161
lightningnetwork/lnd
nursery_store.go
pruneHeight
func (ns *nurseryStore) pruneHeight(tx *bbolt.Tx, height uint32) (bool, error) { // Fetch the existing height index and height bucket. _, hghtIndex, hghtBucket := ns.getHeightBucketPath(tx, height) if hghtBucket == nil { return false, nil } // Iterate over all channels stored at this block height. We will // a...
go
func (ns *nurseryStore) pruneHeight(tx *bbolt.Tx, height uint32) (bool, error) { // Fetch the existing height index and height bucket. _, hghtIndex, hghtBucket := ns.getHeightBucketPath(tx, height) if hghtBucket == nil { return false, nil } // Iterate over all channels stored at this block height. We will // a...
[ "func", "(", "ns", "*", "nurseryStore", ")", "pruneHeight", "(", "tx", "*", "bbolt", ".", "Tx", ",", "height", "uint32", ")", "(", "bool", ",", "error", ")", "{", "// Fetch the existing height index and height bucket.", "_", ",", "hghtIndex", ",", "hghtBucket"...
// pruneHeight removes the height bucket at the provided height if and only if // all active outputs at this height have been removed from their respective // height-channel buckets. The returned boolean value indicated whether or not // this invocation successfully pruned the height bucket.
[ "pruneHeight", "removes", "the", "height", "bucket", "at", "the", "provided", "height", "if", "and", "only", "if", "all", "active", "outputs", "at", "this", "height", "have", "been", "removed", "from", "their", "respective", "height", "-", "channel", "buckets"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1271-L1314
129,162
lightningnetwork/lnd
nursery_store.go
removeBucketIfEmpty
func removeBucketIfEmpty(parent *bbolt.Bucket, bktName []byte) error { // Attempt to fetch the named bucket from its parent. bkt := parent.Bucket(bktName) if bkt == nil { // No bucket was found, already removed? return nil } // The bucket exists, fail if it still has children. if err := isBucketEmpty(bkt); e...
go
func removeBucketIfEmpty(parent *bbolt.Bucket, bktName []byte) error { // Attempt to fetch the named bucket from its parent. bkt := parent.Bucket(bktName) if bkt == nil { // No bucket was found, already removed? return nil } // The bucket exists, fail if it still has children. if err := isBucketEmpty(bkt); e...
[ "func", "removeBucketIfEmpty", "(", "parent", "*", "bbolt", ".", "Bucket", ",", "bktName", "[", "]", "byte", ")", "error", "{", "// Attempt to fetch the named bucket from its parent.", "bkt", ":=", "parent", ".", "Bucket", "(", "bktName", ")", "\n", "if", "bkt",...
// removeBucketIfEmpty attempts to delete a bucket specified by name from the // provided parent bucket.
[ "removeBucketIfEmpty", "attempts", "to", "delete", "a", "bucket", "specified", "by", "name", "from", "the", "provided", "parent", "bucket", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1318-L1332
129,163
lightningnetwork/lnd
nursery_store.go
removeBucketIfExists
func removeBucketIfExists(parent *bbolt.Bucket, bktName []byte) error { // Attempt to fetch the named bucket from its parent. bkt := parent.Bucket(bktName) if bkt == nil { // No bucket was found, already removed? return nil } return parent.DeleteBucket(bktName) }
go
func removeBucketIfExists(parent *bbolt.Bucket, bktName []byte) error { // Attempt to fetch the named bucket from its parent. bkt := parent.Bucket(bktName) if bkt == nil { // No bucket was found, already removed? return nil } return parent.DeleteBucket(bktName) }
[ "func", "removeBucketIfExists", "(", "parent", "*", "bbolt", ".", "Bucket", ",", "bktName", "[", "]", "byte", ")", "error", "{", "// Attempt to fetch the named bucket from its parent.", "bkt", ":=", "parent", ".", "Bucket", "(", "bktName", ")", "\n", "if", "bkt"...
// removeBucketIfExists safely deletes the named bucket by first checking // that it exists in the parent bucket.
[ "removeBucketIfExists", "safely", "deletes", "the", "named", "bucket", "by", "first", "checking", "that", "it", "exists", "in", "the", "parent", "bucket", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1336-L1345
129,164
lightningnetwork/lnd
nursery_store.go
isBucketEmpty
func isBucketEmpty(parent *bbolt.Bucket) error { return parent.ForEach(func(_, _ []byte) error { return errBucketNotEmpty }) }
go
func isBucketEmpty(parent *bbolt.Bucket) error { return parent.ForEach(func(_, _ []byte) error { return errBucketNotEmpty }) }
[ "func", "isBucketEmpty", "(", "parent", "*", "bbolt", ".", "Bucket", ")", "error", "{", "return", "parent", ".", "ForEach", "(", "func", "(", "_", ",", "_", "[", "]", "byte", ")", "error", "{", "return", "errBucketNotEmpty", "\n", "}", ")", "\n", "}"...
// isBucketEmpty returns errBucketNotEmpty if the bucket has a non-zero number // of children.
[ "isBucketEmpty", "returns", "errBucketNotEmpty", "if", "the", "bucket", "has", "a", "non", "-", "zero", "number", "of", "children", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nursery_store.go#L1349-L1353
129,165
lightningnetwork/lnd
lnwire/closing_signed.go
NewClosingSigned
func NewClosingSigned(cid ChannelID, fs btcutil.Amount, sig Sig) *ClosingSigned { return &ClosingSigned{ ChannelID: cid, FeeSatoshis: fs, Signature: sig, } }
go
func NewClosingSigned(cid ChannelID, fs btcutil.Amount, sig Sig) *ClosingSigned { return &ClosingSigned{ ChannelID: cid, FeeSatoshis: fs, Signature: sig, } }
[ "func", "NewClosingSigned", "(", "cid", "ChannelID", ",", "fs", "btcutil", ".", "Amount", ",", "sig", "Sig", ")", "*", "ClosingSigned", "{", "return", "&", "ClosingSigned", "{", "ChannelID", ":", "cid", ",", "FeeSatoshis", ":", "fs", ",", "Signature", ":",...
// NewClosingSigned creates a new empty ClosingSigned message.
[ "NewClosingSigned", "creates", "a", "new", "empty", "ClosingSigned", "message", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/closing_signed.go#L33-L41
129,166
lightningnetwork/lnd
lnwire/closing_signed.go
Decode
func (c *ClosingSigned) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChannelID, &c.FeeSatoshis, &c.Signature) }
go
func (c *ClosingSigned) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChannelID, &c.FeeSatoshis, &c.Signature) }
[ "func", "(", "c", "*", "ClosingSigned", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "c", ".", "ChannelID", ",", "&", "c", ".", "FeeSatoshis", ",", "&", "c", ...
// 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.
[ "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", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/closing_signed.go#L51-L53
129,167
lightningnetwork/lnd
lnwire/closing_signed.go
Encode
func (c *ClosingSigned) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChannelID, c.FeeSatoshis, c.Signature) }
go
func (c *ClosingSigned) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChannelID, c.FeeSatoshis, c.Signature) }
[ "func", "(", "c", "*", "ClosingSigned", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "c", ".", "ChannelID", ",", "c", ".", "FeeSatoshis", ",", "c", ".", "Signature",...
// Encode serializes the target ClosingSigned into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "ClosingSigned", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/closing_signed.go#L59-L61
129,168
lightningnetwork/lnd
lnwire/closing_signed.go
MaxPayloadLength
func (c *ClosingSigned) MaxPayloadLength(uint32) uint32 { var length uint32 // ChannelID - 32 bytes length += 32 // FeeSatoshis - 8 bytes length += 8 // Signature - 64 bytes length += 64 return length }
go
func (c *ClosingSigned) MaxPayloadLength(uint32) uint32 { var length uint32 // ChannelID - 32 bytes length += 32 // FeeSatoshis - 8 bytes length += 8 // Signature - 64 bytes length += 64 return length }
[ "func", "(", "c", "*", "ClosingSigned", ")", "MaxPayloadLength", "(", "uint32", ")", "uint32", "{", "var", "length", "uint32", "\n\n", "// ChannelID - 32 bytes", "length", "+=", "32", "\n\n", "// FeeSatoshis - 8 bytes", "length", "+=", "8", "\n\n", "// Signature -...
// 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.
[ "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"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/closing_signed.go#L75-L88
129,169
lightningnetwork/lnd
lntypes/preimage.go
MakePreimage
func MakePreimage(newPreimage []byte) (Preimage, error) { nhlen := len(newPreimage) if nhlen != PreimageSize { return Preimage{}, fmt.Errorf("invalid preimage length of %v, "+ "want %v", nhlen, PreimageSize) } var preimage Preimage copy(preimage[:], newPreimage) return preimage, nil }
go
func MakePreimage(newPreimage []byte) (Preimage, error) { nhlen := len(newPreimage) if nhlen != PreimageSize { return Preimage{}, fmt.Errorf("invalid preimage length of %v, "+ "want %v", nhlen, PreimageSize) } var preimage Preimage copy(preimage[:], newPreimage) return preimage, nil }
[ "func", "MakePreimage", "(", "newPreimage", "[", "]", "byte", ")", "(", "Preimage", ",", "error", ")", "{", "nhlen", ":=", "len", "(", "newPreimage", ")", "\n", "if", "nhlen", "!=", "PreimageSize", "{", "return", "Preimage", "{", "}", ",", "fmt", ".", ...
// MakePreimage returns a new Preimage from a bytes slice. An error is returned // if the number of bytes passed in is not PreimageSize.
[ "MakePreimage", "returns", "a", "new", "Preimage", "from", "a", "bytes", "slice", ".", "An", "error", "is", "returned", "if", "the", "number", "of", "bytes", "passed", "in", "is", "not", "PreimageSize", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lntypes/preimage.go#L23-L34
129,170
lightningnetwork/lnd
lntypes/preimage.go
MakePreimageFromStr
func MakePreimageFromStr(newPreimage string) (Preimage, error) { // Return error if preimage string is of incorrect length. if len(newPreimage) != PreimageSize*2 { return Preimage{}, fmt.Errorf("invalid preimage string length "+ "of %v, want %v", len(newPreimage), PreimageSize*2) } preimage, err := hex.Decode...
go
func MakePreimageFromStr(newPreimage string) (Preimage, error) { // Return error if preimage string is of incorrect length. if len(newPreimage) != PreimageSize*2 { return Preimage{}, fmt.Errorf("invalid preimage string length "+ "of %v, want %v", len(newPreimage), PreimageSize*2) } preimage, err := hex.Decode...
[ "func", "MakePreimageFromStr", "(", "newPreimage", "string", ")", "(", "Preimage", ",", "error", ")", "{", "// Return error if preimage string is of incorrect length.", "if", "len", "(", "newPreimage", ")", "!=", "PreimageSize", "*", "2", "{", "return", "Preimage", ...
// MakePreimageFromStr creates a Preimage from a hex preimage string.
[ "MakePreimageFromStr", "creates", "a", "Preimage", "from", "a", "hex", "preimage", "string", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lntypes/preimage.go#L37-L50
129,171
lightningnetwork/lnd
rpcserver.go
Start
func (r *rpcServer) Start() error { if atomic.AddInt32(&r.started, 1) != 1 { return nil } // First, we'll start all the sub-servers to ensure that they're ready // to take new requests in. // // TODO(roasbeef): some may require that the entire daemon be started // at that point for _, subServer := range r.su...
go
func (r *rpcServer) Start() error { if atomic.AddInt32(&r.started, 1) != 1 { return nil } // First, we'll start all the sub-servers to ensure that they're ready // to take new requests in. // // TODO(roasbeef): some may require that the entire daemon be started // at that point for _, subServer := range r.su...
[ "func", "(", "r", "*", "rpcServer", ")", "Start", "(", ")", "error", "{", "if", "atomic", ".", "AddInt32", "(", "&", "r", ".", "started", ",", "1", ")", "!=", "1", "{", "return", "nil", "\n", "}", "\n\n", "// First, we'll start all the sub-servers to ens...
// Start launches any helper goroutines required for the rpcServer to function.
[ "Start", "launches", "any", "helper", "goroutines", "required", "for", "the", "rpcServer", "to", "function", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L565-L641
129,172
lightningnetwork/lnd
rpcserver.go
sendCoinsOnChain
func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64, feeRate lnwallet.SatPerKWeight) (*chainhash.Hash, error) { outputs, err := addrPairsToOutputs(paymentMap) if err != nil { return nil, err } tx, err := r.server.cc.wallet.SendOutputs(outputs, feeRate) if err != nil { return nil, err } txHas...
go
func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64, feeRate lnwallet.SatPerKWeight) (*chainhash.Hash, error) { outputs, err := addrPairsToOutputs(paymentMap) if err != nil { return nil, err } tx, err := r.server.cc.wallet.SendOutputs(outputs, feeRate) if err != nil { return nil, err } txHas...
[ "func", "(", "r", "*", "rpcServer", ")", "sendCoinsOnChain", "(", "paymentMap", "map", "[", "string", "]", "int64", ",", "feeRate", "lnwallet", ".", "SatPerKWeight", ")", "(", "*", "chainhash", ".", "Hash", ",", "error", ")", "{", "outputs", ",", "err", ...
// sendCoinsOnChain makes an on-chain transaction in or to send coins to one or // more addresses specified in the passed payment map. The payment map maps an // address to a specified output value to be sent to that address.
[ "sendCoinsOnChain", "makes", "an", "on", "-", "chain", "transaction", "in", "or", "to", "send", "coins", "to", "one", "or", "more", "addresses", "specified", "in", "the", "passed", "payment", "map", ".", "The", "payment", "map", "maps", "an", "address", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L702-L717
129,173
lightningnetwork/lnd
rpcserver.go
EstimateFee
func (r *rpcServer) EstimateFee(ctx context.Context, in *lnrpc.EstimateFeeRequest) (*lnrpc.EstimateFeeResponse, error) { // Create the list of outputs we are spending to. outputs, err := addrPairsToOutputs(in.AddrToAmount) if err != nil { return nil, err } // Query the fee estimator for the fee rate for the g...
go
func (r *rpcServer) EstimateFee(ctx context.Context, in *lnrpc.EstimateFeeRequest) (*lnrpc.EstimateFeeResponse, error) { // Create the list of outputs we are spending to. outputs, err := addrPairsToOutputs(in.AddrToAmount) if err != nil { return nil, err } // Query the fee estimator for the fee rate for the g...
[ "func", "(", "r", "*", "rpcServer", ")", "EstimateFee", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "EstimateFeeRequest", ")", "(", "*", "lnrpc", ".", "EstimateFeeResponse", ",", "error", ")", "{", "// Create the list of outputs we are...
// EstimateFee handles a request for estimating the fee for sending a // transaction spending to multiple specified outputs in parallel.
[ "EstimateFee", "handles", "a", "request", "for", "estimating", "the", "fee", "for", "sending", "a", "transaction", "spending", "to", "multiple", "specified", "outputs", "in", "parallel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L830-L879
129,174
lightningnetwork/lnd
rpcserver.go
SendMany
func (r *rpcServer) SendMany(ctx context.Context, in *lnrpc.SendManyRequest) (*lnrpc.SendManyResponse, error) { // Based on the passed fee related parameters, we'll determine an // appropriate fee rate for this transaction. satPerKw := lnwallet.SatPerKVByte(in.SatPerByte * 1000).FeePerKWeight() feePerKw, err := s...
go
func (r *rpcServer) SendMany(ctx context.Context, in *lnrpc.SendManyRequest) (*lnrpc.SendManyResponse, error) { // Based on the passed fee related parameters, we'll determine an // appropriate fee rate for this transaction. satPerKw := lnwallet.SatPerKVByte(in.SatPerByte * 1000).FeePerKWeight() feePerKw, err := s...
[ "func", "(", "r", "*", "rpcServer", ")", "SendMany", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "SendManyRequest", ")", "(", "*", "lnrpc", ".", "SendManyResponse", ",", "error", ")", "{", "// Based on the passed fee related parameters...
// SendMany handles a request for a transaction create multiple specified // outputs in parallel.
[ "SendMany", "handles", "a", "request", "for", "a", "transaction", "create", "multiple", "specified", "outputs", "in", "parallel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1005-L1049
129,175
lightningnetwork/lnd
rpcserver.go
NewAddress
func (r *rpcServer) NewAddress(ctx context.Context, in *lnrpc.NewAddressRequest) (*lnrpc.NewAddressResponse, error) { // Translate the gRPC proto address type to the wallet controller's // available address types. var ( addr btcutil.Address err error ) switch in.Type { case lnrpc.AddressType_WITNESS_PUBKEY...
go
func (r *rpcServer) NewAddress(ctx context.Context, in *lnrpc.NewAddressRequest) (*lnrpc.NewAddressResponse, error) { // Translate the gRPC proto address type to the wallet controller's // available address types. var ( addr btcutil.Address err error ) switch in.Type { case lnrpc.AddressType_WITNESS_PUBKEY...
[ "func", "(", "r", "*", "rpcServer", ")", "NewAddress", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "NewAddressRequest", ")", "(", "*", "lnrpc", ".", "NewAddressResponse", ",", "error", ")", "{", "// Translate the gRPC proto address typ...
// NewAddress creates a new address under control of the local wallet.
[ "NewAddress", "creates", "a", "new", "address", "under", "control", "of", "the", "local", "wallet", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1052-L1097
129,176
lightningnetwork/lnd
rpcserver.go
SignMessage
func (r *rpcServer) SignMessage(ctx context.Context, in *lnrpc.SignMessageRequest) (*lnrpc.SignMessageResponse, error) { if in.Msg == nil { return nil, fmt.Errorf("need a message to sign") } in.Msg = append(signedMsgPrefix, in.Msg...) sigBytes, err := r.server.nodeSigner.SignCompact(in.Msg) if err != nil { ...
go
func (r *rpcServer) SignMessage(ctx context.Context, in *lnrpc.SignMessageRequest) (*lnrpc.SignMessageResponse, error) { if in.Msg == nil { return nil, fmt.Errorf("need a message to sign") } in.Msg = append(signedMsgPrefix, in.Msg...) sigBytes, err := r.server.nodeSigner.SignCompact(in.Msg) if err != nil { ...
[ "func", "(", "r", "*", "rpcServer", ")", "SignMessage", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "SignMessageRequest", ")", "(", "*", "lnrpc", ".", "SignMessageResponse", ",", "error", ")", "{", "if", "in", ".", "Msg", "==",...
// SignMessage signs a message with the resident node's private key. The // returned signature string is zbase32 encoded and pubkey recoverable, meaning // that only the message digest and signature are needed for verification.
[ "SignMessage", "signs", "a", "message", "with", "the", "resident", "node", "s", "private", "key", ".", "The", "returned", "signature", "string", "is", "zbase32", "encoded", "and", "pubkey", "recoverable", "meaning", "that", "only", "the", "message", "digest", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1111-L1126
129,177
lightningnetwork/lnd
rpcserver.go
VerifyMessage
func (r *rpcServer) VerifyMessage(ctx context.Context, in *lnrpc.VerifyMessageRequest) (*lnrpc.VerifyMessageResponse, error) { if in.Msg == nil { return nil, fmt.Errorf("need a message to verify") } // The signature should be zbase32 encoded sig, err := zbase32.DecodeString(in.Signature) if err != nil { ret...
go
func (r *rpcServer) VerifyMessage(ctx context.Context, in *lnrpc.VerifyMessageRequest) (*lnrpc.VerifyMessageResponse, error) { if in.Msg == nil { return nil, fmt.Errorf("need a message to verify") } // The signature should be zbase32 encoded sig, err := zbase32.DecodeString(in.Signature) if err != nil { ret...
[ "func", "(", "r", "*", "rpcServer", ")", "VerifyMessage", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "VerifyMessageRequest", ")", "(", "*", "lnrpc", ".", "VerifyMessageResponse", ",", "error", ")", "{", "if", "in", ".", "Msg", ...
// VerifyMessage verifies a signature over a msg. The signature must be zbase32 // encoded and signed by an active node in the resident node's channel // database. In addition to returning the validity of the signature, // VerifyMessage also returns the recovered pubkey from the signature.
[ "VerifyMessage", "verifies", "a", "signature", "over", "a", "msg", ".", "The", "signature", "must", "be", "zbase32", "encoded", "and", "signed", "by", "an", "active", "node", "in", "the", "resident", "node", "s", "channel", "database", ".", "In", "addition",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1132-L1173
129,178
lightningnetwork/lnd
rpcserver.go
ConnectPeer
func (r *rpcServer) ConnectPeer(ctx context.Context, in *lnrpc.ConnectPeerRequest) (*lnrpc.ConnectPeerResponse, error) { // The server hasn't yet started, so it won't be able to service any of // our requests, so we'll bail early here. if !r.server.Started() { return nil, fmt.Errorf("chain backend is still synci...
go
func (r *rpcServer) ConnectPeer(ctx context.Context, in *lnrpc.ConnectPeerRequest) (*lnrpc.ConnectPeerResponse, error) { // The server hasn't yet started, so it won't be able to service any of // our requests, so we'll bail early here. if !r.server.Started() { return nil, fmt.Errorf("chain backend is still synci...
[ "func", "(", "r", "*", "rpcServer", ")", "ConnectPeer", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "ConnectPeerRequest", ")", "(", "*", "lnrpc", ".", "ConnectPeerResponse", ",", "error", ")", "{", "// The server hasn't yet started, so...
// ConnectPeer attempts to establish a connection to a remote peer.
[ "ConnectPeer", "attempts", "to", "establish", "a", "connection", "to", "a", "remote", "peer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1176-L1225
129,179
lightningnetwork/lnd
rpcserver.go
DisconnectPeer
func (r *rpcServer) DisconnectPeer(ctx context.Context, in *lnrpc.DisconnectPeerRequest) (*lnrpc.DisconnectPeerResponse, error) { rpcsLog.Debugf("[disconnectpeer] from peer(%s)", in.PubKey) if !r.server.Started() { return nil, fmt.Errorf("chain backend is still syncing, server " + "not active yet") } // Fi...
go
func (r *rpcServer) DisconnectPeer(ctx context.Context, in *lnrpc.DisconnectPeerRequest) (*lnrpc.DisconnectPeerResponse, error) { rpcsLog.Debugf("[disconnectpeer] from peer(%s)", in.PubKey) if !r.server.Started() { return nil, fmt.Errorf("chain backend is still syncing, server " + "not active yet") } // Fi...
[ "func", "(", "r", "*", "rpcServer", ")", "DisconnectPeer", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "DisconnectPeerRequest", ")", "(", "*", "lnrpc", ".", "DisconnectPeerResponse", ",", "error", ")", "{", "rpcsLog", ".", "Debugf"...
// DisconnectPeer attempts to disconnect one peer from another identified by a // given pubKey. In the case that we currently have a pending or active channel // with the target peer, this action will be disallowed.
[ "DisconnectPeer", "attempts", "to", "disconnect", "one", "peer", "from", "another", "identified", "by", "a", "given", "pubKey", ".", "In", "the", "case", "that", "we", "currently", "have", "a", "pending", "or", "active", "channel", "with", "the", "target", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1230-L1275
129,180
lightningnetwork/lnd
rpcserver.go
extractOpenChannelMinConfs
func extractOpenChannelMinConfs(in *lnrpc.OpenChannelRequest) (int32, error) { switch { // Ensure that the MinConfs parameter is non-negative. case in.MinConfs < 0: return 0, errors.New("minimum number of confirmations must " + "be a non-negative number") // The funding transaction should not be funded with u...
go
func extractOpenChannelMinConfs(in *lnrpc.OpenChannelRequest) (int32, error) { switch { // Ensure that the MinConfs parameter is non-negative. case in.MinConfs < 0: return 0, errors.New("minimum number of confirmations must " + "be a non-negative number") // The funding transaction should not be funded with u...
[ "func", "extractOpenChannelMinConfs", "(", "in", "*", "lnrpc", ".", "OpenChannelRequest", ")", "(", "int32", ",", "error", ")", "{", "switch", "{", "// Ensure that the MinConfs parameter is non-negative.", "case", "in", ".", "MinConfs", "<", "0", ":", "return", "0...
// extractOpenChannelMinConfs extracts the minimum number of confirmations from // the OpenChannelRequest that each output used to fund the channel's funding // transaction should satisfy.
[ "extractOpenChannelMinConfs", "extracts", "the", "minimum", "number", "of", "confirmations", "from", "the", "OpenChannelRequest", "that", "each", "output", "used", "to", "fund", "the", "channel", "s", "funding", "transaction", "should", "satisfy", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1280-L1311
129,181
lightningnetwork/lnd
rpcserver.go
getChanPointFundingTxid
func getChanPointFundingTxid(chanPoint *lnrpc.ChannelPoint) (*chainhash.Hash, error) { var txid []byte // A channel point's funding txid can be get/set as a byte slice or a // string. In the case it is a string, decode it. switch chanPoint.GetFundingTxid().(type) { case *lnrpc.ChannelPoint_FundingTxidBytes: txi...
go
func getChanPointFundingTxid(chanPoint *lnrpc.ChannelPoint) (*chainhash.Hash, error) { var txid []byte // A channel point's funding txid can be get/set as a byte slice or a // string. In the case it is a string, decode it. switch chanPoint.GetFundingTxid().(type) { case *lnrpc.ChannelPoint_FundingTxidBytes: txi...
[ "func", "getChanPointFundingTxid", "(", "chanPoint", "*", "lnrpc", ".", "ChannelPoint", ")", "(", "*", "chainhash", ".", "Hash", ",", "error", ")", "{", "var", "txid", "[", "]", "byte", "\n\n", "// A channel point's funding txid can be get/set as a byte slice or a", ...
// getChanPointFundingTxid returns the given channel point's funding txid in // raw bytes.
[ "getChanPointFundingTxid", "returns", "the", "given", "channel", "point", "s", "funding", "txid", "in", "raw", "bytes", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1600-L1619
129,182
lightningnetwork/lnd
rpcserver.go
AbandonChannel
func (r *rpcServer) AbandonChannel(ctx context.Context, in *lnrpc.AbandonChannelRequest) (*lnrpc.AbandonChannelResponse, error) { // If this isn't the dev build, then we won't allow the RPC to be // executed, as it's an advanced feature and won't be activated in // regular production/release builds. if !build.IsD...
go
func (r *rpcServer) AbandonChannel(ctx context.Context, in *lnrpc.AbandonChannelRequest) (*lnrpc.AbandonChannelResponse, error) { // If this isn't the dev build, then we won't allow the RPC to be // executed, as it's an advanced feature and won't be activated in // regular production/release builds. if !build.IsD...
[ "func", "(", "r", "*", "rpcServer", ")", "AbandonChannel", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "AbandonChannelRequest", ")", "(", "*", "lnrpc", ".", "AbandonChannelResponse", ",", "error", ")", "{", "// If this isn't the dev bu...
// AbandonChannel removes all channel state from the database except for a // close summary. This method can be used to get rid of permanently unusable // channels due to bugs fixed in newer versions of lnd.
[ "AbandonChannel", "removes", "all", "channel", "state", "from", "the", "database", "except", "for", "a", "close", "summary", ".", "This", "method", "can", "be", "used", "to", "get", "rid", "of", "permanently", "unusable", "channels", "due", "to", "bugs", "fi...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1830-L1888
129,183
lightningnetwork/lnd
rpcserver.go
fetchActiveChannel
func (r *rpcServer) fetchActiveChannel(chanPoint wire.OutPoint) ( *lnwallet.LightningChannel, error) { dbChan, err := r.server.chanDB.FetchChannel(chanPoint) if err != nil { return nil, err } // If the channel is successfully fetched from the database, // we create a fully populated channel state machine whic...
go
func (r *rpcServer) fetchActiveChannel(chanPoint wire.OutPoint) ( *lnwallet.LightningChannel, error) { dbChan, err := r.server.chanDB.FetchChannel(chanPoint) if err != nil { return nil, err } // If the channel is successfully fetched from the database, // we create a fully populated channel state machine whic...
[ "func", "(", "r", "*", "rpcServer", ")", "fetchActiveChannel", "(", "chanPoint", "wire", ".", "OutPoint", ")", "(", "*", "lnwallet", ".", "LightningChannel", ",", "error", ")", "{", "dbChan", ",", "err", ":=", "r", ".", "server", ".", "chanDB", ".", "F...
// fetchActiveChannel attempts to locate a channel identified by its channel // point from the database's set of all currently opened channels and // return it as a fully populated state machine
[ "fetchActiveChannel", "attempts", "to", "locate", "a", "channel", "identified", "by", "its", "channel", "point", "from", "the", "database", "s", "set", "of", "all", "currently", "opened", "channels", "and", "return", "it", "as", "a", "fully", "populated", "sta...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1893-L1907
129,184
lightningnetwork/lnd
rpcserver.go
GetInfo
func (r *rpcServer) GetInfo(ctx context.Context, in *lnrpc.GetInfoRequest) (*lnrpc.GetInfoResponse, error) { serverPeers := r.server.Peers() openChannels, err := r.server.chanDB.FetchAllOpenChannels() if err != nil { return nil, err } var activeChannels uint32 for _, channel := range openChannels { chanID...
go
func (r *rpcServer) GetInfo(ctx context.Context, in *lnrpc.GetInfoRequest) (*lnrpc.GetInfoResponse, error) { serverPeers := r.server.Peers() openChannels, err := r.server.chanDB.FetchAllOpenChannels() if err != nil { return nil, err } var activeChannels uint32 for _, channel := range openChannels { chanID...
[ "func", "(", "r", "*", "rpcServer", ")", "GetInfo", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "GetInfoRequest", ")", "(", "*", "lnrpc", ".", "GetInfoResponse", ",", "error", ")", "{", "serverPeers", ":=", "r", ".", "server", ...
// GetInfo returns general information concerning the lightning node including // its identity pubkey, alias, the chains it is connected to, and information // concerning the number of open+pending channels.
[ "GetInfo", "returns", "general", "information", "concerning", "the", "lightning", "node", "including", "its", "identity", "pubkey", "alias", "the", "chains", "it", "is", "connected", "to", "and", "information", "concerning", "the", "number", "of", "open", "+", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1912-L1993
129,185
lightningnetwork/lnd
rpcserver.go
ListPeers
func (r *rpcServer) ListPeers(ctx context.Context, in *lnrpc.ListPeersRequest) (*lnrpc.ListPeersResponse, error) { rpcsLog.Tracef("[listpeers] request") serverPeers := r.server.Peers() resp := &lnrpc.ListPeersResponse{ Peers: make([]*lnrpc.Peer, 0, len(serverPeers)), } for _, serverPeer := range serverPeers ...
go
func (r *rpcServer) ListPeers(ctx context.Context, in *lnrpc.ListPeersRequest) (*lnrpc.ListPeersResponse, error) { rpcsLog.Tracef("[listpeers] request") serverPeers := r.server.Peers() resp := &lnrpc.ListPeersResponse{ Peers: make([]*lnrpc.Peer, 0, len(serverPeers)), } for _, serverPeer := range serverPeers ...
[ "func", "(", "r", "*", "rpcServer", ")", "ListPeers", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "ListPeersRequest", ")", "(", "*", "lnrpc", ".", "ListPeersResponse", ",", "error", ")", "{", "rpcsLog", ".", "Tracef", "(", "\""...
// ListPeers returns a verbose listing of all currently active peers.
[ "ListPeers", "returns", "a", "verbose", "listing", "of", "all", "currently", "active", "peers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L1996-L2069
129,186
lightningnetwork/lnd
rpcserver.go
ChannelBalance
func (r *rpcServer) ChannelBalance(ctx context.Context, in *lnrpc.ChannelBalanceRequest) (*lnrpc.ChannelBalanceResponse, error) { openChannels, err := r.server.chanDB.FetchAllOpenChannels() if err != nil { return nil, err } var balance btcutil.Amount for _, channel := range openChannels { balance += channel...
go
func (r *rpcServer) ChannelBalance(ctx context.Context, in *lnrpc.ChannelBalanceRequest) (*lnrpc.ChannelBalanceResponse, error) { openChannels, err := r.server.chanDB.FetchAllOpenChannels() if err != nil { return nil, err } var balance btcutil.Amount for _, channel := range openChannels { balance += channel...
[ "func", "(", "r", "*", "rpcServer", ")", "ChannelBalance", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "ChannelBalanceRequest", ")", "(", "*", "lnrpc", ".", "ChannelBalanceResponse", ",", "error", ")", "{", "openChannels", ",", "er...
// ChannelBalance returns the total available channel flow across all open // channels in satoshis.
[ "ChannelBalance", "returns", "the", "total", "available", "channel", "flow", "across", "all", "open", "channels", "in", "satoshis", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2105-L2132
129,187
lightningnetwork/lnd
rpcserver.go
arbitratorPopulateForceCloseResp
func (r *rpcServer) arbitratorPopulateForceCloseResp(chanPoint *wire.OutPoint, currentHeight int32, forceClose *lnrpc.PendingChannelsResponse_ForceClosedChannel) error { // Query for contract resolvers state. arbitrator, err := r.server.chainArb.GetChannelArbitrator(*chanPoint) if err != nil { return err } re...
go
func (r *rpcServer) arbitratorPopulateForceCloseResp(chanPoint *wire.OutPoint, currentHeight int32, forceClose *lnrpc.PendingChannelsResponse_ForceClosedChannel) error { // Query for contract resolvers state. arbitrator, err := r.server.chainArb.GetChannelArbitrator(*chanPoint) if err != nil { return err } re...
[ "func", "(", "r", "*", "rpcServer", ")", "arbitratorPopulateForceCloseResp", "(", "chanPoint", "*", "wire", ".", "OutPoint", ",", "currentHeight", "int32", ",", "forceClose", "*", "lnrpc", ".", "PendingChannelsResponse_ForceClosedChannel", ")", "error", "{", "// Que...
// arbitratorPopulateForceCloseResp populates the pending channels response // message with channel resolution information from the contract resolvers.
[ "arbitratorPopulateForceCloseResp", "populates", "the", "pending", "channels", "response", "message", "with", "channel", "resolution", "information", "from", "the", "contract", "resolvers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2305-L2337
129,188
lightningnetwork/lnd
rpcserver.go
nurseryPopulateForceCloseResp
func (r *rpcServer) nurseryPopulateForceCloseResp(chanPoint *wire.OutPoint, currentHeight int32, forceClose *lnrpc.PendingChannelsResponse_ForceClosedChannel) error { // Query for the maturity state for this force closed channel. If we // didn't have any time-locked outputs, then the nursery may not know of // th...
go
func (r *rpcServer) nurseryPopulateForceCloseResp(chanPoint *wire.OutPoint, currentHeight int32, forceClose *lnrpc.PendingChannelsResponse_ForceClosedChannel) error { // Query for the maturity state for this force closed channel. If we // didn't have any time-locked outputs, then the nursery may not know of // th...
[ "func", "(", "r", "*", "rpcServer", ")", "nurseryPopulateForceCloseResp", "(", "chanPoint", "*", "wire", ".", "OutPoint", ",", "currentHeight", "int32", ",", "forceClose", "*", "lnrpc", ".", "PendingChannelsResponse_ForceClosedChannel", ")", "error", "{", "// Query ...
// nurseryPopulateForceCloseResp populates the pending channels response // message with contract resolution information from utxonursery.
[ "nurseryPopulateForceCloseResp", "populates", "the", "pending", "channels", "response", "message", "with", "contract", "resolution", "information", "from", "utxonursery", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2341-L2396
129,189
lightningnetwork/lnd
rpcserver.go
ClosedChannels
func (r *rpcServer) ClosedChannels(ctx context.Context, in *lnrpc.ClosedChannelsRequest) (*lnrpc.ClosedChannelsResponse, error) { // Show all channels when no filter flags are set. filterResults := in.Cooperative || in.LocalForce || in.RemoteForce || in.Breach || in.FundingCanceled || in.Abandoned resp := &l...
go
func (r *rpcServer) ClosedChannels(ctx context.Context, in *lnrpc.ClosedChannelsRequest) (*lnrpc.ClosedChannelsResponse, error) { // Show all channels when no filter flags are set. filterResults := in.Cooperative || in.LocalForce || in.RemoteForce || in.Breach || in.FundingCanceled || in.Abandoned resp := &l...
[ "func", "(", "r", "*", "rpcServer", ")", "ClosedChannels", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "ClosedChannelsRequest", ")", "(", "*", "lnrpc", ".", "ClosedChannelsResponse", ",", "error", ")", "{", "// Show all channels when n...
// ClosedChannels returns a list of all the channels have been closed. // This does not include channels that are still in the process of closing.
[ "ClosedChannels", "returns", "a", "list", "of", "all", "the", "channels", "have", "been", "closed", ".", "This", "does", "not", "include", "channels", "that", "are", "still", "in", "the", "process", "of", "closing", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2400-L2460
129,190
lightningnetwork/lnd
rpcserver.go
ListChannels
func (r *rpcServer) ListChannels(ctx context.Context, in *lnrpc.ListChannelsRequest) (*lnrpc.ListChannelsResponse, error) { if in.ActiveOnly && in.InactiveOnly { return nil, fmt.Errorf("either `active_only` or " + "`inactive_only` can be set, but not both") } if in.PublicOnly && in.PrivateOnly { return nil...
go
func (r *rpcServer) ListChannels(ctx context.Context, in *lnrpc.ListChannelsRequest) (*lnrpc.ListChannelsResponse, error) { if in.ActiveOnly && in.InactiveOnly { return nil, fmt.Errorf("either `active_only` or " + "`inactive_only` can be set, but not both") } if in.PublicOnly && in.PrivateOnly { return nil...
[ "func", "(", "r", "*", "rpcServer", ")", "ListChannels", "(", "ctx", "context", ".", "Context", ",", "in", "*", "lnrpc", ".", "ListChannelsRequest", ")", "(", "*", "lnrpc", ".", "ListChannelsResponse", ",", "error", ")", "{", "if", "in", ".", "ActiveOnly...
// ListChannels returns a description of all the open channels that this node // is a participant in.
[ "ListChannels", "returns", "a", "description", "of", "all", "the", "open", "channels", "that", "this", "node", "is", "a", "participant", "in", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2464-L2529
129,191
lightningnetwork/lnd
rpcserver.go
savePayment
func (r *rpcServer) savePayment(route *route.Route, amount lnwire.MilliSatoshi, preImage []byte) error { paymentPath := make([][33]byte, len(route.Hops)) for i, hop := range route.Hops { hopPub := hop.PubKeyBytes copy(paymentPath[i][:], hopPub[:]) } payment := &channeldb.OutgoingPayment{ Invoice: channeldb...
go
func (r *rpcServer) savePayment(route *route.Route, amount lnwire.MilliSatoshi, preImage []byte) error { paymentPath := make([][33]byte, len(route.Hops)) for i, hop := range route.Hops { hopPub := hop.PubKeyBytes copy(paymentPath[i][:], hopPub[:]) } payment := &channeldb.OutgoingPayment{ Invoice: channeldb...
[ "func", "(", "r", "*", "rpcServer", ")", "savePayment", "(", "route", "*", "route", ".", "Route", ",", "amount", "lnwire", ".", "MilliSatoshi", ",", "preImage", "[", "]", "byte", ")", "error", "{", "paymentPath", ":=", "make", "(", "[", "]", "[", "33...
// savePayment saves a successfully completed payment to the database for // historical record keeping.
[ "savePayment", "saves", "a", "successfully", "completed", "payment", "to", "the", "database", "for", "historical", "record", "keeping", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2724-L2747
129,192
lightningnetwork/lnd
rpcserver.go
validatePayReqExpiry
func validatePayReqExpiry(payReq *zpay32.Invoice) error { expiry := payReq.Expiry() validUntil := payReq.Timestamp.Add(expiry) if time.Now().After(validUntil) { return fmt.Errorf("invoice expired. Valid until %v", validUntil) } return nil }
go
func validatePayReqExpiry(payReq *zpay32.Invoice) error { expiry := payReq.Expiry() validUntil := payReq.Timestamp.Add(expiry) if time.Now().After(validUntil) { return fmt.Errorf("invoice expired. Valid until %v", validUntil) } return nil }
[ "func", "validatePayReqExpiry", "(", "payReq", "*", "zpay32", ".", "Invoice", ")", "error", "{", "expiry", ":=", "payReq", ".", "Expiry", "(", ")", "\n", "validUntil", ":=", "payReq", ".", "Timestamp", ".", "Add", "(", "expiry", ")", "\n", "if", "time", ...
// validatePayReqExpiry checks if the passed payment request has expired. In // the case it has expired, an error will be returned.
[ "validatePayReqExpiry", "checks", "if", "the", "passed", "payment", "request", "has", "expired", ".", "In", "the", "case", "it", "has", "expired", "an", "error", "will", "be", "returned", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2751-L2759
129,193
lightningnetwork/lnd
rpcserver.go
SendPayment
func (r *rpcServer) SendPayment(stream lnrpc.Lightning_SendPaymentServer) error { var lock sync.Mutex return r.sendPayment(&paymentStream{ recv: func() (*rpcPaymentRequest, error) { req, err := stream.Recv() if err != nil { return nil, err } return &rpcPaymentRequest{ SendRequest: req, }, n...
go
func (r *rpcServer) SendPayment(stream lnrpc.Lightning_SendPaymentServer) error { var lock sync.Mutex return r.sendPayment(&paymentStream{ recv: func() (*rpcPaymentRequest, error) { req, err := stream.Recv() if err != nil { return nil, err } return &rpcPaymentRequest{ SendRequest: req, }, n...
[ "func", "(", "r", "*", "rpcServer", ")", "SendPayment", "(", "stream", "lnrpc", ".", "Lightning_SendPaymentServer", ")", "error", "{", "var", "lock", "sync", ".", "Mutex", "\n\n", "return", "r", ".", "sendPayment", "(", "&", "paymentStream", "{", "recv", "...
// SendPayment dispatches a bi-directional streaming RPC for sending payments // through the Lightning Network. A single RPC invocation creates a persistent // bi-directional stream allowing clients to rapidly send payments through the // Lightning Network with a single persistent connection.
[ "SendPayment", "dispatches", "a", "bi", "-", "directional", "streaming", "RPC", "for", "sending", "payments", "through", "the", "Lightning", "Network", ".", "A", "single", "RPC", "invocation", "creates", "a", "persistent", "bi", "-", "directional", "stream", "al...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2802-L2823
129,194
lightningnetwork/lnd
rpcserver.go
SendToRoute
func (r *rpcServer) SendToRoute(stream lnrpc.Lightning_SendToRouteServer) error { var lock sync.Mutex return r.sendPayment(&paymentStream{ recv: func() (*rpcPaymentRequest, error) { req, err := stream.Recv() if err != nil { return nil, err } graph := r.server.chanDB.ChannelGraph() return unmar...
go
func (r *rpcServer) SendToRoute(stream lnrpc.Lightning_SendToRouteServer) error { var lock sync.Mutex return r.sendPayment(&paymentStream{ recv: func() (*rpcPaymentRequest, error) { req, err := stream.Recv() if err != nil { return nil, err } graph := r.server.chanDB.ChannelGraph() return unmar...
[ "func", "(", "r", "*", "rpcServer", ")", "SendToRoute", "(", "stream", "lnrpc", ".", "Lightning_SendToRouteServer", ")", "error", "{", "var", "lock", "sync", ".", "Mutex", "\n\n", "return", "r", ".", "sendPayment", "(", "&", "paymentStream", "{", "recv", "...
// SendToRoute dispatches a bi-directional streaming RPC for sending payments // through the Lightning Network via predefined routes passed in. A single RPC // invocation creates a persistent bi-directional stream allowing clients to // rapidly send payments through the Lightning Network with a single persistent // con...
[ "SendToRoute", "dispatches", "a", "bi", "-", "directional", "streaming", "RPC", "for", "sending", "payments", "through", "the", "Lightning", "Network", "via", "predefined", "routes", "passed", "in", ".", "A", "single", "RPC", "invocation", "creates", "a", "persi...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2830-L2851
129,195
lightningnetwork/lnd
rpcserver.go
unmarshallSendToRouteRequest
func unmarshallSendToRouteRequest(req *lnrpc.SendToRouteRequest, graph *channeldb.ChannelGraph) (*rpcPaymentRequest, error) { switch { case len(req.Routes) == 0 && req.Route == nil: return nil, fmt.Errorf("unable to send, no routes provided") case len(req.Routes) > 0 && req.Route != nil: return nil, fmt.Errorf...
go
func unmarshallSendToRouteRequest(req *lnrpc.SendToRouteRequest, graph *channeldb.ChannelGraph) (*rpcPaymentRequest, error) { switch { case len(req.Routes) == 0 && req.Route == nil: return nil, fmt.Errorf("unable to send, no routes provided") case len(req.Routes) > 0 && req.Route != nil: return nil, fmt.Errorf...
[ "func", "unmarshallSendToRouteRequest", "(", "req", "*", "lnrpc", ".", "SendToRouteRequest", ",", "graph", "*", "channeldb", ".", "ChannelGraph", ")", "(", "*", "rpcPaymentRequest", ",", "error", ")", "{", "switch", "{", "case", "len", "(", "req", ".", "Rout...
// unmarshallSendToRouteRequest unmarshalls an rpc sendtoroute request
[ "unmarshallSendToRouteRequest", "unmarshalls", "an", "rpc", "sendtoroute", "request" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L2854-L2889
129,196
lightningnetwork/lnd
rpcserver.go
dispatchPaymentIntent
func (r *rpcServer) dispatchPaymentIntent( payIntent *rpcPaymentIntent) (*paymentIntentResponse, error) { // Construct a payment request to send to the channel router. If the // payment is successful, the route chosen will be returned. Otherwise, // we'll get a non-nil error. var ( preImage [32]byte route ...
go
func (r *rpcServer) dispatchPaymentIntent( payIntent *rpcPaymentIntent) (*paymentIntentResponse, error) { // Construct a payment request to send to the channel router. If the // payment is successful, the route chosen will be returned. Otherwise, // we'll get a non-nil error. var ( preImage [32]byte route ...
[ "func", "(", "r", "*", "rpcServer", ")", "dispatchPaymentIntent", "(", "payIntent", "*", "rpcPaymentIntent", ")", "(", "*", "paymentIntentResponse", ",", "error", ")", "{", "// Construct a payment request to send to the channel router. If the", "// payment is successful, the ...
// dispatchPaymentIntent attempts to fully dispatch an RPC payment intent. // We'll either pass the payment as a whole to the channel router, or give it a // pre-built route. The first error this method returns denotes if we were // unable to save the payment. The second error returned denotes if the payment // didn't ...
[ "dispatchPaymentIntent", "attempts", "to", "fully", "dispatch", "an", "RPC", "payment", "intent", ".", "We", "ll", "either", "pass", "the", "payment", "as", "a", "whole", "to", "the", "channel", "router", "or", "give", "it", "a", "pre", "-", "built", "rout...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3078-L3152
129,197
lightningnetwork/lnd
rpcserver.go
sendPaymentSync
func (r *rpcServer) sendPaymentSync(ctx context.Context, nextPayment *rpcPaymentRequest) (*lnrpc.SendResponse, error) { // We don't allow payments to be sent while the daemon itself is still // syncing as we may be trying to sent a payment over a "stale" // channel. if !r.server.Started() { return nil, fmt.Erro...
go
func (r *rpcServer) sendPaymentSync(ctx context.Context, nextPayment *rpcPaymentRequest) (*lnrpc.SendResponse, error) { // We don't allow payments to be sent while the daemon itself is still // syncing as we may be trying to sent a payment over a "stale" // channel. if !r.server.Started() { return nil, fmt.Erro...
[ "func", "(", "r", "*", "rpcServer", ")", "sendPaymentSync", "(", "ctx", "context", ".", "Context", ",", "nextPayment", "*", "rpcPaymentRequest", ")", "(", "*", "lnrpc", ".", "SendResponse", ",", "error", ")", "{", "// We don't allow payments to be sent while the d...
// sendPaymentSync is the synchronous variant of sendPayment. It will block and // wait until the payment has been fully completed.
[ "sendPaymentSync", "is", "the", "synchronous", "variant", "of", "sendPayment", ".", "It", "will", "block", "and", "wait", "until", "the", "payment", "has", "been", "fully", "completed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3347-L3384
129,198
lightningnetwork/lnd
rpcserver.go
ListInvoices
func (r *rpcServer) ListInvoices(ctx context.Context, req *lnrpc.ListInvoiceRequest) (*lnrpc.ListInvoiceResponse, error) { // If the number of invoices was not specified, then we'll default to // returning the latest 100 invoices. if req.NumMaxInvoices == 0 { req.NumMaxInvoices = 100 } // Next, we'll map the ...
go
func (r *rpcServer) ListInvoices(ctx context.Context, req *lnrpc.ListInvoiceRequest) (*lnrpc.ListInvoiceResponse, error) { // If the number of invoices was not specified, then we'll default to // returning the latest 100 invoices. if req.NumMaxInvoices == 0 { req.NumMaxInvoices = 100 } // Next, we'll map the ...
[ "func", "(", "r", "*", "rpcServer", ")", "ListInvoices", "(", "ctx", "context", ".", "Context", ",", "req", "*", "lnrpc", ".", "ListInvoiceRequest", ")", "(", "*", "lnrpc", ".", "ListInvoiceResponse", ",", "error", ")", "{", "// If the number of invoices was n...
// ListInvoices returns a list of all the invoices currently stored within the // database. Any active debug invoices are ignored.
[ "ListInvoices", "returns", "a", "list", "of", "all", "the", "invoices", "currently", "stored", "within", "the", "database", ".", "Any", "active", "debug", "invoices", "are", "ignored", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3494-L3533
129,199
lightningnetwork/lnd
rpcserver.go
GetTransactions
func (r *rpcServer) GetTransactions(ctx context.Context, _ *lnrpc.GetTransactionsRequest) (*lnrpc.TransactionDetails, error) { // TODO(roasbeef): add pagination support transactions, err := r.server.cc.wallet.ListTransactionDetails() if err != nil { return nil, err } txDetails := &lnrpc.TransactionDetails{ ...
go
func (r *rpcServer) GetTransactions(ctx context.Context, _ *lnrpc.GetTransactionsRequest) (*lnrpc.TransactionDetails, error) { // TODO(roasbeef): add pagination support transactions, err := r.server.cc.wallet.ListTransactionDetails() if err != nil { return nil, err } txDetails := &lnrpc.TransactionDetails{ ...
[ "func", "(", "r", "*", "rpcServer", ")", "GetTransactions", "(", "ctx", "context", ".", "Context", ",", "_", "*", "lnrpc", ".", "GetTransactionsRequest", ")", "(", "*", "lnrpc", ".", "TransactionDetails", ",", "error", ")", "{", "// TODO(roasbeef): add paginat...
// GetTransactions returns a list of describing all the known transactions // relevant to the wallet.
[ "GetTransactions", "returns", "a", "list", "of", "describing", "all", "the", "known", "transactions", "relevant", "to", "the", "wallet", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3623-L3661