port expired transaction notify from Zcash. Issue #110

This commit is contained in:
DenioD
2020-05-19 10:03:53 +02:00
parent 15b2e598c6
commit f3a4f77368
5 changed files with 24 additions and 3 deletions

View File

@@ -399,6 +399,7 @@ std::string HelpMessage(HelpMessageMode mode)
#ifndef _WIN32
strUsage += HelpMessageOpt("-pid=<file>", strprintf(_("Specify pid file (default: %s)"), "komodod.pid"));
#endif
strUsage += HelpMessageOpt("-txexpirynotify=<cmd>", _("Execute command when transaction expires (%s in cmd is replaced by transaction id)"));
strUsage += HelpMessageOpt("-prune=<n>", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode disables wallet support and is incompatible with -txindex. "
"Warning: Reverting this setting requires re-downloading the entire blockchain. "
"(default: 0 = disable pruning blocks, >%u = target size in MiB to use for block files)"), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
@@ -618,6 +619,14 @@ static void BlockNotifyCallback(const uint256& hashNewTip)
boost::thread t(runCommand, strCmd); // thread runs free
}
static void TxExpiryNotifyCallback(const uint256& txid)
{
std::string strCmd = GetArg("-txexpirynotify", "");
boost::replace_all(strCmd, "%s", txid.GetHex());
boost::thread t(runCommand, strCmd); // thread runs free
}
struct CImportingNow
{
CImportingNow() {
@@ -2114,6 +2123,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (mapArgs.count("-blocknotify"))
uiInterface.NotifyBlockTip.connect(BlockNotifyCallback);
if (mapArgs.count("-txexpirynotify"))
uiInterface.NotifyTxExpiration.connect(TxExpiryNotifyCallback);
if ( KOMODO_REWIND >= 0 )
{
uiInterface.InitMessage(_("Activating best chain..."));