Add option 'mempooltxinputlimit' so the mempool can reject a transaction
based on the number of transparent inputs.
This commit is contained in:
11
src/main.cpp
11
src/main.cpp
@@ -1057,6 +1057,17 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
if (pfMissingInputs)
|
||||
*pfMissingInputs = false;
|
||||
|
||||
// Node operator can choose to reject tx by number of transparent inputs
|
||||
static_assert(std::numeric_limits<size_t>::max() >= std::numeric_limits<int64_t>::max(), "size_t too small");
|
||||
size_t limit = (size_t) GetArg("-mempooltxinputlimit", 0);
|
||||
if (limit > 0) {
|
||||
size_t n = tx.vin.size();
|
||||
if (n > limit) {
|
||||
LogPrint("mempool", "Dropping txid %s : too many transparent inputs %zu > limit %zu\n", tx.GetHash().ToString(), n, limit );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto verifier = libzcash::ProofVerifier::Strict();
|
||||
if (!CheckTransaction(tx, state, verifier))
|
||||
return error("AcceptToMemoryPool: CheckTransaction failed");
|
||||
|
||||
Reference in New Issue
Block a user