Created the Broadcaster class (does not interact with Consensus as it should; this will be done in future work)
Wrote the broadcast (multi-hop) message optimization where you assume the original message sender's peers already have the message from that peer
Improve Syncer
Fix misc bugs
Fix misc tests
Misc refactors and cleanups
Detailed:
Move broadcast messages (multi-hop) to a new Broadcaster component that is owned by the ManagerNormal P2P engine
Syncer::sync() accepts a timeout in seconds (default 15s) to wait for peer connections to be established by the DiscoveryWorker
NodeConns::forceRefresh() releases the lock when requesting NodeInfo since that operation now calls NodeConns also
Refactor net/p2p/encoding.* to reuse common (de)serialization code blocks
When node N receives a broadcast message from node S, N will (optionally) not rebroadcast that message to any one of its peers that is also a peer of S (see: ManagerNormal::sendMessageToAll())
Syncer::sync() can now also request block ranges, with both a block height range and a maximum block data download size per request
The return value of methods that try to add both regular and validator transactions to the data model is now TxStatus, which contains status codes for both transaction types
Changed how Broadcaster decides how to process and rebroadcast certain messages
Remove BroadcastInfo (renamed to NotifyInfo, essentially)
Changed ManagerBase destructor to virtual
Removed ManagerDiscovery destructor
Fix missing break in ManagerNormal::handleMessage()
Add NodeType tracking to NodeConns to conform to the existing node list serializer/deserializer helper in encoding.*
Fix deadlock in ManagerBase: stop() vs asyncHandleMessage() acquiring stateMutex_ exclusively
Fix rdPoS test that waits for 10 blocks the right way
Add Utils::safePrintTest() to print also when in testcases
Add missing include guard in net/p2p/client.h
Fix State test so that it waits for blocks instead of sleep()
Need to review (not a complete list):
Is what we are doing in transaction broadcasts already filtering out duplicates? Probably, yes.
Do we need a unit test (& additional support code) for the broadcast optimization? --> I think it is very unlikely that this is not working to specifications, and it would require extra instrumentation to be added.
What to do about Broadcaster::blockBroadcastMutex_ ? We'll deal with this later
Is the assumption that all peers from the NodeInfo in a ManagerNormal context are NORMAL nodes correct? No, fixed
Do we remove the BroadcastInfo message type, since it doesn't appear to be flooded/routed? Deleted
This PR in a nutshell:
Detailed:
Need to review
(not a complete list):Is what we are doing in transaction broadcasts already filtering out duplicates?Probably, yes.What to do about Broadcaster::blockBroadcastMutex_ ?We'll deal with this laterIs the assumption that all peers from the NodeInfo in a ManagerNormal context are NORMAL nodes correct?No, fixedDo we remove the BroadcastInfo message type, since it doesn't appear to be flooded/routed?Deleted