@@ -600,21 +600,6 @@ std::string LicenseInfo()
600
600
" \n " ;
601
601
}
602
602
603
- #if HAVE_SYSTEM
604
- static void BlockNotifyCallback (SynchronizationState sync_state, const CBlockIndex* pBlockIndex)
605
- {
606
- if (sync_state != SynchronizationState::POST_INIT || !pBlockIndex)
607
- return ;
608
-
609
- std::string strCmd = gArgs .GetArg (" -blocknotify" , " " );
610
- if (!strCmd.empty ()) {
611
- boost::replace_all (strCmd, " %s" , pBlockIndex->GetBlockHash ().GetHex ());
612
- std::thread t (runCommand, strCmd);
613
- t.detach (); // thread runs free
614
- }
615
- }
616
- #endif
617
-
618
603
static bool fHaveGenesis = false ;
619
604
static Mutex g_genesis_wait_mutex;
620
605
static std::condition_variable g_genesis_wait_cv;
@@ -1847,8 +1832,21 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
1847
1832
}
1848
1833
1849
1834
#if HAVE_SYSTEM
1850
- if (gArgs .IsArgSet (" -blocknotify" ))
1835
+ if (args.IsArgSet (" -blocknotify" )) {
1836
+ const std::string block_notify = args.GetArg (" -blocknotify" , " " );
1837
+ const auto BlockNotifyCallback = [block_notify](SynchronizationState sync_state, const CBlockIndex* pBlockIndex) {
1838
+ if (sync_state != SynchronizationState::POST_INIT || !pBlockIndex)
1839
+ return ;
1840
+
1841
+ std::string strCmd = block_notify;
1842
+ if (!strCmd.empty ()) {
1843
+ boost::replace_all (strCmd, " %s" , pBlockIndex->GetBlockHash ().GetHex ());
1844
+ std::thread t (runCommand, strCmd);
1845
+ t.detach (); // thread runs free
1846
+ }
1847
+ };
1851
1848
uiInterface.NotifyBlockTip_connect (BlockNotifyCallback);
1849
+ }
1852
1850
#endif
1853
1851
1854
1852
std::vector<fs::path> vImportFiles;
0 commit comments