mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge 332c6134bb into merged_master (Bitcoin PR #15894)
This commit is contained in:
commit
695bf1c24d
5 changed files with 53 additions and 42 deletions
|
|
@ -1452,20 +1452,22 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
|
|||
}
|
||||
|
||||
/** Abort with a message */
|
||||
static bool AbortNode(const std::string& strMessage, const std::string& userMessage="")
|
||||
static bool AbortNode(const std::string& strMessage, const std::string& userMessage = "", unsigned int prefix = 0)
|
||||
{
|
||||
SetMiscWarning(strMessage);
|
||||
LogPrintf("*** %s\n", strMessage);
|
||||
uiInterface.ThreadSafeMessageBox(
|
||||
userMessage.empty() ? _("Error: A fatal internal error occurred, see debug.log for details") : userMessage,
|
||||
"", CClientUIInterface::MSG_ERROR);
|
||||
if (!userMessage.empty()) {
|
||||
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR | prefix);
|
||||
} else {
|
||||
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
|
||||
}
|
||||
StartShutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage="")
|
||||
static bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage = "", unsigned int prefix = 0)
|
||||
{
|
||||
AbortNode(strMessage, userMessage);
|
||||
AbortNode(strMessage, userMessage, prefix);
|
||||
return state.Error(strMessage);
|
||||
}
|
||||
|
||||
|
|
@ -2142,7 +2144,7 @@ bool CChainState::FlushStateToDisk(
|
|||
if (fDoFullFlush || fPeriodicWrite) {
|
||||
// Depend on nMinDiskSpace to ensure we can write block index
|
||||
if (!CheckDiskSpace(GetBlocksDir())) {
|
||||
return AbortNode(state, "Disk space is low!", _("Error: Disk space is low!"));
|
||||
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
||||
}
|
||||
// First make sure all block and undo data is flushed to disk.
|
||||
FlushBlockFile();
|
||||
|
|
@ -2177,7 +2179,7 @@ bool CChainState::FlushStateToDisk(
|
|||
// an overestimation, as most will delete an existing entry or
|
||||
// overwrite one. Still, use a conservative safety factor of 2.
|
||||
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * pcoinsTip->GetCacheSize())) {
|
||||
return AbortNode(state, "Disk space is low!", _("Error: Disk space is low!"));
|
||||
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
||||
}
|
||||
// Flush the chainstate (which may refer to block index entries).
|
||||
if (!pcoinsTip->Flush())
|
||||
|
|
@ -3088,7 +3090,7 @@ static bool FindBlockPos(FlatFilePos &pos, unsigned int nAddSize, unsigned int n
|
|||
bool out_of_space;
|
||||
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
|
||||
if (out_of_space) {
|
||||
return AbortNode("Disk space is low!", _("Error: Disk space is low!"));
|
||||
return AbortNode("Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
||||
}
|
||||
if (bytes_allocated != 0 && fPruneMode) {
|
||||
fCheckForPruning = true;
|
||||
|
|
@ -3112,7 +3114,7 @@ static bool FindUndoPos(CValidationState &state, int nFile, FlatFilePos &pos, un
|
|||
bool out_of_space;
|
||||
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
|
||||
if (out_of_space) {
|
||||
return AbortNode(state, "Disk space is low!", _("Error: Disk space is low!"));
|
||||
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
||||
}
|
||||
if (bytes_allocated != 0 && fPruneMode) {
|
||||
fCheckForPruning = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue