From f89faa258404d2e6fd4300990275cd2439e51255 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 7 May 2013 18:37:37 +0200 Subject: Call the -alertnotify script when we see a long or invalid fork. --- src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 2e79c874d7..b206b68036 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1395,6 +1395,16 @@ void CheckForkWarningConditions() if (pindexBestForkTip || nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256()) { + if (!fLargeWorkForkFound) + { + std::string strCmd = GetArg("-alertnotify", ""); + if (!strCmd.empty()) + { + std::string warning("'Warning: Large-work fork detected. You may need to upgrade, or other nodes may need to upgrade.'"); + boost::replace_all(strCmd, "%s", warning); + boost::thread t(runCommand, strCmd); // thread runs free + } + } fLargeWorkForkFound = true; printf("CheckForkWarningConditions: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n"); } else -- cgit v1.2.3