graph/db: thread context through to LookupAlias
This commit is contained in:
5 files changed
+18
-13
No files matched your search
+8
-4
@@ -4645,7 +4645,7 @@ func (r *rpcServer) ListChannels(ctx context.Context,
|
||||
// our list depending on the type of channels requested to us.
|
||||
isActive := peerOnline && linkActive
|
||||
channel, err := createRPCOpenChannel(
|
||||
r, dbChannel, isActive, in.PeerAliasLookup,
|
||||
ctx, r, dbChannel, isActive, in.PeerAliasLookup,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -4761,7 +4761,10 @@ func encodeCustomChanData(lnChan *channeldb.OpenChannel) ([]byte, error) {
|
||||
}
|
||||
|
||||
// createRPCOpenChannel creates an *lnrpc.Channel from the *channeldb.Channel.
|
||||
func createRPCOpenChannel(r *rpcServer, dbChannel *channeldb.OpenChannel,
|
||||
//
|
||||
//nolint:funlen
|
||||
func createRPCOpenChannel(ctx context.Context, r *rpcServer,
|
||||
dbChannel *channeldb.OpenChannel,
|
||||
isActive, peerAliasLookup bool) (*lnrpc.Channel, error) {
|
||||
|
||||
nodePub := dbChannel.IdentityPub
|
||||
@@ -4863,7 +4866,7 @@ func createRPCOpenChannel(r *rpcServer, dbChannel *channeldb.OpenChannel,
|
||||
|
||||
// Look up our channel peer's node alias if the caller requests it.
|
||||
if peerAliasLookup {
|
||||
peerAlias, err := r.server.graphDB.LookupAlias(nodePub)
|
||||
peerAlias, err := r.server.graphDB.LookupAlias(ctx, nodePub)
|
||||
if err != nil {
|
||||
peerAlias = fmt.Sprintf("unable to lookup "+
|
||||
"peer alias: %v", err)
|
||||
@@ -5307,7 +5310,8 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
|
||||
}
|
||||
case channelnotifier.OpenChannelEvent:
|
||||
channel, err := createRPCOpenChannel(
|
||||
r, event.Channel, true, false,
|
||||
updateStream.Context(), r,
|
||||
event.Channel, true, false,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user