@@ -302,7 +302,7 @@ bool CheckSequenceLocks(CBlockIndex* tip,
302
302
}
303
303
304
304
// Returns the script flags which should be checked for a given block
305
- static unsigned int GetBlockScriptFlags (const CBlockIndex* pindex , const Consensus::Params& chainparams);
305
+ static unsigned int GetBlockScriptFlags (const CBlockIndex& block_index , const Consensus::Params& chainparams);
306
306
307
307
static void LimitMempoolSize (CTxMemPool& pool, CCoinsViewCache& coins_cache, size_t limit, std::chrono::seconds age)
308
308
EXCLUSIVE_LOCKS_REQUIRED(pool.cs, ::cs_main)
@@ -939,7 +939,7 @@ bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws)
939
939
// There is a similar check in CreateNewBlock() to prevent creating
940
940
// invalid blocks (using TestBlockValidity), however allowing such
941
941
// transactions into the mempool can be exploited as a DoS attack.
942
- unsigned int currentBlockScriptVerifyFlags = GetBlockScriptFlags (m_active_chainstate.m_chain .Tip (), chainparams.GetConsensus ());
942
+ unsigned int currentBlockScriptVerifyFlags{ GetBlockScriptFlags (* m_active_chainstate.m_chain .Tip (), chainparams.GetConsensus ())} ;
943
943
if (!CheckInputsFromMempoolAndCache (tx, state, m_view, m_pool, currentBlockScriptVerifyFlags,
944
944
ws.m_precomputed_txdata , m_active_chainstate.CoinsTip ())) {
945
945
LogPrintf (" BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s\n " , hash.ToString (), state.ToString ());
@@ -1579,7 +1579,7 @@ class WarningBitsConditionChecker : public AbstractThresholdConditionChecker
1579
1579
1580
1580
static ThresholdConditionCache warningcache[VERSIONBITS_NUM_BITS] GUARDED_BY(cs_main);
1581
1581
1582
- static unsigned int GetBlockScriptFlags (const CBlockIndex* pindex , const Consensus::Params& consensusparams)
1582
+ static unsigned int GetBlockScriptFlags (const CBlockIndex& block_index , const Consensus::Params& consensusparams)
1583
1583
{
1584
1584
unsigned int flags = SCRIPT_VERIFY_NONE;
1585
1585
@@ -1589,43 +1589,42 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens
1589
1589
// mainnet and testnet), so for simplicity, always leave P2SH
1590
1590
// on except for the one violating block.
1591
1591
if (consensusparams.BIP16Exception .IsNull () || // no bip16 exception on this chain
1592
- pindex-> phashBlock == nullptr || // this is a new candidate block, eg from TestBlockValidity()
1593
- *pindex-> phashBlock != consensusparams.BIP16Exception ) // this block isn't the historical exception
1592
+ block_index. phashBlock == nullptr || // this is a new candidate block, eg from TestBlockValidity()
1593
+ *block_index. phashBlock != consensusparams.BIP16Exception ) // this block isn't the historical exception
1594
1594
{
1595
1595
// Enforce WITNESS rules whenever P2SH is in effect
1596
1596
flags |= SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS;
1597
1597
}
1598
1598
1599
1599
// Enforce the DERSIG (BIP66) rule
1600
- if (DeploymentActiveAt (*pindex , consensusparams, Consensus::DEPLOYMENT_DERSIG)) {
1600
+ if (DeploymentActiveAt (block_index , consensusparams, Consensus::DEPLOYMENT_DERSIG)) {
1601
1601
flags |= SCRIPT_VERIFY_DERSIG;
1602
1602
}
1603
1603
1604
1604
// Enforce CHECKLOCKTIMEVERIFY (BIP65)
1605
- if (DeploymentActiveAt (*pindex , consensusparams, Consensus::DEPLOYMENT_CLTV)) {
1605
+ if (DeploymentActiveAt (block_index , consensusparams, Consensus::DEPLOYMENT_CLTV)) {
1606
1606
flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
1607
1607
}
1608
1608
1609
1609
// Enforce CHECKSEQUENCEVERIFY (BIP112)
1610
- if (DeploymentActiveAt (*pindex , consensusparams, Consensus::DEPLOYMENT_CSV)) {
1610
+ if (DeploymentActiveAt (block_index , consensusparams, Consensus::DEPLOYMENT_CSV)) {
1611
1611
flags |= SCRIPT_VERIFY_CHECKSEQUENCEVERIFY;
1612
1612
}
1613
1613
1614
1614
// Enforce Taproot (BIP340-BIP342)
1615
- if (DeploymentActiveAt (*pindex , consensusparams, Consensus::DEPLOYMENT_TAPROOT)) {
1615
+ if (DeploymentActiveAt (block_index , consensusparams, Consensus::DEPLOYMENT_TAPROOT)) {
1616
1616
flags |= SCRIPT_VERIFY_TAPROOT;
1617
1617
}
1618
1618
1619
1619
// Enforce BIP147 NULLDUMMY (activated simultaneously with segwit)
1620
- if (DeploymentActiveAt (*pindex , consensusparams, Consensus::DEPLOYMENT_SEGWIT)) {
1620
+ if (DeploymentActiveAt (block_index , consensusparams, Consensus::DEPLOYMENT_SEGWIT)) {
1621
1621
flags |= SCRIPT_VERIFY_NULLDUMMY;
1622
1622
}
1623
1623
1624
1624
return flags;
1625
1625
}
1626
1626
1627
1627
1628
-
1629
1628
static int64_t nTimeCheck = 0 ;
1630
1629
static int64_t nTimeForks = 0 ;
1631
1630
static int64_t nTimeVerify = 0 ;
@@ -1811,7 +1810,7 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
1811
1810
}
1812
1811
1813
1812
// Get the script flags for this block
1814
- unsigned int flags = GetBlockScriptFlags (pindex, m_params.GetConsensus ());
1813
+ unsigned int flags{ GetBlockScriptFlags (* pindex, m_params.GetConsensus ())} ;
1815
1814
1816
1815
int64_t nTime2 = GetTimeMicros (); nTimeForks += nTime2 - nTime1;
1817
1816
LogPrint (BCLog::BENCH, " - Fork checks: %.2fms [%.2fs (%.2fms/blk)]\n " , MILLI * (nTime2 - nTime1), nTimeForks * MICRO, nTimeForks * MILLI / nBlocksTotal);
0 commit comments