mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Add absurdly high fee message to validation state (for RPC propagation)
This commit is contained in:
parent
da77a6f761
commit
a651403e09
@ -28,12 +28,12 @@ private:
|
||||
} mode;
|
||||
int nDoS;
|
||||
std::string strRejectReason;
|
||||
unsigned char chRejectCode;
|
||||
unsigned int chRejectCode;
|
||||
bool corruptionPossible;
|
||||
public:
|
||||
CValidationState() : mode(MODE_VALID), nDoS(0), chRejectCode(0), corruptionPossible(false) {}
|
||||
bool DoS(int level, bool ret = false,
|
||||
unsigned char chRejectCodeIn=0, std::string strRejectReasonIn="",
|
||||
unsigned int chRejectCodeIn=0, std::string strRejectReasonIn="",
|
||||
bool corruptionIn=false) {
|
||||
chRejectCode = chRejectCodeIn;
|
||||
strRejectReason = strRejectReasonIn;
|
||||
@ -45,7 +45,7 @@ public:
|
||||
return ret;
|
||||
}
|
||||
bool Invalid(bool ret = false,
|
||||
unsigned char _chRejectCode=0, std::string _strRejectReason="") {
|
||||
unsigned int _chRejectCode=0, std::string _strRejectReason="") {
|
||||
return DoS(0, ret, _chRejectCode, _strRejectReason);
|
||||
}
|
||||
bool Error(const std::string& strRejectReasonIn) {
|
||||
@ -73,7 +73,7 @@ public:
|
||||
bool CorruptionPossible() const {
|
||||
return corruptionPossible;
|
||||
}
|
||||
unsigned char GetRejectCode() const { return chRejectCode; }
|
||||
unsigned int GetRejectCode() const { return chRejectCode; }
|
||||
std::string GetRejectReason() const { return strRejectReason; }
|
||||
};
|
||||
|
||||
|
@ -1031,9 +1031,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",
|
||||
return state.Invalid(error("AcceptToMemoryPool: absurdly high fees %s, %d > %d",
|
||||
hash.ToString(),
|
||||
nFees, ::minRelayTxFee.GetFee(nSize) * 10000);
|
||||
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.
|
||||
|
@ -497,4 +497,7 @@ extern CBlockTreeDB *pblocktree;
|
||||
*/
|
||||
int GetSpendHeight(const CCoinsViewCache& inputs);
|
||||
|
||||
/** local "reject" message codes for RPC which can not be triggered by p2p trasactions */
|
||||
static const unsigned int REJECT_HIGHFEE = 0x100;
|
||||
|
||||
#endif // BITCOIN_MAIN_H
|
||||
|
Loading…
Reference in New Issue
Block a user