aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-12-07 14:47:58 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-12-10 11:59:34 +0100
commit44fef99e666e85caa7616765412d7becf97ab673 (patch)
treef0be071118b4b847463f12458347d8bd8577dca7 /src/main.cpp
parent96e8d120336cf4312cd5f42ba2f9aff17d4ad414 (diff)
downloadbitcoin-44fef99e666e85caa7616765412d7becf97ab673.tar.xz
net: Fix sent reject messages for blocks and transactions
Ever since we #5913 have been sending invalid reject messages for transactions and blocks. test: Add basic test for `reject` code Extend P2P test framework to make it possible to expect reject codes for transactions and blocks. Github-Pull: #7179 Rebased-From: 9fc6ed6003da42f035309240c715ce0fd063ec03 20411903d7b356ebb174df2daad1dcd5d6117f79
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 20e59b9dd4..d6fadd10b2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4824,7 +4824,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pfrom->id,
FormatStateMessage(state));
if (state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P
- pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
+ pfrom->PushMessage("reject", strCommand, (unsigned char)state.GetRejectCode(),
state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash);
if (nDoS > 0)
Misbehaving(pfrom->GetId(), nDoS);
@@ -4954,7 +4954,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
int nDoS;
if (state.IsInvalid(nDoS)) {
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
- pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
+ pfrom->PushMessage("reject", strCommand, (unsigned char)state.GetRejectCode(),
state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash);
if (nDoS > 0) {
LOCK(cs_main);