id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
129,700
lightningnetwork/lnd
utxonursery.go
AddLimboStage2Htlc
func (c *contractMaturityReport) AddLimboStage2Htlc(kid *kidOutput) { c.limboBalance += kid.Amount() htlcReport := htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), stage: 2, } // If the confirmation height is set, then this means the first stage // has been confirmed, and we know t...
go
func (c *contractMaturityReport) AddLimboStage2Htlc(kid *kidOutput) { c.limboBalance += kid.Amount() htlcReport := htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), stage: 2, } // If the confirmation height is set, then this means the first stage // has been confirmed, and we know t...
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddLimboStage2Htlc", "(", "kid", "*", "kidOutput", ")", "{", "c", ".", "limboBalance", "+=", "kid", ".", "Amount", "(", ")", "\n\n", "htlcReport", ":=", "htlcMaturityReport", "{", "outpoint", ":", "*", ...
// AddLimboStage2Htlc adds an htlc kindergarten output to the maturity report's // htlcs, and contributes its amount to the limbo balance.
[ "AddLimboStage2Htlc", "adds", "an", "htlc", "kindergarten", "output", "to", "the", "maturity", "report", "s", "htlcs", "and", "contributes", "its", "amount", "to", "the", "limbo", "balance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1160-L1177
129,701
lightningnetwork/lnd
utxonursery.go
AddRecoveredHtlc
func (c *contractMaturityReport) AddRecoveredHtlc(kid *kidOutput) { c.recoveredBalance += kid.Amount() c.htlcs = append(c.htlcs, htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), maturityHeight: kid.ConfHeight() + kid.BlocksToMaturity(), }) }
go
func (c *contractMaturityReport) AddRecoveredHtlc(kid *kidOutput) { c.recoveredBalance += kid.Amount() c.htlcs = append(c.htlcs, htlcMaturityReport{ outpoint: *kid.OutPoint(), amount: kid.Amount(), maturityHeight: kid.ConfHeight() + kid.BlocksToMaturity(), }) }
[ "func", "(", "c", "*", "contractMaturityReport", ")", "AddRecoveredHtlc", "(", "kid", "*", "kidOutput", ")", "{", "c", ".", "recoveredBalance", "+=", "kid", ".", "Amount", "(", ")", "\n\n", "c", ".", "htlcs", "=", "append", "(", "c", ".", "htlcs", ",",...
// AddRecoveredHtlc adds a graduate output to the maturity report's htlcs, and // contributes its amount to the recovered balance.
[ "AddRecoveredHtlc", "adds", "a", "graduate", "output", "to", "the", "maturity", "report", "s", "htlcs", "and", "contributes", "its", "amount", "to", "the", "recovered", "balance", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1181-L1189
129,702
lightningnetwork/lnd
utxonursery.go
closeAndRemoveIfMature
func (u *utxoNursery) closeAndRemoveIfMature(chanPoint *wire.OutPoint) error { isMature, err := u.cfg.Store.IsMatureChannel(chanPoint) if err == ErrContractNotFound { return nil } else if err != nil { utxnLog.Errorf("Unable to determine maturity of "+ "channel=%s", chanPoint) return err } // Nothing to d...
go
func (u *utxoNursery) closeAndRemoveIfMature(chanPoint *wire.OutPoint) error { isMature, err := u.cfg.Store.IsMatureChannel(chanPoint) if err == ErrContractNotFound { return nil } else if err != nil { utxnLog.Errorf("Unable to determine maturity of "+ "channel=%s", chanPoint) return err } // Nothing to d...
[ "func", "(", "u", "*", "utxoNursery", ")", "closeAndRemoveIfMature", "(", "chanPoint", "*", "wire", ".", "OutPoint", ")", "error", "{", "isMature", ",", "err", ":=", "u", ".", "cfg", ".", "Store", ".", "IsMatureChannel", "(", "chanPoint", ")", "\n", "if"...
// closeAndRemoveIfMature removes a particular channel from the channel index // if and only if all of its outputs have been marked graduated. If the channel // still has ungraduated outputs, the method will succeed without altering the // database state.
[ "closeAndRemoveIfMature", "removes", "a", "particular", "channel", "from", "the", "channel", "index", "if", "and", "only", "if", "all", "of", "its", "outputs", "have", "been", "marked", "graduated", ".", "If", "the", "channel", "still", "has", "ungraduated", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1195-L1223
129,703
lightningnetwork/lnd
utxonursery.go
makeBabyOutput
func makeBabyOutput(chanPoint *wire.OutPoint, htlcResolution *lnwallet.OutgoingHtlcResolution) babyOutput { htlcOutpoint := htlcResolution.ClaimOutpoint blocksToMaturity := htlcResolution.CsvDelay witnessType := input.HtlcOfferedTimeoutSecondLevel kid := makeKidOutput( &htlcOutpoint, chanPoint, blocksToMaturit...
go
func makeBabyOutput(chanPoint *wire.OutPoint, htlcResolution *lnwallet.OutgoingHtlcResolution) babyOutput { htlcOutpoint := htlcResolution.ClaimOutpoint blocksToMaturity := htlcResolution.CsvDelay witnessType := input.HtlcOfferedTimeoutSecondLevel kid := makeKidOutput( &htlcOutpoint, chanPoint, blocksToMaturit...
[ "func", "makeBabyOutput", "(", "chanPoint", "*", "wire", ".", "OutPoint", ",", "htlcResolution", "*", "lnwallet", ".", "OutgoingHtlcResolution", ")", "babyOutput", "{", "htlcOutpoint", ":=", "htlcResolution", ".", "ClaimOutpoint", "\n", "blocksToMaturity", ":=", "ht...
// makeBabyOutput constructs a baby output that wraps a future kidOutput. The // provided sign descriptors and witness types will be used once the output // reaches the delay and claim stage.
[ "makeBabyOutput", "constructs", "a", "baby", "output", "that", "wraps", "a", "future", "kidOutput", ".", "The", "provided", "sign", "descriptors", "and", "witness", "types", "will", "be", "used", "once", "the", "output", "reaches", "the", "delay", "and", "clai...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1268-L1285
129,704
lightningnetwork/lnd
utxonursery.go
Encode
func (bo *babyOutput) Encode(w io.Writer) error { var scratch [4]byte byteOrder.PutUint32(scratch[:], bo.expiry) if _, err := w.Write(scratch[:]); err != nil { return err } if err := bo.timeoutTx.Serialize(w); err != nil { return err } return bo.kidOutput.Encode(w) }
go
func (bo *babyOutput) Encode(w io.Writer) error { var scratch [4]byte byteOrder.PutUint32(scratch[:], bo.expiry) if _, err := w.Write(scratch[:]); err != nil { return err } if err := bo.timeoutTx.Serialize(w); err != nil { return err } return bo.kidOutput.Encode(w) }
[ "func", "(", "bo", "*", "babyOutput", ")", "Encode", "(", "w", "io", ".", "Writer", ")", "error", "{", "var", "scratch", "[", "4", "]", "byte", "\n", "byteOrder", ".", "PutUint32", "(", "scratch", "[", ":", "]", ",", "bo", ".", "expiry", ")", "\n...
// Encode writes the baby output to the given io.Writer.
[ "Encode", "writes", "the", "baby", "output", "to", "the", "given", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1288-L1300
129,705
lightningnetwork/lnd
utxonursery.go
Decode
func (bo *babyOutput) Decode(r io.Reader) error { var scratch [4]byte if _, err := r.Read(scratch[:]); err != nil { return err } bo.expiry = byteOrder.Uint32(scratch[:]) bo.timeoutTx = new(wire.MsgTx) if err := bo.timeoutTx.Deserialize(r); err != nil { return err } return bo.kidOutput.Decode(r) }
go
func (bo *babyOutput) Decode(r io.Reader) error { var scratch [4]byte if _, err := r.Read(scratch[:]); err != nil { return err } bo.expiry = byteOrder.Uint32(scratch[:]) bo.timeoutTx = new(wire.MsgTx) if err := bo.timeoutTx.Deserialize(r); err != nil { return err } return bo.kidOutput.Decode(r) }
[ "func", "(", "bo", "*", "babyOutput", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "var", "scratch", "[", "4", "]", "byte", "\n", "if", "_", ",", "err", ":=", "r", ".", "Read", "(", "scratch", "[", ":", "]", ")", ";", "err...
// Decode reconstructs a baby output using the provided io.Reader.
[ "Decode", "reconstructs", "a", "baby", "output", "using", "the", "provided", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1303-L1316
129,706
lightningnetwork/lnd
utxonursery.go
Decode
func (k *kidOutput) Decode(r io.Reader) error { var scratch [8]byte if _, err := r.Read(scratch[:]); err != nil { return err } k.amt = btcutil.Amount(byteOrder.Uint64(scratch[:])) if err := readOutpoint(io.LimitReader(r, 40), &k.outpoint); err != nil { return err } err := readOutpoint(io.LimitReader(r, 40...
go
func (k *kidOutput) Decode(r io.Reader) error { var scratch [8]byte if _, err := r.Read(scratch[:]); err != nil { return err } k.amt = btcutil.Amount(byteOrder.Uint64(scratch[:])) if err := readOutpoint(io.LimitReader(r, 40), &k.outpoint); err != nil { return err } err := readOutpoint(io.LimitReader(r, 40...
[ "func", "(", "k", "*", "kidOutput", ")", "Decode", "(", "r", "io", ".", "Reader", ")", "error", "{", "var", "scratch", "[", "8", "]", "byte", "\n\n", "if", "_", ",", "err", ":=", "r", ".", "Read", "(", "scratch", "[", ":", "]", ")", ";", "err...
// Decode takes a byte array representation of a kidOutput and converts it to an // struct. Note that the witnessFunc method isn't added during deserialization // and must be added later based on the value of the witnessType field.
[ "Decode", "takes", "a", "byte", "array", "representation", "of", "a", "kidOutput", "and", "converts", "it", "to", "an", "struct", ".", "Note", "that", "the", "witnessFunc", "method", "isn", "t", "added", "during", "deserialization", "and", "must", "be", "add...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/utxonursery.go#L1442-L1484
129,707
lightningnetwork/lnd
contractcourt/htlc_timeout_resolver.go
claimCleanUp
func (h *htlcTimeoutResolver) claimCleanUp( commitSpend *chainntnfs.SpendDetail) (ContractResolver, error) { // Depending on if this is our commitment or not, then we'll be looking // for a different witness pattern. spenderIndex := commitSpend.SpenderInputIndex spendingInput := commitSpend.SpendingTx.TxIn[spende...
go
func (h *htlcTimeoutResolver) claimCleanUp( commitSpend *chainntnfs.SpendDetail) (ContractResolver, error) { // Depending on if this is our commitment or not, then we'll be looking // for a different witness pattern. spenderIndex := commitSpend.SpenderInputIndex spendingInput := commitSpend.SpendingTx.TxIn[spende...
[ "func", "(", "h", "*", "htlcTimeoutResolver", ")", "claimCleanUp", "(", "commitSpend", "*", "chainntnfs", ".", "SpendDetail", ")", "(", "ContractResolver", ",", "error", ")", "{", "// Depending on if this is our commitment or not, then we'll be looking", "// for a different...
// claimCleanUp is a helper method that's called once the HTLC output is spent // by the remote party. It'll extract the preimage, add it to the global cache, // and finally send the appropriate clean up message.
[ "claimCleanUp", "is", "a", "helper", "method", "that", "s", "called", "once", "the", "HTLC", "output", "is", "spent", "by", "the", "remote", "party", ".", "It", "ll", "extract", "the", "preimage", "add", "it", "to", "the", "global", "cache", "and", "fina...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/htlc_timeout_resolver.go#L94-L152
129,708
lightningnetwork/lnd
contractcourt/htlc_timeout_resolver.go
isSuccessSpend
func isSuccessSpend(spend *chainntnfs.SpendDetail, localCommit bool) bool { // Based on the spending input index and transaction, obtain the // witness that tells us what type of spend this is. spenderIndex := spend.SpenderInputIndex spendingInput := spend.SpendingTx.TxIn[spenderIndex] spendingWitness := spendingI...
go
func isSuccessSpend(spend *chainntnfs.SpendDetail, localCommit bool) bool { // Based on the spending input index and transaction, obtain the // witness that tells us what type of spend this is. spenderIndex := spend.SpenderInputIndex spendingInput := spend.SpendingTx.TxIn[spenderIndex] spendingWitness := spendingI...
[ "func", "isSuccessSpend", "(", "spend", "*", "chainntnfs", ".", "SpendDetail", ",", "localCommit", "bool", ")", "bool", "{", "// Based on the spending input index and transaction, obtain the", "// witness that tells us what type of spend this is.", "spenderIndex", ":=", "spend", ...
// isSuccessSpend returns true if the passed spend on the specified commitment // is a success spend that reveals the pre-image or not.
[ "isSuccessSpend", "returns", "true", "if", "the", "passed", "spend", "on", "the", "specified", "commitment", "is", "a", "success", "spend", "that", "reveals", "the", "pre", "-", "image", "or", "not", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/htlc_timeout_resolver.go#L187-L220
129,709
lightningnetwork/lnd
watchtower/wtdb/codec.go
ReadElement
func ReadElement(r io.Reader, element interface{}) error { err := channeldb.ReadElement(r, element) switch { // Known to channeldb codec. case err == nil: return nil // Fail if error is not UnknownElementType. case err != nil: if _, ok := err.(UnknownElementType); !ok { return err } } // Process any...
go
func ReadElement(r io.Reader, element interface{}) error { err := channeldb.ReadElement(r, element) switch { // Known to channeldb codec. case err == nil: return nil // Fail if error is not UnknownElementType. case err != nil: if _, ok := err.(UnknownElementType); !ok { return err } } // Process any...
[ "func", "ReadElement", "(", "r", "io", ".", "Reader", ",", "element", "interface", "{", "}", ")", "error", "{", "err", ":=", "channeldb", ".", "ReadElement", "(", "r", ",", "element", ")", "\n", "switch", "{", "// Known to channeldb codec.", "case", "err",...
// ReadElement deserializes a single element from the provided io.Reader.
[ "ReadElement", "deserializes", "a", "single", "element", "from", "the", "provided", "io", ".", "Reader", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/codec.go#L16-L71
129,710
lightningnetwork/lnd
watchtower/wtdb/codec.go
WriteElement
func WriteElement(w io.Writer, element interface{}) error { err := channeldb.WriteElement(w, element) switch { // Known to channeldb codec. case err == nil: return nil // Fail if error is not UnknownElementType. case err != nil: if _, ok := err.(UnknownElementType); !ok { return err } } // Process a...
go
func WriteElement(w io.Writer, element interface{}) error { err := channeldb.WriteElement(w, element) switch { // Known to channeldb codec. case err == nil: return nil // Fail if error is not UnknownElementType. case err != nil: if _, ok := err.(UnknownElementType); !ok { return err } } // Process a...
[ "func", "WriteElement", "(", "w", "io", ".", "Writer", ",", "element", "interface", "{", "}", ")", "error", "{", "err", ":=", "channeldb", ".", "WriteElement", "(", "w", ",", "element", ")", "\n", "switch", "{", "// Known to channeldb codec.", "case", "err...
// WriteElement serializes a single element into the provided io.Writer.
[ "WriteElement", "serializes", "a", "single", "element", "into", "the", "provided", "io", ".", "Writer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtdb/codec.go#L74-L119
129,711
lightningnetwork/lnd
nat/upnp.go
DiscoverUPnP
func DiscoverUPnP(ctx context.Context) (*UPnP, error) { // Scan the local network for a UPnP-enabled device. device, err := upnp.DiscoverCtx(ctx) if err != nil { return nil, err } u := &UPnP{ device: device, forwardedPorts: make(map[uint16]struct{}), } // We'll then attempt to retrieve the extern...
go
func DiscoverUPnP(ctx context.Context) (*UPnP, error) { // Scan the local network for a UPnP-enabled device. device, err := upnp.DiscoverCtx(ctx) if err != nil { return nil, err } u := &UPnP{ device: device, forwardedPorts: make(map[uint16]struct{}), } // We'll then attempt to retrieve the extern...
[ "func", "DiscoverUPnP", "(", "ctx", "context", ".", "Context", ")", "(", "*", "UPnP", ",", "error", ")", "{", "// Scan the local network for a UPnP-enabled device.", "device", ",", "err", ":=", "upnp", ".", "DiscoverCtx", "(", "ctx", ")", "\n", "if", "err", ...
// DiscoverUPnP scans the local network for a UPnP enabled device.
[ "DiscoverUPnP", "scans", "the", "local", "network", "for", "a", "UPnP", "enabled", "device", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nat/upnp.go#L25-L44
129,712
lightningnetwork/lnd
nat/upnp.go
ExternalIP
func (u *UPnP) ExternalIP() (net.IP, error) { ip, err := u.device.ExternalIP() if err != nil { return nil, err } if isPrivateIP(net.ParseIP(ip)) { return nil, ErrMultipleNAT } return net.ParseIP(ip), nil }
go
func (u *UPnP) ExternalIP() (net.IP, error) { ip, err := u.device.ExternalIP() if err != nil { return nil, err } if isPrivateIP(net.ParseIP(ip)) { return nil, ErrMultipleNAT } return net.ParseIP(ip), nil }
[ "func", "(", "u", "*", "UPnP", ")", "ExternalIP", "(", ")", "(", "net", ".", "IP", ",", "error", ")", "{", "ip", ",", "err", ":=", "u", ".", "device", ".", "ExternalIP", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "er...
// ExternalIP returns the external IP address of the UPnP enabled device.
[ "ExternalIP", "returns", "the", "external", "IP", "address", "of", "the", "UPnP", "enabled", "device", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/nat/upnp.go#L47-L58
129,713
lightningnetwork/lnd
routing/pathfind.go
computeFee
func computeFee(amt lnwire.MilliSatoshi, edge *channeldb.ChannelEdgePolicy) lnwire.MilliSatoshi { return edge.FeeBaseMSat + (amt*edge.FeeProportionalMillionths)/1000000 }
go
func computeFee(amt lnwire.MilliSatoshi, edge *channeldb.ChannelEdgePolicy) lnwire.MilliSatoshi { return edge.FeeBaseMSat + (amt*edge.FeeProportionalMillionths)/1000000 }
[ "func", "computeFee", "(", "amt", "lnwire", ".", "MilliSatoshi", ",", "edge", "*", "channeldb", ".", "ChannelEdgePolicy", ")", "lnwire", ".", "MilliSatoshi", "{", "return", "edge", ".", "FeeBaseMSat", "+", "(", "amt", "*", "edge", ".", "FeeProportionalMilliont...
// computeFee computes the fee to forward an HTLC of `amt` milli-satoshis over // the passed active payment channel. This value is currently computed as // specified in BOLT07, but will likely change in the near future.
[ "computeFee", "computes", "the", "fee", "to", "forward", "an", "HTLC", "of", "amt", "milli", "-", "satoshis", "over", "the", "passed", "active", "payment", "channel", ".", "This", "value", "is", "currently", "computed", "as", "specified", "in", "BOLT07", "bu...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/pathfind.go#L54-L58
129,714
lightningnetwork/lnd
routing/pathfind.go
isSamePath
func isSamePath(path1, path2 []*channeldb.ChannelEdgePolicy) bool { if len(path1) != len(path2) { return false } for i := 0; i < len(path1); i++ { if path1[i].ChannelID != path2[i].ChannelID { return false } } return true }
go
func isSamePath(path1, path2 []*channeldb.ChannelEdgePolicy) bool { if len(path1) != len(path2) { return false } for i := 0; i < len(path1); i++ { if path1[i].ChannelID != path2[i].ChannelID { return false } } return true }
[ "func", "isSamePath", "(", "path1", ",", "path2", "[", "]", "*", "channeldb", ".", "ChannelEdgePolicy", ")", "bool", "{", "if", "len", "(", "path1", ")", "!=", "len", "(", "path2", ")", "{", "return", "false", "\n", "}", "\n\n", "for", "i", ":=", "...
// isSamePath returns true if path1 and path2 travel through the exact same // edges, and false otherwise.
[ "isSamePath", "returns", "true", "if", "path1", "and", "path2", "travel", "through", "the", "exact", "same", "edges", "and", "false", "otherwise", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/pathfind.go#L62-L74
129,715
lightningnetwork/lnd
chanbackup/backup.go
assembleChanBackup
func assembleChanBackup(chanSource LiveChannelSource, openChan *channeldb.OpenChannel) (*Single, error) { log.Debugf("Crafting backup for ChannelPoint(%v)", openChan.FundingOutpoint) // First, we'll query the channel source to obtain all the addresses // that are are associated with the peer for this channel. ...
go
func assembleChanBackup(chanSource LiveChannelSource, openChan *channeldb.OpenChannel) (*Single, error) { log.Debugf("Crafting backup for ChannelPoint(%v)", openChan.FundingOutpoint) // First, we'll query the channel source to obtain all the addresses // that are are associated with the peer for this channel. ...
[ "func", "assembleChanBackup", "(", "chanSource", "LiveChannelSource", ",", "openChan", "*", "channeldb", ".", "OpenChannel", ")", "(", "*", "Single", ",", "error", ")", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "openChan", ".", "FundingOutpoint", ")",...
// assembleChanBackup attempts to assemble a static channel backup for the // passed open channel. The backup includes all information required to restore // the channel, as well as addressing information so we can find the peer and // reconnect to them to initiate the protocol.
[ "assembleChanBackup", "attempts", "to", "assemble", "a", "static", "channel", "backup", "for", "the", "passed", "open", "channel", ".", "The", "backup", "includes", "all", "information", "required", "to", "restore", "the", "channel", "as", "well", "as", "address...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/backup.go#L32-L48
129,716
lightningnetwork/lnd
chanbackup/backup.go
FetchBackupForChan
func FetchBackupForChan(chanPoint wire.OutPoint, chanSource LiveChannelSource) (*Single, error) { // First, we'll query the channel source to see if the channel is known // and open within the database. targetChan, err := chanSource.FetchChannel(chanPoint) if err != nil { // If we can't find the channel, then w...
go
func FetchBackupForChan(chanPoint wire.OutPoint, chanSource LiveChannelSource) (*Single, error) { // First, we'll query the channel source to see if the channel is known // and open within the database. targetChan, err := chanSource.FetchChannel(chanPoint) if err != nil { // If we can't find the channel, then w...
[ "func", "FetchBackupForChan", "(", "chanPoint", "wire", ".", "OutPoint", ",", "chanSource", "LiveChannelSource", ")", "(", "*", "Single", ",", "error", ")", "{", "// First, we'll query the channel source to see if the channel is known", "// and open within the database.", "ta...
// FetchBackupForChan attempts to create a plaintext static channel backup for // the target channel identified by its channel point. If we're unable to find // the target channel, then an error will be returned.
[ "FetchBackupForChan", "attempts", "to", "create", "a", "plaintext", "static", "channel", "backup", "for", "the", "target", "channel", "identified", "by", "its", "channel", "point", ".", "If", "we", "re", "unable", "to", "find", "the", "target", "channel", "the...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/backup.go#L53-L73
129,717
lightningnetwork/lnd
watchtower/wtwire/state_update.go
Decode
func (m *StateUpdate) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &m.SeqNum, &m.LastApplied, &m.IsComplete, &m.Hint, &m.EncryptedBlob, ) }
go
func (m *StateUpdate) Decode(r io.Reader, pver uint32) error { return ReadElements(r, &m.SeqNum, &m.LastApplied, &m.IsComplete, &m.Hint, &m.EncryptedBlob, ) }
[ "func", "(", "m", "*", "StateUpdate", ")", "Decode", "(", "r", "io", ".", "Reader", ",", "pver", "uint32", ")", "error", "{", "return", "ReadElements", "(", "r", ",", "&", "m", ".", "SeqNum", ",", "&", "m", ".", "LastApplied", ",", "&", "m", ".",...
// Decode deserializes a serialized StateUpdate message stored in the passed // io.Reader observing the specified protocol version. // // This is part of the wtwire.Message interface.
[ "Decode", "deserializes", "a", "serialized", "StateUpdate", "message", "stored", "in", "the", "passed", "io", ".", "Reader", "observing", "the", "specified", "protocol", "version", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/state_update.go#L50-L58
129,718
lightningnetwork/lnd
watchtower/wtwire/state_update.go
Encode
func (m *StateUpdate) Encode(w io.Writer, pver uint32) error { return WriteElements(w, m.SeqNum, m.LastApplied, m.IsComplete, m.Hint, m.EncryptedBlob, ) }
go
func (m *StateUpdate) Encode(w io.Writer, pver uint32) error { return WriteElements(w, m.SeqNum, m.LastApplied, m.IsComplete, m.Hint, m.EncryptedBlob, ) }
[ "func", "(", "m", "*", "StateUpdate", ")", "Encode", "(", "w", "io", ".", "Writer", ",", "pver", "uint32", ")", "error", "{", "return", "WriteElements", "(", "w", ",", "m", ".", "SeqNum", ",", "m", ".", "LastApplied", ",", "m", ".", "IsComplete", "...
// Encode serializes the target StateUpdate into the passed io.Writer // observing the protocol version specified. // // This is part of the wtwire.Message interface.
[ "Encode", "serializes", "the", "target", "StateUpdate", "into", "the", "passed", "io", ".", "Writer", "observing", "the", "protocol", "version", "specified", ".", "This", "is", "part", "of", "the", "wtwire", ".", "Message", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtwire/state_update.go#L64-L72
129,719
lightningnetwork/lnd
lnwallet/transactions.go
SetStateNumHint
func SetStateNumHint(commitTx *wire.MsgTx, stateNum uint64, obfuscator [StateHintSize]byte) error { // With the current schema we are only able to encode state num // hints up to 2^48. Therefore if the passed height is greater than our // state hint ceiling, then exit early. if stateNum > maxStateHint { return ...
go
func SetStateNumHint(commitTx *wire.MsgTx, stateNum uint64, obfuscator [StateHintSize]byte) error { // With the current schema we are only able to encode state num // hints up to 2^48. Therefore if the passed height is greater than our // state hint ceiling, then exit early. if stateNum > maxStateHint { return ...
[ "func", "SetStateNumHint", "(", "commitTx", "*", "wire", ".", "MsgTx", ",", "stateNum", "uint64", ",", "obfuscator", "[", "StateHintSize", "]", "byte", ")", "error", "{", "// With the current schema we are only able to encode state num", "// hints up to 2^48. Therefore if t...
// SetStateNumHint encodes the current state number within the passed // commitment transaction by re-purposing the locktime and sequence fields in // the commitment transaction to encode the obfuscated state number. The state // number is encoded using 48 bits. The lower 24 bits of the lock time are the // lower 24 b...
[ "SetStateNumHint", "encodes", "the", "current", "state", "number", "within", "the", "passed", "commitment", "transaction", "by", "re", "-", "purposing", "the", "locktime", "and", "sequence", "fields", "in", "the", "commitment", "transaction", "to", "encode", "the"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/transactions.go#L147-L179
129,720
lightningnetwork/lnd
lnwallet/transactions.go
GetStateNumHint
func GetStateNumHint(commitTx *wire.MsgTx, obfuscator [StateHintSize]byte) uint64 { // Convert the obfuscator into a uint64, this will be used to // de-obfuscate the final recovered state number. var obfs [8]byte copy(obfs[2:], obfuscator[:]) xorInt := binary.BigEndian.Uint64(obfs[:]) // Retrieve the state hint ...
go
func GetStateNumHint(commitTx *wire.MsgTx, obfuscator [StateHintSize]byte) uint64 { // Convert the obfuscator into a uint64, this will be used to // de-obfuscate the final recovered state number. var obfs [8]byte copy(obfs[2:], obfuscator[:]) xorInt := binary.BigEndian.Uint64(obfs[:]) // Retrieve the state hint ...
[ "func", "GetStateNumHint", "(", "commitTx", "*", "wire", ".", "MsgTx", ",", "obfuscator", "[", "StateHintSize", "]", "byte", ")", "uint64", "{", "// Convert the obfuscator into a uint64, this will be used to", "// de-obfuscate the final recovered state number.", "var", "obfs"...
// GetStateNumHint recovers the current state number given a commitment // transaction which has previously had the state number encoded within it via // setStateNumHint and a shared obfuscator. // // See setStateNumHint for further details w.r.t exactly how the state-hints // are encoded.
[ "GetStateNumHint", "recovers", "the", "current", "state", "number", "given", "a", "commitment", "transaction", "which", "has", "previously", "had", "the", "state", "number", "encoded", "within", "it", "via", "setStateNumHint", "and", "a", "shared", "obfuscator", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/transactions.go#L187-L202
129,721
lightningnetwork/lnd
routing/missioncontrol.go
NewPaymentSession
func (m *missionControl) NewPaymentSession(routeHints [][]zpay32.HopHint, target route.Vertex) (*paymentSession, error) { viewSnapshot := m.GraphPruneView() edges := make(map[route.Vertex][]*channeldb.ChannelEdgePolicy) // Traverse through all of the available hop hints and include them in // our edges map, ind...
go
func (m *missionControl) NewPaymentSession(routeHints [][]zpay32.HopHint, target route.Vertex) (*paymentSession, error) { viewSnapshot := m.GraphPruneView() edges := make(map[route.Vertex][]*channeldb.ChannelEdgePolicy) // Traverse through all of the available hop hints and include them in // our edges map, ind...
[ "func", "(", "m", "*", "missionControl", ")", "NewPaymentSession", "(", "routeHints", "[", "]", "[", "]", "zpay32", ".", "HopHint", ",", "target", "route", ".", "Vertex", ")", "(", "*", "paymentSession", ",", "error", ")", "{", "viewSnapshot", ":=", "m",...
// NewPaymentSession creates a new payment session backed by the latest prune // view from Mission Control. An optional set of routing hints can be provided // in order to populate additional edges to explore when finding a path to the // payment's destination.
[ "NewPaymentSession", "creates", "a", "new", "payment", "session", "backed", "by", "the", "latest", "prune", "view", "from", "Mission", "Control", ".", "An", "optional", "set", "of", "routing", "hints", "can", "be", "provided", "in", "order", "to", "populate", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/missioncontrol.go#L157-L232
129,722
lightningnetwork/lnd
routing/missioncontrol.go
NewPaymentSessionFromRoutes
func (m *missionControl) NewPaymentSessionFromRoutes(routes []*route.Route) *paymentSession { return &paymentSession{ pruneViewSnapshot: m.GraphPruneView(), haveRoutes: true, preBuiltRoutes: routes, errFailedPolicyChans: make(map[EdgeLocator]struct{}), mc: m, pathFinder...
go
func (m *missionControl) NewPaymentSessionFromRoutes(routes []*route.Route) *paymentSession { return &paymentSession{ pruneViewSnapshot: m.GraphPruneView(), haveRoutes: true, preBuiltRoutes: routes, errFailedPolicyChans: make(map[EdgeLocator]struct{}), mc: m, pathFinder...
[ "func", "(", "m", "*", "missionControl", ")", "NewPaymentSessionFromRoutes", "(", "routes", "[", "]", "*", "route", ".", "Route", ")", "*", "paymentSession", "{", "return", "&", "paymentSession", "{", "pruneViewSnapshot", ":", "m", ".", "GraphPruneView", "(", ...
// NewPaymentSessionFromRoutes creates a new paymentSession instance that will // skip all path finding, and will instead utilize a set of pre-built routes. // This constructor allows callers to specify their own routes which can be // used for things like channel rebalancing, and swaps.
[ "NewPaymentSessionFromRoutes", "creates", "a", "new", "paymentSession", "instance", "that", "will", "skip", "all", "path", "finding", "and", "will", "instead", "utilize", "a", "set", "of", "pre", "-", "built", "routes", ".", "This", "constructor", "allows", "cal...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/missioncontrol.go#L238-L247
129,723
lightningnetwork/lnd
routing/missioncontrol.go
generateBandwidthHints
func generateBandwidthHints(sourceNode *channeldb.LightningNode, queryBandwidth func(*channeldb.ChannelEdgeInfo) lnwire.MilliSatoshi) (map[uint64]lnwire.MilliSatoshi, error) { // First, we'll collect the set of outbound edges from the target // source node. var localChans []*channeldb.ChannelEdgeInfo err := sourc...
go
func generateBandwidthHints(sourceNode *channeldb.LightningNode, queryBandwidth func(*channeldb.ChannelEdgeInfo) lnwire.MilliSatoshi) (map[uint64]lnwire.MilliSatoshi, error) { // First, we'll collect the set of outbound edges from the target // source node. var localChans []*channeldb.ChannelEdgeInfo err := sourc...
[ "func", "generateBandwidthHints", "(", "sourceNode", "*", "channeldb", ".", "LightningNode", ",", "queryBandwidth", "func", "(", "*", "channeldb", ".", "ChannelEdgeInfo", ")", "lnwire", ".", "MilliSatoshi", ")", "(", "map", "[", "uint64", "]", "lnwire", ".", "...
// generateBandwidthHints is a helper function that's utilized the main // findPath function in order to obtain hints from the lower layer w.r.t to the // available bandwidth of edges on the network. Currently, we'll only obtain // bandwidth hints for the edges we directly have open ourselves. Obtaining // these hints ...
[ "generateBandwidthHints", "is", "a", "helper", "function", "that", "s", "utilized", "the", "main", "findPath", "function", "in", "order", "to", "obtain", "hints", "from", "the", "lower", "layer", "w", ".", "r", ".", "t", "to", "the", "available", "bandwidth"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/missioncontrol.go#L256-L282
129,724
lightningnetwork/lnd
routing/missioncontrol.go
ResetHistory
func (m *missionControl) ResetHistory() { m.Lock() m.failedEdges = make(map[EdgeLocator]time.Time) m.failedVertexes = make(map[route.Vertex]time.Time) m.Unlock() }
go
func (m *missionControl) ResetHistory() { m.Lock() m.failedEdges = make(map[EdgeLocator]time.Time) m.failedVertexes = make(map[route.Vertex]time.Time) m.Unlock() }
[ "func", "(", "m", "*", "missionControl", ")", "ResetHistory", "(", ")", "{", "m", ".", "Lock", "(", ")", "\n", "m", ".", "failedEdges", "=", "make", "(", "map", "[", "EdgeLocator", "]", "time", ".", "Time", ")", "\n", "m", ".", "failedVertexes", "=...
// ResetHistory resets the history of missionControl returning it to a state as // if no payment attempts have been made.
[ "ResetHistory", "resets", "the", "history", "of", "missionControl", "returning", "it", "to", "a", "state", "as", "if", "no", "payment", "attempts", "have", "been", "made", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/routing/missioncontrol.go#L286-L291
129,725
lightningnetwork/lnd
chanbackup/pubsub.go
NewSubSwapper
func NewSubSwapper(startingChans []Single, chanNotifier ChannelNotifier, keyRing keychain.KeyRing, backupSwapper Swapper) (*SubSwapper, error) { // First, we'll subscribe to the latest set of channel updates given // the set of channels we already know of. knownChans := make(map[wire.OutPoint]struct{}) for _, cha...
go
func NewSubSwapper(startingChans []Single, chanNotifier ChannelNotifier, keyRing keychain.KeyRing, backupSwapper Swapper) (*SubSwapper, error) { // First, we'll subscribe to the latest set of channel updates given // the set of channels we already know of. knownChans := make(map[wire.OutPoint]struct{}) for _, cha...
[ "func", "NewSubSwapper", "(", "startingChans", "[", "]", "Single", ",", "chanNotifier", "ChannelNotifier", ",", "keyRing", "keychain", ".", "KeyRing", ",", "backupSwapper", "Swapper", ")", "(", "*", "SubSwapper", ",", "error", ")", "{", "// First, we'll subscribe ...
// NewSubSwapper creates a new instance of the SubSwapper given the starting // set of channels, and the required interfaces to be notified of new channel // updates, pack a multi backup, and swap the current best backup from its // storage location.
[ "NewSubSwapper", "creates", "a", "new", "instance", "of", "the", "SubSwapper", "given", "the", "starting", "set", "of", "channels", "and", "the", "required", "interfaces", "to", "be", "notified", "of", "new", "channel", "updates", "pack", "a", "multi", "backup...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/pubsub.go#L106-L134
129,726
lightningnetwork/lnd
chanbackup/pubsub.go
Start
func (s *SubSwapper) Start() error { if !atomic.CompareAndSwapUint32(&s.started, 0, 1) { return nil } log.Infof("Starting chanbackup.SubSwapper") s.wg.Add(1) go s.backupUpdater() return nil }
go
func (s *SubSwapper) Start() error { if !atomic.CompareAndSwapUint32(&s.started, 0, 1) { return nil } log.Infof("Starting chanbackup.SubSwapper") s.wg.Add(1) go s.backupUpdater() return nil }
[ "func", "(", "s", "*", "SubSwapper", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "s", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Infof", "("...
// Start starts the chanbackup.SubSwapper.
[ "Start", "starts", "the", "chanbackup", ".", "SubSwapper", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/pubsub.go#L137-L148
129,727
lightningnetwork/lnd
chanbackup/pubsub.go
Stop
func (s *SubSwapper) Stop() error { if !atomic.CompareAndSwapUint32(&s.stopped, 0, 1) { return nil } log.Infof("Stopping chanbackup.SubSwapper") close(s.quit) s.wg.Wait() return nil }
go
func (s *SubSwapper) Stop() error { if !atomic.CompareAndSwapUint32(&s.stopped, 0, 1) { return nil } log.Infof("Stopping chanbackup.SubSwapper") close(s.quit) s.wg.Wait() return nil }
[ "func", "(", "s", "*", "SubSwapper", ")", "Stop", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "s", ".", "stopped", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Infof", "(",...
// Stop signals the SubSwapper to being a graceful shutdown.
[ "Stop", "signals", "the", "SubSwapper", "to", "being", "a", "graceful", "shutdown", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/pubsub.go#L151-L162
129,728
lightningnetwork/lnd
chanbackup/pubsub.go
updateBackupFile
func (s *SubSwapper) updateBackupFile() error { // With our updated channel state obtained, we'll create a new multi // from our series of singles. var newMulti Multi for _, backup := range s.backupState { newMulti.StaticBackups = append( newMulti.StaticBackups, backup, ) } // Now that our multi has been ...
go
func (s *SubSwapper) updateBackupFile() error { // With our updated channel state obtained, we'll create a new multi // from our series of singles. var newMulti Multi for _, backup := range s.backupState { newMulti.StaticBackups = append( newMulti.StaticBackups, backup, ) } // Now that our multi has been ...
[ "func", "(", "s", "*", "SubSwapper", ")", "updateBackupFile", "(", ")", "error", "{", "// With our updated channel state obtained, we'll create a new multi", "// from our series of singles.", "var", "newMulti", "Multi", "\n", "for", "_", ",", "backup", ":=", "range", "s...
// updateBackupFile updates the backup file in place given the current state of // the SubSwapper.
[ "updateBackupFile", "updates", "the", "backup", "file", "in", "place", "given", "the", "current", "state", "of", "the", "SubSwapper", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/pubsub.go#L166-L192
129,729
lightningnetwork/lnd
chanbackup/pubsub.go
backupUpdater
func (s *SubSwapper) backupUpdater() { // Ensure that once we exit, we'll cancel our active channel // subscription. defer s.chanEvents.Cancel() defer s.wg.Done() log.Debugf("SubSwapper's backupUpdater is active!") // Before we enter our main loop, we'll update the on-disk state with // the latest Single state...
go
func (s *SubSwapper) backupUpdater() { // Ensure that once we exit, we'll cancel our active channel // subscription. defer s.chanEvents.Cancel() defer s.wg.Done() log.Debugf("SubSwapper's backupUpdater is active!") // Before we enter our main loop, we'll update the on-disk state with // the latest Single state...
[ "func", "(", "s", "*", "SubSwapper", ")", "backupUpdater", "(", ")", "{", "// Ensure that once we exit, we'll cancel our active channel", "// subscription.", "defer", "s", ".", "chanEvents", ".", "Cancel", "(", ")", "\n", "defer", "s", ".", "wg", ".", "Done", "(...
// backupFileUpdater is the primary goroutine of the SubSwapper which is // responsible for listening for changes to the channel, and updating the // persistent multi backup state with a new packed multi of the latest channel // state.
[ "backupFileUpdater", "is", "the", "primary", "goroutine", "of", "the", "SubSwapper", "which", "is", "responsible", "for", "listening", "for", "changes", "to", "the", "channel", "and", "updating", "the", "persistent", "multi", "backup", "state", "with", "a", "new...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/pubsub.go#L198-L263
129,730
lightningnetwork/lnd
discovery/gossiper.go
apply
func (f *optionalMsgFields) apply(optionalMsgFields ...OptionalMsgField) { for _, optionalMsgField := range optionalMsgFields { optionalMsgField(f) } }
go
func (f *optionalMsgFields) apply(optionalMsgFields ...OptionalMsgField) { for _, optionalMsgField := range optionalMsgFields { optionalMsgField(f) } }
[ "func", "(", "f", "*", "optionalMsgFields", ")", "apply", "(", "optionalMsgFields", "...", "OptionalMsgField", ")", "{", "for", "_", ",", "optionalMsgField", ":=", "range", "optionalMsgFields", "{", "optionalMsgField", "(", "f", ")", "\n", "}", "\n", "}" ]
// apply applies the optional fields within the functional options.
[ "apply", "applies", "the", "optional", "fields", "within", "the", "functional", "options", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L48-L52
129,731
lightningnetwork/lnd
discovery/gossiper.go
ChannelCapacity
func ChannelCapacity(capacity btcutil.Amount) OptionalMsgField { return func(f *optionalMsgFields) { f.capacity = &capacity } }
go
func ChannelCapacity(capacity btcutil.Amount) OptionalMsgField { return func(f *optionalMsgFields) { f.capacity = &capacity } }
[ "func", "ChannelCapacity", "(", "capacity", "btcutil", ".", "Amount", ")", "OptionalMsgField", "{", "return", "func", "(", "f", "*", "optionalMsgFields", ")", "{", "f", ".", "capacity", "=", "&", "capacity", "\n", "}", "\n", "}" ]
// ChannelCapacity is an optional field that lets the gossiper know of the // capacity of a channel.
[ "ChannelCapacity", "is", "an", "optional", "field", "that", "lets", "the", "gossiper", "know", "of", "the", "capacity", "of", "a", "channel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L61-L65
129,732
lightningnetwork/lnd
discovery/gossiper.go
ChannelPoint
func ChannelPoint(op wire.OutPoint) OptionalMsgField { return func(f *optionalMsgFields) { f.channelPoint = &op } }
go
func ChannelPoint(op wire.OutPoint) OptionalMsgField { return func(f *optionalMsgFields) { f.channelPoint = &op } }
[ "func", "ChannelPoint", "(", "op", "wire", ".", "OutPoint", ")", "OptionalMsgField", "{", "return", "func", "(", "f", "*", "optionalMsgFields", ")", "{", "f", ".", "channelPoint", "=", "&", "op", "\n", "}", "\n", "}" ]
// ChannelPoint is an optional field that lets the gossiper know of the outpoint // of a channel.
[ "ChannelPoint", "is", "an", "optional", "field", "that", "lets", "the", "gossiper", "know", "of", "the", "outpoint", "of", "a", "channel", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L69-L73
129,733
lightningnetwork/lnd
discovery/gossiper.go
New
func New(cfg Config, selfKey *btcec.PublicKey) *AuthenticatedGossiper { gossiper := &AuthenticatedGossiper{ selfKey: selfKey, cfg: &cfg, networkMsgs: make(chan *networkMsg), quit: make(chan struct{}), chanPolicyUpdates: make(chan *chanP...
go
func New(cfg Config, selfKey *btcec.PublicKey) *AuthenticatedGossiper { gossiper := &AuthenticatedGossiper{ selfKey: selfKey, cfg: &cfg, networkMsgs: make(chan *networkMsg), quit: make(chan struct{}), chanPolicyUpdates: make(chan *chanP...
[ "func", "New", "(", "cfg", "Config", ",", "selfKey", "*", "btcec", ".", "PublicKey", ")", "*", "AuthenticatedGossiper", "{", "gossiper", ":=", "&", "AuthenticatedGossiper", "{", "selfKey", ":", "selfKey", ",", "cfg", ":", "&", "cfg", ",", "networkMsgs", ":...
// New creates a new AuthenticatedGossiper instance, initialized with the // passed configuration parameters.
[ "New", "creates", "a", "new", "AuthenticatedGossiper", "instance", "initialized", "with", "the", "passed", "configuration", "parameters", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L298-L326
129,734
lightningnetwork/lnd
discovery/gossiper.go
Start
func (d *AuthenticatedGossiper) Start() error { if !atomic.CompareAndSwapUint32(&d.started, 0, 1) { return nil } log.Info("Authenticated Gossiper is starting") // First we register for new notifications of newly discovered blocks. // We do this immediately so we'll later be able to consume any/all // blocks w...
go
func (d *AuthenticatedGossiper) Start() error { if !atomic.CompareAndSwapUint32(&d.started, 0, 1) { return nil } log.Info("Authenticated Gossiper is starting") // First we register for new notifications of newly discovered blocks. // We do this immediately so we'll later be able to consume any/all // blocks w...
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "Start", "(", ")", "error", "{", "if", "!", "atomic", ".", "CompareAndSwapUint32", "(", "&", "d", ".", "started", ",", "0", ",", "1", ")", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "In...
// Start spawns network messages handler goroutine and registers on new block // notifications in order to properly handle the premature announcements.
[ "Start", "spawns", "network", "messages", "handler", "goroutine", "and", "registers", "on", "new", "block", "notifications", "in", "order", "to", "properly", "handle", "the", "premature", "announcements", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L462-L497
129,735
lightningnetwork/lnd
discovery/gossiper.go
ProcessLocalAnnouncement
func (d *AuthenticatedGossiper) ProcessLocalAnnouncement(msg lnwire.Message, source *btcec.PublicKey, optionalFields ...OptionalMsgField) chan error { optionalMsgFields := &optionalMsgFields{} optionalMsgFields.apply(optionalFields...) nMsg := &networkMsg{ msg: msg, optionalMsgFields: optionalMs...
go
func (d *AuthenticatedGossiper) ProcessLocalAnnouncement(msg lnwire.Message, source *btcec.PublicKey, optionalFields ...OptionalMsgField) chan error { optionalMsgFields := &optionalMsgFields{} optionalMsgFields.apply(optionalFields...) nMsg := &networkMsg{ msg: msg, optionalMsgFields: optionalMs...
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "ProcessLocalAnnouncement", "(", "msg", "lnwire", ".", "Message", ",", "source", "*", "btcec", ".", "PublicKey", ",", "optionalFields", "...", "OptionalMsgField", ")", "chan", "error", "{", "optionalMsgFields", ...
// ProcessLocalAnnouncement sends a new remote announcement message along with // the peer that sent the routing message. The announcement will be processed // then added to a queue for batched trickled announcement to all connected // peers. Local channel announcements don't contain the announcement proof and // will...
[ "ProcessLocalAnnouncement", "sends", "a", "new", "remote", "announcement", "message", "along", "with", "the", "peer", "that", "sent", "the", "routing", "message", ".", "The", "announcement", "will", "be", "processed", "then", "added", "to", "a", "queue", "for", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L612-L633
129,736
lightningnetwork/lnd
discovery/gossiper.go
mergeSyncerMap
func (m *msgWithSenders) mergeSyncerMap(syncers map[route.Vertex]*GossipSyncer) { for peerPub := range syncers { m.senders[peerPub] = struct{}{} } }
go
func (m *msgWithSenders) mergeSyncerMap(syncers map[route.Vertex]*GossipSyncer) { for peerPub := range syncers { m.senders[peerPub] = struct{}{} } }
[ "func", "(", "m", "*", "msgWithSenders", ")", "mergeSyncerMap", "(", "syncers", "map", "[", "route", ".", "Vertex", "]", "*", "GossipSyncer", ")", "{", "for", "peerPub", ":=", "range", "syncers", "{", "m", ".", "senders", "[", "peerPub", "]", "=", "str...
// mergeSyncerMap is used to merge the set of senders of a particular message // with peers that we have an active GossipSyncer with. We do this to ensure // that we don't broadcast messages to any peers that we have active gossip // syncers for.
[ "mergeSyncerMap", "is", "used", "to", "merge", "the", "set", "of", "senders", "of", "a", "particular", "message", "with", "peers", "that", "we", "have", "an", "active", "GossipSyncer", "with", ".", "We", "do", "this", "to", "ensure", "that", "we", "don", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L665-L669
129,737
lightningnetwork/lnd
discovery/gossiper.go
reset
func (d *deDupedAnnouncements) reset() { // Storage of each type of announcement (channel announcements, channel // updates, node announcements) is set to an empty map where the // appropriate key points to the corresponding lnwire.Message. d.channelAnnouncements = make(map[lnwire.ShortChannelID]msgWithSenders) d....
go
func (d *deDupedAnnouncements) reset() { // Storage of each type of announcement (channel announcements, channel // updates, node announcements) is set to an empty map where the // appropriate key points to the corresponding lnwire.Message. d.channelAnnouncements = make(map[lnwire.ShortChannelID]msgWithSenders) d....
[ "func", "(", "d", "*", "deDupedAnnouncements", ")", "reset", "(", ")", "{", "// Storage of each type of announcement (channel announcements, channel", "// updates, node announcements) is set to an empty map where the", "// appropriate key points to the corresponding lnwire.Message.", "d", ...
// reset is the private version of the Reset method. We have this so we can // call this method within method that are already holding the lock.
[ "reset", "is", "the", "private", "version", "of", "the", "Reset", "method", ".", "We", "have", "this", "so", "we", "can", "call", "this", "method", "within", "method", "that", "are", "already", "holding", "the", "lock", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L702-L709
129,738
lightningnetwork/lnd
discovery/gossiper.go
addMsg
func (d *deDupedAnnouncements) addMsg(message networkMsg) { // Depending on the message type (channel announcement, channel update, // or node announcement), the message is added to the corresponding map // in deDupedAnnouncements. Because each identifying key can have at // most one value, the announcements are de...
go
func (d *deDupedAnnouncements) addMsg(message networkMsg) { // Depending on the message type (channel announcement, channel update, // or node announcement), the message is added to the corresponding map // in deDupedAnnouncements. Because each identifying key can have at // most one value, the announcements are de...
[ "func", "(", "d", "*", "deDupedAnnouncements", ")", "addMsg", "(", "message", "networkMsg", ")", "{", "// Depending on the message type (channel announcement, channel update,", "// or node announcement), the message is added to the corresponding map", "// in deDupedAnnouncements. Because...
// addMsg adds a new message to the current batch. If the message is already // present in the current batch, then this new instance replaces the latter, // and the set of senders is updated to reflect which node sent us this // message.
[ "addMsg", "adds", "a", "new", "message", "to", "the", "current", "batch", ".", "If", "the", "message", "is", "already", "present", "in", "the", "current", "batch", "then", "this", "new", "instance", "replaces", "the", "latter", "and", "the", "set", "of", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L715-L832
129,739
lightningnetwork/lnd
discovery/gossiper.go
AddMsgs
func (d *deDupedAnnouncements) AddMsgs(msgs ...networkMsg) { d.Lock() defer d.Unlock() for _, msg := range msgs { d.addMsg(msg) } }
go
func (d *deDupedAnnouncements) AddMsgs(msgs ...networkMsg) { d.Lock() defer d.Unlock() for _, msg := range msgs { d.addMsg(msg) } }
[ "func", "(", "d", "*", "deDupedAnnouncements", ")", "AddMsgs", "(", "msgs", "...", "networkMsg", ")", "{", "d", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "msg", ":=", "range", "msgs", "{", "d", "...
// AddMsgs is a helper method to add multiple messages to the announcement // batch.
[ "AddMsgs", "is", "a", "helper", "method", "to", "add", "multiple", "messages", "to", "the", "announcement", "batch", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L836-L843
129,740
lightningnetwork/lnd
discovery/gossiper.go
Emit
func (d *deDupedAnnouncements) Emit() []msgWithSenders { d.Lock() defer d.Unlock() // Get the total number of announcements. numAnnouncements := len(d.channelAnnouncements) + len(d.channelUpdates) + len(d.nodeAnnouncements) // Create an empty array of lnwire.Messages with a length equal to // the total number...
go
func (d *deDupedAnnouncements) Emit() []msgWithSenders { d.Lock() defer d.Unlock() // Get the total number of announcements. numAnnouncements := len(d.channelAnnouncements) + len(d.channelUpdates) + len(d.nodeAnnouncements) // Create an empty array of lnwire.Messages with a length equal to // the total number...
[ "func", "(", "d", "*", "deDupedAnnouncements", ")", "Emit", "(", ")", "[", "]", "msgWithSenders", "{", "d", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "Unlock", "(", ")", "\n\n", "// Get the total number of announcements.", "numAnnouncements", ":=", "le...
// Emit returns the set of de-duplicated announcements to be sent out during // the next announcement epoch, in the order of channel announcements, channel // updates, and node announcements. Each message emitted, contains the set of // peers that sent us the message. This way, we can ensure that we don't waste // band...
[ "Emit", "returns", "the", "set", "of", "de", "-", "duplicated", "announcements", "to", "be", "sent", "out", "during", "the", "next", "announcement", "epoch", "in", "the", "order", "of", "channel", "announcements", "channel", "updates", "and", "node", "announce...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L851-L882
129,741
lightningnetwork/lnd
discovery/gossiper.go
isRecentlyRejectedMsg
func (d *AuthenticatedGossiper) isRecentlyRejectedMsg(msg lnwire.Message) bool { d.rejectMtx.RLock() defer d.rejectMtx.RUnlock() switch m := msg.(type) { case *lnwire.ChannelUpdate: _, ok := d.recentRejects[m.ShortChannelID.ToUint64()] return ok case *lnwire.ChannelAnnouncement: _, ok := d.recentRejects[m....
go
func (d *AuthenticatedGossiper) isRecentlyRejectedMsg(msg lnwire.Message) bool { d.rejectMtx.RLock() defer d.rejectMtx.RUnlock() switch m := msg.(type) { case *lnwire.ChannelUpdate: _, ok := d.recentRejects[m.ShortChannelID.ToUint64()] return ok case *lnwire.ChannelAnnouncement: _, ok := d.recentRejects[m....
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "isRecentlyRejectedMsg", "(", "msg", "lnwire", ".", "Message", ")", "bool", "{", "d", ".", "rejectMtx", ".", "RLock", "(", ")", "\n", "defer", "d", ".", "rejectMtx", ".", "RUnlock", "(", ")", "\n\n", ...
// isRecentlyRejectedMsg returns true if we recently rejected a message, and // false otherwise, This avoids expensive reprocessing of the message.
[ "isRecentlyRejectedMsg", "returns", "true", "if", "we", "recently", "rejected", "a", "message", "and", "false", "otherwise", "This", "avoids", "expensive", "reprocessing", "of", "the", "message", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L1147-L1163
129,742
lightningnetwork/lnd
discovery/gossiper.go
retransmitStaleChannels
func (d *AuthenticatedGossiper) retransmitStaleChannels() error { // Iterate over all of our channels and check if any of them fall // within the prune interval or re-broadcast interval. type updateTuple struct { info *channeldb.ChannelEdgeInfo edge *channeldb.ChannelEdgePolicy } var edgesToUpdate []updateTupl...
go
func (d *AuthenticatedGossiper) retransmitStaleChannels() error { // Iterate over all of our channels and check if any of them fall // within the prune interval or re-broadcast interval. type updateTuple struct { info *channeldb.ChannelEdgeInfo edge *channeldb.ChannelEdgePolicy } var edgesToUpdate []updateTupl...
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "retransmitStaleChannels", "(", ")", "error", "{", "// Iterate over all of our channels and check if any of them fall", "// within the prune interval or re-broadcast interval.", "type", "updateTuple", "struct", "{", "info", "*"...
// retransmitStaleChannels examines all outgoing channels that the source node // is known to maintain to check to see if any of them are "stale". A channel // is stale iff, the last timestamp of its rebroadcast is older then // broadcastInterval.
[ "retransmitStaleChannels", "examines", "all", "outgoing", "channels", "that", "the", "source", "node", "is", "known", "to", "maintain", "to", "check", "to", "see", "if", "any", "of", "them", "are", "stale", ".", "A", "channel", "is", "stale", "iff", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L1169-L1259
129,743
lightningnetwork/lnd
discovery/gossiper.go
processRejectedEdge
func (d *AuthenticatedGossiper) processRejectedEdge( chanAnnMsg *lnwire.ChannelAnnouncement, proof *channeldb.ChannelAuthProof) ([]networkMsg, error) { // First, we'll fetch the state of the channel as we know if from the // database. chanInfo, e1, e2, err := d.cfg.Router.GetChannelByID( chanAnnMsg.ShortChannel...
go
func (d *AuthenticatedGossiper) processRejectedEdge( chanAnnMsg *lnwire.ChannelAnnouncement, proof *channeldb.ChannelAuthProof) ([]networkMsg, error) { // First, we'll fetch the state of the channel as we know if from the // database. chanInfo, e1, e2, err := d.cfg.Router.GetChannelByID( chanAnnMsg.ShortChannel...
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "processRejectedEdge", "(", "chanAnnMsg", "*", "lnwire", ".", "ChannelAnnouncement", ",", "proof", "*", "channeldb", ".", "ChannelAuthProof", ")", "(", "[", "]", "networkMsg", ",", "error", ")", "{", "// Fir...
// processRejectedEdge examines a rejected edge to see if we can extract any // new announcements from it. An edge will get rejected if we already added // the same edge without AuthProof to the graph. If the received announcement // contains a proof, we can add this proof to our edge. We can end up in this // situat...
[ "processRejectedEdge", "examines", "a", "rejected", "edge", "to", "see", "if", "we", "can", "extract", "any", "new", "announcements", "from", "it", ".", "An", "edge", "will", "get", "rejected", "if", "we", "already", "added", "the", "same", "edge", "without"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L1375-L1452
129,744
lightningnetwork/lnd
discovery/gossiper.go
fetchNodeAnn
func (d *AuthenticatedGossiper) fetchNodeAnn( pubKey [33]byte) (*lnwire.NodeAnnouncement, error) { node, err := d.cfg.Router.FetchLightningNode(pubKey) if err != nil { return nil, err } return node.NodeAnnouncement(true) }
go
func (d *AuthenticatedGossiper) fetchNodeAnn( pubKey [33]byte) (*lnwire.NodeAnnouncement, error) { node, err := d.cfg.Router.FetchLightningNode(pubKey) if err != nil { return nil, err } return node.NodeAnnouncement(true) }
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "fetchNodeAnn", "(", "pubKey", "[", "33", "]", "byte", ")", "(", "*", "lnwire", ".", "NodeAnnouncement", ",", "error", ")", "{", "node", ",", "err", ":=", "d", ".", "cfg", ".", "Router", ".", "Fetc...
// fetchNodeAnn fetches the latest signed node announcement from our point of // view for the node with the given public key.
[ "fetchNodeAnn", "fetches", "the", "latest", "signed", "node", "announcement", "from", "our", "point", "of", "view", "for", "the", "node", "with", "the", "given", "public", "key", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L2355-L2364
129,745
lightningnetwork/lnd
discovery/gossiper.go
isMsgStale
func (d *AuthenticatedGossiper) isMsgStale(msg lnwire.Message) bool { switch msg := msg.(type) { case *lnwire.AnnounceSignatures: chanInfo, _, _, err := d.cfg.Router.GetChannelByID( msg.ShortChannelID, ) // If the channel cannot be found, it is most likely a leftover // message for a channel that was clos...
go
func (d *AuthenticatedGossiper) isMsgStale(msg lnwire.Message) bool { switch msg := msg.(type) { case *lnwire.AnnounceSignatures: chanInfo, _, _, err := d.cfg.Router.GetChannelByID( msg.ShortChannelID, ) // If the channel cannot be found, it is most likely a leftover // message for a channel that was clos...
[ "func", "(", "d", "*", "AuthenticatedGossiper", ")", "isMsgStale", "(", "msg", "lnwire", ".", "Message", ")", "bool", "{", "switch", "msg", ":=", "msg", ".", "(", "type", ")", "{", "case", "*", "lnwire", ".", "AnnounceSignatures", ":", "chanInfo", ",", ...
// isMsgStale determines whether a message retrieved from the backing // MessageStore is seen as stale by the current graph.
[ "isMsgStale", "determines", "whether", "a", "message", "retrieved", "from", "the", "backing", "MessageStore", "is", "seen", "as", "stale", "by", "the", "current", "graph", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/gossiper.go#L2368-L2431
129,746
lightningnetwork/lnd
brontide/listener.go
NewListener
func NewListener(localStatic *btcec.PrivateKey, listenAddr string) (*Listener, error) { addr, err := net.ResolveTCPAddr("tcp", listenAddr) if err != nil { return nil, err } l, err := net.ListenTCP("tcp", addr) if err != nil { return nil, err } brontideListener := &Listener{ localStatic: localStatic, ...
go
func NewListener(localStatic *btcec.PrivateKey, listenAddr string) (*Listener, error) { addr, err := net.ResolveTCPAddr("tcp", listenAddr) if err != nil { return nil, err } l, err := net.ListenTCP("tcp", addr) if err != nil { return nil, err } brontideListener := &Listener{ localStatic: localStatic, ...
[ "func", "NewListener", "(", "localStatic", "*", "btcec", ".", "PrivateKey", ",", "listenAddr", "string", ")", "(", "*", "Listener", ",", "error", ")", "{", "addr", ",", "err", ":=", "net", ".", "ResolveTCPAddr", "(", "\"", "\"", ",", "listenAddr", ")", ...
// NewListener returns a new net.Listener which enforces the Brontide scheme // during both initial connection establishment and data transfer.
[ "NewListener", "returns", "a", "new", "net", ".", "Listener", "which", "enforces", "the", "Brontide", "scheme", "during", "both", "initial", "connection", "establishment", "and", "data", "transfer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L37-L64
129,747
lightningnetwork/lnd
brontide/listener.go
rejectedConnErr
func rejectedConnErr(err error, remoteAddr string) error { return fmt.Errorf("unable to accept connection from %v: %v", remoteAddr, err) }
go
func rejectedConnErr(err error, remoteAddr string) error { return fmt.Errorf("unable to accept connection from %v: %v", remoteAddr, err) }
[ "func", "rejectedConnErr", "(", "err", "error", ",", "remoteAddr", "string", ")", "error", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "remoteAddr", ",", "err", ")", "\n", "}" ]
// rejectedConnErr is a helper function that prepends the remote address of the // failed connection attempt to the original error message.
[ "rejectedConnErr", "is", "a", "helper", "function", "that", "prepends", "the", "remote", "address", "of", "the", "failed", "connection", "attempt", "to", "the", "original", "error", "message", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L92-L95
129,748
lightningnetwork/lnd
brontide/listener.go
doHandshake
func (l *Listener) doHandshake(conn net.Conn) { defer func() { l.handshakeSema <- struct{}{} }() select { case <-l.quit: return default: } remoteAddr := conn.RemoteAddr().String() brontideConn := &Conn{ conn: conn, noise: NewBrontideMachine(false, l.localStatic, nil), } // We'll ensure that we get A...
go
func (l *Listener) doHandshake(conn net.Conn) { defer func() { l.handshakeSema <- struct{}{} }() select { case <-l.quit: return default: } remoteAddr := conn.RemoteAddr().String() brontideConn := &Conn{ conn: conn, noise: NewBrontideMachine(false, l.localStatic, nil), } // We'll ensure that we get A...
[ "func", "(", "l", "*", "Listener", ")", "doHandshake", "(", "conn", "net", ".", "Conn", ")", "{", "defer", "func", "(", ")", "{", "l", ".", "handshakeSema", "<-", "struct", "{", "}", "{", "}", "}", "(", ")", "\n\n", "select", "{", "case", "<-", ...
// doHandshake asynchronously performs the brontide handshake, so that it does // not block the main accept loop. This prevents peers that delay writing to the // connection from block other connection attempts.
[ "doHandshake", "asynchronously", "performs", "the", "brontide", "handshake", "so", "that", "it", "does", "not", "block", "the", "main", "accept", "loop", ".", "This", "prevents", "peers", "that", "delay", "writing", "to", "the", "connection", "from", "block", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L100-L196
129,749
lightningnetwork/lnd
brontide/listener.go
acceptConn
func (l *Listener) acceptConn(conn *Conn) { select { case l.conns <- maybeConn{conn: conn}: case <-l.quit: } }
go
func (l *Listener) acceptConn(conn *Conn) { select { case l.conns <- maybeConn{conn: conn}: case <-l.quit: } }
[ "func", "(", "l", "*", "Listener", ")", "acceptConn", "(", "conn", "*", "Conn", ")", "{", "select", "{", "case", "l", ".", "conns", "<-", "maybeConn", "{", "conn", ":", "conn", "}", ":", "case", "<-", "l", ".", "quit", ":", "}", "\n", "}" ]
// acceptConn returns a connection that successfully performed a handshake.
[ "acceptConn", "returns", "a", "connection", "that", "successfully", "performed", "a", "handshake", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L206-L211
129,750
lightningnetwork/lnd
brontide/listener.go
rejectConn
func (l *Listener) rejectConn(err error) { select { case l.conns <- maybeConn{err: err}: case <-l.quit: } }
go
func (l *Listener) rejectConn(err error) { select { case l.conns <- maybeConn{err: err}: case <-l.quit: } }
[ "func", "(", "l", "*", "Listener", ")", "rejectConn", "(", "err", "error", ")", "{", "select", "{", "case", "l", ".", "conns", "<-", "maybeConn", "{", "err", ":", "err", "}", ":", "case", "<-", "l", ".", "quit", ":", "}", "\n", "}" ]
// rejectConn returns any errors encountered during connection or handshake.
[ "rejectConn", "returns", "any", "errors", "encountered", "during", "connection", "or", "handshake", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L214-L219
129,751
lightningnetwork/lnd
brontide/listener.go
Accept
func (l *Listener) Accept() (net.Conn, error) { select { case result := <-l.conns: return result.conn, result.err case <-l.quit: return nil, errors.New("brontide connection closed") } }
go
func (l *Listener) Accept() (net.Conn, error) { select { case result := <-l.conns: return result.conn, result.err case <-l.quit: return nil, errors.New("brontide connection closed") } }
[ "func", "(", "l", "*", "Listener", ")", "Accept", "(", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "select", "{", "case", "result", ":=", "<-", "l", ".", "conns", ":", "return", "result", ".", "conn", ",", "result", ".", "err", "\n", ...
// Accept waits for and returns the next connection to the listener. All // incoming connections are authenticated via the three act Brontide // key-exchange scheme. This function will fail with a non-nil error in the // case that either the handshake breaks down, or the remote peer doesn't know // our static public ke...
[ "Accept", "waits", "for", "and", "returns", "the", "next", "connection", "to", "the", "listener", ".", "All", "incoming", "connections", "are", "authenticated", "via", "the", "three", "act", "Brontide", "key", "-", "exchange", "scheme", ".", "This", "function"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L228-L235
129,752
lightningnetwork/lnd
brontide/listener.go
Close
func (l *Listener) Close() error { select { case <-l.quit: default: close(l.quit) } return l.tcp.Close() }
go
func (l *Listener) Close() error { select { case <-l.quit: default: close(l.quit) } return l.tcp.Close() }
[ "func", "(", "l", "*", "Listener", ")", "Close", "(", ")", "error", "{", "select", "{", "case", "<-", "l", ".", "quit", ":", "default", ":", "close", "(", "l", ".", "quit", ")", "\n", "}", "\n\n", "return", "l", ".", "tcp", ".", "Close", "(", ...
// Close closes the listener. Any blocked Accept operations will be unblocked // and return errors. // // Part of the net.Listener interface.
[ "Close", "closes", "the", "listener", ".", "Any", "blocked", "Accept", "operations", "will", "be", "unblocked", "and", "return", "errors", ".", "Part", "of", "the", "net", ".", "Listener", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/brontide/listener.go#L241-L249
129,753
lightningnetwork/lnd
lnwallet/btcwallet/signer.go
FetchInputInfo
func (b *BtcWallet) FetchInputInfo(prevOut *wire.OutPoint) (*wire.TxOut, error) { var ( err error output *wire.TxOut ) // First check to see if the output is already within the utxo cache. // If so we can return directly saving a disk access. b.cacheMtx.RLock() if output, ok := b.utxoCache[*prevOut]; ok {...
go
func (b *BtcWallet) FetchInputInfo(prevOut *wire.OutPoint) (*wire.TxOut, error) { var ( err error output *wire.TxOut ) // First check to see if the output is already within the utxo cache. // If so we can return directly saving a disk access. b.cacheMtx.RLock() if output, ok := b.utxoCache[*prevOut]; ok {...
[ "func", "(", "b", "*", "BtcWallet", ")", "FetchInputInfo", "(", "prevOut", "*", "wire", ".", "OutPoint", ")", "(", "*", "wire", ".", "TxOut", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "output", "*", "wire", ".", "TxOut", "\n", ")", ...
// FetchInputInfo queries for the WalletController's knowledge of the passed // outpoint. If the base wallet determines this output is under its control, // then the original txout should be returned. Otherwise, a non-nil error value // of ErrNotMine should be returned instead. // // This is a part of the WalletControl...
[ "FetchInputInfo", "queries", "for", "the", "WalletController", "s", "knowledge", "of", "the", "passed", "outpoint", ".", "If", "the", "base", "wallet", "determines", "this", "output", "is", "under", "its", "control", "then", "the", "original", "txout", "should",...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/signer.go#L24-L62
129,754
lightningnetwork/lnd
lnwallet/btcwallet/signer.go
fetchOutputAddr
func (b *BtcWallet) fetchOutputAddr(script []byte) (waddrmgr.ManagedAddress, error) { _, addrs, _, err := txscript.ExtractPkScriptAddrs(script, b.netParams) if err != nil { return nil, err } // If the case of a multi-sig output, several address may be extracted. // Therefore, we simply select the key for the fi...
go
func (b *BtcWallet) fetchOutputAddr(script []byte) (waddrmgr.ManagedAddress, error) { _, addrs, _, err := txscript.ExtractPkScriptAddrs(script, b.netParams) if err != nil { return nil, err } // If the case of a multi-sig output, several address may be extracted. // Therefore, we simply select the key for the fi...
[ "func", "(", "b", "*", "BtcWallet", ")", "fetchOutputAddr", "(", "script", "[", "]", "byte", ")", "(", "waddrmgr", ".", "ManagedAddress", ",", "error", ")", "{", "_", ",", "addrs", ",", "_", ",", "err", ":=", "txscript", ".", "ExtractPkScriptAddrs", "(...
// fetchOutputAddr attempts to fetch the managed address corresponding to the // passed output script. This function is used to look up the proper key which // should be used to sign a specified input.
[ "fetchOutputAddr", "attempts", "to", "fetch", "the", "managed", "address", "corresponding", "to", "the", "passed", "output", "script", ".", "This", "function", "is", "used", "to", "look", "up", "the", "proper", "key", "which", "should", "be", "used", "to", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/signer.go#L67-L84
129,755
lightningnetwork/lnd
lnwallet/btcwallet/signer.go
maybeTweakPrivKey
func maybeTweakPrivKey(signDesc *input.SignDescriptor, privKey *btcec.PrivateKey) (*btcec.PrivateKey, error) { var retPriv *btcec.PrivateKey switch { case signDesc.SingleTweak != nil: retPriv = input.TweakPrivKey(privKey, signDesc.SingleTweak) case signDesc.DoubleTweak != nil: retPriv = input.DeriveRevoc...
go
func maybeTweakPrivKey(signDesc *input.SignDescriptor, privKey *btcec.PrivateKey) (*btcec.PrivateKey, error) { var retPriv *btcec.PrivateKey switch { case signDesc.SingleTweak != nil: retPriv = input.TweakPrivKey(privKey, signDesc.SingleTweak) case signDesc.DoubleTweak != nil: retPriv = input.DeriveRevoc...
[ "func", "maybeTweakPrivKey", "(", "signDesc", "*", "input", ".", "SignDescriptor", ",", "privKey", "*", "btcec", ".", "PrivateKey", ")", "(", "*", "btcec", ".", "PrivateKey", ",", "error", ")", "{", "var", "retPriv", "*", "btcec", ".", "PrivateKey", "\n", ...
// maybeTweakPrivKey examines the single and double tweak parameters on the // passed sign descriptor and may perform a mapping on the passed private key // in order to utilize the tweaks, if populated.
[ "maybeTweakPrivKey", "examines", "the", "single", "and", "double", "tweak", "parameters", "on", "the", "passed", "sign", "descriptor", "and", "may", "perform", "a", "mapping", "on", "the", "passed", "private", "key", "in", "order", "to", "utilize", "the", "twe...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/signer.go#L136-L155
129,756
lightningnetwork/lnd
lnwallet/btcwallet/signer.go
SignOutputRaw
func (b *BtcWallet) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) ([]byte, error) { witnessScript := signDesc.WitnessScript // First attempt to fetch the private key which corresponds to the // specified public key. privKey, err := b.fetchPrivKey(&signDesc.KeyDesc) if err != nil { return nil, ...
go
func (b *BtcWallet) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) ([]byte, error) { witnessScript := signDesc.WitnessScript // First attempt to fetch the private key which corresponds to the // specified public key. privKey, err := b.fetchPrivKey(&signDesc.KeyDesc) if err != nil { return nil, ...
[ "func", "(", "b", "*", "BtcWallet", ")", "SignOutputRaw", "(", "tx", "*", "wire", ".", "MsgTx", ",", "signDesc", "*", "input", ".", "SignDescriptor", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "witnessScript", ":=", "signDesc", ".", "WitnessSc...
// SignOutputRaw generates a signature for the passed transaction according to // the data within the passed SignDescriptor. // // This is a part of the WalletController interface.
[ "SignOutputRaw", "generates", "a", "signature", "for", "the", "passed", "transaction", "according", "to", "the", "data", "within", "the", "passed", "SignDescriptor", ".", "This", "is", "a", "part", "of", "the", "WalletController", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/signer.go#L161-L194
129,757
lightningnetwork/lnd
lnwallet/btcwallet/signer.go
ComputeInputScript
func (b *BtcWallet) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error) { outputScript := signDesc.Output.PkScript walletAddr, err := b.fetchOutputAddr(outputScript) if err != nil { return nil, err } pka := walletAddr.(waddrmgr.ManagedPubKeyAddress) privKey, err := pka.P...
go
func (b *BtcWallet) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error) { outputScript := signDesc.Output.PkScript walletAddr, err := b.fetchOutputAddr(outputScript) if err != nil { return nil, err } pka := walletAddr.(waddrmgr.ManagedPubKeyAddress) privKey, err := pka.P...
[ "func", "(", "b", "*", "BtcWallet", ")", "ComputeInputScript", "(", "tx", "*", "wire", ".", "MsgTx", ",", "signDesc", "*", "input", ".", "SignDescriptor", ")", "(", "*", "input", ".", "Script", ",", "error", ")", "{", "outputScript", ":=", "signDesc", ...
// ComputeInputScript generates a complete InputScript for the passed // transaction with the signature as defined within the passed SignDescriptor. // This method is capable of generating the proper input script for both // regular p2wkh output and p2wkh outputs nested within a regular p2sh output. // // This is a par...
[ "ComputeInputScript", "generates", "a", "complete", "InputScript", "for", "the", "passed", "transaction", "with", "the", "signature", "as", "defined", "within", "the", "passed", "SignDescriptor", ".", "This", "method", "is", "capable", "of", "generating", "the", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/signer.go#L202-L282
129,758
lightningnetwork/lnd
shachain/producer.go
NewRevocationProducer
func NewRevocationProducer(root chainhash.Hash) *RevocationProducer { return &RevocationProducer{ root: &element{ index: rootIndex, hash: root, }} }
go
func NewRevocationProducer(root chainhash.Hash) *RevocationProducer { return &RevocationProducer{ root: &element{ index: rootIndex, hash: root, }} }
[ "func", "NewRevocationProducer", "(", "root", "chainhash", ".", "Hash", ")", "*", "RevocationProducer", "{", "return", "&", "RevocationProducer", "{", "root", ":", "&", "element", "{", "index", ":", "rootIndex", ",", "hash", ":", "root", ",", "}", "}", "\n...
// NewRevocationProducer creates new instance of shachain producer.
[ "NewRevocationProducer", "creates", "new", "instance", "of", "shachain", "producer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/producer.go#L43-L49
129,759
lightningnetwork/lnd
shachain/producer.go
NewRevocationProducerFromBytes
func NewRevocationProducerFromBytes(data []byte) (*RevocationProducer, error) { root, err := chainhash.NewHash(data) if err != nil { return nil, err } return &RevocationProducer{ root: &element{ index: rootIndex, hash: *root, }, }, nil }
go
func NewRevocationProducerFromBytes(data []byte) (*RevocationProducer, error) { root, err := chainhash.NewHash(data) if err != nil { return nil, err } return &RevocationProducer{ root: &element{ index: rootIndex, hash: *root, }, }, nil }
[ "func", "NewRevocationProducerFromBytes", "(", "data", "[", "]", "byte", ")", "(", "*", "RevocationProducer", ",", "error", ")", "{", "root", ",", "err", ":=", "chainhash", ".", "NewHash", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// NewRevocationProducerFromBytes deserializes an instance of a // RevocationProducer encoded in the passed byte slice, returning a fully // initialized instance of a RevocationProducer.
[ "NewRevocationProducerFromBytes", "deserializes", "an", "instance", "of", "a", "RevocationProducer", "encoded", "in", "the", "passed", "byte", "slice", "returning", "a", "fully", "initialized", "instance", "of", "a", "RevocationProducer", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/producer.go#L54-L66
129,760
lightningnetwork/lnd
keychain/btcwallet.go
keyScope
func (b *BtcWalletKeyRing) keyScope() (*waddrmgr.ScopedKeyManager, error) { // If the scope has already been populated, then we'll return it // directly. if b.lightningScope != nil { return b.lightningScope, nil } // Otherwise, we'll first do a check to ensure that the root manager // isn't locked, as otherwis...
go
func (b *BtcWalletKeyRing) keyScope() (*waddrmgr.ScopedKeyManager, error) { // If the scope has already been populated, then we'll return it // directly. if b.lightningScope != nil { return b.lightningScope, nil } // Otherwise, we'll first do a check to ensure that the root manager // isn't locked, as otherwis...
[ "func", "(", "b", "*", "BtcWalletKeyRing", ")", "keyScope", "(", ")", "(", "*", "waddrmgr", ".", "ScopedKeyManager", ",", "error", ")", "{", "// If the scope has already been populated, then we'll return it", "// directly.", "if", "b", ".", "lightningScope", "!=", "...
// keyScope attempts to return the key scope that we'll use to derive all of // our keys. If the scope has already been fetched from the database, then a // cached version will be returned. Otherwise, we'll fetch it from the database // and cache it for subsequent accesses.
[ "keyScope", "attempts", "to", "return", "the", "key", "scope", "that", "we", "ll", "use", "to", "derive", "all", "of", "our", "keys", ".", "If", "the", "scope", "has", "already", "been", "fetched", "from", "the", "database", "then", "a", "cached", "versi...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/keychain/btcwallet.go#L86-L110
129,761
lightningnetwork/lnd
keychain/btcwallet.go
createAccountIfNotExists
func (b *BtcWalletKeyRing) createAccountIfNotExists( addrmgrNs walletdb.ReadWriteBucket, keyFam KeyFamily, scope *waddrmgr.ScopedKeyManager) error { // If this is the multi-sig key family, then we can return early as // this is the default account that's created. if keyFam == KeyFamilyMultiSig { return nil } ...
go
func (b *BtcWalletKeyRing) createAccountIfNotExists( addrmgrNs walletdb.ReadWriteBucket, keyFam KeyFamily, scope *waddrmgr.ScopedKeyManager) error { // If this is the multi-sig key family, then we can return early as // this is the default account that's created. if keyFam == KeyFamilyMultiSig { return nil } ...
[ "func", "(", "b", "*", "BtcWalletKeyRing", ")", "createAccountIfNotExists", "(", "addrmgrNs", "walletdb", ".", "ReadWriteBucket", ",", "keyFam", "KeyFamily", ",", "scope", "*", "waddrmgr", ".", "ScopedKeyManager", ")", "error", "{", "// If this is the multi-sig key fa...
// createAccountIfNotExists will create the corresponding account for a key // family if it doesn't already exist in the database.
[ "createAccountIfNotExists", "will", "create", "the", "corresponding", "account", "for", "a", "key", "family", "if", "it", "doesn", "t", "already", "exist", "in", "the", "database", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/keychain/btcwallet.go#L114-L134
129,762
lightningnetwork/lnd
watchtower/wtmock/client_db.go
NewClientDB
func NewClientDB() *ClientDB { return &ClientDB{ sweepPkScripts: make(map[lnwire.ChannelID][]byte), activeSessions: make(map[wtdb.SessionID]*wtdb.ClientSession), towerIndex: make(map[towerPK]uint64), towers: make(map[uint64]*wtdb.Tower), indexes: make(map[uint64]uint32), } }
go
func NewClientDB() *ClientDB { return &ClientDB{ sweepPkScripts: make(map[lnwire.ChannelID][]byte), activeSessions: make(map[wtdb.SessionID]*wtdb.ClientSession), towerIndex: make(map[towerPK]uint64), towers: make(map[uint64]*wtdb.Tower), indexes: make(map[uint64]uint32), } }
[ "func", "NewClientDB", "(", ")", "*", "ClientDB", "{", "return", "&", "ClientDB", "{", "sweepPkScripts", ":", "make", "(", "map", "[", "lnwire", ".", "ChannelID", "]", "[", "]", "byte", ")", ",", "activeSessions", ":", "make", "(", "map", "[", "wtdb", ...
// NewClientDB initializes a new mock ClientDB.
[ "NewClientDB", "initializes", "a", "new", "mock", "ClientDB", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L31-L39
129,763
lightningnetwork/lnd
watchtower/wtmock/client_db.go
CreateTower
func (m *ClientDB) CreateTower(lnAddr *lnwire.NetAddress) (*wtdb.Tower, error) { m.mu.Lock() defer m.mu.Unlock() var towerPubKey towerPK copy(towerPubKey[:], lnAddr.IdentityKey.SerializeCompressed()) var tower *wtdb.Tower towerID, ok := m.towerIndex[towerPubKey] if ok { tower = m.towers[towerID] tower.AddA...
go
func (m *ClientDB) CreateTower(lnAddr *lnwire.NetAddress) (*wtdb.Tower, error) { m.mu.Lock() defer m.mu.Unlock() var towerPubKey towerPK copy(towerPubKey[:], lnAddr.IdentityKey.SerializeCompressed()) var tower *wtdb.Tower towerID, ok := m.towerIndex[towerPubKey] if ok { tower = m.towers[towerID] tower.AddA...
[ "func", "(", "m", "*", "ClientDB", ")", "CreateTower", "(", "lnAddr", "*", "lnwire", ".", "NetAddress", ")", "(", "*", "wtdb", ".", "Tower", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unl...
// CreateTower initializes a database entry with the given lightning address. If // the tower exists, the address is append to the list of all addresses used to // that tower previously.
[ "CreateTower", "initializes", "a", "database", "entry", "with", "the", "given", "lightning", "address", ".", "If", "the", "tower", "exists", "the", "address", "is", "append", "to", "the", "list", "of", "all", "addresses", "used", "to", "that", "tower", "prev...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L44-L69
129,764
lightningnetwork/lnd
watchtower/wtmock/client_db.go
LoadTower
func (m *ClientDB) LoadTower(towerID uint64) (*wtdb.Tower, error) { m.mu.Lock() defer m.mu.Unlock() if tower, ok := m.towers[towerID]; ok { return tower, nil } return nil, wtdb.ErrTowerNotFound }
go
func (m *ClientDB) LoadTower(towerID uint64) (*wtdb.Tower, error) { m.mu.Lock() defer m.mu.Unlock() if tower, ok := m.towers[towerID]; ok { return tower, nil } return nil, wtdb.ErrTowerNotFound }
[ "func", "(", "m", "*", "ClientDB", ")", "LoadTower", "(", "towerID", "uint64", ")", "(", "*", "wtdb", ".", "Tower", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", ...
// LoadTower retrieves a tower by its tower ID.
[ "LoadTower", "retrieves", "a", "tower", "by", "its", "tower", "ID", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L72-L81
129,765
lightningnetwork/lnd
watchtower/wtmock/client_db.go
MarkBackupIneligible
func (m *ClientDB) MarkBackupIneligible(chanID lnwire.ChannelID, commitHeight uint64) error { return nil }
go
func (m *ClientDB) MarkBackupIneligible(chanID lnwire.ChannelID, commitHeight uint64) error { return nil }
[ "func", "(", "m", "*", "ClientDB", ")", "MarkBackupIneligible", "(", "chanID", "lnwire", ".", "ChannelID", ",", "commitHeight", "uint64", ")", "error", "{", "return", "nil", "\n", "}" ]
// MarkBackupIneligible records that particular commit height is ineligible for // backup. This allows the client to track which updates it should not attempt // to retry after startup.
[ "MarkBackupIneligible", "records", "that", "particular", "commit", "height", "is", "ineligible", "for", "backup", ".", "This", "allows", "the", "client", "to", "track", "which", "updates", "it", "should", "not", "attempt", "to", "retry", "after", "startup", "." ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L86-L88
129,766
lightningnetwork/lnd
watchtower/wtmock/client_db.go
ListClientSessions
func (m *ClientDB) ListClientSessions() (map[wtdb.SessionID]*wtdb.ClientSession, error) { m.mu.Lock() defer m.mu.Unlock() sessions := make(map[wtdb.SessionID]*wtdb.ClientSession) for _, session := range m.activeSessions { sessions[session.ID] = session } return sessions, nil }
go
func (m *ClientDB) ListClientSessions() (map[wtdb.SessionID]*wtdb.ClientSession, error) { m.mu.Lock() defer m.mu.Unlock() sessions := make(map[wtdb.SessionID]*wtdb.ClientSession) for _, session := range m.activeSessions { sessions[session.ID] = session } return sessions, nil }
[ "func", "(", "m", "*", "ClientDB", ")", "ListClientSessions", "(", ")", "(", "map", "[", "wtdb", ".", "SessionID", "]", "*", "wtdb", ".", "ClientSession", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu...
// ListClientSessions returns the set of all client sessions known to the db.
[ "ListClientSessions", "returns", "the", "set", "of", "all", "client", "sessions", "known", "to", "the", "db", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L91-L101
129,767
lightningnetwork/lnd
watchtower/wtmock/client_db.go
CreateClientSession
func (m *ClientDB) CreateClientSession(session *wtdb.ClientSession) error { m.mu.Lock() defer m.mu.Unlock() // Ensure that a session key index has been reserved for this tower. keyIndex, ok := m.indexes[session.TowerID] if !ok { return wtdb.ErrNoReservedKeyIndex } // Ensure that the session's index matches t...
go
func (m *ClientDB) CreateClientSession(session *wtdb.ClientSession) error { m.mu.Lock() defer m.mu.Unlock() // Ensure that a session key index has been reserved for this tower. keyIndex, ok := m.indexes[session.TowerID] if !ok { return wtdb.ErrNoReservedKeyIndex } // Ensure that the session's index matches t...
[ "func", "(", "m", "*", "ClientDB", ")", "CreateClientSession", "(", "session", "*", "wtdb", ".", "ClientSession", ")", "error", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "// Ensure tha...
// CreateClientSession records a newly negotiated client session in the set of // active sessions. The session can be identified by its SessionID.
[ "CreateClientSession", "records", "a", "newly", "negotiated", "client", "session", "in", "the", "set", "of", "active", "sessions", ".", "The", "session", "can", "be", "identified", "by", "its", "SessionID", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L105-L137
129,768
lightningnetwork/lnd
watchtower/wtmock/client_db.go
NextSessionKeyIndex
func (m *ClientDB) NextSessionKeyIndex(towerID uint64) (uint32, error) { m.mu.Lock() defer m.mu.Unlock() if index, ok := m.indexes[towerID]; ok { return index, nil } index := m.nextIndex m.indexes[towerID] = index m.nextIndex++ return index, nil }
go
func (m *ClientDB) NextSessionKeyIndex(towerID uint64) (uint32, error) { m.mu.Lock() defer m.mu.Unlock() if index, ok := m.indexes[towerID]; ok { return index, nil } index := m.nextIndex m.indexes[towerID] = index m.nextIndex++ return index, nil }
[ "func", "(", "m", "*", "ClientDB", ")", "NextSessionKeyIndex", "(", "towerID", "uint64", ")", "(", "uint32", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "ind...
// NextSessionKeyIndex reserves a new session key derivation index for a // particular tower id. The index is reserved for that tower until // CreateClientSession is invoked for that tower and index, at which point a new // index for that tower can be reserved. Multiple calls to this method before // CreateClientSessio...
[ "NextSessionKeyIndex", "reserves", "a", "new", "session", "key", "derivation", "index", "for", "a", "particular", "tower", "id", ".", "The", "index", "is", "reserved", "for", "that", "tower", "until", "CreateClientSession", "is", "invoked", "for", "that", "tower...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L144-L158
129,769
lightningnetwork/lnd
watchtower/wtmock/client_db.go
FetchChanPkScripts
func (m *ClientDB) FetchChanPkScripts() (map[lnwire.ChannelID][]byte, error) { m.mu.Lock() defer m.mu.Unlock() sweepPkScripts := make(map[lnwire.ChannelID][]byte) for chanID, pkScript := range m.sweepPkScripts { sweepPkScripts[chanID] = cloneBytes(pkScript) } return sweepPkScripts, nil }
go
func (m *ClientDB) FetchChanPkScripts() (map[lnwire.ChannelID][]byte, error) { m.mu.Lock() defer m.mu.Unlock() sweepPkScripts := make(map[lnwire.ChannelID][]byte) for chanID, pkScript := range m.sweepPkScripts { sweepPkScripts[chanID] = cloneBytes(pkScript) } return sweepPkScripts, nil }
[ "func", "(", "m", "*", "ClientDB", ")", "FetchChanPkScripts", "(", ")", "(", "map", "[", "lnwire", ".", "ChannelID", "]", "[", "]", "byte", ",", "error", ")", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlo...
// FetchChanPkScripts returns the set of sweep pkscripts known for all channels. // This allows the client to cache them in memory on startup.
[ "FetchChanPkScripts", "returns", "the", "set", "of", "sweep", "pkscripts", "known", "for", "all", "channels", ".", "This", "allows", "the", "client", "to", "cache", "them", "in", "memory", "on", "startup", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L243-L253
129,770
lightningnetwork/lnd
watchtower/wtmock/client_db.go
AddChanPkScript
func (m *ClientDB) AddChanPkScript(chanID lnwire.ChannelID, pkScript []byte) error { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.sweepPkScripts[chanID]; ok { return fmt.Errorf("pkscript for %x already exists", pkScript) } m.sweepPkScripts[chanID] = cloneBytes(pkScript) return nil }
go
func (m *ClientDB) AddChanPkScript(chanID lnwire.ChannelID, pkScript []byte) error { m.mu.Lock() defer m.mu.Unlock() if _, ok := m.sweepPkScripts[chanID]; ok { return fmt.Errorf("pkscript for %x already exists", pkScript) } m.sweepPkScripts[chanID] = cloneBytes(pkScript) return nil }
[ "func", "(", "m", "*", "ClientDB", ")", "AddChanPkScript", "(", "chanID", "lnwire", ".", "ChannelID", ",", "pkScript", "[", "]", "byte", ")", "error", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mu", ".", "Unlock", "(", ...
// AddChanPkScript sets a pkscript or sweeping funds from the channel or chanID.
[ "AddChanPkScript", "sets", "a", "pkscript", "or", "sweeping", "funds", "from", "the", "channel", "or", "chanID", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtmock/client_db.go#L256-L267
129,771
lightningnetwork/lnd
chanbackup/backupfile.go
NewMultiFile
func NewMultiFile(fileName string) *MultiFile { // We'll our temporary backup file in the very same directory as the // main backup file. backupFileDir := filepath.Dir(fileName) tempFileName := filepath.Join( backupFileDir, DefaultTempBackupFileName, ) return &MultiFile{ fileName: fileName, tempFileNa...
go
func NewMultiFile(fileName string) *MultiFile { // We'll our temporary backup file in the very same directory as the // main backup file. backupFileDir := filepath.Dir(fileName) tempFileName := filepath.Join( backupFileDir, DefaultTempBackupFileName, ) return &MultiFile{ fileName: fileName, tempFileNa...
[ "func", "NewMultiFile", "(", "fileName", "string", ")", "*", "MultiFile", "{", "// We'll our temporary backup file in the very same directory as the", "// main backup file.", "backupFileDir", ":=", "filepath", ".", "Dir", "(", "fileName", ")", "\n", "tempFileName", ":=", ...
// NewMultiFile create a new multi-file instance at the target location on the // file system.
[ "NewMultiFile", "create", "a", "new", "multi", "-", "file", "instance", "at", "the", "target", "location", "on", "the", "file", "system", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/backupfile.go#L55-L68
129,772
lightningnetwork/lnd
chanbackup/backupfile.go
ExtractMulti
func (b *MultiFile) ExtractMulti(keyChain keychain.KeyRing) (*Multi, error) { var err error // If the backup file isn't already set, then we'll attempt to open it // anew. if b.mainFile == nil { // We'll return an error if the main file isn't currently set. if b.fileName == "" { return nil, ErrNoBackupFileE...
go
func (b *MultiFile) ExtractMulti(keyChain keychain.KeyRing) (*Multi, error) { var err error // If the backup file isn't already set, then we'll attempt to open it // anew. if b.mainFile == nil { // We'll return an error if the main file isn't currently set. if b.fileName == "" { return nil, ErrNoBackupFileE...
[ "func", "(", "b", "*", "MultiFile", ")", "ExtractMulti", "(", "keyChain", "keychain", ".", "KeyRing", ")", "(", "*", "Multi", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// If the backup file isn't already set, then we'll attempt to open it", "// anew.",...
// ExtractMulti attempts to extract the packed multi backup we currently point // to into an unpacked version. This method will fail if no backup file // currently exists as the specified location.
[ "ExtractMulti", "attempts", "to", "extract", "the", "packed", "multi", "backup", "we", "currently", "point", "to", "into", "an", "unpacked", "version", ".", "This", "method", "will", "fail", "if", "no", "backup", "file", "currently", "exists", "as", "the", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chanbackup/backupfile.go#L125-L162
129,773
lightningnetwork/lnd
htlcswitch/hodl/flags.go
String
func (f Flag) String() string { switch f { case ExitSettle: return "ExitSettle" case AddIncoming: return "AddIncoming" case SettleIncoming: return "SettleIncoming" case FailIncoming: return "FailIncoming" case AddOutgoing: return "AddOutgoing" case SettleOutgoing: return "SettleOutgoing" case FailOu...
go
func (f Flag) String() string { switch f { case ExitSettle: return "ExitSettle" case AddIncoming: return "AddIncoming" case SettleIncoming: return "SettleIncoming" case FailIncoming: return "FailIncoming" case AddOutgoing: return "AddOutgoing" case SettleOutgoing: return "SettleOutgoing" case FailOu...
[ "func", "(", "f", "Flag", ")", "String", "(", ")", "string", "{", "switch", "f", "{", "case", "ExitSettle", ":", "return", "\"", "\"", "\n", "case", "AddIncoming", ":", "return", "\"", "\"", "\n", "case", "SettleIncoming", ":", "return", "\"", "\"", ...
// String returns a human-readable identifier for a given Flag.
[ "String", "returns", "a", "human", "-", "readable", "identifier", "for", "a", "given", "Flag", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/hodl/flags.go#L61-L84
129,774
lightningnetwork/lnd
htlcswitch/hodl/flags.go
Warning
func (f Flag) Warning() string { var msg string switch f { case ExitSettle: msg = "will not attempt to settle ADD with sender" case AddIncoming: msg = "will not attempt to forward ADD to switch" case SettleIncoming: msg = "will not attempt to forward SETTLE to switch" case FailIncoming: msg = "will not at...
go
func (f Flag) Warning() string { var msg string switch f { case ExitSettle: msg = "will not attempt to settle ADD with sender" case AddIncoming: msg = "will not attempt to forward ADD to switch" case SettleIncoming: msg = "will not attempt to forward SETTLE to switch" case FailIncoming: msg = "will not at...
[ "func", "(", "f", "Flag", ")", "Warning", "(", ")", "string", "{", "var", "msg", "string", "\n", "switch", "f", "{", "case", "ExitSettle", ":", "msg", "=", "\"", "\"", "\n", "case", "AddIncoming", ":", "msg", "=", "\"", "\"", "\n", "case", "SettleI...
// Warning generates a warning message to log if a particular breakpoint is // triggered during execution.
[ "Warning", "generates", "a", "warning", "message", "to", "log", "if", "a", "particular", "breakpoint", "is", "triggered", "during", "execution", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/hodl/flags.go#L88-L114
129,775
lightningnetwork/lnd
chainntnfs/bitcoindnotify/driver.go
createNewNotifier
func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) { if len(args) != 4 { return nil, fmt.Errorf("incorrect number of arguments to "+ ".New(...), expected 4, instead passed %v", len(args)) } chainConn, ok := args[0].(*chain.BitcoindConn) if !ok { return nil, errors.New("first argum...
go
func createNewNotifier(args ...interface{}) (chainntnfs.ChainNotifier, error) { if len(args) != 4 { return nil, fmt.Errorf("incorrect number of arguments to "+ ".New(...), expected 4, instead passed %v", len(args)) } chainConn, ok := args[0].(*chain.BitcoindConn) if !ok { return nil, errors.New("first argum...
[ "func", "createNewNotifier", "(", "args", "...", "interface", "{", "}", ")", "(", "chainntnfs", ".", "ChainNotifier", ",", "error", ")", "{", "if", "len", "(", "args", ")", "!=", "4", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// createNewNotifier creates a new instance of the ChainNotifier interface // implemented by BitcoindNotifier.
[ "createNewNotifier", "creates", "a", "new", "instance", "of", "the", "ChainNotifier", "interface", "implemented", "by", "BitcoindNotifier", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/chainntnfs/bitcoindnotify/driver.go#L14-L45
129,776
lightningnetwork/lnd
lnrpc/walletrpc/driver.go
createNewSubServer
func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (lnrpc.SubServer, lnrpc.MacaroonPerms, error) { // We'll attempt to look up the config that we expect, according to our // subServerName name. If we can't find this, then we'll exit with an // error, as we're unable to properly initialize oursel...
go
func createNewSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (lnrpc.SubServer, lnrpc.MacaroonPerms, error) { // We'll attempt to look up the config that we expect, according to our // subServerName name. If we can't find this, then we'll exit with an // error, as we're unable to properly initialize oursel...
[ "func", "createNewSubServer", "(", "configRegistry", "lnrpc", ".", "SubServerConfigDispatcher", ")", "(", "lnrpc", ".", "SubServer", ",", "lnrpc", ".", "MacaroonPerms", ",", "error", ")", "{", "// We'll attempt to look up the config that we expect, according to our", "// su...
// createNewSubServer is a helper method that will create the new WalletKit RPC // sub server given the main config dispatcher method. If we're unable to find // the config that is meant for us in the config dispatcher, then we'll exit // with an error.
[ "createNewSubServer", "is", "a", "helper", "method", "that", "will", "create", "the", "new", "WalletKit", "RPC", "sub", "server", "given", "the", "main", "config", "dispatcher", "method", ".", "If", "we", "re", "unable", "to", "find", "the", "config", "that"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/walletrpc/driver.go#L15-L57
129,777
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
New
func New(cfg Config) (*BtcWallet, error) { // Ensure the wallet exists or create it when the create flag is set. netDir := NetworkDir(cfg.DataDir, cfg.NetParams) // Create the key scope for the coin type being managed by this wallet. chainKeyScope := waddrmgr.KeyScope{ Purpose: keychain.BIP0043Purpose, Coin: ...
go
func New(cfg Config) (*BtcWallet, error) { // Ensure the wallet exists or create it when the create flag is set. netDir := NetworkDir(cfg.DataDir, cfg.NetParams) // Create the key scope for the coin type being managed by this wallet. chainKeyScope := waddrmgr.KeyScope{ Purpose: keychain.BIP0043Purpose, Coin: ...
[ "func", "New", "(", "cfg", "Config", ")", "(", "*", "BtcWallet", ",", "error", ")", "{", "// Ensure the wallet exists or create it when the create flag is set.", "netDir", ":=", "NetworkDir", "(", "cfg", ".", "DataDir", ",", "cfg", ".", "NetParams", ")", "\n\n", ...
// New returns a new fully initialized instance of BtcWallet given a valid // configuration struct.
[ "New", "returns", "a", "new", "fully", "initialized", "instance", "of", "BtcWallet", "given", "a", "valid", "configuration", "struct", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L75-L134
129,778
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
BackEnd
func (b *BtcWallet) BackEnd() string { if b.chain != nil { return b.chain.BackEnd() } return "" }
go
func (b *BtcWallet) BackEnd() string { if b.chain != nil { return b.chain.BackEnd() } return "" }
[ "func", "(", "b", "*", "BtcWallet", ")", "BackEnd", "(", ")", "string", "{", "if", "b", ".", "chain", "!=", "nil", "{", "return", "b", ".", "chain", ".", "BackEnd", "(", ")", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
// BackEnd returns the underlying ChainService's name as a string. // // This is a part of the WalletController interface.
[ "BackEnd", "returns", "the", "underlying", "ChainService", "s", "name", "as", "a", "string", ".", "This", "is", "a", "part", "of", "the", "WalletController", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L139-L145
129,779
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
Start
func (b *BtcWallet) Start() error { // We'll start by unlocking the wallet and ensuring that the KeyScope: // (1017, 1) exists within the internal waddrmgr. We'll need this in // order to properly generate the keys required for signing various // contracts. if err := b.wallet.Unlock(b.cfg.PrivatePass, nil); err !=...
go
func (b *BtcWallet) Start() error { // We'll start by unlocking the wallet and ensuring that the KeyScope: // (1017, 1) exists within the internal waddrmgr. We'll need this in // order to properly generate the keys required for signing various // contracts. if err := b.wallet.Unlock(b.cfg.PrivatePass, nil); err !=...
[ "func", "(", "b", "*", "BtcWallet", ")", "Start", "(", ")", "error", "{", "// We'll start by unlocking the wallet and ensuring that the KeyScope:", "// (1017, 1) exists within the internal waddrmgr. We'll need this in", "// order to properly generate the keys required for signing various",...
// Start initializes the underlying rpc connection, the wallet itself, and // begins syncing to the current available blockchain state. // // This is a part of the WalletController interface.
[ "Start", "initializes", "the", "underlying", "rpc", "connection", "the", "wallet", "itself", "and", "begins", "syncing", "to", "the", "current", "available", "blockchain", "state", ".", "This", "is", "a", "part", "of", "the", "WalletController", "interface", "."...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L157-L197
129,780
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
Stop
func (b *BtcWallet) Stop() error { b.wallet.Stop() b.wallet.WaitForShutdown() b.chain.Stop() return nil }
go
func (b *BtcWallet) Stop() error { b.wallet.Stop() b.wallet.WaitForShutdown() b.chain.Stop() return nil }
[ "func", "(", "b", "*", "BtcWallet", ")", "Stop", "(", ")", "error", "{", "b", ".", "wallet", ".", "Stop", "(", ")", "\n\n", "b", ".", "wallet", ".", "WaitForShutdown", "(", ")", "\n\n", "b", ".", "chain", ".", "Stop", "(", ")", "\n\n", "return", ...
// Stop signals the wallet for shutdown. Shutdown may entail closing // any active sockets, database handles, stopping goroutines, etc. // // This is a part of the WalletController interface.
[ "Stop", "signals", "the", "wallet", "for", "shutdown", ".", "Shutdown", "may", "entail", "closing", "any", "active", "sockets", "database", "handles", "stopping", "goroutines", "etc", ".", "This", "is", "a", "part", "of", "the", "WalletController", "interface", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L203-L211
129,781
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
ConfirmedBalance
func (b *BtcWallet) ConfirmedBalance(confs int32) (btcutil.Amount, error) { var balance btcutil.Amount witnessOutputs, err := b.ListUnspentWitness(confs, math.MaxInt32) if err != nil { return 0, err } for _, witnessOutput := range witnessOutputs { balance += witnessOutput.Value } return balance, nil }
go
func (b *BtcWallet) ConfirmedBalance(confs int32) (btcutil.Amount, error) { var balance btcutil.Amount witnessOutputs, err := b.ListUnspentWitness(confs, math.MaxInt32) if err != nil { return 0, err } for _, witnessOutput := range witnessOutputs { balance += witnessOutput.Value } return balance, nil }
[ "func", "(", "b", "*", "BtcWallet", ")", "ConfirmedBalance", "(", "confs", "int32", ")", "(", "btcutil", ".", "Amount", ",", "error", ")", "{", "var", "balance", "btcutil", ".", "Amount", "\n\n", "witnessOutputs", ",", "err", ":=", "b", ".", "ListUnspent...
// ConfirmedBalance returns the sum of all the wallet's unspent outputs that // have at least confs confirmations. If confs is set to zero, then all unspent // outputs, including those currently in the mempool will be included in the // final sum. // // This is a part of the WalletController interface.
[ "ConfirmedBalance", "returns", "the", "sum", "of", "all", "the", "wallet", "s", "unspent", "outputs", "that", "have", "at", "least", "confs", "confirmations", ".", "If", "confs", "is", "set", "to", "zero", "then", "all", "unspent", "outputs", "including", "t...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L219-L232
129,782
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
NewAddress
func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool) (btcutil.Address, error) { var keyScope waddrmgr.KeyScope switch t { case lnwallet.WitnessPubKey: keyScope = waddrmgr.KeyScopeBIP0084 case lnwallet.NestedWitnessPubKey: keyScope = waddrmgr.KeyScopeBIP0049Plus default: return nil, fmt.Errorf...
go
func (b *BtcWallet) NewAddress(t lnwallet.AddressType, change bool) (btcutil.Address, error) { var keyScope waddrmgr.KeyScope switch t { case lnwallet.WitnessPubKey: keyScope = waddrmgr.KeyScopeBIP0084 case lnwallet.NestedWitnessPubKey: keyScope = waddrmgr.KeyScopeBIP0049Plus default: return nil, fmt.Errorf...
[ "func", "(", "b", "*", "BtcWallet", ")", "NewAddress", "(", "t", "lnwallet", ".", "AddressType", ",", "change", "bool", ")", "(", "btcutil", ".", "Address", ",", "error", ")", "{", "var", "keyScope", "waddrmgr", ".", "KeyScope", "\n\n", "switch", "t", ...
// NewAddress returns the next external or internal address for the wallet // dictated by the value of the `change` parameter. If change is true, then an // internal address will be returned, otherwise an external address should be // returned. // // This is a part of the WalletController interface.
[ "NewAddress", "returns", "the", "next", "external", "or", "internal", "address", "for", "the", "wallet", "dictated", "by", "the", "value", "of", "the", "change", "parameter", ".", "If", "change", "is", "true", "then", "an", "internal", "address", "will", "be...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L240-L257
129,783
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
IsOurAddress
func (b *BtcWallet) IsOurAddress(a btcutil.Address) bool { result, err := b.wallet.HaveAddress(a) return result && (err == nil) }
go
func (b *BtcWallet) IsOurAddress(a btcutil.Address) bool { result, err := b.wallet.HaveAddress(a) return result && (err == nil) }
[ "func", "(", "b", "*", "BtcWallet", ")", "IsOurAddress", "(", "a", "btcutil", ".", "Address", ")", "bool", "{", "result", ",", "err", ":=", "b", ".", "wallet", ".", "HaveAddress", "(", "a", ")", "\n", "return", "result", "&&", "(", "err", "==", "ni...
// IsOurAddress checks if the passed address belongs to this wallet // // This is a part of the WalletController interface.
[ "IsOurAddress", "checks", "if", "the", "passed", "address", "belongs", "to", "this", "wallet", "This", "is", "a", "part", "of", "the", "WalletController", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L285-L288
129,784
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
SendOutputs
func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut, feeRate lnwallet.SatPerKWeight) (*wire.MsgTx, error) { // Convert our fee rate from sat/kw to sat/kb since it's required by // SendOutputs. feeSatPerKB := btcutil.Amount(feeRate.FeePerKVByte()) // Sanity check outputs. if len(outputs) < 1 { return nil, ln...
go
func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut, feeRate lnwallet.SatPerKWeight) (*wire.MsgTx, error) { // Convert our fee rate from sat/kw to sat/kb since it's required by // SendOutputs. feeSatPerKB := btcutil.Amount(feeRate.FeePerKVByte()) // Sanity check outputs. if len(outputs) < 1 { return nil, ln...
[ "func", "(", "b", "*", "BtcWallet", ")", "SendOutputs", "(", "outputs", "[", "]", "*", "wire", ".", "TxOut", ",", "feeRate", "lnwallet", ".", "SatPerKWeight", ")", "(", "*", "wire", ".", "MsgTx", ",", "error", ")", "{", "// Convert our fee rate from sat/kw...
// SendOutputs funds, signs, and broadcasts a Bitcoin transaction paying out to // the specified outputs. In the case the wallet has insufficient funds, or the // outputs are non-standard, a non-nil error will be returned. // // This is a part of the WalletController interface.
[ "SendOutputs", "funds", "signs", "and", "broadcasts", "a", "Bitcoin", "transaction", "paying", "out", "to", "the", "specified", "outputs", ".", "In", "the", "case", "the", "wallet", "has", "insufficient", "funds", "or", "the", "outputs", "are", "non", "-", "...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L295-L307
129,785
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
LockOutpoint
func (b *BtcWallet) LockOutpoint(o wire.OutPoint) { b.wallet.LockOutpoint(o) }
go
func (b *BtcWallet) LockOutpoint(o wire.OutPoint) { b.wallet.LockOutpoint(o) }
[ "func", "(", "b", "*", "BtcWallet", ")", "LockOutpoint", "(", "o", "wire", ".", "OutPoint", ")", "{", "b", ".", "wallet", ".", "LockOutpoint", "(", "o", ")", "\n", "}" ]
// LockOutpoint marks an outpoint as locked meaning it will no longer be deemed // as eligible for coin selection. Locking outputs are utilized in order to // avoid race conditions when selecting inputs for usage when funding a // channel. // // This is a part of the WalletController interface.
[ "LockOutpoint", "marks", "an", "outpoint", "as", "locked", "meaning", "it", "will", "no", "longer", "be", "deemed", "as", "eligible", "for", "coin", "selection", ".", "Locking", "outputs", "are", "utilized", "in", "order", "to", "avoid", "race", "conditions", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L347-L349
129,786
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
UnlockOutpoint
func (b *BtcWallet) UnlockOutpoint(o wire.OutPoint) { b.wallet.UnlockOutpoint(o) }
go
func (b *BtcWallet) UnlockOutpoint(o wire.OutPoint) { b.wallet.UnlockOutpoint(o) }
[ "func", "(", "b", "*", "BtcWallet", ")", "UnlockOutpoint", "(", "o", "wire", ".", "OutPoint", ")", "{", "b", ".", "wallet", ".", "UnlockOutpoint", "(", "o", ")", "\n", "}" ]
// UnlockOutpoint unlocks a previously locked output, marking it eligible for // coin selection. // // This is a part of the WalletController interface.
[ "UnlockOutpoint", "unlocks", "a", "previously", "locked", "output", "marking", "it", "eligible", "for", "coin", "selection", ".", "This", "is", "a", "part", "of", "the", "WalletController", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L355-L357
129,787
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
ListUnspentWitness
func (b *BtcWallet) ListUnspentWitness(minConfs, maxConfs int32) ( []*lnwallet.Utxo, error) { // First, grab all the unfiltered currently unspent outputs. unspentOutputs, err := b.wallet.ListUnspent(minConfs, maxConfs, nil) if err != nil { return nil, err } // Next, we'll run through all the regular outputs, o...
go
func (b *BtcWallet) ListUnspentWitness(minConfs, maxConfs int32) ( []*lnwallet.Utxo, error) { // First, grab all the unfiltered currently unspent outputs. unspentOutputs, err := b.wallet.ListUnspent(minConfs, maxConfs, nil) if err != nil { return nil, err } // Next, we'll run through all the regular outputs, o...
[ "func", "(", "b", "*", "BtcWallet", ")", "ListUnspentWitness", "(", "minConfs", ",", "maxConfs", "int32", ")", "(", "[", "]", "*", "lnwallet", ".", "Utxo", ",", "error", ")", "{", "// First, grab all the unfiltered currently unspent outputs.", "unspentOutputs", ",...
// ListUnspentWitness returns a slice of all the unspent outputs the wallet // controls which pay to witness programs either directly or indirectly. // // This is a part of the WalletController interface.
[ "ListUnspentWitness", "returns", "a", "slice", "of", "all", "the", "unspent", "outputs", "the", "wallet", "controls", "which", "pay", "to", "witness", "programs", "either", "directly", "or", "indirectly", ".", "This", "is", "a", "part", "of", "the", "WalletCon...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L363-L421
129,788
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
extractBalanceDelta
func extractBalanceDelta( txSummary base.TransactionSummary, tx *wire.MsgTx, ) (btcutil.Amount, error) { // For each input we debit the wallet's outflow for this transaction, // and for each output we credit the wallet's inflow for this // transaction. var balanceDelta btcutil.Amount for _, input := range txSumm...
go
func extractBalanceDelta( txSummary base.TransactionSummary, tx *wire.MsgTx, ) (btcutil.Amount, error) { // For each input we debit the wallet's outflow for this transaction, // and for each output we credit the wallet's inflow for this // transaction. var balanceDelta btcutil.Amount for _, input := range txSumm...
[ "func", "extractBalanceDelta", "(", "txSummary", "base", ".", "TransactionSummary", ",", "tx", "*", "wire", ".", "MsgTx", ",", ")", "(", "btcutil", ".", "Amount", ",", "error", ")", "{", "// For each input we debit the wallet's outflow for this transaction,", "// and ...
// extractBalanceDelta extracts the net balance delta from the PoV of the // wallet given a TransactionSummary.
[ "extractBalanceDelta", "extracts", "the", "net", "balance", "delta", "from", "the", "PoV", "of", "the", "wallet", "given", "a", "TransactionSummary", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L477-L493
129,789
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
minedTransactionsToDetails
func minedTransactionsToDetails( currentHeight int32, block base.Block, chainParams *chaincfg.Params, ) ([]*lnwallet.TransactionDetail, error) { details := make([]*lnwallet.TransactionDetail, 0, len(block.Transactions)) for _, tx := range block.Transactions { wireTx := &wire.MsgTx{} txReader := bytes.NewReade...
go
func minedTransactionsToDetails( currentHeight int32, block base.Block, chainParams *chaincfg.Params, ) ([]*lnwallet.TransactionDetail, error) { details := make([]*lnwallet.TransactionDetail, 0, len(block.Transactions)) for _, tx := range block.Transactions { wireTx := &wire.MsgTx{} txReader := bytes.NewReade...
[ "func", "minedTransactionsToDetails", "(", "currentHeight", "int32", ",", "block", "base", ".", "Block", ",", "chainParams", "*", "chaincfg", ".", "Params", ",", ")", "(", "[", "]", "*", "lnwallet", ".", "TransactionDetail", ",", "error", ")", "{", "details"...
// minedTransactionsToDetails is a helper function which converts a summary // information about mined transactions to a TransactionDetail.
[ "minedTransactionsToDetails", "is", "a", "helper", "function", "which", "converts", "a", "summary", "information", "about", "mined", "transactions", "to", "a", "TransactionDetail", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L497-L543
129,790
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
unminedTransactionsToDetail
func unminedTransactionsToDetail( summary base.TransactionSummary, ) (*lnwallet.TransactionDetail, error) { wireTx := &wire.MsgTx{} txReader := bytes.NewReader(summary.Transaction) if err := wireTx.Deserialize(txReader); err != nil { return nil, err } txDetail := &lnwallet.TransactionDetail{ Hash: *sum...
go
func unminedTransactionsToDetail( summary base.TransactionSummary, ) (*lnwallet.TransactionDetail, error) { wireTx := &wire.MsgTx{} txReader := bytes.NewReader(summary.Transaction) if err := wireTx.Deserialize(txReader); err != nil { return nil, err } txDetail := &lnwallet.TransactionDetail{ Hash: *sum...
[ "func", "unminedTransactionsToDetail", "(", "summary", "base", ".", "TransactionSummary", ",", ")", "(", "*", "lnwallet", ".", "TransactionDetail", ",", "error", ")", "{", "wireTx", ":=", "&", "wire", ".", "MsgTx", "{", "}", "\n", "txReader", ":=", "bytes", ...
// unminedTransactionsToDetail is a helper function which converts a summary // for an unconfirmed transaction to a transaction detail.
[ "unminedTransactionsToDetail", "is", "a", "helper", "function", "which", "converts", "a", "summary", "for", "an", "unconfirmed", "transaction", "to", "a", "transaction", "detail", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L547-L570
129,791
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
ListTransactionDetails
func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, error) { // Grab the best block the wallet knows of, we'll use this to calculate // # of confirmations shortly below. bestBlock := b.wallet.Manager.SyncedTo() currentHeight := bestBlock.Height // We'll attempt to find all unconfirmed tra...
go
func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, error) { // Grab the best block the wallet knows of, we'll use this to calculate // # of confirmations shortly below. bestBlock := b.wallet.Manager.SyncedTo() currentHeight := bestBlock.Height // We'll attempt to find all unconfirmed tra...
[ "func", "(", "b", "*", "BtcWallet", ")", "ListTransactionDetails", "(", ")", "(", "[", "]", "*", "lnwallet", ".", "TransactionDetail", ",", "error", ")", "{", "// Grab the best block the wallet knows of, we'll use this to calculate", "// # of confirmations shortly below.", ...
// ListTransactionDetails returns a list of all transactions which are // relevant to the wallet. // // This is a part of the WalletController interface.
[ "ListTransactionDetails", "returns", "a", "list", "of", "all", "transactions", "which", "are", "relevant", "to", "the", "wallet", ".", "This", "is", "a", "part", "of", "the", "WalletController", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L576-L616
129,792
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
Cancel
func (t *txSubscriptionClient) Cancel() { close(t.quit) t.wg.Wait() t.txClient.Done() }
go
func (t *txSubscriptionClient) Cancel() { close(t.quit) t.wg.Wait() t.txClient.Done() }
[ "func", "(", "t", "*", "txSubscriptionClient", ")", "Cancel", "(", ")", "{", "close", "(", "t", ".", "quit", ")", "\n", "t", ".", "wg", ".", "Wait", "(", ")", "\n\n", "t", ".", "txClient", ".", "Done", "(", ")", "\n", "}" ]
// Cancel finalizes the subscription, cleaning up any resources allocated. // // This is part of the TransactionSubscription interface.
[ "Cancel", "finalizes", "the", "subscription", "cleaning", "up", "any", "resources", "allocated", ".", "This", "is", "part", "of", "the", "TransactionSubscription", "interface", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L652-L657
129,793
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
notificationProxier
func (t *txSubscriptionClient) notificationProxier() { out: for { select { case txNtfn := <-t.txClient.C: // TODO(roasbeef): handle detached blocks currentHeight := t.w.Manager.SyncedTo().Height // Launch a goroutine to re-package and send // notifications for any newly confirmed transactions. go f...
go
func (t *txSubscriptionClient) notificationProxier() { out: for { select { case txNtfn := <-t.txClient.C: // TODO(roasbeef): handle detached blocks currentHeight := t.w.Manager.SyncedTo().Height // Launch a goroutine to re-package and send // notifications for any newly confirmed transactions. go f...
[ "func", "(", "t", "*", "txSubscriptionClient", ")", "notificationProxier", "(", ")", "{", "out", ":", "for", "{", "select", "{", "case", "txNtfn", ":=", "<-", "t", ".", "txClient", ".", "C", ":", "// TODO(roasbeef): handle detached blocks", "currentHeight", ":...
// notificationProxier proxies the notifications received by the underlying // wallet's notification client to a higher-level TransactionSubscription // client.
[ "notificationProxier", "proxies", "the", "notifications", "received", "by", "the", "underlying", "wallet", "s", "notification", "client", "to", "a", "higher", "-", "level", "TransactionSubscription", "client", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L662-L712
129,794
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
SubscribeTransactions
func (b *BtcWallet) SubscribeTransactions() (lnwallet.TransactionSubscription, error) { walletClient := b.wallet.NtfnServer.TransactionNotifications() txClient := &txSubscriptionClient{ txClient: walletClient, confirmed: make(chan *lnwallet.TransactionDetail), unconfirmed: make(chan *lnwallet.TransactionD...
go
func (b *BtcWallet) SubscribeTransactions() (lnwallet.TransactionSubscription, error) { walletClient := b.wallet.NtfnServer.TransactionNotifications() txClient := &txSubscriptionClient{ txClient: walletClient, confirmed: make(chan *lnwallet.TransactionDetail), unconfirmed: make(chan *lnwallet.TransactionD...
[ "func", "(", "b", "*", "BtcWallet", ")", "SubscribeTransactions", "(", ")", "(", "lnwallet", ".", "TransactionSubscription", ",", "error", ")", "{", "walletClient", ":=", "b", ".", "wallet", ".", "NtfnServer", ".", "TransactionNotifications", "(", ")", "\n\n",...
// SubscribeTransactions returns a TransactionSubscription client which // is capable of receiving async notifications as new transactions // related to the wallet are seen within the network, or found in // blocks. // // This is a part of the WalletController interface.
[ "SubscribeTransactions", "returns", "a", "TransactionSubscription", "client", "which", "is", "capable", "of", "receiving", "async", "notifications", "as", "new", "transactions", "related", "to", "the", "wallet", "are", "seen", "within", "the", "network", "or", "foun...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L720-L734
129,795
lightningnetwork/lnd
lnwallet/btcwallet/btcwallet.go
IsSynced
func (b *BtcWallet) IsSynced() (bool, int64, error) { // Grab the best chain state the wallet is currently aware of. syncState := b.wallet.Manager.SyncedTo() // We'll also extract the current best wallet timestamp so the caller // can get an idea of where we are in the sync timeline. bestTimestamp := syncState.Ti...
go
func (b *BtcWallet) IsSynced() (bool, int64, error) { // Grab the best chain state the wallet is currently aware of. syncState := b.wallet.Manager.SyncedTo() // We'll also extract the current best wallet timestamp so the caller // can get an idea of where we are in the sync timeline. bestTimestamp := syncState.Ti...
[ "func", "(", "b", "*", "BtcWallet", ")", "IsSynced", "(", ")", "(", "bool", ",", "int64", ",", "error", ")", "{", "// Grab the best chain state the wallet is currently aware of.", "syncState", ":=", "b", ".", "wallet", ".", "Manager", ".", "SyncedTo", "(", ")"...
// IsSynced returns a boolean indicating if from the PoV of the wallet, // it has fully synced to the current best block in the main chain. // // This is a part of the WalletController interface.
[ "IsSynced", "returns", "a", "boolean", "indicating", "if", "from", "the", "PoV", "of", "the", "wallet", "it", "has", "fully", "synced", "to", "the", "current", "best", "block", "in", "the", "main", "chain", ".", "This", "is", "a", "part", "of", "the", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwallet/btcwallet/btcwallet.go#L740-L778
129,796
lightningnetwork/lnd
watchtower/wtserver/create_session.go
handleCreateSession
func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID, req *wtwire.CreateSession) error { // TODO(conner): validate accept against policy // Query the db for session info belonging to the client's session id. existingInfo, err := s.cfg.DB.GetSessionInfo(id) switch { // We already have a session, t...
go
func (s *Server) handleCreateSession(peer Peer, id *wtdb.SessionID, req *wtwire.CreateSession) error { // TODO(conner): validate accept against policy // Query the db for session info belonging to the client's session id. existingInfo, err := s.cfg.DB.GetSessionInfo(id) switch { // We already have a session, t...
[ "func", "(", "s", "*", "Server", ")", "handleCreateSession", "(", "peer", "Peer", ",", "id", "*", "wtdb", ".", "SessionID", ",", "req", "*", "wtwire", ".", "CreateSession", ")", "error", "{", "// TODO(conner): validate accept against policy", "// Query the db for ...
// handleCreateSession processes a CreateSession message from the peer, and returns // a CreateSessionReply in response. This method will only succeed if no existing // session info is known about the session id. If an existing session is found, // the reward address is returned in case the client lost our reply.
[ "handleCreateSession", "processes", "a", "CreateSession", "message", "from", "the", "peer", "and", "returns", "a", "CreateSessionReply", "in", "response", ".", "This", "method", "will", "only", "succeed", "if", "no", "existing", "session", "info", "is", "known", ...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtserver/create_session.go#L15-L116
129,797
lightningnetwork/lnd
watchtower/wtserver/create_session.go
replyCreateSession
func (s *Server) replyCreateSession(peer Peer, id *wtdb.SessionID, code wtwire.ErrorCode, lastApplied uint16, data []byte) error { if s.cfg.NoAckCreateSession { return &connFailure{ ID: *id, Code: code, } } msg := &wtwire.CreateSessionReply{ Code: code, LastApplied: lastApplied, Data: ...
go
func (s *Server) replyCreateSession(peer Peer, id *wtdb.SessionID, code wtwire.ErrorCode, lastApplied uint16, data []byte) error { if s.cfg.NoAckCreateSession { return &connFailure{ ID: *id, Code: code, } } msg := &wtwire.CreateSessionReply{ Code: code, LastApplied: lastApplied, Data: ...
[ "func", "(", "s", "*", "Server", ")", "replyCreateSession", "(", "peer", "Peer", ",", "id", "*", "wtdb", ".", "SessionID", ",", "code", "wtwire", ".", "ErrorCode", ",", "lastApplied", "uint16", ",", "data", "[", "]", "byte", ")", "error", "{", "if", ...
// replyCreateSession sends a response to a CreateSession from a client. If the // status code in the reply is OK, the error from the write will be bubbled up. // Otherwise, this method returns a connection error to ensure we don't continue // communication with the client.
[ "replyCreateSession", "sends", "a", "response", "to", "a", "CreateSession", "from", "a", "client", ".", "If", "the", "status", "code", "in", "the", "reply", "is", "OK", "the", "error", "from", "the", "write", "will", "be", "bubbled", "up", ".", "Otherwise"...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/watchtower/wtserver/create_session.go#L122-L154
129,798
lightningnetwork/lnd
htlcswitch/circuit_map.go
NewCircuitMap
func NewCircuitMap(cfg *CircuitMapConfig) (CircuitMap, error) { cm := &circuitMap{ cfg: cfg, } // Initialize the on-disk buckets used by the circuit map. if err := cm.initBuckets(); err != nil { return nil, err } // Load any previously persisted circuit into back into memory. if err := cm.restoreMemState()...
go
func NewCircuitMap(cfg *CircuitMapConfig) (CircuitMap, error) { cm := &circuitMap{ cfg: cfg, } // Initialize the on-disk buckets used by the circuit map. if err := cm.initBuckets(); err != nil { return nil, err } // Load any previously persisted circuit into back into memory. if err := cm.restoreMemState()...
[ "func", "NewCircuitMap", "(", "cfg", "*", "CircuitMapConfig", ")", "(", "CircuitMap", ",", "error", ")", "{", "cm", ":=", "&", "circuitMap", "{", "cfg", ":", "cfg", ",", "}", "\n\n", "// Initialize the on-disk buckets used by the circuit map.", "if", "err", ":="...
// NewCircuitMap creates a new instance of the circuitMap.
[ "NewCircuitMap", "creates", "a", "new", "instance", "of", "the", "circuitMap", "." ]
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L185-L210
129,799
lightningnetwork/lnd
htlcswitch/circuit_map.go
restoreMemState
func (cm *circuitMap) restoreMemState() error { log.Infof("Restoring in-memory circuit state from disk") var ( opened = make(map[CircuitKey]*PaymentCircuit) pending = make(map[CircuitKey]*PaymentCircuit) ) if err := cm.cfg.DB.Update(func(tx *bbolt.Tx) error { // Restore any of the circuits persisted in the...
go
func (cm *circuitMap) restoreMemState() error { log.Infof("Restoring in-memory circuit state from disk") var ( opened = make(map[CircuitKey]*PaymentCircuit) pending = make(map[CircuitKey]*PaymentCircuit) ) if err := cm.cfg.DB.Update(func(tx *bbolt.Tx) error { // Restore any of the circuits persisted in the...
[ "func", "(", "cm", "*", "circuitMap", ")", "restoreMemState", "(", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ")", "\n\n", "var", "(", "opened", "=", "make", "(", "map", "[", "CircuitKey", "]", "*", "PaymentCircuit", ")", "\n", "pending...
// restoreMemState loads the contents of the half circuit and full circuit // buckets from disk and reconstructs the in-memory representation of the // circuit map. Afterwards, the state of the hash index is reconstructed using // the recovered set of full circuits. This method will also remove any stray // keystones, ...
[ "restoreMemState", "loads", "the", "contents", "of", "the", "half", "circuit", "and", "full", "circuit", "buckets", "from", "disk", "and", "reconstructs", "the", "in", "-", "memory", "representation", "of", "the", "circuit", "map", ".", "Afterwards", "the", "s...
1acd38e48c168b86c291524eb56b8fcdf04a910c
https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/htlcswitch/circuit_map.go#L232-L346