fix(mempool)!: limit mempool gossip rate on a per-peer basis #787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
As tx recv rate and tx send rate are global and shared by all peers. This is incorrect and not what we intended to get.
What was done?
Removed option
TxRecvRatePunishPeer
.Moved rate limit logic to p2pclient.
Implemented rate limits on peer level, with garbage collector (peers not used for last 60s have their rate limits removed)
How Has This Been Tested?
Configuration:
Result: 300 txs/15s (20 tx/s) gossiped and added to mempool of local_1 (correct result)
After changing recv lmit to 5:
yarn dashmate config set --config local_1 platform.drive.tenderdash.mempool.txRecvRateLimit 5
gets 150/15s = 10 txs/s == what expected
Breaking Changes
tx-recv-rate-punish-peer
config option was removed.Checklist:
For repository code-owners and collaborators only