Add experimental validation & proposal relay reduction support:

- Add validation/proposal reduce-relay feature negotiation to
  the handshake
- Make squelch duration proportional to a number of peers that
  can be squelched
- Refactor makeRequest()/makeResponse() to facilitate handshake
  unit-testing
- Fix compression enable flag for inbound peer
- Fix compression algorithm parsing in the header parser
- Fix squelch duration in onMessage(TMSquelch)

This commit fixes 3624, fixes 3639 and fixes 3641
This commit is contained in:
Gregory Tsipenyuk
2020-10-21 12:41:04 -04:00
committed by Nik Bougalis
parent 44fe0e1fc4
commit 74d96ff4bd
22 changed files with 1076 additions and 260 deletions

View File

@@ -1388,7 +1388,7 @@ std::shared_ptr<Message>
makeSquelchMessage(
PublicKey const& validator,
bool squelch,
uint64_t squelchDuration)
uint32_t squelchDuration)
{
protocol::TMSquelch m;
m.set_squelch(squelch);
@@ -1402,12 +1402,11 @@ void
OverlayImpl::unsquelch(PublicKey const& validator, Peer::id_t id) const
{
if (auto peer = findPeerByShortID(id);
peer && app_.config().REDUCE_RELAY_SQUELCH)
peer && app_.config().VP_REDUCE_RELAY_SQUELCH)
{
// optimize - multiple message with different
// validator might be sent to the same peer
auto m = makeSquelchMessage(validator, false, 0);
peer->send(m);
peer->send(makeSquelchMessage(validator, false, 0));
}
}
@@ -1418,10 +1417,9 @@ OverlayImpl::squelch(
uint32_t squelchDuration) const
{
if (auto peer = findPeerByShortID(id);
peer && app_.config().REDUCE_RELAY_SQUELCH)
peer && app_.config().VP_REDUCE_RELAY_SQUELCH)
{
auto m = makeSquelchMessage(validator, true, squelchDuration);
peer->send(m);
peer->send(makeSquelchMessage(validator, true, squelchDuration));
}
}