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
128,800
lightningnetwork/lnd
contractcourt/briefcase.go
newLogScope
func newLogScope(chain chainhash.Hash, op wire.OutPoint) (*logScope, error) { var l logScope b := bytes.NewBuffer(l[0:0]) if _, err := b.Write(chain[:]); err != nil { return nil, err } if _, err := b.Write(op.Hash[:]); err != nil { return nil, err } if err := binary.Write(b, endian, op.Index); err != nil {...
go
func newLogScope(chain chainhash.Hash, op wire.OutPoint) (*logScope, error) { var l logScope b := bytes.NewBuffer(l[0:0]) if _, err := b.Write(chain[:]); err != nil { return nil, err } if _, err := b.Write(op.Hash[:]); err != nil { return nil, err } if err := binary.Write(b, endian, op.Index); err != nil {...
[ "func", "newLogScope", "(", "chain", "chainhash", ".", "Hash", ",", "op", "wire", ".", "OutPoint", ")", "(", "*", "logScope", ",", "error", ")", "{", "var", "l", "logScope", "\n", "b", ":=", "bytes", ".", "NewBuffer", "(", "l", "[", "0", ":", "0", ...
// newLogScope creates a new logScope key from the passed chainhash and // chanPoint.
[ "newLogScope", "creates", "a", "new", "logScope", "key", "from", "the", "passed", "chainhash", "and", "chanPoint", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/briefcase.go#L228-L244
128,801
lightningnetwork/lnd
contractcourt/briefcase.go
newBoltArbitratorLog
func newBoltArbitratorLog(db *bbolt.DB, cfg ChannelArbitratorConfig, chainHash chainhash.Hash, chanPoint wire.OutPoint) (*boltArbitratorLog, error) { scope, err := newLogScope(chainHash, chanPoint) if err != nil { return nil, err } return &boltArbitratorLog{ db: db, cfg: cfg, scopeKey: *scope,...
go
func newBoltArbitratorLog(db *bbolt.DB, cfg ChannelArbitratorConfig, chainHash chainhash.Hash, chanPoint wire.OutPoint) (*boltArbitratorLog, error) { scope, err := newLogScope(chainHash, chanPoint) if err != nil { return nil, err } return &boltArbitratorLog{ db: db, cfg: cfg, scopeKey: *scope,...
[ "func", "newBoltArbitratorLog", "(", "db", "*", "bbolt", ".", "DB", ",", "cfg", "ChannelArbitratorConfig", ",", "chainHash", "chainhash", ".", "Hash", ",", "chanPoint", "wire", ".", "OutPoint", ")", "(", "*", "boltArbitratorLog", ",", "error", ")", "{", "sco...
// newBoltArbitratorLog returns a new instance of the boltArbitratorLog given // an arbitrator config, and the items needed to create its log scope.
[ "newBoltArbitratorLog", "returns", "a", "new", "instance", "of", "the", "boltArbitratorLog", "given", "an", "arbitrator", "config", "and", "the", "items", "needed", "to", "create", "its", "log", "scope", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/briefcase.go#L294-L307
128,802
lightningnetwork/lnd
contractcourt/briefcase.go
writeResolver
func (b *boltArbitratorLog) writeResolver(contractBucket *bbolt.Bucket, res ContractResolver) error { // First, we'll write to the buffer the type of this resolver. Using // this byte, we can later properly deserialize the resolver properly. var ( buf bytes.Buffer rType uint8 ) switch res.(type) { case *h...
go
func (b *boltArbitratorLog) writeResolver(contractBucket *bbolt.Bucket, res ContractResolver) error { // First, we'll write to the buffer the type of this resolver. Using // this byte, we can later properly deserialize the resolver properly. var ( buf bytes.Buffer rType uint8 ) switch res.(type) { case *h...
[ "func", "(", "b", "*", "boltArbitratorLog", ")", "writeResolver", "(", "contractBucket", "*", "bbolt", ".", "Bucket", ",", "res", "ContractResolver", ")", "error", "{", "// First, we'll write to the buffer the type of this resolver. Using", "// this byte, we can later properl...
// writeResolver is a helper method that writes a contract resolver and stores // it it within the passed contractBucket using its unique resolutionsKey key.
[ "writeResolver", "is", "a", "helper", "method", "that", "writes", "a", "contract", "resolver", "and", "stores", "it", "it", "within", "the", "passed", "contractBucket", "using", "its", "unique", "resolutionsKey", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/briefcase.go#L345-L379
128,803
lightningnetwork/lnd
contractcourt/briefcase.go
checkpointContract
func (b *boltArbitratorLog) checkpointContract(c ContractResolver) error { return b.db.Batch(func(tx *bbolt.Tx) error { contractBucket, err := fetchContractWriteBucket(tx, b.scopeKey[:]) if err != nil { return err } return b.writeResolver(contractBucket, c) }) }
go
func (b *boltArbitratorLog) checkpointContract(c ContractResolver) error { return b.db.Batch(func(tx *bbolt.Tx) error { contractBucket, err := fetchContractWriteBucket(tx, b.scopeKey[:]) if err != nil { return err } return b.writeResolver(contractBucket, c) }) }
[ "func", "(", "b", "*", "boltArbitratorLog", ")", "checkpointContract", "(", "c", "ContractResolver", ")", "error", "{", "return", "b", ".", "db", ".", "Batch", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "contractBucket", ",", "...
// checkpointContract is a private method that will be fed into // ContractResolver instances to checkpoint their state once they reach // milestones during contract resolution.
[ "checkpointContract", "is", "a", "private", "method", "that", "will", "be", "fed", "into", "ContractResolver", "instances", "to", "checkpoint", "their", "state", "once", "they", "reach", "milestones", "during", "contract", "resolution", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/briefcase.go#L873-L882
128,804
lightningnetwork/lnd
watchtower/wtclient/interface.go
AuthDial
func AuthDial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress, dialer func(string, string) (net.Conn, error)) (wtserver.Peer, error) { return brontide.Dial(localPriv, netAddr, dialer) }
go
func AuthDial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress, dialer func(string, string) (net.Conn, error)) (wtserver.Peer, error) { return brontide.Dial(localPriv, netAddr, dialer) }
[ "func", "AuthDial", "(", "localPriv", "*", "btcec", ".", "PrivateKey", ",", "netAddr", "*", "lnwire", ".", "NetAddress", ",", "dialer", "func", "(", "string", ",", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", ")", "(", "wtserver", ".", ...
// AuthDial is the watchtower client's default method of dialing.
[ "AuthDial", "is", "the", "watchtower", "client", "s", "default", "method", "of", "dialing", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/interface.go#L84-L88
128,805
lightningnetwork/lnd
routing/payment_session.go
ReportEdgePolicyFailure
func (p *paymentSession) ReportEdgePolicyFailure( errSource route.Vertex, failedEdge *EdgeLocator) { // Check to see if we've already reported a policy related failure for // this channel. If so, then we'll prune out the vertex. _, ok := p.errFailedPolicyChans[*failedEdge] if ok { // TODO(joostjager): is this a...
go
func (p *paymentSession) ReportEdgePolicyFailure( errSource route.Vertex, failedEdge *EdgeLocator) { // Check to see if we've already reported a policy related failure for // this channel. If so, then we'll prune out the vertex. _, ok := p.errFailedPolicyChans[*failedEdge] if ok { // TODO(joostjager): is this a...
[ "func", "(", "p", "*", "paymentSession", ")", "ReportEdgePolicyFailure", "(", "errSource", "route", ".", "Vertex", ",", "failedEdge", "*", "EdgeLocator", ")", "{", "// Check to see if we've already reported a policy related failure for", "// this channel. If so, then we'll prun...
// ReportChannelPolicyFailure handles a failure message that relates to a // channel policy. For these types of failures, the policy is updated and we // want to keep it included during path finding. This function does mark the // edge as 'policy failed once'. The next time it fails, the whole node will be // pruned. T...
[ "ReportChannelPolicyFailure", "handles", "a", "failure", "message", "that", "relates", "to", "a", "channel", "policy", ".", "For", "these", "types", "of", "failures", "the", "policy", "is", "updated", "and", "we", "want", "to", "keep", "it", "included", "durin...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/payment_session.go#L87-L104
128,806
lightningnetwork/lnd
queue/gc_queue.go
NewGCQueue
func NewGCQueue(newItem func() interface{}, returnQueueSize int, gcInterval, expiryInterval time.Duration) *GCQueue { q := &GCQueue{ takeBuffer: make(chan interface{}), returnBuffer: make(chan interface{}, returnQueueSize), expiryInterval: expiryInterval, freeList: list.New(), recycleTicker: t...
go
func NewGCQueue(newItem func() interface{}, returnQueueSize int, gcInterval, expiryInterval time.Duration) *GCQueue { q := &GCQueue{ takeBuffer: make(chan interface{}), returnBuffer: make(chan interface{}, returnQueueSize), expiryInterval: expiryInterval, freeList: list.New(), recycleTicker: t...
[ "func", "NewGCQueue", "(", "newItem", "func", "(", ")", "interface", "{", "}", ",", "returnQueueSize", "int", ",", "gcInterval", ",", "expiryInterval", "time", ".", "Duration", ")", "*", "GCQueue", "{", "q", ":=", "&", "GCQueue", "{", "takeBuffer", ":", ...
// NewGCQueue creates a new garbage collecting queue, which dynamically grows // and contracts based on load. If the queue has items which have been returned, // the queue will check every gcInterval amount of time to see if any elements // are eligible to be released back to the runtime. Elements that have been in // ...
[ "NewGCQueue", "creates", "a", "new", "garbage", "collecting", "queue", "which", "dynamically", "grows", "and", "contracts", "based", "on", "load", ".", "If", "the", "queue", "has", "items", "which", "have", "been", "returned", "the", "queue", "will", "check", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/queue/gc_queue.go#L63-L79
128,807
lightningnetwork/lnd
queue/gc_queue.go
Take
func (q *GCQueue) Take() interface{} { select { case item := <-q.takeBuffer: return item case <-time.After(time.Millisecond): return q.newItem() } }
go
func (q *GCQueue) Take() interface{} { select { case item := <-q.takeBuffer: return item case <-time.After(time.Millisecond): return q.newItem() } }
[ "func", "(", "q", "*", "GCQueue", ")", "Take", "(", ")", "interface", "{", "}", "{", "select", "{", "case", "item", ":=", "<-", "q", ".", "takeBuffer", ":", "return", "item", "\n", "case", "<-", "time", ".", "After", "(", "time", ".", "Millisecond"...
// Take returns either a recycled element from the queue, or creates a new item // if none are available.
[ "Take", "returns", "either", "a", "recycled", "element", "from", "the", "queue", "or", "creates", "a", "new", "item", "if", "none", "are", "available", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/queue/gc_queue.go#L83-L90
128,808
lightningnetwork/lnd
channelnotifier/channelnotifier.go
New
func New(chanDB *channeldb.DB) *ChannelNotifier { return &ChannelNotifier{ ntfnServer: subscribe.NewServer(), chanDB: chanDB, } }
go
func New(chanDB *channeldb.DB) *ChannelNotifier { return &ChannelNotifier{ ntfnServer: subscribe.NewServer(), chanDB: chanDB, } }
[ "func", "New", "(", "chanDB", "*", "channeldb", ".", "DB", ")", "*", "ChannelNotifier", "{", "return", "&", "ChannelNotifier", "{", "ntfnServer", ":", "subscribe", ".", "NewServer", "(", ")", ",", "chanDB", ":", "chanDB", ",", "}", "\n", "}" ]
// New creates a new channel notifier. The ChannelNotifier gets channel // events from peers and from the chain arbitrator, and dispatches them to // its clients.
[ "New", "creates", "a", "new", "channel", "notifier", ".", "The", "ChannelNotifier", "gets", "channel", "events", "from", "peers", "and", "from", "the", "chain", "arbitrator", "and", "dispatches", "them", "to", "its", "clients", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L51-L56
128,809
lightningnetwork/lnd
channelnotifier/channelnotifier.go
Start
func (c *ChannelNotifier) Start() error { if !atomic.CompareAndSwapUint32(&c.started, 0, 1) { return nil } log.Tracef("ChannelNotifier %v starting", c) if err := c.ntfnServer.Start(); err != nil { return err } return nil }
go
func (c *ChannelNotifier) Start() error { if !atomic.CompareAndSwapUint32(&c.started, 0, 1) { return nil } log.Tracef("ChannelNotifier %v starting", c) if err := c.ntfnServer.Start(); err != nil { return err } return nil }
[ "func", "(", "c", "*", "ChannelNotifier", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "c", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Tracef",...
// Start starts the ChannelNotifier and all goroutines it needs to carry out its task.
[ "Start", "starts", "the", "ChannelNotifier", "and", "all", "goroutines", "it", "needs", "to", "carry", "out", "its", "task", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L59-L71
128,810
lightningnetwork/lnd
channelnotifier/channelnotifier.go
Stop
func (c *ChannelNotifier) Stop() { if !atomic.CompareAndSwapUint32(&c.stopped, 0, 1) { return } c.ntfnServer.Stop() }
go
func (c *ChannelNotifier) Stop() { if !atomic.CompareAndSwapUint32(&c.stopped, 0, 1) { return } c.ntfnServer.Stop() }
[ "func", "(", "c", "*", "ChannelNotifier", ")", "Stop", "(", ")", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "c", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "\n", "}", "\n\n", "c", ".", "ntfnServer", ".", "Stop", ...
// Stop signals the notifier for a graceful shutdown.
[ "Stop", "signals", "the", "notifier", "for", "a", "graceful", "shutdown", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L74-L80
128,811
lightningnetwork/lnd
channelnotifier/channelnotifier.go
NotifyOpenChannelEvent
func (c *ChannelNotifier) NotifyOpenChannelEvent(chanPoint wire.OutPoint) { // Fetch the relevant channel from the database. channel, err := c.chanDB.FetchChannel(chanPoint) if err != nil { log.Warnf("Unable to fetch open channel from the db: %v", err) } // Send the open event to all channel event subscribers....
go
func (c *ChannelNotifier) NotifyOpenChannelEvent(chanPoint wire.OutPoint) { // Fetch the relevant channel from the database. channel, err := c.chanDB.FetchChannel(chanPoint) if err != nil { log.Warnf("Unable to fetch open channel from the db: %v", err) } // Send the open event to all channel event subscribers....
[ "func", "(", "c", "*", "ChannelNotifier", ")", "NotifyOpenChannelEvent", "(", "chanPoint", "wire", ".", "OutPoint", ")", "{", "// Fetch the relevant channel from the database.", "channel", ",", "err", ":=", "c", ".", "chanDB", ".", "FetchChannel", "(", "chanPoint", ...
// NotifyOpenChannelEvent notifies the channelEventNotifier goroutine that a // channel has gone from pending open to open.
[ "NotifyOpenChannelEvent", "notifies", "the", "channelEventNotifier", "goroutine", "that", "a", "channel", "has", "gone", "from", "pending", "open", "to", "open", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L90-L103
128,812
lightningnetwork/lnd
channelnotifier/channelnotifier.go
NotifyClosedChannelEvent
func (c *ChannelNotifier) NotifyClosedChannelEvent(chanPoint wire.OutPoint) { // Fetch the relevant closed channel from the database. closeSummary, err := c.chanDB.FetchClosedChannel(&chanPoint) if err != nil { log.Warnf("Unable to fetch closed channel summary from the db: %v", err) } // Send the closed event t...
go
func (c *ChannelNotifier) NotifyClosedChannelEvent(chanPoint wire.OutPoint) { // Fetch the relevant closed channel from the database. closeSummary, err := c.chanDB.FetchClosedChannel(&chanPoint) if err != nil { log.Warnf("Unable to fetch closed channel summary from the db: %v", err) } // Send the closed event t...
[ "func", "(", "c", "*", "ChannelNotifier", ")", "NotifyClosedChannelEvent", "(", "chanPoint", "wire", ".", "OutPoint", ")", "{", "// Fetch the relevant closed channel from the database.", "closeSummary", ",", "err", ":=", "c", ".", "chanDB", ".", "FetchClosedChannel", ...
// NotifyClosedChannelEvent notifies the channelEventNotifier goroutine that a // channel has closed.
[ "NotifyClosedChannelEvent", "notifies", "the", "channelEventNotifier", "goroutine", "that", "a", "channel", "has", "closed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L107-L119
128,813
lightningnetwork/lnd
channelnotifier/channelnotifier.go
NotifyActiveChannelEvent
func (c *ChannelNotifier) NotifyActiveChannelEvent(chanPoint wire.OutPoint) { event := ActiveChannelEvent{ChannelPoint: &chanPoint} if err := c.ntfnServer.SendUpdate(event); err != nil { log.Warnf("Unable to send active channel update: %v", err) } }
go
func (c *ChannelNotifier) NotifyActiveChannelEvent(chanPoint wire.OutPoint) { event := ActiveChannelEvent{ChannelPoint: &chanPoint} if err := c.ntfnServer.SendUpdate(event); err != nil { log.Warnf("Unable to send active channel update: %v", err) } }
[ "func", "(", "c", "*", "ChannelNotifier", ")", "NotifyActiveChannelEvent", "(", "chanPoint", "wire", ".", "OutPoint", ")", "{", "event", ":=", "ActiveChannelEvent", "{", "ChannelPoint", ":", "&", "chanPoint", "}", "\n", "if", "err", ":=", "c", ".", "ntfnServ...
// NotifyActiveChannelEvent notifies the channelEventNotifier goroutine that a // channel is active.
[ "NotifyActiveChannelEvent", "notifies", "the", "channelEventNotifier", "goroutine", "that", "a", "channel", "is", "active", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L123-L128
128,814
lightningnetwork/lnd
channelnotifier/channelnotifier.go
NotifyInactiveChannelEvent
func (c *ChannelNotifier) NotifyInactiveChannelEvent(chanPoint wire.OutPoint) { event := InactiveChannelEvent{ChannelPoint: &chanPoint} if err := c.ntfnServer.SendUpdate(event); err != nil { log.Warnf("Unable to send inactive channel update: %v", err) } }
go
func (c *ChannelNotifier) NotifyInactiveChannelEvent(chanPoint wire.OutPoint) { event := InactiveChannelEvent{ChannelPoint: &chanPoint} if err := c.ntfnServer.SendUpdate(event); err != nil { log.Warnf("Unable to send inactive channel update: %v", err) } }
[ "func", "(", "c", "*", "ChannelNotifier", ")", "NotifyInactiveChannelEvent", "(", "chanPoint", "wire", ".", "OutPoint", ")", "{", "event", ":=", "InactiveChannelEvent", "{", "ChannelPoint", ":", "&", "chanPoint", "}", "\n", "if", "err", ":=", "c", ".", "ntfn...
// NotifyInactiveChannelEvent notifies the channelEventNotifier goroutine that a // channel is inactive.
[ "NotifyInactiveChannelEvent", "notifies", "the", "channelEventNotifier", "goroutine", "that", "a", "channel", "is", "inactive", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channelnotifier/channelnotifier.go#L132-L137
128,815
lightningnetwork/lnd
sweep/walletsweep.go
CraftSweepAllTx
func CraftSweepAllTx(feeRate lnwallet.SatPerKWeight, blockHeight uint32, deliveryAddr btcutil.Address, coinSelectLocker CoinSelectionLocker, utxoSource UtxoSource, outpointLocker OutpointLocker, feeEstimator lnwallet.FeeEstimator, signer input.Signer) (*WalletSweepPackage, error) { // TODO(roasbeef): turn off ATP...
go
func CraftSweepAllTx(feeRate lnwallet.SatPerKWeight, blockHeight uint32, deliveryAddr btcutil.Address, coinSelectLocker CoinSelectionLocker, utxoSource UtxoSource, outpointLocker OutpointLocker, feeEstimator lnwallet.FeeEstimator, signer input.Signer) (*WalletSweepPackage, error) { // TODO(roasbeef): turn off ATP...
[ "func", "CraftSweepAllTx", "(", "feeRate", "lnwallet", ".", "SatPerKWeight", ",", "blockHeight", "uint32", ",", "deliveryAddr", "btcutil", ".", "Address", ",", "coinSelectLocker", "CoinSelectionLocker", ",", "utxoSource", "UtxoSource", ",", "outpointLocker", "OutpointLo...
// CraftSweepAllTx attempts to craft a WalletSweepPackage which will allow the // caller to sweep ALL outputs within the wallet to a single UTXO, as specified // by the delivery address. The sweep transaction will be crafted with the // target fee rate, and will use the utxoSource and outpointLocker as sources // for w...
[ "CraftSweepAllTx", "attempts", "to", "craft", "a", "WalletSweepPackage", "which", "will", "allow", "the", "caller", "to", "sweep", "ALL", "outputs", "within", "the", "wallet", "to", "a", "single", "UTXO", "as", "specified", "by", "the", "delivery", "address", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/sweep/walletsweep.go#L152-L289
128,816
lightningnetwork/lnd
lnwire/message.go
String
func (t MessageType) String() string { switch t { case MsgInit: return "Init" case MsgOpenChannel: return "MsgOpenChannel" case MsgAcceptChannel: return "MsgAcceptChannel" case MsgFundingCreated: return "MsgFundingCreated" case MsgFundingSigned: return "MsgFundingSigned" case MsgFundingLocked: return...
go
func (t MessageType) String() string { switch t { case MsgInit: return "Init" case MsgOpenChannel: return "MsgOpenChannel" case MsgAcceptChannel: return "MsgAcceptChannel" case MsgFundingCreated: return "MsgFundingCreated" case MsgFundingSigned: return "MsgFundingSigned" case MsgFundingLocked: return...
[ "func", "(", "t", "MessageType", ")", "String", "(", ")", "string", "{", "switch", "t", "{", "case", "MsgInit", ":", "return", "\"", "\"", "\n", "case", "MsgOpenChannel", ":", "return", "\"", "\"", "\n", "case", "MsgAcceptChannel", ":", "return", "\"", ...
// String return the string representation of message type.
[ "String", "return", "the", "string", "representation", "of", "message", "type", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/message.go#L60-L121
128,817
lightningnetwork/lnd
autopilot/manager.go
NewManager
func NewManager(cfg *ManagerCfg) (*Manager, error) { return &Manager{ cfg: cfg, quit: make(chan struct{}), }, nil }
go
func NewManager(cfg *ManagerCfg) (*Manager, error) { return &Manager{ cfg: cfg, quit: make(chan struct{}), }, nil }
[ "func", "NewManager", "(", "cfg", "*", "ManagerCfg", ")", "(", "*", "Manager", ",", "error", ")", "{", "return", "&", "Manager", "{", "cfg", ":", "cfg", ",", "quit", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", ",", "nil", "\n", ...
// NewManager creates a new instance of the Manager from the passed config.
[ "NewManager", "creates", "a", "new", "instance", "of", "the", "Manager", "from", "the", "passed", "config", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L58-L63
128,818
lightningnetwork/lnd
autopilot/manager.go
Start
func (m *Manager) Start() error { if !atomic.CompareAndSwapUint32(&m.started, 0, 1) { return nil } return nil }
go
func (m *Manager) Start() error { if !atomic.CompareAndSwapUint32(&m.started, 0, 1) { return nil } return nil }
[ "func", "(", "m", "*", "Manager", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "m", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "return", "nil", "\n", "}" ...
// Start starts the Manager.
[ "Start", "starts", "the", "Manager", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L66-L72
128,819
lightningnetwork/lnd
autopilot/manager.go
Stop
func (m *Manager) Stop() error { if !atomic.CompareAndSwapUint32(&m.stopped, 0, 1) { return nil } if err := m.StopAgent(); err != nil { log.Errorf("Unable to stop pilot: %v", err) } close(m.quit) m.wg.Wait() return nil }
go
func (m *Manager) Stop() error { if !atomic.CompareAndSwapUint32(&m.stopped, 0, 1) { return nil } if err := m.StopAgent(); err != nil { log.Errorf("Unable to stop pilot: %v", err) } close(m.quit) m.wg.Wait() return nil }
[ "func", "(", "m", "*", "Manager", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "m", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "m", "....
// Stop stops the Manager. If an autopilot agent is active, it will also be // stopped.
[ "Stop", "stops", "the", "Manager", ".", "If", "an", "autopilot", "agent", "is", "active", "it", "will", "also", "be", "stopped", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L76-L89
128,820
lightningnetwork/lnd
autopilot/manager.go
IsActive
func (m *Manager) IsActive() bool { m.Lock() defer m.Unlock() return m.pilot != nil }
go
func (m *Manager) IsActive() bool { m.Lock() defer m.Unlock() return m.pilot != nil }
[ "func", "(", "m", "*", "Manager", ")", "IsActive", "(", ")", "bool", "{", "m", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "Unlock", "(", ")", "\n\n", "return", "m", ".", "pilot", "!=", "nil", "\n", "}" ]
// IsActive returns whether the autopilot agent is currently active.
[ "IsActive", "returns", "whether", "the", "autopilot", "agent", "is", "currently", "active", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L92-L97
128,821
lightningnetwork/lnd
autopilot/manager.go
StartAgent
func (m *Manager) StartAgent() error { m.Lock() defer m.Unlock() // Already active. if m.pilot != nil { return nil } // Next, we'll fetch the current state of open channels from the // database to use as initial state for the auto-pilot agent. initialChanState, err := m.cfg.ChannelState() if err != nil { ...
go
func (m *Manager) StartAgent() error { m.Lock() defer m.Unlock() // Already active. if m.pilot != nil { return nil } // Next, we'll fetch the current state of open channels from the // database to use as initial state for the auto-pilot agent. initialChanState, err := m.cfg.ChannelState() if err != nil { ...
[ "func", "(", "m", "*", "Manager", ")", "StartAgent", "(", ")", "error", "{", "m", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "Unlock", "(", ")", "\n\n", "// Already active.", "if", "m", ".", "pilot", "!=", "nil", "{", "return", "nil", "\n", ...
// StartAgent creates and starts an autopilot agent from the Manager's // config.
[ "StartAgent", "creates", "and", "starts", "an", "autopilot", "agent", "from", "the", "Manager", "s", "config", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L101-L247
128,822
lightningnetwork/lnd
autopilot/manager.go
StopAgent
func (m *Manager) StopAgent() error { m.Lock() defer m.Unlock() // Not active, so we can return early. if m.pilot == nil { return nil } if err := m.pilot.Stop(); err != nil { return err } // Make sure to nil the current agent, indicating it is no longer // active. m.pilot = nil log.Debugf("Manager st...
go
func (m *Manager) StopAgent() error { m.Lock() defer m.Unlock() // Not active, so we can return early. if m.pilot == nil { return nil } if err := m.pilot.Stop(); err != nil { return err } // Make sure to nil the current agent, indicating it is no longer // active. m.pilot = nil log.Debugf("Manager st...
[ "func", "(", "m", "*", "Manager", ")", "StopAgent", "(", ")", "error", "{", "m", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "Unlock", "(", ")", "\n\n", "// Not active, so we can return early.", "if", "m", ".", "pilot", "==", "nil", "{", "return", ...
// StopAgent stops any active autopilot agent.
[ "StopAgent", "stops", "any", "active", "autopilot", "agent", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L250-L270
128,823
lightningnetwork/lnd
autopilot/manager.go
QueryHeuristics
func (m *Manager) QueryHeuristics(nodes []NodeID, localState bool) ( HeuristicScores, error) { m.Lock() defer m.Unlock() n := make(map[NodeID]struct{}) for _, node := range nodes { n[node] = struct{}{} } log.Debugf("Querying heuristics for %d nodes", len(n)) return m.queryHeuristics(n, localState) }
go
func (m *Manager) QueryHeuristics(nodes []NodeID, localState bool) ( HeuristicScores, error) { m.Lock() defer m.Unlock() n := make(map[NodeID]struct{}) for _, node := range nodes { n[node] = struct{}{} } log.Debugf("Querying heuristics for %d nodes", len(n)) return m.queryHeuristics(n, localState) }
[ "func", "(", "m", "*", "Manager", ")", "QueryHeuristics", "(", "nodes", "[", "]", "NodeID", ",", "localState", "bool", ")", "(", "HeuristicScores", ",", "error", ")", "{", "m", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "Unlock", "(", ")", "\n...
// QueryHeuristics queries the available autopilot heuristics for node scores.
[ "QueryHeuristics", "queries", "the", "available", "autopilot", "heuristics", "for", "node", "scores", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L273-L286
128,824
lightningnetwork/lnd
autopilot/manager.go
SetNodeScores
func (m *Manager) SetNodeScores(name string, scores map[NodeID]float64) error { // It must be ScoreSettable to be available for external // scores. s, ok := m.cfg.PilotCfg.Heuristic.(ScoreSettable) if !ok { return fmt.Errorf("current heuristic doesn't support " + "external scoring") } // Heuristic was found...
go
func (m *Manager) SetNodeScores(name string, scores map[NodeID]float64) error { // It must be ScoreSettable to be available for external // scores. s, ok := m.cfg.PilotCfg.Heuristic.(ScoreSettable) if !ok { return fmt.Errorf("current heuristic doesn't support " + "external scoring") } // Heuristic was found...
[ "func", "(", "m", "*", "Manager", ")", "SetNodeScores", "(", "name", "string", ",", "scores", "map", "[", "NodeID", "]", "float64", ")", "error", "{", "// It must be ScoreSettable to be available for external", "// scores.", "s", ",", "ok", ":=", "m", ".", "cf...
// SetNodeScores is used to set the scores of the given heuristic, if it is // active, and ScoreSettable.
[ "SetNodeScores", "is", "used", "to", "set", "the", "scores", "of", "the", "given", "heuristic", "if", "it", "is", "active", "and", "ScoreSettable", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/autopilot/manager.go#L363-L383
128,825
lightningnetwork/lnd
channeldb/meta.go
FetchMeta
func (d *DB) FetchMeta(tx *bbolt.Tx) (*Meta, error) { meta := &Meta{} err := d.View(func(tx *bbolt.Tx) error { return fetchMeta(meta, tx) }) if err != nil { return nil, err } return meta, nil }
go
func (d *DB) FetchMeta(tx *bbolt.Tx) (*Meta, error) { meta := &Meta{} err := d.View(func(tx *bbolt.Tx) error { return fetchMeta(meta, tx) }) if err != nil { return nil, err } return meta, nil }
[ "func", "(", "d", "*", "DB", ")", "FetchMeta", "(", "tx", "*", "bbolt", ".", "Tx", ")", "(", "*", "Meta", ",", "error", ")", "{", "meta", ":=", "&", "Meta", "{", "}", "\n\n", "err", ":=", "d", ".", "View", "(", "func", "(", "tx", "*", "bbol...
// FetchMeta fetches the meta data from boltdb and returns filled meta // structure.
[ "FetchMeta", "fetches", "the", "meta", "data", "from", "boltdb", "and", "returns", "filled", "meta", "structure", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/meta.go#L23-L34
128,826
lightningnetwork/lnd
channeldb/meta.go
fetchMeta
func fetchMeta(meta *Meta, tx *bbolt.Tx) error { metaBucket := tx.Bucket(metaBucket) if metaBucket == nil { return ErrMetaNotFound } data := metaBucket.Get(dbVersionKey) if data == nil { meta.DbVersionNumber = getLatestDBVersion(dbVersions) } else { meta.DbVersionNumber = byteOrder.Uint32(data) } return...
go
func fetchMeta(meta *Meta, tx *bbolt.Tx) error { metaBucket := tx.Bucket(metaBucket) if metaBucket == nil { return ErrMetaNotFound } data := metaBucket.Get(dbVersionKey) if data == nil { meta.DbVersionNumber = getLatestDBVersion(dbVersions) } else { meta.DbVersionNumber = byteOrder.Uint32(data) } return...
[ "func", "fetchMeta", "(", "meta", "*", "Meta", ",", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "metaBucket", ":=", "tx", ".", "Bucket", "(", "metaBucket", ")", "\n", "if", "metaBucket", "==", "nil", "{", "return", "ErrMetaNotFound", "\n", "}", ...
// fetchMeta is an internal helper function used in order to allow callers to // re-use a database transaction. See the publicly exported FetchMeta method // for more information.
[ "fetchMeta", "is", "an", "internal", "helper", "function", "used", "in", "order", "to", "allow", "callers", "to", "re", "-", "use", "a", "database", "transaction", ".", "See", "the", "publicly", "exported", "FetchMeta", "method", "for", "more", "information", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/meta.go#L39-L53
128,827
lightningnetwork/lnd
channeldb/meta.go
PutMeta
func (d *DB) PutMeta(meta *Meta) error { return d.Update(func(tx *bbolt.Tx) error { return putMeta(meta, tx) }) }
go
func (d *DB) PutMeta(meta *Meta) error { return d.Update(func(tx *bbolt.Tx) error { return putMeta(meta, tx) }) }
[ "func", "(", "d", "*", "DB", ")", "PutMeta", "(", "meta", "*", "Meta", ")", "error", "{", "return", "d", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "return", "putMeta", "(", "meta", ",", "tx", ")", "\n", ...
// PutMeta writes the passed instance of the database met-data struct to disk.
[ "PutMeta", "writes", "the", "passed", "instance", "of", "the", "database", "met", "-", "data", "struct", "to", "disk", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/meta.go#L56-L60
128,828
lightningnetwork/lnd
channeldb/meta.go
putMeta
func putMeta(meta *Meta, tx *bbolt.Tx) error { metaBucket, err := tx.CreateBucketIfNotExists(metaBucket) if err != nil { return err } return putDbVersion(metaBucket, meta) }
go
func putMeta(meta *Meta, tx *bbolt.Tx) error { metaBucket, err := tx.CreateBucketIfNotExists(metaBucket) if err != nil { return err } return putDbVersion(metaBucket, meta) }
[ "func", "putMeta", "(", "meta", "*", "Meta", ",", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "metaBucket", ",", "err", ":=", "tx", ".", "CreateBucketIfNotExists", "(", "metaBucket", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\...
// putMeta is an internal helper function used in order to allow callers to // re-use a database transaction. See the publicly exported PutMeta method for // more information.
[ "putMeta", "is", "an", "internal", "helper", "function", "used", "in", "order", "to", "allow", "callers", "to", "re", "-", "use", "a", "database", "transaction", ".", "See", "the", "publicly", "exported", "PutMeta", "method", "for", "more", "information", "....
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/meta.go#L65-L72
128,829
lightningnetwork/lnd
watchtower/wtclient/task_pipeline.go
newTaskPipeline
func newTaskPipeline() *taskPipeline { rq := &taskPipeline{ queue: list.New(), newBackupTasks: make(chan *backupTask), quit: make(chan struct{}), forceQuit: make(chan struct{}), shutdown: make(chan struct{}), } rq.queueCond = sync.NewCond(&rq.queueMtx) return rq }
go
func newTaskPipeline() *taskPipeline { rq := &taskPipeline{ queue: list.New(), newBackupTasks: make(chan *backupTask), quit: make(chan struct{}), forceQuit: make(chan struct{}), shutdown: make(chan struct{}), } rq.queueCond = sync.NewCond(&rq.queueMtx) return rq }
[ "func", "newTaskPipeline", "(", ")", "*", "taskPipeline", "{", "rq", ":=", "&", "taskPipeline", "{", "queue", ":", "list", ".", "New", "(", ")", ",", "newBackupTasks", ":", "make", "(", "chan", "*", "backupTask", ")", ",", "quit", ":", "make", "(", "...
// newTaskPipeline initializes a new taskPipeline.
[ "newTaskPipeline", "initializes", "a", "new", "taskPipeline", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/task_pipeline.go#L32-L43
128,830
lightningnetwork/lnd
watchtower/wtclient/task_pipeline.go
Stop
func (q *taskPipeline) Stop() { q.stopped.Do(func() { log.Debugf("Stopping task pipeline") close(q.quit) q.signalUntilShutdown() // Skip log if we also force quit. select { case <-q.forceQuit: default: log.Debugf("Task pipeline stopped successfully") } }) }
go
func (q *taskPipeline) Stop() { q.stopped.Do(func() { log.Debugf("Stopping task pipeline") close(q.quit) q.signalUntilShutdown() // Skip log if we also force quit. select { case <-q.forceQuit: default: log.Debugf("Task pipeline stopped successfully") } }) }
[ "func", "(", "q", "*", "taskPipeline", ")", "Stop", "(", ")", "{", "q", ".", "stopped", ".", "Do", "(", "func", "(", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "close", "(", "q", ".", "quit", ")", "\n", "q", ".", "signalUnt...
// Stop begins a graceful shutdown of the taskPipeline. This method returns once // all backupTasks have been delivered via NewBackupTasks, or a ForceQuit causes // the delivery of pending tasks to be interrupted.
[ "Stop", "begins", "a", "graceful", "shutdown", "of", "the", "taskPipeline", ".", "This", "method", "returns", "once", "all", "backupTasks", "have", "been", "delivered", "via", "NewBackupTasks", "or", "a", "ForceQuit", "causes", "the", "delivery", "of", "pending"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/task_pipeline.go#L56-L70
128,831
lightningnetwork/lnd
watchtower/wtclient/task_pipeline.go
ForceQuit
func (q *taskPipeline) ForceQuit() { q.forced.Do(func() { log.Infof("Force quitting task pipeline") close(q.forceQuit) q.signalUntilShutdown() log.Infof("Task pipeline unclean shutdown complete") }) }
go
func (q *taskPipeline) ForceQuit() { q.forced.Do(func() { log.Infof("Force quitting task pipeline") close(q.forceQuit) q.signalUntilShutdown() log.Infof("Task pipeline unclean shutdown complete") }) }
[ "func", "(", "q", "*", "taskPipeline", ")", "ForceQuit", "(", ")", "{", "q", ".", "forced", ".", "Do", "(", "func", "(", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "close", "(", "q", ".", "forceQuit", ")", "\n", "q", ".", "s...
// ForceQuit signals the taskPipeline to immediately exit, dropping any // backupTasks that have not been delivered via NewBackupTasks.
[ "ForceQuit", "signals", "the", "taskPipeline", "to", "immediately", "exit", "dropping", "any", "backupTasks", "that", "have", "not", "been", "delivered", "via", "NewBackupTasks", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/task_pipeline.go#L74-L83
128,832
lightningnetwork/lnd
watchtower/wtclient/task_pipeline.go
QueueBackupTask
func (q *taskPipeline) QueueBackupTask(task *backupTask) error { q.queueCond.L.Lock() select { // Reject new tasks after quit has been signaled. case <-q.quit: q.queueCond.L.Unlock() return ErrClientExiting // Reject new tasks after force quit has been signaled. case <-q.forceQuit: q.queueCond.L.Unlock() ...
go
func (q *taskPipeline) QueueBackupTask(task *backupTask) error { q.queueCond.L.Lock() select { // Reject new tasks after quit has been signaled. case <-q.quit: q.queueCond.L.Unlock() return ErrClientExiting // Reject new tasks after force quit has been signaled. case <-q.forceQuit: q.queueCond.L.Unlock() ...
[ "func", "(", "q", "*", "taskPipeline", ")", "QueueBackupTask", "(", "task", "*", "backupTask", ")", "error", "{", "q", ".", "queueCond", ".", "L", ".", "Lock", "(", ")", "\n", "select", "{", "// Reject new tasks after quit has been signaled.", "case", "<-", ...
// QueueBackupTask enqueues a backupTask for reliable delivery to the consumer // of NewBackupTasks. If the taskPipeline is shutting down, ErrClientExiting is // returned. Otherwise, if QueueBackupTask returns nil it is guaranteed to be // delivered via NewBackupTasks unless ForceQuit is called before completion.
[ "QueueBackupTask", "enqueues", "a", "backupTask", "for", "reliable", "delivery", "to", "the", "consumer", "of", "NewBackupTasks", ".", "If", "the", "taskPipeline", "is", "shutting", "down", "ErrClientExiting", "is", "returned", ".", "Otherwise", "if", "QueueBackupTa...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/task_pipeline.go#L97-L122
128,833
lightningnetwork/lnd
routing/route/route.go
NewVertex
func NewVertex(pub *btcec.PublicKey) Vertex { var v Vertex copy(v[:], pub.SerializeCompressed()) return v }
go
func NewVertex(pub *btcec.PublicKey) Vertex { var v Vertex copy(v[:], pub.SerializeCompressed()) return v }
[ "func", "NewVertex", "(", "pub", "*", "btcec", ".", "PublicKey", ")", "Vertex", "{", "var", "v", "Vertex", "\n", "copy", "(", "v", "[", ":", "]", ",", "pub", ".", "SerializeCompressed", "(", ")", ")", "\n", "return", "v", "\n", "}" ]
// NewVertex returns a new Vertex given a public key.
[ "NewVertex", "returns", "a", "new", "Vertex", "given", "a", "public", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/route/route.go#L21-L25
128,834
lightningnetwork/lnd
routing/route/route.go
HopFee
func (r *Route) HopFee(hopIndex int) lnwire.MilliSatoshi { var incomingAmt lnwire.MilliSatoshi if hopIndex == 0 { incomingAmt = r.TotalAmount } else { incomingAmt = r.Hops[hopIndex-1].AmtToForward } // Fee is calculated as difference between incoming and outgoing amount. return incomingAmt - r.Hops[hopIndex]...
go
func (r *Route) HopFee(hopIndex int) lnwire.MilliSatoshi { var incomingAmt lnwire.MilliSatoshi if hopIndex == 0 { incomingAmt = r.TotalAmount } else { incomingAmt = r.Hops[hopIndex-1].AmtToForward } // Fee is calculated as difference between incoming and outgoing amount. return incomingAmt - r.Hops[hopIndex]...
[ "func", "(", "r", "*", "Route", ")", "HopFee", "(", "hopIndex", "int", ")", "lnwire", ".", "MilliSatoshi", "{", "var", "incomingAmt", "lnwire", ".", "MilliSatoshi", "\n", "if", "hopIndex", "==", "0", "{", "incomingAmt", "=", "r", ".", "TotalAmount", "\n"...
// HopFee returns the fee charged by the route hop indicated by hopIndex.
[ "HopFee", "returns", "the", "fee", "charged", "by", "the", "route", "hop", "indicated", "by", "hopIndex", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/route/route.go#L95-L105
128,835
lightningnetwork/lnd
routing/route/route.go
ToHopPayloads
func (r *Route) ToHopPayloads() []sphinx.HopData { hopPayloads := make([]sphinx.HopData, len(r.Hops)) // For each hop encoded within the route, we'll convert the hop struct // to the matching per-hop payload struct as used by the sphinx // package. for i, hop := range r.Hops { hopPayloads[i] = sphinx.HopData{ ...
go
func (r *Route) ToHopPayloads() []sphinx.HopData { hopPayloads := make([]sphinx.HopData, len(r.Hops)) // For each hop encoded within the route, we'll convert the hop struct // to the matching per-hop payload struct as used by the sphinx // package. for i, hop := range r.Hops { hopPayloads[i] = sphinx.HopData{ ...
[ "func", "(", "r", "*", "Route", ")", "ToHopPayloads", "(", ")", "[", "]", "sphinx", ".", "HopData", "{", "hopPayloads", ":=", "make", "(", "[", "]", "sphinx", ".", "HopData", ",", "len", "(", "r", ".", "Hops", ")", ")", "\n\n", "// For each hop encod...
// ToHopPayloads converts a complete route into the series of per-hop payloads // that is to be encoded within each HTLC using an opaque Sphinx packet.
[ "ToHopPayloads", "converts", "a", "complete", "route", "into", "the", "series", "of", "per", "-", "hop", "payloads", "that", "is", "to", "be", "encoded", "within", "each", "HTLC", "using", "an", "opaque", "Sphinx", "packet", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/route/route.go#L109-L139
128,836
lightningnetwork/lnd
lnwire/short_channel_id.go
String
func (c ShortChannelID) String() string { return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition) }
go
func (c ShortChannelID) String() string { return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition) }
[ "func", "(", "c", "ShortChannelID", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "BlockHeight", ",", "c", ".", "TxIndex", ",", "c", ".", "TxPosition", ")", "\n", "}" ]
// String generates a human-readable representation of the channel ID.
[ "String", "generates", "a", "human", "-", "readable", "representation", "of", "the", "channel", "ID", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/short_channel_id.go#L46-L48
128,837
lightningnetwork/lnd
lnwire/update_fulfill_htlc.go
NewUpdateFulfillHTLC
func NewUpdateFulfillHTLC(chanID ChannelID, id uint64, preimage [32]byte) *UpdateFulfillHTLC { return &UpdateFulfillHTLC{ ChanID: chanID, ID: id, PaymentPreimage: preimage, } }
go
func NewUpdateFulfillHTLC(chanID ChannelID, id uint64, preimage [32]byte) *UpdateFulfillHTLC { return &UpdateFulfillHTLC{ ChanID: chanID, ID: id, PaymentPreimage: preimage, } }
[ "func", "NewUpdateFulfillHTLC", "(", "chanID", "ChannelID", ",", "id", "uint64", ",", "preimage", "[", "32", "]", "byte", ")", "*", "UpdateFulfillHTLC", "{", "return", "&", "UpdateFulfillHTLC", "{", "ChanID", ":", "chanID", ",", "ID", ":", "id", ",", "Paym...
// NewUpdateFulfillHTLC returns a new empty UpdateFulfillHTLC.
[ "NewUpdateFulfillHTLC", "returns", "a", "new", "empty", "UpdateFulfillHTLC", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fulfill_htlc.go#L25-L33
128,838
lightningnetwork/lnd
lnwire/update_fulfill_htlc.go
Decode
func (c *UpdateFulfillHTLC) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, &c.ID, c.PaymentPreimage[:], ) }
go
func (c *UpdateFulfillHTLC) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &c.ChanID, &c.ID, c.PaymentPreimage[:], ) }
[ "func", "(", "c", "*", "UpdateFulfillHTLC", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "c", ".", "ChanID", ",", "&", "c", ".", "ID", ",", "c", ".", "Paymen...
// Decode deserializes a serialized UpdateFulfillHTLC message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "UpdateFulfillHTLC", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interfac...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fulfill_htlc.go#L43-L49
128,839
lightningnetwork/lnd
lnwire/update_fulfill_htlc.go
Encode
func (c *UpdateFulfillHTLC) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.ID, c.PaymentPreimage[:], ) }
go
func (c *UpdateFulfillHTLC) Encode(w io.Writer, pver uint32) error { return WriteElements(w, c.ChanID, c.ID, c.PaymentPreimage[:], ) }
[ "func", "(", "c", "*", "UpdateFulfillHTLC", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "c", ".", "ChanID", ",", "c", ".", "ID", ",", "c", ".", "PaymentPreimage", ...
// Encode serializes the target UpdateFulfillHTLC into the passed io.Writer // observing the protocol version specified. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "UpdateFulfillHTLC", "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/update_fulfill_htlc.go#L55-L61
128,840
lightningnetwork/lnd
watchtower/wtdb/session_info.go
Encode
func (s *SessionInfo) Encode(w io.Writer) error { return WriteElements(w, s.ID, s.Policy, s.LastApplied, s.ClientLastApplied, s.RewardAddress, ) }
go
func (s *SessionInfo) Encode(w io.Writer) error { return WriteElements(w, s.ID, s.Policy, s.LastApplied, s.ClientLastApplied, s.RewardAddress, ) }
[ "func", "(", "s", "*", "SessionInfo", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "s", ".", "ID", ",", "s", ".", "Policy", ",", "s", ".", "LastApplied", ",", "s", ".", "ClientLastApplie...
// Encode serializes the session info to the given io.Writer.
[ "Encode", "serializes", "the", "session", "info", "to", "the", "given", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/session_info.go#L64-L72
128,841
lightningnetwork/lnd
watchtower/wtdb/session_info.go
Decode
func (s *SessionInfo) Decode(r io.Reader) error { return ReadElements(r, &s.ID, &s.Policy, &s.LastApplied, &s.ClientLastApplied, &s.RewardAddress, ) }
go
func (s *SessionInfo) Decode(r io.Reader) error { return ReadElements(r, &s.ID, &s.Policy, &s.LastApplied, &s.ClientLastApplied, &s.RewardAddress, ) }
[ "func", "(", "s", "*", "SessionInfo", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "s", ".", "ID", ",", "&", "s", ".", "Policy", ",", "&", "s", ".", "LastApplied", ",", "&", "s",...
// Decode deserializes the session infor from the given io.Reader.
[ "Decode", "deserializes", "the", "session", "infor", "from", "the", "given", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/session_info.go#L75-L83
128,842
lightningnetwork/lnd
watchtower/wtdb/session_info.go
AcceptUpdateSequence
func (s *SessionInfo) AcceptUpdateSequence(seqNum, lastApplied uint16) error { switch { // Client already claims to have an ACK for this seqnum. case seqNum <= lastApplied: return ErrSeqNumAlreadyApplied // Client echos a last applied that is lower than previously sent. case lastApplied < s.ClientLastApplied: ...
go
func (s *SessionInfo) AcceptUpdateSequence(seqNum, lastApplied uint16) error { switch { // Client already claims to have an ACK for this seqnum. case seqNum <= lastApplied: return ErrSeqNumAlreadyApplied // Client echos a last applied that is lower than previously sent. case lastApplied < s.ClientLastApplied: ...
[ "func", "(", "s", "*", "SessionInfo", ")", "AcceptUpdateSequence", "(", "seqNum", ",", "lastApplied", "uint16", ")", "error", "{", "switch", "{", "// Client already claims to have an ACK for this seqnum.", "case", "seqNum", "<=", "lastApplied", ":", "return", "ErrSeqN...
// AcceptUpdateSequence validates that a state update's sequence number and last // applied are valid given our past history with the client. These checks ensure // that clients are properly in sync and following the update protocol properly. // If validation is successful, the receiver's LastApplied and ClientLastAppl...
[ "AcceptUpdateSequence", "validates", "that", "a", "state", "update", "s", "sequence", "number", "and", "last", "applied", "are", "valid", "given", "our", "past", "history", "with", "the", "client", ".", "These", "checks", "ensure", "that", "clients", "are", "p...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/session_info.go#L92-L116
128,843
lightningnetwork/lnd
multimutex/multimutex.go
Lock
func (c *Mutex) Lock(id uint64) { c.mapMtx.Lock() mtx, ok := c.mutexes[id] if ok { // If the mutex already existed in the map, we // increment its counter, to indicate that there // now is one more goroutine waiting for it. mtx.cnt++ } else { // If it was not in the map, it means no other // goroutine h...
go
func (c *Mutex) Lock(id uint64) { c.mapMtx.Lock() mtx, ok := c.mutexes[id] if ok { // If the mutex already existed in the map, we // increment its counter, to indicate that there // now is one more goroutine waiting for it. mtx.cnt++ } else { // If it was not in the map, it means no other // goroutine h...
[ "func", "(", "c", "*", "Mutex", ")", "Lock", "(", "id", "uint64", ")", "{", "c", ".", "mapMtx", ".", "Lock", "(", ")", "\n", "mtx", ",", "ok", ":=", "c", ".", "mutexes", "[", "id", "]", "\n", "if", "ok", "{", "// If the mutex already existed in the...
// Lock locks the mutex by the given ID. If the mutex is already // locked by this ID, Lock blocks until the mutex is available.
[ "Lock", "locks", "the", "mutex", "by", "the", "given", "ID", ".", "If", "the", "mutex", "is", "already", "locked", "by", "this", "ID", "Lock", "blocks", "until", "the", "mutex", "is", "available", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/multimutex/multimutex.go#L40-L62
128,844
lightningnetwork/lnd
multimutex/multimutex.go
Unlock
func (c *Mutex) Unlock(id uint64) { // Since we are done with all the work for this // update, we update the map to reflect that. c.mapMtx.Lock() mtx, ok := c.mutexes[id] if !ok { // The mutex not existing in the map means // an unlock for an ID not currently locked // was attempted. panic(fmt.Sprintf("do...
go
func (c *Mutex) Unlock(id uint64) { // Since we are done with all the work for this // update, we update the map to reflect that. c.mapMtx.Lock() mtx, ok := c.mutexes[id] if !ok { // The mutex not existing in the map means // an unlock for an ID not currently locked // was attempted. panic(fmt.Sprintf("do...
[ "func", "(", "c", "*", "Mutex", ")", "Unlock", "(", "id", "uint64", ")", "{", "// Since we are done with all the work for this", "// update, we update the map to reflect that.", "c", ".", "mapMtx", ".", "Lock", "(", ")", "\n\n", "mtx", ",", "ok", ":=", "c", ".",...
// Unlock unlocks the mutex by the given ID. It is a run-time // error if the mutex is not locked by the ID on entry to Unlock.
[ "Unlock", "unlocks", "the", "mutex", "by", "the", "given", "ID", ".", "It", "is", "a", "run", "-", "time", "error", "if", "the", "mutex", "is", "not", "locked", "by", "the", "ID", "on", "entry", "to", "Unlock", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/multimutex/multimutex.go#L66-L96
128,845
lightningnetwork/lnd
watchtower/wtwire/state_update_reply.go
Decode
func (t *StateUpdateReply) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &t.Code, &t.LastApplied, ) }
go
func (t *StateUpdateReply) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &t.Code, &t.LastApplied, ) }
[ "func", "(", "t", "*", "StateUpdateReply", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "t", ".", "Code", ",", "&", "t", ".", "LastApplied", ",", ")", "\n", ...
// Decode deserializes a serialized StateUpdateReply message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "StateUpdateReply", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/state_update_reply.go#L54-L59
128,846
lightningnetwork/lnd
watchtower/wtwire/state_update_reply.go
Encode
func (t *StateUpdateReply) Encode(w io.Writer, pver uint32) error { return WriteElements(w, t.Code, t.LastApplied, ) }
go
func (t *StateUpdateReply) Encode(w io.Writer, pver uint32) error { return WriteElements(w, t.Code, t.LastApplied, ) }
[ "func", "(", "t", "*", "StateUpdateReply", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "t", ".", "Code", ",", "t", ".", "LastApplied", ",", ")", "\n", "}" ]
// Encode serializes the target StateUpdateReply into the passed io.Writer // observing the protocol version specified. // // This is part of the wtwire.Message interface.
[ "Encode", "serializes", "the", "target", "StateUpdateReply", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/state_update_reply.go#L65-L70
128,847
lightningnetwork/lnd
ticker/force.go
NewForce
func NewForce(interval time.Duration) *Force { m := &Force{ ticker: time.NewTicker(interval).C, Force: make(chan time.Time), skip: make(chan struct{}), quit: make(chan struct{}), } // Proxy the real ticks to our Force channel if we are active. m.wg.Add(1) go func() { defer m.wg.Done() for { se...
go
func NewForce(interval time.Duration) *Force { m := &Force{ ticker: time.NewTicker(interval).C, Force: make(chan time.Time), skip: make(chan struct{}), quit: make(chan struct{}), } // Proxy the real ticks to our Force channel if we are active. m.wg.Add(1) go func() { defer m.wg.Done() for { se...
[ "func", "NewForce", "(", "interval", "time", ".", "Duration", ")", "*", "Force", "{", "m", ":=", "&", "Force", "{", "ticker", ":", "time", ".", "NewTicker", "(", "interval", ")", ".", "C", ",", "Force", ":", "make", "(", "chan", "time", ".", "Time"...
// NewForce returns a Force ticker, used for testing and debugging. It supports // the ability to force-feed events that get output by the
[ "NewForce", "returns", "a", "Force", "ticker", "used", "for", "testing", "and", "debugging", ".", "It", "supports", "the", "ability", "to", "force", "-", "feed", "events", "that", "get", "output", "by", "the" ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/ticker/force.go#L30-L63
128,848
lightningnetwork/lnd
pool/worker.go
NewWorker
func NewWorker(cfg *WorkerConfig) *Worker { return &Worker{ cfg: cfg, requests: make(chan *request), workerSem: make(chan struct{}, cfg.NumWorkers), work: make(chan *request), quit: make(chan struct{}), } }
go
func NewWorker(cfg *WorkerConfig) *Worker { return &Worker{ cfg: cfg, requests: make(chan *request), workerSem: make(chan struct{}, cfg.NumWorkers), work: make(chan *request), quit: make(chan struct{}), } }
[ "func", "NewWorker", "(", "cfg", "*", "WorkerConfig", ")", "*", "Worker", "{", "return", "&", "Worker", "{", "cfg", ":", "cfg", ",", "requests", ":", "make", "(", "chan", "*", "request", ")", ",", "workerSem", ":", "make", "(", "chan", "struct", "{",...
// NewWorker initializes a new Worker pool using the provided WorkerConfig.
[ "NewWorker", "initializes", "a", "new", "Worker", "pool", "using", "the", "provided", "WorkerConfig", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/worker.go#L85-L93
128,849
lightningnetwork/lnd
pool/worker.go
Start
func (w *Worker) Start() error { w.started.Do(func() { w.wg.Add(1) go w.requestHandler() }) return nil }
go
func (w *Worker) Start() error { w.started.Do(func() { w.wg.Add(1) go w.requestHandler() }) return nil }
[ "func", "(", "w", "*", "Worker", ")", "Start", "(", ")", "error", "{", "w", ".", "started", ".", "Do", "(", "func", "(", ")", "{", "w", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "w", ".", "requestHandler", "(", ")", "\n", "}", ")", ...
// Start safely spins up the Worker pool.
[ "Start", "safely", "spins", "up", "the", "Worker", "pool", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/worker.go#L96-L102
128,850
lightningnetwork/lnd
pool/worker.go
Stop
func (w *Worker) Stop() error { w.stopped.Do(func() { close(w.quit) w.wg.Wait() }) return nil }
go
func (w *Worker) Stop() error { w.stopped.Do(func() { close(w.quit) w.wg.Wait() }) return nil }
[ "func", "(", "w", "*", "Worker", ")", "Stop", "(", ")", "error", "{", "w", ".", "stopped", ".", "Do", "(", "func", "(", ")", "{", "close", "(", "w", ".", "quit", ")", "\n", "w", ".", "wg", ".", "Wait", "(", ")", "\n", "}", ")", "\n", "ret...
// Stop safely shuts down the Worker pool.
[ "Stop", "safely", "shuts", "down", "the", "Worker", "pool", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/worker.go#L105-L111
128,851
lightningnetwork/lnd
pool/worker.go
Submit
func (w *Worker) Submit(fn func(WorkerState) error) error { req := &request{ fn: fn, errChan: make(chan error, 1), } select { // Send request to requestHandler, where either a new worker is spawned // or the task will be handed to an existing worker. case w.requests <- req: // Fast path directly to e...
go
func (w *Worker) Submit(fn func(WorkerState) error) error { req := &request{ fn: fn, errChan: make(chan error, 1), } select { // Send request to requestHandler, where either a new worker is spawned // or the task will be handed to an existing worker. case w.requests <- req: // Fast path directly to e...
[ "func", "(", "w", "*", "Worker", ")", "Submit", "(", "fn", "func", "(", "WorkerState", ")", "error", ")", "error", "{", "req", ":=", "&", "request", "{", "fn", ":", "fn", ",", "errChan", ":", "make", "(", "chan", "error", ",", "1", ")", ",", "}...
// Submit accepts a function closure to the worker pool. The returned error will // be either the result of the closure's execution or an ErrWorkerPoolExiting if // a shutdown is requested.
[ "Submit", "accepts", "a", "function", "closure", "to", "the", "worker", "pool", ".", "The", "returned", "error", "will", "be", "either", "the", "result", "of", "the", "closure", "s", "execution", "or", "an", "ErrWorkerPoolExiting", "if", "a", "shutdown", "is...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/worker.go#L116-L144
128,852
lightningnetwork/lnd
pool/worker.go
requestHandler
func (w *Worker) requestHandler() { defer w.wg.Done() for { select { case req := <-w.requests: select { // If we have not reached our maximum number of workers, // spawn one to process the submitted request. case w.workerSem <- struct{}{}: w.wg.Add(1) go w.spawnWorker(req) // Otherwise, ...
go
func (w *Worker) requestHandler() { defer w.wg.Done() for { select { case req := <-w.requests: select { // If we have not reached our maximum number of workers, // spawn one to process the submitted request. case w.workerSem <- struct{}{}: w.wg.Add(1) go w.spawnWorker(req) // Otherwise, ...
[ "func", "(", "w", "*", "Worker", ")", "requestHandler", "(", ")", "{", "defer", "w", ".", "wg", ".", "Done", "(", ")", "\n\n", "for", "{", "select", "{", "case", "req", ":=", "<-", "w", ".", "requests", ":", "select", "{", "// If we have not reached ...
// requestHandler processes incoming tasks by either allocating new worker // goroutines to process the incoming tasks, or by feeding a submitted task to // an already running worker goroutine.
[ "requestHandler", "processes", "incoming", "tasks", "by", "either", "allocating", "new", "worker", "goroutines", "to", "process", "the", "incoming", "tasks", "or", "by", "feeding", "a", "submitted", "task", "to", "an", "already", "running", "worker", "goroutine", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/worker.go#L149-L175
128,853
lightningnetwork/lnd
macaroons/constraints.go
AddConstraints
func AddConstraints(mac *macaroon.Macaroon, cs ...Constraint) (*macaroon.Macaroon, error) { newMac := mac.Clone() for _, constraint := range cs { if err := constraint(newMac); err != nil { return nil, err } } return newMac, nil }
go
func AddConstraints(mac *macaroon.Macaroon, cs ...Constraint) (*macaroon.Macaroon, error) { newMac := mac.Clone() for _, constraint := range cs { if err := constraint(newMac); err != nil { return nil, err } } return newMac, nil }
[ "func", "AddConstraints", "(", "mac", "*", "macaroon", ".", "Macaroon", ",", "cs", "...", "Constraint", ")", "(", "*", "macaroon", ".", "Macaroon", ",", "error", ")", "{", "newMac", ":=", "mac", ".", "Clone", "(", ")", "\n", "for", "_", ",", "constra...
// AddConstraints returns new derived macaroon by applying every passed // constraint and tightening its restrictions.
[ "AddConstraints", "returns", "new", "derived", "macaroon", "by", "applying", "every", "passed", "constraint", "and", "tightening", "its", "restrictions", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/macaroons/constraints.go#L26-L34
128,854
lightningnetwork/lnd
macaroons/constraints.go
IPLockConstraint
func IPLockConstraint(ipAddr string) func(*macaroon.Macaroon) error { return func(mac *macaroon.Macaroon) error { if ipAddr != "" { macaroonIPAddr := net.ParseIP(ipAddr) if macaroonIPAddr == nil { return fmt.Errorf("incorrect macaroon IP-lock address") } caveat := checkers.Condition("ipaddr", mac...
go
func IPLockConstraint(ipAddr string) func(*macaroon.Macaroon) error { return func(mac *macaroon.Macaroon) error { if ipAddr != "" { macaroonIPAddr := net.ParseIP(ipAddr) if macaroonIPAddr == nil { return fmt.Errorf("incorrect macaroon IP-lock address") } caveat := checkers.Condition("ipaddr", mac...
[ "func", "IPLockConstraint", "(", "ipAddr", "string", ")", "func", "(", "*", "macaroon", ".", "Macaroon", ")", "error", "{", "return", "func", "(", "mac", "*", "macaroon", ".", "Macaroon", ")", "error", "{", "if", "ipAddr", "!=", "\"", "\"", "{", "macar...
// IPLockConstraint locks macaroon to a specific IP address. // If address is an empty string, this constraint does nothing to // accommodate default value's desired behavior.
[ "IPLockConstraint", "locks", "macaroon", "to", "a", "specific", "IP", "address", ".", "If", "address", "is", "an", "empty", "string", "this", "constraint", "does", "nothing", "to", "accommodate", "default", "value", "s", "desired", "behavior", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/macaroons/constraints.go#L54-L67
128,855
lightningnetwork/lnd
macaroons/constraints.go
IPLockChecker
func IPLockChecker() (string, checkers.Func) { return "ipaddr", func(ctx context.Context, cond, arg string) error { // Get peer info and extract IP address from it for macaroon // check. pr, ok := peer.FromContext(ctx) if !ok { return fmt.Errorf("unable to get peer info from context") } peerAddr, _, err...
go
func IPLockChecker() (string, checkers.Func) { return "ipaddr", func(ctx context.Context, cond, arg string) error { // Get peer info and extract IP address from it for macaroon // check. pr, ok := peer.FromContext(ctx) if !ok { return fmt.Errorf("unable to get peer info from context") } peerAddr, _, err...
[ "func", "IPLockChecker", "(", ")", "(", "string", ",", "checkers", ".", "Func", ")", "{", "return", "\"", "\"", ",", "func", "(", "ctx", "context", ".", "Context", ",", "cond", ",", "arg", "string", ")", "error", "{", "// Get peer info and extract IP addre...
// IPLockChecker accepts client IP from the validation context and compares it // with IP locked in the macaroon. It is of the `Checker` type.
[ "IPLockChecker", "accepts", "client", "IP", "from", "the", "validation", "context", "and", "compares", "it", "with", "IP", "locked", "in", "the", "macaroon", ".", "It", "is", "of", "the", "Checker", "type", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/macaroons/constraints.go#L71-L90
128,856
lightningnetwork/lnd
routing/validation_barrier.go
NewValidationBarrier
func NewValidationBarrier(numActiveReqs int, quitChan chan struct{}) *ValidationBarrier { v := &ValidationBarrier{ chanAnnFinSignal: make(map[lnwire.ShortChannelID]chan struct{}), chanEdgeDependencies: make(map[lnwire.ShortChannelID]chan struct{}), nodeAnnDependencies: make(map[route.Vertex]chan struct{})...
go
func NewValidationBarrier(numActiveReqs int, quitChan chan struct{}) *ValidationBarrier { v := &ValidationBarrier{ chanAnnFinSignal: make(map[lnwire.ShortChannelID]chan struct{}), chanEdgeDependencies: make(map[lnwire.ShortChannelID]chan struct{}), nodeAnnDependencies: make(map[route.Vertex]chan struct{})...
[ "func", "NewValidationBarrier", "(", "numActiveReqs", "int", ",", "quitChan", "chan", "struct", "{", "}", ")", "*", "ValidationBarrier", "{", "v", ":=", "&", "ValidationBarrier", "{", "chanAnnFinSignal", ":", "make", "(", "map", "[", "lnwire", ".", "ShortChann...
// NewValidationBarrier creates a new instance of a validation barrier given // the total number of active requests, and a quit channel which will be used // to know when to kill pending, but unfilled jobs.
[ "NewValidationBarrier", "creates", "a", "new", "instance", "of", "a", "validation", "barrier", "given", "the", "total", "number", "of", "active", "requests", "and", "a", "quit", "channel", "which", "will", "be", "used", "to", "know", "when", "to", "kill", "p...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/validation_barrier.go#L55-L73
128,857
lightningnetwork/lnd
routing/validation_barrier.go
WaitForDependants
func (v *ValidationBarrier) WaitForDependants(job interface{}) error { var ( signal chan struct{} ok bool ) v.Lock() switch msg := job.(type) { // Any ChannelUpdate or NodeAnnouncement jobs will need to wait on the // completion of any active ChannelAnnouncement jobs related to them. case *channeldb.C...
go
func (v *ValidationBarrier) WaitForDependants(job interface{}) error { var ( signal chan struct{} ok bool ) v.Lock() switch msg := job.(type) { // Any ChannelUpdate or NodeAnnouncement jobs will need to wait on the // completion of any active ChannelAnnouncement jobs related to them. case *channeldb.C...
[ "func", "(", "v", "*", "ValidationBarrier", ")", "WaitForDependants", "(", "job", "interface", "{", "}", ")", "error", "{", "var", "(", "signal", "chan", "struct", "{", "}", "\n", "ok", "bool", "\n", ")", "\n\n", "v", ".", "Lock", "(", ")", "\n", "...
// WaitForDependants will block until any jobs that this job dependants on have // finished executing. This allows us a graceful way to schedule goroutines // based on any pending uncompleted dependent jobs. If this job doesn't have an // active dependent, then this function will return immediately.
[ "WaitForDependants", "will", "block", "until", "any", "jobs", "that", "this", "job", "dependants", "on", "have", "finished", "executing", ".", "This", "allows", "us", "a", "graceful", "way", "to", "schedule", "goroutines", "based", "on", "any", "pending", "unc...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/validation_barrier.go#L162-L213
128,858
lightningnetwork/lnd
routing/validation_barrier.go
SignalDependants
func (v *ValidationBarrier) SignalDependants(job interface{}) { v.Lock() defer v.Unlock() switch msg := job.(type) { // If we've just finished executing a ChannelAnnouncement, then we'll // close out the signal, and remove the signal from the map of active // ones. This will allow any dependent jobs to continue...
go
func (v *ValidationBarrier) SignalDependants(job interface{}) { v.Lock() defer v.Unlock() switch msg := job.(type) { // If we've just finished executing a ChannelAnnouncement, then we'll // close out the signal, and remove the signal from the map of active // ones. This will allow any dependent jobs to continue...
[ "func", "(", "v", "*", "ValidationBarrier", ")", "SignalDependants", "(", "job", "interface", "{", "}", ")", "{", "v", ".", "Lock", "(", ")", "\n", "defer", "v", ".", "Unlock", "(", ")", "\n\n", "switch", "msg", ":=", "job", ".", "(", "type", ")", ...
// SignalDependants will signal any jobs that are dependent on this job that // they can continue execution. If the job doesn't have any dependants, then // this function sill exit immediately.
[ "SignalDependants", "will", "signal", "any", "jobs", "that", "are", "dependent", "on", "this", "job", "that", "they", "can", "continue", "execution", ".", "If", "the", "job", "doesn", "t", "have", "any", "dependants", "then", "this", "function", "sill", "exi...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/validation_barrier.go#L218-L259
128,859
lightningnetwork/lnd
htlcswitch/hodl/config_dev.go
Mask
func (c *Config) Mask() Mask { var flags []Flag if c.ExitSettle { flags = append(flags, ExitSettle) } if c.AddIncoming { flags = append(flags, AddIncoming) } if c.SettleIncoming { flags = append(flags, SettleIncoming) } if c.FailIncoming { flags = append(flags, FailIncoming) } if c.AddOutgoing { fl...
go
func (c *Config) Mask() Mask { var flags []Flag if c.ExitSettle { flags = append(flags, ExitSettle) } if c.AddIncoming { flags = append(flags, AddIncoming) } if c.SettleIncoming { flags = append(flags, SettleIncoming) } if c.FailIncoming { flags = append(flags, FailIncoming) } if c.AddOutgoing { fl...
[ "func", "(", "c", "*", "Config", ")", "Mask", "(", ")", "Mask", "{", "var", "flags", "[", "]", "Flag", "\n\n", "if", "c", ".", "ExitSettle", "{", "flags", "=", "append", "(", "flags", ",", "ExitSettle", ")", "\n", "}", "\n", "if", "c", ".", "Ad...
// Mask extracts the flags specified in the configuration, composing a Mask from // the active flags.
[ "Mask", "extracts", "the", "flags", "specified", "in", "the", "configuration", "composing", "a", "Mask", "from", "the", "active", "flags", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/hodl/config_dev.go#L32-L67
128,860
lightningnetwork/lnd
breacharbiter.go
Start
func (b *breachArbiter) Start() error { if !atomic.CompareAndSwapUint32(&b.started, 0, 1) { return nil } brarLog.Tracef("Starting breach arbiter") // Load all retributions currently persisted in the retribution store. breachRetInfos := make(map[wire.OutPoint]retributionInfo) if err := b.cfg.Store.ForAll(func(...
go
func (b *breachArbiter) Start() error { if !atomic.CompareAndSwapUint32(&b.started, 0, 1) { return nil } brarLog.Tracef("Starting breach arbiter") // Load all retributions currently persisted in the retribution store. breachRetInfos := make(map[wire.OutPoint]retributionInfo) if err := b.cfg.Store.ForAll(func(...
[ "func", "(", "b", "*", "breachArbiter", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "b", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "brarLog", ".", "Tracef...
// Start is an idempotent method that officially starts the breachArbiter along // with all other goroutines it needs to perform its functions.
[ "Start", "is", "an", "idempotent", "method", "that", "officially", "starts", "the", "breachArbiter", "along", "with", "all", "other", "goroutines", "it", "needs", "to", "perform", "its", "functions", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L142-L223
128,861
lightningnetwork/lnd
breacharbiter.go
Stop
func (b *breachArbiter) Stop() error { if !atomic.CompareAndSwapUint32(&b.stopped, 0, 1) { return nil } brarLog.Infof("Breach arbiter shutting down") close(b.quit) b.wg.Wait() return nil }
go
func (b *breachArbiter) Stop() error { if !atomic.CompareAndSwapUint32(&b.stopped, 0, 1) { return nil } brarLog.Infof("Breach arbiter shutting down") close(b.quit) b.wg.Wait() return nil }
[ "func", "(", "b", "*", "breachArbiter", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "b", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "brarLog", ".", "Infof",...
// Stop is an idempotent method that signals the breachArbiter to execute a // graceful shutdown. This function will block until all goroutines spawned by // the breachArbiter have gracefully exited.
[ "Stop", "is", "an", "idempotent", "method", "that", "signals", "the", "breachArbiter", "to", "execute", "a", "graceful", "shutdown", ".", "This", "function", "will", "block", "until", "all", "goroutines", "spawned", "by", "the", "breachArbiter", "have", "gracefu...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L228-L239
128,862
lightningnetwork/lnd
breacharbiter.go
IsBreached
func (b *breachArbiter) IsBreached(chanPoint *wire.OutPoint) (bool, error) { return b.cfg.Store.IsBreached(chanPoint) }
go
func (b *breachArbiter) IsBreached(chanPoint *wire.OutPoint) (bool, error) { return b.cfg.Store.IsBreached(chanPoint) }
[ "func", "(", "b", "*", "breachArbiter", ")", "IsBreached", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "(", "bool", ",", "error", ")", "{", "return", "b", ".", "cfg", ".", "Store", ".", "IsBreached", "(", "chanPoint", ")", "\n", "}" ]
// IsBreached queries the breach arbiter's retribution store to see if it is // aware of any channel breaches for a particular channel point.
[ "IsBreached", "queries", "the", "breach", "arbiter", "s", "retribution", "store", "to", "see", "if", "it", "is", "aware", "of", "any", "channel", "breaches", "for", "a", "particular", "channel", "point", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L243-L245
128,863
lightningnetwork/lnd
breacharbiter.go
convertToSecondLevelRevoke
func convertToSecondLevelRevoke(bo *breachedOutput, breachInfo *retributionInfo, spendDetails *chainntnfs.SpendDetail) { // In this case, we'll modify the witness type of this output to // actually prepare for a second level revoke. bo.witnessType = input.HtlcSecondLevelRevoke // We'll also redirect the outpoint...
go
func convertToSecondLevelRevoke(bo *breachedOutput, breachInfo *retributionInfo, spendDetails *chainntnfs.SpendDetail) { // In this case, we'll modify the witness type of this output to // actually prepare for a second level revoke. bo.witnessType = input.HtlcSecondLevelRevoke // We'll also redirect the outpoint...
[ "func", "convertToSecondLevelRevoke", "(", "bo", "*", "breachedOutput", ",", "breachInfo", "*", "retributionInfo", ",", "spendDetails", "*", "chainntnfs", ".", "SpendDetail", ")", "{", "// In this case, we'll modify the witness type of this output to", "// actually prepare for ...
// convertToSecondLevelRevoke takes a breached output, and a transaction that // spends it to the second level, and mutates the breach output into one that // is able to properly sweep that second level output. We'll use this function // when we go to sweep a breached commitment transaction, but the cheating // party h...
[ "convertToSecondLevelRevoke", "takes", "a", "breached", "output", "and", "a", "transaction", "that", "spends", "it", "to", "the", "second", "level", "and", "mutates", "the", "breach", "output", "into", "one", "that", "is", "able", "to", "properly", "sweep", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L281-L313
128,864
lightningnetwork/lnd
breacharbiter.go
cleanupBreach
func (b *breachArbiter) cleanupBreach(chanPoint *wire.OutPoint) error { // With the channel closed, mark it in the database as such. err := b.cfg.DB.MarkChanFullyClosed(chanPoint) if err != nil { return fmt.Errorf("unable to mark chan as closed: %v", err) } // Justice has been carried out; we can safely delete ...
go
func (b *breachArbiter) cleanupBreach(chanPoint *wire.OutPoint) error { // With the channel closed, mark it in the database as such. err := b.cfg.DB.MarkChanFullyClosed(chanPoint) if err != nil { return fmt.Errorf("unable to mark chan as closed: %v", err) } // Justice has been carried out; we can safely delete ...
[ "func", "(", "b", "*", "breachArbiter", ")", "cleanupBreach", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "error", "{", "// With the channel closed, mark it in the database as such.", "err", ":=", "b", ".", "cfg", ".", "DB", ".", "MarkChanFullyClosed", "(...
// cleanupBreach marks the given channel point as fully resolved and removes the // retribution for that the channel from the retribution store.
[ "cleanupBreach", "marks", "the", "given", "channel", "point", "as", "fully", "resolved", "and", "removes", "the", "retribution", "for", "that", "the", "channel", "from", "the", "retribution", "store", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L679-L695
128,865
lightningnetwork/lnd
breacharbiter.go
makeBreachedOutput
func makeBreachedOutput(outpoint *wire.OutPoint, witnessType input.WitnessType, secondLevelScript []byte, signDescriptor *input.SignDescriptor, confHeight uint32) breachedOutput { amount := signDescriptor.Output.Value return breachedOutput{ amt: btcutil.Amount(amount), outpoint: ...
go
func makeBreachedOutput(outpoint *wire.OutPoint, witnessType input.WitnessType, secondLevelScript []byte, signDescriptor *input.SignDescriptor, confHeight uint32) breachedOutput { amount := signDescriptor.Output.Value return breachedOutput{ amt: btcutil.Amount(amount), outpoint: ...
[ "func", "makeBreachedOutput", "(", "outpoint", "*", "wire", ".", "OutPoint", ",", "witnessType", "input", ".", "WitnessType", ",", "secondLevelScript", "[", "]", "byte", ",", "signDescriptor", "*", "input", ".", "SignDescriptor", ",", "confHeight", "uint32", ")"...
// makeBreachedOutput assembles a new breachedOutput that can be used by the // breach arbiter to construct a justice or sweep transaction.
[ "makeBreachedOutput", "assembles", "a", "new", "breachedOutput", "that", "can", "be", "used", "by", "the", "breach", "arbiter", "to", "construct", "a", "justice", "or", "sweep", "transaction", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L835-L851
128,866
lightningnetwork/lnd
breacharbiter.go
CraftInputScript
func (bo *breachedOutput) CraftInputScript(signer input.Signer, txn *wire.MsgTx, hashCache *txscript.TxSigHashes, txinIdx int) (*input.Script, error) { // First, we ensure that the witness generation function has been // initialized for this breached output. bo.witnessFunc = bo.witnessType.GenWitnessFunc( signer...
go
func (bo *breachedOutput) CraftInputScript(signer input.Signer, txn *wire.MsgTx, hashCache *txscript.TxSigHashes, txinIdx int) (*input.Script, error) { // First, we ensure that the witness generation function has been // initialized for this breached output. bo.witnessFunc = bo.witnessType.GenWitnessFunc( signer...
[ "func", "(", "bo", "*", "breachedOutput", ")", "CraftInputScript", "(", "signer", "input", ".", "Signer", ",", "txn", "*", "wire", ".", "MsgTx", ",", "hashCache", "*", "txscript", ".", "TxSigHashes", ",", "txinIdx", "int", ")", "(", "*", "input", ".", ...
// CraftInputScript computes a valid witness that allows us to spend from the // breached output. It does so by first generating and memoizing the witness // generation function, which parameterized primarily by the witness type and // sign descriptor. The method then returns the witness computed by invoking // this fu...
[ "CraftInputScript", "computes", "a", "valid", "witness", "that", "allows", "us", "to", "spend", "from", "the", "breached", "output", ".", "It", "does", "so", "by", "first", "generating", "and", "memoizing", "the", "witness", "generation", "function", "which", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L881-L894
128,867
lightningnetwork/lnd
breacharbiter.go
newRetributionInfo
func newRetributionInfo(chanPoint *wire.OutPoint, breachInfo *lnwallet.BreachRetribution) *retributionInfo { // Determine the number of second layer HTLCs we will attempt to sweep. nHtlcs := len(breachInfo.HtlcRetributions) // Initialize a slice to hold the outputs we will attempt to sweep. The // maximum capaci...
go
func newRetributionInfo(chanPoint *wire.OutPoint, breachInfo *lnwallet.BreachRetribution) *retributionInfo { // Determine the number of second layer HTLCs we will attempt to sweep. nHtlcs := len(breachInfo.HtlcRetributions) // Initialize a slice to hold the outputs we will attempt to sweep. The // maximum capaci...
[ "func", "newRetributionInfo", "(", "chanPoint", "*", "wire", ".", "OutPoint", ",", "breachInfo", "*", "lnwallet", ".", "BreachRetribution", ")", "*", "retributionInfo", "{", "// Determine the number of second layer HTLCs we will attempt to sweep.", "nHtlcs", ":=", "len", ...
// newRetributionInfo constructs a retributionInfo containing all the // information required by the breach arbiter to recover funds from breached // channels. The information is primarily populated using the BreachRetribution // delivered by the wallet when it detects a channel breach.
[ "newRetributionInfo", "constructs", "a", "retributionInfo", "containing", "all", "the", "information", "required", "by", "the", "breach", "arbiter", "to", "recover", "funds", "from", "breached", "channels", ".", "The", "information", "is", "primarily", "populated", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L931-L1012
128,868
lightningnetwork/lnd
breacharbiter.go
sweepSpendableOutputsTxn
func (b *breachArbiter) sweepSpendableOutputsTxn(txWeight int64, inputs ...input.Input) (*wire.MsgTx, error) { // First, we obtain a new public key script from the wallet which we'll // sweep the funds to. // TODO(roasbeef): possibly create many outputs to minimize change in // the future? pkScript, err := b.cfg...
go
func (b *breachArbiter) sweepSpendableOutputsTxn(txWeight int64, inputs ...input.Input) (*wire.MsgTx, error) { // First, we obtain a new public key script from the wallet which we'll // sweep the funds to. // TODO(roasbeef): possibly create many outputs to minimize change in // the future? pkScript, err := b.cfg...
[ "func", "(", "b", "*", "breachArbiter", ")", "sweepSpendableOutputsTxn", "(", "txWeight", "int64", ",", "inputs", "...", "input", ".", "Input", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "// First, we obtain a new public key script from the walle...
// sweepSpendableOutputsTxn creates a signed transaction from a sequence of // spendable outputs by sweeping the funds into a single p2wkh output.
[ "sweepSpendableOutputsTxn", "creates", "a", "signed", "transaction", "from", "a", "sequence", "of", "spendable", "outputs", "by", "sweeping", "the", "funds", "into", "a", "single", "p2wkh", "output", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1084-L1174
128,869
lightningnetwork/lnd
breacharbiter.go
Add
func (rs *retributionStore) Add(ret *retributionInfo) error { return rs.db.Update(func(tx *bbolt.Tx) error { // If this is our first contract breach, the retributionBucket // won't exist, in which case, we just create a new bucket. retBucket, err := tx.CreateBucketIfNotExists(retributionBucket) if err != nil {...
go
func (rs *retributionStore) Add(ret *retributionInfo) error { return rs.db.Update(func(tx *bbolt.Tx) error { // If this is our first contract breach, the retributionBucket // won't exist, in which case, we just create a new bucket. retBucket, err := tx.CreateBucketIfNotExists(retributionBucket) if err != nil {...
[ "func", "(", "rs", "*", "retributionStore", ")", "Add", "(", "ret", "*", "retributionInfo", ")", "error", "{", "return", "rs", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "// If this is our first contract...
// Add adds a retribution state to the retributionStore, which is then persisted // to disk.
[ "Add", "adds", "a", "retribution", "state", "to", "the", "retributionStore", "which", "is", "then", "persisted", "to", "disk", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1233-L1254
128,870
lightningnetwork/lnd
breacharbiter.go
Finalize
func (rs *retributionStore) Finalize(chanPoint *wire.OutPoint, finalTx *wire.MsgTx) error { return rs.db.Update(func(tx *bbolt.Tx) error { justiceBkt, err := tx.CreateBucketIfNotExists(justiceTxnBucket) if err != nil { return err } var chanBuf bytes.Buffer if err := writeOutpoint(&chanBuf, chanPoint); e...
go
func (rs *retributionStore) Finalize(chanPoint *wire.OutPoint, finalTx *wire.MsgTx) error { return rs.db.Update(func(tx *bbolt.Tx) error { justiceBkt, err := tx.CreateBucketIfNotExists(justiceTxnBucket) if err != nil { return err } var chanBuf bytes.Buffer if err := writeOutpoint(&chanBuf, chanPoint); e...
[ "func", "(", "rs", "*", "retributionStore", ")", "Finalize", "(", "chanPoint", "*", "wire", ".", "OutPoint", ",", "finalTx", "*", "wire", ".", "MsgTx", ")", "error", "{", "return", "rs", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt",...
// Finalize writes a signed justice transaction to the retribution store. This // is done before publishing the transaction, so that we can recover the txid on // startup and re-register for confirmation notifications.
[ "Finalize", "writes", "a", "signed", "justice", "transaction", "to", "the", "retribution", "store", ".", "This", "is", "done", "before", "publishing", "the", "transaction", "so", "that", "we", "can", "recover", "the", "txid", "on", "startup", "and", "re", "-...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1259-L1279
128,871
lightningnetwork/lnd
breacharbiter.go
GetFinalizedTxn
func (rs *retributionStore) GetFinalizedTxn( chanPoint *wire.OutPoint) (*wire.MsgTx, error) { var finalTxBytes []byte if err := rs.db.View(func(tx *bbolt.Tx) error { justiceBkt := tx.Bucket(justiceTxnBucket) if justiceBkt == nil { return nil } var chanBuf bytes.Buffer if err := writeOutpoint(&chanBuf,...
go
func (rs *retributionStore) GetFinalizedTxn( chanPoint *wire.OutPoint) (*wire.MsgTx, error) { var finalTxBytes []byte if err := rs.db.View(func(tx *bbolt.Tx) error { justiceBkt := tx.Bucket(justiceTxnBucket) if justiceBkt == nil { return nil } var chanBuf bytes.Buffer if err := writeOutpoint(&chanBuf,...
[ "func", "(", "rs", "*", "retributionStore", ")", "GetFinalizedTxn", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "var", "finalTxBytes", "[", "]", "byte", "\n", "if", "err", ":=", "rs", "...
// GetFinalizedTxn loads the finalized justice transaction for the provided // channel point. The finalized transaction will be nil if Finalize has yet to // be called for this channel point.
[ "GetFinalizedTxn", "loads", "the", "finalized", "justice", "transaction", "for", "the", "provided", "channel", "point", ".", "The", "finalized", "transaction", "will", "be", "nil", "if", "Finalize", "has", "yet", "to", "be", "called", "for", "this", "channel", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1284-L1314
128,872
lightningnetwork/lnd
breacharbiter.go
IsBreached
func (rs *retributionStore) IsBreached(chanPoint *wire.OutPoint) (bool, error) { var found bool err := rs.db.View(func(tx *bbolt.Tx) error { retBucket := tx.Bucket(retributionBucket) if retBucket == nil { return nil } var chanBuf bytes.Buffer if err := writeOutpoint(&chanBuf, chanPoint); err != nil { ...
go
func (rs *retributionStore) IsBreached(chanPoint *wire.OutPoint) (bool, error) { var found bool err := rs.db.View(func(tx *bbolt.Tx) error { retBucket := tx.Bucket(retributionBucket) if retBucket == nil { return nil } var chanBuf bytes.Buffer if err := writeOutpoint(&chanBuf, chanPoint); err != nil { ...
[ "func", "(", "rs", "*", "retributionStore", ")", "IsBreached", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "(", "bool", ",", "error", ")", "{", "var", "found", "bool", "\n", "err", ":=", "rs", ".", "db", ".", "View", "(", "func", "(", "tx"...
// IsBreached queries the retribution store to discern if this channel was // previously breached. This is used when connecting to a peer to determine if // it is safe to add a link to the htlcswitch, as we should never add a channel // that has already been breached.
[ "IsBreached", "queries", "the", "retribution", "store", "to", "discern", "if", "this", "channel", "was", "previously", "breached", ".", "This", "is", "used", "when", "connecting", "to", "a", "peer", "to", "determine", "if", "it", "is", "safe", "to", "add", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1320-L1342
128,873
lightningnetwork/lnd
breacharbiter.go
Remove
func (rs *retributionStore) Remove(chanPoint *wire.OutPoint) error { return rs.db.Update(func(tx *bbolt.Tx) error { retBucket := tx.Bucket(retributionBucket) // We return an error if the bucket is not already created, // since normal operation of the breach arbiter should never try // to remove a finalized re...
go
func (rs *retributionStore) Remove(chanPoint *wire.OutPoint) error { return rs.db.Update(func(tx *bbolt.Tx) error { retBucket := tx.Bucket(retributionBucket) // We return an error if the bucket is not already created, // since normal operation of the breach arbiter should never try // to remove a finalized re...
[ "func", "(", "rs", "*", "retributionStore", ")", "Remove", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "error", "{", "return", "rs", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", "retBucket", ...
// Remove removes a retribution state and finalized justice transaction by // channel point from the retribution store.
[ "Remove", "removes", "a", "retribution", "state", "and", "finalized", "justice", "transaction", "by", "channel", "point", "from", "the", "retribution", "store", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1346-L1381
128,874
lightningnetwork/lnd
breacharbiter.go
ForAll
func (rs *retributionStore) ForAll(cb func(*retributionInfo) error) error { return rs.db.View(func(tx *bbolt.Tx) error { // If the bucket does not exist, then there are no pending // retributions. retBucket := tx.Bucket(retributionBucket) if retBucket == nil { return nil } // Otherwise, we fetch each s...
go
func (rs *retributionStore) ForAll(cb func(*retributionInfo) error) error { return rs.db.View(func(tx *bbolt.Tx) error { // If the bucket does not exist, then there are no pending // retributions. retBucket := tx.Bucket(retributionBucket) if retBucket == nil { return nil } // Otherwise, we fetch each s...
[ "func", "(", "rs", "*", "retributionStore", ")", "ForAll", "(", "cb", "func", "(", "*", "retributionInfo", ")", "error", ")", "error", "{", "return", "rs", ".", "db", ".", "View", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ")", "error", "{", ...
// ForAll iterates through all stored retributions and executes the passed // callback function on each retribution.
[ "ForAll", "iterates", "through", "all", "stored", "retributions", "and", "executes", "the", "passed", "callback", "function", "on", "each", "retribution", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1385-L1407
128,875
lightningnetwork/lnd
breacharbiter.go
Encode
func (ret *retributionInfo) Encode(w io.Writer) error { var scratch [4]byte if _, err := w.Write(ret.commitHash[:]); err != nil { return err } if err := writeOutpoint(w, &ret.chanPoint); err != nil { return err } if _, err := w.Write(ret.chainHash[:]); err != nil { return err } binary.BigEndian.PutUin...
go
func (ret *retributionInfo) Encode(w io.Writer) error { var scratch [4]byte if _, err := w.Write(ret.commitHash[:]); err != nil { return err } if err := writeOutpoint(w, &ret.chanPoint); err != nil { return err } if _, err := w.Write(ret.chainHash[:]); err != nil { return err } binary.BigEndian.PutUin...
[ "func", "(", "ret", "*", "retributionInfo", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "var", "scratch", "[", "4", "]", "byte", "\n\n", "if", "_", ",", "err", ":=", "w", ".", "Write", "(", "ret", ".", "commitHash", "[", ":",...
// Encode serializes the retribution into the passed byte stream.
[ "Encode", "serializes", "the", "retribution", "into", "the", "passed", "byte", "stream", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1410-L1442
128,876
lightningnetwork/lnd
breacharbiter.go
Decode
func (ret *retributionInfo) Decode(r io.Reader) error { var scratch [32]byte if _, err := io.ReadFull(r, scratch[:]); err != nil { return err } hash, err := chainhash.NewHash(scratch[:]) if err != nil { return err } ret.commitHash = *hash if err := readOutpoint(r, &ret.chanPoint); err != nil { return er...
go
func (ret *retributionInfo) Decode(r io.Reader) error { var scratch [32]byte if _, err := io.ReadFull(r, scratch[:]); err != nil { return err } hash, err := chainhash.NewHash(scratch[:]) if err != nil { return err } ret.commitHash = *hash if err := readOutpoint(r, &ret.chanPoint); err != nil { return er...
[ "func", "(", "ret", "*", "retributionInfo", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "var", "scratch", "[", "32", "]", "byte", "\n\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "scratch", "[", ":",...
// Dencode deserializes a retribution from the passed byte stream.
[ "Dencode", "deserializes", "a", "retribution", "from", "the", "passed", "byte", "stream", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1445-L1489
128,877
lightningnetwork/lnd
breacharbiter.go
Encode
func (bo *breachedOutput) Encode(w io.Writer) error { var scratch [8]byte binary.BigEndian.PutUint64(scratch[:8], uint64(bo.amt)) if _, err := w.Write(scratch[:8]); err != nil { return err } if err := writeOutpoint(w, &bo.outpoint); err != nil { return err } err := input.WriteSignDescriptor(w, &bo.signDes...
go
func (bo *breachedOutput) Encode(w io.Writer) error { var scratch [8]byte binary.BigEndian.PutUint64(scratch[:8], uint64(bo.amt)) if _, err := w.Write(scratch[:8]); err != nil { return err } if err := writeOutpoint(w, &bo.outpoint); err != nil { return err } err := input.WriteSignDescriptor(w, &bo.signDes...
[ "func", "(", "bo", "*", "breachedOutput", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "var", "scratch", "[", "8", "]", "byte", "\n\n", "binary", ".", "BigEndian", ".", "PutUint64", "(", "scratch", "[", ":", "8", "]", ",", "uint...
// Encode serializes a breachedOutput into the passed byte stream.
[ "Encode", "serializes", "a", "breachedOutput", "into", "the", "passed", "byte", "stream", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1492-L1520
128,878
lightningnetwork/lnd
breacharbiter.go
Decode
func (bo *breachedOutput) Decode(r io.Reader) error { var scratch [8]byte if _, err := io.ReadFull(r, scratch[:8]); err != nil { return err } bo.amt = btcutil.Amount(binary.BigEndian.Uint64(scratch[:8])) if err := readOutpoint(r, &bo.outpoint); err != nil { return err } if err := input.ReadSignDescriptor(...
go
func (bo *breachedOutput) Decode(r io.Reader) error { var scratch [8]byte if _, err := io.ReadFull(r, scratch[:8]); err != nil { return err } bo.amt = btcutil.Amount(binary.BigEndian.Uint64(scratch[:8])) if err := readOutpoint(r, &bo.outpoint); err != nil { return err } if err := input.ReadSignDescriptor(...
[ "func", "(", "bo", "*", "breachedOutput", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "var", "scratch", "[", "8", "]", "byte", "\n\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "r", ",", "scratch", "[", ":", ...
// Decode deserializes a breachedOutput from the passed byte stream.
[ "Decode", "deserializes", "a", "breachedOutput", "from", "the", "passed", "byte", "stream", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/breacharbiter.go#L1523-L1553
128,879
lightningnetwork/lnd
chainntnfs/btcdnotify/driver.go
createNewNotifier
func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) { if len(args) != 4 { return nil, fmt.Errorf("incorrect number of arguments to "+ ".New(...), expected 4, instead passed %v", len(args)) } config, ok := args[0].(*rpcclient.ConnConfig) if !ok { return nil, errors.New("first argume...
go
func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) { if len(args) != 4 { return nil, fmt.Errorf("incorrect number of arguments to "+ ".New(...), expected 4, instead passed %v", len(args)) } config, ok := args[0].(*rpcclient.ConnConfig) if !ok { return nil, errors.New("first argume...
[ "func", "createNewNotifier", "(", "args", "...", "interface", "{", "}", ")", "(", "chainntnfs", ".", "ChainNotifier", ",", "error", ")", "{", "if", "len", "(", "args", ")", "!=", "4", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// createNewNotifier creates a new instance of the ChainNotifier interface // implemented by BtcdNotifier.
[ "createNewNotifier", "creates", "a", "new", "instance", "of", "the", "ChainNotifier", "interface", "implemented", "by", "BtcdNotifier", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/btcdnotify/driver.go#L14-L45
128,880
lightningnetwork/lnd
routing/ann_validation.go
ValidateChannelAnn
func ValidateChannelAnn(a *lnwire.ChannelAnnouncement) error { // First, we'll compute the digest (h) which is to be signed by each of // the keys included within the node announcement message. This hash // digest includes all the keys, so the (up to 4 signatures) will // attest to the validity of each of the keys....
go
func ValidateChannelAnn(a *lnwire.ChannelAnnouncement) error { // First, we'll compute the digest (h) which is to be signed by each of // the keys included within the node announcement message. This hash // digest includes all the keys, so the (up to 4 signatures) will // attest to the validity of each of the keys....
[ "func", "ValidateChannelAnn", "(", "a", "*", "lnwire", ".", "ChannelAnnouncement", ")", "error", "{", "// First, we'll compute the digest (h) which is to be signed by each of", "// the keys included within the node announcement message. This hash", "// digest includes all the keys, so the ...
// ValidateChannelAnn validates the channel announcement message and checks // that node signatures covers the announcement message, and that the bitcoin // signatures covers the node keys.
[ "ValidateChannelAnn", "validates", "the", "channel", "announcement", "message", "and", "checks", "that", "node", "signatures", "covers", "the", "announcement", "message", "and", "that", "the", "bitcoin", "signatures", "covers", "the", "node", "keys", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/ann_validation.go#L18-L86
128,881
lightningnetwork/lnd
routing/ann_validation.go
ValidateNodeAnn
func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error { // Reconstruct the data of announcement which should be covered by the // signature so we can verify the signature shortly below data, err := a.DataToSign() if err != nil { return err } nodeSig, err := a.Signature.ToSignature() if err != nil { return ...
go
func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error { // Reconstruct the data of announcement which should be covered by the // signature so we can verify the signature shortly below data, err := a.DataToSign() if err != nil { return err } nodeSig, err := a.Signature.ToSignature() if err != nil { return ...
[ "func", "ValidateNodeAnn", "(", "a", "*", "lnwire", ".", "NodeAnnouncement", ")", "error", "{", "// Reconstruct the data of announcement which should be covered by the", "// signature so we can verify the signature shortly below", "data", ",", "err", ":=", "a", ".", "DataToSign...
// ValidateNodeAnn validates the node announcement by ensuring that the // attached signature is needed a signature of the node announcement under the // specified node public key.
[ "ValidateNodeAnn", "validates", "the", "node", "announcement", "by", "ensuring", "that", "the", "attached", "signature", "is", "needed", "a", "signature", "of", "the", "node", "announcement", "under", "the", "specified", "node", "public", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/ann_validation.go#L91-L123
128,882
lightningnetwork/lnd
routing/ann_validation.go
VerifyChannelUpdateSignature
func VerifyChannelUpdateSignature(msg *lnwire.ChannelUpdate, pubKey *btcec.PublicKey) error { data, err := msg.DataToSign() if err != nil { return fmt.Errorf("unable to reconstruct message data: %v", err) } dataHash := chainhash.DoubleHashB(data) nodeSig, err := msg.Signature.ToSignature() if err != nil { ...
go
func VerifyChannelUpdateSignature(msg *lnwire.ChannelUpdate, pubKey *btcec.PublicKey) error { data, err := msg.DataToSign() if err != nil { return fmt.Errorf("unable to reconstruct message data: %v", err) } dataHash := chainhash.DoubleHashB(data) nodeSig, err := msg.Signature.ToSignature() if err != nil { ...
[ "func", "VerifyChannelUpdateSignature", "(", "msg", "*", "lnwire", ".", "ChannelUpdate", ",", "pubKey", "*", "btcec", ".", "PublicKey", ")", "error", "{", "data", ",", "err", ":=", "msg", ".", "DataToSign", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// VerifyChannelUpdateSignature verifies that the channel update message was // signed by the party with the given node public key.
[ "VerifyChannelUpdateSignature", "verifies", "that", "the", "channel", "update", "message", "was", "signed", "by", "the", "party", "with", "the", "given", "node", "public", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/ann_validation.go#L141-L161
128,883
lightningnetwork/lnd
routing/ann_validation.go
validateOptionalFields
func validateOptionalFields(capacity btcutil.Amount, msg *lnwire.ChannelUpdate) error { if msg.MessageFlags.HasMaxHtlc() { maxHtlc := msg.HtlcMaximumMsat if maxHtlc == 0 || maxHtlc < msg.HtlcMinimumMsat { return errors.Errorf("invalid max htlc for channel "+ "update %v", spew.Sdump(msg)) } // For lig...
go
func validateOptionalFields(capacity btcutil.Amount, msg *lnwire.ChannelUpdate) error { if msg.MessageFlags.HasMaxHtlc() { maxHtlc := msg.HtlcMaximumMsat if maxHtlc == 0 || maxHtlc < msg.HtlcMinimumMsat { return errors.Errorf("invalid max htlc for channel "+ "update %v", spew.Sdump(msg)) } // For lig...
[ "func", "validateOptionalFields", "(", "capacity", "btcutil", ".", "Amount", ",", "msg", "*", "lnwire", ".", "ChannelUpdate", ")", "error", "{", "if", "msg", ".", "MessageFlags", ".", "HasMaxHtlc", "(", ")", "{", "maxHtlc", ":=", "msg", ".", "HtlcMaximumMsat...
// validateOptionalFields validates a channel update's message flags and // corresponding update fields.
[ "validateOptionalFields", "validates", "a", "channel", "update", "s", "message", "flags", "and", "corresponding", "update", "fields", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/ann_validation.go#L165-L187
128,884
lightningnetwork/lnd
lncfg/address.go
NormalizeAddresses
func NormalizeAddresses(addrs []string, defaultPort string, tcpResolver tcpResolver) ([]net.Addr, error) { result := make([]net.Addr, 0, len(addrs)) seen := map[string]struct{}{} for _, addr := range addrs { parsedAddr, err := ParseAddressString( addr, defaultPort, tcpResolver, ) if err != nil { retur...
go
func NormalizeAddresses(addrs []string, defaultPort string, tcpResolver tcpResolver) ([]net.Addr, error) { result := make([]net.Addr, 0, len(addrs)) seen := map[string]struct{}{} for _, addr := range addrs { parsedAddr, err := ParseAddressString( addr, defaultPort, tcpResolver, ) if err != nil { retur...
[ "func", "NormalizeAddresses", "(", "addrs", "[", "]", "string", ",", "defaultPort", "string", ",", "tcpResolver", "tcpResolver", ")", "(", "[", "]", "net", ".", "Addr", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "net", ".", "Addr", ...
// NormalizeAddresses returns a new slice with all the passed addresses // normalized with the given default port and all duplicates removed.
[ "NormalizeAddresses", "returns", "a", "new", "slice", "with", "all", "the", "passed", "addresses", "normalized", "with", "the", "given", "default", "port", "and", "all", "duplicates", "removed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L25-L46
128,885
lightningnetwork/lnd
lncfg/address.go
EnforceSafeAuthentication
func EnforceSafeAuthentication(addrs []net.Addr, macaroonsActive bool) error { // We'll now examine all addresses that this RPC server is listening // on. If it's a localhost address, we'll skip it, otherwise, we'll // return an error if macaroons are inactive. for _, addr := range addrs { if IsLoopback(addr.Stri...
go
func EnforceSafeAuthentication(addrs []net.Addr, macaroonsActive bool) error { // We'll now examine all addresses that this RPC server is listening // on. If it's a localhost address, we'll skip it, otherwise, we'll // return an error if macaroons are inactive. for _, addr := range addrs { if IsLoopback(addr.Stri...
[ "func", "EnforceSafeAuthentication", "(", "addrs", "[", "]", "net", ".", "Addr", ",", "macaroonsActive", "bool", ")", "error", "{", "// We'll now examine all addresses that this RPC server is listening", "// on. If it's a localhost address, we'll skip it, otherwise, we'll", "// ret...
// EnforceSafeAuthentication enforces "safe" authentication taking into account // the interfaces that the RPC servers are listening on, and if macaroons are // activated or not. To protect users from using dangerous config combinations, // we'll prevent disabling authentication if the server is listening on a public /...
[ "EnforceSafeAuthentication", "enforces", "safe", "authentication", "taking", "into", "account", "the", "interfaces", "that", "the", "RPC", "servers", "are", "listening", "on", "and", "if", "macaroons", "are", "activated", "or", "not", ".", "To", "protect", "users"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L53-L71
128,886
lightningnetwork/lnd
lncfg/address.go
parseNetwork
func parseNetwork(addr net.Addr) string { switch addr := addr.(type) { // TCP addresses resolved through net.ResolveTCPAddr give a default // network of "tcp", so we'll map back the correct network for the given // address. This ensures that we can listen on the correct interface // (IPv4 vs IPv6). case *net.TCPA...
go
func parseNetwork(addr net.Addr) string { switch addr := addr.(type) { // TCP addresses resolved through net.ResolveTCPAddr give a default // network of "tcp", so we'll map back the correct network for the given // address. This ensures that we can listen on the correct interface // (IPv4 vs IPv6). case *net.TCPA...
[ "func", "parseNetwork", "(", "addr", "net", ".", "Addr", ")", "string", "{", "switch", "addr", ":=", "addr", ".", "(", "type", ")", "{", "// TCP addresses resolved through net.ResolveTCPAddr give a default", "// network of \"tcp\", so we'll map back the correct network for th...
// parseNetwork parses the network type of the given address.
[ "parseNetwork", "parses", "the", "network", "type", "of", "the", "given", "address", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L74-L89
128,887
lightningnetwork/lnd
lncfg/address.go
ListenOnAddress
func ListenOnAddress(addr net.Addr) (net.Listener, error) { return net.Listen(parseNetwork(addr), addr.String()) }
go
func ListenOnAddress(addr net.Addr) (net.Listener, error) { return net.Listen(parseNetwork(addr), addr.String()) }
[ "func", "ListenOnAddress", "(", "addr", "net", ".", "Addr", ")", "(", "net", ".", "Listener", ",", "error", ")", "{", "return", "net", ".", "Listen", "(", "parseNetwork", "(", "addr", ")", ",", "addr", ".", "String", "(", ")", ")", "\n", "}" ]
// ListenOnAddress creates a listener that listens on the given address.
[ "ListenOnAddress", "creates", "a", "listener", "that", "listens", "on", "the", "given", "address", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L92-L94
128,888
lightningnetwork/lnd
lncfg/address.go
TLSListenOnAddress
func TLSListenOnAddress(addr net.Addr, config *tls.Config) (net.Listener, error) { return tls.Listen(parseNetwork(addr), addr.String(), config) }
go
func TLSListenOnAddress(addr net.Addr, config *tls.Config) (net.Listener, error) { return tls.Listen(parseNetwork(addr), addr.String(), config) }
[ "func", "TLSListenOnAddress", "(", "addr", "net", ".", "Addr", ",", "config", "*", "tls", ".", "Config", ")", "(", "net", ".", "Listener", ",", "error", ")", "{", "return", "tls", ".", "Listen", "(", "parseNetwork", "(", "addr", ")", ",", "addr", "."...
// TLSListenOnAddress creates a TLS listener that listens on the given address.
[ "TLSListenOnAddress", "creates", "a", "TLS", "listener", "that", "listens", "on", "the", "given", "address", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L97-L100
128,889
lightningnetwork/lnd
lncfg/address.go
IsLoopback
func IsLoopback(addr string) bool { for _, loopback := range loopBackAddrs { if strings.Contains(addr, loopback) { return true } } return false }
go
func IsLoopback(addr string) bool { for _, loopback := range loopBackAddrs { if strings.Contains(addr, loopback) { return true } } return false }
[ "func", "IsLoopback", "(", "addr", "string", ")", "bool", "{", "for", "_", ",", "loopback", ":=", "range", "loopBackAddrs", "{", "if", "strings", ".", "Contains", "(", "addr", ",", "loopback", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", ...
// IsLoopback returns true if an address describes a loopback interface.
[ "IsLoopback", "returns", "true", "if", "an", "address", "describes", "a", "loopback", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L103-L111
128,890
lightningnetwork/lnd
lncfg/address.go
ParseAddressString
func ParseAddressString(strAddress string, defaultPort string, tcpResolver tcpResolver) (net.Addr, error) { var parsedNetwork, parsedAddr string // Addresses can either be in network://address:port format, // network:address:port, address:port, or just port. We want to support // all possible types. if strings....
go
func ParseAddressString(strAddress string, defaultPort string, tcpResolver tcpResolver) (net.Addr, error) { var parsedNetwork, parsedAddr string // Addresses can either be in network://address:port format, // network:address:port, address:port, or just port. We want to support // all possible types. if strings....
[ "func", "ParseAddressString", "(", "strAddress", "string", ",", "defaultPort", "string", ",", "tcpResolver", "tcpResolver", ")", "(", "net", ".", "Addr", ",", "error", ")", "{", "var", "parsedNetwork", ",", "parsedAddr", "string", "\n\n", "// Addresses can either ...
// ParseAddressString converts an address in string format to a net.Addr that is // compatible with lnd. UDP is not supported because lnd needs reliable // connections. We accept a custom function to resolve any TCP addresses so // that caller is able control exactly how resolution is performed.
[ "ParseAddressString", "converts", "an", "address", "in", "string", "format", "to", "a", "net", ".", "Addr", "that", "is", "compatible", "with", "lnd", ".", "UDP", "is", "not", "supported", "because", "lnd", "needs", "reliable", "connections", ".", "We", "acc...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L122-L184
128,891
lightningnetwork/lnd
lncfg/address.go
ClientAddressDialer
func ClientAddressDialer(defaultPort string) func(string, time.Duration) (net.Conn, error) { return func(addr string, timeout time.Duration) (net.Conn, error) { parsedAddr, err := ParseAddressString( addr, defaultPort, net.ResolveTCPAddr, ) if err != nil { return nil, err } return net.DialTimeout( ...
go
func ClientAddressDialer(defaultPort string) func(string, time.Duration) (net.Conn, error) { return func(addr string, timeout time.Duration) (net.Conn, error) { parsedAddr, err := ParseAddressString( addr, defaultPort, net.ResolveTCPAddr, ) if err != nil { return nil, err } return net.DialTimeout( ...
[ "func", "ClientAddressDialer", "(", "defaultPort", "string", ")", "func", "(", "string", ",", "time", ".", "Duration", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "return", "func", "(", "addr", "string", ",", "timeout", "time", ".", "Duration",...
// ClientAddressDialer creates a gRPC dialer that can also dial unix socket // addresses instead of just TCP addresses.
[ "ClientAddressDialer", "creates", "a", "gRPC", "dialer", "that", "can", "also", "dial", "unix", "socket", "addresses", "instead", "of", "just", "TCP", "addresses", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/address.go#L275-L288
128,892
lightningnetwork/lnd
brontide/conn.go
Dial
func Dial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress, dialer func(string, string) (net.Conn, error)) (*Conn, error) { ipAddr := netAddr.Address.String() var conn net.Conn var err error conn, err = dialer("tcp", ipAddr) if err != nil { return nil, err } b := &Conn{ conn: conn, noise: NewBron...
go
func Dial(localPriv *btcec.PrivateKey, netAddr *lnwire.NetAddress, dialer func(string, string) (net.Conn, error)) (*Conn, error) { ipAddr := netAddr.Address.String() var conn net.Conn var err error conn, err = dialer("tcp", ipAddr) if err != nil { return nil, err } b := &Conn{ conn: conn, noise: NewBron...
[ "func", "Dial", "(", "localPriv", "*", "btcec", ".", "PrivateKey", ",", "netAddr", "*", "lnwire", ".", "NetAddress", ",", "dialer", "func", "(", "string", ",", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", ")", "(", "*", "Conn", ",", "...
// Dial attempts to establish an encrypted+authenticated connection with the // remote peer located at address which has remotePub as its long-term static // public key. In the case of a handshake failure, the connection is closed and // a non-nil error is returned.
[ "Dial", "attempts", "to", "establish", "an", "encrypted", "+", "authenticated", "connection", "with", "the", "remote", "peer", "located", "at", "address", "which", "has", "remotePub", "as", "its", "long", "-", "term", "static", "public", "key", ".", "In", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/conn.go#L35-L105
128,893
lightningnetwork/lnd
brontide/conn.go
ReadNextBody
func (c *Conn) ReadNextBody(buf []byte) ([]byte, error) { return c.noise.ReadBody(c.conn, buf) }
go
func (c *Conn) ReadNextBody(buf []byte) ([]byte, error) { return c.noise.ReadBody(c.conn, buf) }
[ "func", "(", "c", "*", "Conn", ")", "ReadNextBody", "(", "buf", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "c", ".", "noise", ".", "ReadBody", "(", "c", ".", "conn", ",", "buf", ")", "\n", "}" ]
// ReadNextBody uses the connection to read the next message body from the // brontide stream. This function will block until the read of the body succeeds // and return the decrypted payload. The provided buffer MUST be the packet // length returned by the preceding call to ReadNextHeader.
[ "ReadNextBody", "uses", "the", "connection", "to", "read", "the", "next", "message", "body", "from", "the", "brontide", "stream", ".", "This", "function", "will", "block", "until", "the", "read", "of", "the", "body", "succeeds", "and", "return", "the", "decr...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/conn.go#L131-L133
128,894
lightningnetwork/lnd
config.go
parseAndSetDebugLevels
func parseAndSetDebugLevels(debugLevel string) error { // When the specified string doesn't have any delimiters, treat it as // the log level for all subsystems. if !strings.Contains(debugLevel, ",") && !strings.Contains(debugLevel, "=") { // Validate debug log level. if !validLogLevel(debugLevel) { str := "T...
go
func parseAndSetDebugLevels(debugLevel string) error { // When the specified string doesn't have any delimiters, treat it as // the log level for all subsystems. if !strings.Contains(debugLevel, ",") && !strings.Contains(debugLevel, "=") { // Validate debug log level. if !validLogLevel(debugLevel) { str := "T...
[ "func", "parseAndSetDebugLevels", "(", "debugLevel", "string", ")", "error", "{", "// When the specified string doesn't have any delimiters, treat it as", "// the log level for all subsystems.", "if", "!", "strings", ".", "Contains", "(", "debugLevel", ",", "\"", "\"", ")", ...
// parseAndSetDebugLevels attempts to parse the specified debug level and set // the levels accordingly. An appropriate error is returned if anything is // invalid.
[ "parseAndSetDebugLevels", "attempts", "to", "parse", "the", "specified", "debug", "level", "and", "set", "the", "levels", "accordingly", ".", "An", "appropriate", "error", "is", "returned", "if", "anything", "is", "invalid", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/config.go#L1065-L1111
128,895
lightningnetwork/lnd
config.go
extractBtcdRPCParams
func extractBtcdRPCParams(btcdConfigPath string) (string, string, error) { // First, we'll open up the btcd configuration file found at the target // destination. btcdConfigFile, err := os.Open(btcdConfigPath) if err != nil { return "", "", err } defer btcdConfigFile.Close() // With the file open extract the ...
go
func extractBtcdRPCParams(btcdConfigPath string) (string, string, error) { // First, we'll open up the btcd configuration file found at the target // destination. btcdConfigFile, err := os.Open(btcdConfigPath) if err != nil { return "", "", err } defer btcdConfigFile.Close() // With the file open extract the ...
[ "func", "extractBtcdRPCParams", "(", "btcdConfigPath", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "// First, we'll open up the btcd configuration file found at the target", "// destination.", "btcdConfigFile", ",", "err", ":=", "os", ".", "Open",...
// extractBtcdRPCParams attempts to extract the RPC credentials for an existing // btcd instance. The passed path is expected to be the location of btcd's // application data directory on the target system.
[ "extractBtcdRPCParams", "attempts", "to", "extract", "the", "RPC", "credentials", "for", "an", "existing", "btcd", "instance", ".", "The", "passed", "path", "is", "expected", "to", "be", "the", "location", "of", "btcd", "s", "application", "data", "directory", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/config.go#L1267-L1308
128,896
lightningnetwork/lnd
config.go
checkZMQOptions
func checkZMQOptions(zmqBlockHost, zmqTxHost string) error { if zmqBlockHost == zmqTxHost { return errors.New("zmqpubrawblock and zmqpubrawtx must be set" + "to different addresses") } return nil }
go
func checkZMQOptions(zmqBlockHost, zmqTxHost string) error { if zmqBlockHost == zmqTxHost { return errors.New("zmqpubrawblock and zmqpubrawtx must be set" + "to different addresses") } return nil }
[ "func", "checkZMQOptions", "(", "zmqBlockHost", ",", "zmqTxHost", "string", ")", "error", "{", "if", "zmqBlockHost", "==", "zmqTxHost", "{", "return", "errors", ".", "New", "(", "\"", "\"", "+", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", ...
// checkZMQOptions ensures that the provided addresses to use as the hosts for // ZMQ rawblock and rawtx notifications are different.
[ "checkZMQOptions", "ensures", "that", "the", "provided", "addresses", "to", "use", "as", "the", "hosts", "for", "ZMQ", "rawblock", "and", "rawtx", "notifications", "are", "different", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/config.go#L1422-L1429
128,897
lightningnetwork/lnd
queue/queue.go
NewConcurrentQueue
func NewConcurrentQueue(bufferSize int) *ConcurrentQueue { return &ConcurrentQueue{ chanIn: make(chan interface{}), chanOut: make(chan interface{}, bufferSize), overflow: list.New(), quit: make(chan struct{}), } }
go
func NewConcurrentQueue(bufferSize int) *ConcurrentQueue { return &ConcurrentQueue{ chanIn: make(chan interface{}), chanOut: make(chan interface{}, bufferSize), overflow: list.New(), quit: make(chan struct{}), } }
[ "func", "NewConcurrentQueue", "(", "bufferSize", "int", ")", "*", "ConcurrentQueue", "{", "return", "&", "ConcurrentQueue", "{", "chanIn", ":", "make", "(", "chan", "interface", "{", "}", ")", ",", "chanOut", ":", "make", "(", "chan", "interface", "{", "}"...
// NewConcurrentQueue constructs a ConcurrentQueue. The bufferSize parameter is // the capacity of the output channel. When the size of the queue is below this // threshold, pushes do not incur the overhead of the less efficient overflow // structure.
[ "NewConcurrentQueue", "constructs", "a", "ConcurrentQueue", ".", "The", "bufferSize", "parameter", "is", "the", "capacity", "of", "the", "output", "channel", ".", "When", "the", "size", "of", "the", "queue", "is", "below", "this", "threshold", "pushes", "do", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/queue/queue.go#L30-L37
128,898
lightningnetwork/lnd
queue/queue.go
Stop
func (cq *ConcurrentQueue) Stop() { if !atomic.CompareAndSwapUint32(&cq.stopped, 0, 1) { return } close(cq.quit) cq.wg.Wait() }
go
func (cq *ConcurrentQueue) Stop() { if !atomic.CompareAndSwapUint32(&cq.stopped, 0, 1) { return } close(cq.quit) cq.wg.Wait() }
[ "func", "(", "cq", "*", "ConcurrentQueue", ")", "Stop", "(", ")", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "cq", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "\n", "}", "\n\n", "close", "(", "cq", ".", "quit", "...
// Stop ends the goroutine that moves items from the in channel to the out // channel. This does not clear the queue state, so the queue can be restarted // without dropping items.
[ "Stop", "ends", "the", "goroutine", "that", "moves", "items", "from", "the", "in", "channel", "to", "the", "out", "channel", ".", "This", "does", "not", "clear", "the", "queue", "state", "so", "the", "queue", "can", "be", "restarted", "without", "dropping"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/queue/queue.go#L98-L105
128,899
lightningnetwork/lnd
lnwire/query_channel_range.go
Decode
func (q *QueryChannelRange) Decode(r io.Reader, pver uint32) error { return ReadElements(r, q.ChainHash[:], &q.FirstBlockHeight, &q.NumBlocks, ) }
go
func (q *QueryChannelRange) Decode(r io.Reader, pver uint32) error { return ReadElements(r, q.ChainHash[:], &q.FirstBlockHeight, &q.NumBlocks, ) }
[ "func", "(", "q", "*", "QueryChannelRange", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "q", ".", "ChainHash", "[", ":", "]", ",", "&", "q", ".", "FirstBlockHeight",...
// Decode deserializes a serialized QueryChannelRange message stored in the // passed io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "QueryChannelRange", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interfac...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/query_channel_range.go#L42-L48