diff options
| author | John Newbery <[email protected]> | 2017-03-31 14:18:15 -0400 |
|---|---|---|
| committer | John Newbery <[email protected]> | 2017-03-31 14:22:25 -0400 |
| commit | 5d08c9c579ba8cc7b684105c6a08263992b08d52 (patch) | |
| tree | 96962d7d1ea9464c59ee23838a468f268ecda43c /src/net_processing.cpp | |
| parent | Merge #10114: [tests] sync_with_ping should assert that ping hasn't timed out (diff) | |
| download | discoin-5d08c9c579ba8cc7b684105c6a08263992b08d52.tar.xz discoin-5d08c9c579ba8cc7b684105c6a08263992b08d52.zip | |
Send the correct error code in reject messages
Diffstat (limited to 'src/net_processing.cpp')
| -rw-r--r-- | src/net_processing.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 71a0a1de2..abf9797af 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -855,8 +855,8 @@ void PeerLogicValidation::BlockChecked(const CBlock& block, const CValidationSta int nDoS = 0; if (state.IsInvalid(nDoS)) { - if (it != mapBlockSource.end() && State(it->second.first)) { - assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes + // Don't send reject message with code 0 or an internal reject code. + if (it != mapBlockSource.end() && State(it->second.first) && state.GetRejectCode() > 0 && state.GetRejectCode() < REJECT_INTERNAL) { CBlockReject reject = {(unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), hash}; State(it->second.first)->rejects.push_back(reject); if (nDoS > 0 && it->second.second) @@ -1942,7 +1942,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr LogPrint("mempoolrej", "%s from peer=%d was not accepted: %s\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state)); - if (state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P + if (state.GetRejectCode() > 0 && state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::REJECT, strCommand, (unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash)); if (nDoS > 0) { |