| 1066 | std::unique_ptr<Node> MakeNode(node::NodeContext& context) { return std::make_unique<node::NodeImpl>(context); } |
| 1067 | std::unique_ptr<Chain> MakeChain(node::NodeContext& context) { return std::make_unique<node::ChainImpl>(context); } |
| 1068 | std::unique_ptr<Mining> MakeMining(const node::NodeContext& context, bool wait_loaded) |
| 1069 | { |
| 1070 | if (wait_loaded) { |
| 1071 | node::KernelNotifications& kernel_notifications(*Assert(context.notifications)); |
| 1072 | util::SignalInterrupt& interrupt(*Assert(context.shutdown_signal)); |
| 1073 | WAIT_LOCK(kernel_notifications.m_tip_block_mutex, lock); |
| 1074 | kernel_notifications.m_tip_block_cv.wait(lock, [&]() EXCLUSIVE_LOCKS_REQUIRED(kernel_notifications.m_tip_block_mutex) { |
| 1075 | return kernel_notifications.m_state.chainstate_loaded || interrupt; |
| 1076 | }); |
| 1077 | if (interrupt) return nullptr; |
| 1078 | } |
| 1079 | return std::make_unique<node::MinerImpl>(context); |
| 1080 | } |
| 1081 | std::unique_ptr<Rpc> MakeRpc(node::NodeContext& context) { return std::make_unique<node::RpcImpl>(context); } |
| 1082 | } // namespace interfaces |