-
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
Make sure to clear setAskFor in Dash submodules #1730
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -771,7 +771,6 @@ std::pair<CService, std::set<uint256> > CMasternodeMan::PopScheduledMnbRequestCo | |
void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman) | ||
{ | ||
if(fLiteMode) return; // disable all Dash specific functionality | ||
if(!masternodeSync.IsBlockchainSynced()) return; | ||
|
||
if (strCommand == NetMsgType::MNANNOUNCE) { //Masternode Broadcast | ||
|
||
|
@@ -780,6 +779,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData | |
|
||
pfrom->setAskFor.erase(mnb.GetHash()); | ||
|
||
if(!masternodeSync.IsBlockchainSynced()) return; | ||
|
||
LogPrint("masternode", "MNANNOUNCE -- Masternode announce, masternode=%s\n", mnb.vin.prevout.ToStringShort()); | ||
|
||
int nDos = 0; | ||
|
@@ -803,6 +804,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData | |
|
||
pfrom->setAskFor.erase(nHash); | ||
|
||
if(!masternodeSync.IsBlockchainSynced()) return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this should be IsMasternodeListSynced instead of IsBlockchainSynced?, a MN ping should generally happen after you have the MN in question no? I do see that AskForMN is called at the end of this block of code if the MN is not found for some reason. Is it used for your created but not yet broadcast MN for some reason? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Processing pings while in mn list sync state is ok. DSEG actually sends last ping invs together with mnb invs and (in general) there should be not that much of an overhead here imo. I woudn't touch it (at least for now). |
||
|
||
LogPrint("masternode", "MNPING -- Masternode ping, masternode=%s\n", mnp.vin.prevout.ToStringShort()); | ||
|
||
// Need LOCK2 here to ensure consistent locking order because the CheckAndUpdate call below locks cs_main | ||
|
@@ -909,6 +912,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData | |
CMasternodeVerification mnv; | ||
vRecv >> mnv; | ||
|
||
pfrom->setAskFor.erase(mnv.GetHash()); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean mWeAskedForVerification? Where is MNVERIFY requested with an INV? Can you show how this MNVERIFY ended up calling setAskFor.insert() on the client side? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We relay There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh I see ok this one was a little convoluted and was a harder path to trace but found it's pushing INV here: https://github.com/dashpay/dash/blob/master/src/masternode.h#L405 so that relays PushInventory to all connected nodes which sets up setAskFor.insert later. That is a good catch and wasn't sure of it when I was implementing I did see it but was not sure. Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think you need a
after line 915 where you added the setAskFor.erase()? I'm not sure if a MN message (case 2 & 3) can be verified if the list isn't synced? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, makes sense not to process |
||
if(mnv.vchSig1.empty()) { | ||
// CASE 1: someone asked me to verify myself /IP we are using/ | ||
SendVerifyReply(pfrom, mnv, connman); | ||
|
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.
not needed because if node is misbehaving by sending wrong peer version let setAskFor be not cleared to avoid DDOS .
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.
Good point, fixed. As a side note, this should probably be moved to the top of
CMasternodePayments::ProcessMessage
to avoid serving outdated nodes completely but that's out of the scope for this PR.