-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't resend tx hashes that were sent to us #5449
Conversation
src/Nethermind/Nethermind.Network/P2P/ProtocolHandlers/SyncPeerProtocolHandlerBase.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In PR description:
When we get sent transaction or hash don't re-send it to the peer that send it in the first place
- full transactions are sent anyway: https://github.com/NethermindEth/nethermind/blob/perf/tx-pool-peer/src/Nethermind/Nethermind.Network/P2P/ProtocolHandlers/SyncPeerProtocolHandlerBase.cs#L198
and it is fine - we want to broadcast local txs as fast and as wide as possible - PR name
Don't resend tx hashes that were sent to us
- we already have protection from sending hashes to the peer which sent this tx to us:
https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.TxPool/TxBroadcaster.cs#L224
https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.TxPool/TxBroadcaster.cs#L239-L242
I'm not sure why you achieved such reduction in number of hashes sent, for me it looks like we are doing the same as before, just adding to the cache tx hashes which will not be sent anyway - we have logic in TxBroadcaster
which is preparing messages exclusively for every peer to protect from sending back hash to the original sender of tx.
Good question about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I got it, we were not sending back hashes of txs added to the pool, now we are not sending back hashes received and not pooled too. At this point I think we can consider simplifying TxBroadcaster
- remove logic of skipping tx by sender and prepare only one HashesMessage
for all peers, and then not-resending will be handled by peer cache
I mean we can drop this https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Nethermind.TxPool/TxBroadcaster.cs#L234-L244 Also I think we should add
to |
Actually it is wrong, we were not sending not pooled hashes anyway, hashes are added to broadcaster only after adding txs to the pool. But we could received tx hash from many peers and full tx from only one. Before we were announcing that hash to every peer except of one, now we are announcing only to the ones which didn't sent that hash to us. It explains why number of sent hashes dropped. Refactoring |
|
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?