diff options
author | Adam Jonas <jonas@chaincode.com> | 2019-10-29 16:26:01 -0400 |
---|---|---|
committer | Adam Jonas <jonas@chaincode.com> | 2019-10-30 12:03:07 -0400 |
commit | c98bd13e675fbf5641ed64d551b63aaf55a1a8e9 (patch) | |
tree | de1e060178eb8efa14291ca328c26b82323b5976 /src/rpc/mining.cpp | |
parent | edd9d0781b96e71f88bd87b30dd10ad008b964a5 (diff) | |
download | bitcoin-c98bd13e675fbf5641ed64d551b63aaf55a1a8e9.tar.xz |
replace asserts in RPC code with CHECK_NONFATAL and add linter
Diffstat (limited to 'src/rpc/mining.cpp')
-rw-r--r-- | src/rpc/mining.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index bfa3e35d96..2038986bfc 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -512,7 +512,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) // Need to update only after we know CreateNewBlock succeeded pindexPrev = pindexPrevNew; } - assert(pindexPrev); + CHECK_NONFATAL(pindexPrev); CBlock* pblock = &pblocktemplate->block; // pointer for convenience const Consensus::Params& consensusParams = Params().GetConsensus(); @@ -554,7 +554,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) entry.pushKV("fee", pblocktemplate->vTxFees[index_in_template]); int64_t nTxSigOps = pblocktemplate->vTxSigOpsCost[index_in_template]; if (fPreSegWit) { - assert(nTxSigOps % WITNESS_SCALE_FACTOR == 0); + CHECK_NONFATAL(nTxSigOps % WITNESS_SCALE_FACTOR == 0); nTxSigOps /= WITNESS_SCALE_FACTOR; } entry.pushKV("sigops", nTxSigOps); @@ -643,9 +643,9 @@ static UniValue getblocktemplate(const JSONRPCRequest& request) int64_t nSigOpLimit = MAX_BLOCK_SIGOPS_COST; int64_t nSizeLimit = MAX_BLOCK_SERIALIZED_SIZE; if (fPreSegWit) { - assert(nSigOpLimit % WITNESS_SCALE_FACTOR == 0); + CHECK_NONFATAL(nSigOpLimit % WITNESS_SCALE_FACTOR == 0); nSigOpLimit /= WITNESS_SCALE_FACTOR; - assert(nSizeLimit % WITNESS_SCALE_FACTOR == 0); + CHECK_NONFATAL(nSizeLimit % WITNESS_SCALE_FACTOR == 0); nSizeLimit /= WITNESS_SCALE_FACTOR; } result.pushKV("sigoplimit", nSigOpLimit); |