-
Notifications
You must be signed in to change notification settings - Fork 992
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
Track blocks we requested, always broadcast otherwise #2349
Track blocks we requested, always broadcast otherwise #2349
Conversation
Generally this is nice! 👍 Just a bit of question to avoid us forgot sth: I see the gossip block request is Can we use this to differentiate in the |
I don't think we can reliably. We have no control over whether peers send us blocks vs. compact blocks and we should avoid making local decisions based on what other nodes send us. |
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.
I think makes a lot of sense.
We broadcast things we receive via broadcast. And we suppress anything we explicitly ask for.
None of this is sync vs. non-sync or mining vs. non-mining related (which are orthogonal to this).
👍
Agree, since only the remote peers can decide what to send. |
So it turns out this is actually subtly broken. There are two different scenarios in which we can "ask for a block" -
In case (1) we want to track blocks we requested and suppress both the hooks and the broadcast. Turns out nodes have not been broadcasting block headers to their peers if they first attempted to process a compact block then fallback to requesting and processing the full block. |
This is an attempt at improving upon #2324. It fixes the following issue:
This PR adds the tracking of block requests we originate in the
TrackingAdapter
(which was already tracking what we received). We can then check upon receiving a block if it was in the list we requested and propagate this information to decide whether to relay or not. This is a little longer than I'd like but most of the changes are just due to adding a boolean toblock_received