id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
128,600 | lightningnetwork/lnd | aezeed/cipherseed.go | ToCipherSeed | func (m *Mnemonic) ToCipherSeed(pass []byte) (*CipherSeed, error) {
// First, we'll attempt to decipher the mnemonic by mapping back into
// our byte slice and applying our deciphering scheme.
plainSeed, err := m.Decipher(pass)
if err != nil {
return nil, err
}
// If decryption was successful, then we'll decod... | go | func (m *Mnemonic) ToCipherSeed(pass []byte) (*CipherSeed, error) {
// First, we'll attempt to decipher the mnemonic by mapping back into
// our byte slice and applying our deciphering scheme.
plainSeed, err := m.Decipher(pass)
if err != nil {
return nil, err
}
// If decryption was successful, then we'll decod... | [
"func",
"(",
"m",
"*",
"Mnemonic",
")",
"ToCipherSeed",
"(",
"pass",
"[",
"]",
"byte",
")",
"(",
"*",
"CipherSeed",
",",
"error",
")",
"{",
"// First, we'll attempt to decipher the mnemonic by mapping back into",
"// our byte slice and applying our deciphering scheme.",
"... | // ToCipherSeed attempts to map the mnemonic to the original cipher text byte
// slice. Then we'll attempt to decrypt the ciphertext using aez with the
// passed passphrase, using the last 5 bytes of the ciphertext as a salt for
// the KDF. | [
"ToCipherSeed",
"attempts",
"to",
"map",
"the",
"mnemonic",
"to",
"the",
"original",
"cipher",
"text",
"byte",
"slice",
".",
"Then",
"we",
"ll",
"attempt",
"to",
"decrypt",
"the",
"ciphertext",
"using",
"aez",
"with",
"the",
"passed",
"passphrase",
"using",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L432-L448 |
128,601 | lightningnetwork/lnd | aezeed/cipherseed.go | decipherCipherSeed | func decipherCipherSeed(cipherSeedBytes [EncipheredCipherSeedSize]byte,
pass []byte) ([DecipheredCipherSeedSize]byte, error) {
var plainSeed [DecipheredCipherSeedSize]byte
// Before we do anything, we'll ensure that the version is one that we
// understand. Otherwise, we won't be able to decrypt, or even parse
/... | go | func decipherCipherSeed(cipherSeedBytes [EncipheredCipherSeedSize]byte,
pass []byte) ([DecipheredCipherSeedSize]byte, error) {
var plainSeed [DecipheredCipherSeedSize]byte
// Before we do anything, we'll ensure that the version is one that we
// understand. Otherwise, we won't be able to decrypt, or even parse
/... | [
"func",
"decipherCipherSeed",
"(",
"cipherSeedBytes",
"[",
"EncipheredCipherSeedSize",
"]",
"byte",
",",
"pass",
"[",
"]",
"byte",
")",
"(",
"[",
"DecipheredCipherSeedSize",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"plainSeed",
"[",
"DecipheredCipherSeedSize",
... | // decipherCipherSeed attempts to decipher the passed cipher seed ciphertext
// using the passed passphrase. This function is the opposite of
// the encipher method. | [
"decipherCipherSeed",
"attempts",
"to",
"decipher",
"the",
"passed",
"cipher",
"seed",
"ciphertext",
"using",
"the",
"passed",
"passphrase",
".",
"This",
"function",
"is",
"the",
"opposite",
"of",
"the",
"encipher",
"method",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L453-L503 |
128,602 | lightningnetwork/lnd | aezeed/cipherseed.go | Decipher | func (m *Mnemonic) Decipher(pass []byte) ([DecipheredCipherSeedSize]byte, error) {
// Before we attempt to map the mnemonic back to the original
// ciphertext, we'll ensure that all the word are actually a part of
// the current default word list.
for _, word := range m {
if !strings.Contains(englishWordList, wo... | go | func (m *Mnemonic) Decipher(pass []byte) ([DecipheredCipherSeedSize]byte, error) {
// Before we attempt to map the mnemonic back to the original
// ciphertext, we'll ensure that all the word are actually a part of
// the current default word list.
for _, word := range m {
if !strings.Contains(englishWordList, wo... | [
"func",
"(",
"m",
"*",
"Mnemonic",
")",
"Decipher",
"(",
"pass",
"[",
"]",
"byte",
")",
"(",
"[",
"DecipheredCipherSeedSize",
"]",
"byte",
",",
"error",
")",
"{",
"// Before we attempt to map the mnemonic back to the original",
"// ciphertext, we'll ensure that all the ... | // Decipher attempts to decipher the encoded mnemonic by first mapping to the
// original chipertext, then applying our deciphering scheme. ErrInvalidPass
// will be returned if the passphrase is incorrect. | [
"Decipher",
"attempts",
"to",
"decipher",
"the",
"encoded",
"mnemonic",
"by",
"first",
"mapping",
"to",
"the",
"original",
"chipertext",
"then",
"applying",
"our",
"deciphering",
"scheme",
".",
"ErrInvalidPass",
"will",
"be",
"returned",
"if",
"the",
"passphrase",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L508-L535 |
128,603 | lightningnetwork/lnd | aezeed/cipherseed.go | ChangePass | func (m *Mnemonic) ChangePass(oldPass, newPass []byte) (Mnemonic, error) {
var newmnemonic Mnemonic
// First, we'll try to decrypt the current mnemonic using the existing
// passphrase. If this fails, then we can't proceed any further.
cipherSeed, err := m.ToCipherSeed(oldPass)
if err != nil {
return newmnemoni... | go | func (m *Mnemonic) ChangePass(oldPass, newPass []byte) (Mnemonic, error) {
var newmnemonic Mnemonic
// First, we'll try to decrypt the current mnemonic using the existing
// passphrase. If this fails, then we can't proceed any further.
cipherSeed, err := m.ToCipherSeed(oldPass)
if err != nil {
return newmnemoni... | [
"func",
"(",
"m",
"*",
"Mnemonic",
")",
"ChangePass",
"(",
"oldPass",
",",
"newPass",
"[",
"]",
"byte",
")",
"(",
"Mnemonic",
",",
"error",
")",
"{",
"var",
"newmnemonic",
"Mnemonic",
"\n\n",
"// First, we'll try to decrypt the current mnemonic using the existing",
... | // ChangePass takes an existing mnemonic, and passphrase for said mnemonic and
// re-enciphers the plaintext cipher seed into a brand new mnemonic. This can
// be used to allow users to re-encrypt the same seed with multiple pass
// phrases, or just change the passphrase on an existing seed. | [
"ChangePass",
"takes",
"an",
"existing",
"mnemonic",
"and",
"passphrase",
"for",
"said",
"mnemonic",
"and",
"re",
"-",
"enciphers",
"the",
"plaintext",
"cipher",
"seed",
"into",
"a",
"brand",
"new",
"mnemonic",
".",
"This",
"can",
"be",
"used",
"to",
"allow"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/aezeed/cipherseed.go#L541-L554 |
128,604 | lightningnetwork/lnd | lnwire/announcement_signatures.go | Decode | func (a *AnnounceSignatures) Decode(r io.Reader, pver uint32) error {
err := ReadElements(r,
&a.ChannelID,
&a.ShortChannelID,
&a.NodeSignature,
&a.BitcoinSignature,
)
if err != nil {
return err
}
// Now that we've read out all the fields that we explicitly know of,
// we'll collect the remainder into t... | go | func (a *AnnounceSignatures) Decode(r io.Reader, pver uint32) error {
err := ReadElements(r,
&a.ChannelID,
&a.ShortChannelID,
&a.NodeSignature,
&a.BitcoinSignature,
)
if err != nil {
return err
}
// Now that we've read out all the fields that we explicitly know of,
// we'll collect the remainder into t... | [
"func",
"(",
"a",
"*",
"AnnounceSignatures",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
",",
"pver",
"uint32",
")",
"error",
"{",
"err",
":=",
"ReadElements",
"(",
"r",
",",
"&",
"a",
".",
"ChannelID",
",",
"&",
"a",
".",
"ShortChannelID",
",",
... | // Decode deserializes a serialized AnnounceSignatures stored in the passed
// io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"Decode",
"deserializes",
"a",
"serialized",
"AnnounceSignatures",
"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/announcement_signatures.go#L54-L78 |
128,605 | lightningnetwork/lnd | lnwire/announcement_signatures.go | Encode | func (a *AnnounceSignatures) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
a.ChannelID,
a.ShortChannelID,
a.NodeSignature,
a.BitcoinSignature,
a.ExtraOpaqueData,
)
} | go | func (a *AnnounceSignatures) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
a.ChannelID,
a.ShortChannelID,
a.NodeSignature,
a.BitcoinSignature,
a.ExtraOpaqueData,
)
} | [
"func",
"(",
"a",
"*",
"AnnounceSignatures",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"WriteElements",
"(",
"w",
",",
"a",
".",
"ChannelID",
",",
"a",
".",
"ShortChannelID",
",",
"a",
".",
"Nod... | // Encode serializes the target AnnounceSignatures into the passed io.Writer
// observing the protocol version specified.
//
// This is part of the lnwire.Message interface. | [
"Encode",
"serializes",
"the",
"target",
"AnnounceSignatures",
"into",
"the",
"passed",
"io",
".",
"Writer",
"observing",
"the",
"protocol",
"version",
"specified",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/announcement_signatures.go#L84-L92 |
128,606 | lightningnetwork/lnd | chainntnfs/interface.go | String | func (t TxConfStatus) String() string {
switch t {
case TxFoundMempool:
return "TxFoundMempool"
case TxFoundIndex:
return "TxFoundIndex"
case TxNotFoundIndex:
return "TxNotFoundIndex"
case TxFoundManually:
return "TxFoundManually"
case TxNotFoundManually:
return "TxNotFoundManually"
default:
ret... | go | func (t TxConfStatus) String() string {
switch t {
case TxFoundMempool:
return "TxFoundMempool"
case TxFoundIndex:
return "TxFoundIndex"
case TxNotFoundIndex:
return "TxNotFoundIndex"
case TxFoundManually:
return "TxFoundManually"
case TxNotFoundManually:
return "TxNotFoundManually"
default:
ret... | [
"func",
"(",
"t",
"TxConfStatus",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"TxFoundMempool",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"TxFoundIndex",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"TxNotFoundIndex",
":",
"return",
... | // String returns the string representation of the TxConfStatus. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"the",
"TxConfStatus",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/interface.go#L45-L65 |
128,607 | lightningnetwork/lnd | chainntnfs/interface.go | NewConfirmationEvent | func NewConfirmationEvent(numConfs uint32, cancel func()) *ConfirmationEvent {
return &ConfirmationEvent{
Confirmed: make(chan *TxConfirmation, 1),
Updates: make(chan uint32, numConfs),
NegativeConf: make(chan int32, 1),
Done: make(chan struct{}, 1),
Cancel: cancel,
}
} | go | func NewConfirmationEvent(numConfs uint32, cancel func()) *ConfirmationEvent {
return &ConfirmationEvent{
Confirmed: make(chan *TxConfirmation, 1),
Updates: make(chan uint32, numConfs),
NegativeConf: make(chan int32, 1),
Done: make(chan struct{}, 1),
Cancel: cancel,
}
} | [
"func",
"NewConfirmationEvent",
"(",
"numConfs",
"uint32",
",",
"cancel",
"func",
"(",
")",
")",
"*",
"ConfirmationEvent",
"{",
"return",
"&",
"ConfirmationEvent",
"{",
"Confirmed",
":",
"make",
"(",
"chan",
"*",
"TxConfirmation",
",",
"1",
")",
",",
"Update... | // NewConfirmationEvent constructs a new ConfirmationEvent with newly opened
// channels. | [
"NewConfirmationEvent",
"constructs",
"a",
"new",
"ConfirmationEvent",
"with",
"newly",
"opened",
"channels",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/interface.go#L218-L226 |
128,608 | lightningnetwork/lnd | chainntnfs/interface.go | NewSpendEvent | func NewSpendEvent(cancel func()) *SpendEvent {
return &SpendEvent{
Spend: make(chan *SpendDetail, 1),
Reorg: make(chan struct{}, 1),
Done: make(chan struct{}, 1),
Cancel: cancel,
}
} | go | func NewSpendEvent(cancel func()) *SpendEvent {
return &SpendEvent{
Spend: make(chan *SpendDetail, 1),
Reorg: make(chan struct{}, 1),
Done: make(chan struct{}, 1),
Cancel: cancel,
}
} | [
"func",
"NewSpendEvent",
"(",
"cancel",
"func",
"(",
")",
")",
"*",
"SpendEvent",
"{",
"return",
"&",
"SpendEvent",
"{",
"Spend",
":",
"make",
"(",
"chan",
"*",
"SpendDetail",
",",
"1",
")",
",",
"Reorg",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",... | // NewSpendEvent constructs a new SpendEvent with newly opened channels. | [
"NewSpendEvent",
"constructs",
"a",
"new",
"SpendEvent",
"with",
"newly",
"opened",
"channels",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/interface.go#L274-L281 |
128,609 | lightningnetwork/lnd | chainntnfs/interface.go | GetClientMissedBlocks | func GetClientMissedBlocks(chainConn ChainConn, clientBestBlock *BlockEpoch,
notifierBestHeight int32, backendStoresReorgs bool) ([]BlockEpoch, error) {
startingHeight := clientBestBlock.Height
if backendStoresReorgs {
// If a reorg causes the client's best hash to be incorrect,
// retrieve the closest common a... | go | func GetClientMissedBlocks(chainConn ChainConn, clientBestBlock *BlockEpoch,
notifierBestHeight int32, backendStoresReorgs bool) ([]BlockEpoch, error) {
startingHeight := clientBestBlock.Height
if backendStoresReorgs {
// If a reorg causes the client's best hash to be incorrect,
// retrieve the closest common a... | [
"func",
"GetClientMissedBlocks",
"(",
"chainConn",
"ChainConn",
",",
"clientBestBlock",
"*",
"BlockEpoch",
",",
"notifierBestHeight",
"int32",
",",
"backendStoresReorgs",
"bool",
")",
"(",
"[",
"]",
"BlockEpoch",
",",
"error",
")",
"{",
"startingHeight",
":=",
"cl... | // GetClientMissedBlocks uses a client's best block to determine what blocks
// it missed being notified about, and returns them in a slice. Its
// backendStoresReorgs parameter tells it whether or not the notifier's
// chainConn stores information about blocks that have been reorged out of the
// chain, which allows G... | [
"GetClientMissedBlocks",
"uses",
"a",
"client",
"s",
"best",
"block",
"to",
"determine",
"what",
"blocks",
"it",
"missed",
"being",
"notified",
"about",
"and",
"returns",
"them",
"in",
"a",
"slice",
".",
"Its",
"backendStoresReorgs",
"parameter",
"tells",
"it",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/interface.go#L437-L471 |
128,610 | lightningnetwork/lnd | chainntnfs/interface.go | RewindChain | func RewindChain(chainConn ChainConn, txNotifier *TxNotifier,
currBestBlock BlockEpoch, targetHeight int32) (BlockEpoch, error) {
newBestBlock := BlockEpoch{
Height: currBestBlock.Height,
Hash: currBestBlock.Hash,
}
for height := currBestBlock.Height; height > targetHeight; height-- {
hash, err := chainCo... | go | func RewindChain(chainConn ChainConn, txNotifier *TxNotifier,
currBestBlock BlockEpoch, targetHeight int32) (BlockEpoch, error) {
newBestBlock := BlockEpoch{
Height: currBestBlock.Height,
Hash: currBestBlock.Hash,
}
for height := currBestBlock.Height; height > targetHeight; height-- {
hash, err := chainCo... | [
"func",
"RewindChain",
"(",
"chainConn",
"ChainConn",
",",
"txNotifier",
"*",
"TxNotifier",
",",
"currBestBlock",
"BlockEpoch",
",",
"targetHeight",
"int32",
")",
"(",
"BlockEpoch",
",",
"error",
")",
"{",
"newBestBlock",
":=",
"BlockEpoch",
"{",
"Height",
":",
... | // RewindChain handles internal state updates for the notifier's TxNotifier It
// has no effect if given a height greater than or equal to our current best
// known height. It returns the new best block for the notifier. | [
"RewindChain",
"handles",
"internal",
"state",
"updates",
"for",
"the",
"notifier",
"s",
"TxNotifier",
"It",
"has",
"no",
"effect",
"if",
"given",
"a",
"height",
"greater",
"than",
"or",
"equal",
"to",
"our",
"current",
"best",
"known",
"height",
".",
"It",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/interface.go#L476-L505 |
128,611 | lightningnetwork/lnd | chainntnfs/interface.go | HandleMissedBlocks | func HandleMissedBlocks(chainConn ChainConn, txNotifier *TxNotifier,
currBestBlock BlockEpoch, newHeight int32,
backendStoresReorgs bool) (BlockEpoch, []BlockEpoch, error) {
startingHeight := currBestBlock.Height
if backendStoresReorgs {
// If a reorg causes our best hash to be incorrect, rewind the
// chain ... | go | func HandleMissedBlocks(chainConn ChainConn, txNotifier *TxNotifier,
currBestBlock BlockEpoch, newHeight int32,
backendStoresReorgs bool) (BlockEpoch, []BlockEpoch, error) {
startingHeight := currBestBlock.Height
if backendStoresReorgs {
// If a reorg causes our best hash to be incorrect, rewind the
// chain ... | [
"func",
"HandleMissedBlocks",
"(",
"chainConn",
"ChainConn",
",",
"txNotifier",
"*",
"TxNotifier",
",",
"currBestBlock",
"BlockEpoch",
",",
"newHeight",
"int32",
",",
"backendStoresReorgs",
"bool",
")",
"(",
"BlockEpoch",
",",
"[",
"]",
"BlockEpoch",
",",
"error",... | // HandleMissedBlocks is called when the chain backend for a notifier misses a
// series of blocks, handling a reorg if necessary. Its backendStoresReorgs
// parameter tells it whether or not the notifier's chainConn stores
// information about blocks that have been reorged out of the chain, which allows
// HandleMisse... | [
"HandleMissedBlocks",
"is",
"called",
"when",
"the",
"chain",
"backend",
"for",
"a",
"notifier",
"misses",
"a",
"series",
"of",
"blocks",
"handling",
"a",
"reorg",
"if",
"necessary",
".",
"Its",
"backendStoresReorgs",
"parameter",
"tells",
"it",
"whether",
"or",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/interface.go#L517-L560 |
128,612 | lightningnetwork/lnd | input/txout.go | writeTxOut | func writeTxOut(w io.Writer, txo *wire.TxOut) error {
var scratch [8]byte
binary.BigEndian.PutUint64(scratch[:], uint64(txo.Value))
if _, err := w.Write(scratch[:]); err != nil {
return err
}
if err := wire.WriteVarBytes(w, 0, txo.PkScript); err != nil {
return err
}
return nil
} | go | func writeTxOut(w io.Writer, txo *wire.TxOut) error {
var scratch [8]byte
binary.BigEndian.PutUint64(scratch[:], uint64(txo.Value))
if _, err := w.Write(scratch[:]); err != nil {
return err
}
if err := wire.WriteVarBytes(w, 0, txo.PkScript); err != nil {
return err
}
return nil
} | [
"func",
"writeTxOut",
"(",
"w",
"io",
".",
"Writer",
",",
"txo",
"*",
"wire",
".",
"TxOut",
")",
"error",
"{",
"var",
"scratch",
"[",
"8",
"]",
"byte",
"\n\n",
"binary",
".",
"BigEndian",
".",
"PutUint64",
"(",
"scratch",
"[",
":",
"]",
",",
"uint6... | // writeTxOut serializes a wire.TxOut struct into the passed io.Writer stream. | [
"writeTxOut",
"serializes",
"a",
"wire",
".",
"TxOut",
"struct",
"into",
"the",
"passed",
"io",
".",
"Writer",
"stream",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/txout.go#L11-L24 |
128,613 | lightningnetwork/lnd | input/txout.go | readTxOut | func readTxOut(r io.Reader, txo *wire.TxOut) error {
var scratch [8]byte
if _, err := io.ReadFull(r, scratch[:]); err != nil {
return err
}
value := int64(binary.BigEndian.Uint64(scratch[:]))
pkScript, err := wire.ReadVarBytes(r, 0, 80, "pkScript")
if err != nil {
return err
}
*txo = wire.TxOut{
Value:... | go | func readTxOut(r io.Reader, txo *wire.TxOut) error {
var scratch [8]byte
if _, err := io.ReadFull(r, scratch[:]); err != nil {
return err
}
value := int64(binary.BigEndian.Uint64(scratch[:]))
pkScript, err := wire.ReadVarBytes(r, 0, 80, "pkScript")
if err != nil {
return err
}
*txo = wire.TxOut{
Value:... | [
"func",
"readTxOut",
"(",
"r",
"io",
".",
"Reader",
",",
"txo",
"*",
"wire",
".",
"TxOut",
")",
"error",
"{",
"var",
"scratch",
"[",
"8",
"]",
"byte",
"\n\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"scratch",
"[",
":... | // readTxOut deserializes a wire.TxOut struct from the passed io.Reader stream. | [
"readTxOut",
"deserializes",
"a",
"wire",
".",
"TxOut",
"struct",
"from",
"the",
"passed",
"io",
".",
"Reader",
"stream",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/txout.go#L27-L46 |
128,614 | lightningnetwork/lnd | lnwire/update_fail_htlc.go | Decode | func (c *UpdateFailHTLC) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&c.ChanID,
&c.ID,
&c.Reason,
)
} | go | func (c *UpdateFailHTLC) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&c.ChanID,
&c.ID,
&c.Reason,
)
} | [
"func",
"(",
"c",
"*",
"UpdateFailHTLC",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"ReadElements",
"(",
"r",
",",
"&",
"c",
".",
"ChanID",
",",
"&",
"c",
".",
"ID",
",",
"&",
"c",
".",
"Re... | // Decode deserializes a serialized UpdateFailHTLC message stored in the passed
// io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"Decode",
"deserializes",
"a",
"serialized",
"UpdateFailHTLC",
"message",
"stored",
"in",
"the",
"passed",
"io",
".",
"Reader",
"observing",
"the",
"specified",
"protocol",
"version",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fail_htlc.go#L37-L43 |
128,615 | lightningnetwork/lnd | lnwire/update_fail_htlc.go | Encode | func (c *UpdateFailHTLC) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
c.ChanID,
c.ID,
c.Reason,
)
} | go | func (c *UpdateFailHTLC) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
c.ChanID,
c.ID,
c.Reason,
)
} | [
"func",
"(",
"c",
"*",
"UpdateFailHTLC",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"WriteElements",
"(",
"w",
",",
"c",
".",
"ChanID",
",",
"c",
".",
"ID",
",",
"c",
".",
"Reason",
",",
")",... | // Encode serializes the target UpdateFailHTLC into the passed io.Writer observing
// the protocol version specified.
//
// This is part of the lnwire.Message interface. | [
"Encode",
"serializes",
"the",
"target",
"UpdateFailHTLC",
"into",
"the",
"passed",
"io",
".",
"Writer",
"observing",
"the",
"protocol",
"version",
"specified",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fail_htlc.go#L49-L55 |
128,616 | lightningnetwork/lnd | lnwire/update_fail_htlc.go | MaxPayloadLength | func (c *UpdateFailHTLC) MaxPayloadLength(uint32) uint32 {
var length uint32
// Length of the ChanID
length += 32
// Length of the ID
length += 8
// Length of the length opaque reason
length += 2
// Length of the Reason
length += 292
return length
} | go | func (c *UpdateFailHTLC) MaxPayloadLength(uint32) uint32 {
var length uint32
// Length of the ChanID
length += 32
// Length of the ID
length += 8
// Length of the length opaque reason
length += 2
// Length of the Reason
length += 292
return length
} | [
"func",
"(",
"c",
"*",
"UpdateFailHTLC",
")",
"MaxPayloadLength",
"(",
"uint32",
")",
"uint32",
"{",
"var",
"length",
"uint32",
"\n\n",
"// Length of the ChanID",
"length",
"+=",
"32",
"\n\n",
"// Length of the ID",
"length",
"+=",
"8",
"\n\n",
"// Length of the l... | // MaxPayloadLength returns the maximum allowed payload size for an UpdateFailHTLC
// complete message observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"MaxPayloadLength",
"returns",
"the",
"maximum",
"allowed",
"payload",
"size",
"for",
"an",
"UpdateFailHTLC",
"complete",
"message",
"observing",
"the",
"specified",
"protocol",
"version",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interfac... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fail_htlc.go#L69-L85 |
128,617 | lightningnetwork/lnd | channeldb/addr.go | encodeTCPAddr | func encodeTCPAddr(w io.Writer, addr *net.TCPAddr) error {
var (
addrType byte
ip []byte
)
if addr.IP.To4() != nil {
addrType = byte(tcp4Addr)
ip = addr.IP.To4()
} else {
addrType = byte(tcp6Addr)
ip = addr.IP.To16()
}
if ip == nil {
return fmt.Errorf("unable to encode IP %v", addr.IP)
}
... | go | func encodeTCPAddr(w io.Writer, addr *net.TCPAddr) error {
var (
addrType byte
ip []byte
)
if addr.IP.To4() != nil {
addrType = byte(tcp4Addr)
ip = addr.IP.To4()
} else {
addrType = byte(tcp6Addr)
ip = addr.IP.To16()
}
if ip == nil {
return fmt.Errorf("unable to encode IP %v", addr.IP)
}
... | [
"func",
"encodeTCPAddr",
"(",
"w",
"io",
".",
"Writer",
",",
"addr",
"*",
"net",
".",
"TCPAddr",
")",
"error",
"{",
"var",
"(",
"addrType",
"byte",
"\n",
"ip",
"[",
"]",
"byte",
"\n",
")",
"\n\n",
"if",
"addr",
".",
"IP",
".",
"To4",
"(",
")",
... | // encodeTCPAddr serializes a TCP address into its compact raw bytes
// representation. | [
"encodeTCPAddr",
"serializes",
"a",
"TCP",
"address",
"into",
"its",
"compact",
"raw",
"bytes",
"representation",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/addr.go#L33-L66 |
128,618 | lightningnetwork/lnd | channeldb/addr.go | encodeOnionAddr | func encodeOnionAddr(w io.Writer, addr *tor.OnionAddr) error {
var suffixIndex int
hostLen := len(addr.OnionService)
switch hostLen {
case tor.V2Len:
if _, err := w.Write([]byte{byte(v2OnionAddr)}); err != nil {
return err
}
suffixIndex = tor.V2Len - tor.OnionSuffixLen
case tor.V3Len:
if _, err := w.Wri... | go | func encodeOnionAddr(w io.Writer, addr *tor.OnionAddr) error {
var suffixIndex int
hostLen := len(addr.OnionService)
switch hostLen {
case tor.V2Len:
if _, err := w.Write([]byte{byte(v2OnionAddr)}); err != nil {
return err
}
suffixIndex = tor.V2Len - tor.OnionSuffixLen
case tor.V3Len:
if _, err := w.Wri... | [
"func",
"encodeOnionAddr",
"(",
"w",
"io",
".",
"Writer",
",",
"addr",
"*",
"tor",
".",
"OnionAddr",
")",
"error",
"{",
"var",
"suffixIndex",
"int",
"\n",
"hostLen",
":=",
"len",
"(",
"addr",
".",
"OnionService",
")",
"\n",
"switch",
"hostLen",
"{",
"c... | // encodeOnionAddr serializes an onion address into its compact raw bytes
// representation. | [
"encodeOnionAddr",
"serializes",
"an",
"onion",
"address",
"into",
"its",
"compact",
"raw",
"bytes",
"representation",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/addr.go#L70-L122 |
128,619 | lightningnetwork/lnd | channeldb/addr.go | serializeAddr | func serializeAddr(w io.Writer, address net.Addr) error {
switch addr := address.(type) {
case *net.TCPAddr:
return encodeTCPAddr(w, addr)
case *tor.OnionAddr:
return encodeOnionAddr(w, addr)
default:
return ErrUnknownAddressType
}
} | go | func serializeAddr(w io.Writer, address net.Addr) error {
switch addr := address.(type) {
case *net.TCPAddr:
return encodeTCPAddr(w, addr)
case *tor.OnionAddr:
return encodeOnionAddr(w, addr)
default:
return ErrUnknownAddressType
}
} | [
"func",
"serializeAddr",
"(",
"w",
"io",
".",
"Writer",
",",
"address",
"net",
".",
"Addr",
")",
"error",
"{",
"switch",
"addr",
":=",
"address",
".",
"(",
"type",
")",
"{",
"case",
"*",
"net",
".",
"TCPAddr",
":",
"return",
"encodeTCPAddr",
"(",
"w"... | // serializeAddr serializes an address into its raw bytes representation so that
// it can be deserialized without requiring address resolution. | [
"serializeAddr",
"serializes",
"an",
"address",
"into",
"its",
"raw",
"bytes",
"representation",
"so",
"that",
"it",
"can",
"be",
"deserialized",
"without",
"requiring",
"address",
"resolution",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/addr.go#L212-L221 |
128,620 | lightningnetwork/lnd | cmd/lncli/types.go | NewOutPointFromProto | func NewOutPointFromProto(op *lnrpc.OutPoint) OutPoint {
return OutPoint(fmt.Sprintf("%s:%d", op.TxidStr, op.OutputIndex))
} | go | func NewOutPointFromProto(op *lnrpc.OutPoint) OutPoint {
return OutPoint(fmt.Sprintf("%s:%d", op.TxidStr, op.OutputIndex))
} | [
"func",
"NewOutPointFromProto",
"(",
"op",
"*",
"lnrpc",
".",
"OutPoint",
")",
"OutPoint",
"{",
"return",
"OutPoint",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"op",
".",
"TxidStr",
",",
"op",
".",
"OutputIndex",
")",
")",
"\n",
"}"
] | // NewOutPointFromProto formats the lnrpc.OutPoint into an OutPoint for display. | [
"NewOutPointFromProto",
"formats",
"the",
"lnrpc",
".",
"OutPoint",
"into",
"an",
"OutPoint",
"for",
"display",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/types.go#L13-L15 |
128,621 | lightningnetwork/lnd | cmd/lncli/types.go | NewUtxoFromProto | func NewUtxoFromProto(utxo *lnrpc.Utxo) *Utxo {
return &Utxo{
Type: utxo.Type,
Address: utxo.Address,
AmountSat: utxo.AmountSat,
PkScript: utxo.PkScript,
OutPoint: NewOutPointFromProto(utxo.Outpoint),
Confirmations: utxo.Confirmations,
}
} | go | func NewUtxoFromProto(utxo *lnrpc.Utxo) *Utxo {
return &Utxo{
Type: utxo.Type,
Address: utxo.Address,
AmountSat: utxo.AmountSat,
PkScript: utxo.PkScript,
OutPoint: NewOutPointFromProto(utxo.Outpoint),
Confirmations: utxo.Confirmations,
}
} | [
"func",
"NewUtxoFromProto",
"(",
"utxo",
"*",
"lnrpc",
".",
"Utxo",
")",
"*",
"Utxo",
"{",
"return",
"&",
"Utxo",
"{",
"Type",
":",
"utxo",
".",
"Type",
",",
"Address",
":",
"utxo",
".",
"Address",
",",
"AmountSat",
":",
"utxo",
".",
"AmountSat",
","... | // NewUtxoFromProto creates a display Utxo from the Utxo proto. This filters out
// the raw txid bytes from the provided outpoint, which will otherwise be
// printed in base64. | [
"NewUtxoFromProto",
"creates",
"a",
"display",
"Utxo",
"from",
"the",
"Utxo",
"proto",
".",
"This",
"filters",
"out",
"the",
"raw",
"txid",
"bytes",
"from",
"the",
"provided",
"outpoint",
"which",
"will",
"otherwise",
"be",
"printed",
"in",
"base64",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/cmd/lncli/types.go#L31-L40 |
128,622 | lightningnetwork/lnd | pool/write.go | NewWrite | func NewWrite(writeBufferPool *WriteBuffer, numWorkers int,
workerTimeout time.Duration) *Write {
w := &Write{
bufferPool: writeBufferPool,
}
w.workerPool = NewWorker(&WorkerConfig{
NewWorkerState: w.newWorkerState,
NumWorkers: numWorkers,
WorkerTimeout: workerTimeout,
})
return w
} | go | func NewWrite(writeBufferPool *WriteBuffer, numWorkers int,
workerTimeout time.Duration) *Write {
w := &Write{
bufferPool: writeBufferPool,
}
w.workerPool = NewWorker(&WorkerConfig{
NewWorkerState: w.newWorkerState,
NumWorkers: numWorkers,
WorkerTimeout: workerTimeout,
})
return w
} | [
"func",
"NewWrite",
"(",
"writeBufferPool",
"*",
"WriteBuffer",
",",
"numWorkers",
"int",
",",
"workerTimeout",
"time",
".",
"Duration",
")",
"*",
"Write",
"{",
"w",
":=",
"&",
"Write",
"{",
"bufferPool",
":",
"writeBufferPool",
",",
"}",
"\n",
"w",
".",
... | // NewWrite creates a Write pool, using an underlying Writebuffer pool to
// recycle buffer.Write objects accross the lifetime of the Write pool's
// workers. | [
"NewWrite",
"creates",
"a",
"Write",
"pool",
"using",
"an",
"underlying",
"Writebuffer",
"pool",
"to",
"recycle",
"buffer",
".",
"Write",
"objects",
"accross",
"the",
"lifetime",
"of",
"the",
"Write",
"pool",
"s",
"workers",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write.go#L22-L35 |
128,623 | lightningnetwork/lnd | pool/write.go | Submit | func (w *Write) Submit(inner func(*bytes.Buffer) error) error {
return w.workerPool.Submit(func(s WorkerState) error {
state := s.(*writeWorkerState)
return inner(state.buf)
})
} | go | func (w *Write) Submit(inner func(*bytes.Buffer) error) error {
return w.workerPool.Submit(func(s WorkerState) error {
state := s.(*writeWorkerState)
return inner(state.buf)
})
} | [
"func",
"(",
"w",
"*",
"Write",
")",
"Submit",
"(",
"inner",
"func",
"(",
"*",
"bytes",
".",
"Buffer",
")",
"error",
")",
"error",
"{",
"return",
"w",
".",
"workerPool",
".",
"Submit",
"(",
"func",
"(",
"s",
"WorkerState",
")",
"error",
"{",
"state... | // Submit accepts a function closure that provides access to a fresh
// bytes.Buffer backed by a buffer.Write object. The function's execution will
// be allocated to one of the underlying Worker pool's goroutines. | [
"Submit",
"accepts",
"a",
"function",
"closure",
"that",
"provides",
"access",
"to",
"a",
"fresh",
"bytes",
".",
"Buffer",
"backed",
"by",
"a",
"buffer",
".",
"Write",
"object",
".",
"The",
"function",
"s",
"execution",
"will",
"be",
"allocated",
"to",
"on... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write.go#L50-L55 |
128,624 | lightningnetwork/lnd | pool/write.go | newWorkerState | func (w *Write) newWorkerState() WorkerState {
writeBuf := w.bufferPool.Take()
return &writeWorkerState{
bufferPool: w.bufferPool,
writeBuf: writeBuf,
buf: bytes.NewBuffer(writeBuf[0:0:len(writeBuf)]),
}
} | go | func (w *Write) newWorkerState() WorkerState {
writeBuf := w.bufferPool.Take()
return &writeWorkerState{
bufferPool: w.bufferPool,
writeBuf: writeBuf,
buf: bytes.NewBuffer(writeBuf[0:0:len(writeBuf)]),
}
} | [
"func",
"(",
"w",
"*",
"Write",
")",
"newWorkerState",
"(",
")",
"WorkerState",
"{",
"writeBuf",
":=",
"w",
".",
"bufferPool",
".",
"Take",
"(",
")",
"\n\n",
"return",
"&",
"writeWorkerState",
"{",
"bufferPool",
":",
"w",
".",
"bufferPool",
",",
"writeBu... | // newWorkerState initializes a new writeWorkerState, which will be called
// whenever a new goroutine is allocated to begin processing write tasks. | [
"newWorkerState",
"initializes",
"a",
"new",
"writeWorkerState",
"which",
"will",
"be",
"called",
"whenever",
"a",
"new",
"goroutine",
"is",
"allocated",
"to",
"begin",
"processing",
"write",
"tasks",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write.go#L78-L86 |
128,625 | lightningnetwork/lnd | pool/write.go | Cleanup | func (w *writeWorkerState) Cleanup() {
w.bufferPool.Return(w.writeBuf)
w.writeBuf = nil
w.buf = nil
} | go | func (w *writeWorkerState) Cleanup() {
w.bufferPool.Return(w.writeBuf)
w.writeBuf = nil
w.buf = nil
} | [
"func",
"(",
"w",
"*",
"writeWorkerState",
")",
"Cleanup",
"(",
")",
"{",
"w",
".",
"bufferPool",
".",
"Return",
"(",
"w",
".",
"writeBuf",
")",
"\n",
"w",
".",
"writeBuf",
"=",
"nil",
"\n",
"w",
".",
"buf",
"=",
"nil",
"\n",
"}"
] | // Cleanup returns the writeBuf to the underlying buffer pool, and removes the
// goroutine's reference to the readBuf and encapsulating buf. | [
"Cleanup",
"returns",
"the",
"writeBuf",
"to",
"the",
"underlying",
"buffer",
"pool",
"and",
"removes",
"the",
"goroutine",
"s",
"reference",
"to",
"the",
"readBuf",
"and",
"encapsulating",
"buf",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/pool/write.go#L90-L94 |
128,626 | lightningnetwork/lnd | lnrpc/signrpc/signer_server.go | New | func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
// If the path of the signer macaroon wasn't generated, then we'll
// assume that it's found at the default network directory.
if cfg.SignerMacPath == "" {
cfg.SignerMacPath = filepath.Join(
cfg.NetworkDir, DefaultSignerMacFilename,
)
}
// Now t... | go | func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
// If the path of the signer macaroon wasn't generated, then we'll
// assume that it's found at the default network directory.
if cfg.SignerMacPath == "" {
cfg.SignerMacPath = filepath.Join(
cfg.NetworkDir, DefaultSignerMacFilename,
)
}
// Now t... | [
"func",
"New",
"(",
"cfg",
"*",
"Config",
")",
"(",
"*",
"Server",
",",
"lnrpc",
".",
"MacaroonPerms",
",",
"error",
")",
"{",
"// If the path of the signer macaroon wasn't generated, then we'll",
"// assume that it's found at the default network directory.",
"if",
"cfg",
... | // New returns a new instance of the signrpc Signer sub-server. We also return
// the set of permissions for the macaroons that we may create within this
// method. If the macaroons we need aren't found in the filepath, then we'll
// create them on start up. If we're unable to locate, or create the macaroons
// we need... | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"the",
"signrpc",
"Signer",
"sub",
"-",
"server",
".",
"We",
"also",
"return",
"the",
"set",
"of",
"permissions",
"for",
"the",
"macaroons",
"that",
"we",
"may",
"create",
"within",
"this",
"method",
".",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/signrpc/signer_server.go#L77-L119 |
128,627 | lightningnetwork/lnd | lnrpc/signrpc/signer_server.go | ComputeInputScript | func (s *Server) ComputeInputScript(ctx context.Context,
in *SignReq) (*InputScriptResp, error) {
switch {
// If the client doesn't specify a transaction, then there's nothing to
// sign, so we'll exit early.
case len(in.RawTxBytes) == 0:
return nil, fmt.Errorf("a transaction to sign MUST be " +
"passed in")... | go | func (s *Server) ComputeInputScript(ctx context.Context,
in *SignReq) (*InputScriptResp, error) {
switch {
// If the client doesn't specify a transaction, then there's nothing to
// sign, so we'll exit early.
case len(in.RawTxBytes) == 0:
return nil, fmt.Errorf("a transaction to sign MUST be " +
"passed in")... | [
"func",
"(",
"s",
"*",
"Server",
")",
"ComputeInputScript",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"SignReq",
")",
"(",
"*",
"InputScriptResp",
",",
"error",
")",
"{",
"switch",
"{",
"// If the client doesn't specify a transaction, then there's not... | // ComputeInputScript generates a complete InputIndex for the passed
// transaction with the signature as defined within the passed SignDescriptor.
// This method should be capable of generating the proper input script for both
// regular p2wkh output and p2wkh outputs nested within a regular p2sh output.
//
// Note th... | [
"ComputeInputScript",
"generates",
"a",
"complete",
"InputIndex",
"for",
"the",
"passed",
"transaction",
"with",
"the",
"signature",
"as",
"defined",
"within",
"the",
"passed",
"SignDescriptor",
".",
"This",
"method",
"should",
"be",
"capable",
"of",
"generating",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/signrpc/signer_server.go#L320-L385 |
128,628 | lightningnetwork/lnd | lnwire/lnwire.go | AddrLen | func (a addressType) AddrLen() uint16 {
switch a {
case noAddr:
return 0
case tcp4Addr:
return 6
case tcp6Addr:
return 18
case v2OnionAddr:
return 12
case v3OnionAddr:
return 37
default:
return 0
}
} | go | func (a addressType) AddrLen() uint16 {
switch a {
case noAddr:
return 0
case tcp4Addr:
return 6
case tcp6Addr:
return 18
case v2OnionAddr:
return 12
case v3OnionAddr:
return 37
default:
return 0
}
} | [
"func",
"(",
"a",
"addressType",
")",
"AddrLen",
"(",
")",
"uint16",
"{",
"switch",
"a",
"{",
"case",
"noAddr",
":",
"return",
"0",
"\n",
"case",
"tcp4Addr",
":",
"return",
"6",
"\n",
"case",
"tcp6Addr",
":",
"return",
"18",
"\n",
"case",
"v2OnionAddr"... | // AddrLen returns the number of bytes that it takes to encode the target
// address. | [
"AddrLen",
"returns",
"the",
"number",
"of",
"bytes",
"that",
"it",
"takes",
"to",
"encode",
"the",
"target",
"address",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/lnwire.go#L53-L68 |
128,629 | lightningnetwork/lnd | htlcswitch/hodl/mask_dev.go | MaskFromFlags | func MaskFromFlags(flags ...Flag) Mask {
var mask Mask
for _, flag := range flags {
mask |= Mask(flag)
}
return mask
} | go | func MaskFromFlags(flags ...Flag) Mask {
var mask Mask
for _, flag := range flags {
mask |= Mask(flag)
}
return mask
} | [
"func",
"MaskFromFlags",
"(",
"flags",
"...",
"Flag",
")",
"Mask",
"{",
"var",
"mask",
"Mask",
"\n",
"for",
"_",
",",
"flag",
":=",
"range",
"flags",
"{",
"mask",
"|=",
"Mask",
"(",
"flag",
")",
"\n",
"}",
"\n\n",
"return",
"mask",
"\n",
"}"
] | // MaskFromFlags merges a variadic set of Flags into a single Mask. | [
"MaskFromFlags",
"merges",
"a",
"variadic",
"set",
"of",
"Flags",
"into",
"a",
"single",
"Mask",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/hodl/mask_dev.go#L11-L18 |
128,630 | lightningnetwork/lnd | htlcswitch/hodl/mask_dev.go | String | func (m Mask) String() string {
if m == MaskNone {
return "hodl.Mask(NONE)"
}
var activeFlags []string
for i := uint(0); i < 32; i++ {
flag := Flag(1 << i)
if m.Active(flag) {
activeFlags = append(activeFlags, flag.String())
}
}
return fmt.Sprintf("hodl.Mask(%s)", strings.Join(activeFlags, "|"))
} | go | func (m Mask) String() string {
if m == MaskNone {
return "hodl.Mask(NONE)"
}
var activeFlags []string
for i := uint(0); i < 32; i++ {
flag := Flag(1 << i)
if m.Active(flag) {
activeFlags = append(activeFlags, flag.String())
}
}
return fmt.Sprintf("hodl.Mask(%s)", strings.Join(activeFlags, "|"))
} | [
"func",
"(",
"m",
"Mask",
")",
"String",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"MaskNone",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"activeFlags",
"[",
"]",
"string",
"\n",
"for",
"i",
":=",
"uint",
"(",
"0",
")",
";",
"i",
"<",... | // String returns a human-readable description of all active Flags. | [
"String",
"returns",
"a",
"human",
"-",
"readable",
"description",
"of",
"all",
"active",
"Flags",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/hodl/mask_dev.go#L27-L41 |
128,631 | lightningnetwork/lnd | contractcourt/commit_sweep_resolver.go | ResolverKey | func (c *commitSweepResolver) ResolverKey() []byte {
key := newResolverID(c.commitResolution.SelfOutPoint)
return key[:]
} | go | func (c *commitSweepResolver) ResolverKey() []byte {
key := newResolverID(c.commitResolution.SelfOutPoint)
return key[:]
} | [
"func",
"(",
"c",
"*",
"commitSweepResolver",
")",
"ResolverKey",
"(",
")",
"[",
"]",
"byte",
"{",
"key",
":=",
"newResolverID",
"(",
"c",
".",
"commitResolution",
".",
"SelfOutPoint",
")",
"\n",
"return",
"key",
"[",
":",
"]",
"\n",
"}"
] | // ResolverKey returns an identifier which should be globally unique for this
// particular resolver within the chain the original contract resides within. | [
"ResolverKey",
"returns",
"an",
"identifier",
"which",
"should",
"be",
"globally",
"unique",
"for",
"this",
"particular",
"resolver",
"within",
"the",
"chain",
"the",
"original",
"contract",
"resides",
"within",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/commit_sweep_resolver.go#L39-L42 |
128,632 | lightningnetwork/lnd | zpay32/bech32.go | toBytes | func toBytes(chars string) ([]byte, error) {
decoded := make([]byte, 0, len(chars))
for i := 0; i < len(chars); i++ {
index := strings.IndexByte(charset, chars[i])
if index < 0 {
return nil, fmt.Errorf("invalid character not part of "+
"charset: %v", chars[i])
}
decoded = append(decoded, byte(index))
... | go | func toBytes(chars string) ([]byte, error) {
decoded := make([]byte, 0, len(chars))
for i := 0; i < len(chars); i++ {
index := strings.IndexByte(charset, chars[i])
if index < 0 {
return nil, fmt.Errorf("invalid character not part of "+
"charset: %v", chars[i])
}
decoded = append(decoded, byte(index))
... | [
"func",
"toBytes",
"(",
"chars",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"decoded",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"len",
"(",
"chars",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
... | // toBytes converts each character in the string 'chars' to the value of the
// index of the corresponding character in 'charset'. | [
"toBytes",
"converts",
"each",
"character",
"in",
"the",
"string",
"chars",
"to",
"the",
"value",
"of",
"the",
"index",
"of",
"the",
"corresponding",
"character",
"in",
"charset",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/bech32.go#L88-L99 |
128,633 | lightningnetwork/lnd | zpay32/bech32.go | toChars | func toChars(data []byte) (string, error) {
result := make([]byte, 0, len(data))
for _, b := range data {
if int(b) >= len(charset) {
return "", fmt.Errorf("invalid data byte: %v", b)
}
result = append(result, charset[b])
}
return string(result), nil
} | go | func toChars(data []byte) (string, error) {
result := make([]byte, 0, len(data))
for _, b := range data {
if int(b) >= len(charset) {
return "", fmt.Errorf("invalid data byte: %v", b)
}
result = append(result, charset[b])
}
return string(result), nil
} | [
"func",
"toChars",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"string",
",",
"error",
")",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"len",
"(",
"data",
")",
")",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"data",
"{",
... | // toChars converts the byte slice 'data' to a string where each byte in 'data'
// encodes the index of a character in 'charset'. | [
"toChars",
"converts",
"the",
"byte",
"slice",
"data",
"to",
"a",
"string",
"where",
"each",
"byte",
"in",
"data",
"encodes",
"the",
"index",
"of",
"a",
"character",
"in",
"charset",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/bech32.go#L103-L112 |
128,634 | lightningnetwork/lnd | zpay32/bech32.go | bech32Checksum | func bech32Checksum(hrp string, data []byte) []byte {
// Convert the bytes to list of integers, as this is needed for the
// checksum calculation.
integers := make([]int, len(data))
for i, b := range data {
integers[i] = int(b)
}
values := append(bech32HrpExpand(hrp), integers...)
values = append(values, []int... | go | func bech32Checksum(hrp string, data []byte) []byte {
// Convert the bytes to list of integers, as this is needed for the
// checksum calculation.
integers := make([]int, len(data))
for i, b := range data {
integers[i] = int(b)
}
values := append(bech32HrpExpand(hrp), integers...)
values = append(values, []int... | [
"func",
"bech32Checksum",
"(",
"hrp",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"// Convert the bytes to list of integers, as this is needed for the",
"// checksum calculation.",
"integers",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
... | // For more details on the checksum calculation, please refer to BIP 173. | [
"For",
"more",
"details",
"on",
"the",
"checksum",
"calculation",
"please",
"refer",
"to",
"BIP",
"173",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/bech32.go#L115-L130 |
128,635 | lightningnetwork/lnd | zpay32/bech32.go | bech32Polymod | func bech32Polymod(values []int) int {
chk := 1
for _, v := range values {
b := chk >> 25
chk = (chk&0x1ffffff)<<5 ^ v
for i := 0; i < 5; i++ {
if (b>>uint(i))&1 == 1 {
chk ^= gen[i]
}
}
}
return chk
} | go | func bech32Polymod(values []int) int {
chk := 1
for _, v := range values {
b := chk >> 25
chk = (chk&0x1ffffff)<<5 ^ v
for i := 0; i < 5; i++ {
if (b>>uint(i))&1 == 1 {
chk ^= gen[i]
}
}
}
return chk
} | [
"func",
"bech32Polymod",
"(",
"values",
"[",
"]",
"int",
")",
"int",
"{",
"chk",
":=",
"1",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"values",
"{",
"b",
":=",
"chk",
">>",
"25",
"\n",
"chk",
"=",
"(",
"chk",
"&",
"0x1ffffff",
")",
"<<",
"5",
... | // For more details on the polymod calculation, please refer to BIP 173. | [
"For",
"more",
"details",
"on",
"the",
"polymod",
"calculation",
"please",
"refer",
"to",
"BIP",
"173",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/bech32.go#L133-L145 |
128,636 | lightningnetwork/lnd | zpay32/bech32.go | bech32HrpExpand | func bech32HrpExpand(hrp string) []int {
v := make([]int, 0, len(hrp)*2+1)
for i := 0; i < len(hrp); i++ {
v = append(v, int(hrp[i]>>5))
}
v = append(v, 0)
for i := 0; i < len(hrp); i++ {
v = append(v, int(hrp[i]&31))
}
return v
} | go | func bech32HrpExpand(hrp string) []int {
v := make([]int, 0, len(hrp)*2+1)
for i := 0; i < len(hrp); i++ {
v = append(v, int(hrp[i]>>5))
}
v = append(v, 0)
for i := 0; i < len(hrp); i++ {
v = append(v, int(hrp[i]&31))
}
return v
} | [
"func",
"bech32HrpExpand",
"(",
"hrp",
"string",
")",
"[",
"]",
"int",
"{",
"v",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"0",
",",
"len",
"(",
"hrp",
")",
"*",
"2",
"+",
"1",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"... | // For more details on HRP expansion, please refer to BIP 173. | [
"For",
"more",
"details",
"on",
"HRP",
"expansion",
"please",
"refer",
"to",
"BIP",
"173",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/bech32.go#L148-L158 |
128,637 | lightningnetwork/lnd | zpay32/bech32.go | bech32VerifyChecksum | func bech32VerifyChecksum(hrp string, data []byte) bool {
integers := make([]int, len(data))
for i, b := range data {
integers[i] = int(b)
}
concat := append(bech32HrpExpand(hrp), integers...)
return bech32Polymod(concat) == 1
} | go | func bech32VerifyChecksum(hrp string, data []byte) bool {
integers := make([]int, len(data))
for i, b := range data {
integers[i] = int(b)
}
concat := append(bech32HrpExpand(hrp), integers...)
return bech32Polymod(concat) == 1
} | [
"func",
"bech32VerifyChecksum",
"(",
"hrp",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"bool",
"{",
"integers",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
"(",
"data",
")",
")",
"\n",
"for",
"i",
",",
"b",
":=",
"range",
"data",
"{",
"int... | // For more details on the checksum verification, please refer to BIP 173. | [
"For",
"more",
"details",
"on",
"the",
"checksum",
"verification",
"please",
"refer",
"to",
"BIP",
"173",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/zpay32/bech32.go#L161-L168 |
128,638 | lightningnetwork/lnd | lnwire/reply_channel_range.go | Decode | func (c *ReplyChannelRange) Decode(r io.Reader, pver uint32) error {
err := c.QueryChannelRange.Decode(r, pver)
if err != nil {
return err
}
if err := ReadElements(r, &c.Complete); err != nil {
return err
}
c.EncodingType, c.ShortChanIDs, err = decodeShortChanIDs(r)
return err
} | go | func (c *ReplyChannelRange) Decode(r io.Reader, pver uint32) error {
err := c.QueryChannelRange.Decode(r, pver)
if err != nil {
return err
}
if err := ReadElements(r, &c.Complete); err != nil {
return err
}
c.EncodingType, c.ShortChanIDs, err = decodeShortChanIDs(r)
return err
} | [
"func",
"(",
"c",
"*",
"ReplyChannelRange",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
",",
"pver",
"uint32",
")",
"error",
"{",
"err",
":=",
"c",
".",
"QueryChannelRange",
".",
"Decode",
"(",
"r",
",",
"pver",
")",
"\n",
"if",
"err",
"!=",
"nil... | // Decode deserializes a serialized ReplyChannelRange message stored in the
// passed io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"Decode",
"deserializes",
"a",
"serialized",
"ReplyChannelRange",
"message",
"stored",
"in",
"the",
"passed",
"io",
".",
"Reader",
"observing",
"the",
"specified",
"protocol",
"version",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interfac... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/reply_channel_range.go#L39-L52 |
128,639 | lightningnetwork/lnd | lnwire/reply_channel_range.go | Encode | func (c *ReplyChannelRange) Encode(w io.Writer, pver uint32) error {
if err := c.QueryChannelRange.Encode(w, pver); err != nil {
return err
}
if err := WriteElements(w, c.Complete); err != nil {
return err
}
return encodeShortChanIDs(w, c.EncodingType, c.ShortChanIDs)
} | go | func (c *ReplyChannelRange) Encode(w io.Writer, pver uint32) error {
if err := c.QueryChannelRange.Encode(w, pver); err != nil {
return err
}
if err := WriteElements(w, c.Complete); err != nil {
return err
}
return encodeShortChanIDs(w, c.EncodingType, c.ShortChanIDs)
} | [
"func",
"(",
"c",
"*",
"ReplyChannelRange",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"pver",
"uint32",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"QueryChannelRange",
".",
"Encode",
"(",
"w",
",",
"pver",
")",
";",
"err",
"!=",
"nil"... | // Encode serializes the target ReplyChannelRange into the passed io.Writer
// observing the protocol version specified.
//
// This is part of the lnwire.Message interface. | [
"Encode",
"serializes",
"the",
"target",
"ReplyChannelRange",
"into",
"the",
"passed",
"io",
".",
"Writer",
"observing",
"the",
"protocol",
"version",
"specified",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/reply_channel_range.go#L58-L68 |
128,640 | lightningnetwork/lnd | input/script_utils.go | WitnessScriptHash | func WitnessScriptHash(witnessScript []byte) ([]byte, error) {
bldr := txscript.NewScriptBuilder()
bldr.AddOp(txscript.OP_0)
scriptHash := sha256.Sum256(witnessScript)
bldr.AddData(scriptHash[:])
return bldr.Script()
} | go | func WitnessScriptHash(witnessScript []byte) ([]byte, error) {
bldr := txscript.NewScriptBuilder()
bldr.AddOp(txscript.OP_0)
scriptHash := sha256.Sum256(witnessScript)
bldr.AddData(scriptHash[:])
return bldr.Script()
} | [
"func",
"WitnessScriptHash",
"(",
"witnessScript",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"bldr",
":=",
"txscript",
".",
"NewScriptBuilder",
"(",
")",
"\n\n",
"bldr",
".",
"AddOp",
"(",
"txscript",
".",
"OP_0",
")",
"\n",... | // WitnessScriptHash generates a pay-to-witness-script-hash public key script
// paying to a version 0 witness program paying to the passed redeem script. | [
"WitnessScriptHash",
"generates",
"a",
"pay",
"-",
"to",
"-",
"witness",
"-",
"script",
"-",
"hash",
"public",
"key",
"script",
"paying",
"to",
"a",
"version",
"0",
"witness",
"program",
"paying",
"to",
"the",
"passed",
"redeem",
"script",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L28-L35 |
128,641 | lightningnetwork/lnd | input/script_utils.go | GenMultiSigScript | func GenMultiSigScript(aPub, bPub []byte) ([]byte, error) {
if len(aPub) != 33 || len(bPub) != 33 {
return nil, fmt.Errorf("Pubkey size error. Compressed pubkeys only")
}
// Swap to sort pubkeys if needed. Keys are sorted in lexicographical
// order. The signatures within the scriptSig must also adhere to the
/... | go | func GenMultiSigScript(aPub, bPub []byte) ([]byte, error) {
if len(aPub) != 33 || len(bPub) != 33 {
return nil, fmt.Errorf("Pubkey size error. Compressed pubkeys only")
}
// Swap to sort pubkeys if needed. Keys are sorted in lexicographical
// order. The signatures within the scriptSig must also adhere to the
/... | [
"func",
"GenMultiSigScript",
"(",
"aPub",
",",
"bPub",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"aPub",
")",
"!=",
"33",
"||",
"len",
"(",
"bPub",
")",
"!=",
"33",
"{",
"return",
"nil",
",",
"fmt",... | // GenMultiSigScript generates the non-p2sh'd multisig script for 2 of 2
// pubkeys. | [
"GenMultiSigScript",
"generates",
"the",
"non",
"-",
"p2sh",
"d",
"multisig",
"script",
"for",
"2",
"of",
"2",
"pubkeys",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L39-L59 |
128,642 | lightningnetwork/lnd | input/script_utils.go | GenFundingPkScript | func GenFundingPkScript(aPub, bPub []byte, amt int64) ([]byte, *wire.TxOut, error) {
// As a sanity check, ensure that the passed amount is above zero.
if amt <= 0 {
return nil, nil, fmt.Errorf("can't create FundTx script with " +
"zero, or negative coins")
}
// First, create the 2-of-2 multi-sig script itsel... | go | func GenFundingPkScript(aPub, bPub []byte, amt int64) ([]byte, *wire.TxOut, error) {
// As a sanity check, ensure that the passed amount is above zero.
if amt <= 0 {
return nil, nil, fmt.Errorf("can't create FundTx script with " +
"zero, or negative coins")
}
// First, create the 2-of-2 multi-sig script itsel... | [
"func",
"GenFundingPkScript",
"(",
"aPub",
",",
"bPub",
"[",
"]",
"byte",
",",
"amt",
"int64",
")",
"(",
"[",
"]",
"byte",
",",
"*",
"wire",
".",
"TxOut",
",",
"error",
")",
"{",
"// As a sanity check, ensure that the passed amount is above zero.",
"if",
"amt"... | // GenFundingPkScript creates a redeem script, and its matching p2wsh
// output for the funding transaction. | [
"GenFundingPkScript",
"creates",
"a",
"redeem",
"script",
"and",
"its",
"matching",
"p2wsh",
"output",
"for",
"the",
"funding",
"transaction",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L63-L84 |
128,643 | lightningnetwork/lnd | input/script_utils.go | SpendMultiSig | func SpendMultiSig(witnessScript, pubA, sigA, pubB, sigB []byte) [][]byte {
witness := make([][]byte, 4)
// When spending a p2wsh multi-sig script, rather than an OP_0, we add
// a nil stack element to eat the extra pop.
witness[0] = nil
// When initially generating the witnessScript, we sorted the serialized
/... | go | func SpendMultiSig(witnessScript, pubA, sigA, pubB, sigB []byte) [][]byte {
witness := make([][]byte, 4)
// When spending a p2wsh multi-sig script, rather than an OP_0, we add
// a nil stack element to eat the extra pop.
witness[0] = nil
// When initially generating the witnessScript, we sorted the serialized
/... | [
"func",
"SpendMultiSig",
"(",
"witnessScript",
",",
"pubA",
",",
"sigA",
",",
"pubB",
",",
"sigB",
"[",
"]",
"byte",
")",
"[",
"]",
"[",
"]",
"byte",
"{",
"witness",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"4",
")",
"\n\n",
"// When s... | // SpendMultiSig generates the witness stack required to redeem the 2-of-2 p2wsh
// multi-sig output. | [
"SpendMultiSig",
"generates",
"the",
"witness",
"stack",
"required",
"to",
"redeem",
"the",
"2",
"-",
"of",
"-",
"2",
"p2wsh",
"multi",
"-",
"sig",
"output",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L88-L111 |
128,644 | lightningnetwork/lnd | input/script_utils.go | SenderHtlcSpendRevokeWithKey | func SenderHtlcSpendRevokeWithKey(signer Signer, signDesc *SignDescriptor,
revokeKey *btcec.PublicKey, sweepTx *wire.MsgTx) (wire.TxWitness, error) {
sweepSig, err := signer.SignOutputRaw(sweepTx, signDesc)
if err != nil {
return nil, err
}
// The stack required to sweep a revoke HTLC output consists simply of... | go | func SenderHtlcSpendRevokeWithKey(signer Signer, signDesc *SignDescriptor,
revokeKey *btcec.PublicKey, sweepTx *wire.MsgTx) (wire.TxWitness, error) {
sweepSig, err := signer.SignOutputRaw(sweepTx, signDesc)
if err != nil {
return nil, err
}
// The stack required to sweep a revoke HTLC output consists simply of... | [
"func",
"SenderHtlcSpendRevokeWithKey",
"(",
"signer",
"Signer",
",",
"signDesc",
"*",
"SignDescriptor",
",",
"revokeKey",
"*",
"btcec",
".",
"PublicKey",
",",
"sweepTx",
"*",
"wire",
".",
"MsgTx",
")",
"(",
"wire",
".",
"TxWitness",
",",
"error",
")",
"{",
... | // SenderHtlcSpendRevokeWithKey constructs a valid witness allowing the receiver of an
// HTLC to claim the output with knowledge of the revocation private key in the
// scenario that the sender of the HTLC broadcasts a previously revoked
// commitment transaction. A valid spend requires knowledge of the private key
//... | [
"SenderHtlcSpendRevokeWithKey",
"constructs",
"a",
"valid",
"witness",
"allowing",
"the",
"receiver",
"of",
"an",
"HTLC",
"to",
"claim",
"the",
"output",
"with",
"knowledge",
"of",
"the",
"revocation",
"private",
"key",
"in",
"the",
"scenario",
"that",
"the",
"s... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L259-L278 |
128,645 | lightningnetwork/lnd | input/script_utils.go | SenderHtlcSpendRevoke | func SenderHtlcSpendRevoke(signer Signer, signDesc *SignDescriptor,
sweepTx *wire.MsgTx) (wire.TxWitness, error) {
if signDesc.KeyDesc.PubKey == nil {
return nil, fmt.Errorf("cannot generate witness with nil " +
"KeyDesc pubkey")
}
// Derive the revocation key using the local revocation base point and
// co... | go | func SenderHtlcSpendRevoke(signer Signer, signDesc *SignDescriptor,
sweepTx *wire.MsgTx) (wire.TxWitness, error) {
if signDesc.KeyDesc.PubKey == nil {
return nil, fmt.Errorf("cannot generate witness with nil " +
"KeyDesc pubkey")
}
// Derive the revocation key using the local revocation base point and
// co... | [
"func",
"SenderHtlcSpendRevoke",
"(",
"signer",
"Signer",
",",
"signDesc",
"*",
"SignDescriptor",
",",
"sweepTx",
"*",
"wire",
".",
"MsgTx",
")",
"(",
"wire",
".",
"TxWitness",
",",
"error",
")",
"{",
"if",
"signDesc",
".",
"KeyDesc",
".",
"PubKey",
"==",
... | // SenderHtlcSpendRevoke constructs a valid witness allowing the receiver of an
// HTLC to claim the output with knowledge of the revocation private key in the
// scenario that the sender of the HTLC broadcasts a previously revoked
// commitment transaction. This method first derives the appropriate revocation
// key,... | [
"SenderHtlcSpendRevoke",
"constructs",
"a",
"valid",
"witness",
"allowing",
"the",
"receiver",
"of",
"an",
"HTLC",
"to",
"claim",
"the",
"output",
"with",
"knowledge",
"of",
"the",
"revocation",
"private",
"key",
"in",
"the",
"scenario",
"that",
"the",
"sender",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L287-L303 |
128,646 | lightningnetwork/lnd | input/script_utils.go | SenderHtlcSpendTimeout | func SenderHtlcSpendTimeout(receiverSig []byte, signer Signer,
signDesc *SignDescriptor, htlcTimeoutTx *wire.MsgTx) (wire.TxWitness, error) {
sweepSig, err := signer.SignOutputRaw(htlcTimeoutTx, signDesc)
if err != nil {
return nil, err
}
// We place a zero as the first item of the evaluated witness stack in
... | go | func SenderHtlcSpendTimeout(receiverSig []byte, signer Signer,
signDesc *SignDescriptor, htlcTimeoutTx *wire.MsgTx) (wire.TxWitness, error) {
sweepSig, err := signer.SignOutputRaw(htlcTimeoutTx, signDesc)
if err != nil {
return nil, err
}
// We place a zero as the first item of the evaluated witness stack in
... | [
"func",
"SenderHtlcSpendTimeout",
"(",
"receiverSig",
"[",
"]",
"byte",
",",
"signer",
"Signer",
",",
"signDesc",
"*",
"SignDescriptor",
",",
"htlcTimeoutTx",
"*",
"wire",
".",
"MsgTx",
")",
"(",
"wire",
".",
"TxWitness",
",",
"error",
")",
"{",
"sweepSig",
... | // SenderHtlcSpendTimeout constructs a valid witness allowing the sender of an
// HTLC to activate the time locked covenant clause of a soon to be expired
// HTLC. This script simply spends the multi-sig output using the
// pre-generated HTLC timeout transaction. | [
"SenderHtlcSpendTimeout",
"constructs",
"a",
"valid",
"witness",
"allowing",
"the",
"sender",
"of",
"an",
"HTLC",
"to",
"activate",
"the",
"time",
"locked",
"covenant",
"clause",
"of",
"a",
"soon",
"to",
"be",
"expired",
"HTLC",
".",
"This",
"script",
"simply"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L333-L353 |
128,647 | lightningnetwork/lnd | input/script_utils.go | ReceiverHtlcSpendRedeem | func ReceiverHtlcSpendRedeem(senderSig, paymentPreimage []byte,
signer Signer, signDesc *SignDescriptor,
htlcSuccessTx *wire.MsgTx) (wire.TxWitness, error) {
// First, we'll generate a signature for the HTLC success transaction.
// The signDesc should be signing with the public key used as the
// receiver's publi... | go | func ReceiverHtlcSpendRedeem(senderSig, paymentPreimage []byte,
signer Signer, signDesc *SignDescriptor,
htlcSuccessTx *wire.MsgTx) (wire.TxWitness, error) {
// First, we'll generate a signature for the HTLC success transaction.
// The signDesc should be signing with the public key used as the
// receiver's publi... | [
"func",
"ReceiverHtlcSpendRedeem",
"(",
"senderSig",
",",
"paymentPreimage",
"[",
"]",
"byte",
",",
"signer",
"Signer",
",",
"signDesc",
"*",
"SignDescriptor",
",",
"htlcSuccessTx",
"*",
"wire",
".",
"MsgTx",
")",
"(",
"wire",
".",
"TxWitness",
",",
"error",
... | // ReceiverHtlcSpendRedeem constructs a valid witness allowing the receiver of
// an HTLC to redeem the conditional payment in the event that their commitment
// transaction is broadcast. This clause transitions the state of the HLTC
// output into the delay+claim state by activating the off-chain covenant bound
// by ... | [
"ReceiverHtlcSpendRedeem",
"constructs",
"a",
"valid",
"witness",
"allowing",
"the",
"receiver",
"of",
"an",
"HTLC",
"to",
"redeem",
"the",
"conditional",
"payment",
"in",
"the",
"event",
"that",
"their",
"commitment",
"transaction",
"is",
"broadcast",
".",
"This"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L484-L508 |
128,648 | lightningnetwork/lnd | input/script_utils.go | HtlcSpendSuccess | func HtlcSpendSuccess(signer Signer, signDesc *SignDescriptor,
sweepTx *wire.MsgTx, csvDelay uint32) (wire.TxWitness, error) {
// We're required to wait a relative period of time before we can sweep
// the output in order to allow the other party to contest our claim of
// validity to this version of the commitmen... | go | func HtlcSpendSuccess(signer Signer, signDesc *SignDescriptor,
sweepTx *wire.MsgTx, csvDelay uint32) (wire.TxWitness, error) {
// We're required to wait a relative period of time before we can sweep
// the output in order to allow the other party to contest our claim of
// validity to this version of the commitmen... | [
"func",
"HtlcSpendSuccess",
"(",
"signer",
"Signer",
",",
"signDesc",
"*",
"SignDescriptor",
",",
"sweepTx",
"*",
"wire",
".",
"MsgTx",
",",
"csvDelay",
"uint32",
")",
"(",
"wire",
".",
"TxWitness",
",",
"error",
")",
"{",
"// We're required to wait a relative p... | // HtlcSpendSuccess spends a second-level HTLC output. This function is to be
// used by the sender of an HTLC to claim the output after a relative timeout
// or the receiver of the HTLC to claim on-chain with the pre-image. | [
"HtlcSpendSuccess",
"spends",
"a",
"second",
"-",
"level",
"HTLC",
"output",
".",
"This",
"function",
"is",
"to",
"be",
"used",
"by",
"the",
"sender",
"of",
"an",
"HTLC",
"to",
"claim",
"the",
"output",
"after",
"a",
"relative",
"timeout",
"or",
"the",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L671-L705 |
128,649 | lightningnetwork/lnd | input/script_utils.go | CommitScriptUnencumbered | func CommitScriptUnencumbered(key *btcec.PublicKey) ([]byte, error) {
// This script goes to the "other" party, and it spendable immediately.
builder := txscript.NewScriptBuilder()
builder.AddOp(txscript.OP_0)
builder.AddData(btcutil.Hash160(key.SerializeCompressed()))
return builder.Script()
} | go | func CommitScriptUnencumbered(key *btcec.PublicKey) ([]byte, error) {
// This script goes to the "other" party, and it spendable immediately.
builder := txscript.NewScriptBuilder()
builder.AddOp(txscript.OP_0)
builder.AddData(btcutil.Hash160(key.SerializeCompressed()))
return builder.Script()
} | [
"func",
"CommitScriptUnencumbered",
"(",
"key",
"*",
"btcec",
".",
"PublicKey",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// This script goes to the \"other\" party, and it spendable immediately.",
"builder",
":=",
"txscript",
".",
"NewScriptBuilder",
"(",
... | // CommitScriptUnencumbered constructs the public key script on the commitment
// transaction paying to the "other" party. The constructed output is a normal
// p2wkh output spendable immediately, requiring no contestation period. | [
"CommitScriptUnencumbered",
"constructs",
"the",
"public",
"key",
"script",
"on",
"the",
"commitment",
"transaction",
"paying",
"to",
"the",
"other",
"party",
".",
"The",
"constructed",
"output",
"is",
"a",
"normal",
"p2wkh",
"output",
"spendable",
"immediately",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L834-L841 |
128,650 | lightningnetwork/lnd | input/script_utils.go | TweakPubKeyWithTweak | func TweakPubKeyWithTweak(pubKey *btcec.PublicKey, tweakBytes []byte) *btcec.PublicKey {
curve := btcec.S256()
tweakX, tweakY := curve.ScalarBaseMult(tweakBytes)
// TODO(roasbeef): check that both passed on curve?
x, y := curve.Add(pubKey.X, pubKey.Y, tweakX, tweakY)
return &btcec.PublicKey{
X: x,
Y: ... | go | func TweakPubKeyWithTweak(pubKey *btcec.PublicKey, tweakBytes []byte) *btcec.PublicKey {
curve := btcec.S256()
tweakX, tweakY := curve.ScalarBaseMult(tweakBytes)
// TODO(roasbeef): check that both passed on curve?
x, y := curve.Add(pubKey.X, pubKey.Y, tweakX, tweakY)
return &btcec.PublicKey{
X: x,
Y: ... | [
"func",
"TweakPubKeyWithTweak",
"(",
"pubKey",
"*",
"btcec",
".",
"PublicKey",
",",
"tweakBytes",
"[",
"]",
"byte",
")",
"*",
"btcec",
".",
"PublicKey",
"{",
"curve",
":=",
"btcec",
".",
"S256",
"(",
")",
"\n",
"tweakX",
",",
"tweakY",
":=",
"curve",
"... | // TweakPubKeyWithTweak is the exact same as the TweakPubKey function, however
// it accepts the raw tweak bytes directly rather than the commitment point. | [
"TweakPubKeyWithTweak",
"is",
"the",
"exact",
"same",
"as",
"the",
"TweakPubKey",
"function",
"however",
"it",
"accepts",
"the",
"raw",
"tweak",
"bytes",
"directly",
"rather",
"than",
"the",
"commitment",
"point",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L986-L997 |
128,651 | lightningnetwork/lnd | input/script_utils.go | ComputeCommitmentPoint | func ComputeCommitmentPoint(commitSecret []byte) *btcec.PublicKey {
x, y := btcec.S256().ScalarBaseMult(commitSecret)
return &btcec.PublicKey{
X: x,
Y: y,
Curve: btcec.S256(),
}
} | go | func ComputeCommitmentPoint(commitSecret []byte) *btcec.PublicKey {
x, y := btcec.S256().ScalarBaseMult(commitSecret)
return &btcec.PublicKey{
X: x,
Y: y,
Curve: btcec.S256(),
}
} | [
"func",
"ComputeCommitmentPoint",
"(",
"commitSecret",
"[",
"]",
"byte",
")",
"*",
"btcec",
".",
"PublicKey",
"{",
"x",
",",
"y",
":=",
"btcec",
".",
"S256",
"(",
")",
".",
"ScalarBaseMult",
"(",
"commitSecret",
")",
"\n\n",
"return",
"&",
"btcec",
".",
... | // ComputeCommitmentPoint generates a commitment point given a commitment
// secret. The commitment point for each state is used to randomize each key in
// the key-ring and also to used as a tweak to derive new public+private keys
// for the state. | [
"ComputeCommitmentPoint",
"generates",
"a",
"commitment",
"point",
"given",
"a",
"commitment",
"secret",
".",
"The",
"commitment",
"point",
"for",
"each",
"state",
"is",
"used",
"to",
"randomize",
"each",
"key",
"in",
"the",
"key",
"-",
"ring",
"and",
"also",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/input/script_utils.go#L1117-L1125 |
128,652 | lightningnetwork/lnd | lnrpc/chainrpc/chainnotifer_server.go | New | func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
// If the path of the chain notifier macaroon wasn't generated, then
// we'll assume that it's found at the default network directory.
if cfg.ChainNotifierMacPath == "" {
cfg.ChainNotifierMacPath = filepath.Join(
cfg.NetworkDir, DefaultChainNotifierM... | go | func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
// If the path of the chain notifier macaroon wasn't generated, then
// we'll assume that it's found at the default network directory.
if cfg.ChainNotifierMacPath == "" {
cfg.ChainNotifierMacPath = filepath.Join(
cfg.NetworkDir, DefaultChainNotifierM... | [
"func",
"New",
"(",
"cfg",
"*",
"Config",
")",
"(",
"*",
"Server",
",",
"lnrpc",
".",
"MacaroonPerms",
",",
"error",
")",
"{",
"// If the path of the chain notifier macaroon wasn't generated, then",
"// we'll assume that it's found at the default network directory.",
"if",
... | // New returns a new instance of the chainrpc ChainNotifier sub-server. We also
// return the set of permissions for the macaroons that we may create within
// this method. If the macaroons we need aren't found in the filepath, then
// we'll create them on start up. If we're unable to locate, or create the
// macaroons... | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"the",
"chainrpc",
"ChainNotifier",
"sub",
"-",
"server",
".",
"We",
"also",
"return",
"the",
"set",
"of",
"permissions",
"for",
"the",
"macaroons",
"that",
"we",
"may",
"create",
"within",
"this",
"method",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/chainrpc/chainnotifer_server.go#L97-L138 |
128,653 | lightningnetwork/lnd | watchtower/conf_experimental.go | Apply | func (c *Conf) Apply(cfg *Config) (*Config, error) {
// Set the Config's listening addresses if they are empty.
if cfg.ListenAddrs == nil {
// Without a network, we will be unable to resolve the listening
// addresses.
if cfg.Net == nil {
return nil, ErrNoNetwork
}
// If no addresses are specified by th... | go | func (c *Conf) Apply(cfg *Config) (*Config, error) {
// Set the Config's listening addresses if they are empty.
if cfg.ListenAddrs == nil {
// Without a network, we will be unable to resolve the listening
// addresses.
if cfg.Net == nil {
return nil, ErrNoNetwork
}
// If no addresses are specified by th... | [
"func",
"(",
"c",
"*",
"Conf",
")",
"Apply",
"(",
"cfg",
"*",
"Config",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"// Set the Config's listening addresses if they are empty.",
"if",
"cfg",
".",
"ListenAddrs",
"==",
"nil",
"{",
"// Without a network, we wi... | // Apply completes the passed Config struct by applying any parsed Conf options.
// If the corresponding values parsed by Conf are already set in the Config,
// those fields will be not be modified. | [
"Apply",
"completes",
"the",
"passed",
"Config",
"struct",
"by",
"applying",
"any",
"parsed",
"Conf",
"options",
".",
"If",
"the",
"corresponding",
"values",
"parsed",
"by",
"Conf",
"are",
"already",
"set",
"in",
"the",
"Config",
"those",
"fields",
"will",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/conf_experimental.go#L24-L65 |
128,654 | lightningnetwork/lnd | htlcswitch/queue.go | newPacketQueue | func newPacketQueue(maxFreeSlots int) *packetQueue {
p := &packetQueue{
outgoingPkts: make(chan *htlcPacket),
freeSlots: make(chan struct{}, maxFreeSlots),
quit: make(chan struct{}),
}
p.queueCond = sync.NewCond(&p.queueMtx)
return p
} | go | func newPacketQueue(maxFreeSlots int) *packetQueue {
p := &packetQueue{
outgoingPkts: make(chan *htlcPacket),
freeSlots: make(chan struct{}, maxFreeSlots),
quit: make(chan struct{}),
}
p.queueCond = sync.NewCond(&p.queueMtx)
return p
} | [
"func",
"newPacketQueue",
"(",
"maxFreeSlots",
"int",
")",
"*",
"packetQueue",
"{",
"p",
":=",
"&",
"packetQueue",
"{",
"outgoingPkts",
":",
"make",
"(",
"chan",
"*",
"htlcPacket",
")",
",",
"freeSlots",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",... | // newPacketQueue returns a new instance of the packetQueue. The maxFreeSlots
// value should reflect the max number of HTLC's that we're allowed to have
// outstanding within the commitment transaction. | [
"newPacketQueue",
"returns",
"a",
"new",
"instance",
"of",
"the",
"packetQueue",
".",
"The",
"maxFreeSlots",
"value",
"should",
"reflect",
"the",
"max",
"number",
"of",
"HTLC",
"s",
"that",
"we",
"re",
"allowed",
"to",
"have",
"outstanding",
"within",
"the",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/queue.go#L58-L67 |
128,655 | lightningnetwork/lnd | htlcswitch/queue.go | Stop | func (p *packetQueue) Stop() {
close(p.quit)
// Now that we've closed the channel, we'll repeatedly signal the msg
// consumer until we've detected that it has exited.
for atomic.LoadInt32(&p.streamShutdown) == 0 {
p.queueCond.Signal()
time.Sleep(time.Millisecond * 100)
}
} | go | func (p *packetQueue) Stop() {
close(p.quit)
// Now that we've closed the channel, we'll repeatedly signal the msg
// consumer until we've detected that it has exited.
for atomic.LoadInt32(&p.streamShutdown) == 0 {
p.queueCond.Signal()
time.Sleep(time.Millisecond * 100)
}
} | [
"func",
"(",
"p",
"*",
"packetQueue",
")",
"Stop",
"(",
")",
"{",
"close",
"(",
"p",
".",
"quit",
")",
"\n\n",
"// Now that we've closed the channel, we'll repeatedly signal the msg",
"// consumer until we've detected that it has exited.",
"for",
"atomic",
".",
"LoadInt32... | // Stop signals the packetQueue for a graceful shutdown, and waits for all
// goroutines to exit. | [
"Stop",
"signals",
"the",
"packetQueue",
"for",
"a",
"graceful",
"shutdown",
"and",
"waits",
"for",
"all",
"goroutines",
"to",
"exit",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/queue.go#L78-L87 |
128,656 | lightningnetwork/lnd | htlcswitch/queue.go | AddPkt | func (p *packetQueue) AddPkt(pkt *htlcPacket) {
// First, we'll lock the condition, and add the message to the end of
// the message queue, and increment the internal atomic for tracking
// the queue's length.
p.queueCond.L.Lock()
p.queue = append(p.queue, pkt)
atomic.AddInt32(&p.queueLen, 1)
atomic.AddInt64(&p.... | go | func (p *packetQueue) AddPkt(pkt *htlcPacket) {
// First, we'll lock the condition, and add the message to the end of
// the message queue, and increment the internal atomic for tracking
// the queue's length.
p.queueCond.L.Lock()
p.queue = append(p.queue, pkt)
atomic.AddInt32(&p.queueLen, 1)
atomic.AddInt64(&p.... | [
"func",
"(",
"p",
"*",
"packetQueue",
")",
"AddPkt",
"(",
"pkt",
"*",
"htlcPacket",
")",
"{",
"// First, we'll lock the condition, and add the message to the end of",
"// the message queue, and increment the internal atomic for tracking",
"// the queue's length.",
"p",
".",
"queu... | // AddPkt adds the referenced packet to the overflow queue, preserving ordering
// of the existing items. | [
"AddPkt",
"adds",
"the",
"referenced",
"packet",
"to",
"the",
"overflow",
"queue",
"preserving",
"ordering",
"of",
"the",
"existing",
"items",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/queue.go#L161-L174 |
128,657 | lightningnetwork/lnd | watchtower/wtmock/tower_db.go | NewTowerDB | func NewTowerDB() *TowerDB {
return &TowerDB{
sessions: make(map[wtdb.SessionID]*wtdb.SessionInfo),
blobs: make(map[wtdb.BreachHint]map[wtdb.SessionID]*wtdb.SessionStateUpdate),
}
} | go | func NewTowerDB() *TowerDB {
return &TowerDB{
sessions: make(map[wtdb.SessionID]*wtdb.SessionInfo),
blobs: make(map[wtdb.BreachHint]map[wtdb.SessionID]*wtdb.SessionStateUpdate),
}
} | [
"func",
"NewTowerDB",
"(",
")",
"*",
"TowerDB",
"{",
"return",
"&",
"TowerDB",
"{",
"sessions",
":",
"make",
"(",
"map",
"[",
"wtdb",
".",
"SessionID",
"]",
"*",
"wtdb",
".",
"SessionInfo",
")",
",",
"blobs",
":",
"make",
"(",
"map",
"[",
"wtdb",
"... | // NewTowerDB initializes a fresh mock TowerDB. | [
"NewTowerDB",
"initializes",
"a",
"fresh",
"mock",
"TowerDB",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/tower_db.go#L19-L24 |
128,658 | lightningnetwork/lnd | lnwire/update_fail_malformed_htlc.go | Decode | func (c *UpdateFailMalformedHTLC) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&c.ChanID,
&c.ID,
c.ShaOnionBlob[:],
&c.FailureCode,
)
} | go | func (c *UpdateFailMalformedHTLC) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&c.ChanID,
&c.ID,
c.ShaOnionBlob[:],
&c.FailureCode,
)
} | [
"func",
"(",
"c",
"*",
"UpdateFailMalformedHTLC",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"ReadElements",
"(",
"r",
",",
"&",
"c",
".",
"ChanID",
",",
"&",
"c",
".",
"ID",
",",
"c",
".",
"... | // Decode deserializes a serialized UpdateFailMalformedHTLC message stored in the passed
// io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"Decode",
"deserializes",
"a",
"serialized",
"UpdateFailMalformedHTLC",
"message",
"stored",
"in",
"the",
"passed",
"io",
".",
"Reader",
"observing",
"the",
"specified",
"protocol",
"version",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"in... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fail_malformed_htlc.go#L37-L44 |
128,659 | lightningnetwork/lnd | lnwire/update_fail_malformed_htlc.go | Encode | func (c *UpdateFailMalformedHTLC) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
c.ChanID,
c.ID,
c.ShaOnionBlob[:],
c.FailureCode,
)
} | go | func (c *UpdateFailMalformedHTLC) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
c.ChanID,
c.ID,
c.ShaOnionBlob[:],
c.FailureCode,
)
} | [
"func",
"(",
"c",
"*",
"UpdateFailMalformedHTLC",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"WriteElements",
"(",
"w",
",",
"c",
".",
"ChanID",
",",
"c",
".",
"ID",
",",
"c",
".",
"ShaOnionBlob"... | // Encode serializes the target UpdateFailMalformedHTLC into the passed
// io.Writer observing the protocol version specified.
//
// This is part of the lnwire.Message interface. | [
"Encode",
"serializes",
"the",
"target",
"UpdateFailMalformedHTLC",
"into",
"the",
"passed",
"io",
".",
"Writer",
"observing",
"the",
"protocol",
"version",
"specified",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/update_fail_malformed_htlc.go#L50-L57 |
128,660 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | NewHeightHintCache | func NewHeightHintCache(db *channeldb.DB) (*HeightHintCache, error) {
cache := &HeightHintCache{db}
if err := cache.initBuckets(); err != nil {
return nil, err
}
return cache, nil
} | go | func NewHeightHintCache(db *channeldb.DB) (*HeightHintCache, error) {
cache := &HeightHintCache{db}
if err := cache.initBuckets(); err != nil {
return nil, err
}
return cache, nil
} | [
"func",
"NewHeightHintCache",
"(",
"db",
"*",
"channeldb",
".",
"DB",
")",
"(",
"*",
"HeightHintCache",
",",
"error",
")",
"{",
"cache",
":=",
"&",
"HeightHintCache",
"{",
"db",
"}",
"\n",
"if",
"err",
":=",
"cache",
".",
"initBuckets",
"(",
")",
";",
... | // NewHeightHintCache returns a new height hint cache backed by a database. | [
"NewHeightHintCache",
"returns",
"a",
"new",
"height",
"hint",
"cache",
"backed",
"by",
"a",
"database",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L95-L102 |
128,661 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | CommitSpendHint | func (c *HeightHintCache) CommitSpendHint(height uint32,
spendRequests ...SpendRequest) error {
if len(spendRequests) == 0 {
return nil
}
Log.Tracef("Updating spend hint to height %d for %v", height,
spendRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
spendHints := tx.Bucket(spendHintBucket)
if s... | go | func (c *HeightHintCache) CommitSpendHint(height uint32,
spendRequests ...SpendRequest) error {
if len(spendRequests) == 0 {
return nil
}
Log.Tracef("Updating spend hint to height %d for %v", height,
spendRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
spendHints := tx.Bucket(spendHintBucket)
if s... | [
"func",
"(",
"c",
"*",
"HeightHintCache",
")",
"CommitSpendHint",
"(",
"height",
"uint32",
",",
"spendRequests",
"...",
"SpendRequest",
")",
"error",
"{",
"if",
"len",
"(",
"spendRequests",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"Log",
... | // CommitSpendHint commits a spend hint for the outpoints to the cache. | [
"CommitSpendHint",
"commits",
"a",
"spend",
"hint",
"for",
"the",
"outpoints",
"to",
"the",
"cache",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L119-L153 |
128,662 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | QuerySpendHint | func (c *HeightHintCache) QuerySpendHint(spendRequest SpendRequest) (uint32, error) {
var hint uint32
err := c.db.View(func(tx *bolt.Tx) error {
spendHints := tx.Bucket(spendHintBucket)
if spendHints == nil {
return ErrCorruptedHeightHintCache
}
spendHintKey, err := spendRequest.SpendHintKey()
if err !=... | go | func (c *HeightHintCache) QuerySpendHint(spendRequest SpendRequest) (uint32, error) {
var hint uint32
err := c.db.View(func(tx *bolt.Tx) error {
spendHints := tx.Bucket(spendHintBucket)
if spendHints == nil {
return ErrCorruptedHeightHintCache
}
spendHintKey, err := spendRequest.SpendHintKey()
if err !=... | [
"func",
"(",
"c",
"*",
"HeightHintCache",
")",
"QuerySpendHint",
"(",
"spendRequest",
"SpendRequest",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"var",
"hint",
"uint32",
"\n",
"err",
":=",
"c",
".",
"db",
".",
"View",
"(",
"func",
"(",
"tx",
"*",
"b... | // QuerySpendHint returns the latest spend hint for an outpoint.
// ErrSpendHintNotFound is returned if a spend hint does not exist within the
// cache for the outpoint. | [
"QuerySpendHint",
"returns",
"the",
"latest",
"spend",
"hint",
"for",
"an",
"outpoint",
".",
"ErrSpendHintNotFound",
"is",
"returned",
"if",
"a",
"spend",
"hint",
"does",
"not",
"exist",
"within",
"the",
"cache",
"for",
"the",
"outpoint",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L158-L182 |
128,663 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | PurgeSpendHint | func (c *HeightHintCache) PurgeSpendHint(spendRequests ...SpendRequest) error {
if len(spendRequests) == 0 {
return nil
}
Log.Tracef("Removing spend hints for %v", spendRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
spendHints := tx.Bucket(spendHintBucket)
if spendHints == nil {
return ErrCorrupte... | go | func (c *HeightHintCache) PurgeSpendHint(spendRequests ...SpendRequest) error {
if len(spendRequests) == 0 {
return nil
}
Log.Tracef("Removing spend hints for %v", spendRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
spendHints := tx.Bucket(spendHintBucket)
if spendHints == nil {
return ErrCorrupte... | [
"func",
"(",
"c",
"*",
"HeightHintCache",
")",
"PurgeSpendHint",
"(",
"spendRequests",
"...",
"SpendRequest",
")",
"error",
"{",
"if",
"len",
"(",
"spendRequests",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"Log",
".",
"Tracef",
"(",
"\"",
... | // PurgeSpendHint removes the spend hint for the outpoints from the cache. | [
"PurgeSpendHint",
"removes",
"the",
"spend",
"hint",
"for",
"the",
"outpoints",
"from",
"the",
"cache",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L185-L210 |
128,664 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | CommitConfirmHint | func (c *HeightHintCache) CommitConfirmHint(height uint32,
confRequests ...ConfRequest) error {
if len(confRequests) == 0 {
return nil
}
Log.Tracef("Updating confirm hints to height %d for %v", height,
confRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
confirmHints := tx.Bucket(confirmHintBucket)
... | go | func (c *HeightHintCache) CommitConfirmHint(height uint32,
confRequests ...ConfRequest) error {
if len(confRequests) == 0 {
return nil
}
Log.Tracef("Updating confirm hints to height %d for %v", height,
confRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
confirmHints := tx.Bucket(confirmHintBucket)
... | [
"func",
"(",
"c",
"*",
"HeightHintCache",
")",
"CommitConfirmHint",
"(",
"height",
"uint32",
",",
"confRequests",
"...",
"ConfRequest",
")",
"error",
"{",
"if",
"len",
"(",
"confRequests",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"Log",
"... | // CommitConfirmHint commits a confirm hint for the transactions to the cache. | [
"CommitConfirmHint",
"commits",
"a",
"confirm",
"hint",
"for",
"the",
"transactions",
"to",
"the",
"cache",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L213-L247 |
128,665 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | QueryConfirmHint | func (c *HeightHintCache) QueryConfirmHint(confRequest ConfRequest) (uint32, error) {
var hint uint32
err := c.db.View(func(tx *bolt.Tx) error {
confirmHints := tx.Bucket(confirmHintBucket)
if confirmHints == nil {
return ErrCorruptedHeightHintCache
}
confHintKey, err := confRequest.ConfHintKey()
if err... | go | func (c *HeightHintCache) QueryConfirmHint(confRequest ConfRequest) (uint32, error) {
var hint uint32
err := c.db.View(func(tx *bolt.Tx) error {
confirmHints := tx.Bucket(confirmHintBucket)
if confirmHints == nil {
return ErrCorruptedHeightHintCache
}
confHintKey, err := confRequest.ConfHintKey()
if err... | [
"func",
"(",
"c",
"*",
"HeightHintCache",
")",
"QueryConfirmHint",
"(",
"confRequest",
"ConfRequest",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"var",
"hint",
"uint32",
"\n",
"err",
":=",
"c",
".",
"db",
".",
"View",
"(",
"func",
"(",
"tx",
"*",
"b... | // QueryConfirmHint returns the latest confirm hint for a transaction hash.
// ErrConfirmHintNotFound is returned if a confirm hint does not exist within
// the cache for the transaction hash. | [
"QueryConfirmHint",
"returns",
"the",
"latest",
"confirm",
"hint",
"for",
"a",
"transaction",
"hash",
".",
"ErrConfirmHintNotFound",
"is",
"returned",
"if",
"a",
"confirm",
"hint",
"does",
"not",
"exist",
"within",
"the",
"cache",
"for",
"the",
"transaction",
"h... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L252-L276 |
128,666 | lightningnetwork/lnd | chainntnfs/height_hint_cache.go | PurgeConfirmHint | func (c *HeightHintCache) PurgeConfirmHint(confRequests ...ConfRequest) error {
if len(confRequests) == 0 {
return nil
}
Log.Tracef("Removing confirm hints for %v", confRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
confirmHints := tx.Bucket(confirmHintBucket)
if confirmHints == nil {
return ErrCo... | go | func (c *HeightHintCache) PurgeConfirmHint(confRequests ...ConfRequest) error {
if len(confRequests) == 0 {
return nil
}
Log.Tracef("Removing confirm hints for %v", confRequests)
return c.db.Batch(func(tx *bolt.Tx) error {
confirmHints := tx.Bucket(confirmHintBucket)
if confirmHints == nil {
return ErrCo... | [
"func",
"(",
"c",
"*",
"HeightHintCache",
")",
"PurgeConfirmHint",
"(",
"confRequests",
"...",
"ConfRequest",
")",
"error",
"{",
"if",
"len",
"(",
"confRequests",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"Log",
".",
"Tracef",
"(",
"\"",
... | // PurgeConfirmHint removes the confirm hint for the transactions from the
// cache. | [
"PurgeConfirmHint",
"removes",
"the",
"confirm",
"hint",
"for",
"the",
"transactions",
"from",
"the",
"cache",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/height_hint_cache.go#L280-L305 |
128,667 | lightningnetwork/lnd | discovery/utils.go | CreateChanAnnouncement | func CreateChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
chanInfo *channeldb.ChannelEdgeInfo,
e1, e2 *channeldb.ChannelEdgePolicy) (*lnwire.ChannelAnnouncement,
*lnwire.ChannelUpdate, *lnwire.ChannelUpdate, error) {
// First, using the parameters of the channel, along with the channel
// authentication ... | go | func CreateChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
chanInfo *channeldb.ChannelEdgeInfo,
e1, e2 *channeldb.ChannelEdgePolicy) (*lnwire.ChannelAnnouncement,
*lnwire.ChannelUpdate, *lnwire.ChannelUpdate, error) {
// First, using the parameters of the channel, along with the channel
// authentication ... | [
"func",
"CreateChanAnnouncement",
"(",
"chanProof",
"*",
"channeldb",
".",
"ChannelAuthProof",
",",
"chanInfo",
"*",
"channeldb",
".",
"ChannelEdgeInfo",
",",
"e1",
",",
"e2",
"*",
"channeldb",
".",
"ChannelEdgePolicy",
")",
"(",
"*",
"lnwire",
".",
"ChannelAnno... | // CreateChanAnnouncement is a helper function which creates all channel
// announcements given the necessary channel related database items. This
// function is used to transform out database structs into the corresponding wire
// structs for announcing new channels to other peers, or simply syncing up a
// peer's ini... | [
"CreateChanAnnouncement",
"is",
"a",
"helper",
"function",
"which",
"creates",
"all",
"channel",
"announcements",
"given",
"the",
"necessary",
"channel",
"related",
"database",
"items",
".",
"This",
"function",
"is",
"used",
"to",
"transform",
"out",
"database",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/utils.go#L16-L110 |
128,668 | lightningnetwork/lnd | discovery/utils.go | copyPubKey | func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey {
return &btcec.PublicKey{
Curve: btcec.S256(),
X: pub.X,
Y: pub.Y,
}
} | go | func copyPubKey(pub *btcec.PublicKey) *btcec.PublicKey {
return &btcec.PublicKey{
Curve: btcec.S256(),
X: pub.X,
Y: pub.Y,
}
} | [
"func",
"copyPubKey",
"(",
"pub",
"*",
"btcec",
".",
"PublicKey",
")",
"*",
"btcec",
".",
"PublicKey",
"{",
"return",
"&",
"btcec",
".",
"PublicKey",
"{",
"Curve",
":",
"btcec",
".",
"S256",
"(",
")",
",",
"X",
":",
"pub",
".",
"X",
",",
"Y",
":"... | // copyPubKey performs a copy of the target public key, setting a fresh curve
// parameter during the process. | [
"copyPubKey",
"performs",
"a",
"copy",
"of",
"the",
"target",
"public",
"key",
"setting",
"a",
"fresh",
"curve",
"parameter",
"during",
"the",
"process",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/utils.go#L114-L120 |
128,669 | lightningnetwork/lnd | discovery/utils.go | SignAnnouncement | func SignAnnouncement(signer lnwallet.MessageSigner, pubKey *btcec.PublicKey,
msg lnwire.Message) (*btcec.Signature, error) {
var (
data []byte
err error
)
switch m := msg.(type) {
case *lnwire.ChannelAnnouncement:
data, err = m.DataToSign()
case *lnwire.ChannelUpdate:
data, err = m.DataToSign()
case ... | go | func SignAnnouncement(signer lnwallet.MessageSigner, pubKey *btcec.PublicKey,
msg lnwire.Message) (*btcec.Signature, error) {
var (
data []byte
err error
)
switch m := msg.(type) {
case *lnwire.ChannelAnnouncement:
data, err = m.DataToSign()
case *lnwire.ChannelUpdate:
data, err = m.DataToSign()
case ... | [
"func",
"SignAnnouncement",
"(",
"signer",
"lnwallet",
".",
"MessageSigner",
",",
"pubKey",
"*",
"btcec",
".",
"PublicKey",
",",
"msg",
"lnwire",
".",
"Message",
")",
"(",
"*",
"btcec",
".",
"Signature",
",",
"error",
")",
"{",
"var",
"(",
"data",
"[",
... | // SignAnnouncement is a helper function which is used to sign any outgoing
// channel node node announcement messages. | [
"SignAnnouncement",
"is",
"a",
"helper",
"function",
"which",
"is",
"used",
"to",
"sign",
"any",
"outgoing",
"channel",
"node",
"node",
"announcement",
"messages",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/utils.go#L124-L148 |
128,670 | lightningnetwork/lnd | discovery/utils.go | remotePubFromChanInfo | func remotePubFromChanInfo(chanInfo *channeldb.ChannelEdgeInfo,
chanFlags lnwire.ChanUpdateChanFlags) [33]byte {
var remotePubKey [33]byte
switch {
case chanFlags&lnwire.ChanUpdateDirection == 0:
remotePubKey = chanInfo.NodeKey2Bytes
case chanFlags&lnwire.ChanUpdateDirection == 1:
remotePubKey = chanInfo.Node... | go | func remotePubFromChanInfo(chanInfo *channeldb.ChannelEdgeInfo,
chanFlags lnwire.ChanUpdateChanFlags) [33]byte {
var remotePubKey [33]byte
switch {
case chanFlags&lnwire.ChanUpdateDirection == 0:
remotePubKey = chanInfo.NodeKey2Bytes
case chanFlags&lnwire.ChanUpdateDirection == 1:
remotePubKey = chanInfo.Node... | [
"func",
"remotePubFromChanInfo",
"(",
"chanInfo",
"*",
"channeldb",
".",
"ChannelEdgeInfo",
",",
"chanFlags",
"lnwire",
".",
"ChanUpdateChanFlags",
")",
"[",
"33",
"]",
"byte",
"{",
"var",
"remotePubKey",
"[",
"33",
"]",
"byte",
"\n",
"switch",
"{",
"case",
... | // remotePubFromChanInfo returns the public key of the remote peer given a
// ChannelEdgeInfo that describe a channel we have with them. | [
"remotePubFromChanInfo",
"returns",
"the",
"public",
"key",
"of",
"the",
"remote",
"peer",
"given",
"a",
"ChannelEdgeInfo",
"that",
"describe",
"a",
"channel",
"we",
"have",
"with",
"them",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/utils.go#L152-L164 |
128,671 | lightningnetwork/lnd | lnwallet/reservation.go | SetNumConfsRequired | func (r *ChannelReservation) SetNumConfsRequired(numConfs uint16) {
r.Lock()
defer r.Unlock()
r.partialState.NumConfsRequired = numConfs
} | go | func (r *ChannelReservation) SetNumConfsRequired(numConfs uint16) {
r.Lock()
defer r.Unlock()
r.partialState.NumConfsRequired = numConfs
} | [
"func",
"(",
"r",
"*",
"ChannelReservation",
")",
"SetNumConfsRequired",
"(",
"numConfs",
"uint16",
")",
"{",
"r",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"Unlock",
"(",
")",
"\n\n",
"r",
".",
"partialState",
".",
"NumConfsRequired",
"=",
"numCon... | // SetNumConfsRequired sets the number of confirmations that are required for
// the ultimate funding transaction before the channel can be considered open.
// This is distinct from the main reservation workflow as it allows
// implementations a bit more flexibility w.r.t to if the responder of the
// initiator sets de... | [
"SetNumConfsRequired",
"sets",
"the",
"number",
"of",
"confirmations",
"that",
"are",
"required",
"for",
"the",
"ultimate",
"funding",
"transaction",
"before",
"the",
"channel",
"can",
"be",
"considered",
"open",
".",
"This",
"is",
"distinct",
"from",
"the",
"ma... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/reservation.go#L265-L270 |
128,672 | lightningnetwork/lnd | lnwallet/reservation.go | CommitConstraints | func (r *ChannelReservation) CommitConstraints(c *channeldb.ChannelConstraints) error {
r.Lock()
defer r.Unlock()
// Fail if we consider csvDelay excessively large.
// TODO(halseth): find a more scientific choice of value.
const maxDelay = 10000
if c.CsvDelay > maxDelay {
return ErrCsvDelayTooLarge(c.CsvDelay,... | go | func (r *ChannelReservation) CommitConstraints(c *channeldb.ChannelConstraints) error {
r.Lock()
defer r.Unlock()
// Fail if we consider csvDelay excessively large.
// TODO(halseth): find a more scientific choice of value.
const maxDelay = 10000
if c.CsvDelay > maxDelay {
return ErrCsvDelayTooLarge(c.CsvDelay,... | [
"func",
"(",
"r",
"*",
"ChannelReservation",
")",
"CommitConstraints",
"(",
"c",
"*",
"channeldb",
".",
"ChannelConstraints",
")",
"error",
"{",
"r",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"Unlock",
"(",
")",
"\n\n",
"// Fail if we consider csvDelay... | // CommitConstraints takes the constraints that the remote party specifies for
// the type of commitments that we can generate for them. These constraints
// include several parameters that serve as flow control restricting the amount
// of satoshis that can be transferred in a single commitment. This function
// will ... | [
"CommitConstraints",
"takes",
"the",
"constraints",
"that",
"the",
"remote",
"party",
"specifies",
"for",
"the",
"type",
"of",
"commitments",
"that",
"we",
"can",
"generate",
"for",
"them",
".",
"These",
"constraints",
"include",
"several",
"parameters",
"that",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/reservation.go#L278-L346 |
128,673 | lightningnetwork/lnd | lnwallet/reservation.go | ProcessContribution | func (r *ChannelReservation) ProcessContribution(theirContribution *ChannelContribution) error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &addContributionMsg{
pendingFundingID: r.reservationID,
contribution: theirContribution,
err: errChan,
}
return <-errChan
} | go | func (r *ChannelReservation) ProcessContribution(theirContribution *ChannelContribution) error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &addContributionMsg{
pendingFundingID: r.reservationID,
contribution: theirContribution,
err: errChan,
}
return <-errChan
} | [
"func",
"(",
"r",
"*",
"ChannelReservation",
")",
"ProcessContribution",
"(",
"theirContribution",
"*",
"ChannelContribution",
")",
"error",
"{",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n\n",
"r",
".",
"wallet",
".",
"msgChan",
"<-",
... | // ProcessContribution verifies the counterparty's contribution to the pending
// payment channel. As a result of this incoming message, lnwallet is able to
// build the funding transaction, and both commitment transactions. Once this
// message has been processed, all signatures to inputs to the funding
// transaction... | [
"ProcessContribution",
"verifies",
"the",
"counterparty",
"s",
"contribution",
"to",
"the",
"pending",
"payment",
"channel",
".",
"As",
"a",
"result",
"of",
"this",
"incoming",
"message",
"lnwallet",
"is",
"able",
"to",
"build",
"the",
"funding",
"transaction",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/reservation.go#L368-L378 |
128,674 | lightningnetwork/lnd | lnwallet/reservation.go | ProcessSingleContribution | func (r *ChannelReservation) ProcessSingleContribution(theirContribution *ChannelContribution) error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &addSingleContributionMsg{
pendingFundingID: r.reservationID,
contribution: theirContribution,
err: errChan,
}
return <-errChan
} | go | func (r *ChannelReservation) ProcessSingleContribution(theirContribution *ChannelContribution) error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &addSingleContributionMsg{
pendingFundingID: r.reservationID,
contribution: theirContribution,
err: errChan,
}
return <-errChan
} | [
"func",
"(",
"r",
"*",
"ChannelReservation",
")",
"ProcessSingleContribution",
"(",
"theirContribution",
"*",
"ChannelContribution",
")",
"error",
"{",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n\n",
"r",
".",
"wallet",
".",
"msgChan",
... | // ProcessSingleContribution verifies, and records the initiator's contribution
// to this pending single funder channel. Internally, no further action is
// taken other than recording the initiator's contribution to the single funder
// channel. | [
"ProcessSingleContribution",
"verifies",
"and",
"records",
"the",
"initiator",
"s",
"contribution",
"to",
"this",
"pending",
"single",
"funder",
"channel",
".",
"Internally",
"no",
"further",
"action",
"is",
"taken",
"other",
"than",
"recording",
"the",
"initiator",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/reservation.go#L384-L394 |
128,675 | lightningnetwork/lnd | lnwallet/reservation.go | Cancel | func (r *ChannelReservation) Cancel() error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &fundingReserveCancelMsg{
pendingFundingID: r.reservationID,
err: errChan,
}
return <-errChan
} | go | func (r *ChannelReservation) Cancel() error {
errChan := make(chan error, 1)
r.wallet.msgChan <- &fundingReserveCancelMsg{
pendingFundingID: r.reservationID,
err: errChan,
}
return <-errChan
} | [
"func",
"(",
"r",
"*",
"ChannelReservation",
")",
"Cancel",
"(",
")",
"error",
"{",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"r",
".",
"wallet",
".",
"msgChan",
"<-",
"&",
"fundingReserveCancelMsg",
"{",
"pendingFundingID",
":"... | // Cancel abandons this channel reservation. This method should be called in
// the scenario that communications with the counterparty break down. Upon
// cancellation, all resources previously reserved for this pending payment
// channel are returned to the free pool, allowing subsequent reservations to
// utilize the... | [
"Cancel",
"abandons",
"this",
"channel",
"reservation",
".",
"This",
"method",
"should",
"be",
"called",
"in",
"the",
"scenario",
"that",
"communications",
"with",
"the",
"counterparty",
"break",
"down",
".",
"Upon",
"cancellation",
"all",
"resources",
"previously... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/reservation.go#L521-L529 |
128,676 | lightningnetwork/lnd | watchtower/wtpolicy/policy.go | DefaultPolicy | func DefaultPolicy() Policy {
return Policy{
BlobType: blob.TypeDefault,
MaxUpdates: DefaultMaxUpdates,
RewardRate: DefaultRewardRate,
SweepFeeRate: lnwallet.SatPerKWeight(
DefaultSweepFeeRate,
),
}
} | go | func DefaultPolicy() Policy {
return Policy{
BlobType: blob.TypeDefault,
MaxUpdates: DefaultMaxUpdates,
RewardRate: DefaultRewardRate,
SweepFeeRate: lnwallet.SatPerKWeight(
DefaultSweepFeeRate,
),
}
} | [
"func",
"DefaultPolicy",
"(",
")",
"Policy",
"{",
"return",
"Policy",
"{",
"BlobType",
":",
"blob",
".",
"TypeDefault",
",",
"MaxUpdates",
":",
"DefaultMaxUpdates",
",",
"RewardRate",
":",
"DefaultRewardRate",
",",
"SweepFeeRate",
":",
"lnwallet",
".",
"SatPerKW... | // DefaultPolicy returns a Policy containing the default parameters that can be
// used by clients or servers. | [
"DefaultPolicy",
"returns",
"a",
"Policy",
"containing",
"the",
"default",
"parameters",
"that",
"can",
"be",
"used",
"by",
"clients",
"or",
"servers",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtpolicy/policy.go#L50-L59 |
128,677 | lightningnetwork/lnd | watchtower/wtpolicy/policy.go | String | func (p Policy) String() string {
return fmt.Sprintf("(blob-type=%b max-updates=%d reward-rate=%d "+
"sweep-fee-rate=%d)", p.BlobType, p.MaxUpdates, p.RewardRate,
p.SweepFeeRate)
} | go | func (p Policy) String() string {
return fmt.Sprintf("(blob-type=%b max-updates=%d reward-rate=%d "+
"sweep-fee-rate=%d)", p.BlobType, p.MaxUpdates, p.RewardRate,
p.SweepFeeRate)
} | [
"func",
"(",
"p",
"Policy",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"p",
".",
"BlobType",
",",
"p",
".",
"MaxUpdates",
",",
"p",
".",
"RewardRate",
",",
"p",
".",
"SweepFeeRa... | // String returns a human-readable description of the current policy. | [
"String",
"returns",
"a",
"human",
"-",
"readable",
"description",
"of",
"the",
"current",
"policy",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtpolicy/policy.go#L92-L96 |
128,678 | lightningnetwork/lnd | watchtower/wtpolicy/policy.go | ComputeAltruistOutput | func (p *Policy) ComputeAltruistOutput(totalAmt btcutil.Amount,
txWeight int64) (btcutil.Amount, error) {
txFee := p.SweepFeeRate.FeeForWeight(txWeight)
if txFee > totalAmt {
return 0, ErrFeeExceedsInputs
}
sweepAmt := totalAmt - txFee
// TODO(conner): replace w/ configurable dust limit
dustLimit := lnwalle... | go | func (p *Policy) ComputeAltruistOutput(totalAmt btcutil.Amount,
txWeight int64) (btcutil.Amount, error) {
txFee := p.SweepFeeRate.FeeForWeight(txWeight)
if txFee > totalAmt {
return 0, ErrFeeExceedsInputs
}
sweepAmt := totalAmt - txFee
// TODO(conner): replace w/ configurable dust limit
dustLimit := lnwalle... | [
"func",
"(",
"p",
"*",
"Policy",
")",
"ComputeAltruistOutput",
"(",
"totalAmt",
"btcutil",
".",
"Amount",
",",
"txWeight",
"int64",
")",
"(",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"txFee",
":=",
"p",
".",
"SweepFeeRate",
".",
"FeeForWeight",
... | // ComputeAltruistOutput computes the lone output value of a justice transaction
// that pays no reward to the tower. The value is computed using the weight of
// of the justice transaction and subtracting an amount that satisfies the
// policy's fee rate. | [
"ComputeAltruistOutput",
"computes",
"the",
"lone",
"output",
"value",
"of",
"a",
"justice",
"transaction",
"that",
"pays",
"no",
"reward",
"to",
"the",
"tower",
".",
"The",
"value",
"is",
"computed",
"using",
"the",
"weight",
"of",
"of",
"the",
"justice",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtpolicy/policy.go#L102-L121 |
128,679 | lightningnetwork/lnd | watchtower/wtpolicy/policy.go | ComputeRewardOutputs | func (p *Policy) ComputeRewardOutputs(totalAmt btcutil.Amount,
txWeight int64) (btcutil.Amount, btcutil.Amount, error) {
txFee := p.SweepFeeRate.FeeForWeight(txWeight)
if txFee > totalAmt {
return 0, 0, ErrFeeExceedsInputs
}
// Apply the reward rate to the remaining total, specified in millionths
// of the av... | go | func (p *Policy) ComputeRewardOutputs(totalAmt btcutil.Amount,
txWeight int64) (btcutil.Amount, btcutil.Amount, error) {
txFee := p.SweepFeeRate.FeeForWeight(txWeight)
if txFee > totalAmt {
return 0, 0, ErrFeeExceedsInputs
}
// Apply the reward rate to the remaining total, specified in millionths
// of the av... | [
"func",
"(",
"p",
"*",
"Policy",
")",
"ComputeRewardOutputs",
"(",
"totalAmt",
"btcutil",
".",
"Amount",
",",
"txWeight",
"int64",
")",
"(",
"btcutil",
".",
"Amount",
",",
"btcutil",
".",
"Amount",
",",
"error",
")",
"{",
"txFee",
":=",
"p",
".",
"Swee... | // ComputeRewardOutputs splits the total funds in a breaching commitment
// transaction between the victim and the tower, according to the sweep fee rate
// and reward rate. The reward to he tower is substracted first, before
// splitting the remaining balance amongst the victim and fees. | [
"ComputeRewardOutputs",
"splits",
"the",
"total",
"funds",
"in",
"a",
"breaching",
"commitment",
"transaction",
"between",
"the",
"victim",
"and",
"the",
"tower",
"according",
"to",
"the",
"sweep",
"fee",
"rate",
"and",
"reward",
"rate",
".",
"The",
"reward",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtpolicy/policy.go#L127-L155 |
128,680 | lightningnetwork/lnd | watchtower/wtpolicy/policy.go | ComputeJusticeTxOuts | func (p *Policy) ComputeJusticeTxOuts(totalAmt btcutil.Amount, txWeight int64,
sweepPkScript, rewardPkScript []byte) ([]*wire.TxOut, error) {
var outputs []*wire.TxOut
// If the policy specifies a reward for the tower, compute a split of
// the funds based on the policy's parameters. Otherwise, we will use an
//... | go | func (p *Policy) ComputeJusticeTxOuts(totalAmt btcutil.Amount, txWeight int64,
sweepPkScript, rewardPkScript []byte) ([]*wire.TxOut, error) {
var outputs []*wire.TxOut
// If the policy specifies a reward for the tower, compute a split of
// the funds based on the policy's parameters. Otherwise, we will use an
//... | [
"func",
"(",
"p",
"*",
"Policy",
")",
"ComputeJusticeTxOuts",
"(",
"totalAmt",
"btcutil",
".",
"Amount",
",",
"txWeight",
"int64",
",",
"sweepPkScript",
",",
"rewardPkScript",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"*",
"wire",
".",
"TxOut",
",",
"error",... | // ComputeJusticeTxOuts constructs the justice transaction outputs for the given
// policy. If the policy specifies a reward for the tower, there will be two
// outputs paying to the victim and the tower. Otherwise there will be a single
// output sweeping funds back to the victim. The totalAmt should be the sum of
// ... | [
"ComputeJusticeTxOuts",
"constructs",
"the",
"justice",
"transaction",
"outputs",
"for",
"the",
"given",
"policy",
".",
"If",
"the",
"policy",
"specifies",
"a",
"reward",
"for",
"the",
"tower",
"there",
"will",
"be",
"two",
"outputs",
"paying",
"to",
"the",
"v... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtpolicy/policy.go#L190-L243 |
128,681 | lightningnetwork/lnd | discovery/sync_manager.go | newSyncManager | func newSyncManager(cfg *SyncManagerCfg) *SyncManager {
return &SyncManager{
cfg: *cfg,
newSyncers: make(chan *newSyncer),
staleSyncers: make(chan *staleSyncer),
activeSyncers: make(
map[route.Vertex]*GossipSyncer, cfg.NumActiveSyncers,
),
inactiveSyncers: make(map[route.Vertex]*GossipSyncer)... | go | func newSyncManager(cfg *SyncManagerCfg) *SyncManager {
return &SyncManager{
cfg: *cfg,
newSyncers: make(chan *newSyncer),
staleSyncers: make(chan *staleSyncer),
activeSyncers: make(
map[route.Vertex]*GossipSyncer, cfg.NumActiveSyncers,
),
inactiveSyncers: make(map[route.Vertex]*GossipSyncer)... | [
"func",
"newSyncManager",
"(",
"cfg",
"*",
"SyncManagerCfg",
")",
"*",
"SyncManager",
"{",
"return",
"&",
"SyncManager",
"{",
"cfg",
":",
"*",
"cfg",
",",
"newSyncers",
":",
"make",
"(",
"chan",
"*",
"newSyncer",
")",
",",
"staleSyncers",
":",
"make",
"(... | // newSyncManager constructs a new SyncManager backed by the given config. | [
"newSyncManager",
"constructs",
"a",
"new",
"SyncManager",
"backed",
"by",
"the",
"given",
"config",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L132-L143 |
128,682 | lightningnetwork/lnd | discovery/sync_manager.go | Start | func (m *SyncManager) Start() {
m.start.Do(func() {
m.wg.Add(1)
go m.syncerHandler()
})
} | go | func (m *SyncManager) Start() {
m.start.Do(func() {
m.wg.Add(1)
go m.syncerHandler()
})
} | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"Start",
"(",
")",
"{",
"m",
".",
"start",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"m",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"m",
".",
"syncerHandler",
"(",
")",
"\n",
"}",
")",
"\n",
... | // Start starts the SyncManager in order to properly carry out its duties. | [
"Start",
"starts",
"the",
"SyncManager",
"in",
"order",
"to",
"properly",
"carry",
"out",
"its",
"duties",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L146-L151 |
128,683 | lightningnetwork/lnd | discovery/sync_manager.go | Stop | func (m *SyncManager) Stop() {
m.stop.Do(func() {
close(m.quit)
m.wg.Wait()
for _, syncer := range m.inactiveSyncers {
syncer.Stop()
}
for _, syncer := range m.activeSyncers {
syncer.Stop()
}
})
} | go | func (m *SyncManager) Stop() {
m.stop.Do(func() {
close(m.quit)
m.wg.Wait()
for _, syncer := range m.inactiveSyncers {
syncer.Stop()
}
for _, syncer := range m.activeSyncers {
syncer.Stop()
}
})
} | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"Stop",
"(",
")",
"{",
"m",
".",
"stop",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"close",
"(",
"m",
".",
"quit",
")",
"\n",
"m",
".",
"wg",
".",
"Wait",
"(",
")",
"\n\n",
"for",
"_",
",",
"syncer",
... | // Stop stops the SyncManager from performing its duties. | [
"Stop",
"stops",
"the",
"SyncManager",
"from",
"performing",
"its",
"duties",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L154-L166 |
128,684 | lightningnetwork/lnd | discovery/sync_manager.go | createGossipSyncer | func (m *SyncManager) createGossipSyncer(peer lnpeer.Peer) *GossipSyncer {
nodeID := route.Vertex(peer.PubKey())
log.Infof("Creating new GossipSyncer for peer=%x", nodeID[:])
encoding := lnwire.EncodingSortedPlain
s := newGossipSyncer(gossipSyncerCfg{
chainHash: m.cfg.ChainHash,
peerPub: nodeID,
ch... | go | func (m *SyncManager) createGossipSyncer(peer lnpeer.Peer) *GossipSyncer {
nodeID := route.Vertex(peer.PubKey())
log.Infof("Creating new GossipSyncer for peer=%x", nodeID[:])
encoding := lnwire.EncodingSortedPlain
s := newGossipSyncer(gossipSyncerCfg{
chainHash: m.cfg.ChainHash,
peerPub: nodeID,
ch... | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"createGossipSyncer",
"(",
"peer",
"lnpeer",
".",
"Peer",
")",
"*",
"GossipSyncer",
"{",
"nodeID",
":=",
"route",
".",
"Vertex",
"(",
"peer",
".",
"PubKey",
"(",
")",
")",
"\n",
"log",
".",
"Infof",
"(",
"\"... | // createGossipSyncer creates the GossipSyncer for a newly connected peer. | [
"createGossipSyncer",
"creates",
"the",
"GossipSyncer",
"for",
"a",
"newly",
"connected",
"peer",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L374-L400 |
128,685 | lightningnetwork/lnd | discovery/sync_manager.go | removeGossipSyncer | func (m *SyncManager) removeGossipSyncer(peer route.Vertex) {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
s, ok := m.gossipSyncer(peer)
if !ok {
return
}
log.Infof("Removing GossipSyncer for peer=%v", peer)
// We'll stop the GossipSyncer for the disconnected peer in a goroutine
// to prevent blocking the... | go | func (m *SyncManager) removeGossipSyncer(peer route.Vertex) {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
s, ok := m.gossipSyncer(peer)
if !ok {
return
}
log.Infof("Removing GossipSyncer for peer=%v", peer)
// We'll stop the GossipSyncer for the disconnected peer in a goroutine
// to prevent blocking the... | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"removeGossipSyncer",
"(",
"peer",
"route",
".",
"Vertex",
")",
"{",
"m",
".",
"syncersMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"syncersMu",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
",",
"ok",
":=... | // removeGossipSyncer removes all internal references to the disconnected peer's
// GossipSyncer and stops it. In the event of an active GossipSyncer being
// disconnected, a passive GossipSyncer, if any, will take its place. | [
"removeGossipSyncer",
"removes",
"all",
"internal",
"references",
"to",
"the",
"disconnected",
"peer",
"s",
"GossipSyncer",
"and",
"stops",
"it",
".",
"In",
"the",
"event",
"of",
"an",
"active",
"GossipSyncer",
"being",
"disconnected",
"a",
"passive",
"GossipSynce... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L405-L437 |
128,686 | lightningnetwork/lnd | discovery/sync_manager.go | rotateActiveSyncerCandidate | func (m *SyncManager) rotateActiveSyncerCandidate() {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
// If we couldn't find an eligible active syncer to rotate, we can
// return early.
activeSyncer := chooseRandomSyncer(m.activeSyncers, nil)
if activeSyncer == nil {
log.Debug("No eligible active syncer to rotat... | go | func (m *SyncManager) rotateActiveSyncerCandidate() {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
// If we couldn't find an eligible active syncer to rotate, we can
// return early.
activeSyncer := chooseRandomSyncer(m.activeSyncers, nil)
if activeSyncer == nil {
log.Debug("No eligible active syncer to rotat... | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"rotateActiveSyncerCandidate",
"(",
")",
"{",
"m",
".",
"syncersMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"syncersMu",
".",
"Unlock",
"(",
")",
"\n\n",
"// If we couldn't find an eligible active syncer to rot... | // rotateActiveSyncerCandidate rotates a single active syncer. In order to
// achieve this, the active syncer must be in a chansSynced state in order to
// process the sync transition. | [
"rotateActiveSyncerCandidate",
"rotates",
"a",
"single",
"active",
"syncer",
".",
"In",
"order",
"to",
"achieve",
"this",
"the",
"active",
"syncer",
"must",
"be",
"in",
"a",
"chansSynced",
"state",
"in",
"order",
"to",
"process",
"the",
"sync",
"transition",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L442-L478 |
128,687 | lightningnetwork/lnd | discovery/sync_manager.go | forceHistoricalSync | func (m *SyncManager) forceHistoricalSync() *GossipSyncer {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
// We'll sample from both sets of active and inactive syncers in the
// event that we don't have any inactive syncers.
return chooseRandomSyncer(m.gossipSyncers(), func(s *GossipSyncer) error {
return s.his... | go | func (m *SyncManager) forceHistoricalSync() *GossipSyncer {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
// We'll sample from both sets of active and inactive syncers in the
// event that we don't have any inactive syncers.
return chooseRandomSyncer(m.gossipSyncers(), func(s *GossipSyncer) error {
return s.his... | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"forceHistoricalSync",
"(",
")",
"*",
"GossipSyncer",
"{",
"m",
".",
"syncersMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"syncersMu",
".",
"Unlock",
"(",
")",
"\n\n",
"// We'll sample from both sets of acti... | // forceHistoricalSync chooses a syncer with a remote peer at random and forces
// a historical sync with it. | [
"forceHistoricalSync",
"chooses",
"a",
"syncer",
"with",
"a",
"remote",
"peer",
"at",
"random",
"and",
"forces",
"a",
"historical",
"sync",
"with",
"it",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L516-L525 |
128,688 | lightningnetwork/lnd | discovery/sync_manager.go | GossipSyncer | func (m *SyncManager) GossipSyncer(peer route.Vertex) (*GossipSyncer, bool) {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
return m.gossipSyncer(peer)
} | go | func (m *SyncManager) GossipSyncer(peer route.Vertex) (*GossipSyncer, bool) {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
return m.gossipSyncer(peer)
} | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"GossipSyncer",
"(",
"peer",
"route",
".",
"Vertex",
")",
"(",
"*",
"GossipSyncer",
",",
"bool",
")",
"{",
"m",
".",
"syncersMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"syncersMu",
".",
"Unlock",
... | // GossipSyncer returns the associated gossip syncer of a peer. The boolean
// returned signals whether there exists a gossip syncer for the peer. | [
"GossipSyncer",
"returns",
"the",
"associated",
"gossip",
"syncer",
"of",
"a",
"peer",
".",
"The",
"boolean",
"returned",
"signals",
"whether",
"there",
"exists",
"a",
"gossip",
"syncer",
"for",
"the",
"peer",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L611-L615 |
128,689 | lightningnetwork/lnd | discovery/sync_manager.go | gossipSyncer | func (m *SyncManager) gossipSyncer(peer route.Vertex) (*GossipSyncer, bool) {
syncer, ok := m.inactiveSyncers[peer]
if ok {
return syncer, true
}
syncer, ok = m.activeSyncers[peer]
if ok {
return syncer, true
}
return nil, false
} | go | func (m *SyncManager) gossipSyncer(peer route.Vertex) (*GossipSyncer, bool) {
syncer, ok := m.inactiveSyncers[peer]
if ok {
return syncer, true
}
syncer, ok = m.activeSyncers[peer]
if ok {
return syncer, true
}
return nil, false
} | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"gossipSyncer",
"(",
"peer",
"route",
".",
"Vertex",
")",
"(",
"*",
"GossipSyncer",
",",
"bool",
")",
"{",
"syncer",
",",
"ok",
":=",
"m",
".",
"inactiveSyncers",
"[",
"peer",
"]",
"\n",
"if",
"ok",
"{",
"... | // gossipSyncer returns the associated gossip syncer of a peer. The boolean
// returned signals whether there exists a gossip syncer for the peer. | [
"gossipSyncer",
"returns",
"the",
"associated",
"gossip",
"syncer",
"of",
"a",
"peer",
".",
"The",
"boolean",
"returned",
"signals",
"whether",
"there",
"exists",
"a",
"gossip",
"syncer",
"for",
"the",
"peer",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L619-L629 |
128,690 | lightningnetwork/lnd | discovery/sync_manager.go | GossipSyncers | func (m *SyncManager) GossipSyncers() map[route.Vertex]*GossipSyncer {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
return m.gossipSyncers()
} | go | func (m *SyncManager) GossipSyncers() map[route.Vertex]*GossipSyncer {
m.syncersMu.Lock()
defer m.syncersMu.Unlock()
return m.gossipSyncers()
} | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"GossipSyncers",
"(",
")",
"map",
"[",
"route",
".",
"Vertex",
"]",
"*",
"GossipSyncer",
"{",
"m",
".",
"syncersMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"syncersMu",
".",
"Unlock",
"(",
")",
"\... | // GossipSyncers returns all of the currently initialized gossip syncers. | [
"GossipSyncers",
"returns",
"all",
"of",
"the",
"currently",
"initialized",
"gossip",
"syncers",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L632-L636 |
128,691 | lightningnetwork/lnd | discovery/sync_manager.go | gossipSyncers | func (m *SyncManager) gossipSyncers() map[route.Vertex]*GossipSyncer {
numSyncers := len(m.inactiveSyncers) + len(m.activeSyncers)
syncers := make(map[route.Vertex]*GossipSyncer, numSyncers)
for _, syncer := range m.inactiveSyncers {
syncers[syncer.cfg.peerPub] = syncer
}
for _, syncer := range m.activeSyncers ... | go | func (m *SyncManager) gossipSyncers() map[route.Vertex]*GossipSyncer {
numSyncers := len(m.inactiveSyncers) + len(m.activeSyncers)
syncers := make(map[route.Vertex]*GossipSyncer, numSyncers)
for _, syncer := range m.inactiveSyncers {
syncers[syncer.cfg.peerPub] = syncer
}
for _, syncer := range m.activeSyncers ... | [
"func",
"(",
"m",
"*",
"SyncManager",
")",
"gossipSyncers",
"(",
")",
"map",
"[",
"route",
".",
"Vertex",
"]",
"*",
"GossipSyncer",
"{",
"numSyncers",
":=",
"len",
"(",
"m",
".",
"inactiveSyncers",
")",
"+",
"len",
"(",
"m",
".",
"activeSyncers",
")",
... | // gossipSyncers returns all of the currently initialized gossip syncers. | [
"gossipSyncers",
"returns",
"all",
"of",
"the",
"currently",
"initialized",
"gossip",
"syncers",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/sync_manager.go#L639-L651 |
128,692 | lightningnetwork/lnd | watchtower/wtdb/session_id.go | NewSessionIDFromPubKey | func NewSessionIDFromPubKey(pubKey *btcec.PublicKey) SessionID {
var sid SessionID
copy(sid[:], pubKey.SerializeCompressed())
return sid
} | go | func NewSessionIDFromPubKey(pubKey *btcec.PublicKey) SessionID {
var sid SessionID
copy(sid[:], pubKey.SerializeCompressed())
return sid
} | [
"func",
"NewSessionIDFromPubKey",
"(",
"pubKey",
"*",
"btcec",
".",
"PublicKey",
")",
"SessionID",
"{",
"var",
"sid",
"SessionID",
"\n",
"copy",
"(",
"sid",
"[",
":",
"]",
",",
"pubKey",
".",
"SerializeCompressed",
"(",
")",
")",
"\n",
"return",
"sid",
"... | // NewSessionIDFromPubKey creates a new SessionID from a public key. | [
"NewSessionIDFromPubKey",
"creates",
"a",
"new",
"SessionID",
"from",
"a",
"public",
"key",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/session_id.go#L17-L21 |
128,693 | lightningnetwork/lnd | watchtower/wtclient/stats.go | String | func (s clientStats) String() string {
return fmt.Sprintf("tasks(received=%d accepted=%d ineligible=%d) "+
"sessions(acquired=%d exhausted=%d)", s.numTasksReceived,
s.numTasksAccepted, s.numTasksIneligible, s.numSessionsAcquired,
s.numSessionsExhausted)
} | go | func (s clientStats) String() string {
return fmt.Sprintf("tasks(received=%d accepted=%d ineligible=%d) "+
"sessions(acquired=%d exhausted=%d)", s.numTasksReceived,
s.numTasksAccepted, s.numTasksIneligible, s.numSessionsAcquired,
s.numSessionsExhausted)
} | [
"func",
"(",
"s",
"clientStats",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"s",
".",
"numTasksReceived",
",",
"s",
".",
"numTasksAccepted",
",",
"s",
".",
"numTasksIneligible",
",",
... | // String returns a human readable summary of the client's metrics. | [
"String",
"returns",
"a",
"human",
"readable",
"summary",
"of",
"the",
"client",
"s",
"metrics",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtclient/stats.go#L46-L51 |
128,694 | lightningnetwork/lnd | lnwire/init_message.go | NewInitMessage | func NewInitMessage(gf *RawFeatureVector, lf *RawFeatureVector) *Init {
return &Init{
GlobalFeatures: gf,
LocalFeatures: lf,
}
} | go | func NewInitMessage(gf *RawFeatureVector, lf *RawFeatureVector) *Init {
return &Init{
GlobalFeatures: gf,
LocalFeatures: lf,
}
} | [
"func",
"NewInitMessage",
"(",
"gf",
"*",
"RawFeatureVector",
",",
"lf",
"*",
"RawFeatureVector",
")",
"*",
"Init",
"{",
"return",
"&",
"Init",
"{",
"GlobalFeatures",
":",
"gf",
",",
"LocalFeatures",
":",
"lf",
",",
"}",
"\n",
"}"
] | // NewInitMessage creates new instance of init message object. | [
"NewInitMessage",
"creates",
"new",
"instance",
"of",
"init",
"message",
"object",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/init_message.go#L20-L25 |
128,695 | lightningnetwork/lnd | lnwire/init_message.go | Decode | func (msg *Init) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&msg.GlobalFeatures,
&msg.LocalFeatures,
)
} | go | func (msg *Init) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&msg.GlobalFeatures,
&msg.LocalFeatures,
)
} | [
"func",
"(",
"msg",
"*",
"Init",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"ReadElements",
"(",
"r",
",",
"&",
"msg",
".",
"GlobalFeatures",
",",
"&",
"msg",
".",
"LocalFeatures",
",",
")",
"\... | // Decode deserializes a serialized Init message stored in the passed
// io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"Decode",
"deserializes",
"a",
"serialized",
"Init",
"message",
"stored",
"in",
"the",
"passed",
"io",
".",
"Reader",
"observing",
"the",
"specified",
"protocol",
"version",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/init_message.go#L35-L40 |
128,696 | lightningnetwork/lnd | lnwire/init_message.go | Encode | func (msg *Init) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
msg.GlobalFeatures,
msg.LocalFeatures,
)
} | go | func (msg *Init) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
msg.GlobalFeatures,
msg.LocalFeatures,
)
} | [
"func",
"(",
"msg",
"*",
"Init",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"pver",
"uint32",
")",
"error",
"{",
"return",
"WriteElements",
"(",
"w",
",",
"msg",
".",
"GlobalFeatures",
",",
"msg",
".",
"LocalFeatures",
",",
")",
"\n",
"}"
] | // Encode serializes the target Init into the passed io.Writer observing
// the protocol version specified.
//
// This is part of the lnwire.Message interface. | [
"Encode",
"serializes",
"the",
"target",
"Init",
"into",
"the",
"passed",
"io",
".",
"Writer",
"observing",
"the",
"protocol",
"version",
"specified",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/init_message.go#L46-L51 |
128,697 | lightningnetwork/lnd | chainntnfs/bitcoindnotify/bitcoind.go | New | func New(chainConn *chain.BitcoindConn, chainParams *chaincfg.Params,
spendHintCache chainntnfs.SpendHintCache,
confirmHintCache chainntnfs.ConfirmHintCache) *BitcoindNotifier {
notifier := &BitcoindNotifier{
chainParams: chainParams,
notificationCancels: make(chan interface{}),
notificationRegistry: make(c... | go | func New(chainConn *chain.BitcoindConn, chainParams *chaincfg.Params,
spendHintCache chainntnfs.SpendHintCache,
confirmHintCache chainntnfs.ConfirmHintCache) *BitcoindNotifier {
notifier := &BitcoindNotifier{
chainParams: chainParams,
notificationCancels: make(chan interface{}),
notificationRegistry: make(c... | [
"func",
"New",
"(",
"chainConn",
"*",
"chain",
".",
"BitcoindConn",
",",
"chainParams",
"*",
"chaincfg",
".",
"Params",
",",
"spendHintCache",
"chainntnfs",
".",
"SpendHintCache",
",",
"confirmHintCache",
"chainntnfs",
".",
"ConfirmHintCache",
")",
"*",
"BitcoindN... | // New returns a new BitcoindNotifier instance. This function assumes the
// bitcoind node detailed in the passed configuration is already running, and
// willing to accept RPC requests and new zmq clients. | [
"New",
"returns",
"a",
"new",
"BitcoindNotifier",
"instance",
".",
"This",
"function",
"assumes",
"the",
"bitcoind",
"node",
"detailed",
"in",
"the",
"passed",
"configuration",
"is",
"already",
"running",
"and",
"willing",
"to",
"accept",
"RPC",
"requests",
"and... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/bitcoindnotify/bitcoind.go#L85-L106 |
128,698 | lightningnetwork/lnd | chainntnfs/bitcoindnotify/bitcoind.go | Stop | func (b *BitcoindNotifier) Stop() error {
// Already shutting down?
if atomic.AddInt32(&b.stopped, 1) != 1 {
return nil
}
// Shutdown the rpc client, this gracefully disconnects from bitcoind,
// and cleans up all related resources.
b.chainConn.Stop()
close(b.quit)
b.wg.Wait()
// Notify all pending client... | go | func (b *BitcoindNotifier) Stop() error {
// Already shutting down?
if atomic.AddInt32(&b.stopped, 1) != 1 {
return nil
}
// Shutdown the rpc client, this gracefully disconnects from bitcoind,
// and cleans up all related resources.
b.chainConn.Stop()
close(b.quit)
b.wg.Wait()
// Notify all pending client... | [
"func",
"(",
"b",
"*",
"BitcoindNotifier",
")",
"Stop",
"(",
")",
"error",
"{",
"// Already shutting down?",
"if",
"atomic",
".",
"AddInt32",
"(",
"&",
"b",
".",
"stopped",
",",
"1",
")",
"!=",
"1",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Shutdown... | // Stop shutsdown the BitcoindNotifier. | [
"Stop",
"shutsdown",
"the",
"BitcoindNotifier",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/bitcoindnotify/bitcoind.go#L147-L171 |
128,699 | lightningnetwork/lnd | chainntnfs/bitcoindnotify/bitcoind.go | confDetailsFromTxIndex | func (b *BitcoindNotifier) confDetailsFromTxIndex(txid *chainhash.Hash,
) (*chainntnfs.TxConfirmation, chainntnfs.TxConfStatus, error) {
// If the transaction has some or all of its confirmations required,
// then we may be able to dispatch it immediately.
rawTxRes, err := b.chainConn.GetRawTransactionVerbose(txid)... | go | func (b *BitcoindNotifier) confDetailsFromTxIndex(txid *chainhash.Hash,
) (*chainntnfs.TxConfirmation, chainntnfs.TxConfStatus, error) {
// If the transaction has some or all of its confirmations required,
// then we may be able to dispatch it immediately.
rawTxRes, err := b.chainConn.GetRawTransactionVerbose(txid)... | [
"func",
"(",
"b",
"*",
"BitcoindNotifier",
")",
"confDetailsFromTxIndex",
"(",
"txid",
"*",
"chainhash",
".",
"Hash",
",",
")",
"(",
"*",
"chainntnfs",
".",
"TxConfirmation",
",",
"chainntnfs",
".",
"TxConfStatus",
",",
"error",
")",
"{",
"// If the transactio... | // confDetailsFromTxIndex looks up whether a transaction is already included in
// a block in the active chain by using the backend node's transaction index.
// If the transaction is found its TxConfStatus is returned. If it was found in
// the mempool this will be TxFoundMempool, if it is found in a block this will
//... | [
"confDetailsFromTxIndex",
"looks",
"up",
"whether",
"a",
"transaction",
"is",
"already",
"included",
"in",
"a",
"block",
"in",
"the",
"active",
"chain",
"by",
"using",
"the",
"backend",
"node",
"s",
"transaction",
"index",
".",
"If",
"the",
"transaction",
"is"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/bitcoindnotify/bitcoind.go#L498-L579 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.