#include "utilmoneystr.h"
#include "validationinterface.h"
#include "wallet/asyncrpcoperation_sendmany.h"
+#include "wallet/asyncrpcoperation_shieldcoinbase.h"
#include <sstream>
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");
bool ContextualCheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, bool cacheStore, const Consensus::Params& consensusParams, std::vector<CScriptCheck> *pvChecks)
{
- if (!Consensus::CheckTxInputs(tx, state, inputs, GetSpendHeight(inputs), consensusParams))
- return false;
-
if (!tx.IsCoinBase())
{
+ if (!Consensus::CheckTxInputs(tx, state, inputs, GetSpendHeight(inputs), consensusParams)) {
+ return false;
+ }
+
if (pvChecks)
pvChecks->reserve(tx.vin.size());
REJECT_INVALID, "bad-txns-BIP30");
}
- unsigned int flags = SCRIPT_VERIFY_P2SH;
+ unsigned int flags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
- // Start enforcing the DERSIG (BIP66) rules, for block.nVersion=3 blocks,
- // when 75% of the network has upgraded:
- if (block.nVersion >= 3) {
- flags |= SCRIPT_VERIFY_DERSIG;
- }
-
- // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4
- // blocks, when 75% of the network has upgraded:
- if (block.nVersion >= 4) {
- flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
- }
+ // DERSIG (BIP66) is also always enforced, but does not have a flag.
CBlockUndo blockundo;
}
}
- // Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
- // if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
- // Since MIN_BLOCK_VERSION = 4 all blocks with nHeight > 0 should satisfy this.
- // This rule is not applied to the genesis block, which didn't include the height
- // in the coinbase.
+ // Enforce BIP 34 rule that the coinbase starts with serialized block height.
+ // In Zcash this has been enforced since launch, except that the genesis
+ // block didn't include the height in the coinbase (see Zcash protocol spec
+ // section '6.8 Bitcoin Improvement Proposals').
if (nHeight > 0)
{
CScript expect = CScript() << nHeight;