Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 2,867 Lines • ▼ Show 20 Lines | if (::ChainActive().Tip() == nullptr) { | ||||
block_notify_genesis_wait_connection = | block_notify_genesis_wait_connection = | ||||
uiInterface.NotifyBlockTip_connect( | uiInterface.NotifyBlockTip_connect( | ||||
std::bind(BlockNotifyGenesisWait, std::placeholders::_2)); | std::bind(BlockNotifyGenesisWait, std::placeholders::_2)); | ||||
} else { | } else { | ||||
fHaveGenesis = true; | fHaveGenesis = true; | ||||
} | } | ||||
#if defined(HAVE_SYSTEM) | #if defined(HAVE_SYSTEM) | ||||
if (args.IsArgSet("-blocknotify")) { | |||||
const std::string block_notify = args.GetArg("-blocknotify", ""); | const std::string block_notify = args.GetArg("-blocknotify", ""); | ||||
const auto BlockNotifyCallback = [block_notify]( | if (!block_notify.empty()) { | ||||
uiInterface.NotifyBlockTip_connect([block_notify]( | |||||
SynchronizationState sync_state, | SynchronizationState sync_state, | ||||
const CBlockIndex *pBlockIndex) { | const CBlockIndex *pBlockIndex) { | ||||
if (sync_state != SynchronizationState::POST_INIT || !pBlockIndex) { | if (sync_state != SynchronizationState::POST_INIT || !pBlockIndex) { | ||||
return; | return; | ||||
} | } | ||||
std::string command = block_notify; | |||||
std::string strCmd = block_notify; | boost::replace_all(command, "%s", | ||||
if (!strCmd.empty()) { | |||||
boost::replace_all(strCmd, "%s", | |||||
pBlockIndex->GetBlockHash().GetHex()); | pBlockIndex->GetBlockHash().GetHex()); | ||||
std::thread t(runCommand, strCmd); | std::thread t(runCommand, command); | ||||
// thread runs free | // thread runs free | ||||
t.detach(); | t.detach(); | ||||
} | }); | ||||
}; | |||||
uiInterface.NotifyBlockTip_connect(BlockNotifyCallback); | |||||
} | } | ||||
#endif | #endif | ||||
std::vector<fs::path> vImportFiles; | std::vector<fs::path> vImportFiles; | ||||
for (const std::string &strFile : args.GetArgs("-loadblock")) { | for (const std::string &strFile : args.GetArgs("-loadblock")) { | ||||
vImportFiles.push_back(strFile); | vImportFiles.push_back(strFile); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |