diff --git a/node/node.go b/node/node.go index 46185847e..6f2cad1e5 100644 --- a/node/node.go +++ b/node/node.go @@ -714,7 +714,6 @@ func (n *Node) OnStop() { n.indexerService.Stop() // now stop the reactors - // TODO: gracefully disconnect from peers. n.sw.Stop() // stop mempool WAL diff --git a/p2p/switch.go b/p2p/switch.go index 31e0aa6e1..7e681d67c 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -221,11 +221,7 @@ func (sw *Switch) OnStart() error { func (sw *Switch) OnStop() { // Stop peers for _, p := range sw.peers.List() { - sw.transport.Cleanup(p) - p.Stop() - if sw.peers.Remove(p) { - sw.metrics.Peers.Add(float64(-1)) - } + sw.stopAndRemovePeer(p, nil) } // Stop reactors