Skip to content

Commit

Permalink
fix: decode peer IDs from limits.json (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
guseggert authored Apr 18, 2022
1 parent 65fb3af commit 69b6171
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion p2p/host/resource-manager/limit_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func NewLimiterFromJSON(in io.Reader, defaults DefaultLimitConfig) (*BasicLimite
if len(cfg.Peer) > 0 {
limiter.PeerLimits = make(map[peer.ID]Limit, len(cfg.Peer))
for p, cfgLimit := range cfg.Peer {
pid, err := peer.IDFromString(p)
pid, err := peer.Decode(p)
if err != nil {
return nil, fmt.Errorf("invalid peer ID %s: %w", p, err)
}
Expand Down
5 changes: 5 additions & 0 deletions p2p/host/resource-manager/limit_config_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,10 @@
},
"PeerDefault": {
"Memory": 4096
},
"Peer": {
"12D3KooWPFH2Bx2tPfw6RLxN8k2wh47GRXgkt9yrAHU37zFwHWzS": {
"Memory": 4096
}
}
}

0 comments on commit 69b6171

Please sign in to comment.