The Mining interface waitTipChanged()
method now returns nullopt
if the node is shutting down.
Previously it would return the last known tip during shutdown, but this creates an ambiguous circumstance in the scenario where the node is started and quickly shutdown, before notifications().TipBlock()
is set.
This allows the proposed waitNext()
method in #31283 to safely assume TipBlock()
isn’t null
, not even during a scenario of early shutdown.
In general it’s easier to understand this behavior for callers: waitTipChanged()
either eventually returns a tip, or nullptr
if the timeout is reached or the node shuts down.
They no longer have to worry about a case where a tip is returned, but it’s unchanged and the node is shutting down.
The getblocktemplate
, waitfornewblock
and waitforblockheight
RPC calls now explicitly handle the shutdown scenario.