Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Commit dfc3c98

Browse files
nolashacud
authored andcommitted
network: Add capabilities if peer from store does not have it (#1791)
1 parent 5122fcc commit dfc3c98

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

network/hive.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/ethereum/go-ethereum/p2p"
2626
"github.com/ethereum/go-ethereum/p2p/enode"
2727
"github.com/ethersphere/swarm/log"
28+
"github.com/ethersphere/swarm/network/capability"
2829
"github.com/ethersphere/swarm/state"
2930
)
3031

@@ -240,6 +241,14 @@ func (h *Hive) loadPeers() error {
240241
}
241242
return err
242243
}
244+
// workaround for old node stores not containing capabilities
245+
for i := range as {
246+
if as[i].Capabilities == nil {
247+
caps := capability.NewCapabilities()
248+
caps.Add(fullCapability)
249+
as[i] = as[i].WithCapabilities(caps)
250+
}
251+
}
243252
log.Info(fmt.Sprintf("hive %08x: peers loaded", h.BaseAddr()[:4]))
244253

245254
return h.Register(as...)

0 commit comments

Comments
 (0)