From a2c93c1f0d787c24d06e88791f1223b5dc8d3f39 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 22 Oct 2018 05:17:51 -1100 Subject: [PATCH] Check tx during mining --- src/main.cpp | 2 +- src/miner.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 98fbb378a..c2ce7ec60 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2227,7 +2227,7 @@ namespace Consensus { // Ensure that coinbases are matured if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) { return state.Invalid( - error("CheckInputs(): tried to spend coinbase at depth %d", nSpendHeight - coins->nHeight), + error("CheckInputs(): tried to spend coinbase at depth %d/%d", nSpendHeight - coins->nHeight,(int32_t)COINBASE_MATURITY), REJECT_INVALID, "bad-txns-premature-spend-of-coinbase"); } diff --git a/src/miner.cpp b/src/miner.cpp index 874c1b4f8..188cffbef 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -335,6 +335,15 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) //fprintf(stderr,"dont have inputs\n"); continue; } + { + CValidationState state; + auto verifier = libzcash::ProofVerifier::Disabled(); + if ( !CheckTransaction(tx, state, verifier) ) + { + fprintf(stderr,"skip tx.(%s) that failed CheckTransaction\n",txid.GetHex().c_str()); + continue; + } + } CAmount nTxFees = view.GetValueIn(chainActive.LastTip()->nHeight,&interest,tx,chainActive.LastTip()->nTime)-tx.GetValueOut(); nTxSigOps += GetP2SHSigOpCount(tx, view);