Skip to content

Commit 6eb6298

Browse files
UdjinM6PastaPastaPasta
authored andcommitted
More of 12218 for Dash-specific code
1 parent 0255027 commit 6eb6298

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/evo/mnauth.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,19 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
6363
}
6464
if (fAlreadyHaveMNAUTH) {
6565
LOCK(cs_main);
66-
Misbehaving(pnode->GetId(), 100);
66+
Misbehaving(pnode->GetId(), 100, "duplicate mnauth");
67+
return;
68+
}
69+
70+
if (mnauth.proRegTxHash.IsNull()) {
71+
LOCK(cs_main);
72+
Misbehaving(pnode->GetId(), 100, "empty mnauth proRegTxHash");
6773
return;
6874
}
6975

7076
if (mnauth.proRegTxHash.IsNull() || !mnauth.sig.IsValid()) {
7177
LOCK(cs_main);
72-
Misbehaving(pnode->GetId(), 100);
78+
Misbehaving(pnode->GetId(), 100, "invalid mnauth signature");
7379
return;
7480
}
7581

@@ -80,7 +86,7 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
8086
// in case he was unlucky and not up to date, just let him be connected as a regular node, which gives him
8187
// a chance to get up-to-date and thus realize by himself that he's not a MN anymore. We still give him a
8288
// low DoS score.
83-
Misbehaving(pnode->GetId(), 10);
89+
Misbehaving(pnode->GetId(), 10, "missing mnauth masternode");
8490
return;
8591
}
8692

@@ -95,7 +101,7 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
95101
LOCK(cs_main);
96102
// Same as above, MN seems to not know about his fate yet, so give him a chance to update. If this is a
97103
// malicious actor (DoSing us), we'll ban him soon.
98-
Misbehaving(pnode->GetId(), 10);
104+
Misbehaving(pnode->GetId(), 10, "mnauth signature verification failed");
99105
return;
100106
}
101107

src/net_processing.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,8 +3137,8 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
31373137
if (BuildSimplifiedMNListDiff(cmd.baseBlockHash, cmd.blockHash, mnListDiff, strError)) {
31383138
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::MNLISTDIFF, mnListDiff));
31393139
} else {
3140-
LogPrint(BCLog::NET, "getmnlistdiff failed for baseBlockHash=%s, blockHash=%s. error=%s\n", cmd.baseBlockHash.ToString(), cmd.blockHash.ToString(), strError);
3141-
Misbehaving(pfrom->GetId(), 1);
3140+
strError = strprintf("getmnlistdiff failed for baseBlockHash=%s, blockHash=%s. error=%s", cmd.baseBlockHash.ToString(), cmd.blockHash.ToString(), strError);
3141+
Misbehaving(pfrom->GetId(), 1, strError);
31423142
}
31433143
return true;
31443144
}
@@ -3147,8 +3147,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
31473147
if (strCommand == NetMsgType::MNLISTDIFF) {
31483148
// we have never requested this
31493149
LOCK(cs_main);
3150-
Misbehaving(pfrom->GetId(), 100);
3151-
LogPrint(BCLog::NET, "received not-requested mnlistdiff. peer=%d\n", pfrom->GetId());
3150+
Misbehaving(pfrom->GetId(), 100, strprintf("received not-requested mnlistdiff. peer=%d", pfrom->GetId()));
31523151
return true;
31533152
}
31543153

0 commit comments

Comments
 (0)