mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
[validation] Make script error messages uniform for parallel/single validation
This makes the debug output mostly the same for -par=1 and parallel validation runs. Of course, parallel validation is non-deterministic in what error it may encounter first if there are multiple issues. Also, the way certain script-related and non-script-related checks are performed differs between the two modes still, which may result in discrepancies.
This commit is contained in:
@@ -2688,8 +2688,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
||||
// Any transaction validation failure in ConnectBlock is a block consensus failure
|
||||
state.Invalid(BlockValidationResult::BLOCK_CONSENSUS,
|
||||
tx_state.GetRejectReason(), tx_state.GetDebugMessage());
|
||||
LogError("ConnectBlock(): CheckInputScripts on %s failed with %s\n",
|
||||
tx.GetHash().ToString(), state.ToString());
|
||||
LogInfo("Script validation error in block: %s\n", tx_state.GetRejectReason());
|
||||
return false;
|
||||
}
|
||||
control.Add(std::move(vChecks));
|
||||
@@ -2717,8 +2716,9 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
||||
|
||||
auto parallel_result = control.Complete();
|
||||
if (parallel_result.has_value()) {
|
||||
LogPrintf("ERROR: %s: CheckQueue failed\n", __func__);
|
||||
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "block-validation-failed");
|
||||
state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(*parallel_result)));
|
||||
LogInfo("Script validation error in block: %s", state.GetRejectReason());
|
||||
return false;
|
||||
}
|
||||
const auto time_4{SteadyClock::now()};
|
||||
m_chainman.time_verify += time_4 - time_2;
|
||||
|
||||
Reference in New Issue
Block a user