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

Apply the effects of a block to a given coins view, checking its validity&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f2e1ba844e8), requires&lowbar;capability(0x7f2e14564138), requires&lowbar;capability(0x7f2e373bd2e8), requires&lowbar;capability(0x7f2e36e33f38)&rsqb;&rsqb;
bool
ConnectBlock(
    xref:CBlock.adoc[CBlock] const& block,
    xref:BlockValidationState.adoc[BlockValidationState]& state,
    xref:CBlockIndex.adoc[CBlockIndex]* pindex,
    xref:CCoinsViewCache.adoc[CCoinsViewCache]& view,
    bool fJustCheck = false);
----

== Return Value

true if the block was connected successfully&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *block*
| The block to connect&period;
| *state*
| Validation state updated with the reason for any failure&period;
| *pindex*
| Block index entry corresponding to the block&period;
| *view*
| The coins view to apply the block to&period;
| *fJustCheck*
| When true, validate the block without committing the changes&period;
|===


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