-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement RemoveAskFor to indicate that we're not interested in an item anymore #2384
Conversation
Forgot to describe the reason I implemented this in the first place:
I always found these very confusing because it looks like the node is trying to re-request some inventory items or that it received duplicated INV items long after the message was received. Mostly noticed this my LLMQ branch where a lot of message are exchanged in intra-quorum communication, but now also observed this in the auto IX test cases, so I decided to backport this commit from my local LLMQ branch. |
…em anymore When an INV item is received from the first node, the item is requested immediately. If the same item is received from another node, an entry is added to mapAskFor which marks the item for re-requesting in case the first node did not respond. When the item is received from the first node, the item was previously never removed from mapAskFor. Only the later getdata loop in SendMessages would then gradually remove items from the map. This is quite delayed however as the entries in mapAskFor have a timeout value. RemoveAskFor allows to remove all entries from mapAskFor and setAskFor when we are not interested in the item anymore (e.g. because we received it already).
24d741b
to
b35ee5c
Compare
Looks good in general but why constructing and passing a |
@UdjinM6 True, didn't make sense. Using uint256 now. |
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.
The last commit feels incomplete... see inline comments.
src/instantx.cpp
Outdated
pfrom->setAskFor.erase(nVoteHash); | ||
{ | ||
LOCK(cs_main); | ||
connman.RemoveAskFor(CInv(MSG_TXLOCK_VOTE, nVoteHash)); |
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.
still uses CInv
?
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.
Strange. Looks like I did the global search too early after branch switching (CLion indexes out of date maybe). Fixing in a squashed commit.
src/masternode-payments.cpp
Outdated
pfrom->setAskFor.erase(nHash); | ||
{ | ||
LOCK(cs_main); | ||
connman.RemoveAskFor(CInv(MSG_MASTERNODE_PAYMENT_VOTE, nHash)); |
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.
same
src/masternodeman.cpp
Outdated
pfrom->setAskFor.erase(mnb.GetHash()); | ||
{ | ||
LOCK(cs_main); | ||
connman.RemoveAskFor(CInv(MSG_MASTERNODE_ANNOUNCE, mnb.GetHash())); |
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.
same + 2 more below
3d43eaf
to
677f49a
Compare
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.
Looks good now 👍
utACK
…em anymore (dashpay#2384) * Implement RemoveAskFor to indicate that we're not interested in an item anymore When an INV item is received from the first node, the item is requested immediately. If the same item is received from another node, an entry is added to mapAskFor which marks the item for re-requesting in case the first node did not respond. When the item is received from the first node, the item was previously never removed from mapAskFor. Only the later getdata loop in SendMessages would then gradually remove items from the map. This is quite delayed however as the entries in mapAskFor have a timeout value. RemoveAskFor allows to remove all entries from mapAskFor and setAskFor when we are not interested in the item anymore (e.g. because we received it already). * Call RemoveAskFor whenever we receive a message * Only pass hash instead of CInv object to RemoveAskFor
When an INV item is received from the first node, the item is requested
immediately. If the same item is received from another node, an entry is
added to mapAskFor which marks the item for re-requesting in case the first
node did not respond. When the item is received from the first node,
the item was previously never removed from mapAskFor. Only the later getdata
loop in SendMessages would then gradually remove items from the map. This
is quite delayed however as the entries in mapAskFor have a timeout value.
RemoveAskFor allows to remove all entries from mapAskFor and setAskFor
when we are not interested in the item anymore (e.g. because we received
it already).