[#btck_chainstate_manager_process_block]
= btck&lowbar;chainstate&lowbar;manager&lowbar;process&lowbar;block
:mrdocs:

Process and validate the passed in block with the chainstate manager&period; Processing first does checks on the block, and if these passed, saves it to disk&period; It then validates the block against the utxo set&period; If it is valid, the chain is extended with it&period; The return value is not indicative of the block&apos;s validity&period; Detailed information on the validity of the block can be retrieved by registering the `block&lowbar;checked` callback in the validation interface&period;

== Synopsis

Declared in `&lt;kernel&sol;bitcoinkernel&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard, &lowbar;&lowbar;nonnull&lowbar;&lowbar;&rsqb;&rsqb;
int
btck&lowbar;chainstate&lowbar;manager&lowbar;process&lowbar;block(
    xref:btck_ChainstateManager-0e.adoc[btck&lowbar;ChainstateManager]* chainstate&lowbar;manager,
    xref:btck_Block-04.adoc[btck&lowbar;Block] const* block,
    int* new&lowbar;block);
----

== Return Value

0 if processing the block was successful&period; Will also return 0 for valid, but duplicate blocks&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *chainstate&lowbar;manager* [in]
| Non&hyphen;null&period;
| *block* [in]
| Non&hyphen;null, block to be validated&period;
| *new&lowbar;block* [out]
| Nullable, will be set to 1 if this block was not processed before&period; 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&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
