Skip to content

Commit d89f8ad

Browse files
committed
Make DisconnectBlock and ConnectBlock static in validation.cpp
1 parent 67023e9 commit d89f8ad

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/validation.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,11 @@ bool ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const COutPoint
15241524
return fClean;
15251525
}
15261526

1527-
bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean)
1527+
/** Undo the effects of this block (with given index) on the UTXO set represented by coins.
1528+
* In case pfClean is provided, operation will try to be tolerant about errors, and *pfClean
1529+
* will be true if no problems were found. Otherwise, the return value will be false in case
1530+
* of problems. Note that in any case, coins may be modified. */
1531+
static bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean = NULL)
15281532
{
15291533
assert(pindex->GetBlockHash() == view.GetBestBlock());
15301534

@@ -1677,8 +1681,11 @@ static int64_t nTimeIndex = 0;
16771681
static int64_t nTimeCallbacks = 0;
16781682
static int64_t nTimeTotal = 0;
16791683

1680-
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex,
1681-
CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck)
1684+
/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
1685+
* Validity checks that depend on the UTXO set are also done; ConnectBlock()
1686+
* can fail if those validity checks fail (among other reasons). */
1687+
static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex,
1688+
CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck = false)
16821689
{
16831690
AssertLockHeld(cs_main);
16841691
assert(pindex);

src/validation.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,6 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
483483
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, int64_t nAdjustedTime);
484484
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
485485

486-
/** Apply the effects of this block (with given index) on the UTXO set represented by coins.
487-
* Validity checks that depend on the UTXO set are also done; ConnectBlock()
488-
* can fail if those validity checks fail (among other reasons). */
489-
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins,
490-
const CChainParams& chainparams, bool fJustCheck = false);
491-
492-
/** Undo the effects of this block (with given index) on the UTXO set represented by coins.
493-
* In case pfClean is provided, operation will try to be tolerant about errors, and *pfClean
494-
* will be true if no problems were found. Otherwise, the return value will be false in case
495-
* of problems. Note that in any case, coins may be modified. */
496-
bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL);
497-
498486
/** Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) */
499487
bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
500488

0 commit comments

Comments
 (0)