Validation
ValidationMode
Bases: IntEnum
Result of validation processing.
Indicates whether a data structure (such as a block) passed validation, failed validation, or encountered an error during processing.
Source code in pbk/validation.py
BlockValidationResult
Bases: IntEnum
Specific reason why a block failed validation.
Provides detailed information about which validation rule was violated when a block is rejected. These results help diagnose why blocks fail to be accepted into the blockchain.
Source code in pbk/validation.py
BlockValidationState
Bases: KernelOpaquePtr
State of a block during validation.
Contains information about whether validation was successful and, if not, which specific validation step failed. This state is provided to validation interface callbacks to communicate detailed validation results.
Note
BlockValidationState instances cannot be directly constructed. They are obtained from validation interface callbacks.
Source code in pbk/validation.py
block_validation_result
property
Specific validation failure reason.
| RETURNS | DESCRIPTION |
|---|---|
BlockValidationResult
|
The granular reason why validation failed, or UNSET if valid. |
validation_mode
property
Overall validation result.
| RETURNS | DESCRIPTION |
|---|---|
ValidationMode
|
Whether the block is valid, invalid, or encountered an error. |
ValidationInterfaceCallbacks
Bases: btck_ValidationInterfaceCallbacks
Callbacks for receiving validation events.
These callbacks allow monitoring of block validation progress and results. Callbacks are invoked synchronously during validation and will block further validation execution until they complete, so they should execute quickly.
Available callbacks
block_checked: Called when a block has been fully validated with resultspow_valid_block: Called when a block extends the header chain with valid PoWblock_connected: Called when a valid block is connected to the best chainblock_disconnected: Called when a block is disconnected during a reorg
Source code in pbk/validation.py
__init__
Create validation interface callbacks.
| PARAMETER | DESCRIPTION |
|---|---|
user_data
|
Optional user-defined data passed to all callbacks.
TYPE:
|
**callbacks
|
Callback functions for validation events. The key is the name of the callback, the value the callback function.
TYPE:
|