|
|
|
@ -1035,7 +1035,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
@@ -1035,7 +1035,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
|
|
|
|
|
// CBlock and CBlockIndex
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos, const CMessageHeader::MessageStartChars& messageStart) |
|
|
|
|
bool WriteBlockToDisk(const CBlock& block, CDiskBlockPos& pos, const CMessageHeader::MessageStartChars& messageStart) |
|
|
|
|
{ |
|
|
|
|
// Open history file to append
|
|
|
|
|
CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); |
|
|
|
@ -1520,7 +1520,7 @@ static bool ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const CO
@@ -1520,7 +1520,7 @@ static bool ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const CO
|
|
|
|
|
return fClean; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) |
|
|
|
|
bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) |
|
|
|
|
{ |
|
|
|
|
assert(pindex->GetBlockHash() == view.GetBestBlock()); |
|
|
|
|
|
|
|
|
@ -2077,7 +2077,7 @@ static int64_t nTimePostConnect = 0;
@@ -2077,7 +2077,7 @@ static int64_t nTimePostConnect = 0;
|
|
|
|
|
* Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock |
|
|
|
|
* corresponding to pindexNew, to bypass loading it again from disk. |
|
|
|
|
*/ |
|
|
|
|
bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *pblock) { |
|
|
|
|
bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, const CBlock *pblock) { |
|
|
|
|
assert(pindexNew->pprev == chainActive.Tip()); |
|
|
|
|
mempool.check(pcoinsTip); |
|
|
|
|
// Read block from disk.
|
|
|
|
@ -2209,7 +2209,7 @@ static void PruneBlockIndexCandidates() {
@@ -2209,7 +2209,7 @@ static void PruneBlockIndexCandidates() {
|
|
|
|
|
* Try to make some progress towards making pindexMostWork the active block. |
|
|
|
|
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. |
|
|
|
|
*/ |
|
|
|
|
static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) { |
|
|
|
|
static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, const CBlock *pblock) { |
|
|
|
|
AssertLockHeld(cs_main); |
|
|
|
|
bool fInvalidFound = false; |
|
|
|
|
const CBlockIndex *pindexOldTip = chainActive.Tip(); |
|
|
|
@ -2278,7 +2278,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
@@ -2278,7 +2278,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
|
|
|
|
|
* or an activated best chain. pblock is either NULL or a pointer to a block |
|
|
|
|
* that is already loaded (to avoid loading it again from disk). |
|
|
|
|
*/ |
|
|
|
|
bool ActivateBestChain(CValidationState &state, CBlock *pblock) { |
|
|
|
|
bool ActivateBestChain(CValidationState &state, const CBlock *pblock) { |
|
|
|
|
CBlockIndex *pindexNewTip = NULL; |
|
|
|
|
CBlockIndex *pindexMostWork = NULL; |
|
|
|
|
const CChainParams& chainParams = Params(); |
|
|
|
@ -2749,7 +2749,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
@@ -2749,7 +2749,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp) |
|
|
|
|
bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp) |
|
|
|
|
{ |
|
|
|
|
const CChainParams& chainparams = Params(); |
|
|
|
|
AssertLockHeld(cs_main); |
|
|
|
@ -2826,7 +2826,7 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
@@ -2826,7 +2826,7 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool ProcessNewBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp) |
|
|
|
|
bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp) |
|
|
|
|
{ |
|
|
|
|
// Preliminary checks
|
|
|
|
|
bool checked = CheckBlock(*pblock, state); |
|
|
|
|