@@ -2051,10 +2051,10 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
2051
2051
return true ;
2052
2052
}
2053
2053
2054
- bool FatalError (Notifications& notifications, BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage )
2054
+ bool FatalError (Notifications& notifications, BlockValidationState& state, const bilingual_str& message )
2055
2055
{
2056
- notifications.fatalError (strMessage, userMessage );
2057
- return state.Error (strMessage );
2056
+ notifications.fatalError (message );
2057
+ return state.Error (message. original );
2058
2058
}
2059
2059
2060
2060
/* *
@@ -2276,7 +2276,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2276
2276
// We don't write down blocks to disk if they may have been
2277
2277
// corrupted, so this should be impossible unless we're having hardware
2278
2278
// problems.
2279
- return FatalError (m_chainman.GetNotifications (), state, " Corrupt block found indicating potential hardware failure; shutting down " );
2279
+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Corrupt block found indicating potential hardware failure. " ) );
2280
2280
}
2281
2281
LogError (" %s: Consensus::CheckBlock: %s\n " , __func__, state.ToString ());
2282
2282
return false ;
@@ -2702,7 +2702,7 @@ bool Chainstate::FlushStateToDisk(
2702
2702
if (fDoFullFlush || fPeriodicWrite ) {
2703
2703
// Ensure we can write block index
2704
2704
if (!CheckDiskSpace (m_blockman.m_opts .blocks_dir )) {
2705
- return FatalError (m_chainman.GetNotifications (), state, " Disk space is too low! " , _ (" Disk space is too low!" ));
2705
+ return FatalError (m_chainman.GetNotifications (), state, _ (" Disk space is too low!" ));
2706
2706
}
2707
2707
{
2708
2708
LOG_TIME_MILLIS_WITH_CATEGORY (" write block and undo data to disk" , BCLog::BENCH);
@@ -2720,7 +2720,7 @@ bool Chainstate::FlushStateToDisk(
2720
2720
LOG_TIME_MILLIS_WITH_CATEGORY (" write block index to disk" , BCLog::BENCH);
2721
2721
2722
2722
if (!m_blockman.WriteBlockIndexDB ()) {
2723
- return FatalError (m_chainman.GetNotifications (), state, " Failed to write to block index database" );
2723
+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to write to block index database. " ) );
2724
2724
}
2725
2725
}
2726
2726
// Finally remove any pruned files
@@ -2742,11 +2742,11 @@ bool Chainstate::FlushStateToDisk(
2742
2742
// an overestimation, as most will delete an existing entry or
2743
2743
// overwrite one. Still, use a conservative safety factor of 2.
2744
2744
if (!CheckDiskSpace (m_chainman.m_options .datadir , 48 * 2 * 2 * CoinsTip ().GetCacheSize ())) {
2745
- return FatalError (m_chainman.GetNotifications (), state, " Disk space is too low! " , _ (" Disk space is too low!" ));
2745
+ return FatalError (m_chainman.GetNotifications (), state, _ (" Disk space is too low!" ));
2746
2746
}
2747
2747
// Flush the chainstate (which may refer to block index entries).
2748
2748
if (!CoinsTip ().Flush ())
2749
- return FatalError (m_chainman.GetNotifications (), state, " Failed to write to coin database" );
2749
+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to write to coin database. " ) );
2750
2750
m_last_flush = nNow;
2751
2751
full_flush_completed = true ;
2752
2752
TRACE5 (utxocache, flush,
@@ -2762,7 +2762,7 @@ bool Chainstate::FlushStateToDisk(
2762
2762
m_chainman.m_options .signals ->ChainStateFlushed (this ->GetRole (), m_chain.GetLocator ());
2763
2763
}
2764
2764
} catch (const std::runtime_error& e) {
2765
- return FatalError (m_chainman.GetNotifications (), state, std::string ( " System error while flushing: " ) + e.what ());
2765
+ return FatalError (m_chainman.GetNotifications (), state, strprintf ( _ ( " System error while flushing: %s " ), e.what () ));
2766
2766
}
2767
2767
return true ;
2768
2768
}
@@ -2998,7 +2998,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
2998
2998
if (!pblock) {
2999
2999
std::shared_ptr<CBlock> pblockNew = std::make_shared<CBlock>();
3000
3000
if (!m_blockman.ReadBlockFromDisk (*pblockNew, *pindexNew)) {
3001
- return FatalError (m_chainman.GetNotifications (), state, " Failed to read block" );
3001
+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to read block. " ) );
3002
3002
}
3003
3003
pthisBlock = pblockNew;
3004
3004
} else {
@@ -3185,7 +3185,7 @@ bool Chainstate::ActivateBestChainStep(BlockValidationState& state, CBlockIndex*
3185
3185
// If we're unable to disconnect a block during normal operation,
3186
3186
// then that is a failure of our local system -- we should abort
3187
3187
// rather than stay on a less work chain.
3188
- FatalError (m_chainman.GetNotifications (), state, " Failed to disconnect block; see debug.log for details " );
3188
+ FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to disconnect block. " ) );
3189
3189
return false ;
3190
3190
}
3191
3191
fBlocksDisconnected = true ;
@@ -4347,7 +4347,7 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,
4347
4347
}
4348
4348
ReceivedBlockTransactions (block, pindex, blockPos);
4349
4349
} catch (const std::runtime_error& e) {
4350
- return FatalError (GetNotifications (), state, std::string ( " System error: " ) + e.what ());
4350
+ return FatalError (GetNotifications (), state, strprintf ( _ ( " System error while saving block to disk: %s " ), e.what () ));
4351
4351
}
4352
4352
4353
4353
// TODO: FlushStateToDisk() handles flushing of both block and chainstate
@@ -5031,7 +5031,7 @@ void ChainstateManager::LoadExternalBlockFile(
5031
5031
}
5032
5032
}
5033
5033
} catch (const std::runtime_error& e) {
5034
- GetNotifications ().fatalError (std::string ( " System error: " ) + e.what ());
5034
+ GetNotifications ().fatalError (strprintf ( _ ( " System error while loading external block file: %s " ), e.what () ));
5035
5035
}
5036
5036
LogPrintf (" Loaded %i blocks from external file in %dms\n " , nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now () - start));
5037
5037
}
@@ -5541,8 +5541,8 @@ bool ChainstateManager::ActivateSnapshot(
5541
5541
snapshot_chainstate.reset ();
5542
5542
bool removed = DeleteCoinsDBFromDisk (*snapshot_datadir, /* is_snapshot=*/ true );
5543
5543
if (!removed) {
5544
- GetNotifications ().fatalError (strprintf (" Failed to remove snapshot chainstate dir (%s). "
5545
- " Manually remove it before restarting.\n " , fs::PathToString (*snapshot_datadir)));
5544
+ GetNotifications ().fatalError (strprintf (_ ( " Failed to remove snapshot chainstate dir (%s). "
5545
+ " Manually remove it before restarting.\n " ) , fs::PathToString (*snapshot_datadir)));
5546
5546
}
5547
5547
}
5548
5548
return false ;
@@ -5881,7 +5881,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
5881
5881
user_error = strprintf (Untranslated (" %s\n %s" ), user_error, util::ErrorString (rename_result));
5882
5882
}
5883
5883
5884
- GetNotifications ().fatalError (user_error. original , user_error );
5884
+ GetNotifications ().fatalError (user_error);
5885
5885
};
5886
5886
5887
5887
if (index_new.GetBlockHash () != snapshot_blockhash) {
@@ -6222,9 +6222,9 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
6222
6222
const fs::filesystem_error& err) {
6223
6223
LogPrintf (" Error renaming path (%s) -> (%s): %s\n " ,
6224
6224
fs::PathToString (p_old), fs::PathToString (p_new), err.what ());
6225
- GetNotifications ().fatalError (strprintf (
6225
+ GetNotifications ().fatalError (strprintf (_ (
6226
6226
" Rename of '%s' -> '%s' failed. "
6227
- " Cannot clean up the background chainstate leveldb directory." ,
6227
+ " Cannot clean up the background chainstate leveldb directory." ) ,
6228
6228
fs::PathToString (p_old), fs::PathToString (p_new)));
6229
6229
};
6230
6230
0 commit comments