Refactor -alertnotify code

Refactor common -alertnotify code into static CAlert::Notify method.
This commit is contained in:
Gavin Andresen
2014-10-07 13:11:48 -04:00
parent 7c6cbff0e5
commit e01a7939d3
3 changed files with 26 additions and 25 deletions

View File

@@ -1178,14 +1178,9 @@ void CheckForkWarningConditions()
{
if (!fLargeWorkForkFound)
{
std::string strCmd = GetArg("-alertnotify", "");
if (!strCmd.empty())
{
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") +
pindexBestForkBase->phashBlock->ToString() + std::string("'");
boost::replace_all(strCmd, "%s", warning);
boost::thread t(runCommand, strCmd); // thread runs free
}
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") +
pindexBestForkBase->phashBlock->ToString() + std::string("'");
CAlert::Notify(warning, true);
}
if (pindexBestForkTip)
{