mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
Merge pull request #5913
5922b67Add assertion and cast before sending reject code (Wladimir J. van der Laan)a651403Add absurdly high fee message to validation state (for RPC propagation) (Shaul Kfir)
This commit is contained in:
10
src/main.cpp
10
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);
|
||||
|
||||
Reference in New Issue
Block a user