From 13612bb1c89388e8142dad69a68bd9ad35849b2f Mon Sep 17 00:00:00 2001 From: Duke Date: Tue, 13 Jun 2023 22:58:36 -0400 Subject: [PATCH] Better error message when hashPrevBlock != view.GetBestBlock --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index f6d6ca270..786de3397 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3243,7 +3243,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash(); if ( hashPrevBlock != view.GetBestBlock() ) { - fprintf(stderr,"ConnectBlock(): hashPrevBlock != view.GetBestBlock()\n"); + fprintf(stderr,"ConnectBlock(): hashPrevBlock != view.GetBestBlock() %s != %s\n", hashPrevBlock.ToString().c_str(), view.GetBestBlock().ToString().c_str() ); + return state.DoS(1, error("ConnectBlock(): hashPrevBlock != view.GetBestBlock()"), REJECT_INVALID, "hashPrevBlock-not-bestblock"); }