[#Chainstate-ActivateBestChainStep]
= xref:Chainstate.adoc[Chainstate]::ActivateBestChainStep
:relfileprefix: ../
:mrdocs:

Connect a run of blocks toward the most&hyphen;work chain, one step of ActivateBestChain&period;

== Synopsis

Declared in `&lt;validation&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f2e1ba854e8, 0x7f2e1ba85560), requires&lowbar;capability(0x7f2e14565138, 0x7f2e145651b0), requires&lowbar;capability(0x7f2e373be2e8, 0x7f2e373be360), requires&lowbar;capability(0x7f2e36e34f38, 0x7f2e36e34fb0)&rsqb;&rsqb;
bool
ActivateBestChainStep(
    xref:BlockValidationState.adoc[BlockValidationState]& state,
    xref:CBlockIndex.adoc[CBlockIndex]& index&lowbar;most&lowbar;work,
    std::shared&lowbar;ptr&lt;CBlock const&gt; const& pblock,
    bool& fInvalidFound,
    std::vector&lt;ConnectedBlock&gt;& connected&lowbar;blocks);
----

== Return Value

true unless a system error occurred&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *state*
| Validation state updated with the reason for any failure&period;
| *index&lowbar;most&lowbar;work*
| Block index entry of the most&hyphen;work candidate to build toward&period;
| *pblock*
| Optional already&hyphen;loaded block to avoid re&hyphen;reading it from disk&period;
| *fInvalidFound*
| Set to true if an invalid block was found during the step&period;
| *connected&lowbar;blocks*
| Collects the blocks connected during this step&period;
|===


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