mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-23 14:10:15 +01:00
Replace RPCNotifyBlockChange with waitTipChanged()
This refactoring commit uses the newly introduced waitTipChanged mining interface method to replace the RPCNotifyBlockChange mechanism.
This commit is contained in:
@@ -429,16 +429,12 @@ static void registerSignalHandler(int signal, void(*handler)(int))
|
||||
}
|
||||
#endif
|
||||
|
||||
static boost::signals2::connection rpc_notify_block_change_connection;
|
||||
static void OnRPCStarted()
|
||||
{
|
||||
rpc_notify_block_change_connection = uiInterface.NotifyBlockTip_connect(std::bind(RPCNotifyBlockChange, std::placeholders::_2));
|
||||
}
|
||||
|
||||
static void OnRPCStopped()
|
||||
{
|
||||
rpc_notify_block_change_connection.disconnect();
|
||||
RPCNotifyBlockChange(nullptr);
|
||||
g_best_block_cv.notify_all();
|
||||
LogDebug(BCLog::RPC, "RPC stopped.\n");
|
||||
}
|
||||
@@ -2011,11 +2007,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
// cannot yet be called. Before we make it callable, we need to make sure
|
||||
// that the RPC's view of the best block is valid and consistent with
|
||||
// ChainstateManager's active tip.
|
||||
//
|
||||
// If we do not do this, RPC's view of the best block will be height=0 and
|
||||
// hash=0x0. This will lead to erroroneous responses for things like
|
||||
// waitforblockheight.
|
||||
RPCNotifyBlockChange(WITH_LOCK(chainman.GetMutex(), return chainman.ActiveTip()));
|
||||
SetRPCWarmupFinished();
|
||||
|
||||
uiInterface.InitMessage(_("Done loading").translated);
|
||||
|
||||
Reference in New Issue
Block a user