aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2019-03-14 11:30:37 +0100
committerSjors Provoost <sjors@sprovoost.nl>2019-06-06 11:54:26 +0200
commitf874e14cd3c84cd412bd3fb42b3ee1706ca6a267 (patch)
tree26a3b6fc73c55d01cf1bbba8c00347529ae76d0b /src/init.cpp
parentcc3ad56ff2bc2583fe68c4a9e0b41072a47c0b07 (diff)
[build]: check std::system for -[alert|block|wallet]notify
Platforms such as iOs do not support launching a process through system().
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f9723196b0..e6e85b66a1 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -378,10 +378,14 @@ void SetupServerArgs()
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform"};
gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS);
+#if defined(HAVE_SYSTEM)
gArgs.AddArg("-alertnotify=<cmd>", "Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)", false, OptionsCategory::OPTIONS);
+#endif
gArgs.AddArg("-assumevalid=<hex>", strprintf("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)", defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(), testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-blocksdir=<dir>", "Specify directory to hold blocks subdirectory for *.dat files (default: <datadir>)", false, OptionsCategory::OPTIONS);
+#if defined(HAVE_SYSTEM)
gArgs.AddArg("-blocknotify=<cmd>", "Execute command when the best block changes (%s in cmd is replaced by block hash)", false, OptionsCategory::OPTIONS);
+#endif
gArgs.AddArg("-blockreconstructionextratxn=<n>", strprintf("Extra transactions to keep in memory for compact block reconstructions (default: %u)", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-blocksonly", strprintf("Whether to reject transactions from network peers. Transactions from the wallet or RPC are not affected. (default: %u)", DEFAULT_BLOCKSONLY), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), false, OptionsCategory::OPTIONS);
@@ -582,6 +586,7 @@ std::string LicenseInfo()
"\n";
}
+#if defined(HAVE_SYSTEM)
static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex)
{
if (initialSync || !pBlockIndex)
@@ -594,6 +599,7 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex
t.detach(); // thread runs free
}
}
+#endif
static bool fHaveGenesis = false;
static Mutex g_genesis_wait_mutex;
@@ -1726,8 +1732,10 @@ bool AppInitMain(InitInterfaces& interfaces)
fHaveGenesis = true;
}
+#if defined(HAVE_SYSTEM)
if (gArgs.IsArgSet("-blocknotify"))
uiInterface.NotifyBlockTip_connect(BlockNotifyCallback);
+#endif
std::vector<fs::path> vImportFiles;
for (const std::string& strFile : gArgs.GetArgs("-loadblock")) {