[#node-WaitAndCreateNewBlock]
= xref:node.adoc[node]::WaitAndCreateNewBlock
:relfileprefix: ../
:mrdocs:

Return a new block template when fees rise to a certain threshold or after a new tip&semi; return nullopt if timeout is reached&period;

== Synopsis

Declared in `&lt;node&sol;miner&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::unique&lowbar;ptr&lt;CBlockTemplate&gt;
WaitAndCreateNewBlock(
    xref:ChainstateManager.adoc[ChainstateManager]& chainman,
    xref:node/KernelNotifications.adoc[KernelNotifications]& kernel&lowbar;notifications,
    xref:CTxMemPool.adoc[CTxMemPool]* mempool,
    std::unique&lowbar;ptr&lt;CBlockTemplate&gt; const& block&lowbar;template,
    xref:node/BlockWaitOptions.adoc[BlockWaitOptions] const& wait&lowbar;options,
    xref:node/BlockCreateOptions.adoc[BlockCreateOptions] const& create&lowbar;options,
    bool& interrupt&lowbar;wait);
----

== Return Value

A new block template, or nullptr if the timeout elapsed&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *chainman*
| The chainstate manager to build on&period;
| *kernel&lowbar;notifications*
| The notifications object used to wait for events&period;
| *mempool*
| The mempool to draw transactions from&period;
| *block&lowbar;template*
| The previous template, used to compare fees&period;
| *wait&lowbar;options*
| Options controlling how long to wait and the fee threshold&period;
| *create&lowbar;options*
| Options controlling block&hyphen;template creation&period;
| *interrupt&lowbar;wait*
| Flag that, when set, interrupts the wait&period;
|===


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