id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
129,800
lightningnetwork/lnd
htlcswitch/circuit_map.go
decodeCircuit
func (cm *circuitMap) decodeCircuit(v []byte) (*PaymentCircuit, error) { var circuit = &PaymentCircuit{} circuitReader := bytes.NewReader(v) if err := circuit.Decode(circuitReader); err != nil { return nil, err } // If the error encrypter is nil, this is locally-source payment so // there is no encrypter. if...
go
func (cm *circuitMap) decodeCircuit(v []byte) (*PaymentCircuit, error) { var circuit = &PaymentCircuit{} circuitReader := bytes.NewReader(v) if err := circuit.Decode(circuitReader); err != nil { return nil, err } // If the error encrypter is nil, this is locally-source payment so // there is no encrypter. if...
[ "func", "(", "cm", "*", "circuitMap", ")", "decodeCircuit", "(", "v", "[", "]", "byte", ")", "(", "*", "PaymentCircuit", ",", "error", ")", "{", "var", "circuit", "=", "&", "PaymentCircuit", "{", "}", "\n\n", "circuitReader", ":=", "bytes", ".", "NewRe...
// decodeCircuit reconstructs an in-memory payment circuit from a byte slice. // The byte slice is assumed to have been generated by the circuit's Encode // method. If the decoding is successful, the onion obfuscator will be // reextracted, since it is not stored in plaintext on disk.
[ "decodeCircuit", "reconstructs", "an", "in", "-", "memory", "payment", "circuit", "from", "a", "byte", "slice", ".", "The", "byte", "slice", "is", "assumed", "to", "have", "been", "generated", "by", "the", "circuit", "s", "Encode", "method", ".", "If", "th...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L352-L376
129,801
lightningnetwork/lnd
htlcswitch/circuit_map.go
TrimOpenCircuits
func (cm *circuitMap) TrimOpenCircuits(chanID lnwire.ShortChannelID, start uint64) error { log.Infof("Trimming open circuits for chan_id=%v, start_htlc_id=%v", chanID, start) var trimmedOutKeys []CircuitKey // Scan forward from the last unacked htlc id, stopping as soon as we // don't find any more. Outgoing ...
go
func (cm *circuitMap) TrimOpenCircuits(chanID lnwire.ShortChannelID, start uint64) error { log.Infof("Trimming open circuits for chan_id=%v, start_htlc_id=%v", chanID, start) var trimmedOutKeys []CircuitKey // Scan forward from the last unacked htlc id, stopping as soon as we // don't find any more. Outgoing ...
[ "func", "(", "cm", "*", "circuitMap", ")", "TrimOpenCircuits", "(", "chanID", "lnwire", ".", "ShortChannelID", ",", "start", "uint64", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "chanID", ",", "start", ")", "\n\n", "var", "trimmedOutKe...
// TrimOpenCircuits removes a channel's keystones above the short chan id's // highest committed htlc index. This has the effect of returning those // circuits to a half-open state. Since opening of circuits is done in advance // of actually committing the Add htlcs into a commitment txn, this allows // circuits to be ...
[ "TrimOpenCircuits", "removes", "a", "channel", "s", "keystones", "above", "the", "short", "chan", "id", "s", "highest", "committed", "htlc", "index", ".", "This", "has", "the", "effect", "of", "returning", "those", "circuits", "to", "a", "half", "-", "open",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L431-L480
129,802
lightningnetwork/lnd
htlcswitch/circuit_map.go
LookupCircuit
func (cm *circuitMap) LookupCircuit(inKey CircuitKey) *PaymentCircuit { cm.mtx.RLock() defer cm.mtx.RUnlock() return cm.pending[inKey] }
go
func (cm *circuitMap) LookupCircuit(inKey CircuitKey) *PaymentCircuit { cm.mtx.RLock() defer cm.mtx.RUnlock() return cm.pending[inKey] }
[ "func", "(", "cm", "*", "circuitMap", ")", "LookupCircuit", "(", "inKey", "CircuitKey", ")", "*", "PaymentCircuit", "{", "cm", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "cm", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "return", "cm", ".",...
// LookupByHTLC looks up the payment circuit by the outgoing channel and HTLC // IDs. Returns nil if there is no such circuit.
[ "LookupByHTLC", "looks", "up", "the", "payment", "circuit", "by", "the", "outgoing", "channel", "and", "HTLC", "IDs", ".", "Returns", "nil", "if", "there", "is", "no", "such", "circuit", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L484-L489
129,803
lightningnetwork/lnd
htlcswitch/circuit_map.go
LookupOpenCircuit
func (cm *circuitMap) LookupOpenCircuit(outKey CircuitKey) *PaymentCircuit { cm.mtx.RLock() defer cm.mtx.RUnlock() return cm.opened[outKey] }
go
func (cm *circuitMap) LookupOpenCircuit(outKey CircuitKey) *PaymentCircuit { cm.mtx.RLock() defer cm.mtx.RUnlock() return cm.opened[outKey] }
[ "func", "(", "cm", "*", "circuitMap", ")", "LookupOpenCircuit", "(", "outKey", "CircuitKey", ")", "*", "PaymentCircuit", "{", "cm", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "cm", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "return", "cm", ...
// LookupOpenCircuit searches for the circuit identified by its outgoing circuit // key.
[ "LookupOpenCircuit", "searches", "for", "the", "circuit", "identified", "by", "its", "outgoing", "circuit", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L493-L498
129,804
lightningnetwork/lnd
htlcswitch/circuit_map.go
LookupByPaymentHash
func (cm *circuitMap) LookupByPaymentHash(hash [32]byte) []*PaymentCircuit { cm.mtx.RLock() defer cm.mtx.RUnlock() var circuits []*PaymentCircuit if circuitSet, ok := cm.hashIndex[hash]; ok { // Iterate over the outgoing circuit keys found with this hash, // and retrieve the circuit from the opened map. circ...
go
func (cm *circuitMap) LookupByPaymentHash(hash [32]byte) []*PaymentCircuit { cm.mtx.RLock() defer cm.mtx.RUnlock() var circuits []*PaymentCircuit if circuitSet, ok := cm.hashIndex[hash]; ok { // Iterate over the outgoing circuit keys found with this hash, // and retrieve the circuit from the opened map. circ...
[ "func", "(", "cm", "*", "circuitMap", ")", "LookupByPaymentHash", "(", "hash", "[", "32", "]", "byte", ")", "[", "]", "*", "PaymentCircuit", "{", "cm", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "cm", ".", "mtx", ".", "RUnlock", "(", ")", ...
// LookupByPaymentHash looks up and returns any payment circuits with a given // payment hash.
[ "LookupByPaymentHash", "looks", "up", "and", "returns", "any", "payment", "circuits", "with", "a", "given", "payment", "hash", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L502-L519
129,805
lightningnetwork/lnd
htlcswitch/circuit_map.go
String
func (k *Keystone) String() string { return fmt.Sprintf("%s --> %s", k.InKey, k.OutKey) }
go
func (k *Keystone) String() string { return fmt.Sprintf("%s --> %s", k.InKey, k.OutKey) }
[ "func", "(", "k", "*", "Keystone", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "k", ".", "InKey", ",", "k", ".", "OutKey", ")", "\n", "}" ]
// String returns a human readable description of the Keystone.
[ "String", "returns", "a", "human", "readable", "description", "of", "the", "Keystone", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L671-L673
129,806
lightningnetwork/lnd
htlcswitch/circuit_map.go
OpenCircuits
func (cm *circuitMap) OpenCircuits(keystones ...Keystone) error { if len(keystones) == 0 { return nil } log.Tracef("Opening finalized circuits: %v", newLogClosure(func() string { return spew.Sdump(keystones) })) // Check that all keystones correspond to committed-but-unopened // circuits. cm.mtx.RLock() o...
go
func (cm *circuitMap) OpenCircuits(keystones ...Keystone) error { if len(keystones) == 0 { return nil } log.Tracef("Opening finalized circuits: %v", newLogClosure(func() string { return spew.Sdump(keystones) })) // Check that all keystones correspond to committed-but-unopened // circuits. cm.mtx.RLock() o...
[ "func", "(", "cm", "*", "circuitMap", ")", "OpenCircuits", "(", "keystones", "...", "Keystone", ")", "error", "{", "if", "len", "(", "keystones", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Tracef", "(", "\"", "\"", ",", "...
// OpenCircuits sets the outgoing circuit key for the circuit identified by // inKey, persistently marking the circuit as opened. After the changes have // been persisted, the circuit map's in-memory indexes are updated so that this // circuit can be queried using LookupByKeystone or LookupByPaymentHash.
[ "OpenCircuits", "sets", "the", "outgoing", "circuit", "key", "for", "the", "circuit", "identified", "by", "inKey", "persistently", "marking", "the", "circuit", "as", "opened", ".", "After", "the", "changes", "have", "been", "persisted", "the", "circuit", "map", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L679-L750
129,807
lightningnetwork/lnd
htlcswitch/circuit_map.go
addCircuitToHashIndex
func (cm *circuitMap) addCircuitToHashIndex(c *PaymentCircuit) { if _, ok := cm.hashIndex[c.PaymentHash]; !ok { cm.hashIndex[c.PaymentHash] = make(map[CircuitKey]struct{}) } cm.hashIndex[c.PaymentHash][c.OutKey()] = struct{}{} }
go
func (cm *circuitMap) addCircuitToHashIndex(c *PaymentCircuit) { if _, ok := cm.hashIndex[c.PaymentHash]; !ok { cm.hashIndex[c.PaymentHash] = make(map[CircuitKey]struct{}) } cm.hashIndex[c.PaymentHash][c.OutKey()] = struct{}{} }
[ "func", "(", "cm", "*", "circuitMap", ")", "addCircuitToHashIndex", "(", "c", "*", "PaymentCircuit", ")", "{", "if", "_", ",", "ok", ":=", "cm", ".", "hashIndex", "[", "c", ".", "PaymentHash", "]", ";", "!", "ok", "{", "cm", ".", "hashIndex", "[", ...
// addCirciutToHashIndex inserts a circuit into the circuit map's hash index, so // that it can be queried using LookupByPaymentHash.
[ "addCirciutToHashIndex", "inserts", "a", "circuit", "into", "the", "circuit", "map", "s", "hash", "index", "so", "that", "it", "can", "be", "queried", "using", "LookupByPaymentHash", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L754-L759
129,808
lightningnetwork/lnd
htlcswitch/circuit_map.go
DeleteCircuits
func (cm *circuitMap) DeleteCircuits(inKeys ...CircuitKey) error { log.Tracef("Deleting resolved circuits: %v", newLogClosure(func() string { return spew.Sdump(inKeys) })) var ( closingCircuits = make(map[CircuitKey]struct{}) removedCircuits = make(map[CircuitKey]*PaymentCircuit) ) cm.mtx.Lock() // Remov...
go
func (cm *circuitMap) DeleteCircuits(inKeys ...CircuitKey) error { log.Tracef("Deleting resolved circuits: %v", newLogClosure(func() string { return spew.Sdump(inKeys) })) var ( closingCircuits = make(map[CircuitKey]struct{}) removedCircuits = make(map[CircuitKey]*PaymentCircuit) ) cm.mtx.Lock() // Remov...
[ "func", "(", "cm", "*", "circuitMap", ")", "DeleteCircuits", "(", "inKeys", "...", "CircuitKey", ")", "error", "{", "log", ".", "Tracef", "(", "\"", "\"", ",", "newLogClosure", "(", "func", "(", ")", "string", "{", "return", "spew", ".", "Sdump", "(", ...
// DeleteCircuits destroys the target circuits by removing them from the circuit // map, additionally removing the circuits' keystones if any HTLCs were // forwarded through an outgoing link. The circuits should be identified by its // incoming circuit key. If a given circuit is not found in the circuit map, it // will...
[ "DeleteCircuits", "destroys", "the", "target", "circuits", "by", "removing", "them", "from", "the", "circuit", "map", "additionally", "removing", "the", "circuits", "keystones", "if", "any", "HTLCs", "were", "forwarded", "through", "an", "outgoing", "link", ".", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L812-L907
129,809
lightningnetwork/lnd
htlcswitch/circuit_map.go
removeCircuitFromHashIndex
func (cm *circuitMap) removeCircuitFromHashIndex(c *PaymentCircuit) { // Locate bucket containing this circuit's payment hashes. circuitsWithHash, ok := cm.hashIndex[c.PaymentHash] if !ok { return } outKey := c.OutKey() // Remove this circuit from the set of circuitsWithHash. delete(circuitsWithHash, outKey)...
go
func (cm *circuitMap) removeCircuitFromHashIndex(c *PaymentCircuit) { // Locate bucket containing this circuit's payment hashes. circuitsWithHash, ok := cm.hashIndex[c.PaymentHash] if !ok { return } outKey := c.OutKey() // Remove this circuit from the set of circuitsWithHash. delete(circuitsWithHash, outKey)...
[ "func", "(", "cm", "*", "circuitMap", ")", "removeCircuitFromHashIndex", "(", "c", "*", "PaymentCircuit", ")", "{", "// Locate bucket containing this circuit's payment hashes.", "circuitsWithHash", ",", "ok", ":=", "cm", ".", "hashIndex", "[", "c", ".", "PaymentHash",...
// removeCircuitFromHashIndex removes the given circuit from the hash index, // pruning any unnecessary memory optimistically.
[ "removeCircuitFromHashIndex", "removes", "the", "given", "circuit", "from", "the", "hash", "index", "pruning", "any", "unnecessary", "memory", "optimistically", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L911-L927
129,810
lightningnetwork/lnd
htlcswitch/circuit_map.go
NumPending
func (cm *circuitMap) NumPending() int { cm.mtx.RLock() defer cm.mtx.RUnlock() return len(cm.pending) }
go
func (cm *circuitMap) NumPending() int { cm.mtx.RLock() defer cm.mtx.RUnlock() return len(cm.pending) }
[ "func", "(", "cm", "*", "circuitMap", ")", "NumPending", "(", ")", "int", "{", "cm", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "cm", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "return", "len", "(", "cm", ".", "pending", ")", "\n", "...
// NumPending returns the number of active circuits added to the circuit map.
[ "NumPending", "returns", "the", "number", "of", "active", "circuits", "added", "to", "the", "circuit", "map", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L930-L935
129,811
lightningnetwork/lnd
routing/chainview/queue.go
newBlockEventQueue
func newBlockEventQueue() *blockEventQueue { b := &blockEventQueue{ newBlocks: make(chan *FilteredBlock), staleBlocks: make(chan *FilteredBlock), quit: make(chan struct{}), } b.queueCond = sync.NewCond(&b.queueMtx) return b }
go
func newBlockEventQueue() *blockEventQueue { b := &blockEventQueue{ newBlocks: make(chan *FilteredBlock), staleBlocks: make(chan *FilteredBlock), quit: make(chan struct{}), } b.queueCond = sync.NewCond(&b.queueMtx) return b }
[ "func", "newBlockEventQueue", "(", ")", "*", "blockEventQueue", "{", "b", ":=", "&", "blockEventQueue", "{", "newBlocks", ":", "make", "(", "chan", "*", "FilteredBlock", ")", ",", "staleBlocks", ":", "make", "(", "chan", "*", "FilteredBlock", ")", ",", "qu...
// newBlockEventQueue creates a new blockEventQueue.
[ "newBlockEventQueue", "creates", "a", "new", "blockEventQueue", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/chainview/queue.go#L51-L60
129,812
lightningnetwork/lnd
watchtower/wtwire/summary.go
MessageSummary
func MessageSummary(msg Message) string { switch msg := msg.(type) { case *Init: return "" case *CreateSession: return fmt.Sprintf("blob_type=%s, max_updates=%d "+ "reward_base=%d reward_rate=%d sweep_fee_rate=%d", msg.BlobType, msg.MaxUpdates, msg.RewardBase, msg.RewardRate, msg.SweepFeeRate) case *...
go
func MessageSummary(msg Message) string { switch msg := msg.(type) { case *Init: return "" case *CreateSession: return fmt.Sprintf("blob_type=%s, max_updates=%d "+ "reward_base=%d reward_rate=%d sweep_fee_rate=%d", msg.BlobType, msg.MaxUpdates, msg.RewardBase, msg.RewardRate, msg.SweepFeeRate) case *...
[ "func", "MessageSummary", "(", "msg", "Message", ")", "string", "{", "switch", "msg", ":=", "msg", ".", "(", "type", ")", "{", "case", "*", "Init", ":", "return", "\"", "\"", "\n\n", "case", "*", "CreateSession", ":", "return", "fmt", ".", "Sprintf", ...
// MessageSummary creates a human-readable description of a given Message. If // the type is unknown, an empty string is returned.
[ "MessageSummary", "creates", "a", "human", "-", "readable", "description", "of", "a", "given", "Message", ".", "If", "the", "type", "is", "unknown", "an", "empty", "string", "is", "returned", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/summary.go#L7-L36
129,813
lightningnetwork/lnd
mock.go
Spend
func (m *mockSpendNotifier) Spend(outpoint *wire.OutPoint, height int32, txn *wire.MsgTx) { m.mtx.Lock() defer m.mtx.Unlock() txnHash := txn.TxHash() details := &chainntnfs.SpendDetail{ SpentOutPoint: outpoint, SpendingHeight: height, SpendingTx: txn, SpenderTxHash: &txnHash, SpenderIn...
go
func (m *mockSpendNotifier) Spend(outpoint *wire.OutPoint, height int32, txn *wire.MsgTx) { m.mtx.Lock() defer m.mtx.Unlock() txnHash := txn.TxHash() details := &chainntnfs.SpendDetail{ SpentOutPoint: outpoint, SpendingHeight: height, SpendingTx: txn, SpenderTxHash: &txnHash, SpenderIn...
[ "func", "(", "m", "*", "mockSpendNotifier", ")", "Spend", "(", "outpoint", "*", "wire", ".", "OutPoint", ",", "height", "int32", ",", "txn", "*", "wire", ".", "MsgTx", ")", "{", "m", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mt...
// Spend dispatches SpendDetails to all subscribers of the outpoint. The details // will include the transaction and height provided by the caller.
[ "Spend", "dispatches", "SpendDetails", "to", "all", "subscribers", "of", "the", "outpoint", ".", "The", "details", "will", "include", "the", "transaction", "and", "height", "provided", "by", "the", "caller", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/mock.go#L170-L202
129,814
lightningnetwork/lnd
mock.go
FetchInputInfo
func (*mockWalletController) FetchInputInfo( prevOut *wire.OutPoint) (*wire.TxOut, error) { txOut := &wire.TxOut{ Value: int64(10 * btcutil.SatoshiPerBitcoin), PkScript: []byte("dummy"), } return txOut, nil }
go
func (*mockWalletController) FetchInputInfo( prevOut *wire.OutPoint) (*wire.TxOut, error) { txOut := &wire.TxOut{ Value: int64(10 * btcutil.SatoshiPerBitcoin), PkScript: []byte("dummy"), } return txOut, nil }
[ "func", "(", "*", "mockWalletController", ")", "FetchInputInfo", "(", "prevOut", "*", "wire", ".", "OutPoint", ")", "(", "*", "wire", ".", "TxOut", ",", "error", ")", "{", "txOut", ":=", "&", "wire", ".", "TxOut", "{", "Value", ":", "int64", "(", "10...
// FetchInputInfo will be called to get info about the inputs to the funding // transaction.
[ "FetchInputInfo", "will", "be", "called", "to", "get", "info", "about", "the", "inputs", "to", "the", "funding", "transaction", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/mock.go#L241-L248
129,815
lightningnetwork/lnd
mock.go
NewAddress
func (m *mockWalletController) NewAddress(addrType lnwallet.AddressType, change bool) (btcutil.Address, error) { addr, _ := btcutil.NewAddressPubKey( m.rootKey.PubKey().SerializeCompressed(), &chaincfg.MainNetParams) return addr, nil }
go
func (m *mockWalletController) NewAddress(addrType lnwallet.AddressType, change bool) (btcutil.Address, error) { addr, _ := btcutil.NewAddressPubKey( m.rootKey.PubKey().SerializeCompressed(), &chaincfg.MainNetParams) return addr, nil }
[ "func", "(", "m", "*", "mockWalletController", ")", "NewAddress", "(", "addrType", "lnwallet", ".", "AddressType", ",", "change", "bool", ")", "(", "btcutil", ".", "Address", ",", "error", ")", "{", "addr", ",", "_", ":=", "btcutil", ".", "NewAddressPubKey...
// NewAddress is called to get new addresses for delivery, change etc.
[ "NewAddress", "is", "called", "to", "get", "new", "addresses", "for", "delivery", "change", "etc", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/mock.go#L254-L259
129,816
lightningnetwork/lnd
mock.go
ListUnspentWitness
func (m *mockWalletController) ListUnspentWitness(minconfirms, maxconfirms int32) ([]*lnwallet.Utxo, error) { utxo := &lnwallet.Utxo{ AddressType: lnwallet.WitnessPubKey, Value: btcutil.Amount(10 * btcutil.SatoshiPerBitcoin), PkScript: make([]byte, 22), OutPoint: wire.OutPoint{ Hash: chainhash.Ha...
go
func (m *mockWalletController) ListUnspentWitness(minconfirms, maxconfirms int32) ([]*lnwallet.Utxo, error) { utxo := &lnwallet.Utxo{ AddressType: lnwallet.WitnessPubKey, Value: btcutil.Amount(10 * btcutil.SatoshiPerBitcoin), PkScript: make([]byte, 22), OutPoint: wire.OutPoint{ Hash: chainhash.Ha...
[ "func", "(", "m", "*", "mockWalletController", ")", "ListUnspentWitness", "(", "minconfirms", ",", "maxconfirms", "int32", ")", "(", "[", "]", "*", "lnwallet", ".", "Utxo", ",", "error", ")", "{", "utxo", ":=", "&", "lnwallet", ".", "Utxo", "{", "Address...
// ListUnspentWitness is called by the wallet when doing coin selection. We just // need one unspent for the funding transaction.
[ "ListUnspentWitness", "is", "called", "by", "the", "wallet", "when", "doing", "coin", "selection", ".", "We", "just", "need", "one", "unspent", "for", "the", "funding", "transaction", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/mock.go#L283-L298
129,817
lightningnetwork/lnd
watchtower/wtwire/create_session.go
Decode
func (m *CreateSession) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &m.BlobType, &m.MaxUpdates, &m.RewardBase, &m.RewardRate, &m.SweepFeeRate, ) }
go
func (m *CreateSession) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &m.BlobType, &m.MaxUpdates, &m.RewardBase, &m.RewardRate, &m.SweepFeeRate, ) }
[ "func", "(", "m", "*", "CreateSession", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "m", ".", "BlobType", ",", "&", "m", ".", "MaxUpdates", ",", "&", "m", "...
// Decode deserializes a serialized CreateSession message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "CreateSession", "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/create_session.go#L48-L56
129,818
lightningnetwork/lnd
watchtower/wtwire/create_session.go
Encode
func (m *CreateSession) Encode(w io.Writer, pver uint32) error { return WriteElements(w, m.BlobType, m.MaxUpdates, m.RewardBase, m.RewardRate, m.SweepFeeRate, ) }
go
func (m *CreateSession) Encode(w io.Writer, pver uint32) error { return WriteElements(w, m.BlobType, m.MaxUpdates, m.RewardBase, m.RewardRate, m.SweepFeeRate, ) }
[ "func", "(", "m", "*", "CreateSession", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "m", ".", "BlobType", ",", "m", ".", "MaxUpdates", ",", "m", ".", "RewardBase", ...
// Encode serializes the target CreateSession into the passed io.Writer // observing the protocol version specified. // // This is part of the wtwire.Message interface.
[ "Encode", "serializes", "the", "target", "CreateSession", "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/create_session.go#L62-L70
129,819
lightningnetwork/lnd
routing/errors.go
newErr
func newErr(code errorCode, a interface{}) *routerError { return &routerError{ code: code, err: errors.New(a), } }
go
func newErr(code errorCode, a interface{}) *routerError { return &routerError{ code: code, err: errors.New(a), } }
[ "func", "newErr", "(", "code", "errorCode", ",", "a", "interface", "{", "}", ")", "*", "routerError", "{", "return", "&", "routerError", "{", "code", ":", "code", ",", "err", ":", "errors", ".", "New", "(", "a", ")", ",", "}", "\n", "}" ]
// newErr creates a routerError by the given error description and its // corresponding error code.
[ "newErr", "creates", "a", "routerError", "by", "the", "given", "error", "description", "and", "its", "corresponding", "error", "code", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/errors.go#L75-L80
129,820
lightningnetwork/lnd
routing/errors.go
newErrf
func newErrf(code errorCode, format string, a ...interface{}) *routerError { return &routerError{ code: code, err: errors.Errorf(format, a...), } }
go
func newErrf(code errorCode, format string, a ...interface{}) *routerError { return &routerError{ code: code, err: errors.Errorf(format, a...), } }
[ "func", "newErrf", "(", "code", "errorCode", ",", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "*", "routerError", "{", "return", "&", "routerError", "{", "code", ":", "code", ",", "err", ":", "errors", ".", "Errorf", "(", "format",...
// newErrf creates a routerError by the given error formatted description and // its corresponding error code.
[ "newErrf", "creates", "a", "routerError", "by", "the", "given", "error", "formatted", "description", "and", "its", "corresponding", "error", "code", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/errors.go#L84-L89
129,821
lightningnetwork/lnd
routing/errors.go
IsError
func IsError(e interface{}, codes ...errorCode) bool { err, ok := e.(*routerError) if !ok { return false } for _, code := range codes { if err.code == code { return true } } return false }
go
func IsError(e interface{}, codes ...errorCode) bool { err, ok := e.(*routerError) if !ok { return false } for _, code := range codes { if err.code == code { return true } } return false }
[ "func", "IsError", "(", "e", "interface", "{", "}", ",", "codes", "...", "errorCode", ")", "bool", "{", "err", ",", "ok", ":=", "e", ".", "(", "*", "routerError", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n\n", "for", "_", ...
// IsError is a helper function which is needed to have ability to check that // returned error has specific error code.
[ "IsError", "is", "a", "helper", "function", "which", "is", "needed", "to", "have", "ability", "to", "check", "that", "returned", "error", "has", "specific", "error", "code", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/errors.go#L93-L106
129,822
lightningnetwork/lnd
lncfg/interface.go
Validate
func Validate(validators ...Validator) error { for _, validator := range validators { if err := validator.Validate(); err != nil { return err } } return nil }
go
func Validate(validators ...Validator) error { for _, validator := range validators { if err := validator.Validate(); err != nil { return err } } return nil }
[ "func", "Validate", "(", "validators", "...", "Validator", ")", "error", "{", "for", "_", ",", "validator", ":=", "range", "validators", "{", "if", "err", ":=", "validator", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n"...
// Validate accepts a variadic list of Validators and checks that each one // passes its Validate method. An error is returned from the first Validator // that fails.
[ "Validate", "accepts", "a", "variadic", "list", "of", "Validators", "and", "checks", "that", "each", "one", "passes", "its", "Validate", "method", ".", "An", "error", "is", "returned", "from", "the", "first", "Validator", "that", "fails", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lncfg/interface.go#L13-L21
129,823
lightningnetwork/lnd
pool/write_buffer.go
NewWriteBuffer
func NewWriteBuffer(gcInterval, expiryInterval time.Duration) *WriteBuffer { return &WriteBuffer{ pool: NewRecycle( func() interface{} { return new(buffer.Write) }, 100, gcInterval, expiryInterval, ), } }
go
func NewWriteBuffer(gcInterval, expiryInterval time.Duration) *WriteBuffer { return &WriteBuffer{ pool: NewRecycle( func() interface{} { return new(buffer.Write) }, 100, gcInterval, expiryInterval, ), } }
[ "func", "NewWriteBuffer", "(", "gcInterval", ",", "expiryInterval", "time", ".", "Duration", ")", "*", "WriteBuffer", "{", "return", "&", "WriteBuffer", "{", "pool", ":", "NewRecycle", "(", "func", "(", ")", "interface", "{", "}", "{", "return", "new", "("...
// NewWriteBuffer returns a freshly instantiated WriteBuffer, using the given // gcInterval and expiryIntervals.
[ "NewWriteBuffer", "returns", "a", "freshly", "instantiated", "WriteBuffer", "using", "the", "given", "gcInterval", "and", "expiryIntervals", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write_buffer.go#L30-L37
129,824
lightningnetwork/lnd
pool/write_buffer.go
Take
func (p *WriteBuffer) Take() *buffer.Write { return p.pool.Take().(*buffer.Write) }
go
func (p *WriteBuffer) Take() *buffer.Write { return p.pool.Take().(*buffer.Write) }
[ "func", "(", "p", "*", "WriteBuffer", ")", "Take", "(", ")", "*", "buffer", ".", "Write", "{", "return", "p", ".", "pool", ".", "Take", "(", ")", ".", "(", "*", "buffer", ".", "Write", ")", "\n", "}" ]
// Take returns a fresh buffer.Write to the caller.
[ "Take", "returns", "a", "fresh", "buffer", ".", "Write", "to", "the", "caller", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write_buffer.go#L40-L42
129,825
lightningnetwork/lnd
pool/write_buffer.go
Return
func (p *WriteBuffer) Return(buf *buffer.Write) { p.pool.Return(buf) }
go
func (p *WriteBuffer) Return(buf *buffer.Write) { p.pool.Return(buf) }
[ "func", "(", "p", "*", "WriteBuffer", ")", "Return", "(", "buf", "*", "buffer", ".", "Write", ")", "{", "p", ".", "pool", ".", "Return", "(", "buf", ")", "\n", "}" ]
// Return returns the buffer.Write to the pool, so that it can be recycled or // released.
[ "Return", "returns", "the", "buffer", ".", "Write", "to", "the", "pool", "so", "that", "it", "can", "be", "recycled", "or", "released", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write_buffer.go#L46-L48
129,826
lightningnetwork/lnd
lnwire/features.go
NewRawFeatureVector
func NewRawFeatureVector(bits ...FeatureBit) *RawFeatureVector { fv := &RawFeatureVector{features: make(map[FeatureBit]bool)} for _, bit := range bits { fv.Set(bit) } return fv }
go
func NewRawFeatureVector(bits ...FeatureBit) *RawFeatureVector { fv := &RawFeatureVector{features: make(map[FeatureBit]bool)} for _, bit := range bits { fv.Set(bit) } return fv }
[ "func", "NewRawFeatureVector", "(", "bits", "...", "FeatureBit", ")", "*", "RawFeatureVector", "{", "fv", ":=", "&", "RawFeatureVector", "{", "features", ":", "make", "(", "map", "[", "FeatureBit", "]", "bool", ")", "}", "\n", "for", "_", ",", "bit", ":=...
// NewRawFeatureVector creates a feature vector with all of the feature bits // given as arguments enabled.
[ "NewRawFeatureVector", "creates", "a", "feature", "vector", "with", "all", "of", "the", "feature", "bits", "given", "as", "arguments", "enabled", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L92-L98
129,827
lightningnetwork/lnd
lnwire/features.go
SerializeSize
func (fv *RawFeatureVector) SerializeSize() int { // Find the largest feature bit index max := -1 for feature := range fv.features { index := int(feature) if index > max { max = index } } if max == -1 { return 0 } // We calculate byte-length via the largest bit index return max/8 + 1 }
go
func (fv *RawFeatureVector) SerializeSize() int { // Find the largest feature bit index max := -1 for feature := range fv.features { index := int(feature) if index > max { max = index } } if max == -1 { return 0 } // We calculate byte-length via the largest bit index return max/8 + 1 }
[ "func", "(", "fv", "*", "RawFeatureVector", ")", "SerializeSize", "(", ")", "int", "{", "// Find the largest feature bit index", "max", ":=", "-", "1", "\n", "for", "feature", ":=", "range", "fv", ".", "features", "{", "index", ":=", "int", "(", "feature", ...
// SerializeSize returns the number of bytes needed to represent feature vector // in byte format.
[ "SerializeSize", "returns", "the", "number", "of", "bytes", "needed", "to", "represent", "feature", "vector", "in", "byte", "format", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L117-L132
129,828
lightningnetwork/lnd
lnwire/features.go
Encode
func (fv *RawFeatureVector) Encode(w io.Writer) error { // Write length of feature vector. var l [2]byte length := fv.SerializeSize() binary.BigEndian.PutUint16(l[:], uint16(length)) if _, err := w.Write(l[:]); err != nil { return err } // Generate the data and write it. data := make([]byte, length) for fea...
go
func (fv *RawFeatureVector) Encode(w io.Writer) error { // Write length of feature vector. var l [2]byte length := fv.SerializeSize() binary.BigEndian.PutUint16(l[:], uint16(length)) if _, err := w.Write(l[:]); err != nil { return err } // Generate the data and write it. data := make([]byte, length) for fea...
[ "func", "(", "fv", "*", "RawFeatureVector", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "// Write length of feature vector.", "var", "l", "[", "2", "]", "byte", "\n", "length", ":=", "fv", ".", "SerializeSize", "(", ")", "\n", "binar...
// Encode writes the feature vector in byte representation. Every feature // encoded as a bit, and the bit vector is serialized using the least number of // bytes. Since the bit vector length is variable, the first two bytes of the // serialization represent the length.
[ "Encode", "writes", "the", "feature", "vector", "in", "byte", "representation", ".", "Every", "feature", "encoded", "as", "a", "bit", "and", "the", "bit", "vector", "is", "serialized", "using", "the", "least", "number", "of", "bytes", ".", "Since", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L138-L157
129,829
lightningnetwork/lnd
lnwire/features.go
Decode
func (fv *RawFeatureVector) Decode(r io.Reader) error { // Read the length of the feature vector. var l [2]byte if _, err := io.ReadFull(r, l[:]); err != nil { return err } length := binary.BigEndian.Uint16(l[:]) // Read the feature vector data. data := make([]byte, length) if _, err := io.ReadFull(r, data);...
go
func (fv *RawFeatureVector) Decode(r io.Reader) error { // Read the length of the feature vector. var l [2]byte if _, err := io.ReadFull(r, l[:]); err != nil { return err } length := binary.BigEndian.Uint16(l[:]) // Read the feature vector data. data := make([]byte, length) if _, err := io.ReadFull(r, data);...
[ "func", "(", "fv", "*", "RawFeatureVector", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "// Read the length of the feature vector.", "var", "l", "[", "2", "]", "byte", "\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", ...
// Decode reads the feature vector from its byte representation. Every feature // encoded as a bit, and the bit vector is serialized using the least number of // bytes. Since the bit vector length is variable, the first two bytes of the // serialization represent the length.
[ "Decode", "reads", "the", "feature", "vector", "from", "its", "byte", "representation", ".", "Every", "feature", "encoded", "as", "a", "bit", "and", "the", "bit", "vector", "is", "serialized", "using", "the", "least", "number", "of", "bytes", ".", "Since", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L163-L188
129,830
lightningnetwork/lnd
lnwire/features.go
NewFeatureVector
func NewFeatureVector(featureVector *RawFeatureVector, featureNames map[FeatureBit]string) *FeatureVector { if featureVector == nil { featureVector = NewRawFeatureVector() } return &FeatureVector{ RawFeatureVector: featureVector, featureNames: featureNames, } }
go
func NewFeatureVector(featureVector *RawFeatureVector, featureNames map[FeatureBit]string) *FeatureVector { if featureVector == nil { featureVector = NewRawFeatureVector() } return &FeatureVector{ RawFeatureVector: featureVector, featureNames: featureNames, } }
[ "func", "NewFeatureVector", "(", "featureVector", "*", "RawFeatureVector", ",", "featureNames", "map", "[", "FeatureBit", "]", "string", ")", "*", "FeatureVector", "{", "if", "featureVector", "==", "nil", "{", "featureVector", "=", "NewRawFeatureVector", "(", ")",...
// NewFeatureVector constructs a new FeatureVector from a raw feature vector // and mapping of feature definitions. If the feature vector argument is nil, a // new one will be constructed with no enabled features.
[ "NewFeatureVector", "constructs", "a", "new", "FeatureVector", "from", "a", "raw", "feature", "vector", "and", "mapping", "of", "feature", "definitions", ".", "If", "the", "feature", "vector", "argument", "is", "nil", "a", "new", "one", "will", "be", "construc...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L202-L212
129,831
lightningnetwork/lnd
lnwire/features.go
UnknownRequiredFeatures
func (fv *FeatureVector) UnknownRequiredFeatures() []FeatureBit { var unknown []FeatureBit for feature := range fv.features { if feature%2 == 0 && !fv.IsKnown(feature) { unknown = append(unknown, feature) } } return unknown }
go
func (fv *FeatureVector) UnknownRequiredFeatures() []FeatureBit { var unknown []FeatureBit for feature := range fv.features { if feature%2 == 0 && !fv.IsKnown(feature) { unknown = append(unknown, feature) } } return unknown }
[ "func", "(", "fv", "*", "FeatureVector", ")", "UnknownRequiredFeatures", "(", ")", "[", "]", "FeatureBit", "{", "var", "unknown", "[", "]", "FeatureBit", "\n", "for", "feature", ":=", "range", "fv", ".", "features", "{", "if", "feature", "%", "2", "==", ...
// UnknownRequiredFeatures returns a list of feature bits set in the vector // that are unknown and in an even bit position. Feature bits with an even // index must be known to a node receiving the feature vector in a message.
[ "UnknownRequiredFeatures", "returns", "a", "list", "of", "feature", "bits", "set", "in", "the", "vector", "that", "are", "unknown", "and", "in", "an", "even", "bit", "position", ".", "Feature", "bits", "with", "an", "even", "index", "must", "be", "known", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L227-L235
129,832
lightningnetwork/lnd
lnwire/features.go
Name
func (fv *FeatureVector) Name(bit FeatureBit) string { name, known := fv.featureNames[bit] if !known { name = "unknown" } return fmt.Sprintf("%s(%d)", name, bit) }
go
func (fv *FeatureVector) Name(bit FeatureBit) string { name, known := fv.featureNames[bit] if !known { name = "unknown" } return fmt.Sprintf("%s(%d)", name, bit) }
[ "func", "(", "fv", "*", "FeatureVector", ")", "Name", "(", "bit", "FeatureBit", ")", "string", "{", "name", ",", "known", ":=", "fv", ".", "featureNames", "[", "bit", "]", "\n", "if", "!", "known", "{", "name", "=", "\"", "\"", "\n", "}", "\n", "...
// Name returns a string identifier for the feature represented by this bit. If // the bit does not represent a known feature, this returns a string indicating // as much.
[ "Name", "returns", "a", "string", "identifier", "for", "the", "feature", "represented", "by", "this", "bit", ".", "If", "the", "bit", "does", "not", "represent", "a", "known", "feature", "this", "returns", "a", "string", "indicating", "as", "much", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L240-L246
129,833
lightningnetwork/lnd
lnwire/features.go
IsKnown
func (fv *FeatureVector) IsKnown(bit FeatureBit) bool { _, known := fv.featureNames[bit] return known }
go
func (fv *FeatureVector) IsKnown(bit FeatureBit) bool { _, known := fv.featureNames[bit] return known }
[ "func", "(", "fv", "*", "FeatureVector", ")", "IsKnown", "(", "bit", "FeatureBit", ")", "bool", "{", "_", ",", "known", ":=", "fv", ".", "featureNames", "[", "bit", "]", "\n", "return", "known", "\n", "}" ]
// IsKnown returns whether this feature bit represents a known feature.
[ "IsKnown", "returns", "whether", "this", "feature", "bit", "represents", "a", "known", "feature", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/features.go#L249-L252
129,834
lightningnetwork/lnd
channeldb/invoices.go
LookupInvoice
func (d *DB) LookupInvoice(paymentHash [32]byte) (Invoice, error) { var invoice Invoice err := d.View(func(tx *bbolt.Tx) error { invoices := tx.Bucket(invoiceBucket) if invoices == nil { return ErrNoInvoicesCreated } invoiceIndex := invoices.Bucket(invoiceIndexBucket) if invoiceIndex == nil { return E...
go
func (d *DB) LookupInvoice(paymentHash [32]byte) (Invoice, error) { var invoice Invoice err := d.View(func(tx *bbolt.Tx) error { invoices := tx.Bucket(invoiceBucket) if invoices == nil { return ErrNoInvoicesCreated } invoiceIndex := invoices.Bucket(invoiceIndexBucket) if invoiceIndex == nil { return E...
[ "func", "(", "d", "*", "DB", ")", "LookupInvoice", "(", "paymentHash", "[", "32", "]", "byte", ")", "(", "Invoice", ",", "error", ")", "{", "var", "invoice", "Invoice", "\n", "err", ":=", "d", ".", "View", "(", "func", "(", "tx", "*", "bbolt", "....
// LookupInvoice attempts to look up an invoice according to its 32 byte // payment hash. If an invoice which can settle the HTLC identified by the // passed payment hash isn't found, then an error is returned. Otherwise, the // full invoice is returned. Before setting the incoming HTLC, the values // SHOULD be checked...
[ "LookupInvoice", "attempts", "to", "look", "up", "an", "invoice", "according", "to", "its", "32", "byte", "payment", "hash", ".", "If", "an", "invoice", "which", "can", "settle", "the", "HTLC", "identified", "by", "the", "passed", "payment", "hash", "isn", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/invoices.go#L376-L410
129,835
lightningnetwork/lnd
channeldb/invoices.go
FetchAllInvoices
func (d *DB) FetchAllInvoices(pendingOnly bool) ([]Invoice, error) { var invoices []Invoice err := d.View(func(tx *bbolt.Tx) error { invoiceB := tx.Bucket(invoiceBucket) if invoiceB == nil { return ErrNoInvoicesCreated } // Iterate through the entire key space of the top-level // invoice bucket. If key...
go
func (d *DB) FetchAllInvoices(pendingOnly bool) ([]Invoice, error) { var invoices []Invoice err := d.View(func(tx *bbolt.Tx) error { invoiceB := tx.Bucket(invoiceBucket) if invoiceB == nil { return ErrNoInvoicesCreated } // Iterate through the entire key space of the top-level // invoice bucket. If key...
[ "func", "(", "d", "*", "DB", ")", "FetchAllInvoices", "(", "pendingOnly", "bool", ")", "(", "[", "]", "Invoice", ",", "error", ")", "{", "var", "invoices", "[", "]", "Invoice", "\n\n", "err", ":=", "d", ".", "View", "(", "func", "(", "tx", "*", "...
// FetchAllInvoices returns all invoices currently stored within the database. // If the pendingOnly param is true, then only unsettled invoices will be // returned, skipping all invoices that are fully settled.
[ "FetchAllInvoices", "returns", "all", "invoices", "currently", "stored", "within", "the", "database", ".", "If", "the", "pendingOnly", "param", "is", "true", "then", "only", "unsettled", "invoices", "will", "be", "returned", "skipping", "all", "invoices", "that", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/invoices.go#L415-L454
129,836
lightningnetwork/lnd
channeldb/invoices.go
QueryInvoices
func (d *DB) QueryInvoices(q InvoiceQuery) (InvoiceSlice, error) { resp := InvoiceSlice{ InvoiceQuery: q, } err := d.View(func(tx *bbolt.Tx) error { // If the bucket wasn't found, then there aren't any invoices // within the database yet, so we can simply exit. invoices := tx.Bucket(invoiceBucket) if invo...
go
func (d *DB) QueryInvoices(q InvoiceQuery) (InvoiceSlice, error) { resp := InvoiceSlice{ InvoiceQuery: q, } err := d.View(func(tx *bbolt.Tx) error { // If the bucket wasn't found, then there aren't any invoices // within the database yet, so we can simply exit. invoices := tx.Bucket(invoiceBucket) if invo...
[ "func", "(", "d", "*", "DB", ")", "QueryInvoices", "(", "q", "InvoiceQuery", ")", "(", "InvoiceSlice", ",", "error", ")", "{", "resp", ":=", "InvoiceSlice", "{", "InvoiceQuery", ":", "q", ",", "}", "\n\n", "err", ":=", "d", ".", "View", "(", "func", ...
// QueryInvoices allows a caller to query the invoice database for invoices // within the specified add index range.
[ "QueryInvoices", "allows", "a", "caller", "to", "query", "the", "invoice", "database", "for", "invoices", "within", "the", "specified", "add", "index", "range", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/invoices.go#L504-L625
129,837
lightningnetwork/lnd
channeldb/invoices.go
SettleHoldInvoice
func (d *DB) SettleHoldInvoice(preimage lntypes.Preimage) (*Invoice, error) { var updatedInvoice *Invoice hash := preimage.Hash() err := d.Update(func(tx *bbolt.Tx) error { invoices, err := tx.CreateBucketIfNotExists(invoiceBucket) if err != nil { return err } invoiceIndex, err := invoices.CreateBucketIfN...
go
func (d *DB) SettleHoldInvoice(preimage lntypes.Preimage) (*Invoice, error) { var updatedInvoice *Invoice hash := preimage.Hash() err := d.Update(func(tx *bbolt.Tx) error { invoices, err := tx.CreateBucketIfNotExists(invoiceBucket) if err != nil { return err } invoiceIndex, err := invoices.CreateBucketIfN...
[ "func", "(", "d", "*", "DB", ")", "SettleHoldInvoice", "(", "preimage", "lntypes", ".", "Preimage", ")", "(", "*", "Invoice", ",", "error", ")", "{", "var", "updatedInvoice", "*", "Invoice", "\n", "hash", ":=", "preimage", ".", "Hash", "(", ")", "\n", ...
// SettleHoldInvoice sets the preimage of a hodl invoice and marks the invoice // as settled.
[ "SettleHoldInvoice", "sets", "the", "preimage", "of", "a", "hodl", "invoice", "and", "marks", "the", "invoice", "as", "settled", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/invoices.go#L675-L711
129,838
lightningnetwork/lnd
zpay32/amountunits.go
mBtcToMSat
func mBtcToMSat(m uint64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(m) * 100000000, nil }
go
func mBtcToMSat(m uint64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(m) * 100000000, nil }
[ "func", "mBtcToMSat", "(", "m", "uint64", ")", "(", "lnwire", ".", "MilliSatoshi", ",", "error", ")", "{", "return", "lnwire", ".", "MilliSatoshi", "(", "m", ")", "*", "100000000", ",", "nil", "\n", "}" ]
// mBtcToMSat converts the given amount in milliBTC to millisatoshis.
[ "mBtcToMSat", "converts", "the", "given", "amount", "in", "milliBTC", "to", "millisatoshis", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L31-L33
129,839
lightningnetwork/lnd
zpay32/amountunits.go
uBtcToMSat
func uBtcToMSat(u uint64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(u * 100000), nil }
go
func uBtcToMSat(u uint64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(u * 100000), nil }
[ "func", "uBtcToMSat", "(", "u", "uint64", ")", "(", "lnwire", ".", "MilliSatoshi", ",", "error", ")", "{", "return", "lnwire", ".", "MilliSatoshi", "(", "u", "*", "100000", ")", ",", "nil", "\n", "}" ]
// uBtcToMSat converts the given amount in microBTC to millisatoshis.
[ "uBtcToMSat", "converts", "the", "given", "amount", "in", "microBTC", "to", "millisatoshis", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L36-L38
129,840
lightningnetwork/lnd
zpay32/amountunits.go
nBtcToMSat
func nBtcToMSat(n uint64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(n * 100), nil }
go
func nBtcToMSat(n uint64) (lnwire.MilliSatoshi, error) { return lnwire.MilliSatoshi(n * 100), nil }
[ "func", "nBtcToMSat", "(", "n", "uint64", ")", "(", "lnwire", ".", "MilliSatoshi", ",", "error", ")", "{", "return", "lnwire", ".", "MilliSatoshi", "(", "n", "*", "100", ")", ",", "nil", "\n", "}" ]
// nBtcToMSat converts the given amount in nanoBTC to millisatoshis.
[ "nBtcToMSat", "converts", "the", "given", "amount", "in", "nanoBTC", "to", "millisatoshis", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L41-L43
129,841
lightningnetwork/lnd
zpay32/amountunits.go
pBtcToMSat
func pBtcToMSat(p uint64) (lnwire.MilliSatoshi, error) { if p < 10 { return 0, fmt.Errorf("minimum amount is 10p") } if p%10 != 0 { return 0, fmt.Errorf("amount %d pBTC not expressible in msat", p) } return lnwire.MilliSatoshi(p / 10), nil }
go
func pBtcToMSat(p uint64) (lnwire.MilliSatoshi, error) { if p < 10 { return 0, fmt.Errorf("minimum amount is 10p") } if p%10 != 0 { return 0, fmt.Errorf("amount %d pBTC not expressible in msat", p) } return lnwire.MilliSatoshi(p / 10), nil }
[ "func", "pBtcToMSat", "(", "p", "uint64", ")", "(", "lnwire", ".", "MilliSatoshi", ",", "error", ")", "{", "if", "p", "<", "10", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "p", "%", "10", "!=", ...
// pBtcToMSat converts the given amount in picoBTC to millisatoshis.
[ "pBtcToMSat", "converts", "the", "given", "amount", "in", "picoBTC", "to", "millisatoshis", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L46-L55
129,842
lightningnetwork/lnd
zpay32/amountunits.go
mSatToMBtc
func mSatToMBtc(msat lnwire.MilliSatoshi) (uint64, error) { if msat%100000000 != 0 { return 0, fmt.Errorf("%d msat not expressible "+ "in mBTC", msat) } return uint64(msat / 100000000), nil }
go
func mSatToMBtc(msat lnwire.MilliSatoshi) (uint64, error) { if msat%100000000 != 0 { return 0, fmt.Errorf("%d msat not expressible "+ "in mBTC", msat) } return uint64(msat / 100000000), nil }
[ "func", "mSatToMBtc", "(", "msat", "lnwire", ".", "MilliSatoshi", ")", "(", "uint64", ",", "error", ")", "{", "if", "msat", "%", "100000000", "!=", "0", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", "+", "\"", "\"", ",", "msat", ...
// mSatToMBtc converts the given amount in millisatoshis to milliBTC.
[ "mSatToMBtc", "converts", "the", "given", "amount", "in", "millisatoshis", "to", "milliBTC", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L58-L64
129,843
lightningnetwork/lnd
zpay32/amountunits.go
decodeAmount
func decodeAmount(amount string) (lnwire.MilliSatoshi, error) { if len(amount) < 1 { return 0, fmt.Errorf("amount must be non-empty") } // If last character is a digit, then the amount can just be // interpreted as BTC. char := amount[len(amount)-1] digit := char - '0' if digit >= 0 && digit <= 9 { btc, err...
go
func decodeAmount(amount string) (lnwire.MilliSatoshi, error) { if len(amount) < 1 { return 0, fmt.Errorf("amount must be non-empty") } // If last character is a digit, then the amount can just be // interpreted as BTC. char := amount[len(amount)-1] digit := char - '0' if digit >= 0 && digit <= 9 { btc, err...
[ "func", "decodeAmount", "(", "amount", "string", ")", "(", "lnwire", ".", "MilliSatoshi", ",", "error", ")", "{", "if", "len", "(", "amount", ")", "<", "1", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "...
// decodeAmount returns the amount encoded by the provided string in // millisatoshi.
[ "decodeAmount", "returns", "the", "amount", "encoded", "by", "the", "provided", "string", "in", "millisatoshi", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L90-L125
129,844
lightningnetwork/lnd
zpay32/amountunits.go
encodeAmount
func encodeAmount(msat lnwire.MilliSatoshi) (string, error) { if msat < 0 { return "", fmt.Errorf("amount must be positive: %v", msat) } // If possible to express in BTC, that will always be the shortest // representation. if msat%mSatPerBtc == 0 { return strconv.FormatInt(int64(msat/mSatPerBtc), 10), nil } ...
go
func encodeAmount(msat lnwire.MilliSatoshi) (string, error) { if msat < 0 { return "", fmt.Errorf("amount must be positive: %v", msat) } // If possible to express in BTC, that will always be the shortest // representation. if msat%mSatPerBtc == 0 { return strconv.FormatInt(int64(msat/mSatPerBtc), 10), nil } ...
[ "func", "encodeAmount", "(", "msat", "lnwire", ".", "MilliSatoshi", ")", "(", "string", ",", "error", ")", "{", "if", "msat", "<", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "msat", ")", "\n", "}", "\n\n", "/...
// encodeAmount encodes the provided millisatoshi amount using as few characters // as possible.
[ "encodeAmount", "encodes", "the", "provided", "millisatoshi", "amount", "using", "as", "few", "characters", "as", "possible", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/amountunits.go#L129-L162
129,845
lightningnetwork/lnd
watchtower/wtdb/breach_hint.go
NewBreachHintFromHash
func NewBreachHintFromHash(hash *chainhash.Hash) BreachHint { var hint BreachHint copy(hint[:], hash[:BreachHintSize]) return hint }
go
func NewBreachHintFromHash(hash *chainhash.Hash) BreachHint { var hint BreachHint copy(hint[:], hash[:BreachHintSize]) return hint }
[ "func", "NewBreachHintFromHash", "(", "hash", "*", "chainhash", ".", "Hash", ")", "BreachHint", "{", "var", "hint", "BreachHint", "\n", "copy", "(", "hint", "[", ":", "]", ",", "hash", "[", ":", "BreachHintSize", "]", ")", "\n", "return", "hint", "\n", ...
// NewBreachHintFromHash creates a breach hint from a transaction ID.
[ "NewBreachHintFromHash", "creates", "a", "breach", "hint", "from", "a", "transaction", "ID", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/breach_hint.go#L18-L22
129,846
lightningnetwork/lnd
log.go
addSubLogger
func addSubLogger(subsystem string, useLogger func(btclog.Logger)) { logger := build.NewSubLogger(subsystem, backendLog.Logger) useLogger(logger) subsystemLoggers[subsystem] = logger }
go
func addSubLogger(subsystem string, useLogger func(btclog.Logger)) { logger := build.NewSubLogger(subsystem, backendLog.Logger) useLogger(logger) subsystemLoggers[subsystem] = logger }
[ "func", "addSubLogger", "(", "subsystem", "string", ",", "useLogger", "func", "(", "btclog", ".", "Logger", ")", ")", "{", "logger", ":=", "build", ".", "NewSubLogger", "(", "subsystem", ",", "backendLog", ".", "Logger", ")", "\n", "useLogger", "(", "logge...
// addSubLogger is a helper method to conveniently register the logger of a sub // system.
[ "addSubLogger", "is", "a", "helper", "method", "to", "conveniently", "register", "the", "logger", "of", "a", "sub", "system", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/log.go#L121-L125
129,847
lightningnetwork/lnd
log.go
initLogRotator
func initLogRotator(logFile string, MaxLogFileSize int, MaxLogFiles int) { logDir, _ := filepath.Split(logFile) err := os.MkdirAll(logDir, 0700) if err != nil { fmt.Fprintf(os.Stderr, "failed to create log directory: %v\n", err) os.Exit(1) } r, err := rotator.New(logFile, int64(MaxLogFileSize*1024), false, Max...
go
func initLogRotator(logFile string, MaxLogFileSize int, MaxLogFiles int) { logDir, _ := filepath.Split(logFile) err := os.MkdirAll(logDir, 0700) if err != nil { fmt.Fprintf(os.Stderr, "failed to create log directory: %v\n", err) os.Exit(1) } r, err := rotator.New(logFile, int64(MaxLogFileSize*1024), false, Max...
[ "func", "initLogRotator", "(", "logFile", "string", ",", "MaxLogFileSize", "int", ",", "MaxLogFiles", "int", ")", "{", "logDir", ",", "_", ":=", "filepath", ".", "Split", "(", "logFile", ")", "\n", "err", ":=", "os", ".", "MkdirAll", "(", "logDir", ",", ...
// initLogRotator initializes the logging rotator to write logs to logFile and // create roll files in the same directory. It must be called before the // package-global log rotator variables are used.
[ "initLogRotator", "initializes", "the", "logging", "rotator", "to", "write", "logs", "to", "logFile", "and", "create", "roll", "files", "in", "the", "same", "directory", ".", "It", "must", "be", "called", "before", "the", "package", "-", "global", "log", "ro...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/log.go#L163-L181
129,848
lightningnetwork/lnd
log.go
setLogLevel
func setLogLevel(subsystemID string, logLevel string) { // Ignore invalid subsystems. logger, ok := subsystemLoggers[subsystemID] if !ok { return } // Defaults to info if the log level is invalid. level, _ := btclog.LevelFromString(logLevel) logger.SetLevel(level) }
go
func setLogLevel(subsystemID string, logLevel string) { // Ignore invalid subsystems. logger, ok := subsystemLoggers[subsystemID] if !ok { return } // Defaults to info if the log level is invalid. level, _ := btclog.LevelFromString(logLevel) logger.SetLevel(level) }
[ "func", "setLogLevel", "(", "subsystemID", "string", ",", "logLevel", "string", ")", "{", "// Ignore invalid subsystems.", "logger", ",", "ok", ":=", "subsystemLoggers", "[", "subsystemID", "]", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n\n", "// Defa...
// setLogLevel sets the logging level for provided subsystem. Invalid // subsystems are ignored. Uninitialized subsystems are dynamically created as // needed.
[ "setLogLevel", "sets", "the", "logging", "level", "for", "provided", "subsystem", ".", "Invalid", "subsystems", "are", "ignored", ".", "Uninitialized", "subsystems", "are", "dynamically", "created", "as", "needed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/log.go#L186-L196
129,849
lightningnetwork/lnd
lnrpc/routerrpc/router_server.go
New
func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) { // If the path of the router macaroon wasn't generated, then we'll // assume that it's found at the default network directory. if cfg.RouterMacPath == "" { cfg.RouterMacPath = filepath.Join( cfg.NetworkDir, DefaultRouterMacFilename, ) } // Now t...
go
func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) { // If the path of the router macaroon wasn't generated, then we'll // assume that it's found at the default network directory. if cfg.RouterMacPath == "" { cfg.RouterMacPath = filepath.Join( cfg.NetworkDir, DefaultRouterMacFilename, ) } // Now t...
[ "func", "New", "(", "cfg", "*", "Config", ")", "(", "*", "Server", ",", "lnrpc", ".", "MacaroonPerms", ",", "error", ")", "{", "// If the path of the router macaroon wasn't generated, then we'll", "// assume that it's found at the default network directory.", "if", "cfg", ...
// New creates a new instance of the RouterServer given a configuration struct // that contains all external dependencies. If the target macaroon exists, and // we're unable to create it, then an error will be returned. We also return // the set of permissions that we require as a server. At the time of writing // of t...
[ "New", "creates", "a", "new", "instance", "of", "the", "RouterServer", "given", "a", "configuration", "struct", "that", "contains", "all", "external", "dependencies", ".", "If", "the", "target", "macaroon", "exists", "and", "we", "re", "unable", "to", "create"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/routerrpc/router_server.go#L84-L126
129,850
lightningnetwork/lnd
lnrpc/routerrpc/router_server.go
SendPayment
func (s *Server) SendPayment(ctx context.Context, req *PaymentRequest) (*PaymentResponse, error) { switch { // If the payment request isn't populated, then we won't be able to // even attempt a payment. case req.PayReq == "": return nil, fmt.Errorf("a valid payment request MUST be specified") } // Now that w...
go
func (s *Server) SendPayment(ctx context.Context, req *PaymentRequest) (*PaymentResponse, error) { switch { // If the payment request isn't populated, then we won't be able to // even attempt a payment. case req.PayReq == "": return nil, fmt.Errorf("a valid payment request MUST be specified") } // Now that w...
[ "func", "(", "s", "*", "Server", ")", "SendPayment", "(", "ctx", "context", ".", "Context", ",", "req", "*", "PaymentRequest", ")", "(", "*", "PaymentResponse", ",", "error", ")", "{", "switch", "{", "// If the payment request isn't populated, then we won't be abl...
// SendPayment attempts to route a payment described by the passed // PaymentRequest to the final destination. If we are unable to route the // payment, or cannot find a route that satisfies the constraints in the // PaymentRequest, then an error will be returned. Otherwise, the payment // pre-image, along with the fin...
[ "SendPayment", "attempts", "to", "route", "a", "payment", "described", "by", "the", "passed", "PaymentRequest", "to", "the", "final", "destination", ".", "If", "we", "are", "unable", "to", "route", "the", "payment", "or", "cannot", "find", "a", "route", "tha...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/routerrpc/router_server.go#L171-L226
129,851
lightningnetwork/lnd
lnrpc/routerrpc/router_server.go
EstimateRouteFee
func (s *Server) EstimateRouteFee(ctx context.Context, req *RouteFeeRequest) (*RouteFeeResponse, error) { if len(req.Dest) != 33 { return nil, errors.New("invalid length destination key") } var destNode route.Vertex copy(destNode[:], req.Dest) // Next, we'll convert the amount in satoshis to mSAT, which are t...
go
func (s *Server) EstimateRouteFee(ctx context.Context, req *RouteFeeRequest) (*RouteFeeResponse, error) { if len(req.Dest) != 33 { return nil, errors.New("invalid length destination key") } var destNode route.Vertex copy(destNode[:], req.Dest) // Next, we'll convert the amount in satoshis to mSAT, which are t...
[ "func", "(", "s", "*", "Server", ")", "EstimateRouteFee", "(", "ctx", "context", ".", "Context", ",", "req", "*", "RouteFeeRequest", ")", "(", "*", "RouteFeeResponse", ",", "error", ")", "{", "if", "len", "(", "req", ".", "Dest", ")", "!=", "33", "{"...
// EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it // may cost to send an HTLC to the target end destination.
[ "EstimateRouteFee", "allows", "callers", "to", "obtain", "a", "lower", "bound", "w", ".", "r", ".", "t", "how", "much", "it", "may", "cost", "to", "send", "an", "HTLC", "to", "the", "target", "end", "destination", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/routerrpc/router_server.go#L230-L268
129,852
lightningnetwork/lnd
watchtower/wtwire/error.go
Decode
func (e *Error) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &e.Code, &e.Data, ) }
go
func (e *Error) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &e.Code, &e.Data, ) }
[ "func", "(", "e", "*", "Error", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "e", ".", "Code", ",", "&", "e", ".", "Data", ",", ")", "\n", "}" ]
// Decode deserializes a serialized Error message stored in the passed io.Reader // observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "Error", "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/error.go#L30-L35
129,853
lightningnetwork/lnd
watchtower/wtwire/error.go
Encode
func (e *Error) Encode(w io.Writer, prver uint32) error { return WriteElements(w, e.Code, e.Data, ) }
go
func (e *Error) Encode(w io.Writer, prver uint32) error { return WriteElements(w, e.Code, e.Data, ) }
[ "func", "(", "e", "*", "Error", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "prver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "e", ".", "Code", ",", "e", ".", "Data", ",", ")", "\n", "}" ]
// Encode serializes the target Error into the passed io.Writer observing the // protocol version specified. // // This is part of the wtwire.Message interface.
[ "Encode", "serializes", "the", "target", "Error", "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/error.go#L41-L46
129,854
lightningnetwork/lnd
sweep/store.go
NewSweeperStore
func NewSweeperStore(db *channeldb.DB, chainHash *chainhash.Hash) ( SweeperStore, error) { err := db.Update(func(tx *bbolt.Tx) error { _, err := tx.CreateBucketIfNotExists( lastTxBucketKey, ) if err != nil { return err } if tx.Bucket(txHashesBucketKey) != nil { return nil } txHashesBucket, e...
go
func NewSweeperStore(db *channeldb.DB, chainHash *chainhash.Hash) ( SweeperStore, error) { err := db.Update(func(tx *bbolt.Tx) error { _, err := tx.CreateBucketIfNotExists( lastTxBucketKey, ) if err != nil { return err } if tx.Bucket(txHashesBucketKey) != nil { return nil } txHashesBucket, e...
[ "func", "NewSweeperStore", "(", "db", "*", "channeldb", ".", "DB", ",", "chainHash", "*", "chainhash", ".", "Hash", ")", "(", "SweeperStore", ",", "error", ")", "{", "err", ":=", "db", ".", "Update", "(", "func", "(", "tx", "*", "bbolt", ".", "Tx", ...
// NewSweeperStore returns a new store instance.
[ "NewSweeperStore", "returns", "a", "new", "store", "instance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/sweep/store.go#L64-L97
129,855
lightningnetwork/lnd
sweep/store.go
migrateTxHashes
func migrateTxHashes(tx *bbolt.Tx, txHashesBucket *bbolt.Bucket, chainHash *chainhash.Hash) error { log.Infof("Migrating UTXO nursery finalized TXIDs") // Compose chain bucket key. var b bytes.Buffer if _, err := b.Write(utxnChainPrefix); err != nil { return err } if _, err := b.Write(chainHash[:]); err != ...
go
func migrateTxHashes(tx *bbolt.Tx, txHashesBucket *bbolt.Bucket, chainHash *chainhash.Hash) error { log.Infof("Migrating UTXO nursery finalized TXIDs") // Compose chain bucket key. var b bytes.Buffer if _, err := b.Write(utxnChainPrefix); err != nil { return err } if _, err := b.Write(chainHash[:]); err != ...
[ "func", "migrateTxHashes", "(", "tx", "*", "bbolt", ".", "Tx", ",", "txHashesBucket", "*", "bbolt", ".", "Bucket", ",", "chainHash", "*", "chainhash", ".", "Hash", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "// Compose chain bu...
// migrateTxHashes migrates nursery finalized txes to the tx hashes bucket. This // is not implemented as a database migration, to keep the downgrade path open.
[ "migrateTxHashes", "migrates", "nursery", "finalized", "txes", "to", "the", "tx", "hashes", "bucket", ".", "This", "is", "not", "implemented", "as", "a", "database", "migration", "to", "keep", "the", "downgrade", "path", "open", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/sweep/store.go#L101-L163
129,856
lightningnetwork/lnd
sweep/store.go
GetLastPublishedTx
func (s *sweeperStore) GetLastPublishedTx() (*wire.MsgTx, error) { var sweepTx *wire.MsgTx err := s.db.View(func(tx *bbolt.Tx) error { lastTxBucket := tx.Bucket(lastTxBucketKey) if lastTxBucket == nil { return errors.New("last tx bucket does not exist") } sweepTxRaw := lastTxBucket.Get(lastTxKey) if sw...
go
func (s *sweeperStore) GetLastPublishedTx() (*wire.MsgTx, error) { var sweepTx *wire.MsgTx err := s.db.View(func(tx *bbolt.Tx) error { lastTxBucket := tx.Bucket(lastTxBucketKey) if lastTxBucket == nil { return errors.New("last tx bucket does not exist") } sweepTxRaw := lastTxBucket.Get(lastTxKey) if sw...
[ "func", "(", "s", "*", "sweeperStore", ")", "GetLastPublishedTx", "(", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "var", "sweepTx", "*", "wire", ".", "MsgTx", "\n\n", "err", ":=", "s", ".", "db", ".", "View", "(", "func", "(", "...
// GetLastPublishedTx returns the last tx that we called NotifyPublishTx // for.
[ "GetLastPublishedTx", "returns", "the", "last", "tx", "that", "we", "called", "NotifyPublishTx", "for", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/sweep/store.go#L195-L222
129,857
lightningnetwork/lnd
lnwire/accept_channel.go
Encode
func (a *AcceptChannel) Encode(w io.Writer, pver uint32) error { return WriteElements(w, a.PendingChannelID[:], a.DustLimit, a.MaxValueInFlight, a.ChannelReserve, a.HtlcMinimum, a.MinAcceptDepth, a.CsvDelay, a.MaxAcceptedHTLCs, a.FundingKey, a.RevocationPoint, a.PaymentPoint, a.DelayedPaymentPo...
go
func (a *AcceptChannel) Encode(w io.Writer, pver uint32) error { return WriteElements(w, a.PendingChannelID[:], a.DustLimit, a.MaxValueInFlight, a.ChannelReserve, a.HtlcMinimum, a.MinAcceptDepth, a.CsvDelay, a.MaxAcceptedHTLCs, a.FundingKey, a.RevocationPoint, a.PaymentPoint, a.DelayedPaymentPo...
[ "func", "(", "a", "*", "AcceptChannel", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "a", ".", "PendingChannelID", "[", ":", "]", ",", "a", ".", "DustLimit", ",", ...
// Encode serializes the target AcceptChannel into the passed io.Writer // implementation. Serialization will observe the rules defined by the passed // protocol version. // // This is part of the lnwire.Message interface.
[ "Encode", "serializes", "the", "target", "AcceptChannel", "into", "the", "passed", "io", ".", "Writer", "implementation", ".", "Serialization", "will", "observe", "the", "rules", "defined", "by", "the", "passed", "protocol", "version", ".", "This", "is", "part",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/accept_channel.go#L100-L117
129,858
lightningnetwork/lnd
lnwire/accept_channel.go
Decode
func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error { return ReadElements(r, a.PendingChannelID[:], &a.DustLimit, &a.MaxValueInFlight, &a.ChannelReserve, &a.HtlcMinimum, &a.MinAcceptDepth, &a.CsvDelay, &a.MaxAcceptedHTLCs, &a.FundingKey, &a.RevocationPoint, &a.PaymentPoint, &a.Delaye...
go
func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error { return ReadElements(r, a.PendingChannelID[:], &a.DustLimit, &a.MaxValueInFlight, &a.ChannelReserve, &a.HtlcMinimum, &a.MinAcceptDepth, &a.CsvDelay, &a.MaxAcceptedHTLCs, &a.FundingKey, &a.RevocationPoint, &a.PaymentPoint, &a.Delaye...
[ "func", "(", "a", "*", "AcceptChannel", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "a", ".", "PendingChannelID", "[", ":", "]", ",", "&", "a", ".", "DustLimit", "...
// Decode deserializes the serialized AcceptChannel stored in the passed // io.Reader into the target AcceptChannel using the deserialization rules // defined by the passed protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "the", "serialized", "AcceptChannel", "stored", "in", "the", "passed", "io", ".", "Reader", "into", "the", "target", "AcceptChannel", "using", "the", "deserialization", "rules", "defined", "by", "the", "passed", "protocol", "version", "."...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/accept_channel.go#L124-L141
129,859
lightningnetwork/lnd
lnwallet/fee_estimator.go
FeeForVSize
func (s SatPerKVByte) FeeForVSize(vbytes int64) btcutil.Amount { return btcutil.Amount(s) * btcutil.Amount(vbytes) / 1000 }
go
func (s SatPerKVByte) FeeForVSize(vbytes int64) btcutil.Amount { return btcutil.Amount(s) * btcutil.Amount(vbytes) / 1000 }
[ "func", "(", "s", "SatPerKVByte", ")", "FeeForVSize", "(", "vbytes", "int64", ")", "btcutil", ".", "Amount", "{", "return", "btcutil", ".", "Amount", "(", "s", ")", "*", "btcutil", ".", "Amount", "(", "vbytes", ")", "/", "1000", "\n", "}" ]
// FeeForVSize calculates the fee resulting from this fee rate and the given // vsize in vbytes.
[ "FeeForVSize", "calculates", "the", "fee", "resulting", "from", "this", "fee", "rate", "and", "the", "given", "vsize", "in", "vbytes", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L48-L50
129,860
lightningnetwork/lnd
lnwallet/fee_estimator.go
NewStaticFeeEstimator
func NewStaticFeeEstimator(feePerKW, relayFee SatPerKWeight) *StaticFeeEstimator { return &StaticFeeEstimator{ feePerKW: feePerKW, relayFee: relayFee, } }
go
func NewStaticFeeEstimator(feePerKW, relayFee SatPerKWeight) *StaticFeeEstimator { return &StaticFeeEstimator{ feePerKW: feePerKW, relayFee: relayFee, } }
[ "func", "NewStaticFeeEstimator", "(", "feePerKW", ",", "relayFee", "SatPerKWeight", ")", "*", "StaticFeeEstimator", "{", "return", "&", "StaticFeeEstimator", "{", "feePerKW", ":", "feePerKW", ",", "relayFee", ":", "relayFee", ",", "}", "\n", "}" ]
// NewStaticFeeEstimator returns a new static fee estimator instance.
[ "NewStaticFeeEstimator", "returns", "a", "new", "static", "fee", "estimator", "instance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L110-L117
129,861
lightningnetwork/lnd
lnwallet/fee_estimator.go
NewBtcdFeeEstimator
func NewBtcdFeeEstimator(rpcConfig rpcclient.ConnConfig, fallBackFeeRate SatPerKWeight) (*BtcdFeeEstimator, error) { rpcConfig.DisableConnectOnNew = true rpcConfig.DisableAutoReconnect = false chainConn, err := rpcclient.New(&rpcConfig, nil) if err != nil { return nil, err } return &BtcdFeeEstimator{ fallb...
go
func NewBtcdFeeEstimator(rpcConfig rpcclient.ConnConfig, fallBackFeeRate SatPerKWeight) (*BtcdFeeEstimator, error) { rpcConfig.DisableConnectOnNew = true rpcConfig.DisableAutoReconnect = false chainConn, err := rpcclient.New(&rpcConfig, nil) if err != nil { return nil, err } return &BtcdFeeEstimator{ fallb...
[ "func", "NewBtcdFeeEstimator", "(", "rpcConfig", "rpcclient", ".", "ConnConfig", ",", "fallBackFeeRate", "SatPerKWeight", ")", "(", "*", "BtcdFeeEstimator", ",", "error", ")", "{", "rpcConfig", ".", "DisableConnectOnNew", "=", "true", "\n", "rpcConfig", ".", "Disa...
// NewBtcdFeeEstimator creates a new BtcdFeeEstimator given a fully populated // rpc config that is able to successfully connect and authenticate with the // btcd node, and also a fall back fee rate. The fallback fee rate is used in // the occasion that the estimator has insufficient data, or returns zero for a // fee ...
[ "NewBtcdFeeEstimator", "creates", "a", "new", "BtcdFeeEstimator", "given", "a", "fully", "populated", "rpc", "config", "that", "is", "able", "to", "successfully", "connect", "and", "authenticate", "with", "the", "btcd", "node", "and", "also", "a", "fall", "back"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L177-L191
129,862
lightningnetwork/lnd
lnwallet/fee_estimator.go
NewBitcoindFeeEstimator
func NewBitcoindFeeEstimator(rpcConfig rpcclient.ConnConfig, fallBackFeeRate SatPerKWeight) (*BitcoindFeeEstimator, error) { rpcConfig.DisableConnectOnNew = true rpcConfig.DisableAutoReconnect = false rpcConfig.DisableTLS = true rpcConfig.HTTPPostMode = true chainConn, err := rpcclient.New(&rpcConfig, nil) if e...
go
func NewBitcoindFeeEstimator(rpcConfig rpcclient.ConnConfig, fallBackFeeRate SatPerKWeight) (*BitcoindFeeEstimator, error) { rpcConfig.DisableConnectOnNew = true rpcConfig.DisableAutoReconnect = false rpcConfig.DisableTLS = true rpcConfig.HTTPPostMode = true chainConn, err := rpcclient.New(&rpcConfig, nil) if e...
[ "func", "NewBitcoindFeeEstimator", "(", "rpcConfig", "rpcclient", ".", "ConnConfig", ",", "fallBackFeeRate", "SatPerKWeight", ")", "(", "*", "BitcoindFeeEstimator", ",", "error", ")", "{", "rpcConfig", ".", "DisableConnectOnNew", "=", "true", "\n", "rpcConfig", ".",...
// NewBitcoindFeeEstimator creates a new BitcoindFeeEstimator given a fully // populated rpc config that is able to successfully connect and authenticate // with the bitcoind node, and also a fall back fee rate. The fallback fee rate // is used in the occasion that the estimator has insufficient data, or returns // zer...
[ "NewBitcoindFeeEstimator", "creates", "a", "new", "BitcoindFeeEstimator", "given", "a", "fully", "populated", "rpc", "config", "that", "is", "able", "to", "successfully", "connect", "and", "authenticate", "with", "the", "bitcoind", "node", "and", "also", "a", "fal...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L332-L348
129,863
lightningnetwork/lnd
lnwallet/fee_estimator.go
NewWebAPIFeeEstimator
func NewWebAPIFeeEstimator( api WebAPIFeeSource, defaultFee SatPerKWeight) *WebAPIFeeEstimator { return &WebAPIFeeEstimator{ apiSource: api, feeByBlockTarget: make(map[uint32]uint32), defaultFeePerKw: defaultFee, quit: make(chan struct{}), } }
go
func NewWebAPIFeeEstimator( api WebAPIFeeSource, defaultFee SatPerKWeight) *WebAPIFeeEstimator { return &WebAPIFeeEstimator{ apiSource: api, feeByBlockTarget: make(map[uint32]uint32), defaultFeePerKw: defaultFee, quit: make(chan struct{}), } }
[ "func", "NewWebAPIFeeEstimator", "(", "api", "WebAPIFeeSource", ",", "defaultFee", "SatPerKWeight", ")", "*", "WebAPIFeeEstimator", "{", "return", "&", "WebAPIFeeEstimator", "{", "apiSource", ":", "api", ",", "feeByBlockTarget", ":", "make", "(", "map", "[", "uint...
// NewWebAPIFeeEstimator creates a new WebAPIFeeEstimator from a given URL and a // fallback default fee. The fees are updated whenever a new block is mined.
[ "NewWebAPIFeeEstimator", "creates", "a", "new", "WebAPIFeeEstimator", "from", "a", "given", "URL", "and", "a", "fallback", "default", "fee", ".", "The", "fees", "are", "updated", "whenever", "a", "new", "block", "is", "mined", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L576-L585
129,864
lightningnetwork/lnd
lnwallet/fee_estimator.go
randomFeeUpdateTimeout
func (w *WebAPIFeeEstimator) randomFeeUpdateTimeout() time.Duration { lower := int64(minFeeUpdateTimeout) upper := int64(maxFeeUpdateTimeout) return time.Duration(prand.Int63n(upper-lower) + lower) }
go
func (w *WebAPIFeeEstimator) randomFeeUpdateTimeout() time.Duration { lower := int64(minFeeUpdateTimeout) upper := int64(maxFeeUpdateTimeout) return time.Duration(prand.Int63n(upper-lower) + lower) }
[ "func", "(", "w", "*", "WebAPIFeeEstimator", ")", "randomFeeUpdateTimeout", "(", ")", "time", ".", "Duration", "{", "lower", ":=", "int64", "(", "minFeeUpdateTimeout", ")", "\n", "upper", ":=", "int64", "(", "maxFeeUpdateTimeout", ")", "\n", "return", "time", ...
// randomFeeUpdateTimeout returns a random timeout between minFeeUpdateTimeout // and maxFeeUpdateTimeout that will be used to determine how often the Estimator // should retrieve fresh fees from its API.
[ "randomFeeUpdateTimeout", "returns", "a", "random", "timeout", "between", "minFeeUpdateTimeout", "and", "maxFeeUpdateTimeout", "that", "will", "be", "used", "to", "determine", "how", "often", "the", "Estimator", "should", "retrieve", "fresh", "fees", "from", "its", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L663-L667
129,865
lightningnetwork/lnd
lnwallet/fee_estimator.go
updateFeeEstimates
func (w *WebAPIFeeEstimator) updateFeeEstimates() { // Rather than use the default http.Client, we'll make a custom one // which will allow us to control how long we'll wait to read the // response from the service. This way, if the service is down or // overloaded, we can exit early and use our default fee. netTr...
go
func (w *WebAPIFeeEstimator) updateFeeEstimates() { // Rather than use the default http.Client, we'll make a custom one // which will allow us to control how long we'll wait to read the // response from the service. This way, if the service is down or // overloaded, we can exit early and use our default fee. netTr...
[ "func", "(", "w", "*", "WebAPIFeeEstimator", ")", "updateFeeEstimates", "(", ")", "{", "// Rather than use the default http.Client, we'll make a custom one", "// which will allow us to control how long we'll wait to read the", "// response from the service. This way, if the service is down o...
// updateFeeEstimates re-queries the API for fresh fees and caches them.
[ "updateFeeEstimates", "re", "-", "queries", "the", "API", "for", "fresh", "fees", "and", "caches", "them", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L697-L736
129,866
lightningnetwork/lnd
lnwallet/fee_estimator.go
feeUpdateManager
func (w *WebAPIFeeEstimator) feeUpdateManager() { defer w.wg.Done() for { select { case <-w.updateFeeTicker.C: w.updateFeeEstimates() case <-w.quit: return } } }
go
func (w *WebAPIFeeEstimator) feeUpdateManager() { defer w.wg.Done() for { select { case <-w.updateFeeTicker.C: w.updateFeeEstimates() case <-w.quit: return } } }
[ "func", "(", "w", "*", "WebAPIFeeEstimator", ")", "feeUpdateManager", "(", ")", "{", "defer", "w", ".", "wg", ".", "Done", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "w", ".", "updateFeeTicker", ".", "C", ":", "w", ".", "updateFeeEsti...
// feeUpdateManager updates the fee estimates whenever a new block comes in.
[ "feeUpdateManager", "updates", "the", "fee", "estimates", "whenever", "a", "new", "block", "comes", "in", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/fee_estimator.go#L739-L750
129,867
lightningnetwork/lnd
chanrestore.go
openChannelShell
func (c *chanDBRestorer) openChannelShell(backup chanbackup.Single) ( *channeldb.ChannelShell, error) { // First, we'll also need to obtain the private key for the shachain // root from the encoded public key. // // TODO(roasbeef): now adds req for hardware signers to impl // shachain... privKey, err := c.secre...
go
func (c *chanDBRestorer) openChannelShell(backup chanbackup.Single) ( *channeldb.ChannelShell, error) { // First, we'll also need to obtain the private key for the shachain // root from the encoded public key. // // TODO(roasbeef): now adds req for hardware signers to impl // shachain... privKey, err := c.secre...
[ "func", "(", "c", "*", "chanDBRestorer", ")", "openChannelShell", "(", "backup", "chanbackup", ".", "Single", ")", "(", "*", "channeldb", ".", "ChannelShell", ",", "error", ")", "{", "// First, we'll also need to obtain the private key for the shachain", "// root from t...
// openChannelShell maps the static channel back up into an open channel // "shell". We say shell as this doesn't include all the information required // to continue to use the channel, only the minimal amount of information to // insert this shell channel back into the database.
[ "openChannelShell", "maps", "the", "static", "channel", "back", "up", "into", "an", "open", "channel", "shell", ".", "We", "say", "shell", "as", "this", "doesn", "t", "include", "all", "the", "information", "required", "to", "continue", "to", "use", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanrestore.go#L34-L105
129,868
lightningnetwork/lnd
discovery/reliable_sender.go
newReliableSender
func newReliableSender(cfg *reliableSenderCfg) *reliableSender { return &reliableSender{ cfg: *cfg, activePeers: make(map[[33]byte]peerManager), quit: make(chan struct{}), } }
go
func newReliableSender(cfg *reliableSenderCfg) *reliableSender { return &reliableSender{ cfg: *cfg, activePeers: make(map[[33]byte]peerManager), quit: make(chan struct{}), } }
[ "func", "newReliableSender", "(", "cfg", "*", "reliableSenderCfg", ")", "*", "reliableSender", "{", "return", "&", "reliableSender", "{", "cfg", ":", "*", "cfg", ",", "activePeers", ":", "make", "(", "map", "[", "[", "33", "]", "byte", "]", "peerManager", ...
// newReliableSender returns a new reliableSender backed by the given config.
[ "newReliableSender", "returns", "a", "new", "reliableSender", "backed", "by", "the", "given", "config", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/reliable_sender.go#L70-L76
129,869
lightningnetwork/lnd
discovery/reliable_sender.go
Start
func (s *reliableSender) Start() error { var err error s.start.Do(func() { err = s.resendPendingMsgs() }) return err }
go
func (s *reliableSender) Start() error { var err error s.start.Do(func() { err = s.resendPendingMsgs() }) return err }
[ "func", "(", "s", "*", "reliableSender", ")", "Start", "(", ")", "error", "{", "var", "err", "error", "\n", "s", ".", "start", ".", "Do", "(", "func", "(", ")", "{", "err", "=", "s", ".", "resendPendingMsgs", "(", ")", "\n", "}", ")", "\n", "re...
// Start spawns message handlers for any peers with pending messages.
[ "Start", "spawns", "message", "handlers", "for", "any", "peers", "with", "pending", "messages", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/reliable_sender.go#L79-L85
129,870
lightningnetwork/lnd
discovery/reliable_sender.go
Stop
func (s *reliableSender) Stop() { s.stop.Do(func() { close(s.quit) s.wg.Wait() }) }
go
func (s *reliableSender) Stop() { s.stop.Do(func() { close(s.quit) s.wg.Wait() }) }
[ "func", "(", "s", "*", "reliableSender", ")", "Stop", "(", ")", "{", "s", ".", "stop", ".", "Do", "(", "func", "(", ")", "{", "close", "(", "s", ".", "quit", ")", "\n", "s", ".", "wg", ".", "Wait", "(", ")", "\n", "}", ")", "\n", "}" ]
// Stop halts the reliable sender from sending messages to peers.
[ "Stop", "halts", "the", "reliable", "sender", "from", "sending", "messages", "to", "peers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/reliable_sender.go#L88-L93
129,871
lightningnetwork/lnd
discovery/reliable_sender.go
sendMessage
func (s *reliableSender) sendMessage(msg lnwire.Message, peerPubKey [33]byte) error { // We'll start by persisting the message to disk. This allows us to // resend the message upon restarts and peer reconnections. if err := s.cfg.MessageStore.AddMessage(msg, peerPubKey); err != nil { return err } // Then, we'll...
go
func (s *reliableSender) sendMessage(msg lnwire.Message, peerPubKey [33]byte) error { // We'll start by persisting the message to disk. This allows us to // resend the message upon restarts and peer reconnections. if err := s.cfg.MessageStore.AddMessage(msg, peerPubKey); err != nil { return err } // Then, we'll...
[ "func", "(", "s", "*", "reliableSender", ")", "sendMessage", "(", "msg", "lnwire", ".", "Message", ",", "peerPubKey", "[", "33", "]", "byte", ")", "error", "{", "// We'll start by persisting the message to disk. This allows us to", "// resend the message upon restarts and...
// sendMessage constructs a request to send a message reliably to a peer. In the // event that the peer is currently offline, this will only write the message to // disk. Once the peer reconnects, this message, along with any others pending, // will be sent to the peer.
[ "sendMessage", "constructs", "a", "request", "to", "send", "a", "message", "reliably", "to", "a", "peer", ".", "In", "the", "event", "that", "the", "peer", "is", "currently", "offline", "this", "will", "only", "write", "the", "message", "to", "disk", ".", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/reliable_sender.go#L99-L132
129,872
lightningnetwork/lnd
discovery/reliable_sender.go
spawnPeerHandler
func (s *reliableSender) spawnPeerHandler(peerPubKey [33]byte) (peerManager, bool) { s.activePeersMtx.Lock() defer s.activePeersMtx.Unlock() msgHandler, ok := s.activePeers[peerPubKey] if !ok { msgHandler = peerManager{ msgs: make(chan lnwire.Message), done: make(chan struct{}), } s.activePeers[peerPub...
go
func (s *reliableSender) spawnPeerHandler(peerPubKey [33]byte) (peerManager, bool) { s.activePeersMtx.Lock() defer s.activePeersMtx.Unlock() msgHandler, ok := s.activePeers[peerPubKey] if !ok { msgHandler = peerManager{ msgs: make(chan lnwire.Message), done: make(chan struct{}), } s.activePeers[peerPub...
[ "func", "(", "s", "*", "reliableSender", ")", "spawnPeerHandler", "(", "peerPubKey", "[", "33", "]", "byte", ")", "(", "peerManager", ",", "bool", ")", "{", "s", ".", "activePeersMtx", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "activePeersMtx", "...
// spawnPeerMsgHandler spawns a peerHandler for the given peer if there isn't // one already active. The boolean returned signals whether there was already // one active or not.
[ "spawnPeerMsgHandler", "spawns", "a", "peerHandler", "for", "the", "given", "peer", "if", "there", "isn", "t", "one", "already", "active", ".", "The", "boolean", "returned", "signals", "whether", "there", "was", "already", "one", "active", "or", "not", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/reliable_sender.go#L137-L154
129,873
lightningnetwork/lnd
discovery/reliable_sender.go
resendPendingMsgs
func (s *reliableSender) resendPendingMsgs() error { // Fetch all of the peers for which we have pending messages for and // spawn a peerMsgHandler for each. Once the peer is seen as online, all // of the pending messages will be sent. peers, err := s.cfg.MessageStore.Peers() if err != nil { return err } for ...
go
func (s *reliableSender) resendPendingMsgs() error { // Fetch all of the peers for which we have pending messages for and // spawn a peerMsgHandler for each. Once the peer is seen as online, all // of the pending messages will be sent. peers, err := s.cfg.MessageStore.Peers() if err != nil { return err } for ...
[ "func", "(", "s", "*", "reliableSender", ")", "resendPendingMsgs", "(", ")", "error", "{", "// Fetch all of the peers for which we have pending messages for and", "// spawn a peerMsgHandler for each. Once the peer is seen as online, all", "// of the pending messages will be sent.", "peer...
// resendPendingMsgs retrieves and sends all of the messages within the message // store that should be reliably sent to their respective peers.
[ "resendPendingMsgs", "retrieves", "and", "sends", "all", "of", "the", "messages", "within", "the", "message", "store", "that", "should", "be", "reliably", "sent", "to", "their", "respective", "peers", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/reliable_sender.go#L320-L334
129,874
lightningnetwork/lnd
cmd/lncli/commands.go
actionDecorator
func actionDecorator(f func(*cli.Context) error) func(*cli.Context) error { return func(c *cli.Context) error { if err := f(c); err != nil { s, ok := status.FromError(err) // If it's a command for the UnlockerService (like // 'create' or 'unlock') but the wallet is already // unlocked, then these method...
go
func actionDecorator(f func(*cli.Context) error) func(*cli.Context) error { return func(c *cli.Context) error { if err := f(c); err != nil { s, ok := status.FromError(err) // If it's a command for the UnlockerService (like // 'create' or 'unlock') but the wallet is already // unlocked, then these method...
[ "func", "actionDecorator", "(", "f", "func", "(", "*", "cli", ".", "Context", ")", "error", ")", "func", "(", "*", "cli", ".", "Context", ")", "error", "{", "return", "func", "(", "c", "*", "cli", ".", "Context", ")", "error", "{", "if", "err", "...
// actionDecorator is used to add additional information and error handling // to command actions.
[ "actionDecorator", "is", "used", "to", "add", "additional", "information", "and", "error", "handling", "to", "command", "actions", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L68-L103
129,875
lightningnetwork/lnd
cmd/lncli/commands.go
executeChannelClose
func executeChannelClose(client lnrpc.LightningClient, req *lnrpc.CloseChannelRequest, txidChan chan<- string, block bool) error { stream, err := client.CloseChannel(context.Background(), req) if err != nil { return err } for { resp, err := stream.Recv() if err == io.EOF { return nil } else if err != ...
go
func executeChannelClose(client lnrpc.LightningClient, req *lnrpc.CloseChannelRequest, txidChan chan<- string, block bool) error { stream, err := client.CloseChannel(context.Background(), req) if err != nil { return err } for { resp, err := stream.Recv() if err == io.EOF { return nil } else if err != ...
[ "func", "executeChannelClose", "(", "client", "lnrpc", ".", "LightningClient", ",", "req", "*", "lnrpc", ".", "CloseChannelRequest", ",", "txidChan", "chan", "<-", "string", ",", "block", "bool", ")", "error", "{", "stream", ",", "err", ":=", "client", ".", ...
// executeChannelClose attempts to close the channel from a request. The closing // transaction ID is sent through `txidChan` as soon as it is broadcasted to the // network. The block boolean is used to determine if we should block until the // closing transaction receives all of its required confirmations.
[ "executeChannelClose", "attempts", "to", "close", "the", "channel", "from", "a", "request", ".", "The", "closing", "transaction", "ID", "is", "sent", "through", "txidChan", "as", "soon", "as", "it", "is", "broadcasted", "to", "the", "network", ".", "The", "b...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L935-L968
129,876
lightningnetwork/lnd
cmd/lncli/commands.go
promptForConfirmation
func promptForConfirmation(msg string) bool { reader := bufio.NewReader(os.Stdin) for { fmt.Print(msg) answer, err := reader.ReadString('\n') if err != nil { return false } answer = strings.ToLower(strings.TrimSpace(answer)) switch { case answer == "yes": return true case answer == "no": ...
go
func promptForConfirmation(msg string) bool { reader := bufio.NewReader(os.Stdin) for { fmt.Print(msg) answer, err := reader.ReadString('\n') if err != nil { return false } answer = strings.ToLower(strings.TrimSpace(answer)) switch { case answer == "yes": return true case answer == "no": ...
[ "func", "promptForConfirmation", "(", "msg", "string", ")", "bool", "{", "reader", ":=", "bufio", ".", "NewReader", "(", "os", ".", "Stdin", ")", "\n\n", "for", "{", "fmt", ".", "Print", "(", "msg", ")", "\n\n", "answer", ",", "err", ":=", "reader", ...
// promptForConfirmation continuously prompts the user for the message until // receiving a response of "yes" or "no" and returns their answer as a bool.
[ "promptForConfirmation", "continuously", "prompts", "the", "user", "for", "the", "message", "until", "receiving", "a", "response", "of", "yes", "or", "no", "and", "returns", "their", "answer", "as", "a", "bool", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L1158-L1180
129,877
lightningnetwork/lnd
cmd/lncli/commands.go
parseChannelPoint
func parseChannelPoint(ctx *cli.Context) (*lnrpc.ChannelPoint, error) { channelPoint := &lnrpc.ChannelPoint{} args := ctx.Args() switch { case ctx.IsSet("funding_txid"): channelPoint.FundingTxid = &lnrpc.ChannelPoint_FundingTxidStr{ FundingTxidStr: ctx.String("funding_txid"), } case args.Present(): chan...
go
func parseChannelPoint(ctx *cli.Context) (*lnrpc.ChannelPoint, error) { channelPoint := &lnrpc.ChannelPoint{} args := ctx.Args() switch { case ctx.IsSet("funding_txid"): channelPoint.FundingTxid = &lnrpc.ChannelPoint_FundingTxidStr{ FundingTxidStr: ctx.String("funding_txid"), } case args.Present(): chan...
[ "func", "parseChannelPoint", "(", "ctx", "*", "cli", ".", "Context", ")", "(", "*", "lnrpc", ".", "ChannelPoint", ",", "error", ")", "{", "channelPoint", ":=", "&", "lnrpc", ".", "ChannelPoint", "{", "}", "\n\n", "args", ":=", "ctx", ".", "Args", "(", ...
// parseChannelPoint parses a funding txid and output index from the command // line. Both named options as well as unnamed parameters are supported.
[ "parseChannelPoint", "parses", "a", "funding", "txid", "and", "output", "index", "from", "the", "command", "line", ".", "Both", "named", "options", "as", "well", "as", "unnamed", "parameters", "are", "supported", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L1243-L1276
129,878
lightningnetwork/lnd
cmd/lncli/commands.go
monowidthColumns
func monowidthColumns(words []string, ncols int) []string { // Determine max size of words in each column. colWidths := make([]int, ncols) for i, word := range words { col := i % ncols curWidth := colWidths[col] if len(word) > curWidth { colWidths[col] = len(word) } } // Append whitespace to each word ...
go
func monowidthColumns(words []string, ncols int) []string { // Determine max size of words in each column. colWidths := make([]int, ncols) for i, word := range words { col := i % ncols curWidth := colWidths[col] if len(word) > curWidth { colWidths[col] = len(word) } } // Append whitespace to each word ...
[ "func", "monowidthColumns", "(", "words", "[", "]", "string", ",", "ncols", "int", ")", "[", "]", "string", "{", "// Determine max size of words in each column.", "colWidths", ":=", "make", "(", "[", "]", "int", ",", "ncols", ")", "\n", "for", "i", ",", "w...
// monowidthColumns takes a set of words, and the number of desired columns, // and returns a new set of words that have had white space appended to the // word in order to create a mono-width column.
[ "monowidthColumns", "takes", "a", "set", "of", "words", "and", "the", "number", "of", "desired", "columns", "and", "returns", "a", "new", "set", "of", "words", "that", "have", "had", "white", "space", "appended", "to", "the", "word", "in", "order", "to", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L1351-L1373
129,879
lightningnetwork/lnd
cmd/lncli/commands.go
retrieveFeeLimit
func retrieveFeeLimit(ctx *cli.Context) (*lnrpc.FeeLimit, error) { switch { case ctx.IsSet("fee_limit") && ctx.IsSet("fee_limit_percent"): return nil, fmt.Errorf("either fee_limit or fee_limit_percent " + "can be set, but not both") case ctx.IsSet("fee_limit"): return &lnrpc.FeeLimit{ Limit: &lnrpc.FeeLimi...
go
func retrieveFeeLimit(ctx *cli.Context) (*lnrpc.FeeLimit, error) { switch { case ctx.IsSet("fee_limit") && ctx.IsSet("fee_limit_percent"): return nil, fmt.Errorf("either fee_limit or fee_limit_percent " + "can be set, but not both") case ctx.IsSet("fee_limit"): return &lnrpc.FeeLimit{ Limit: &lnrpc.FeeLimi...
[ "func", "retrieveFeeLimit", "(", "ctx", "*", "cli", ".", "Context", ")", "(", "*", "lnrpc", ".", "FeeLimit", ",", "error", ")", "{", "switch", "{", "case", "ctx", ".", "IsSet", "(", "\"", "\"", ")", "&&", "ctx", ".", "IsSet", "(", "\"", "\"", ")"...
// retrieveFeeLimit retrieves the fee limit based on the different fee limit // flags passed.
[ "retrieveFeeLimit", "retrieves", "the", "fee", "limit", "based", "on", "the", "different", "fee", "limit", "flags", "passed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L2086-L2108
129,880
lightningnetwork/lnd
cmd/lncli/commands.go
normalizeFunc
func normalizeFunc(edges []*lnrpc.ChannelEdge, scaleFactor float64) func(int64) float64 { var ( min float64 = math.MaxInt64 max float64 ) for _, edge := range edges { // In order to obtain saner values, we reduce the capacity of a // channel to its base 2 logarithm. z := math.Log2(float64(edge.Capacity)) ...
go
func normalizeFunc(edges []*lnrpc.ChannelEdge, scaleFactor float64) func(int64) float64 { var ( min float64 = math.MaxInt64 max float64 ) for _, edge := range edges { // In order to obtain saner values, we reduce the capacity of a // channel to its base 2 logarithm. z := math.Log2(float64(edge.Capacity)) ...
[ "func", "normalizeFunc", "(", "edges", "[", "]", "*", "lnrpc", ".", "ChannelEdge", ",", "scaleFactor", "float64", ")", "func", "(", "int64", ")", "float64", "{", "var", "(", "min", "float64", "=", "math", ".", "MaxInt64", "\n", "max", "float64", "\n", ...
// normalizeFunc is a factory function which returns a function that normalizes // the capacity of edges within the graph. The value of the returned // function can be used to either plot the capacities, or to use a weight in a // rendering of the graph.
[ "normalizeFunc", "is", "a", "factory", "function", "which", "returns", "a", "function", "that", "normalizes", "the", "capacity", "of", "edges", "within", "the", "graph", ".", "The", "value", "of", "the", "returned", "function", "can", "be", "used", "to", "ei...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/commands.go#L2811-L2836
129,881
lightningnetwork/lnd
routing/notifications.go
notifyTopologyChange
func (r *ChannelRouter) notifyTopologyChange(topologyDiff *TopologyChange) { r.RLock() numClients := len(r.topologyClients) r.RUnlock() // Do not reacquire the lock twice unnecessarily. if numClients == 0 { return } log.Tracef("Sending topology notification to %v clients %v", numClients, newLogClosure(fu...
go
func (r *ChannelRouter) notifyTopologyChange(topologyDiff *TopologyChange) { r.RLock() numClients := len(r.topologyClients) r.RUnlock() // Do not reacquire the lock twice unnecessarily. if numClients == 0 { return } log.Tracef("Sending topology notification to %v clients %v", numClients, newLogClosure(fu...
[ "func", "(", "r", "*", "ChannelRouter", ")", "notifyTopologyChange", "(", "topologyDiff", "*", "TopologyChange", ")", "{", "r", ".", "RLock", "(", ")", "\n", "numClients", ":=", "len", "(", "r", ".", "topologyClients", ")", "\n", "r", ".", "RUnlock", "("...
// notifyTopologyChange notifies all registered clients of a new change in // graph topology in a non-blocking.
[ "notifyTopologyChange", "notifies", "all", "registered", "clients", "of", "a", "new", "change", "in", "graph", "topology", "in", "a", "non", "-", "blocking", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/notifications.go#L118-L160
129,882
lightningnetwork/lnd
routing/notifications.go
createCloseSummaries
func createCloseSummaries(blockHeight uint32, closedChans ...*channeldb.ChannelEdgeInfo) []*ClosedChanSummary { closeSummaries := make([]*ClosedChanSummary, len(closedChans)) for i, closedChan := range closedChans { closeSummaries[i] = &ClosedChanSummary{ ChanID: closedChan.ChannelID, Capacity: cl...
go
func createCloseSummaries(blockHeight uint32, closedChans ...*channeldb.ChannelEdgeInfo) []*ClosedChanSummary { closeSummaries := make([]*ClosedChanSummary, len(closedChans)) for i, closedChan := range closedChans { closeSummaries[i] = &ClosedChanSummary{ ChanID: closedChan.ChannelID, Capacity: cl...
[ "func", "createCloseSummaries", "(", "blockHeight", "uint32", ",", "closedChans", "...", "*", "channeldb", ".", "ChannelEdgeInfo", ")", "[", "]", "*", "ClosedChanSummary", "{", "closeSummaries", ":=", "make", "(", "[", "]", "*", "ClosedChanSummary", ",", "len", ...
// createCloseSummaries takes in a slice of channels closed at the target block // height and creates a slice of summaries which of each channel closure.
[ "createCloseSummaries", "takes", "in", "a", "slice", "of", "channels", "closed", "at", "the", "target", "block", "height", "and", "creates", "a", "slice", "of", "summaries", "which", "of", "each", "channel", "closure", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/notifications.go#L214-L228
129,883
lightningnetwork/lnd
routing/notifications.go
addToTopologyChange
func addToTopologyChange(graph *channeldb.ChannelGraph, update *TopologyChange, msg interface{}) error { switch m := msg.(type) { // Any node announcement maps directly to a NetworkNodeUpdate struct. // No further data munging or db queries are required. case *channeldb.LightningNode: pubKey, err := m.PubKey()...
go
func addToTopologyChange(graph *channeldb.ChannelGraph, update *TopologyChange, msg interface{}) error { switch m := msg.(type) { // Any node announcement maps directly to a NetworkNodeUpdate struct. // No further data munging or db queries are required. case *channeldb.LightningNode: pubKey, err := m.PubKey()...
[ "func", "addToTopologyChange", "(", "graph", "*", "channeldb", ".", "ChannelGraph", ",", "update", "*", "TopologyChange", ",", "msg", "interface", "{", "}", ")", "error", "{", "switch", "m", ":=", "msg", ".", "(", "type", ")", "{", "// Any node announcement ...
// appendTopologyChange appends the passed update message to the passed // TopologyChange, properly identifying which type of update the message // constitutes. This function will also fetch any required auxiliary // information required to create the topology change update from the graph // database.
[ "appendTopologyChange", "appends", "the", "passed", "update", "message", "to", "the", "passed", "TopologyChange", "properly", "identifying", "which", "type", "of", "update", "the", "message", "constitutes", ".", "This", "function", "will", "also", "fetch", "any", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/notifications.go#L308-L390
129,884
lightningnetwork/lnd
lnrpc/invoicesrpc/utils.go
CreateRPCRouteHints
func CreateRPCRouteHints(routeHints [][]zpay32.HopHint) []*lnrpc.RouteHint { var res []*lnrpc.RouteHint for _, route := range routeHints { hopHints := make([]*lnrpc.HopHint, 0, len(route)) for _, hop := range route { pubKey := hex.EncodeToString( hop.NodeID.SerializeCompressed(), ) hint := &lnrpc.H...
go
func CreateRPCRouteHints(routeHints [][]zpay32.HopHint) []*lnrpc.RouteHint { var res []*lnrpc.RouteHint for _, route := range routeHints { hopHints := make([]*lnrpc.HopHint, 0, len(route)) for _, hop := range route { pubKey := hex.EncodeToString( hop.NodeID.SerializeCompressed(), ) hint := &lnrpc.H...
[ "func", "CreateRPCRouteHints", "(", "routeHints", "[", "]", "[", "]", "zpay32", ".", "HopHint", ")", "[", "]", "*", "lnrpc", ".", "RouteHint", "{", "var", "res", "[", "]", "*", "lnrpc", ".", "RouteHint", "\n\n", "for", "_", ",", "route", ":=", "range...
// CreateRPCRouteHints takes in the decoded form of an invoice's route hints // and converts them into the lnrpc type.
[ "CreateRPCRouteHints", "takes", "in", "the", "decoded", "form", "of", "an", "invoice", "s", "route", "hints", "and", "converts", "them", "into", "the", "lnrpc", "type", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/invoicesrpc/utils.go#L102-L128
129,885
lightningnetwork/lnd
routing/chainview/bitcoind.go
NewBitcoindFilteredChainView
func NewBitcoindFilteredChainView( chainConn *chain.BitcoindConn) *BitcoindFilteredChainView { chainView := &BitcoindFilteredChainView{ chainFilter: make(map[wire.OutPoint]struct{}), filterUpdates: make(chan filterUpdate), filterBlockReqs: make(chan *filterBlockReq), quit: make(chan struct{}...
go
func NewBitcoindFilteredChainView( chainConn *chain.BitcoindConn) *BitcoindFilteredChainView { chainView := &BitcoindFilteredChainView{ chainFilter: make(map[wire.OutPoint]struct{}), filterUpdates: make(chan filterUpdate), filterBlockReqs: make(chan *filterBlockReq), quit: make(chan struct{}...
[ "func", "NewBitcoindFilteredChainView", "(", "chainConn", "*", "chain", ".", "BitcoindConn", ")", "*", "BitcoindFilteredChainView", "{", "chainView", ":=", "&", "BitcoindFilteredChainView", "{", "chainFilter", ":", "make", "(", "map", "[", "wire", ".", "OutPoint", ...
// NewBitcoindFilteredChainView creates a new instance of a FilteredChainView // from RPC credentials and a ZMQ socket address for a bitcoind instance.
[ "NewBitcoindFilteredChainView", "creates", "a", "new", "instance", "of", "a", "FilteredChainView", "from", "RPC", "credentials", "and", "a", "ZMQ", "socket", "address", "for", "a", "bitcoind", "instance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/chainview/bitcoind.go#L63-L77
129,886
lightningnetwork/lnd
lnwire/node_announcement.go
NewNodeAlias
func NewNodeAlias(s string) (NodeAlias, error) { var n NodeAlias if len(s) > 32 { return n, fmt.Errorf("alias too large: max is %v, got %v", 32, len(s)) } if !utf8.ValidString(s) { return n, &ErrInvalidNodeAlias{} } copy(n[:], []byte(s)) return n, nil }
go
func NewNodeAlias(s string) (NodeAlias, error) { var n NodeAlias if len(s) > 32 { return n, fmt.Errorf("alias too large: max is %v, got %v", 32, len(s)) } if !utf8.ValidString(s) { return n, &ErrInvalidNodeAlias{} } copy(n[:], []byte(s)) return n, nil }
[ "func", "NewNodeAlias", "(", "s", "string", ")", "(", "NodeAlias", ",", "error", ")", "{", "var", "n", "NodeAlias", "\n\n", "if", "len", "(", "s", ")", ">", "32", "{", "return", "n", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "32", ",", "...
// NewNodeAlias creates a new instance of a NodeAlias. Verification is // performed on the passed string to ensure it meets the alias requirements.
[ "NewNodeAlias", "creates", "a", "new", "instance", "of", "a", "NodeAlias", ".", "Verification", "is", "performed", "on", "the", "passed", "string", "to", "ensure", "it", "meets", "the", "alias", "requirements", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/node_announcement.go#L49-L63
129,887
lightningnetwork/lnd
lnwire/node_announcement.go
UpdateNodeAnnAddrs
func UpdateNodeAnnAddrs(addrs []net.Addr) func(*NodeAnnouncement) { return func(nodeAnn *NodeAnnouncement) { nodeAnn.Addresses = addrs } }
go
func UpdateNodeAnnAddrs(addrs []net.Addr) func(*NodeAnnouncement) { return func(nodeAnn *NodeAnnouncement) { nodeAnn.Addresses = addrs } }
[ "func", "UpdateNodeAnnAddrs", "(", "addrs", "[", "]", "net", ".", "Addr", ")", "func", "(", "*", "NodeAnnouncement", ")", "{", "return", "func", "(", "nodeAnn", "*", "NodeAnnouncement", ")", "{", "nodeAnn", ".", "Addresses", "=", "addrs", "\n", "}", "\n"...
// UpdateNodeAnnAddrs is a functional option that allows updating the addresses // of the given node announcement.
[ "UpdateNodeAnnAddrs", "is", "a", "functional", "option", "that", "allows", "updating", "the", "addresses", "of", "the", "given", "node", "announcement", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/node_announcement.go#L111-L115
129,888
lightningnetwork/lnd
lnwire/node_announcement.go
Decode
func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error { err := ReadElements(r, &a.Signature, &a.Features, &a.Timestamp, &a.NodeID, &a.RGBColor, &a.Alias, &a.Addresses, ) if err != nil { return err } // Now that we've read out all the fields that we explicitly know of, // we'll collect...
go
func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error { err := ReadElements(r, &a.Signature, &a.Features, &a.Timestamp, &a.NodeID, &a.RGBColor, &a.Alias, &a.Addresses, ) if err != nil { return err } // Now that we've read out all the fields that we explicitly know of, // we'll collect...
[ "func", "(", "a", "*", "NodeAnnouncement", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "err", ":=", "ReadElements", "(", "r", ",", "&", "a", ".", "Signature", ",", "&", "a", ".", "Features", ",", "&", "...
// Decode deserializes a serialized NodeAnnouncement stored in the passed // io.Reader observing the specified protocol version. // // This is part of the lnwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "NodeAnnouncement", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "lnwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/node_announcement.go#L125-L152
129,889
lightningnetwork/lnd
lnwire/node_announcement.go
Encode
func (a *NodeAnnouncement) Encode(w io.Writer, pver uint32) error { return WriteElements(w, a.Signature, a.Features, a.Timestamp, a.NodeID, a.RGBColor, a.Alias, a.Addresses, a.ExtraOpaqueData, ) }
go
func (a *NodeAnnouncement) Encode(w io.Writer, pver uint32) error { return WriteElements(w, a.Signature, a.Features, a.Timestamp, a.NodeID, a.RGBColor, a.Alias, a.Addresses, a.ExtraOpaqueData, ) }
[ "func", "(", "a", "*", "NodeAnnouncement", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "a", ".", "Signature", ",", "a", ".", "Features", ",", "a", ".", "Timestamp",...
// Encode serializes the target NodeAnnouncement into the passed io.Writer // observing the protocol version specified. //
[ "Encode", "serializes", "the", "target", "NodeAnnouncement", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/node_announcement.go#L157-L168
129,890
lightningnetwork/lnd
lnwire/node_announcement.go
DataToSign
func (a *NodeAnnouncement) DataToSign() ([]byte, error) { // We should not include the signatures itself. var w bytes.Buffer err := WriteElements(&w, a.Features, a.Timestamp, a.NodeID, a.RGBColor, a.Alias[:], a.Addresses, a.ExtraOpaqueData, ) if err != nil { return nil, err } return w.Bytes(), ...
go
func (a *NodeAnnouncement) DataToSign() ([]byte, error) { // We should not include the signatures itself. var w bytes.Buffer err := WriteElements(&w, a.Features, a.Timestamp, a.NodeID, a.RGBColor, a.Alias[:], a.Addresses, a.ExtraOpaqueData, ) if err != nil { return nil, err } return w.Bytes(), ...
[ "func", "(", "a", "*", "NodeAnnouncement", ")", "DataToSign", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// We should not include the signatures itself.", "var", "w", "bytes", ".", "Buffer", "\n", "err", ":=", "WriteElements", "(", "&", "w", ...
// DataToSign returns the part of the message that should be signed.
[ "DataToSign", "returns", "the", "part", "of", "the", "message", "that", "should", "be", "signed", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/node_announcement.go#L187-L205
129,891
containerd/containerd
platforms/database.go
normalizeArch
func normalizeArch(arch, variant string) (string, string) { arch, variant = strings.ToLower(arch), strings.ToLower(variant) switch arch { case "i386": arch = "386" variant = "" case "x86_64", "x86-64": arch = "amd64" variant = "" case "aarch64", "arm64": arch = "arm64" switch variant { case "8", "v8"...
go
func normalizeArch(arch, variant string) (string, string) { arch, variant = strings.ToLower(arch), strings.ToLower(variant) switch arch { case "i386": arch = "386" variant = "" case "x86_64", "x86-64": arch = "amd64" variant = "" case "aarch64", "arm64": arch = "arm64" switch variant { case "8", "v8"...
[ "func", "normalizeArch", "(", "arch", ",", "variant", "string", ")", "(", "string", ",", "string", ")", "{", "arch", ",", "variant", "=", "strings", ".", "ToLower", "(", "arch", ")", ",", "strings", ".", "ToLower", "(", "variant", ")", "\n", "switch", ...
// normalizeArch normalizes the architecture.
[ "normalizeArch", "normalizes", "the", "architecture", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/platforms/database.go#L83-L114
129,892
containerd/containerd
identifiers/validate.go
Validate
func Validate(s string) error { if len(s) == 0 { return errors.Wrapf(errdefs.ErrInvalidArgument, "identifier must not be empty") } if len(s) > maxLength { return errors.Wrapf(errdefs.ErrInvalidArgument, "identifier %q greater than maximum length (%d characters)", s, maxLength) } if !identifierRe.MatchString(...
go
func Validate(s string) error { if len(s) == 0 { return errors.Wrapf(errdefs.ErrInvalidArgument, "identifier must not be empty") } if len(s) > maxLength { return errors.Wrapf(errdefs.ErrInvalidArgument, "identifier %q greater than maximum length (%d characters)", s, maxLength) } if !identifierRe.MatchString(...
[ "func", "Validate", "(", "s", "string", ")", "error", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "errors", ".", "Wrapf", "(", "errdefs", ".", "ErrInvalidArgument", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "s", ")...
// Validate return nil if the string s is a valid identifier. // // identifiers must be valid domain names according to RFC 1035, section 2.3.1. To // enforce case insensitivity, all characters must be lower case. // // In general, identifiers that pass this validation, should be safe for use as // a domain names or f...
[ "Validate", "return", "nil", "if", "the", "string", "s", "is", "a", "valid", "identifier", ".", "identifiers", "must", "be", "valid", "domain", "names", "according", "to", "RFC", "1035", "section", "2", ".", "3", ".", "1", ".", "To", "enforce", "case", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/identifiers/validate.go#L52-L65
129,893
containerd/containerd
pkg/dialer/dialer.go
Dialer
func Dialer(address string, timeout time.Duration) (net.Conn, error) { var ( stopC = make(chan struct{}) synC = make(chan *dialResult) ) go func() { defer close(synC) for { select { case <-stopC: return default: c, err := dialer(address, timeout) if isNoent(err) { <-time.After(10 *...
go
func Dialer(address string, timeout time.Duration) (net.Conn, error) { var ( stopC = make(chan struct{}) synC = make(chan *dialResult) ) go func() { defer close(synC) for { select { case <-stopC: return default: c, err := dialer(address, timeout) if isNoent(err) { <-time.After(10 *...
[ "func", "Dialer", "(", "address", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "var", "(", "stopC", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "synC", "=", "make", "(", "ch...
// Dialer returns a GRPC net.Conn connected to the provided address
[ "Dialer", "returns", "a", "GRPC", "net", ".", "Conn", "connected", "to", "the", "provided", "address" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/pkg/dialer/dialer.go#L32-L67
129,894
containerd/containerd
mount/mount_windows.go
Mount
func (m *Mount) Mount(target string) error { if m.Type != "windows-layer" { return errors.Errorf("invalid windows mount type: '%s'", m.Type) } home, layerID := filepath.Split(m.Source) parentLayerPaths, err := m.GetParentPaths() if err != nil { return err } var di = hcsshim.DriverInfo{ HomeDir: home, }...
go
func (m *Mount) Mount(target string) error { if m.Type != "windows-layer" { return errors.Errorf("invalid windows mount type: '%s'", m.Type) } home, layerID := filepath.Split(m.Source) parentLayerPaths, err := m.GetParentPaths() if err != nil { return err } var di = hcsshim.DriverInfo{ HomeDir: home, }...
[ "func", "(", "m", "*", "Mount", ")", "Mount", "(", "target", "string", ")", "error", "{", "if", "m", ".", "Type", "!=", "\"", "\"", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "m", ".", "Type", ")", "\n", "}", "\n\n", "home", ...
// Mount to the provided target
[ "Mount", "to", "the", "provided", "target" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/mount_windows.go#L34-L63
129,895
containerd/containerd
mount/mount_windows.go
GetParentPaths
func (m *Mount) GetParentPaths() ([]string, error) { var parentLayerPaths []string for _, option := range m.Options { if strings.HasPrefix(option, ParentLayerPathsFlag) { err := json.Unmarshal([]byte(option[len(ParentLayerPathsFlag):]), &parentLayerPaths) if err != nil { return nil, errors.Wrap(err, "fail...
go
func (m *Mount) GetParentPaths() ([]string, error) { var parentLayerPaths []string for _, option := range m.Options { if strings.HasPrefix(option, ParentLayerPathsFlag) { err := json.Unmarshal([]byte(option[len(ParentLayerPathsFlag):]), &parentLayerPaths) if err != nil { return nil, errors.Wrap(err, "fail...
[ "func", "(", "m", "*", "Mount", ")", "GetParentPaths", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "parentLayerPaths", "[", "]", "string", "\n", "for", "_", ",", "option", ":=", "range", "m", ".", "Options", "{", "if", "string...
// GetParentPaths of the mount
[ "GetParentPaths", "of", "the", "mount" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/mount_windows.go#L70-L81
129,896
containerd/containerd
mount/mount_windows.go
Unmount
func Unmount(mount string, flags int) error { var ( home, layerID = filepath.Split(mount) di = hcsshim.DriverInfo{ HomeDir: home, } ) if err := hcsshim.UnprepareLayer(di, layerID); err != nil { return errors.Wrapf(err, "failed to unprepare layer %s", mount) } if err := hcsshim.DeactivateLaye...
go
func Unmount(mount string, flags int) error { var ( home, layerID = filepath.Split(mount) di = hcsshim.DriverInfo{ HomeDir: home, } ) if err := hcsshim.UnprepareLayer(di, layerID); err != nil { return errors.Wrapf(err, "failed to unprepare layer %s", mount) } if err := hcsshim.DeactivateLaye...
[ "func", "Unmount", "(", "mount", "string", ",", "flags", "int", ")", "error", "{", "var", "(", "home", ",", "layerID", "=", "filepath", ".", "Split", "(", "mount", ")", "\n", "di", "=", "hcsshim", ".", "DriverInfo", "{", "HomeDir", ":", "home", ",", ...
// Unmount the mount at the provided path
[ "Unmount", "the", "mount", "at", "the", "provided", "path" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/mount_windows.go#L84-L100
129,897
containerd/containerd
sys/mount_linux.go
FMountat
func FMountat(dirfd uintptr, source, target, fstype string, flags uintptr, data string) error { var ( sourceP, targetP, fstypeP, dataP *byte pid uintptr ws unix.WaitStatus err error errno syscal...
go
func FMountat(dirfd uintptr, source, target, fstype string, flags uintptr, data string) error { var ( sourceP, targetP, fstypeP, dataP *byte pid uintptr ws unix.WaitStatus err error errno syscal...
[ "func", "FMountat", "(", "dirfd", "uintptr", ",", "source", ",", "target", ",", "fstype", "string", ",", "flags", "uintptr", ",", "data", "string", ")", "error", "{", "var", "(", "sourceP", ",", "targetP", ",", "fstypeP", ",", "dataP", "*", "byte", "\n...
// FMountat performs mount from the provided directory.
[ "FMountat", "performs", "mount", "from", "the", "provided", "directory", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/sys/mount_linux.go#L29-L88
129,898
containerd/containerd
errdefs/grpc.go
ToGRPC
func ToGRPC(err error) error { if err == nil { return nil } if isGRPCError(err) { // error has already been mapped to grpc return err } switch { case IsInvalidArgument(err): return status.Errorf(codes.InvalidArgument, err.Error()) case IsNotFound(err): return status.Errorf(codes.NotFound, err.Error()...
go
func ToGRPC(err error) error { if err == nil { return nil } if isGRPCError(err) { // error has already been mapped to grpc return err } switch { case IsInvalidArgument(err): return status.Errorf(codes.InvalidArgument, err.Error()) case IsNotFound(err): return status.Errorf(codes.NotFound, err.Error()...
[ "func", "ToGRPC", "(", "err", "error", ")", "error", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "isGRPCError", "(", "err", ")", "{", "// error has already been mapped to grpc", "return", "err", "\n", "}", "\n\n", "switch"...
// ToGRPC will attempt to map the backend containerd error into a grpc error, // using the original error message as a description. // // Further information may be extracted from certain errors depending on their // type. // // If the error is unmapped, the original error will be returned to be handled // by the regul...
[ "ToGRPC", "will", "attempt", "to", "map", "the", "backend", "containerd", "error", "into", "a", "grpc", "error", "using", "the", "original", "error", "message", "as", "a", "description", ".", "Further", "information", "may", "be", "extracted", "from", "certain...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/errdefs/grpc.go#L35-L61
129,899
containerd/containerd
errdefs/grpc.go
FromGRPC
func FromGRPC(err error) error { if err == nil { return nil } var cls error // divide these into error classes, becomes the cause switch code(err) { case codes.InvalidArgument: cls = ErrInvalidArgument case codes.AlreadyExists: cls = ErrAlreadyExists case codes.NotFound: cls = ErrNotFound case codes.U...
go
func FromGRPC(err error) error { if err == nil { return nil } var cls error // divide these into error classes, becomes the cause switch code(err) { case codes.InvalidArgument: cls = ErrInvalidArgument case codes.AlreadyExists: cls = ErrAlreadyExists case codes.NotFound: cls = ErrNotFound case codes.U...
[ "func", "FromGRPC", "(", "err", "error", ")", "error", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "var", "cls", "error", "// divide these into error classes, becomes the cause", "\n\n", "switch", "code", "(", "err", ")", "{", "ca...
// FromGRPC returns the underlying error from a grpc service based on the grpc error code
[ "FromGRPC", "returns", "the", "underlying", "error", "from", "a", "grpc", "service", "based", "on", "the", "grpc", "error", "code" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/errdefs/grpc.go#L72-L104