diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 7e420dcd9b5..e16f75ab781 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -778,9 +778,7 @@ static RPCHelpMan getblocktemplate() } ENTER_CRITICAL_SECTION(cs_main); - std::optional maybe_tip{miner.getTipHash()}; - CHECK_NONFATAL(maybe_tip); - tip = maybe_tip.value(); + tip = CHECK_NONFATAL(miner.getTipHash()).value(); if (!IsRPCRunning()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Shutting down");