snarkOS
snarkOS copied to clipboard
Skip computing block locators if peer is disconnected
Motivation
This PR improves the efficiency of validators and beacons by checking that the peer is still connected prior to preparing a Ping message.
While the call to send_ping will already check that the peer is still connected (via logic in can_send), it was observed that validators and beacons (due to the number of connections they maintain) frequently prepare block locators that are not used as the peer has already disconnected.
This PR thus significantly reduces the number of calls to Ledger for validators and beacons, thereby improving the efficiency in usage of RocksDB for other operations such as syncing blocks.
Validator will always get block locators when perform_handshake, however, there's no need to do it when peer is a Prover or a Client,right? https://github.com/AleoHQ/snarkOS/pull/2147
Validator will always get block locators when perform_handshake, however, there's no need to do it when peer is a Prover or a Client,right? #2147
I've answered this in PR 2147, thanks
Validator will always get block locators when perform_handshake, however, there's no need to do it when peer is a Prover or a Client,right? #2147
I've answered this in PR 2147, thanks
Ok, Maybe we can cached the block_locator and update it when new block is coming. https://github.com/AleoHQ/snarkOS/pull/2152