aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2024-10-18 06:01:23 -0400
committerPieter Wuille <pieter@wuille.net>2024-12-02 16:25:17 -0500
commit146a3d542683ddb89a31104f5211dfc757d1dafb (patch)
treedb6d1a85fbe0298355904be8c70150289317e23e /src
parent1ac1c33f3f120bbe0bde4fa948299bc07cac47ee (diff)
[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.
Diffstat (limited to 'src')
-rw-r--r--src/test/miner_tests.cpp3
-rw-r--r--src/validation.cpp8
2 files changed, 5 insertions, 6 deletions
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
index f6ae6549bc..c5ecf7022e 100644
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -403,8 +403,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
tx.vout[0].nValue -= LOWFEE;
hash = tx.GetHash();
AddToMempool(tx_mempool, entry.Fee(LOWFEE).Time(Now<NodeSeconds>()).SpendsCoinbase(false).FromTx(tx));
- // Should throw block-validation-failed
- BOOST_CHECK_EXCEPTION(AssemblerForTest(tx_mempool).CreateNewBlock(scriptPubKey), std::runtime_error, HasReason("block-validation-failed"));
+ BOOST_CHECK_EXCEPTION(AssemblerForTest(tx_mempool).CreateNewBlock(scriptPubKey), std::runtime_error, HasReason("mandatory-script-verify-flag-failed"));
// Delete the dummy blocks again.
while (m_node.chainman->ActiveChain().Tip()->nHeight > nHeight) {
diff --git a/src/validation.cpp b/src/validation.cpp
index 1ba9bb22cd..54901b2c58 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -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;