@@ -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 ;
@@ -4345,7 +4345,7 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,
4345
4345
}
4346
4346
ReceivedBlockTransactions (block, pindex, blockPos);
4347
4347
} catch (const std::runtime_error& e) {
4348
- return FatalError (GetNotifications (), state, std::string ( " System error: " ) + e.what ());
4348
+ return FatalError (GetNotifications (), state, strprintf ( _ ( " System error while saving block to disk: %s " ), e.what () ));
4349
4349
}
4350
4350
4351
4351
// TODO: FlushStateToDisk() handles flushing of both block and chainstate
@@ -5029,7 +5029,7 @@ void ChainstateManager::LoadExternalBlockFile(
5029
5029
}
5030
5030
}
5031
5031
} catch (const std::runtime_error& e) {
5032
- GetNotifications ().fatalError (std::string ( " System error: " ) + e.what ());
5032
+ GetNotifications ().fatalError (strprintf ( _ ( " System error while loading external block file: %s " ), e.what () ));
5033
5033
}
5034
5034
LogPrintf (" Loaded %i blocks from external file in %dms\n " , nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now () - start));
5035
5035
}
@@ -5539,8 +5539,8 @@ bool ChainstateManager::ActivateSnapshot(
5539
5539
snapshot_chainstate.reset ();
5540
5540
bool removed = DeleteCoinsDBFromDisk (*snapshot_datadir, /* is_snapshot=*/ true );
5541
5541
if (!removed) {
5542
- GetNotifications ().fatalError (strprintf (" Failed to remove snapshot chainstate dir (%s). "
5543
- " Manually remove it before restarting.\n " , fs::PathToString (*snapshot_datadir)));
5542
+ GetNotifications ().fatalError (strprintf (_ ( " Failed to remove snapshot chainstate dir (%s). "
5543
+ " Manually remove it before restarting.\n " ) , fs::PathToString (*snapshot_datadir)));
5544
5544
}
5545
5545
}
5546
5546
return false ;
@@ -5879,7 +5879,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
5879
5879
user_error = strprintf (Untranslated (" %s\n %s" ), user_error, util::ErrorString (rename_result));
5880
5880
}
5881
5881
5882
- GetNotifications ().fatalError (user_error. original , user_error );
5882
+ GetNotifications ().fatalError (user_error);
5883
5883
};
5884
5884
5885
5885
if (index_new.GetBlockHash () != snapshot_blockhash) {
@@ -6220,9 +6220,9 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
6220
6220
const fs::filesystem_error& err) {
6221
6221
LogPrintf (" Error renaming path (%s) -> (%s): %s\n " ,
6222
6222
fs::PathToString (p_old), fs::PathToString (p_new), err.what ());
6223
- GetNotifications ().fatalError (strprintf (
6223
+ GetNotifications ().fatalError (strprintf (_ (
6224
6224
" Rename of '%s' -> '%s' failed. "
6225
- " Cannot clean up the background chainstate leveldb directory." ,
6225
+ " Cannot clean up the background chainstate leveldb directory." ) ,
6226
6226
fs::PathToString (p_old), fs::PathToString (p_new)));
6227
6227
};
6228
6228
0 commit comments