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,200 | lightningnetwork/lnd | rpcserver.go | GetNodeInfo | func (r *rpcServer) GetNodeInfo(ctx context.Context,
in *lnrpc.NodeInfoRequest) (*lnrpc.NodeInfo, error) {
graph := r.server.chanDB.ChannelGraph()
// First, parse the hex-encoded public key into a full in-memory public
// key object we can work with for querying.
pubKeyBytes, err := hex.DecodeString(in.PubKey)
... | go | func (r *rpcServer) GetNodeInfo(ctx context.Context,
in *lnrpc.NodeInfoRequest) (*lnrpc.NodeInfo, error) {
graph := r.server.chanDB.ChannelGraph()
// First, parse the hex-encoded public key into a full in-memory public
// key object we can work with for querying.
pubKeyBytes, err := hex.DecodeString(in.PubKey)
... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"GetNodeInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"lnrpc",
".",
"NodeInfoRequest",
")",
"(",
"*",
"lnrpc",
".",
"NodeInfo",
",",
"error",
")",
"{",
"graph",
":=",
"r",
".",
"server",
".",
... | // GetNodeInfo returns the latest advertised and aggregate authenticated
// channel information for the specified node identified by its public key. | [
"GetNodeInfo",
"returns",
"the",
"latest",
"advertised",
"and",
"aggregate",
"authenticated",
"channel",
"information",
"for",
"the",
"specified",
"node",
"identified",
"by",
"its",
"public",
"key",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3807-L3869 |
129,201 | lightningnetwork/lnd | rpcserver.go | unmarshallHopByChannelLookup | func unmarshallHopByChannelLookup(graph *channeldb.ChannelGraph, hop *lnrpc.Hop,
prevPubKeyBytes [33]byte) (*route.Hop, error) {
// Discard edge policies, because they may be nil.
edgeInfo, _, _, err := graph.FetchChannelEdgesByID(hop.ChanId)
if err != nil {
return nil, fmt.Errorf("unable to fetch channel edges ... | go | func unmarshallHopByChannelLookup(graph *channeldb.ChannelGraph, hop *lnrpc.Hop,
prevPubKeyBytes [33]byte) (*route.Hop, error) {
// Discard edge policies, because they may be nil.
edgeInfo, _, _, err := graph.FetchChannelEdgesByID(hop.ChanId)
if err != nil {
return nil, fmt.Errorf("unable to fetch channel edges ... | [
"func",
"unmarshallHopByChannelLookup",
"(",
"graph",
"*",
"channeldb",
".",
"ChannelGraph",
",",
"hop",
"*",
"lnrpc",
".",
"Hop",
",",
"prevPubKeyBytes",
"[",
"33",
"]",
"byte",
")",
"(",
"*",
"route",
".",
"Hop",
",",
"error",
")",
"{",
"// Discard edge ... | // unmarshallHopByChannelLookup unmarshalls an rpc hop for which the pub key is
// not known. This function will query the channel graph with channel id to
// retrieve both endpoints and determine the hop pubkey using the previous hop
// pubkey. If the channel is unknown, an error is returned. | [
"unmarshallHopByChannelLookup",
"unmarshalls",
"an",
"rpc",
"hop",
"for",
"which",
"the",
"pub",
"key",
"is",
"not",
"known",
".",
"This",
"function",
"will",
"query",
"the",
"channel",
"graph",
"with",
"channel",
"id",
"to",
"retrieve",
"both",
"endpoints",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3890-L3916 |
129,202 | lightningnetwork/lnd | rpcserver.go | unmarshallKnownPubkeyHop | func unmarshallKnownPubkeyHop(hop *lnrpc.Hop) (*route.Hop, error) {
pubKey, err := hex.DecodeString(hop.PubKey)
if err != nil {
return nil, fmt.Errorf("cannot decode pubkey %s", hop.PubKey)
}
var pubKeyBytes [33]byte
copy(pubKeyBytes[:], pubKey)
return &route.Hop{
OutgoingTimeLock: hop.Expiry,
AmtToForwar... | go | func unmarshallKnownPubkeyHop(hop *lnrpc.Hop) (*route.Hop, error) {
pubKey, err := hex.DecodeString(hop.PubKey)
if err != nil {
return nil, fmt.Errorf("cannot decode pubkey %s", hop.PubKey)
}
var pubKeyBytes [33]byte
copy(pubKeyBytes[:], pubKey)
return &route.Hop{
OutgoingTimeLock: hop.Expiry,
AmtToForwar... | [
"func",
"unmarshallKnownPubkeyHop",
"(",
"hop",
"*",
"lnrpc",
".",
"Hop",
")",
"(",
"*",
"route",
".",
"Hop",
",",
"error",
")",
"{",
"pubKey",
",",
"err",
":=",
"hex",
".",
"DecodeString",
"(",
"hop",
".",
"PubKey",
")",
"\n",
"if",
"err",
"!=",
"... | // unmarshallKnownPubkeyHop unmarshalls an rpc hop that contains the hop pubkey.
// The channel graph doesn't need to be queried because all information required
// for sending the payment is present. | [
"unmarshallKnownPubkeyHop",
"unmarshalls",
"an",
"rpc",
"hop",
"that",
"contains",
"the",
"hop",
"pubkey",
".",
"The",
"channel",
"graph",
"doesn",
"t",
"need",
"to",
"be",
"queried",
"because",
"all",
"information",
"required",
"for",
"sending",
"the",
"payment... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3921-L3936 |
129,203 | lightningnetwork/lnd | rpcserver.go | unmarshallHop | func unmarshallHop(graph *channeldb.ChannelGraph, hop *lnrpc.Hop,
prevNodePubKey [33]byte) (*route.Hop, error) {
if hop.PubKey == "" {
// If no pub key is given of the hop, the local channel
// graph needs to be queried to complete the information
// necessary for routing.
return unmarshallHopByChannelLookup... | go | func unmarshallHop(graph *channeldb.ChannelGraph, hop *lnrpc.Hop,
prevNodePubKey [33]byte) (*route.Hop, error) {
if hop.PubKey == "" {
// If no pub key is given of the hop, the local channel
// graph needs to be queried to complete the information
// necessary for routing.
return unmarshallHopByChannelLookup... | [
"func",
"unmarshallHop",
"(",
"graph",
"*",
"channeldb",
".",
"ChannelGraph",
",",
"hop",
"*",
"lnrpc",
".",
"Hop",
",",
"prevNodePubKey",
"[",
"33",
"]",
"byte",
")",
"(",
"*",
"route",
".",
"Hop",
",",
"error",
")",
"{",
"if",
"hop",
".",
"PubKey",... | // unmarshallHop unmarshalls an rpc hop that may or may not contain a node
// pubkey. | [
"unmarshallHop",
"unmarshalls",
"an",
"rpc",
"hop",
"that",
"may",
"or",
"may",
"not",
"contain",
"a",
"node",
"pubkey",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3940-L3951 |
129,204 | lightningnetwork/lnd | rpcserver.go | unmarshallRoute | func unmarshallRoute(rpcroute *lnrpc.Route,
graph *channeldb.ChannelGraph) (*route.Route, error) {
sourceNode, err := graph.SourceNode()
if err != nil {
return nil, fmt.Errorf("unable to fetch source node from graph "+
"while unmarshaling route. %v", err)
}
prevNodePubKey := sourceNode.PubKeyBytes
hops :=... | go | func unmarshallRoute(rpcroute *lnrpc.Route,
graph *channeldb.ChannelGraph) (*route.Route, error) {
sourceNode, err := graph.SourceNode()
if err != nil {
return nil, fmt.Errorf("unable to fetch source node from graph "+
"while unmarshaling route. %v", err)
}
prevNodePubKey := sourceNode.PubKeyBytes
hops :=... | [
"func",
"unmarshallRoute",
"(",
"rpcroute",
"*",
"lnrpc",
".",
"Route",
",",
"graph",
"*",
"channeldb",
".",
"ChannelGraph",
")",
"(",
"*",
"route",
".",
"Route",
",",
"error",
")",
"{",
"sourceNode",
",",
"err",
":=",
"graph",
".",
"SourceNode",
"(",
... | // unmarshallRoute unmarshalls an rpc route. For hops that don't specify a
// pubkey, the channel graph is queried. | [
"unmarshallRoute",
"unmarshalls",
"an",
"rpc",
"route",
".",
"For",
"hops",
"that",
"don",
"t",
"specify",
"a",
"pubkey",
"the",
"channel",
"graph",
"is",
"queried",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3955-L3990 |
129,205 | lightningnetwork/lnd | rpcserver.go | GetNetworkInfo | func (r *rpcServer) GetNetworkInfo(ctx context.Context,
_ *lnrpc.NetworkInfoRequest) (*lnrpc.NetworkInfo, error) {
graph := r.server.chanDB.ChannelGraph()
var (
numNodes uint32
numChannels uint32
maxChanOut uint32
totalNetworkCapacity btcutil.Amount
minChannelSize btc... | go | func (r *rpcServer) GetNetworkInfo(ctx context.Context,
_ *lnrpc.NetworkInfoRequest) (*lnrpc.NetworkInfo, error) {
graph := r.server.chanDB.ChannelGraph()
var (
numNodes uint32
numChannels uint32
maxChanOut uint32
totalNetworkCapacity btcutil.Amount
minChannelSize btc... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"GetNetworkInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"_",
"*",
"lnrpc",
".",
"NetworkInfoRequest",
")",
"(",
"*",
"lnrpc",
".",
"NetworkInfo",
",",
"error",
")",
"{",
"graph",
":=",
"r",
".",
"server",
... | // GetNetworkInfo returns some basic stats about the known channel graph from
// the PoV of the node. | [
"GetNetworkInfo",
"returns",
"some",
"basic",
"stats",
"about",
"the",
"known",
"channel",
"graph",
"from",
"the",
"PoV",
"of",
"the",
"node",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L3994-L4114 |
129,206 | lightningnetwork/lnd | rpcserver.go | StopDaemon | func (r *rpcServer) StopDaemon(ctx context.Context,
_ *lnrpc.StopRequest) (*lnrpc.StopResponse, error) {
signal.RequestShutdown()
return &lnrpc.StopResponse{}, nil
} | go | func (r *rpcServer) StopDaemon(ctx context.Context,
_ *lnrpc.StopRequest) (*lnrpc.StopResponse, error) {
signal.RequestShutdown()
return &lnrpc.StopResponse{}, nil
} | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"StopDaemon",
"(",
"ctx",
"context",
".",
"Context",
",",
"_",
"*",
"lnrpc",
".",
"StopRequest",
")",
"(",
"*",
"lnrpc",
".",
"StopResponse",
",",
"error",
")",
"{",
"signal",
".",
"RequestShutdown",
"(",
")",
... | // StopDaemon will send a shutdown request to the interrupt handler, triggering
// a graceful shutdown of the daemon. | [
"StopDaemon",
"will",
"send",
"a",
"shutdown",
"request",
"to",
"the",
"interrupt",
"handler",
"triggering",
"a",
"graceful",
"shutdown",
"of",
"the",
"daemon",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4118-L4123 |
129,207 | lightningnetwork/lnd | rpcserver.go | marshallTopologyChange | func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopologyUpdate {
// encodeKey is a simple helper function that converts a live public
// key into a hex-encoded version of the compressed serialization for
// the public key.
encodeKey := func(k *btcec.PublicKey) string {
return hex.Encod... | go | func marshallTopologyChange(topChange *routing.TopologyChange) *lnrpc.GraphTopologyUpdate {
// encodeKey is a simple helper function that converts a live public
// key into a hex-encoded version of the compressed serialization for
// the public key.
encodeKey := func(k *btcec.PublicKey) string {
return hex.Encod... | [
"func",
"marshallTopologyChange",
"(",
"topChange",
"*",
"routing",
".",
"TopologyChange",
")",
"*",
"lnrpc",
".",
"GraphTopologyUpdate",
"{",
"// encodeKey is a simple helper function that converts a live public",
"// key into a hex-encoded version of the compressed serialization for"... | // marshallTopologyChange performs a mapping from the topology change struct
// returned by the router to the form of notifications expected by the current
// gRPC service. | [
"marshallTopologyChange",
"performs",
"a",
"mapping",
"from",
"the",
"topology",
"change",
"struct",
"returned",
"by",
"the",
"router",
"to",
"the",
"form",
"of",
"notifications",
"expected",
"by",
"the",
"current",
"gRPC",
"service",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4179-L4247 |
129,208 | lightningnetwork/lnd | rpcserver.go | ListPayments | func (r *rpcServer) ListPayments(ctx context.Context,
_ *lnrpc.ListPaymentsRequest) (*lnrpc.ListPaymentsResponse, error) {
rpcsLog.Debugf("[ListPayments]")
payments, err := r.server.chanDB.FetchAllPayments()
if err != nil && err != channeldb.ErrNoPaymentsCreated {
return nil, err
}
paymentsResp := &lnrpc.Lis... | go | func (r *rpcServer) ListPayments(ctx context.Context,
_ *lnrpc.ListPaymentsRequest) (*lnrpc.ListPaymentsResponse, error) {
rpcsLog.Debugf("[ListPayments]")
payments, err := r.server.chanDB.FetchAllPayments()
if err != nil && err != channeldb.ErrNoPaymentsCreated {
return nil, err
}
paymentsResp := &lnrpc.Lis... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"ListPayments",
"(",
"ctx",
"context",
".",
"Context",
",",
"_",
"*",
"lnrpc",
".",
"ListPaymentsRequest",
")",
"(",
"*",
"lnrpc",
".",
"ListPaymentsResponse",
",",
"error",
")",
"{",
"rpcsLog",
".",
"Debugf",
"("... | // ListPayments returns a list of all outgoing payments. | [
"ListPayments",
"returns",
"a",
"list",
"of",
"all",
"outgoing",
"payments",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4250-L4286 |
129,209 | lightningnetwork/lnd | rpcserver.go | DeleteAllPayments | func (r *rpcServer) DeleteAllPayments(ctx context.Context,
_ *lnrpc.DeleteAllPaymentsRequest) (*lnrpc.DeleteAllPaymentsResponse, error) {
rpcsLog.Debugf("[DeleteAllPayments]")
if err := r.server.chanDB.DeleteAllPayments(); err != nil {
return nil, err
}
return &lnrpc.DeleteAllPaymentsResponse{}, nil
} | go | func (r *rpcServer) DeleteAllPayments(ctx context.Context,
_ *lnrpc.DeleteAllPaymentsRequest) (*lnrpc.DeleteAllPaymentsResponse, error) {
rpcsLog.Debugf("[DeleteAllPayments]")
if err := r.server.chanDB.DeleteAllPayments(); err != nil {
return nil, err
}
return &lnrpc.DeleteAllPaymentsResponse{}, nil
} | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"DeleteAllPayments",
"(",
"ctx",
"context",
".",
"Context",
",",
"_",
"*",
"lnrpc",
".",
"DeleteAllPaymentsRequest",
")",
"(",
"*",
"lnrpc",
".",
"DeleteAllPaymentsResponse",
",",
"error",
")",
"{",
"rpcsLog",
".",
... | // DeleteAllPayments deletes all outgoing payments from DB. | [
"DeleteAllPayments",
"deletes",
"all",
"outgoing",
"payments",
"from",
"DB",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4289-L4299 |
129,210 | lightningnetwork/lnd | rpcserver.go | DebugLevel | func (r *rpcServer) DebugLevel(ctx context.Context,
req *lnrpc.DebugLevelRequest) (*lnrpc.DebugLevelResponse, error) {
// If show is set, then we simply print out the list of available
// sub-systems.
if req.Show {
return &lnrpc.DebugLevelResponse{
SubSystems: strings.Join(supportedSubsystems(), " "),
}, ni... | go | func (r *rpcServer) DebugLevel(ctx context.Context,
req *lnrpc.DebugLevelRequest) (*lnrpc.DebugLevelResponse, error) {
// If show is set, then we simply print out the list of available
// sub-systems.
if req.Show {
return &lnrpc.DebugLevelResponse{
SubSystems: strings.Join(supportedSubsystems(), " "),
}, ni... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"DebugLevel",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"lnrpc",
".",
"DebugLevelRequest",
")",
"(",
"*",
"lnrpc",
".",
"DebugLevelResponse",
",",
"error",
")",
"{",
"// If show is set, then we simply prin... | // DebugLevel allows a caller to programmatically set the logging verbosity of
// lnd. The logging can be targeted according to a coarse daemon-wide logging
// level, or in a granular fashion to specify the logging for a target
// sub-system. | [
"DebugLevel",
"allows",
"a",
"caller",
"to",
"programmatically",
"set",
"the",
"logging",
"verbosity",
"of",
"lnd",
".",
"The",
"logging",
"can",
"be",
"targeted",
"according",
"to",
"a",
"coarse",
"daemon",
"-",
"wide",
"logging",
"level",
"or",
"in",
"a",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4305-L4325 |
129,211 | lightningnetwork/lnd | rpcserver.go | DecodePayReq | func (r *rpcServer) DecodePayReq(ctx context.Context,
req *lnrpc.PayReqString) (*lnrpc.PayReq, error) {
rpcsLog.Tracef("[decodepayreq] decoding: %v", req.PayReq)
// Fist we'll attempt to decode the payment request string, if the
// request is invalid or the checksum doesn't match, then we'll exit
// here with an... | go | func (r *rpcServer) DecodePayReq(ctx context.Context,
req *lnrpc.PayReqString) (*lnrpc.PayReq, error) {
rpcsLog.Tracef("[decodepayreq] decoding: %v", req.PayReq)
// Fist we'll attempt to decode the payment request string, if the
// request is invalid or the checksum doesn't match, then we'll exit
// here with an... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"DecodePayReq",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"lnrpc",
".",
"PayReqString",
")",
"(",
"*",
"lnrpc",
".",
"PayReq",
",",
"error",
")",
"{",
"rpcsLog",
".",
"Tracef",
"(",
"\"",
"\"",
... | // DecodePayReq takes an encoded payment request string and attempts to decode
// it, returning a full description of the conditions encoded within the
// payment request. | [
"DecodePayReq",
"takes",
"an",
"encoded",
"payment",
"request",
"string",
"and",
"attempts",
"to",
"decode",
"it",
"returning",
"a",
"full",
"description",
"of",
"the",
"conditions",
"encoded",
"within",
"the",
"payment",
"request",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4330-L4384 |
129,212 | lightningnetwork/lnd | rpcserver.go | UpdateChannelPolicy | func (r *rpcServer) UpdateChannelPolicy(ctx context.Context,
req *lnrpc.PolicyUpdateRequest) (*lnrpc.PolicyUpdateResponse, error) {
var targetChans []wire.OutPoint
switch scope := req.Scope.(type) {
// If the request is targeting all active channels, then we don't need
// target any channels by their channel poin... | go | func (r *rpcServer) UpdateChannelPolicy(ctx context.Context,
req *lnrpc.PolicyUpdateRequest) (*lnrpc.PolicyUpdateResponse, error) {
var targetChans []wire.OutPoint
switch scope := req.Scope.(type) {
// If the request is targeting all active channels, then we don't need
// target any channels by their channel poin... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"UpdateChannelPolicy",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"lnrpc",
".",
"PolicyUpdateRequest",
")",
"(",
"*",
"lnrpc",
".",
"PolicyUpdateResponse",
",",
"error",
")",
"{",
"var",
"targetChans",
... | // UpdateChannelPolicy allows the caller to update the channel forwarding policy
// for all channels globally, or a particular channel. | [
"UpdateChannelPolicy",
"allows",
"the",
"caller",
"to",
"update",
"the",
"channel",
"forwarding",
"policy",
"for",
"all",
"channels",
"globally",
"or",
"a",
"particular",
"channel",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4538-L4627 |
129,213 | lightningnetwork/lnd | rpcserver.go | ForwardingHistory | func (r *rpcServer) ForwardingHistory(ctx context.Context,
req *lnrpc.ForwardingHistoryRequest) (*lnrpc.ForwardingHistoryResponse, error) {
rpcsLog.Debugf("[forwardinghistory]")
// Before we perform the queries below, we'll instruct the switch to
// flush any pending events to disk. This ensure we get a complete
... | go | func (r *rpcServer) ForwardingHistory(ctx context.Context,
req *lnrpc.ForwardingHistoryRequest) (*lnrpc.ForwardingHistoryResponse, error) {
rpcsLog.Debugf("[forwardinghistory]")
// Before we perform the queries below, we'll instruct the switch to
// flush any pending events to disk. This ensure we get a complete
... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"ForwardingHistory",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"lnrpc",
".",
"ForwardingHistoryRequest",
")",
"(",
"*",
"lnrpc",
".",
"ForwardingHistoryResponse",
",",
"error",
")",
"{",
"rpcsLog",
".",
... | // ForwardingHistory allows the caller to query the htlcswitch for a record of
// all HTLC's forwarded within the target time range, and integer offset within
// that time range. If no time-range is specified, then the first chunk of the
// past 24 hrs of forwarding history are returned.
// A list of forwarding events ... | [
"ForwardingHistory",
"allows",
"the",
"caller",
"to",
"query",
"the",
"htlcswitch",
"for",
"a",
"record",
"of",
"all",
"HTLC",
"s",
"forwarded",
"within",
"the",
"target",
"time",
"range",
"and",
"integer",
"offset",
"within",
"that",
"time",
"range",
".",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4640-L4718 |
129,214 | lightningnetwork/lnd | rpcserver.go | ExportChannelBackup | func (r *rpcServer) ExportChannelBackup(ctx context.Context,
in *lnrpc.ExportChannelBackupRequest) (*lnrpc.ChannelBackup, error) {
// First, we'll convert the lnrpc channel point into a wire.OutPoint
// that we can manipulate.
txid, err := getChanPointFundingTxid(in.ChanPoint)
if err != nil {
return nil, err
}... | go | func (r *rpcServer) ExportChannelBackup(ctx context.Context,
in *lnrpc.ExportChannelBackupRequest) (*lnrpc.ChannelBackup, error) {
// First, we'll convert the lnrpc channel point into a wire.OutPoint
// that we can manipulate.
txid, err := getChanPointFundingTxid(in.ChanPoint)
if err != nil {
return nil, err
}... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"ExportChannelBackup",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"lnrpc",
".",
"ExportChannelBackupRequest",
")",
"(",
"*",
"lnrpc",
".",
"ChannelBackup",
",",
"error",
")",
"{",
"// First, we'll convert th... | // ExportChannelBackup attempts to return an encrypted static channel backup
// for the target channel identified by it channel point. The backup is
// encrypted with a key generated from the aezeed seed of the user. The
// returned backup can either be restored using the RestoreChannelBackup method
// once lnd is runn... | [
"ExportChannelBackup",
"attempts",
"to",
"return",
"an",
"encrypted",
"static",
"channel",
"backup",
"for",
"the",
"target",
"channel",
"identified",
"by",
"it",
"channel",
"point",
".",
"The",
"backup",
"is",
"encrypted",
"with",
"a",
"key",
"generated",
"from"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4726-L4774 |
129,215 | lightningnetwork/lnd | rpcserver.go | VerifyChanBackup | func (r *rpcServer) VerifyChanBackup(ctx context.Context,
in *lnrpc.ChanBackupSnapshot) (*lnrpc.VerifyChanBackupResponse, error) {
switch {
// If neither a Single or Multi has been specified, then we have nothing
// to verify.
case in.GetSingleChanBackups() == nil && in.GetMultiChanBackup() == nil:
return nil, ... | go | func (r *rpcServer) VerifyChanBackup(ctx context.Context,
in *lnrpc.ChanBackupSnapshot) (*lnrpc.VerifyChanBackupResponse, error) {
switch {
// If neither a Single or Multi has been specified, then we have nothing
// to verify.
case in.GetSingleChanBackups() == nil && in.GetMultiChanBackup() == nil:
return nil, ... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"VerifyChanBackup",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"lnrpc",
".",
"ChanBackupSnapshot",
")",
"(",
"*",
"lnrpc",
".",
"VerifyChanBackupResponse",
",",
"error",
")",
"{",
"switch",
"{",
"// If n... | // VerifyChanBackup allows a caller to verify the integrity of a channel backup
// snapshot. This method will accept both either a packed Single or a packed
// Multi. Specifying both will result in an error. | [
"VerifyChanBackup",
"allows",
"a",
"caller",
"to",
"verify",
"the",
"integrity",
"of",
"a",
"channel",
"backup",
"snapshot",
".",
"This",
"method",
"will",
"accept",
"both",
"either",
"a",
"packed",
"Single",
"or",
"a",
"packed",
"Multi",
".",
"Specifying",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4779-L4834 |
129,216 | lightningnetwork/lnd | rpcserver.go | createBackupSnapshot | func (r *rpcServer) createBackupSnapshot(backups []chanbackup.Single) (
*lnrpc.ChanBackupSnapshot, error) {
// Once we have the set of back ups, we'll attempt to pack them all
// into a series of single channel backups.
singleChanPackedBackups, err := chanbackup.PackStaticChanBackups(
backups, r.server.cc.keyRin... | go | func (r *rpcServer) createBackupSnapshot(backups []chanbackup.Single) (
*lnrpc.ChanBackupSnapshot, error) {
// Once we have the set of back ups, we'll attempt to pack them all
// into a series of single channel backups.
singleChanPackedBackups, err := chanbackup.PackStaticChanBackups(
backups, r.server.cc.keyRin... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"createBackupSnapshot",
"(",
"backups",
"[",
"]",
"chanbackup",
".",
"Single",
")",
"(",
"*",
"lnrpc",
".",
"ChanBackupSnapshot",
",",
"error",
")",
"{",
"// Once we have the set of back ups, we'll attempt to pack them all",
... | // createBackupSnapshot converts the passed Single backup into a snapshot which
// contains individual packed single backups, as well as a single packed multi
// backup. | [
"createBackupSnapshot",
"converts",
"the",
"passed",
"Single",
"backup",
"into",
"a",
"snapshot",
"which",
"contains",
"individual",
"packed",
"single",
"backups",
"as",
"well",
"as",
"a",
"single",
"packed",
"multi",
"backup",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4839-L4901 |
129,217 | lightningnetwork/lnd | rpcserver.go | ExportAllChannelBackups | func (r *rpcServer) ExportAllChannelBackups(ctx context.Context,
in *lnrpc.ChanBackupExportRequest) (*lnrpc.ChanBackupSnapshot, error) {
// First, we'll attempt to read back ups for ALL currently opened
// channels from disk.
allUnpackedBackups, err := chanbackup.FetchStaticChanBackups(
r.server.chanDB,
)
if e... | go | func (r *rpcServer) ExportAllChannelBackups(ctx context.Context,
in *lnrpc.ChanBackupExportRequest) (*lnrpc.ChanBackupSnapshot, error) {
// First, we'll attempt to read back ups for ALL currently opened
// channels from disk.
allUnpackedBackups, err := chanbackup.FetchStaticChanBackups(
r.server.chanDB,
)
if e... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"ExportAllChannelBackups",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"lnrpc",
".",
"ChanBackupExportRequest",
")",
"(",
"*",
"lnrpc",
".",
"ChanBackupSnapshot",
",",
"error",
")",
"{",
"// First, we'll atte... | // ExportAllChannelBackups returns static channel backups for all existing
// channels known to lnd. A set of regular singular static channel backups for
// each channel are returned. Additionally, a multi-channel backup is returned
// as well, which contains a single encrypted blob containing the backups of
// each ch... | [
"ExportAllChannelBackups",
"returns",
"static",
"channel",
"backups",
"for",
"all",
"existing",
"channels",
"known",
"to",
"lnd",
".",
"A",
"set",
"of",
"regular",
"singular",
"static",
"channel",
"backups",
"for",
"each",
"channel",
"are",
"returned",
".",
"Add... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4908-L4923 |
129,218 | lightningnetwork/lnd | rpcserver.go | RestoreChannelBackups | func (r *rpcServer) RestoreChannelBackups(ctx context.Context,
in *lnrpc.RestoreChanBackupRequest) (*lnrpc.RestoreBackupResponse, error) {
// First, we'll make our implementation of the
// chanbackup.ChannelRestorer interface which we'll use to properly
// restore either a set of chanbackup.Single or chanbackup.Mu... | go | func (r *rpcServer) RestoreChannelBackups(ctx context.Context,
in *lnrpc.RestoreChanBackupRequest) (*lnrpc.RestoreBackupResponse, error) {
// First, we'll make our implementation of the
// chanbackup.ChannelRestorer interface which we'll use to properly
// restore either a set of chanbackup.Single or chanbackup.Mu... | [
"func",
"(",
"r",
"*",
"rpcServer",
")",
"RestoreChannelBackups",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"*",
"lnrpc",
".",
"RestoreChanBackupRequest",
")",
"(",
"*",
"lnrpc",
".",
"RestoreBackupResponse",
",",
"error",
")",
"{",
"// First, we'll ma... | // RestoreChannelBackups accepts a set of singular channel backups, or a single
// encrypted multi-chan backup and attempts to recover any funds remaining
// within the channel. If we're able to unpack the backup, then the new channel
// will be shown under listchannels, as well as pending channels. | [
"RestoreChannelBackups",
"accepts",
"a",
"set",
"of",
"singular",
"channel",
"backups",
"or",
"a",
"single",
"encrypted",
"multi",
"-",
"chan",
"backup",
"and",
"attempts",
"to",
"recover",
"any",
"funds",
"remaining",
"within",
"the",
"channel",
".",
"If",
"w... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/rpcserver.go#L4929-L4989 |
129,219 | lightningnetwork/lnd | netann/chan_status_manager.go | Start | func (m *ChanStatusManager) Start() error {
if !atomic.CompareAndSwapUint32(&m.started, 0, 1) {
return nil
}
channels, err := m.fetchChannels()
if err != nil {
return err
}
// Populate the initial states of all confirmed, public channels.
for _, c := range channels {
_, err := m.getOrInitChanStatus(c.Fun... | go | func (m *ChanStatusManager) Start() error {
if !atomic.CompareAndSwapUint32(&m.started, 0, 1) {
return nil
}
channels, err := m.fetchChannels()
if err != nil {
return err
}
// Populate the initial states of all confirmed, public channels.
for _, c := range channels {
_, err := m.getOrInitChanStatus(c.Fun... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"Start",
"(",
")",
"error",
"{",
"if",
"!",
"atomic",
".",
"CompareAndSwapUint32",
"(",
"&",
"m",
".",
"started",
",",
"0",
",",
"1",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"channels",
",",
"e... | // Start safely starts the ChanStatusManager. | [
"Start",
"safely",
"starts",
"the",
"ChanStatusManager",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L157-L191 |
129,220 | lightningnetwork/lnd | netann/chan_status_manager.go | Stop | func (m *ChanStatusManager) Stop() error {
if !atomic.CompareAndSwapUint32(&m.stopped, 0, 1) {
return nil
}
close(m.quit)
m.wg.Wait()
return nil
} | go | func (m *ChanStatusManager) Stop() error {
if !atomic.CompareAndSwapUint32(&m.stopped, 0, 1) {
return nil
}
close(m.quit)
m.wg.Wait()
return nil
} | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"Stop",
"(",
")",
"error",
"{",
"if",
"!",
"atomic",
".",
"CompareAndSwapUint32",
"(",
"&",
"m",
".",
"stopped",
",",
"0",
",",
"1",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"close",
"(",
"m",
... | // Stop safely shuts down the ChanStatusManager. | [
"Stop",
"safely",
"shuts",
"down",
"the",
"ChanStatusManager",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L194-L203 |
129,221 | lightningnetwork/lnd | netann/chan_status_manager.go | RequestDisable | func (m *ChanStatusManager) RequestDisable(outpoint wire.OutPoint) error {
return m.submitRequest(m.disableRequests, outpoint)
} | go | func (m *ChanStatusManager) RequestDisable(outpoint wire.OutPoint) error {
return m.submitRequest(m.disableRequests, outpoint)
} | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"RequestDisable",
"(",
"outpoint",
"wire",
".",
"OutPoint",
")",
"error",
"{",
"return",
"m",
".",
"submitRequest",
"(",
"m",
".",
"disableRequests",
",",
"outpoint",
")",
"\n",
"}"
] | // RequestDisable submits a request to immediately disable a channel identified
// by the provided outpoint. If the channel is already disabled, no action will
// be taken. Otherwise, a new announcement will be signed with the disabled bit
// set and broadcast to the network. | [
"RequestDisable",
"submits",
"a",
"request",
"to",
"immediately",
"disable",
"a",
"channel",
"identified",
"by",
"the",
"provided",
"outpoint",
".",
"If",
"the",
"channel",
"is",
"already",
"disabled",
"no",
"action",
"will",
"be",
"taken",
".",
"Otherwise",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L224-L226 |
129,222 | lightningnetwork/lnd | netann/chan_status_manager.go | submitRequest | func (m *ChanStatusManager) submitRequest(reqChan chan statusRequest,
outpoint wire.OutPoint) error {
req := statusRequest{
outpoint: outpoint,
errChan: make(chan error, 1),
}
select {
case reqChan <- req:
case <-m.quit:
return ErrChanStatusManagerExiting
}
select {
case err := <-req.errChan:
retur... | go | func (m *ChanStatusManager) submitRequest(reqChan chan statusRequest,
outpoint wire.OutPoint) error {
req := statusRequest{
outpoint: outpoint,
errChan: make(chan error, 1),
}
select {
case reqChan <- req:
case <-m.quit:
return ErrChanStatusManagerExiting
}
select {
case err := <-req.errChan:
retur... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"submitRequest",
"(",
"reqChan",
"chan",
"statusRequest",
",",
"outpoint",
"wire",
".",
"OutPoint",
")",
"error",
"{",
"req",
":=",
"statusRequest",
"{",
"outpoint",
":",
"outpoint",
",",
"errChan",
":",
"make... | // submitRequest sends a request for either enabling or disabling a particular
// outpoint and awaits an error response. The request type is dictated by the
// reqChan passed in, which can be either of the enableRequests or
// disableRequests channels. | [
"submitRequest",
"sends",
"a",
"request",
"for",
"either",
"enabling",
"or",
"disabling",
"a",
"particular",
"outpoint",
"and",
"awaits",
"an",
"error",
"response",
".",
"The",
"request",
"type",
"is",
"dictated",
"by",
"the",
"reqChan",
"passed",
"in",
"which... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L240-L260 |
129,223 | lightningnetwork/lnd | netann/chan_status_manager.go | processEnableRequest | func (m *ChanStatusManager) processEnableRequest(outpoint wire.OutPoint) error {
curState, err := m.getOrInitChanStatus(outpoint)
if err != nil {
return err
}
// Quickly check to see if the requested channel is active within the
// htlcswitch and return an error if it isn't.
chanID := lnwire.NewChanIDFromOutPo... | go | func (m *ChanStatusManager) processEnableRequest(outpoint wire.OutPoint) error {
curState, err := m.getOrInitChanStatus(outpoint)
if err != nil {
return err
}
// Quickly check to see if the requested channel is active within the
// htlcswitch and return an error if it isn't.
chanID := lnwire.NewChanIDFromOutPo... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"processEnableRequest",
"(",
"outpoint",
"wire",
".",
"OutPoint",
")",
"error",
"{",
"curState",
",",
"err",
":=",
"m",
".",
"getOrInitChanStatus",
"(",
"outpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // processEnableRequest attempts to enable the given outpoint. If the method
// returns nil, the status of the channel in chanStates will be
// ChanStatusEnabled. If the channel is not active at the time of the request,
// ErrEnableInactiveChan will be returned. An update will be broadcast only if
// the channel is cur... | [
"processEnableRequest",
"attempts",
"to",
"enable",
"the",
"given",
"outpoint",
".",
"If",
"the",
"method",
"returns",
"nil",
"the",
"status",
"of",
"the",
"channel",
"in",
"chanStates",
"will",
"be",
"ChanStatusEnabled",
".",
"If",
"the",
"channel",
"is",
"no... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L310-L348 |
129,224 | lightningnetwork/lnd | netann/chan_status_manager.go | processDisableRequest | func (m *ChanStatusManager) processDisableRequest(outpoint wire.OutPoint) error {
curState, err := m.getOrInitChanStatus(outpoint)
if err != nil {
return err
}
switch curState.Status {
// Channel is already disabled, nothing to do.
case ChanStatusDisabled:
return nil
// We'll sign a new update disabling t... | go | func (m *ChanStatusManager) processDisableRequest(outpoint wire.OutPoint) error {
curState, err := m.getOrInitChanStatus(outpoint)
if err != nil {
return err
}
switch curState.Status {
// Channel is already disabled, nothing to do.
case ChanStatusDisabled:
return nil
// We'll sign a new update disabling t... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"processDisableRequest",
"(",
"outpoint",
"wire",
".",
"OutPoint",
")",
"error",
"{",
"curState",
",",
"err",
":=",
"m",
".",
"getOrInitChanStatus",
"(",
"outpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // processDisableRequest attempts to disable the given outpoint. If the method
// returns nil, the status of the channel in chanStates will be
// ChanStatusDisabled. An update will only be sent if the channel has a status
// other than ChanStatusEnabled, otherwise no update will be sent on the
// network. | [
"processDisableRequest",
"attempts",
"to",
"disable",
"the",
"given",
"outpoint",
".",
"If",
"the",
"method",
"returns",
"nil",
"the",
"status",
"of",
"the",
"channel",
"in",
"chanStates",
"will",
"be",
"ChanStatusDisabled",
".",
"An",
"update",
"will",
"only",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L355-L388 |
129,225 | lightningnetwork/lnd | netann/chan_status_manager.go | markPendingInactiveChannels | func (m *ChanStatusManager) markPendingInactiveChannels() {
channels, err := m.fetchChannels()
if err != nil {
log.Errorf("Unable to load active channels: %v", err)
return
}
for _, c := range channels {
// Determine the initial status of the active channel, and
// populate the entry in the chanStates map.
... | go | func (m *ChanStatusManager) markPendingInactiveChannels() {
channels, err := m.fetchChannels()
if err != nil {
log.Errorf("Unable to load active channels: %v", err)
return
}
for _, c := range channels {
// Determine the initial status of the active channel, and
// populate the entry in the chanStates map.
... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"markPendingInactiveChannels",
"(",
")",
"{",
"channels",
",",
"err",
":=",
"m",
".",
"fetchChannels",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
... | // markPendingInactiveChannels performs a sweep of the database's active
// channels and determines which, if any, should have a disable announcement
// scheduled. Once an active channel is determined to be pending-inactive, one
// of two transitions can follow. Either the channel is disabled because no
// request to e... | [
"markPendingInactiveChannels",
"performs",
"a",
"sweep",
"of",
"the",
"database",
"s",
"active",
"channels",
"and",
"determines",
"which",
"if",
"any",
"should",
"have",
"a",
"disable",
"announcement",
"scheduled",
".",
"Once",
"an",
"active",
"channel",
"is",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L397-L441 |
129,226 | lightningnetwork/lnd | netann/chan_status_manager.go | disableInactiveChannels | func (m *ChanStatusManager) disableInactiveChannels() {
// Now, disable any channels whose inactive chan timeout has elapsed.
now := time.Now()
for outpoint, state := range m.chanStates {
// Ignore statuses that are not in the pending-inactive state.
if state.Status != ChanStatusPendingDisabled {
continue
}... | go | func (m *ChanStatusManager) disableInactiveChannels() {
// Now, disable any channels whose inactive chan timeout has elapsed.
now := time.Now()
for outpoint, state := range m.chanStates {
// Ignore statuses that are not in the pending-inactive state.
if state.Status != ChanStatusPendingDisabled {
continue
}... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"disableInactiveChannels",
"(",
")",
"{",
"// Now, disable any channels whose inactive chan timeout has elapsed.",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"outpoint",
",",
"state",
":=",
"range",
"m",
... | // disableInactiveChannels scans through the set of monitored channels, and
// broadcast a disable update for any pending inactive channels whose
// SendDisableTime has been superseded by the current time. | [
"disableInactiveChannels",
"scans",
"through",
"the",
"set",
"of",
"monitored",
"channels",
"and",
"broadcast",
"a",
"disable",
"update",
"for",
"any",
"pending",
"inactive",
"channels",
"whose",
"SendDisableTime",
"has",
"been",
"superseded",
"by",
"the",
"current"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L446-L487 |
129,227 | lightningnetwork/lnd | netann/chan_status_manager.go | fetchChannels | func (m *ChanStatusManager) fetchChannels() ([]*channeldb.OpenChannel, error) {
allChannels, err := m.cfg.DB.FetchAllOpenChannels()
if err != nil {
return nil, err
}
// Filter out private channels.
var channels []*channeldb.OpenChannel
for _, c := range allChannels {
// We'll skip any private channels, as th... | go | func (m *ChanStatusManager) fetchChannels() ([]*channeldb.OpenChannel, error) {
allChannels, err := m.cfg.DB.FetchAllOpenChannels()
if err != nil {
return nil, err
}
// Filter out private channels.
var channels []*channeldb.OpenChannel
for _, c := range allChannels {
// We'll skip any private channels, as th... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"fetchChannels",
"(",
")",
"(",
"[",
"]",
"*",
"channeldb",
".",
"OpenChannel",
",",
"error",
")",
"{",
"allChannels",
",",
"err",
":=",
"m",
".",
"cfg",
".",
"DB",
".",
"FetchAllOpenChannels",
"(",
")",... | // fetchChannels returns the working set of channels managed by the
// ChanStatusManager. The returned channels are filtered to only contain public
// channels. | [
"fetchChannels",
"returns",
"the",
"working",
"set",
"of",
"channels",
"managed",
"by",
"the",
"ChanStatusManager",
".",
"The",
"returned",
"channels",
"are",
"filtered",
"to",
"only",
"contain",
"public",
"channels",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L492-L511 |
129,228 | lightningnetwork/lnd | netann/chan_status_manager.go | signAndSendNextUpdate | func (m *ChanStatusManager) signAndSendNextUpdate(outpoint wire.OutPoint,
disabled bool) error {
// Retrieve the latest update for this channel. We'll use this
// as our starting point to send the new update.
chanUpdate, err := m.fetchLastChanUpdateByOutPoint(outpoint)
if err != nil {
return err
}
err = Sign... | go | func (m *ChanStatusManager) signAndSendNextUpdate(outpoint wire.OutPoint,
disabled bool) error {
// Retrieve the latest update for this channel. We'll use this
// as our starting point to send the new update.
chanUpdate, err := m.fetchLastChanUpdateByOutPoint(outpoint)
if err != nil {
return err
}
err = Sign... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"signAndSendNextUpdate",
"(",
"outpoint",
"wire",
".",
"OutPoint",
",",
"disabled",
"bool",
")",
"error",
"{",
"// Retrieve the latest update for this channel. We'll use this",
"// as our starting point to send the new update.",
... | // signAndSendNextUpdate computes and signs a valid update for the passed
// outpoint, with the ability to toggle the disabled bit. The new update will
// use the current time as the update's timestamp, or increment the old
// timestamp by 1 to ensure the update can propagate. If signing is successful,
// the new updat... | [
"signAndSendNextUpdate",
"computes",
"and",
"signs",
"a",
"valid",
"update",
"for",
"the",
"passed",
"outpoint",
"with",
"the",
"ability",
"to",
"toggle",
"the",
"disabled",
"bit",
".",
"The",
"new",
"update",
"will",
"use",
"the",
"current",
"time",
"as",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L518-L537 |
129,229 | lightningnetwork/lnd | netann/chan_status_manager.go | fetchLastChanUpdateByOutPoint | func (m *ChanStatusManager) fetchLastChanUpdateByOutPoint(op wire.OutPoint) (
*lnwire.ChannelUpdate, error) {
// Get the edge info and policies for this channel from the graph.
info, edge1, edge2, err := m.cfg.Graph.FetchChannelEdgesByOutpoint(&op)
if err != nil {
return nil, err
}
return ExtractChannelUpdate... | go | func (m *ChanStatusManager) fetchLastChanUpdateByOutPoint(op wire.OutPoint) (
*lnwire.ChannelUpdate, error) {
// Get the edge info and policies for this channel from the graph.
info, edge1, edge2, err := m.cfg.Graph.FetchChannelEdgesByOutpoint(&op)
if err != nil {
return nil, err
}
return ExtractChannelUpdate... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"fetchLastChanUpdateByOutPoint",
"(",
"op",
"wire",
".",
"OutPoint",
")",
"(",
"*",
"lnwire",
".",
"ChannelUpdate",
",",
"error",
")",
"{",
"// Get the edge info and policies for this channel from the graph.",
"info",
"... | // fetchLastChanUpdateByOutPoint fetches the latest policy for our direction of
// a channel, and crafts a new ChannelUpdate with this policy. Returns an error
// in case our ChannelEdgePolicy is not found in the database. | [
"fetchLastChanUpdateByOutPoint",
"fetches",
"the",
"latest",
"policy",
"for",
"our",
"direction",
"of",
"a",
"channel",
"and",
"crafts",
"a",
"new",
"ChannelUpdate",
"with",
"this",
"policy",
".",
"Returns",
"an",
"error",
"in",
"case",
"our",
"ChannelEdgePolicy",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L542-L552 |
129,230 | lightningnetwork/lnd | netann/chan_status_manager.go | loadInitialChanState | func (m *ChanStatusManager) loadInitialChanState(
outpoint *wire.OutPoint) (ChannelState, error) {
lastUpdate, err := m.fetchLastChanUpdateByOutPoint(*outpoint)
if err != nil {
return ChannelState{}, err
}
// Determine the channel's starting status by inspecting the disable bit
// on last announcement we sent... | go | func (m *ChanStatusManager) loadInitialChanState(
outpoint *wire.OutPoint) (ChannelState, error) {
lastUpdate, err := m.fetchLastChanUpdateByOutPoint(*outpoint)
if err != nil {
return ChannelState{}, err
}
// Determine the channel's starting status by inspecting the disable bit
// on last announcement we sent... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"loadInitialChanState",
"(",
"outpoint",
"*",
"wire",
".",
"OutPoint",
")",
"(",
"ChannelState",
",",
"error",
")",
"{",
"lastUpdate",
",",
"err",
":=",
"m",
".",
"fetchLastChanUpdateByOutPoint",
"(",
"*",
"ou... | // loadInitialChanState determines the initial ChannelState for a particular
// outpoint. The initial ChanStatus for a given outpoint will either be
// ChanStatusEnabled or ChanStatusDisabled, determined by inspecting the bits on
// the most recent announcement. An error is returned if the latest update could
// not be... | [
"loadInitialChanState",
"determines",
"the",
"initial",
"ChannelState",
"for",
"a",
"particular",
"outpoint",
".",
"The",
"initial",
"ChanStatus",
"for",
"a",
"given",
"outpoint",
"will",
"either",
"be",
"ChanStatusEnabled",
"or",
"ChanStatusDisabled",
"determined",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L559-L579 |
129,231 | lightningnetwork/lnd | netann/chan_status_manager.go | getOrInitChanStatus | func (m *ChanStatusManager) getOrInitChanStatus(
outpoint wire.OutPoint) (ChannelState, error) {
// Return the current ChannelState from the chanStates map if it is
// already known to the ChanStatusManager.
if curState, ok := m.chanStates[outpoint]; ok {
return curState, nil
}
// Otherwise, determine the ini... | go | func (m *ChanStatusManager) getOrInitChanStatus(
outpoint wire.OutPoint) (ChannelState, error) {
// Return the current ChannelState from the chanStates map if it is
// already known to the ChanStatusManager.
if curState, ok := m.chanStates[outpoint]; ok {
return curState, nil
}
// Otherwise, determine the ini... | [
"func",
"(",
"m",
"*",
"ChanStatusManager",
")",
"getOrInitChanStatus",
"(",
"outpoint",
"wire",
".",
"OutPoint",
")",
"(",
"ChannelState",
",",
"error",
")",
"{",
"// Return the current ChannelState from the chanStates map if it is",
"// already known to the ChanStatusManage... | // getOrInitChanStatus retrieves the current ChannelState for a particular
// outpoint. If the chanStates map already contains an entry for the outpoint,
// the value in the map is returned. Otherwise, the outpoint's initial status is
// computed and updated in the chanStates map before being returned. | [
"getOrInitChanStatus",
"retrieves",
"the",
"current",
"ChannelState",
"for",
"a",
"particular",
"outpoint",
".",
"If",
"the",
"chanStates",
"map",
"already",
"contains",
"an",
"entry",
"for",
"the",
"outpoint",
"the",
"value",
"in",
"the",
"map",
"is",
"returned... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/netann/chan_status_manager.go#L585-L607 |
129,232 | lightningnetwork/lnd | server.go | parseAddr | func parseAddr(address string) (net.Addr, error) {
var (
host string
port int
)
// Split the address into its host and port components.
h, p, err := net.SplitHostPort(address)
if err != nil {
// If a port wasn't specified, we'll assume the address only
// contains the host so we'll use the default port.
... | go | func parseAddr(address string) (net.Addr, error) {
var (
host string
port int
)
// Split the address into its host and port components.
h, p, err := net.SplitHostPort(address)
if err != nil {
// If a port wasn't specified, we'll assume the address only
// contains the host so we'll use the default port.
... | [
"func",
"parseAddr",
"(",
"address",
"string",
")",
"(",
"net",
".",
"Addr",
",",
"error",
")",
"{",
"var",
"(",
"host",
"string",
"\n",
"port",
"int",
"\n",
")",
"\n\n",
"// Split the address into its host and port components.",
"h",
",",
"p",
",",
"err",
... | // parseAddr parses an address from its string format to a net.Addr. | [
"parseAddr",
"parses",
"an",
"address",
"from",
"its",
"string",
"format",
"to",
"a",
"net",
".",
"Addr",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L234-L267 |
129,233 | lightningnetwork/lnd | server.go | noiseDial | func noiseDial(idPriv *btcec.PrivateKey) func(net.Addr) (net.Conn, error) {
return func(a net.Addr) (net.Conn, error) {
lnAddr := a.(*lnwire.NetAddress)
return brontide.Dial(idPriv, lnAddr, cfg.net.Dial)
}
} | go | func noiseDial(idPriv *btcec.PrivateKey) func(net.Addr) (net.Conn, error) {
return func(a net.Addr) (net.Conn, error) {
lnAddr := a.(*lnwire.NetAddress)
return brontide.Dial(idPriv, lnAddr, cfg.net.Dial)
}
} | [
"func",
"noiseDial",
"(",
"idPriv",
"*",
"btcec",
".",
"PrivateKey",
")",
"func",
"(",
"net",
".",
"Addr",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"func",
"(",
"a",
"net",
".",
"Addr",
")",
"(",
"net",
".",
"Conn",
",",
... | // noiseDial is a factory function which creates a connmgr compliant dialing
// function by returning a closure which includes the server's identity key. | [
"noiseDial",
"is",
"a",
"factory",
"function",
"which",
"creates",
"a",
"connmgr",
"compliant",
"dialing",
"function",
"by",
"returning",
"a",
"closure",
"which",
"includes",
"the",
"server",
"s",
"identity",
"key",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L271-L276 |
129,234 | lightningnetwork/lnd | server.go | initNetworkBootstrappers | func initNetworkBootstrappers(s *server) ([]discovery.NetworkPeerBootstrapper, error) {
srvrLog.Infof("Initializing peer network bootstrappers!")
var bootStrappers []discovery.NetworkPeerBootstrapper
// First, we'll create an instance of the ChannelGraphBootstrapper as
// this can be used by default if we've alre... | go | func initNetworkBootstrappers(s *server) ([]discovery.NetworkPeerBootstrapper, error) {
srvrLog.Infof("Initializing peer network bootstrappers!")
var bootStrappers []discovery.NetworkPeerBootstrapper
// First, we'll create an instance of the ChannelGraphBootstrapper as
// this can be used by default if we've alre... | [
"func",
"initNetworkBootstrappers",
"(",
"s",
"*",
"server",
")",
"(",
"[",
"]",
"discovery",
".",
"NetworkPeerBootstrapper",
",",
"error",
")",
"{",
"srvrLog",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"var",
"bootStrappers",
"[",
"]",
"discovery",
".",... | // initNetworkBootstrappers initializes a set of network peer bootstrappers
// based on the server, and currently active bootstrap mechanisms as defined
// within the current configuration. | [
"initNetworkBootstrappers",
"initializes",
"a",
"set",
"of",
"network",
"peer",
"bootstrappers",
"based",
"on",
"the",
"server",
"and",
"currently",
"active",
"bootstrap",
"mechanisms",
"as",
"defined",
"within",
"the",
"current",
"configuration",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L1482-L1516 |
129,235 | lightningnetwork/lnd | server.go | peerBootstrapper | func (s *server) peerBootstrapper(numTargetPeers uint32,
bootstrappers []discovery.NetworkPeerBootstrapper) {
defer s.wg.Done()
// ignore is a set used to keep track of peers already retrieved from
// our bootstrappers in order to avoid duplicates.
ignore := make(map[autopilot.NodeID]struct{})
// We'll start o... | go | func (s *server) peerBootstrapper(numTargetPeers uint32,
bootstrappers []discovery.NetworkPeerBootstrapper) {
defer s.wg.Done()
// ignore is a set used to keep track of peers already retrieved from
// our bootstrappers in order to avoid duplicates.
ignore := make(map[autopilot.NodeID]struct{})
// We'll start o... | [
"func",
"(",
"s",
"*",
"server",
")",
"peerBootstrapper",
"(",
"numTargetPeers",
"uint32",
",",
"bootstrappers",
"[",
"]",
"discovery",
".",
"NetworkPeerBootstrapper",
")",
"{",
"defer",
"s",
".",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"// ignore is a set used t... | // peerBootstrapper is a goroutine which is tasked with attempting to establish
// and maintain a target minimum number of outbound connections. With this
// invariant, we ensure that our node is connected to a diverse set of peers
// and that nodes newly joining the network receive an up to date network view
// as soo... | [
"peerBootstrapper",
"is",
"a",
"goroutine",
"which",
"is",
"tasked",
"with",
"attempting",
"to",
"establish",
"and",
"maintain",
"a",
"target",
"minimum",
"number",
"of",
"outbound",
"connections",
".",
"With",
"this",
"invariant",
"we",
"ensure",
"that",
"our",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L1523-L1652 |
129,236 | lightningnetwork/lnd | server.go | initialPeerBootstrap | func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{},
numTargetPeers uint32, bootstrappers []discovery.NetworkPeerBootstrapper) {
var wg sync.WaitGroup
for {
// Check if the server has been requested to shut down in order
// to prevent blocking.
if s.Stopped() {
return
}
// We c... | go | func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{},
numTargetPeers uint32, bootstrappers []discovery.NetworkPeerBootstrapper) {
var wg sync.WaitGroup
for {
// Check if the server has been requested to shut down in order
// to prevent blocking.
if s.Stopped() {
return
}
// We c... | [
"func",
"(",
"s",
"*",
"server",
")",
"initialPeerBootstrap",
"(",
"ignore",
"map",
"[",
"autopilot",
".",
"NodeID",
"]",
"struct",
"{",
"}",
",",
"numTargetPeers",
"uint32",
",",
"bootstrappers",
"[",
"]",
"discovery",
".",
"NetworkPeerBootstrapper",
")",
"... | // initialPeerBootstrap attempts to continuously connect to peers on startup
// until the target number of peers has been reached. This ensures that nodes
// receive an up to date network view as soon as possible. | [
"initialPeerBootstrap",
"attempts",
"to",
"continuously",
"connect",
"to",
"peers",
"on",
"startup",
"until",
"the",
"target",
"number",
"of",
"peers",
"has",
"been",
"reached",
".",
"This",
"ensures",
"that",
"nodes",
"receive",
"an",
"up",
"to",
"date",
"net... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L1657-L1726 |
129,237 | lightningnetwork/lnd | server.go | initTorController | func (s *server) initTorController() error {
if err := s.torController.Start(); err != nil {
return err
}
// Determine the different ports the server is listening on. The onion
// service's virtual port will map to these ports and one will be picked
// at random when the onion service is being accessed.
listen... | go | func (s *server) initTorController() error {
if err := s.torController.Start(); err != nil {
return err
}
// Determine the different ports the server is listening on. The onion
// service's virtual port will map to these ports and one will be picked
// at random when the onion service is being accessed.
listen... | [
"func",
"(",
"s",
"*",
"server",
")",
"initTorController",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"s",
".",
"torController",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Determine the different ports t... | // initTorController initiliazes the Tor controller backed by lnd and
// automatically sets up a v2 onion service in order to listen for inbound
// connections over Tor. | [
"initTorController",
"initiliazes",
"the",
"Tor",
"controller",
"backed",
"by",
"lnd",
"and",
"automatically",
"sets",
"up",
"a",
"v2",
"onion",
"service",
"in",
"order",
"to",
"listen",
"for",
"inbound",
"connections",
"over",
"Tor",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L1731-L1797 |
129,238 | lightningnetwork/lnd | server.go | genNodeAnnouncement | func (s *server) genNodeAnnouncement(refresh bool,
updates ...func(*lnwire.NodeAnnouncement)) (lnwire.NodeAnnouncement, error) {
s.mu.Lock()
defer s.mu.Unlock()
// If we don't need to refresh the announcement, then we can return a
// copy of our cached version.
if !refresh {
return *s.currentNodeAnn, nil
}
... | go | func (s *server) genNodeAnnouncement(refresh bool,
updates ...func(*lnwire.NodeAnnouncement)) (lnwire.NodeAnnouncement, error) {
s.mu.Lock()
defer s.mu.Unlock()
// If we don't need to refresh the announcement, then we can return a
// copy of our cached version.
if !refresh {
return *s.currentNodeAnn, nil
}
... | [
"func",
"(",
"s",
"*",
"server",
")",
"genNodeAnnouncement",
"(",
"refresh",
"bool",
",",
"updates",
"...",
"func",
"(",
"*",
"lnwire",
".",
"NodeAnnouncement",
")",
")",
"(",
"lnwire",
".",
"NodeAnnouncement",
",",
"error",
")",
"{",
"s",
".",
"mu",
"... | // genNodeAnnouncement generates and returns the current fully signed node
// announcement. If refresh is true, then the time stamp of the announcement
// will be updated in order to ensure it propagates through the network. | [
"genNodeAnnouncement",
"generates",
"and",
"returns",
"the",
"current",
"fully",
"signed",
"node",
"announcement",
".",
"If",
"refresh",
"is",
"true",
"then",
"the",
"time",
"stamp",
"of",
"the",
"announcement",
"will",
"be",
"updated",
"in",
"order",
"to",
"e... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L1802-L1844 |
129,239 | lightningnetwork/lnd | server.go | prunePersistentPeerConnection | func (s *server) prunePersistentPeerConnection(compressedPubKey [33]byte) {
srvrLog.Infof("Pruning peer %x from persistent connections, number of "+
"open channels is now zero", compressedPubKey)
pubKeyStr := string(compressedPubKey[:])
s.mu.Lock()
delete(s.persistentPeers, pubKeyStr)
delete(s.persistentPeersB... | go | func (s *server) prunePersistentPeerConnection(compressedPubKey [33]byte) {
srvrLog.Infof("Pruning peer %x from persistent connections, number of "+
"open channels is now zero", compressedPubKey)
pubKeyStr := string(compressedPubKey[:])
s.mu.Lock()
delete(s.persistentPeers, pubKeyStr)
delete(s.persistentPeersB... | [
"func",
"(",
"s",
"*",
"server",
")",
"prunePersistentPeerConnection",
"(",
"compressedPubKey",
"[",
"33",
"]",
"byte",
")",
"{",
"srvrLog",
".",
"Infof",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"compressedPubKey",
")",
"\n\n",
"pubKeyStr",
":=",
"string",
... | // prunePersistentPeerConnection removes all internal state related to
// persistent connections to a peer within the server. This is used to avoid
// persistent connection retries to peers we do not have any open channels with. | [
"prunePersistentPeerConnection",
"removes",
"all",
"internal",
"state",
"related",
"to",
"persistent",
"connections",
"to",
"a",
"peer",
"within",
"the",
"server",
".",
"This",
"is",
"used",
"to",
"avoid",
"persistent",
"connection",
"retries",
"to",
"peers",
"we"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2048-L2059 |
129,240 | lightningnetwork/lnd | server.go | NotifyWhenOffline | func (s *server) NotifyWhenOffline(peerPubKey [33]byte) <-chan struct{} {
s.mu.Lock()
defer s.mu.Unlock()
c := make(chan struct{})
// If the peer is already offline, we can immediately trigger the
// notification.
peerPubKeyStr := string(peerPubKey[:])
if _, ok := s.peersByPub[peerPubKeyStr]; !ok {
srvrLog.D... | go | func (s *server) NotifyWhenOffline(peerPubKey [33]byte) <-chan struct{} {
s.mu.Lock()
defer s.mu.Unlock()
c := make(chan struct{})
// If the peer is already offline, we can immediately trigger the
// notification.
peerPubKeyStr := string(peerPubKey[:])
if _, ok := s.peersByPub[peerPubKeyStr]; !ok {
srvrLog.D... | [
"func",
"(",
"s",
"*",
"server",
")",
"NotifyWhenOffline",
"(",
"peerPubKey",
"[",
"33",
"]",
"byte",
")",
"<-",
"chan",
"struct",
"{",
"}",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n... | // NotifyWhenOffline delivers a notification to the caller of when the peer with
// the given public key has been disconnected. The notification is signaled by
// closing the channel returned. | [
"NotifyWhenOffline",
"delivers",
"a",
"notification",
"to",
"the",
"caller",
"of",
"when",
"the",
"peer",
"with",
"the",
"given",
"public",
"key",
"has",
"been",
"disconnected",
".",
"The",
"notification",
"is",
"signaled",
"by",
"closing",
"the",
"channel",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2150-L2173 |
129,241 | lightningnetwork/lnd | server.go | findPeerByPubStr | func (s *server) findPeerByPubStr(pubStr string) (*peer, error) {
peer, ok := s.peersByPub[pubStr]
if !ok {
return nil, ErrPeerNotConnected
}
return peer, nil
} | go | func (s *server) findPeerByPubStr(pubStr string) (*peer, error) {
peer, ok := s.peersByPub[pubStr]
if !ok {
return nil, ErrPeerNotConnected
}
return peer, nil
} | [
"func",
"(",
"s",
"*",
"server",
")",
"findPeerByPubStr",
"(",
"pubStr",
"string",
")",
"(",
"*",
"peer",
",",
"error",
")",
"{",
"peer",
",",
"ok",
":=",
"s",
".",
"peersByPub",
"[",
"pubStr",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",... | // findPeerByPubStr is an internal method that retrieves the specified peer from
// the server's internal state using. | [
"findPeerByPubStr",
"is",
"an",
"internal",
"method",
"that",
"retrieves",
"the",
"specified",
"peer",
"from",
"the",
"server",
"s",
"internal",
"state",
"using",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2203-L2210 |
129,242 | lightningnetwork/lnd | server.go | nextPeerBackoff | func (s *server) nextPeerBackoff(pubStr string,
startTime time.Time) time.Duration {
// Now, determine the appropriate backoff to use for the retry.
backoff, ok := s.persistentPeersBackoff[pubStr]
if !ok {
// If an existing backoff was unknown, use the default.
return cfg.MinBackoff
}
// If the peer failed ... | go | func (s *server) nextPeerBackoff(pubStr string,
startTime time.Time) time.Duration {
// Now, determine the appropriate backoff to use for the retry.
backoff, ok := s.persistentPeersBackoff[pubStr]
if !ok {
// If an existing backoff was unknown, use the default.
return cfg.MinBackoff
}
// If the peer failed ... | [
"func",
"(",
"s",
"*",
"server",
")",
"nextPeerBackoff",
"(",
"pubStr",
"string",
",",
"startTime",
"time",
".",
"Time",
")",
"time",
".",
"Duration",
"{",
"// Now, determine the appropriate backoff to use for the retry.",
"backoff",
",",
"ok",
":=",
"s",
".",
"... | // nextPeerBackoff computes the next backoff duration for a peer's pubkey using
// exponential backoff. If no previous backoff was known, the default is
// returned. | [
"nextPeerBackoff",
"computes",
"the",
"next",
"backoff",
"duration",
"for",
"a",
"peer",
"s",
"pubkey",
"using",
"exponential",
"backoff",
".",
"If",
"no",
"previous",
"backoff",
"was",
"known",
"the",
"default",
"is",
"returned",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2215-L2255 |
129,243 | lightningnetwork/lnd | server.go | shouldDropLocalConnection | func shouldDropLocalConnection(local, remote *btcec.PublicKey) bool {
localPubBytes := local.SerializeCompressed()
remotePubPbytes := remote.SerializeCompressed()
// The connection that comes from the node with a "smaller" pubkey
// should be kept. Therefore, if our pubkey is "greater" than theirs, we
// should d... | go | func shouldDropLocalConnection(local, remote *btcec.PublicKey) bool {
localPubBytes := local.SerializeCompressed()
remotePubPbytes := remote.SerializeCompressed()
// The connection that comes from the node with a "smaller" pubkey
// should be kept. Therefore, if our pubkey is "greater" than theirs, we
// should d... | [
"func",
"shouldDropLocalConnection",
"(",
"local",
",",
"remote",
"*",
"btcec",
".",
"PublicKey",
")",
"bool",
"{",
"localPubBytes",
":=",
"local",
".",
"SerializeCompressed",
"(",
")",
"\n",
"remotePubPbytes",
":=",
"remote",
".",
"SerializeCompressed",
"(",
")... | // shouldDropConnection determines if our local connection to a remote peer
// should be dropped in the case of concurrent connection establishment. In
// order to deterministically decide which connection should be dropped, we'll
// utilize the ordering of the local and remote public key. If we didn't use
// such a ti... | [
"shouldDropConnection",
"determines",
"if",
"our",
"local",
"connection",
"to",
"a",
"remote",
"peer",
"should",
"be",
"dropped",
"in",
"the",
"case",
"of",
"concurrent",
"connection",
"establishment",
".",
"In",
"order",
"to",
"deterministically",
"decide",
"whic... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2263-L2271 |
129,244 | lightningnetwork/lnd | server.go | cancelConnReqs | func (s *server) cancelConnReqs(pubStr string, skip *uint64) {
// First, cancel any lingering persistent retry attempts, which will
// prevent retries for any with backoffs that are still maturing.
if cancelChan, ok := s.persistentRetryCancels[pubStr]; ok {
close(cancelChan)
delete(s.persistentRetryCancels, pubS... | go | func (s *server) cancelConnReqs(pubStr string, skip *uint64) {
// First, cancel any lingering persistent retry attempts, which will
// prevent retries for any with backoffs that are still maturing.
if cancelChan, ok := s.persistentRetryCancels[pubStr]; ok {
close(cancelChan)
delete(s.persistentRetryCancels, pubS... | [
"func",
"(",
"s",
"*",
"server",
")",
"cancelConnReqs",
"(",
"pubStr",
"string",
",",
"skip",
"*",
"uint64",
")",
"{",
"// First, cancel any lingering persistent retry attempts, which will",
"// prevent retries for any with backoffs that are still maturing.",
"if",
"cancelChan"... | // cancelConnReqs stops all persistent connection requests for a given pubkey.
// Any attempts initiated by the peerTerminationWatcher are canceled first.
// Afterwards, each connection request removed from the connmgr. The caller can
// optionally specify a connection ID to ignore, which prevents us from
// canceling ... | [
"cancelConnReqs",
"stops",
"all",
"persistent",
"connection",
"requests",
"for",
"a",
"given",
"pubkey",
".",
"Any",
"attempts",
"initiated",
"by",
"the",
"peerTerminationWatcher",
"are",
"canceled",
"first",
".",
"Afterwards",
"each",
"connection",
"request",
"remo... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2485-L2520 |
129,245 | lightningnetwork/lnd | server.go | peerConnected | func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
inbound bool) {
brontideConn := conn.(*brontide.Conn)
addr := conn.RemoteAddr()
pubKey := brontideConn.RemotePub()
srvrLog.Infof("Finalizing connection to %x@%s, inbound=%v",
pubKey.SerializeCompressed(), addr, inbound)
peerAddr := &lnwi... | go | func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
inbound bool) {
brontideConn := conn.(*brontide.Conn)
addr := conn.RemoteAddr()
pubKey := brontideConn.RemotePub()
srvrLog.Infof("Finalizing connection to %x@%s, inbound=%v",
pubKey.SerializeCompressed(), addr, inbound)
peerAddr := &lnwi... | [
"func",
"(",
"s",
"*",
"server",
")",
"peerConnected",
"(",
"conn",
"net",
".",
"Conn",
",",
"connReq",
"*",
"connmgr",
".",
"ConnReq",
",",
"inbound",
"bool",
")",
"{",
"brontideConn",
":=",
"conn",
".",
"(",
"*",
"brontide",
".",
"Conn",
")",
"\n",... | // peerConnected is a function that handles initialization a newly connected
// peer by adding it to the server's global list of all active peers, and
// starting all the goroutines the peer needs to function properly. The inbound
// boolean should be true if the peer initiated the connection to us. | [
"peerConnected",
"is",
"a",
"function",
"that",
"handles",
"initialization",
"a",
"newly",
"connected",
"peer",
"by",
"adding",
"it",
"to",
"the",
"server",
"s",
"global",
"list",
"of",
"all",
"active",
"peers",
"and",
"starting",
"all",
"the",
"goroutines",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2526-L2578 |
129,246 | lightningnetwork/lnd | server.go | addPeer | func (s *server) addPeer(p *peer) {
if p == nil {
return
}
// Ignore new peers if we're shutting down.
if s.Stopped() {
p.Disconnect(ErrServerShuttingDown)
return
}
// Track the new peer in our indexes so we can quickly look it up either
// according to its public key, or its peer ID.
// TODO(roasbeef):... | go | func (s *server) addPeer(p *peer) {
if p == nil {
return
}
// Ignore new peers if we're shutting down.
if s.Stopped() {
p.Disconnect(ErrServerShuttingDown)
return
}
// Track the new peer in our indexes so we can quickly look it up either
// according to its public key, or its peer ID.
// TODO(roasbeef):... | [
"func",
"(",
"s",
"*",
"server",
")",
"addPeer",
"(",
"p",
"*",
"peer",
")",
"{",
"if",
"p",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Ignore new peers if we're shutting down.",
"if",
"s",
".",
"Stopped",
"(",
")",
"{",
"p",
".",
"Disconnect",... | // addPeer adds the passed peer to the server's global state of all active
// peers. | [
"addPeer",
"adds",
"the",
"passed",
"peer",
"to",
"the",
"server",
"s",
"global",
"state",
"of",
"all",
"active",
"peers",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2582-L2607 |
129,247 | lightningnetwork/lnd | server.go | removePeer | func (s *server) removePeer(p *peer) {
if p == nil {
return
}
srvrLog.Debugf("removing peer %v", p)
// As the peer is now finished, ensure that the TCP connection is
// closed and all of its related goroutines have exited.
p.Disconnect(fmt.Errorf("server: disconnecting peer %v", p))
// If this peer had an a... | go | func (s *server) removePeer(p *peer) {
if p == nil {
return
}
srvrLog.Debugf("removing peer %v", p)
// As the peer is now finished, ensure that the TCP connection is
// closed and all of its related goroutines have exited.
p.Disconnect(fmt.Errorf("server: disconnecting peer %v", p))
// If this peer had an a... | [
"func",
"(",
"s",
"*",
"server",
")",
"removePeer",
"(",
"p",
"*",
"peer",
")",
"{",
"if",
"p",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"srvrLog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"p",
")",
"\n\n",
"// As the peer is now finished, ensure tha... | // removePeer removes the passed peer from the server's state of all active
// peers. | [
"removePeer",
"removes",
"the",
"passed",
"peer",
"from",
"the",
"server",
"s",
"state",
"of",
"all",
"active",
"peers",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2827-L2857 |
129,248 | lightningnetwork/lnd | server.go | connectToPeer | func (s *server) connectToPeer(addr *lnwire.NetAddress, errChan chan<- error) {
conn, err := brontide.Dial(s.identityPriv, addr, cfg.net.Dial)
if err != nil {
srvrLog.Errorf("Unable to connect to %v: %v", addr, err)
select {
case errChan <- err:
case <-s.quit:
}
return
}
close(errChan)
s.OutboundPeer... | go | func (s *server) connectToPeer(addr *lnwire.NetAddress, errChan chan<- error) {
conn, err := brontide.Dial(s.identityPriv, addr, cfg.net.Dial)
if err != nil {
srvrLog.Errorf("Unable to connect to %v: %v", addr, err)
select {
case errChan <- err:
case <-s.quit:
}
return
}
close(errChan)
s.OutboundPeer... | [
"func",
"(",
"s",
"*",
"server",
")",
"connectToPeer",
"(",
"addr",
"*",
"lnwire",
".",
"NetAddress",
",",
"errChan",
"chan",
"<-",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"brontide",
".",
"Dial",
"(",
"s",
".",
"identityPriv",
",",
"addr",
",",... | // connectToPeer establishes a connection to a remote peer. errChan is used to
// notify the caller if the connection attempt has failed. Otherwise, it will be
// closed. | [
"connectToPeer",
"establishes",
"a",
"connection",
"to",
"a",
"remote",
"peer",
".",
"errChan",
"is",
"used",
"to",
"notify",
"the",
"caller",
"if",
"the",
"connection",
"attempt",
"has",
"failed",
".",
"Otherwise",
"it",
"will",
"be",
"closed",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L2965-L2979 |
129,249 | lightningnetwork/lnd | server.go | fetchNodeAdvertisedAddr | func (s *server) fetchNodeAdvertisedAddr(pub *btcec.PublicKey) (net.Addr, error) {
node, err := s.chanDB.ChannelGraph().FetchLightningNode(pub)
if err != nil {
return nil, err
}
if len(node.Addresses) == 0 {
return nil, errors.New("no advertised addresses found")
}
return node.Addresses[0], nil
} | go | func (s *server) fetchNodeAdvertisedAddr(pub *btcec.PublicKey) (net.Addr, error) {
node, err := s.chanDB.ChannelGraph().FetchLightningNode(pub)
if err != nil {
return nil, err
}
if len(node.Addresses) == 0 {
return nil, errors.New("no advertised addresses found")
}
return node.Addresses[0], nil
} | [
"func",
"(",
"s",
"*",
"server",
")",
"fetchNodeAdvertisedAddr",
"(",
"pub",
"*",
"btcec",
".",
"PublicKey",
")",
"(",
"net",
".",
"Addr",
",",
"error",
")",
"{",
"node",
",",
"err",
":=",
"s",
".",
"chanDB",
".",
"ChannelGraph",
"(",
")",
".",
"Fe... | // fetchNodeAdvertisedAddr attempts to fetch an advertised address of a node. | [
"fetchNodeAdvertisedAddr",
"attempts",
"to",
"fetch",
"an",
"advertised",
"address",
"of",
"a",
"node",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L3130-L3141 |
129,250 | lightningnetwork/lnd | server.go | fetchLastChanUpdate | func (s *server) fetchLastChanUpdate() func(lnwire.ShortChannelID) (
*lnwire.ChannelUpdate, error) {
ourPubKey := s.identityPriv.PubKey().SerializeCompressed()
return func(cid lnwire.ShortChannelID) (*lnwire.ChannelUpdate, error) {
info, edge1, edge2, err := s.chanRouter.GetChannelByID(cid)
if err != nil {
r... | go | func (s *server) fetchLastChanUpdate() func(lnwire.ShortChannelID) (
*lnwire.ChannelUpdate, error) {
ourPubKey := s.identityPriv.PubKey().SerializeCompressed()
return func(cid lnwire.ShortChannelID) (*lnwire.ChannelUpdate, error) {
info, edge1, edge2, err := s.chanRouter.GetChannelByID(cid)
if err != nil {
r... | [
"func",
"(",
"s",
"*",
"server",
")",
"fetchLastChanUpdate",
"(",
")",
"func",
"(",
"lnwire",
".",
"ShortChannelID",
")",
"(",
"*",
"lnwire",
".",
"ChannelUpdate",
",",
"error",
")",
"{",
"ourPubKey",
":=",
"s",
".",
"identityPriv",
".",
"PubKey",
"(",
... | // fetchLastChanUpdate returns a function which is able to retrieve our latest
// channel update for a target channel. | [
"fetchLastChanUpdate",
"returns",
"a",
"function",
"which",
"is",
"able",
"to",
"retrieve",
"our",
"latest",
"channel",
"update",
"for",
"a",
"target",
"channel",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L3145-L3159 |
129,251 | lightningnetwork/lnd | server.go | applyChannelUpdate | func (s *server) applyChannelUpdate(update *lnwire.ChannelUpdate) error {
pubKey := s.identityPriv.PubKey()
errChan := s.authGossiper.ProcessLocalAnnouncement(update, pubKey)
select {
case err := <-errChan:
return err
case <-s.quit:
return ErrServerShuttingDown
}
} | go | func (s *server) applyChannelUpdate(update *lnwire.ChannelUpdate) error {
pubKey := s.identityPriv.PubKey()
errChan := s.authGossiper.ProcessLocalAnnouncement(update, pubKey)
select {
case err := <-errChan:
return err
case <-s.quit:
return ErrServerShuttingDown
}
} | [
"func",
"(",
"s",
"*",
"server",
")",
"applyChannelUpdate",
"(",
"update",
"*",
"lnwire",
".",
"ChannelUpdate",
")",
"error",
"{",
"pubKey",
":=",
"s",
".",
"identityPriv",
".",
"PubKey",
"(",
")",
"\n",
"errChan",
":=",
"s",
".",
"authGossiper",
".",
... | // applyChannelUpdate applies the channel update to the different sub-systems of
// the server. | [
"applyChannelUpdate",
"applies",
"the",
"channel",
"update",
"to",
"the",
"different",
"sub",
"-",
"systems",
"of",
"the",
"server",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/server.go#L3163-L3172 |
129,252 | lightningnetwork/lnd | shachain/store.go | NewRevocationStoreFromBytes | func NewRevocationStoreFromBytes(r io.Reader) (*RevocationStore, error) {
store := &RevocationStore{}
if err := binary.Read(r, binary.BigEndian, &store.lenBuckets); err != nil {
return nil, err
}
for i := uint8(0); i < store.lenBuckets; i++ {
var hashIndex index
err := binary.Read(r, binary.BigEndian, &hash... | go | func NewRevocationStoreFromBytes(r io.Reader) (*RevocationStore, error) {
store := &RevocationStore{}
if err := binary.Read(r, binary.BigEndian, &store.lenBuckets); err != nil {
return nil, err
}
for i := uint8(0); i < store.lenBuckets; i++ {
var hashIndex index
err := binary.Read(r, binary.BigEndian, &hash... | [
"func",
"NewRevocationStoreFromBytes",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"*",
"RevocationStore",
",",
"error",
")",
"{",
"store",
":=",
"&",
"RevocationStore",
"{",
"}",
"\n\n",
"if",
"err",
":=",
"binary",
".",
"Read",
"(",
"r",
",",
"binary",
... | // NewRevocationStoreFromBytes recreates the initial store state from the given
// binary shachain store representation. | [
"NewRevocationStoreFromBytes",
"recreates",
"the",
"initial",
"store",
"state",
"from",
"the",
"given",
"binary",
"shachain",
"store",
"representation",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/shachain/store.go#L70-L100 |
129,253 | lightningnetwork/lnd | discovery/syncer.go | String | func (t SyncerType) String() string {
switch t {
case ActiveSync:
return "ActiveSync"
case PassiveSync:
return "PassiveSync"
default:
return fmt.Sprintf("unknown sync type %d", t)
}
} | go | func (t SyncerType) String() string {
switch t {
case ActiveSync:
return "ActiveSync"
case PassiveSync:
return "PassiveSync"
default:
return fmt.Sprintf("unknown sync type %d", t)
}
} | [
"func",
"(",
"t",
"SyncerType",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"ActiveSync",
":",
"return",
"\"",
"\"",
"\n",
"case",
"PassiveSync",
":",
"return",
"\"",
"\"",
"\n",
"default",
":",
"return",
"fmt",
".",
"Sprintf",
... | // String returns a human readable string describing the target SyncerType. | [
"String",
"returns",
"a",
"human",
"readable",
"string",
"describing",
"the",
"target",
"SyncerType",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L46-L55 |
129,254 | lightningnetwork/lnd | discovery/syncer.go | String | func (s syncerState) String() string {
switch s {
case syncingChans:
return "syncingChans"
case waitingQueryRangeReply:
return "waitingQueryRangeReply"
case queryNewChannels:
return "queryNewChannels"
case waitingQueryChanReply:
return "waitingQueryChanReply"
case chansSynced:
return "chansSynced"
... | go | func (s syncerState) String() string {
switch s {
case syncingChans:
return "syncingChans"
case waitingQueryRangeReply:
return "waitingQueryRangeReply"
case queryNewChannels:
return "queryNewChannels"
case waitingQueryChanReply:
return "waitingQueryChanReply"
case chansSynced:
return "chansSynced"
... | [
"func",
"(",
"s",
"syncerState",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"s",
"{",
"case",
"syncingChans",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"waitingQueryRangeReply",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"queryNewChannels",
":",
"r... | // String returns a human readable string describing the target syncerState. | [
"String",
"returns",
"a",
"human",
"readable",
"string",
"describing",
"the",
"target",
"syncerState",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L99-L119 |
129,255 | lightningnetwork/lnd | discovery/syncer.go | newGossipSyncer | func newGossipSyncer(cfg gossipSyncerCfg) *GossipSyncer {
// If no parameter was specified for max undelayed query replies, set it
// to the default of 5 queries.
if cfg.maxUndelayedQueryReplies <= 0 {
cfg.maxUndelayedQueryReplies = DefaultMaxUndelayedQueryReplies
}
// If no parameter was specified for delayed ... | go | func newGossipSyncer(cfg gossipSyncerCfg) *GossipSyncer {
// If no parameter was specified for max undelayed query replies, set it
// to the default of 5 queries.
if cfg.maxUndelayedQueryReplies <= 0 {
cfg.maxUndelayedQueryReplies = DefaultMaxUndelayedQueryReplies
}
// If no parameter was specified for delayed ... | [
"func",
"newGossipSyncer",
"(",
"cfg",
"gossipSyncerCfg",
")",
"*",
"GossipSyncer",
"{",
"// If no parameter was specified for max undelayed query replies, set it",
"// to the default of 5 queries.",
"if",
"cfg",
".",
"maxUndelayedQueryReplies",
"<=",
"0",
"{",
"cfg",
".",
"m... | // newGossipSyncer returns a new instance of the GossipSyncer populated using
// the passed config. | [
"newGossipSyncer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"GossipSyncer",
"populated",
"using",
"the",
"passed",
"config",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L328-L359 |
129,256 | lightningnetwork/lnd | discovery/syncer.go | Start | func (g *GossipSyncer) Start() {
g.started.Do(func() {
log.Debugf("Starting GossipSyncer(%x)", g.cfg.peerPub[:])
// TODO(conner): only spawn channelGraphSyncer if remote
// supports gossip queries, and only spawn replyHandler if we
// advertise support
if !g.cfg.noSyncChannels {
g.wg.Add(1)
go g.chann... | go | func (g *GossipSyncer) Start() {
g.started.Do(func() {
log.Debugf("Starting GossipSyncer(%x)", g.cfg.peerPub[:])
// TODO(conner): only spawn channelGraphSyncer if remote
// supports gossip queries, and only spawn replyHandler if we
// advertise support
if !g.cfg.noSyncChannels {
g.wg.Add(1)
go g.chann... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"Start",
"(",
")",
"{",
"g",
".",
"started",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"g",
".",
"cfg",
".",
"peerPub",
"[",
":",
"]",
")",
"\n\n",
"// TODO(... | // Start starts the GossipSyncer and any goroutines that it needs to carry out
// its duties. | [
"Start",
"starts",
"the",
"GossipSyncer",
"and",
"any",
"goroutines",
"that",
"it",
"needs",
"to",
"carry",
"out",
"its",
"duties",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L363-L379 |
129,257 | lightningnetwork/lnd | discovery/syncer.go | Stop | func (g *GossipSyncer) Stop() {
g.stopped.Do(func() {
close(g.quit)
g.wg.Wait()
})
} | go | func (g *GossipSyncer) Stop() {
g.stopped.Do(func() {
close(g.quit)
g.wg.Wait()
})
} | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"Stop",
"(",
")",
"{",
"g",
".",
"stopped",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"close",
"(",
"g",
".",
"quit",
")",
"\n",
"g",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"}",
")",
"\n",
"}"
] | // Stop signals the GossipSyncer for a graceful exit, then waits until it has
// exited. | [
"Stop",
"signals",
"the",
"GossipSyncer",
"for",
"a",
"graceful",
"exit",
"then",
"waits",
"until",
"it",
"has",
"exited",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L383-L388 |
129,258 | lightningnetwork/lnd | discovery/syncer.go | channelGraphSyncer | func (g *GossipSyncer) channelGraphSyncer() {
defer g.wg.Done()
for {
state := g.syncState()
syncType := g.SyncType()
log.Debugf("GossipSyncer(%x): state=%v, type=%v",
g.cfg.peerPub[:], state, syncType)
switch state {
// When we're in this state, we're trying to synchronize our
// view of the networ... | go | func (g *GossipSyncer) channelGraphSyncer() {
defer g.wg.Done()
for {
state := g.syncState()
syncType := g.SyncType()
log.Debugf("GossipSyncer(%x): state=%v, type=%v",
g.cfg.peerPub[:], state, syncType)
switch state {
// When we're in this state, we're trying to synchronize our
// view of the networ... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"channelGraphSyncer",
"(",
")",
"{",
"defer",
"g",
".",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"for",
"{",
"state",
":=",
"g",
".",
"syncState",
"(",
")",
"\n",
"syncType",
":=",
"g",
".",
"SyncType",
"(",
... | // channelGraphSyncer is the main goroutine responsible for ensuring that we
// properly channel graph state with the remote peer, and also that we only
// send them messages which actually pass their defined update horizon. | [
"channelGraphSyncer",
"is",
"the",
"main",
"goroutine",
"responsible",
"for",
"ensuring",
"that",
"we",
"properly",
"channel",
"graph",
"state",
"with",
"the",
"remote",
"peer",
"and",
"also",
"that",
"we",
"only",
"send",
"them",
"messages",
"which",
"actually"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L393-L554 |
129,259 | lightningnetwork/lnd | discovery/syncer.go | sendGossipTimestampRange | func (g *GossipSyncer) sendGossipTimestampRange(firstTimestamp time.Time,
timestampRange uint32) error {
endTimestamp := firstTimestamp.Add(
time.Duration(timestampRange) * time.Second,
)
log.Infof("GossipSyncer(%x): applying gossipFilter(start=%v, end=%v)",
g.cfg.peerPub[:], firstTimestamp, endTimestamp)
l... | go | func (g *GossipSyncer) sendGossipTimestampRange(firstTimestamp time.Time,
timestampRange uint32) error {
endTimestamp := firstTimestamp.Add(
time.Duration(timestampRange) * time.Second,
)
log.Infof("GossipSyncer(%x): applying gossipFilter(start=%v, end=%v)",
g.cfg.peerPub[:], firstTimestamp, endTimestamp)
l... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"sendGossipTimestampRange",
"(",
"firstTimestamp",
"time",
".",
"Time",
",",
"timestampRange",
"uint32",
")",
"error",
"{",
"endTimestamp",
":=",
"firstTimestamp",
".",
"Add",
"(",
"time",
".",
"Duration",
"(",
"time... | // sendGossipTimestampRange constructs and sets a GossipTimestampRange for the
// syncer and sends it to the remote peer. | [
"sendGossipTimestampRange",
"constructs",
"and",
"sets",
"a",
"GossipTimestampRange",
"for",
"the",
"syncer",
"and",
"sends",
"it",
"to",
"the",
"remote",
"peer",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L590-L617 |
129,260 | lightningnetwork/lnd | discovery/syncer.go | synchronizeChanIDs | func (g *GossipSyncer) synchronizeChanIDs() (bool, error) {
// If we're in this state yet there are no more new channels to query
// for, then we'll transition to our final synced state and return true
// to signal that we're fully synchronized.
if len(g.newChansToQuery) == 0 {
log.Infof("GossipSyncer(%x): no mor... | go | func (g *GossipSyncer) synchronizeChanIDs() (bool, error) {
// If we're in this state yet there are no more new channels to query
// for, then we'll transition to our final synced state and return true
// to signal that we're fully synchronized.
if len(g.newChansToQuery) == 0 {
log.Infof("GossipSyncer(%x): no mor... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"synchronizeChanIDs",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// If we're in this state yet there are no more new channels to query",
"// for, then we'll transition to our final synced state and return true",
"// to signal that we... | // synchronizeChanIDs is called by the channelGraphSyncer when we need to query
// the remote peer for its known set of channel IDs within a particular block
// range. This method will be called continually until the entire range has
// been queried for with a response received. We'll chunk our requests as
// required ... | [
"synchronizeChanIDs",
"is",
"called",
"by",
"the",
"channelGraphSyncer",
"when",
"we",
"need",
"to",
"query",
"the",
"remote",
"peer",
"for",
"its",
"known",
"set",
"of",
"channel",
"IDs",
"within",
"a",
"particular",
"block",
"range",
".",
"This",
"method",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L625-L665 |
129,261 | lightningnetwork/lnd | discovery/syncer.go | processChanRangeReply | func (g *GossipSyncer) processChanRangeReply(msg *lnwire.ReplyChannelRange) error {
g.bufferedChanRangeReplies = append(
g.bufferedChanRangeReplies, msg.ShortChanIDs...,
)
log.Infof("GossipSyncer(%x): buffering chan range reply of size=%v",
g.cfg.peerPub[:], len(msg.ShortChanIDs))
// If this isn't the last re... | go | func (g *GossipSyncer) processChanRangeReply(msg *lnwire.ReplyChannelRange) error {
g.bufferedChanRangeReplies = append(
g.bufferedChanRangeReplies, msg.ShortChanIDs...,
)
log.Infof("GossipSyncer(%x): buffering chan range reply of size=%v",
g.cfg.peerPub[:], len(msg.ShortChanIDs))
// If this isn't the last re... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"processChanRangeReply",
"(",
"msg",
"*",
"lnwire",
".",
"ReplyChannelRange",
")",
"error",
"{",
"g",
".",
"bufferedChanRangeReplies",
"=",
"append",
"(",
"g",
".",
"bufferedChanRangeReplies",
",",
"msg",
".",
"Short... | // processChanRangeReply is called each time the GossipSyncer receives a new
// reply to the initial range query to discover new channels that it didn't
// previously know of. | [
"processChanRangeReply",
"is",
"called",
"each",
"time",
"the",
"GossipSyncer",
"receives",
"a",
"new",
"reply",
"to",
"the",
"initial",
"range",
"query",
"to",
"discover",
"new",
"channels",
"that",
"it",
"didn",
"t",
"previously",
"know",
"of",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L670-L720 |
129,262 | lightningnetwork/lnd | discovery/syncer.go | genChanRangeQuery | func (g *GossipSyncer) genChanRangeQuery(
historicalQuery bool) (*lnwire.QueryChannelRange, error) {
// First, we'll query our channel graph time series for its highest
// known channel ID.
newestChan, err := g.cfg.channelSeries.HighestChanID(g.cfg.chainHash)
if err != nil {
return nil, err
}
// Once we have... | go | func (g *GossipSyncer) genChanRangeQuery(
historicalQuery bool) (*lnwire.QueryChannelRange, error) {
// First, we'll query our channel graph time series for its highest
// known channel ID.
newestChan, err := g.cfg.channelSeries.HighestChanID(g.cfg.chainHash)
if err != nil {
return nil, err
}
// Once we have... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"genChanRangeQuery",
"(",
"historicalQuery",
"bool",
")",
"(",
"*",
"lnwire",
".",
"QueryChannelRange",
",",
"error",
")",
"{",
"// First, we'll query our channel graph time series for its highest",
"// known channel ID.",
"newe... | // genChanRangeQuery generates the initial message we'll send to the remote
// party when we're kicking off the channel graph synchronization upon
// connection. The historicalQuery boolean can be used to generate a query from
// the genesis block of the chain. | [
"genChanRangeQuery",
"generates",
"the",
"initial",
"message",
"we",
"ll",
"send",
"to",
"the",
"remote",
"party",
"when",
"we",
"re",
"kicking",
"off",
"the",
"channel",
"graph",
"synchronization",
"upon",
"connection",
".",
"The",
"historicalQuery",
"boolean",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L726-L763 |
129,263 | lightningnetwork/lnd | discovery/syncer.go | replyPeerQueries | func (g *GossipSyncer) replyPeerQueries(msg lnwire.Message) error {
reservation := g.rateLimiter.Reserve()
delay := reservation.Delay()
// If we've already replied a handful of times, we will start to delay
// responses back to the remote peer. This can help prevent DOS attacks
// where the remote peer spams us e... | go | func (g *GossipSyncer) replyPeerQueries(msg lnwire.Message) error {
reservation := g.rateLimiter.Reserve()
delay := reservation.Delay()
// If we've already replied a handful of times, we will start to delay
// responses back to the remote peer. This can help prevent DOS attacks
// where the remote peer spams us e... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"replyPeerQueries",
"(",
"msg",
"lnwire",
".",
"Message",
")",
"error",
"{",
"reservation",
":=",
"g",
".",
"rateLimiter",
".",
"Reserve",
"(",
")",
"\n",
"delay",
":=",
"reservation",
".",
"Delay",
"(",
")",
... | // replyPeerQueries is called in response to any query by the remote peer.
// We'll examine our state and send back our best response. | [
"replyPeerQueries",
"is",
"called",
"in",
"response",
"to",
"any",
"query",
"by",
"the",
"remote",
"peer",
".",
"We",
"ll",
"examine",
"our",
"state",
"and",
"send",
"back",
"our",
"best",
"response",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L767-L800 |
129,264 | lightningnetwork/lnd | discovery/syncer.go | replyChanRangeQuery | func (g *GossipSyncer) replyChanRangeQuery(query *lnwire.QueryChannelRange) error {
log.Infof("GossipSyncer(%x): filtering chan range: start_height=%v, "+
"num_blocks=%v", g.cfg.peerPub[:], query.FirstBlockHeight,
query.NumBlocks)
// Next, we'll consult the time series to obtain the set of known
// channel ID's... | go | func (g *GossipSyncer) replyChanRangeQuery(query *lnwire.QueryChannelRange) error {
log.Infof("GossipSyncer(%x): filtering chan range: start_height=%v, "+
"num_blocks=%v", g.cfg.peerPub[:], query.FirstBlockHeight,
query.NumBlocks)
// Next, we'll consult the time series to obtain the set of known
// channel ID's... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"replyChanRangeQuery",
"(",
"query",
"*",
"lnwire",
".",
"QueryChannelRange",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"g",
".",
"cfg",
".",
"peerPub",
"[",
":",
"]",
... | // replyChanRangeQuery will be dispatched in response to a channel range query
// by the remote node. We'll query the channel time series for channels that
// meet the channel range, then chunk our responses to the remote node. We also
// ensure that our final fragment carries the "complete" bit to indicate the
// end ... | [
"replyChanRangeQuery",
"will",
"be",
"dispatched",
"in",
"response",
"to",
"a",
"channel",
"range",
"query",
"by",
"the",
"remote",
"node",
".",
"We",
"ll",
"query",
"the",
"channel",
"time",
"series",
"for",
"channels",
"that",
"meet",
"the",
"channel",
"ra... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L807-L878 |
129,265 | lightningnetwork/lnd | discovery/syncer.go | replyShortChanIDs | func (g *GossipSyncer) replyShortChanIDs(query *lnwire.QueryShortChanIDs) error {
// Before responding, we'll check to ensure that the remote peer is
// querying for the same chain that we're on. If not, we'll send back a
// response with a complete value of zero to indicate we're on a
// different chain.
if g.cfg... | go | func (g *GossipSyncer) replyShortChanIDs(query *lnwire.QueryShortChanIDs) error {
// Before responding, we'll check to ensure that the remote peer is
// querying for the same chain that we're on. If not, we'll send back a
// response with a complete value of zero to indicate we're on a
// different chain.
if g.cfg... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"replyShortChanIDs",
"(",
"query",
"*",
"lnwire",
".",
"QueryShortChanIDs",
")",
"error",
"{",
"// Before responding, we'll check to ensure that the remote peer is",
"// querying for the same chain that we're on. If not, we'll send back a... | // replyShortChanIDs will be dispatched in response to a query by the remote
// node for information concerning a set of short channel ID's. Our response
// will be sent in a streaming chunked manner to ensure that we remain below
// the current transport level message size. | [
"replyShortChanIDs",
"will",
"be",
"dispatched",
"in",
"response",
"to",
"a",
"query",
"by",
"the",
"remote",
"node",
"for",
"information",
"concerning",
"a",
"set",
"of",
"short",
"channel",
"ID",
"s",
".",
"Our",
"response",
"will",
"be",
"sent",
"in",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L884-L937 |
129,266 | lightningnetwork/lnd | discovery/syncer.go | ApplyGossipFilter | func (g *GossipSyncer) ApplyGossipFilter(filter *lnwire.GossipTimestampRange) error {
g.Lock()
g.remoteUpdateHorizon = filter
startTime := time.Unix(int64(g.remoteUpdateHorizon.FirstTimestamp), 0)
endTime := startTime.Add(
time.Duration(g.remoteUpdateHorizon.TimestampRange) * time.Second,
)
g.Unlock()
// N... | go | func (g *GossipSyncer) ApplyGossipFilter(filter *lnwire.GossipTimestampRange) error {
g.Lock()
g.remoteUpdateHorizon = filter
startTime := time.Unix(int64(g.remoteUpdateHorizon.FirstTimestamp), 0)
endTime := startTime.Add(
time.Duration(g.remoteUpdateHorizon.TimestampRange) * time.Second,
)
g.Unlock()
// N... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"ApplyGossipFilter",
"(",
"filter",
"*",
"lnwire",
".",
"GossipTimestampRange",
")",
"error",
"{",
"g",
".",
"Lock",
"(",
")",
"\n\n",
"g",
".",
"remoteUpdateHorizon",
"=",
"filter",
"\n\n",
"startTime",
":=",
"t... | // ApplyGossipFilter applies a gossiper filter sent by the remote node to the
// state machine. Once applied, we'll ensure that we don't forward any messages
// to the peer that aren't within the time range of the filter. | [
"ApplyGossipFilter",
"applies",
"a",
"gossiper",
"filter",
"sent",
"by",
"the",
"remote",
"node",
"to",
"the",
"state",
"machine",
".",
"Once",
"applied",
"we",
"ll",
"ensure",
"that",
"we",
"don",
"t",
"forward",
"any",
"messages",
"to",
"the",
"peer",
"t... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L942-L994 |
129,267 | lightningnetwork/lnd | discovery/syncer.go | FilterGossipMsgs | func (g *GossipSyncer) FilterGossipMsgs(msgs ...msgWithSenders) {
// If the peer doesn't have an update horizon set, then we won't send
// it any new update messages.
if g.remoteUpdateHorizon == nil {
return
}
// If we've been signaled to exit, or are exiting, then we'll stop
// short.
select {
case <-g.quit... | go | func (g *GossipSyncer) FilterGossipMsgs(msgs ...msgWithSenders) {
// If the peer doesn't have an update horizon set, then we won't send
// it any new update messages.
if g.remoteUpdateHorizon == nil {
return
}
// If we've been signaled to exit, or are exiting, then we'll stop
// short.
select {
case <-g.quit... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"FilterGossipMsgs",
"(",
"msgs",
"...",
"msgWithSenders",
")",
"{",
"// If the peer doesn't have an update horizon set, then we won't send",
"// it any new update messages.",
"if",
"g",
".",
"remoteUpdateHorizon",
"==",
"nil",
"{"... | // FilterGossipMsgs takes a set of gossip messages, and only send it to a peer
// iff the message is within the bounds of their set gossip filter. If the peer
// doesn't have a gossip filter set, then no messages will be forwarded. | [
"FilterGossipMsgs",
"takes",
"a",
"set",
"of",
"gossip",
"messages",
"and",
"only",
"send",
"it",
"to",
"a",
"peer",
"iff",
"the",
"message",
"is",
"within",
"the",
"bounds",
"of",
"their",
"set",
"gossip",
"filter",
".",
"If",
"the",
"peer",
"doesn",
"t... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L999-L1117 |
129,268 | lightningnetwork/lnd | discovery/syncer.go | ProcessQueryMsg | func (g *GossipSyncer) ProcessQueryMsg(msg lnwire.Message, peerQuit <-chan struct{}) {
var msgChan chan lnwire.Message
switch msg.(type) {
case *lnwire.QueryChannelRange, *lnwire.QueryShortChanIDs:
msgChan = g.queryMsgs
default:
msgChan = g.gossipMsgs
}
select {
case msgChan <- msg:
case <-peerQuit:
case ... | go | func (g *GossipSyncer) ProcessQueryMsg(msg lnwire.Message, peerQuit <-chan struct{}) {
var msgChan chan lnwire.Message
switch msg.(type) {
case *lnwire.QueryChannelRange, *lnwire.QueryShortChanIDs:
msgChan = g.queryMsgs
default:
msgChan = g.gossipMsgs
}
select {
case msgChan <- msg:
case <-peerQuit:
case ... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"ProcessQueryMsg",
"(",
"msg",
"lnwire",
".",
"Message",
",",
"peerQuit",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"var",
"msgChan",
"chan",
"lnwire",
".",
"Message",
"\n",
"switch",
"msg",
".",
"(",
"type... | // ProcessQueryMsg is used by outside callers to pass new channel time series
// queries to the internal processing goroutine. | [
"ProcessQueryMsg",
"is",
"used",
"by",
"outside",
"callers",
"to",
"pass",
"new",
"channel",
"time",
"series",
"queries",
"to",
"the",
"internal",
"processing",
"goroutine",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L1121-L1135 |
129,269 | lightningnetwork/lnd | discovery/syncer.go | setSyncState | func (g *GossipSyncer) setSyncState(state syncerState) {
atomic.StoreUint32(&g.state, uint32(state))
} | go | func (g *GossipSyncer) setSyncState(state syncerState) {
atomic.StoreUint32(&g.state, uint32(state))
} | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"setSyncState",
"(",
"state",
"syncerState",
")",
"{",
"atomic",
".",
"StoreUint32",
"(",
"&",
"g",
".",
"state",
",",
"uint32",
"(",
"state",
")",
")",
"\n",
"}"
] | // setSyncState sets the gossip syncer's state to the given state. | [
"setSyncState",
"sets",
"the",
"gossip",
"syncer",
"s",
"state",
"to",
"the",
"given",
"state",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L1138-L1140 |
129,270 | lightningnetwork/lnd | discovery/syncer.go | ResetSyncedSignal | func (g *GossipSyncer) ResetSyncedSignal() chan struct{} {
g.Lock()
defer g.Unlock()
syncedSignal := make(chan struct{})
syncState := syncerState(atomic.LoadUint32(&g.state))
if syncState == chansSynced {
close(syncedSignal)
return syncedSignal
}
g.syncedSignal = syncedSignal
return g.syncedSignal
} | go | func (g *GossipSyncer) ResetSyncedSignal() chan struct{} {
g.Lock()
defer g.Unlock()
syncedSignal := make(chan struct{})
syncState := syncerState(atomic.LoadUint32(&g.state))
if syncState == chansSynced {
close(syncedSignal)
return syncedSignal
}
g.syncedSignal = syncedSignal
return g.syncedSignal
} | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"ResetSyncedSignal",
"(",
")",
"chan",
"struct",
"{",
"}",
"{",
"g",
".",
"Lock",
"(",
")",
"\n",
"defer",
"g",
".",
"Unlock",
"(",
")",
"\n\n",
"syncedSignal",
":=",
"make",
"(",
"chan",
"struct",
"{",
"... | // ResetSyncedSignal returns a channel that will be closed in order to serve as
// a signal for when the GossipSyncer has reached its chansSynced state. | [
"ResetSyncedSignal",
"returns",
"a",
"channel",
"that",
"will",
"be",
"closed",
"in",
"order",
"to",
"serve",
"as",
"a",
"signal",
"for",
"when",
"the",
"GossipSyncer",
"has",
"reached",
"its",
"chansSynced",
"state",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L1149-L1163 |
129,271 | lightningnetwork/lnd | discovery/syncer.go | setSyncType | func (g *GossipSyncer) setSyncType(syncType SyncerType) {
atomic.StoreUint32(&g.syncType, uint32(syncType))
} | go | func (g *GossipSyncer) setSyncType(syncType SyncerType) {
atomic.StoreUint32(&g.syncType, uint32(syncType))
} | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"setSyncType",
"(",
"syncType",
"SyncerType",
")",
"{",
"atomic",
".",
"StoreUint32",
"(",
"&",
"g",
".",
"syncType",
",",
"uint32",
"(",
"syncType",
")",
")",
"\n",
"}"
] | // setSyncType sets the gossip syncer's sync type to the given type. | [
"setSyncType",
"sets",
"the",
"gossip",
"syncer",
"s",
"sync",
"type",
"to",
"the",
"given",
"type",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L1241-L1243 |
129,272 | lightningnetwork/lnd | discovery/syncer.go | handleHistoricalSync | func (g *GossipSyncer) handleHistoricalSync(req *historicalSyncReq) {
// We'll go back to our initial syncingChans state in order to request
// the remote peer to give us all of the channel IDs they know of
// starting from the genesis block.
g.genHistoricalChanRangeQuery = true
g.setSyncState(syncingChans)
close... | go | func (g *GossipSyncer) handleHistoricalSync(req *historicalSyncReq) {
// We'll go back to our initial syncingChans state in order to request
// the remote peer to give us all of the channel IDs they know of
// starting from the genesis block.
g.genHistoricalChanRangeQuery = true
g.setSyncState(syncingChans)
close... | [
"func",
"(",
"g",
"*",
"GossipSyncer",
")",
"handleHistoricalSync",
"(",
"req",
"*",
"historicalSyncReq",
")",
"{",
"// We'll go back to our initial syncingChans state in order to request",
"// the remote peer to give us all of the channel IDs they know of",
"// starting from the genes... | // handleHistoricalSync handles a request to the gossip syncer to perform a
// historical sync. | [
"handleHistoricalSync",
"handles",
"a",
"request",
"to",
"the",
"gossip",
"syncer",
"to",
"perform",
"a",
"historical",
"sync",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/discovery/syncer.go#L1278-L1285 |
129,273 | lightningnetwork/lnd | lnrpc/autopilotrpc/autopilot_server.go | New | func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
// We don't create any new macaroons for this subserver, instead reuse
// existing onchain/offchain permissions.
server := &Server{
cfg: cfg,
manager: cfg.Manager,
}
return server, macPermissions, nil
} | go | func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
// We don't create any new macaroons for this subserver, instead reuse
// existing onchain/offchain permissions.
server := &Server{
cfg: cfg,
manager: cfg.Manager,
}
return server, macPermissions, nil
} | [
"func",
"New",
"(",
"cfg",
"*",
"Config",
")",
"(",
"*",
"Server",
",",
"lnrpc",
".",
"MacaroonPerms",
",",
"error",
")",
"{",
"// We don't create any new macaroons for this subserver, instead reuse",
"// existing onchain/offchain permissions.",
"server",
":=",
"&",
"Se... | // New returns a new instance of the autopilotrpc Autopilot sub-server. We also
// return the set of permissions for the macaroons that we may create within
// this method. If the macaroons we need aren't found in the filepath, then
// we'll create them on start up. If we're unable to locate, or create the
// macaroons... | [
"New",
"returns",
"a",
"new",
"instance",
"of",
"the",
"autopilotrpc",
"Autopilot",
"sub",
"-",
"server",
".",
"We",
"also",
"return",
"the",
"set",
"of",
"permissions",
"for",
"the",
"macaroons",
"that",
"we",
"may",
"create",
"within",
"this",
"method",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnrpc/autopilotrpc/autopilot_server.go#L74-L83 |
129,274 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | NewChainArbitrator | func NewChainArbitrator(cfg ChainArbitratorConfig,
db *channeldb.DB) *ChainArbitrator {
return &ChainArbitrator{
cfg: cfg,
activeChannels: make(map[wire.OutPoint]*ChannelArbitrator),
activeWatchers: make(map[wire.OutPoint]*chainWatcher),
chanSource: db,
quit: make(chan struct{}),
... | go | func NewChainArbitrator(cfg ChainArbitratorConfig,
db *channeldb.DB) *ChainArbitrator {
return &ChainArbitrator{
cfg: cfg,
activeChannels: make(map[wire.OutPoint]*ChannelArbitrator),
activeWatchers: make(map[wire.OutPoint]*chainWatcher),
chanSource: db,
quit: make(chan struct{}),
... | [
"func",
"NewChainArbitrator",
"(",
"cfg",
"ChainArbitratorConfig",
",",
"db",
"*",
"channeldb",
".",
"DB",
")",
"*",
"ChainArbitrator",
"{",
"return",
"&",
"ChainArbitrator",
"{",
"cfg",
":",
"cfg",
",",
"activeChannels",
":",
"make",
"(",
"map",
"[",
"wire"... | // NewChainArbitrator returns a new instance of the ChainArbitrator using the
// passed config struct, and backing persistent database. | [
"NewChainArbitrator",
"returns",
"a",
"new",
"instance",
"of",
"the",
"ChainArbitrator",
"using",
"the",
"passed",
"config",
"struct",
"and",
"backing",
"persistent",
"database",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L194-L204 |
129,275 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | newActiveChannelArbitrator | func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
c *ChainArbitrator, chanEvents *ChainEventSubscription) (*ChannelArbitrator, error) {
log.Tracef("Creating ChannelArbitrator for ChannelPoint(%v)",
channel.FundingOutpoint)
// We'll start by registering for a block epoch notifications so this
// ch... | go | func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
c *ChainArbitrator, chanEvents *ChainEventSubscription) (*ChannelArbitrator, error) {
log.Tracef("Creating ChannelArbitrator for ChannelPoint(%v)",
channel.FundingOutpoint)
// We'll start by registering for a block epoch notifications so this
// ch... | [
"func",
"newActiveChannelArbitrator",
"(",
"channel",
"*",
"channeldb",
".",
"OpenChannel",
",",
"c",
"*",
"ChainArbitrator",
",",
"chanEvents",
"*",
"ChainEventSubscription",
")",
"(",
"*",
"ChannelArbitrator",
",",
"error",
")",
"{",
"log",
".",
"Tracef",
"(",... | // newActiveChannelArbitrator creates a new instance of an active channel
// arbitrator given the state of the target channel. | [
"newActiveChannelArbitrator",
"creates",
"a",
"new",
"instance",
"of",
"an",
"active",
"channel",
"arbitrator",
"given",
"the",
"state",
"of",
"the",
"target",
"channel",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L208-L303 |
129,276 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | resolveContract | func (c *ChainArbitrator) resolveContract(chanPoint wire.OutPoint,
arbLog ArbitratorLog) error {
log.Infof("Marking ChannelPoint(%v) fully resolved", chanPoint)
// First, we'll we'll mark the channel as fully closed from the PoV of
// the channel source.
err := c.chanSource.MarkChanFullyClosed(&chanPoint)
if er... | go | func (c *ChainArbitrator) resolveContract(chanPoint wire.OutPoint,
arbLog ArbitratorLog) error {
log.Infof("Marking ChannelPoint(%v) fully resolved", chanPoint)
// First, we'll we'll mark the channel as fully closed from the PoV of
// the channel source.
err := c.chanSource.MarkChanFullyClosed(&chanPoint)
if er... | [
"func",
"(",
"c",
"*",
"ChainArbitrator",
")",
"resolveContract",
"(",
"chanPoint",
"wire",
".",
"OutPoint",
",",
"arbLog",
"ArbitratorLog",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"chanPoint",
")",
"\n\n",
"// First, we'll we'll mark the... | // resolveContract marks a contract as fully resolved within the database.
// This is only to be done once all contracts which were live on the channel
// before hitting the chain have been resolved. | [
"resolveContract",
"marks",
"a",
"contract",
"as",
"fully",
"resolved",
"within",
"the",
"database",
".",
"This",
"is",
"only",
"to",
"be",
"done",
"once",
"all",
"contracts",
"which",
"were",
"live",
"on",
"the",
"channel",
"before",
"hitting",
"the",
"chai... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L308-L344 |
129,277 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | Stop | func (c *ChainArbitrator) Stop() error {
if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) {
return nil
}
log.Infof("Stopping ChainArbitrator")
close(c.quit)
var (
activeWatchers = make(map[wire.OutPoint]*chainWatcher)
activeChannels = make(map[wire.OutPoint]*ChannelArbitrator)
)
// Copy the current set... | go | func (c *ChainArbitrator) Stop() error {
if !atomic.CompareAndSwapInt32(&c.stopped, 0, 1) {
return nil
}
log.Infof("Stopping ChainArbitrator")
close(c.quit)
var (
activeWatchers = make(map[wire.OutPoint]*chainWatcher)
activeChannels = make(map[wire.OutPoint]*ChannelArbitrator)
)
// Copy the current set... | [
"func",
"(",
"c",
"*",
"ChainArbitrator",
")",
"Stop",
"(",
")",
"error",
"{",
"if",
"!",
"atomic",
".",
"CompareAndSwapInt32",
"(",
"&",
"c",
".",
"stopped",
",",
"0",
",",
"1",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Infof",
... | // Stop signals the ChainArbitrator to trigger a graceful shutdown. Any active
// channel arbitrators will be signalled to exit, and this method will block
// until they've all exited. | [
"Stop",
"signals",
"the",
"ChainArbitrator",
"to",
"trigger",
"a",
"graceful",
"shutdown",
".",
"Any",
"active",
"channel",
"arbitrators",
"will",
"be",
"signalled",
"to",
"exit",
"and",
"this",
"method",
"will",
"block",
"until",
"they",
"ve",
"all",
"exited"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L512-L560 |
129,278 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | UpdateContractSignals | func (c *ChainArbitrator) UpdateContractSignals(chanPoint wire.OutPoint,
signals *ContractSignals) error {
log.Infof("Attempting to update ContractSignals for ChannelPoint(%v)",
chanPoint)
c.Lock()
arbitrator, ok := c.activeChannels[chanPoint]
c.Unlock()
if !ok {
return fmt.Errorf("unable to find arbitrator... | go | func (c *ChainArbitrator) UpdateContractSignals(chanPoint wire.OutPoint,
signals *ContractSignals) error {
log.Infof("Attempting to update ContractSignals for ChannelPoint(%v)",
chanPoint)
c.Lock()
arbitrator, ok := c.activeChannels[chanPoint]
c.Unlock()
if !ok {
return fmt.Errorf("unable to find arbitrator... | [
"func",
"(",
"c",
"*",
"ChainArbitrator",
")",
"UpdateContractSignals",
"(",
"chanPoint",
"wire",
".",
"OutPoint",
",",
"signals",
"*",
"ContractSignals",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"chanPoint",
")",
"\n\n",
"c",
".",
"... | // UpdateContractSignals sends a set of active, up to date contract signals to
// the ChannelArbitrator which is has been assigned to the channel infield by
// the passed channel point. | [
"UpdateContractSignals",
"sends",
"a",
"set",
"of",
"active",
"up",
"to",
"date",
"contract",
"signals",
"to",
"the",
"ChannelArbitrator",
"which",
"is",
"has",
"been",
"assigned",
"to",
"the",
"channel",
"infield",
"by",
"the",
"passed",
"channel",
"point",
"... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L581-L597 |
129,279 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | GetChannelArbitrator | func (c *ChainArbitrator) GetChannelArbitrator(chanPoint wire.OutPoint) (
*ChannelArbitrator, error) {
c.Lock()
arbitrator, ok := c.activeChannels[chanPoint]
c.Unlock()
if !ok {
return nil, fmt.Errorf("unable to find arbitrator")
}
return arbitrator, nil
} | go | func (c *ChainArbitrator) GetChannelArbitrator(chanPoint wire.OutPoint) (
*ChannelArbitrator, error) {
c.Lock()
arbitrator, ok := c.activeChannels[chanPoint]
c.Unlock()
if !ok {
return nil, fmt.Errorf("unable to find arbitrator")
}
return arbitrator, nil
} | [
"func",
"(",
"c",
"*",
"ChainArbitrator",
")",
"GetChannelArbitrator",
"(",
"chanPoint",
"wire",
".",
"OutPoint",
")",
"(",
"*",
"ChannelArbitrator",
",",
"error",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"arbitrator",
",",
"ok",
":=",
"c",
".",
"ac... | // GetChannelArbitrator safely returns the channel arbitrator for a given
// channel outpoint. | [
"GetChannelArbitrator",
"safely",
"returns",
"the",
"channel",
"arbitrator",
"for",
"a",
"given",
"channel",
"outpoint",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L601-L612 |
129,280 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | WatchNewChannel | func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error {
c.Lock()
defer c.Unlock()
log.Infof("Creating new ChannelArbitrator for ChannelPoint(%v)",
newChan.FundingOutpoint)
// If we're already watching this channel, then we'll ignore this
// request.
chanPoint := newChan.FundingOutpoi... | go | func (c *ChainArbitrator) WatchNewChannel(newChan *channeldb.OpenChannel) error {
c.Lock()
defer c.Unlock()
log.Infof("Creating new ChannelArbitrator for ChannelPoint(%v)",
newChan.FundingOutpoint)
// If we're already watching this channel, then we'll ignore this
// request.
chanPoint := newChan.FundingOutpoi... | [
"func",
"(",
"c",
"*",
"ChainArbitrator",
")",
"WatchNewChannel",
"(",
"newChan",
"*",
"channeldb",
".",
"OpenChannel",
")",
"error",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n\n",
"log",
".",
"Infof",
"(",
"\""... | // WatchNewChannel sends the ChainArbitrator a message to create a
// ChannelArbitrator tasked with watching over a new channel. Once a new
// channel has finished its final funding flow, it should be registered with
// the ChainArbitrator so we can properly react to any on-chain events. | [
"WatchNewChannel",
"sends",
"the",
"ChainArbitrator",
"a",
"message",
"to",
"create",
"a",
"ChannelArbitrator",
"tasked",
"with",
"watching",
"over",
"a",
"new",
"channel",
".",
"Once",
"a",
"new",
"channel",
"has",
"finished",
"its",
"final",
"funding",
"flow",... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L692-L745 |
129,281 | lightningnetwork/lnd | contractcourt/chain_arbitrator.go | SubscribeChannelEvents | func (c *ChainArbitrator) SubscribeChannelEvents(
chanPoint wire.OutPoint) (*ChainEventSubscription, error) {
// First, we'll attempt to look up the active watcher for this channel.
// If we can't find it, then we'll return an error back to the caller.
watcher, ok := c.activeWatchers[chanPoint]
if !ok {
return ... | go | func (c *ChainArbitrator) SubscribeChannelEvents(
chanPoint wire.OutPoint) (*ChainEventSubscription, error) {
// First, we'll attempt to look up the active watcher for this channel.
// If we can't find it, then we'll return an error back to the caller.
watcher, ok := c.activeWatchers[chanPoint]
if !ok {
return ... | [
"func",
"(",
"c",
"*",
"ChainArbitrator",
")",
"SubscribeChannelEvents",
"(",
"chanPoint",
"wire",
".",
"OutPoint",
")",
"(",
"*",
"ChainEventSubscription",
",",
"error",
")",
"{",
"// First, we'll attempt to look up the active watcher for this channel.",
"// If we can't fi... | // SubscribeChannelEvents returns a new active subscription for the set of
// possible on-chain events for a particular channel. The struct can be used by
// callers to be notified whenever an event that changes the state of the
// channel on-chain occurs. | [
"SubscribeChannelEvents",
"returns",
"a",
"new",
"active",
"subscription",
"for",
"the",
"set",
"of",
"possible",
"on",
"-",
"chain",
"events",
"for",
"a",
"particular",
"channel",
".",
"The",
"struct",
"can",
"be",
"used",
"by",
"callers",
"to",
"be",
"noti... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/contractcourt/chain_arbitrator.go#L751-L765 |
129,282 | lightningnetwork/lnd | channeldb/forwarding_log.go | encodeForwardingEvent | func encodeForwardingEvent(w io.Writer, f *ForwardingEvent) error {
return WriteElements(
w, f.IncomingChanID, f.OutgoingChanID, f.AmtIn, f.AmtOut,
)
} | go | func encodeForwardingEvent(w io.Writer, f *ForwardingEvent) error {
return WriteElements(
w, f.IncomingChanID, f.OutgoingChanID, f.AmtIn, f.AmtOut,
)
} | [
"func",
"encodeForwardingEvent",
"(",
"w",
"io",
".",
"Writer",
",",
"f",
"*",
"ForwardingEvent",
")",
"error",
"{",
"return",
"WriteElements",
"(",
"w",
",",
"f",
".",
"IncomingChanID",
",",
"f",
".",
"OutgoingChanID",
",",
"f",
".",
"AmtIn",
",",
"f",
... | // encodeForwardingEvent writes out the target forwarding event to the passed
// io.Writer, using the expected DB format. Note that the timestamp isn't
// serialized as this will be the key value within the bucket. | [
"encodeForwardingEvent",
"writes",
"out",
"the",
"target",
"forwarding",
"event",
"to",
"the",
"passed",
"io",
".",
"Writer",
"using",
"the",
"expected",
"DB",
"format",
".",
"Note",
"that",
"the",
"timestamp",
"isn",
"t",
"serialized",
"as",
"this",
"will",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_log.go#L85-L89 |
129,283 | lightningnetwork/lnd | channeldb/forwarding_log.go | decodeForwardingEvent | func decodeForwardingEvent(r io.Reader, f *ForwardingEvent) error {
return ReadElements(
r, &f.IncomingChanID, &f.OutgoingChanID, &f.AmtIn, &f.AmtOut,
)
} | go | func decodeForwardingEvent(r io.Reader, f *ForwardingEvent) error {
return ReadElements(
r, &f.IncomingChanID, &f.OutgoingChanID, &f.AmtIn, &f.AmtOut,
)
} | [
"func",
"decodeForwardingEvent",
"(",
"r",
"io",
".",
"Reader",
",",
"f",
"*",
"ForwardingEvent",
")",
"error",
"{",
"return",
"ReadElements",
"(",
"r",
",",
"&",
"f",
".",
"IncomingChanID",
",",
"&",
"f",
".",
"OutgoingChanID",
",",
"&",
"f",
".",
"Am... | // decodeForwardingEvent attempts to decode the raw bytes of a serialized
// forwarding event into the target ForwardingEvent. Note that the timestamp
// won't be decoded, as the caller is expected to set this due to the bucket
// structure of the forwarding log. | [
"decodeForwardingEvent",
"attempts",
"to",
"decode",
"the",
"raw",
"bytes",
"of",
"a",
"serialized",
"forwarding",
"event",
"into",
"the",
"target",
"ForwardingEvent",
".",
"Note",
"that",
"the",
"timestamp",
"won",
"t",
"be",
"decoded",
"as",
"the",
"caller",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_log.go#L95-L99 |
129,284 | lightningnetwork/lnd | channeldb/forwarding_log.go | AddForwardingEvents | func (f *ForwardingLog) AddForwardingEvents(events []ForwardingEvent) error {
// Before we create the database transaction, we'll ensure that the set
// of forwarding events are properly sorted according to their
// timestamp.
sort.Slice(events, func(i, j int) bool {
return events[i].Timestamp.Before(events[j].Ti... | go | func (f *ForwardingLog) AddForwardingEvents(events []ForwardingEvent) error {
// Before we create the database transaction, we'll ensure that the set
// of forwarding events are properly sorted according to their
// timestamp.
sort.Slice(events, func(i, j int) bool {
return events[i].Timestamp.Before(events[j].Ti... | [
"func",
"(",
"f",
"*",
"ForwardingLog",
")",
"AddForwardingEvents",
"(",
"events",
"[",
"]",
"ForwardingEvent",
")",
"error",
"{",
"// Before we create the database transaction, we'll ensure that the set",
"// of forwarding events are properly sorted according to their",
"// timest... | // AddForwardingEvents adds a series of forwarding events to the database.
// Before inserting, the set of events will be sorted according to their
// timestamp. This ensures that all writes to disk are sequential. | [
"AddForwardingEvents",
"adds",
"a",
"series",
"of",
"forwarding",
"events",
"to",
"the",
"database",
".",
"Before",
"inserting",
"the",
"set",
"of",
"events",
"will",
"be",
"sorted",
"according",
"to",
"their",
"timestamp",
".",
"This",
"ensures",
"that",
"all... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/channeldb/forwarding_log.go#L104-L150 |
129,285 | lightningnetwork/lnd | lntypes/hash.go | MakeHash | func MakeHash(newHash []byte) (Hash, error) {
nhlen := len(newHash)
if nhlen != HashSize {
return Hash{}, fmt.Errorf("invalid hash length of %v, want %v",
nhlen, HashSize)
}
var hash Hash
copy(hash[:], newHash)
return hash, nil
} | go | func MakeHash(newHash []byte) (Hash, error) {
nhlen := len(newHash)
if nhlen != HashSize {
return Hash{}, fmt.Errorf("invalid hash length of %v, want %v",
nhlen, HashSize)
}
var hash Hash
copy(hash[:], newHash)
return hash, nil
} | [
"func",
"MakeHash",
"(",
"newHash",
"[",
"]",
"byte",
")",
"(",
"Hash",
",",
"error",
")",
"{",
"nhlen",
":=",
"len",
"(",
"newHash",
")",
"\n",
"if",
"nhlen",
"!=",
"HashSize",
"{",
"return",
"Hash",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"... | // MakeHash returns a new Hash from a byte slice. An error is returned if
// the number of bytes passed in is not HashSize. | [
"MakeHash",
"returns",
"a",
"new",
"Hash",
"from",
"a",
"byte",
"slice",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"number",
"of",
"bytes",
"passed",
"in",
"is",
"not",
"HashSize",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lntypes/hash.go#L22-L33 |
129,286 | lightningnetwork/lnd | lntypes/hash.go | MakeHashFromStr | func MakeHashFromStr(newHash string) (Hash, error) {
// Return error if hash string is of incorrect length.
if len(newHash) != HashSize*2 {
return Hash{}, fmt.Errorf("invalid hash string length of %v, "+
"want %v", len(newHash), HashSize*2)
}
hash, err := hex.DecodeString(newHash)
if err != nil {
return Ha... | go | func MakeHashFromStr(newHash string) (Hash, error) {
// Return error if hash string is of incorrect length.
if len(newHash) != HashSize*2 {
return Hash{}, fmt.Errorf("invalid hash string length of %v, "+
"want %v", len(newHash), HashSize*2)
}
hash, err := hex.DecodeString(newHash)
if err != nil {
return Ha... | [
"func",
"MakeHashFromStr",
"(",
"newHash",
"string",
")",
"(",
"Hash",
",",
"error",
")",
"{",
"// Return error if hash string is of incorrect length.",
"if",
"len",
"(",
"newHash",
")",
"!=",
"HashSize",
"*",
"2",
"{",
"return",
"Hash",
"{",
"}",
",",
"fmt",
... | // MakeHashFromStr creates a Hash from a hex hash string. | [
"MakeHashFromStr",
"creates",
"a",
"Hash",
"from",
"a",
"hex",
"hash",
"string",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lntypes/hash.go#L36-L49 |
129,287 | lightningnetwork/lnd | lnwire/channel_reestablish.go | Encode | func (a *ChannelReestablish) Encode(w io.Writer, pver uint32) error {
err := WriteElements(w,
a.ChanID,
a.NextLocalCommitHeight,
a.RemoteCommitTailHeight,
)
if err != nil {
return err
}
// If the commit point wasn't sent, then we won't write out any of the
// remaining fields as they're optional.
if a.L... | go | func (a *ChannelReestablish) Encode(w io.Writer, pver uint32) error {
err := WriteElements(w,
a.ChanID,
a.NextLocalCommitHeight,
a.RemoteCommitTailHeight,
)
if err != nil {
return err
}
// If the commit point wasn't sent, then we won't write out any of the
// remaining fields as they're optional.
if a.L... | [
"func",
"(",
"a",
"*",
"ChannelReestablish",
")",
"Encode",
"(",
"w",
"io",
".",
"Writer",
",",
"pver",
"uint32",
")",
"error",
"{",
"err",
":=",
"WriteElements",
"(",
"w",
",",
"a",
".",
"ChanID",
",",
"a",
".",
"NextLocalCommitHeight",
",",
"a",
".... | // Encode serializes the target ChannelReestablish into the passed io.Writer
// observing the protocol version specified.
//
// This is part of the lnwire.Message interface. | [
"Encode",
"serializes",
"the",
"target",
"ChannelReestablish",
"into",
"the",
"passed",
"io",
".",
"Writer",
"observing",
"the",
"protocol",
"version",
"specified",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/channel_reestablish.go#L73-L92 |
129,288 | lightningnetwork/lnd | lnwire/channel_reestablish.go | Decode | func (a *ChannelReestablish) Decode(r io.Reader, pver uint32) error {
err := ReadElements(r,
&a.ChanID,
&a.NextLocalCommitHeight,
&a.RemoteCommitTailHeight,
)
if err != nil {
return err
}
// This message has to currently defined optional fields. As a result,
// we'll only proceed if there's still bytes r... | go | func (a *ChannelReestablish) Decode(r io.Reader, pver uint32) error {
err := ReadElements(r,
&a.ChanID,
&a.NextLocalCommitHeight,
&a.RemoteCommitTailHeight,
)
if err != nil {
return err
}
// This message has to currently defined optional fields. As a result,
// we'll only proceed if there's still bytes r... | [
"func",
"(",
"a",
"*",
"ChannelReestablish",
")",
"Decode",
"(",
"r",
"io",
".",
"Reader",
",",
"pver",
"uint32",
")",
"error",
"{",
"err",
":=",
"ReadElements",
"(",
"r",
",",
"&",
"a",
".",
"ChanID",
",",
"&",
"a",
".",
"NextLocalCommitHeight",
","... | // Decode deserializes a serialized ChannelReestablish stored in the passed
// io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface. | [
"Decode",
"deserializes",
"a",
"serialized",
"ChannelReestablish",
"stored",
"in",
"the",
"passed",
"io",
".",
"Reader",
"observing",
"the",
"specified",
"protocol",
"version",
".",
"This",
"is",
"part",
"of",
"the",
"lnwire",
".",
"Message",
"interface",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/lnwire/channel_reestablish.go#L98-L133 |
129,289 | lightningnetwork/lnd | invoices/invoiceregistry.go | NewRegistry | func NewRegistry(cdb *channeldb.DB, decodeFinalCltvExpiry func(invoice string) (
uint32, error)) *InvoiceRegistry {
return &InvoiceRegistry{
cdb: cdb,
debugInvoices: make(map[lntypes.Hash]*channeldb.Invoice),
notificationClients: make(map[uint32]*InvoiceSubscription),
... | go | func NewRegistry(cdb *channeldb.DB, decodeFinalCltvExpiry func(invoice string) (
uint32, error)) *InvoiceRegistry {
return &InvoiceRegistry{
cdb: cdb,
debugInvoices: make(map[lntypes.Hash]*channeldb.Invoice),
notificationClients: make(map[uint32]*InvoiceSubscription),
... | [
"func",
"NewRegistry",
"(",
"cdb",
"*",
"channeldb",
".",
"DB",
",",
"decodeFinalCltvExpiry",
"func",
"(",
"invoice",
"string",
")",
"(",
"uint32",
",",
"error",
")",
")",
"*",
"InvoiceRegistry",
"{",
"return",
"&",
"InvoiceRegistry",
"{",
"cdb",
":",
"cdb... | // NewRegistry creates a new invoice registry. The invoice registry
// wraps the persistent on-disk invoice storage with an additional in-memory
// layer. The in-memory layer is in place such that debug invoices can be added
// which are volatile yet available system wide within the daemon. | [
"NewRegistry",
"creates",
"a",
"new",
"invoice",
"registry",
".",
"The",
"invoice",
"registry",
"wraps",
"the",
"persistent",
"on",
"-",
"disk",
"invoice",
"storage",
"with",
"an",
"additional",
"in",
"-",
"memory",
"layer",
".",
"The",
"in",
"-",
"memory",
... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L81-L98 |
129,290 | lightningnetwork/lnd | invoices/invoiceregistry.go | Start | func (i *InvoiceRegistry) Start() error {
i.wg.Add(1)
go i.invoiceEventNotifier()
return nil
} | go | func (i *InvoiceRegistry) Start() error {
i.wg.Add(1)
go i.invoiceEventNotifier()
return nil
} | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"Start",
"(",
")",
"error",
"{",
"i",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n\n",
"go",
"i",
".",
"invoiceEventNotifier",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Start starts the registry and all goroutines it needs to carry out its task. | [
"Start",
"starts",
"the",
"registry",
"and",
"all",
"goroutines",
"it",
"needs",
"to",
"carry",
"out",
"its",
"task",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L101-L107 |
129,291 | lightningnetwork/lnd | invoices/invoiceregistry.go | invoiceEventNotifier | func (i *InvoiceRegistry) invoiceEventNotifier() {
defer i.wg.Done()
for {
select {
// A new invoice subscription for all invoices has just arrived!
// We'll query for any backlog notifications, then add it to the
// set of clients.
case newClient := <-i.newSubscriptions:
// Before we add the client to ... | go | func (i *InvoiceRegistry) invoiceEventNotifier() {
defer i.wg.Done()
for {
select {
// A new invoice subscription for all invoices has just arrived!
// We'll query for any backlog notifications, then add it to the
// set of clients.
case newClient := <-i.newSubscriptions:
// Before we add the client to ... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"invoiceEventNotifier",
"(",
")",
"{",
"defer",
"i",
".",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"// A new invoice subscription for all invoices has just arrived!",
"// We'll query for any backlog... | // invoiceEventNotifier is the dedicated goroutine responsible for accepting
// new notification subscriptions, cancelling old subscriptions, and
// dispatching new invoice events. | [
"invoiceEventNotifier",
"is",
"the",
"dedicated",
"goroutine",
"responsible",
"for",
"accepting",
"new",
"notification",
"subscriptions",
"cancelling",
"old",
"subscriptions",
"and",
"dispatching",
"new",
"invoice",
"events",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L128-L196 |
129,292 | lightningnetwork/lnd | invoices/invoiceregistry.go | dispatchToSingleClients | func (i *InvoiceRegistry) dispatchToSingleClients(event *invoiceEvent) {
// Dispatch to single invoice subscribers.
for _, client := range i.singleNotificationClients {
if client.hash != event.hash {
continue
}
select {
case client.ntfnQueue.ChanIn() <- &invoiceEvent{
state: event.state,
invoice: ... | go | func (i *InvoiceRegistry) dispatchToSingleClients(event *invoiceEvent) {
// Dispatch to single invoice subscribers.
for _, client := range i.singleNotificationClients {
if client.hash != event.hash {
continue
}
select {
case client.ntfnQueue.ChanIn() <- &invoiceEvent{
state: event.state,
invoice: ... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"dispatchToSingleClients",
"(",
"event",
"*",
"invoiceEvent",
")",
"{",
"// Dispatch to single invoice subscribers.",
"for",
"_",
",",
"client",
":=",
"range",
"i",
".",
"singleNotificationClients",
"{",
"if",
"client",... | // dispatchToSingleClients passes the supplied event to all notification clients
// that subscribed to all the invoice this event applies to. | [
"dispatchToSingleClients",
"passes",
"the",
"supplied",
"event",
"to",
"all",
"notification",
"clients",
"that",
"subscribed",
"to",
"all",
"the",
"invoice",
"this",
"event",
"applies",
"to",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L200-L216 |
129,293 | lightningnetwork/lnd | invoices/invoiceregistry.go | dispatchToClients | func (i *InvoiceRegistry) dispatchToClients(event *invoiceEvent) {
invoice := event.invoice
for clientID, client := range i.notificationClients {
// Before we dispatch this event, we'll check
// to ensure that this client hasn't already
// received this notification in order to
// ensure we don't duplicate a... | go | func (i *InvoiceRegistry) dispatchToClients(event *invoiceEvent) {
invoice := event.invoice
for clientID, client := range i.notificationClients {
// Before we dispatch this event, we'll check
// to ensure that this client hasn't already
// received this notification in order to
// ensure we don't duplicate a... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"dispatchToClients",
"(",
"event",
"*",
"invoiceEvent",
")",
"{",
"invoice",
":=",
"event",
".",
"invoice",
"\n\n",
"for",
"clientID",
",",
"client",
":=",
"range",
"i",
".",
"notificationClients",
"{",
"// Befo... | // dispatchToClients passes the supplied event to all notification clients that
// subscribed to all invoices. Add and settle indices are used to make sure that
// clients don't receive duplicate or unwanted events. | [
"dispatchToClients",
"passes",
"the",
"supplied",
"event",
"to",
"all",
"notification",
"clients",
"that",
"subscribed",
"to",
"all",
"invoices",
".",
"Add",
"and",
"settle",
"indices",
"are",
"used",
"to",
"make",
"sure",
"that",
"clients",
"don",
"t",
"recei... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L221-L286 |
129,294 | lightningnetwork/lnd | invoices/invoiceregistry.go | deliverBacklogEvents | func (i *InvoiceRegistry) deliverBacklogEvents(client *InvoiceSubscription) error {
// First, we'll query the database to see if based on the provided
// addIndex and settledIndex we need to deliver any backlog
// notifications.
addEvents, err := i.cdb.InvoicesAddedSince(client.addIndex)
if err != nil {
return e... | go | func (i *InvoiceRegistry) deliverBacklogEvents(client *InvoiceSubscription) error {
// First, we'll query the database to see if based on the provided
// addIndex and settledIndex we need to deliver any backlog
// notifications.
addEvents, err := i.cdb.InvoicesAddedSince(client.addIndex)
if err != nil {
return e... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"deliverBacklogEvents",
"(",
"client",
"*",
"InvoiceSubscription",
")",
"error",
"{",
"// First, we'll query the database to see if based on the provided",
"// addIndex and settledIndex we need to deliver any backlog",
"// notifications.... | // deliverBacklogEvents will attempts to query the invoice database for any
// notifications that the client has missed since it reconnected last. | [
"deliverBacklogEvents",
"will",
"attempts",
"to",
"query",
"the",
"invoice",
"database",
"for",
"any",
"notifications",
"that",
"the",
"client",
"has",
"missed",
"since",
"it",
"reconnected",
"last",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L290-L338 |
129,295 | lightningnetwork/lnd | invoices/invoiceregistry.go | deliverSingleBacklogEvents | func (i *InvoiceRegistry) deliverSingleBacklogEvents(
client *SingleInvoiceSubscription) error {
invoice, err := i.cdb.LookupInvoice(client.hash)
// It is possible that the invoice does not exist yet, but the client is
// already watching it in anticipation.
if err == channeldb.ErrInvoiceNotFound {
return nil
... | go | func (i *InvoiceRegistry) deliverSingleBacklogEvents(
client *SingleInvoiceSubscription) error {
invoice, err := i.cdb.LookupInvoice(client.hash)
// It is possible that the invoice does not exist yet, but the client is
// already watching it in anticipation.
if err == channeldb.ErrInvoiceNotFound {
return nil
... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"deliverSingleBacklogEvents",
"(",
"client",
"*",
"SingleInvoiceSubscription",
")",
"error",
"{",
"invoice",
",",
"err",
":=",
"i",
".",
"cdb",
".",
"LookupInvoice",
"(",
"client",
".",
"hash",
")",
"\n\n",
"// ... | // deliverSingleBacklogEvents will attempt to query the invoice database to
// retrieve the current invoice state and deliver this to the subscriber. Single
// invoice subscribers will always receive the current state right after
// subscribing. Only in case the invoice does not yet exist, nothing is sent
// yet. | [
"deliverSingleBacklogEvents",
"will",
"attempt",
"to",
"query",
"the",
"invoice",
"database",
"to",
"retrieve",
"the",
"current",
"invoice",
"state",
"and",
"deliver",
"this",
"to",
"the",
"subscriber",
".",
"Single",
"invoice",
"subscribers",
"will",
"always",
"r... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L345-L369 |
129,296 | lightningnetwork/lnd | invoices/invoiceregistry.go | SettleHodlInvoice | func (i *InvoiceRegistry) SettleHodlInvoice(preimage lntypes.Preimage) error {
i.Lock()
defer i.Unlock()
invoice, err := i.cdb.SettleHoldInvoice(preimage)
if err != nil {
log.Errorf("SettleHodlInvoice with preimage %v: %v", preimage, err)
return err
}
hash := preimage.Hash()
log.Debugf("Invoice(%v): settle... | go | func (i *InvoiceRegistry) SettleHodlInvoice(preimage lntypes.Preimage) error {
i.Lock()
defer i.Unlock()
invoice, err := i.cdb.SettleHoldInvoice(preimage)
if err != nil {
log.Errorf("SettleHodlInvoice with preimage %v: %v", preimage, err)
return err
}
hash := preimage.Hash()
log.Debugf("Invoice(%v): settle... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"SettleHodlInvoice",
"(",
"preimage",
"lntypes",
".",
"Preimage",
")",
"error",
"{",
"i",
".",
"Lock",
"(",
")",
"\n",
"defer",
"i",
".",
"Unlock",
"(",
")",
"\n\n",
"invoice",
",",
"err",
":=",
"i",
"."... | // SettleHodlInvoice sets the preimage of a hodl invoice. | [
"SettleHodlInvoice",
"sets",
"the",
"preimage",
"of",
"a",
"hodl",
"invoice",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L542-L563 |
129,297 | lightningnetwork/lnd | invoices/invoiceregistry.go | Cancel | func (i *invoiceSubscriptionKit) Cancel() {
if !atomic.CompareAndSwapUint32(&i.cancelled, 0, 1) {
return
}
select {
case i.inv.subscriptionCancels <- i.id:
case <-i.inv.quit:
}
i.ntfnQueue.Stop()
close(i.cancelChan)
i.wg.Wait()
} | go | func (i *invoiceSubscriptionKit) Cancel() {
if !atomic.CompareAndSwapUint32(&i.cancelled, 0, 1) {
return
}
select {
case i.inv.subscriptionCancels <- i.id:
case <-i.inv.quit:
}
i.ntfnQueue.Stop()
close(i.cancelChan)
i.wg.Wait()
} | [
"func",
"(",
"i",
"*",
"invoiceSubscriptionKit",
")",
"Cancel",
"(",
")",
"{",
"if",
"!",
"atomic",
".",
"CompareAndSwapUint32",
"(",
"&",
"i",
".",
"cancelled",
",",
"0",
",",
"1",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"select",
"{",
"case",
"i",
... | // Cancel unregisters the InvoiceSubscription, freeing any previously allocated
// resources. | [
"Cancel",
"unregisters",
"the",
"InvoiceSubscription",
"freeing",
"any",
"previously",
"allocated",
"resources",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L670-L684 |
129,298 | lightningnetwork/lnd | invoices/invoiceregistry.go | SubscribeNotifications | func (i *InvoiceRegistry) SubscribeNotifications(addIndex, settleIndex uint64) *InvoiceSubscription {
client := &InvoiceSubscription{
NewInvoices: make(chan *channeldb.Invoice),
SettledInvoices: make(chan *channeldb.Invoice),
addIndex: addIndex,
settleIndex: settleIndex,
invoiceSubscriptionKit... | go | func (i *InvoiceRegistry) SubscribeNotifications(addIndex, settleIndex uint64) *InvoiceSubscription {
client := &InvoiceSubscription{
NewInvoices: make(chan *channeldb.Invoice),
SettledInvoices: make(chan *channeldb.Invoice),
addIndex: addIndex,
settleIndex: settleIndex,
invoiceSubscriptionKit... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"SubscribeNotifications",
"(",
"addIndex",
",",
"settleIndex",
"uint64",
")",
"*",
"InvoiceSubscription",
"{",
"client",
":=",
"&",
"InvoiceSubscription",
"{",
"NewInvoices",
":",
"make",
"(",
"chan",
"*",
"channeld... | // SubscribeNotifications returns an InvoiceSubscription which allows the
// caller to receive async notifications when any invoices are settled or
// added. The invoiceIndex parameter is a streaming "checkpoint". We'll start
// by first sending out all new events with an invoice index _greater_ than
// this value. Aft... | [
"SubscribeNotifications",
"returns",
"an",
"InvoiceSubscription",
"which",
"allows",
"the",
"caller",
"to",
"receive",
"async",
"notifications",
"when",
"any",
"invoices",
"are",
"settled",
"or",
"added",
".",
"The",
"invoiceIndex",
"parameter",
"is",
"a",
"streamin... | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L701-L775 |
129,299 | lightningnetwork/lnd | invoices/invoiceregistry.go | SubscribeSingleInvoice | func (i *InvoiceRegistry) SubscribeSingleInvoice(
hash lntypes.Hash) *SingleInvoiceSubscription {
client := &SingleInvoiceSubscription{
Updates: make(chan *channeldb.Invoice),
invoiceSubscriptionKit: invoiceSubscriptionKit{
inv: i,
ntfnQueue: queue.NewConcurrentQueue(20),
cancelChan: make(chan s... | go | func (i *InvoiceRegistry) SubscribeSingleInvoice(
hash lntypes.Hash) *SingleInvoiceSubscription {
client := &SingleInvoiceSubscription{
Updates: make(chan *channeldb.Invoice),
invoiceSubscriptionKit: invoiceSubscriptionKit{
inv: i,
ntfnQueue: queue.NewConcurrentQueue(20),
cancelChan: make(chan s... | [
"func",
"(",
"i",
"*",
"InvoiceRegistry",
")",
"SubscribeSingleInvoice",
"(",
"hash",
"lntypes",
".",
"Hash",
")",
"*",
"SingleInvoiceSubscription",
"{",
"client",
":=",
"&",
"SingleInvoiceSubscription",
"{",
"Updates",
":",
"make",
"(",
"chan",
"*",
"channeldb"... | // SubscribeSingleInvoice returns an SingleInvoiceSubscription which allows the
// caller to receive async notifications for a specific invoice. | [
"SubscribeSingleInvoice",
"returns",
"an",
"SingleInvoiceSubscription",
"which",
"allows",
"the",
"caller",
"to",
"receive",
"async",
"notifications",
"for",
"a",
"specific",
"invoice",
"."
] | 1acd38e48c168b86c291524eb56b8fcdf04a910c | https://github.com/lightningnetwork/lnd/blob/1acd38e48c168b86c291524eb56b8fcdf04a910c/invoices/invoiceregistry.go#L779-L839 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.