snarkOS
snarkOS copied to clipboard
[Bug] Do not allow bootstrap peers to be trusted peers
🐛 Bug Report
There appears not to be any code that prevents a peer from being both a bootstrap peer and a trusted peer. If it is both, then there is suboptimal code that can cause the peer to be disconnected and then immediately reconnected (possibly with a gap of being able to use it). This can happen if two bootstrap peers happen to be connected, in which case handle_bootstrap_peers(), (which is only called from heartbeat()), will disconnect a random one of them. If the disconnected one is a trusted peer, the next function called from heartbeat() is handle_trusted_peers(), which will initiate a reconnection attempt. We should fix this.