Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Added `Block::check` to perform context-free validation of a block (size, weight, coinbase, transactions, sigops), with optional proof-of-work and merkle-root checks toggled via the `BLOCK_CHECK_BASE` / `_POW` / `_MERKLE` / `_ALL` flags. Returns a `BlockCheckResult` enum carrying the validation state on failure.
- Added `#[must_use]` to `BlockCheckResult` and `ProcessBlockHeaderResult` to warn when validation results are silently ignored.

### Changed
- The `verify` function's `flags` parameter now uses `ScriptVerificationFlags` instead of `u32`, making the type explicit in the public API.
Expand Down
1 change: 1 addition & 0 deletions src/core/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub const BLOCK_CHECK_ALL: BlockCheckFlags = btck_BlockCheckFlags_ALL;
///
/// On failure, the [`BlockValidationState`] carries details that can be
/// inspected via [`BlockValidationStateExt`](crate::notifications::BlockValidationStateExt).
#[must_use = "check result must be inspected to determine whether the block is valid"]
pub enum BlockCheckResult {
/// The block passed the requested context-free checks.
Valid,
Expand Down
1 change: 1 addition & 0 deletions src/state/chainstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub enum ProcessBlockResult {
/// Result of proceesing a header with the [`ChainstateManager`]
///
/// Indicates whether a block header was processed, or rejected, and whether it is valid.
#[must_use = "header processing result must be inspected to determine whether processing completed successfully"]
#[derive(Clone)]
pub enum ProcessBlockHeaderResult {
/// Header was succssfully processed and added to the block tree
Expand Down
Loading