aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-08-05 19:12:46 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-08-05 19:12:48 +0200
commita0625b8085aa379ac5f7bdca6f2cbf3cbb4a5d0a (patch)
treeefb535486e2d574f13049963f3a25c0757a5ebf8 /src/main.cpp
parentc3848000277d5ab6b5f5faecb1d21b89374ef999 (diff)
parent5922b6774e352e802ca9a347cc224cfebf1a6a7d (diff)
downloadbitcoin-a0625b8085aa379ac5f7bdca6f2cbf3cbb4a5d0a.tar.xz
Merge pull request #5913
5922b67 Add assertion and cast before sending reject code (Wladimir J. van der Laan) a651403 Add absurdly high fee message to validation state (for RPC propagation) (Shaul Kfir)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 52d543c117..79cc606856 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -927,9 +927,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000)
- return error("AcceptToMemoryPool: absurdly high fees %s, %d > %d",
- hash.ToString(),
- nFees, ::minRelayTxFee.GetFee(nSize) * 10000);
+ return state.Invalid(error("AcceptToMemoryPool: absurdly high fees %s, %d > %d",
+ hash.ToString(),
+ nFees, ::minRelayTxFee.GetFee(nSize) * 10000),
+ REJECT_HIGHFEE, "absurdly-high-fee");
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
@@ -1238,7 +1239,8 @@ void static InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state
if (state.IsInvalid(nDoS)) {
std::map<uint256, NodeId>::iterator it = mapBlockSource.find(pindex->GetBlockHash());
if (it != mapBlockSource.end() && State(it->second)) {
- CBlockReject reject = {state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
+ assert(state.GetRejectCode() < 0x100);
+ CBlockReject reject = {(unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
State(it->second)->rejects.push_back(reject);
if (nDoS > 0)
Misbehaving(it->second, nDoS);