Correct logging AcceptBlock()->AcceptBlockHeader()
This commit is contained in:
parent
20a4b69360
commit
4bb30a1eb8
1 changed files with 9 additions and 9 deletions
18
src/main.cpp
18
src/main.cpp
|
@ -2274,7 +2274,7 @@ bool AcceptBlockHeader(CBlockHeader& block, CValidationState& state, CBlockIndex
|
|||
if (miSelf != mapBlockIndex.end()) {
|
||||
pindex = miSelf->second;
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||
return state.Invalid(error("AcceptBlock() : block is marked invalid"), 0, "duplicate");
|
||||
return state.Invalid(error("%s : block is marked invalid", __func__), 0, "duplicate");
|
||||
}
|
||||
|
||||
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint();
|
||||
|
@ -2284,12 +2284,12 @@ bool AcceptBlockHeader(CBlockHeader& block, CValidationState& state, CBlockIndex
|
|||
int64_t deltaTime = block.GetBlockTime() - pcheckpoint->GetBlockTime();
|
||||
if (deltaTime < 0)
|
||||
{
|
||||
return state.DoS(100, error("CheckBlockHeader() : block with timestamp before last checkpoint"),
|
||||
return state.DoS(100, error("%s : block with timestamp before last checkpoint", __func__),
|
||||
REJECT_CHECKPOINT, "time-too-old");
|
||||
}
|
||||
if (!CheckMinWork(block.nBits, pcheckpoint->nBits, deltaTime))
|
||||
{
|
||||
return state.DoS(100, error("CheckBlockHeader() : block with too little proof-of-work"),
|
||||
return state.DoS(100, error("%s : block with too little proof-of-work", __func__),
|
||||
REJECT_INVALID, "bad-diffbits");
|
||||
}
|
||||
}
|
||||
|
@ -2300,36 +2300,36 @@ bool AcceptBlockHeader(CBlockHeader& block, CValidationState& state, CBlockIndex
|
|||
if (hash != Params().HashGenesisBlock()) {
|
||||
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
|
||||
if (mi == mapBlockIndex.end())
|
||||
return state.DoS(10, error("AcceptBlock() : prev block not found"), 0, "bad-prevblk");
|
||||
return state.DoS(10, error("%s : prev block not found", __func__), 0, "bad-prevblk");
|
||||
pindexPrev = (*mi).second;
|
||||
nHeight = pindexPrev->nHeight+1;
|
||||
|
||||
// Check proof of work
|
||||
if ((!Params().SkipProofOfWorkCheck()) &&
|
||||
(block.nBits != GetNextWorkRequired(pindexPrev, &block)))
|
||||
return state.DoS(100, error("AcceptBlock() : incorrect proof of work"),
|
||||
return state.DoS(100, error("%s : incorrect proof of work", __func__),
|
||||
REJECT_INVALID, "bad-diffbits");
|
||||
|
||||
// Check timestamp against prev
|
||||
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
|
||||
return state.Invalid(error("AcceptBlock() : block's timestamp is too early"),
|
||||
return state.Invalid(error("%s : block's timestamp is too early", __func__),
|
||||
REJECT_INVALID, "time-too-old");
|
||||
|
||||
// Check that the block chain matches the known block chain up to a checkpoint
|
||||
if (!Checkpoints::CheckBlock(nHeight, hash))
|
||||
return state.DoS(100, error("AcceptBlock() : rejected by checkpoint lock-in at %d", nHeight),
|
||||
return state.DoS(100, error("%s : rejected by checkpoint lock-in at %d", __func__, nHeight),
|
||||
REJECT_CHECKPOINT, "checkpoint mismatch");
|
||||
|
||||
// Don't accept any forks from the main chain prior to last checkpoint
|
||||
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint();
|
||||
if (pcheckpoint && nHeight < pcheckpoint->nHeight)
|
||||
return state.DoS(100, error("AcceptBlock() : forked chain older than last checkpoint (height %d)", nHeight));
|
||||
return state.DoS(100, error("%s : forked chain older than last checkpoint (height %d)", __func__, nHeight));
|
||||
|
||||
// Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded:
|
||||
if (block.nVersion < 2 &&
|
||||
CBlockIndex::IsSuperMajority(2, pindexPrev, Params().RejectBlockOutdatedMajority()))
|
||||
{
|
||||
return state.Invalid(error("AcceptBlock() : rejected nVersion=1 block"),
|
||||
return state.Invalid(error("%s : rejected nVersion=1 block", __func__),
|
||||
REJECT_OBSOLETE, "bad-version");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue