Skip to content

Commit

Permalink
Perform invalidation of ChainLock conflicts after adding header to bl…
Browse files Browse the repository at this point in the history
…ock index

This at least adds the header to the block index, which allows us to further
debug conflicts. This commit also adds the conflicting block hash to the
log output.
  • Loading branch information
codablock committed May 14, 2019
1 parent 394bec4 commit 7e6bf43
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3477,13 +3477,16 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state

if (!ContextualCheckBlockHeader(block, state, chainparams.GetConsensus(), pindexPrev, GetAdjustedTime()))
return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state));
}
if (pindex == NULL) {
pindex = AddToBlockIndex(block);

if (llmq::chainLocksHandler->HasConflictingChainLock(pindexPrev->nHeight + 1, hash)) {
return state.DoS(10, error("%s: conflicting with chainlock", __func__), REJECT_INVALID, "bad-chainlock");
if (llmq::chainLocksHandler->HasConflictingChainLock(pindex->nHeight, hash)) {
CValidationState dummyState;
InvalidateBlock(dummyState, chainparams, pindex);
return state.DoS(10, error("%s: header %s conflicts with chainlock", __func__, hash.ToString()), REJECT_INVALID, "bad-chainlock");
}
}
if (pindex == NULL)
pindex = AddToBlockIndex(block);

if (ppindex)
*ppindex = pindex;
Expand Down

0 comments on commit 7e6bf43

Please sign in to comment.