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

Waits for the connected tip to change until timeout has elapsed&period; During node initialization, this will wait until the tip is connected (regardless of `timeout`)&period; Returns the current tip, or nullopt if the node is shutting down or interrupt() is called&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::optional&lt;interfaces::BlockRef&gt;
WaitTipChanged(
    xref:ChainstateManager.adoc[ChainstateManager]& chainman,
    xref:node/KernelNotifications.adoc[KernelNotifications]& kernel&lowbar;notifications,
    xref:uint256.adoc[uint256] const& current&lowbar;tip,
    xref:MillisecondsDouble.adoc[MillisecondsDouble]& timeout,
    bool& interrupt);
----

== Return Value

The new tip reference, or std&colon;&colon;nullopt if shutting down or interrupted&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *chainman*
| The chainstate manager to query&period;
| *kernel&lowbar;notifications*
| The notifications object used to wait for tip changes&period;
| *current&lowbar;tip*
| The tip hash to wait for a change from&period;
| *timeout*
| Maximum time to wait&semi; updated with the remaining time&period;
| *interrupt*
| Flag that, when set, ends the wait early&period;
|===


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