-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add 100-500ms of per-peer inventory delay #2383
Conversation
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.
Something I noticed in decred/dcrd#3363 was that the address list was shuffled.
Should you also shuffle the address list here?
I know you said:
Currently, with every peer using a 500ms ticker, if no changes occur to the graph of connected nodes, messages will always propagate the nodes in the same order. However, if all nodes are randomizing their inventory batching delays, the next peer who will relay a message first during the next hop will always be different.
So it's possible that shuffling the address list is redundant, but I figured I'd ask if it was worth doing.
const d = maxInvTrickleTimeout - minInvTrickleTimeout | ||
return minInvTrickleTimeout + rand.Duration(d) | ||
} | ||
timer := time.NewTimer(timeout()) |
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.
What's the point of setting the variable timer
here? It doesn't look like it's used, and you're already using timer.Reset(timeout())
below on line 526.
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.
Oh I'm sorry, I spoke too soon. You have to wait for timer.C
, and then you reset it with a new randomized timeout()
. I misread it as doubling-up the time-duration.
dcrwallet does not respond to |
or did you mean this, shuffling the inventory before we publish?
|
Yes, sorry. Shuffling the inventory. Just wondering if it was worth doing. |
it's a good idea. we shouldn't need to depend on the order being dependency order, as both mempool and mixpool handle orphans. |
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 like the changes to PublishTransactions
and PublishMixMessages
. A lot easier to read.
I actually disagree with this. In fact, it's a bad idea, imo. It's true that mempool handles orphans, but only a pretty limited number of them on purpose to prevent malicious actors being able to fill up memory without actually spending any real coins. It assumes that they are going to mostly be advertised in dependency order. Changing that would make it so malicious actors can hinder propagation by intentionally sending a bunch of junk to flush orphan buffers. |
Similar to a recent dcrd change, we want published inventory by SPV wallet peers be submitted with a small random amount of delay. In this change we use the same logic that dcrd now uses to pick, for each connected peer, a random delay between 100-500ms before the inventory is sent.
Similar to a recent dcrd change, we want published inventory by SPV wallet peers be submitted with a small random amount of delay. In this change we use the same logic that dcrd now uses to pick, for each connected peer, a random delay between 100-500ms before the inventory is sent.