The waitfornewblock
is inherently racy as the tip may have changed since the last RPC call, and can even change during initial processing of this call.
Add an optional blockhash
argument so the caller can specify their current tip. Return immediately if our tip is different.
I’ve made it fail if LookupBlockIndex
fails. This should never happen if the user got the block hash from our RPC in the first place.
Finally, the waitfor{block,newblock,blockheight}
RPC methods are no longer hidden in help
:
- the changes in #30409 ensured these methods could work in the GUI
- #31785 removed the guards that prevented GUI users from using them
- this PR makes
waitfornewblock
reliable
So there’s no more reason to hide them.