Process and validate the passed in block with the chainstate manager. Processing first does checks on the block, and if these passed, saves it to disk. It then validates the block against the utxo set. If it is valid, the chain is extended with it. The return value is not indicative of the block's validity. Detailed information on the validity of the block can be retrieved by registering the block_checked callback in the validation interface.
Declared in <kernel/bitcoinkernel.h>
[[nodiscard, __nonnull__]]
int
btck_chainstate_manager_process_block(
btck_ChainstateManager* chainstate_manager,
btck_Block const* block,
int* new_block);
0 if processing the block was successful. Will also return 0 for valid, but duplicate blocks.
The return value should not be discarded.
| Name | Description |
|---|---|
| chainstate_manager [in] | Non-null. |
| block [in] | Non-null, block to be validated. |
| new_block [out] | Nullable, will be set to 1 if this block was not processed before. Note that this means it might also not be 1 if processing was attempted before, but the block was found invalid before its data was persisted. |