diff --git a/api/service/legacysync/epoch_syncing.go b/api/service/legacysync/epoch_syncing.go index 641fb5889..8d1cb37c4 100644 --- a/api/service/legacysync/epoch_syncing.go +++ b/api/service/legacysync/epoch_syncing.go @@ -112,7 +112,7 @@ func syncLoop(bc core.BlockChain, syncConfig *SyncConfig) (timeout int) { } if otherEpoch < curEpoch { for _, peerCfg := range syncConfig.GetPeers() { - syncConfig.RemovePeer(peerCfg, fmt.Sprintf("[EPOCHSYNC]: current height is higher that others, remove peers: %s", peerCfg.String())) + syncConfig.RemovePeer(peerCfg, fmt.Sprintf("[EPOCHSYNC]: current height is higher than others, remove peers: %s", peerCfg.String())) } return 2 } diff --git a/p2p/discovery/option.go b/p2p/discovery/option.go index ce4259270..fff8eea20 100644 --- a/p2p/discovery/option.go +++ b/p2p/discovery/option.go @@ -42,7 +42,9 @@ func (opt DHTConfig) GetLibp2pRawOptions() ([]libp2p_dht.Option, error) { opts = append(opts, libp2p_dht.Concurrency(opt.DiscConcurrency)) } - opts = append(opts, libp2p_dht.DisableAutoRefresh()) + // TODO: to disable auto refresh to make sure there is no conflicts with protocol discovery functions + // it's not applicable for legacy sync + // opts = append(opts, libp2p_dht.DisableAutoRefresh()) return opts, nil } diff --git a/p2p/stream/common/streammanager/cooldown.go b/p2p/stream/common/streammanager/cooldown.go index f22f4956f..ef6d21bc9 100644 --- a/p2p/stream/common/streammanager/cooldown.go +++ b/p2p/stream/common/streammanager/cooldown.go @@ -36,6 +36,8 @@ func (cache *coolDownCache) Has(id peer.ID) bool { // Add adds the peer ID to the cache func (cache *coolDownCache) Add(id peer.ID) { + cache.mu.Lock() + defer cache.mu.Unlock() has := cache.timeCache.Has(string(id)) if !has { cache.timeCache.Add(string(id))