@@ -2024,10 +2024,10 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
20242024 return true ;
20252025}
20262026
2027- bool FatalError (Notifications& notifications, BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage )
2027+ bool FatalError (Notifications& notifications, BlockValidationState& state, const bilingual_str& message )
20282028{
2029- notifications.fatalError (strMessage, userMessage );
2030- return state.Error (strMessage );
2029+ notifications.fatalError (message );
2030+ return state.Error (message. original );
20312031}
20322032
20332033/* *
@@ -2249,7 +2249,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
22492249 // We don't write down blocks to disk if they may have been
22502250 // corrupted, so this should be impossible unless we're having hardware
22512251 // problems.
2252- return FatalError (m_chainman.GetNotifications (), state, " Corrupt block found indicating potential hardware failure; shutting down " );
2252+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Corrupt block found indicating potential hardware failure. " ) );
22532253 }
22542254 LogError (" %s: Consensus::CheckBlock: %s\n " , __func__, state.ToString ());
22552255 return false ;
@@ -2675,7 +2675,7 @@ bool Chainstate::FlushStateToDisk(
26752675 if (fDoFullFlush || fPeriodicWrite ) {
26762676 // Ensure we can write block index
26772677 if (!CheckDiskSpace (m_blockman.m_opts .blocks_dir )) {
2678- return FatalError (m_chainman.GetNotifications (), state, " Disk space is too low! " , _ (" Disk space is too low!" ));
2678+ return FatalError (m_chainman.GetNotifications (), state, _ (" Disk space is too low!" ));
26792679 }
26802680 {
26812681 LOG_TIME_MILLIS_WITH_CATEGORY (" write block and undo data to disk" , BCLog::BENCH);
@@ -2693,7 +2693,7 @@ bool Chainstate::FlushStateToDisk(
26932693 LOG_TIME_MILLIS_WITH_CATEGORY (" write block index to disk" , BCLog::BENCH);
26942694
26952695 if (!m_blockman.WriteBlockIndexDB ()) {
2696- return FatalError (m_chainman.GetNotifications (), state, " Failed to write to block index database" );
2696+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to write to block index database. " ) );
26972697 }
26982698 }
26992699 // Finally remove any pruned files
@@ -2715,11 +2715,11 @@ bool Chainstate::FlushStateToDisk(
27152715 // an overestimation, as most will delete an existing entry or
27162716 // overwrite one. Still, use a conservative safety factor of 2.
27172717 if (!CheckDiskSpace (m_chainman.m_options .datadir , 48 * 2 * 2 * CoinsTip ().GetCacheSize ())) {
2718- return FatalError (m_chainman.GetNotifications (), state, " Disk space is too low! " , _ (" Disk space is too low!" ));
2718+ return FatalError (m_chainman.GetNotifications (), state, _ (" Disk space is too low!" ));
27192719 }
27202720 // Flush the chainstate (which may refer to block index entries).
27212721 if (!CoinsTip ().Flush ())
2722- return FatalError (m_chainman.GetNotifications (), state, " Failed to write to coin database" );
2722+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to write to coin database. " ) );
27232723 m_last_flush = nNow;
27242724 full_flush_completed = true ;
27252725 TRACE5 (utxocache, flush,
@@ -2735,7 +2735,7 @@ bool Chainstate::FlushStateToDisk(
27352735 m_chainman.m_options .signals ->ChainStateFlushed (this ->GetRole (), m_chain.GetLocator ());
27362736 }
27372737 } catch (const std::runtime_error& e) {
2738- return FatalError (m_chainman.GetNotifications (), state, std::string ( " System error while flushing: " ) + e.what ());
2738+ return FatalError (m_chainman.GetNotifications (), state, strprintf ( _ ( " System error while flushing: %s " ), e.what () ));
27392739 }
27402740 return true ;
27412741}
@@ -2971,7 +2971,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
29712971 if (!pblock) {
29722972 std::shared_ptr<CBlock> pblockNew = std::make_shared<CBlock>();
29732973 if (!m_blockman.ReadBlockFromDisk (*pblockNew, *pindexNew)) {
2974- return FatalError (m_chainman.GetNotifications (), state, " Failed to read block" );
2974+ return FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to read block. " ) );
29752975 }
29762976 pthisBlock = pblockNew;
29772977 } else {
@@ -3158,7 +3158,7 @@ bool Chainstate::ActivateBestChainStep(BlockValidationState& state, CBlockIndex*
31583158 // If we're unable to disconnect a block during normal operation,
31593159 // then that is a failure of our local system -- we should abort
31603160 // rather than stay on a less work chain.
3161- FatalError (m_chainman.GetNotifications (), state, " Failed to disconnect block; see debug.log for details " );
3161+ FatalError (m_chainman.GetNotifications (), state, _ ( " Failed to disconnect block. " ) );
31623162 return false ;
31633163 }
31643164 fBlocksDisconnected = true ;
@@ -4299,7 +4299,7 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,
42994299 }
43004300 ReceivedBlockTransactions (block, pindex, blockPos);
43014301 } catch (const std::runtime_error& e) {
4302- return FatalError (GetNotifications (), state, std::string ( " System error: " ) + e.what ());
4302+ return FatalError (GetNotifications (), state, strprintf ( _ ( " System error while saving block to disk: %s " ), e.what () ));
43034303 }
43044304
43054305 // TODO: FlushStateToDisk() handles flushing of both block and chainstate
@@ -4983,7 +4983,7 @@ void ChainstateManager::LoadExternalBlockFile(
49834983 }
49844984 }
49854985 } catch (const std::runtime_error& e) {
4986- GetNotifications ().fatalError (std::string ( " System error: " ) + e.what ());
4986+ GetNotifications ().fatalError (strprintf ( _ ( " System error while loading external block file: %s " ), e.what () ));
49874987 }
49884988 LogPrintf (" Loaded %i blocks from external file in %dms\n " , nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now () - start));
49894989}
@@ -5450,8 +5450,8 @@ bool ChainstateManager::ActivateSnapshot(
54505450 snapshot_chainstate.reset ();
54515451 bool removed = DeleteCoinsDBFromDisk (*snapshot_datadir, /* is_snapshot=*/ true );
54525452 if (!removed) {
5453- GetNotifications ().fatalError (strprintf (" Failed to remove snapshot chainstate dir (%s). "
5454- " Manually remove it before restarting.\n " , fs::PathToString (*snapshot_datadir)));
5453+ GetNotifications ().fatalError (strprintf (_ ( " Failed to remove snapshot chainstate dir (%s). "
5454+ " Manually remove it before restarting.\n " ) , fs::PathToString (*snapshot_datadir)));
54555455 }
54565456 }
54575457 return false ;
@@ -5805,7 +5805,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
58055805 user_error = strprintf (Untranslated (" %s\n %s" ), user_error, util::ErrorString (rename_result));
58065806 }
58075807
5808- GetNotifications ().fatalError (user_error. original , user_error );
5808+ GetNotifications ().fatalError (user_error);
58095809 };
58105810
58115811 if (index_new.GetBlockHash () != snapshot_blockhash) {
@@ -6146,9 +6146,9 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
61466146 const fs::filesystem_error& err) {
61476147 LogPrintf (" Error renaming path (%s) -> (%s): %s\n " ,
61486148 fs::PathToString (p_old), fs::PathToString (p_new), err.what ());
6149- GetNotifications ().fatalError (strprintf (
6149+ GetNotifications ().fatalError (strprintf (_ (
61506150 " Rename of '%s' -> '%s' failed. "
6151- " Cannot clean up the background chainstate leveldb directory." ,
6151+ " Cannot clean up the background chainstate leveldb directory." ) ,
61526152 fs::PathToString (p_old), fs::PathToString (p_new)));
61536153 };
61546154
0 commit comments