Skip to content

Commit f724f31

Browse files
committed
Make AbortNode() aware of MSG_NOPREFIX flag
1 parent 96fd4ee commit f724f31

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/validation.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,20 +1374,22 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
13741374
}
13751375

13761376
/** Abort with a message */
1377-
static bool AbortNode(const std::string& strMessage, const std::string& userMessage="")
1377+
static bool AbortNode(const std::string& strMessage, const std::string& userMessage = "", unsigned int prefix = 0)
13781378
{
13791379
SetMiscWarning(strMessage);
13801380
LogPrintf("*** %s\n", strMessage);
1381-
uiInterface.ThreadSafeMessageBox(
1382-
userMessage.empty() ? _("Error: A fatal internal error occurred, see debug.log for details") : userMessage,
1383-
"", CClientUIInterface::MSG_ERROR);
1381+
if (!userMessage.empty()) {
1382+
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR | prefix);
1383+
} else {
1384+
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
1385+
}
13841386
StartShutdown();
13851387
return false;
13861388
}
13871389

1388-
static bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage="")
1390+
static bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage = "", unsigned int prefix = 0)
13891391
{
1390-
AbortNode(strMessage, userMessage);
1392+
AbortNode(strMessage, userMessage, prefix);
13911393
return state.Error(strMessage);
13921394
}
13931395

@@ -1998,7 +2000,7 @@ bool CChainState::FlushStateToDisk(
19982000
if (fDoFullFlush || fPeriodicWrite) {
19992001
// Depend on nMinDiskSpace to ensure we can write block index
20002002
if (!CheckDiskSpace(GetBlocksDir())) {
2001-
return AbortNode(state, "Disk space is low!", _("Error: Disk space is low!"));
2003+
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
20022004
}
20032005
// First make sure all block and undo data is flushed to disk.
20042006
FlushBlockFile();
@@ -2033,7 +2035,7 @@ bool CChainState::FlushStateToDisk(
20332035
// an overestimation, as most will delete an existing entry or
20342036
// overwrite one. Still, use a conservative safety factor of 2.
20352037
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * pcoinsTip->GetCacheSize())) {
2036-
return AbortNode(state, "Disk space is low!", _("Error: Disk space is low!"));
2038+
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
20372039
}
20382040
// Flush the chainstate (which may refer to block index entries).
20392041
if (!pcoinsTip->Flush())
@@ -2899,7 +2901,7 @@ static bool FindBlockPos(FlatFilePos &pos, unsigned int nAddSize, unsigned int n
28992901
bool out_of_space;
29002902
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
29012903
if (out_of_space) {
2902-
return AbortNode("Disk space is low!", _("Error: Disk space is low!"));
2904+
return AbortNode("Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
29032905
}
29042906
if (bytes_allocated != 0 && fPruneMode) {
29052907
fCheckForPruning = true;
@@ -2923,7 +2925,7 @@ static bool FindUndoPos(CValidationState &state, int nFile, FlatFilePos &pos, un
29232925
bool out_of_space;
29242926
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
29252927
if (out_of_space) {
2926-
return AbortNode(state, "Disk space is low!", _("Error: Disk space is low!"));
2928+
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
29272929
}
29282930
if (bytes_allocated != 0 && fPruneMode) {
29292931
fCheckForPruning = true;

0 commit comments

Comments
 (0)