No description provided.
remove error enum #35693
pull yuvicc wants to merge 4 commits into bitcoin:master from yuvicc:2026-06-remove_enum_ie_2 changing 36 files +435 −404-
yuvicc commented at 12:47 PM on July 9, 2026: contributor
-
93cf87a9db
validation: route fatal errors through util::Expected<T, kernel::FatalError>
Validation functions previously signalled fatal/internal errors by setting an `M_ERROR` mode on the BlockValidationState out-parameter, which tangled three outcomes (valid / invalid / fatal) in a single object and forced callers to unwrap them. Introduce `kernel::FatalError`, which can only be created through `FatalError::Raise()`. Raise() fires the fatalError notification and returns the error wrapped in `util::Unexpected`, so holding a FatalError proves the notification fired exactly once; propagation up the stack just moves the object. Convert the block processing chain to return `util::Expected<T, kernel::FatalError>`, where the error channel carries the fatal error and the value channel carries the `BlockValidationState` (valid/invalid) or void. `BlockManager::WriteBlock` and `FindNextBlockPos` now mint the error at the true origin instead of returning a null FlatFilePos after firing the notification. `Chainstate::DisconnectTip` and `Chainstate::InvalidateBlock` keep a plain string error channel because they mix outcomes: DisconnectTip failures are escalated to a fatal error by ActivateBestChainStep but surfaced as a plain error by InvalidateBlock (matching the previous AbortNode-at-caller behaviour), and InvalidateBlock mixes user errors with propagated fatal messages. The BlockChecked validation interface signal is now fired only for valid/invalid outcomes, never on a fatal error. Observable behaviour is otherwise unchanged: fatal errors keep mapping to the same RPC error codes as before, and the Mining interface's checkBlock/submitBlock surface the fatal message as the reject reason as before. The one exception is the internal-bug guard in ActivateBestChain (m_target_utxohash set), which now raises a fatal error instead of returning a plain string, since continuing to operate that chainstate would corrupt state.
-
88e08d7bd5
rpc: surface fatal validation errors as RPC_INTERNAL_ERROR
A fatal error (disk failure, block data corruption, ...) is a failure of the node itself, not a verdict on the RPC's inputs, and the node is already shutting down by the time it is reported. Previously these errors were conflated with block validation failures: submitblock and getblocktemplate reported them as RPC_VERIFY_ERROR; preciousblock, invalidateblock and reconsiderblock as RPC_DATABASE_ERROR; and generatetoaddress/generatetodescriptor flattened them into the generic "ProcessNewBlock, block not accepted" error. Add a ThrowFatalError() helper and use it at every RPC call site that receives a kernel::FatalError, so all of them consistently fail with RPC_INTERNAL_ERROR and the fatal error message.
-
fa5a55ebb8
consensus: remove `Error()`/`IsError()` from ValidationState
Now that fatal errors are propagated through util::Expected's error channel, no validation code sets or reads the `M_ERROR` mode. Drop `Error()`, `IsError()` and the `M_ERROR` enumerator so that a `ValidationState` can only be valid or invalid.
-
kernel: remove `INTERNAL_ERROR` from `btck_ValidationMode` 65d6f7eb6c
- yuvicc closed this on Jul 9, 2026
-
DrahtBot commented at 12:47 PM on July 9, 2026: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35693.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline and AI policy for information on the review process. A summary of reviews will appear here.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
LLM Linter (✨ experimental)
Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):chainman.AcceptBlock(pblockone, &pindex, true, nullptr, &newblock, true)insrc/test/validation_chainstate_tests.cppchainman.ProcessNewBlock(block, true, true, &new_block)insrc/test/util/mining.cppAssert(m_node.chainman)->ProcessNewBlock(shared_pblock, true, true, nullptr)insrc/test/util/setup_common.cppauto res{Assert(m_node.chainman)->ProcessNewBlock(std::make_shared<CBlock>(Params().GenesisBlock()), true, true, &ignored)}insrc/test/validation_block_tests.cpp(void)Assert(m_node.chainman)->ProcessNewBlock(block, true, true, &ignored)insrc/test/validation_block_tests.cppauto res{Assert(m_node.chainman)->ProcessNewBlock(block, true, true, &ignored)}insrc/test/validation_block_tests.cppchainman.AcceptBlock(new_block, &new_block_index, true, nullptr, nullptr, true)insrc/test/coinstatsindex_tests.cppAcceptBlock(pblock, nullptr, true, dbp, nullptr, true)insrc/validation.cppAcceptBlock(pblockrecursive, nullptr, true, &it->second, nullptr, true)insrc/validation.cpp
<sup>2026-07-09 12:48:09</sup>