Skip to content

Commit 71d7b38

Browse files
authored
Fix NodeInfo protocols decoding (#3081)
1 parent 3c95db0 commit 71d7b38

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/rpcdaemon/services/eth_backend.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,16 @@ func (back *RemoteBackend) NodeInfo(ctx context.Context, limit uint32) ([]p2p.No
182182

183183
ret := make([]p2p.NodeInfo, 0, len(nodes.NodesInfo))
184184
for _, node := range nodes.NodesInfo {
185-
var protocols map[string]interface{}
186-
if err = json.Unmarshal(node.Protocols, &protocols); err != nil {
185+
var rawProtocols map[string]json.RawMessage
186+
if err = json.Unmarshal(node.Protocols, &rawProtocols); err != nil {
187187
return nil, fmt.Errorf("cannot decode protocols metadata: %w", err)
188188
}
189189

190+
protocols := make(map[string]interface{}, len(rawProtocols))
191+
for k, v := range rawProtocols {
192+
protocols[k] = v
193+
}
194+
190195
ret = append(ret, p2p.NodeInfo{
191196
Enode: node.Enode,
192197
ID: node.Id,

0 commit comments

Comments
 (0)