From e2af3c0fa73938b2d36b31f3b804f9895cc5e8d6 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 26 Jun 2019 14:19:17 +0200 Subject: [PATCH] routerrpc: fix loop variable binding bug in querymc This bug caused all node pubkey to be the same. --- lnrpc/routerrpc/router_server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lnrpc/routerrpc/router_server.go b/lnrpc/routerrpc/router_server.go index 58e9d2ee..b900f6bf 100644 --- a/lnrpc/routerrpc/router_server.go +++ b/lnrpc/routerrpc/router_server.go @@ -445,7 +445,10 @@ func (s *Server) QueryMissionControl(ctx context.Context, snapshot := s.cfg.RouterBackend.MissionControl.GetHistorySnapshot() rpcNodes := make([]*NodeHistory, len(snapshot.Nodes)) - for i, node := range snapshot.Nodes { + for i, n := range snapshot.Nodes { + // Copy node struct to prevent loop variable binding bugs. + node := n + channels := make([]*ChannelHistory, len(node.Channels)) for j, channel := range node.Channels { channels[j] = &ChannelHistory{