@@ -2051,10 +2051,10 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
20512051 return true ;
20522052}
20532053
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 )
20552055{
2056- notifications.fatalError (strMessage, userMessage );
2057- return state.Error (strMessage );
2056+ notifications.fatalError (message );
2057+ return state.Error (message. original );
20582058}
20592059
20602060/* *
@@ -2276,7 +2276,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
22762276 // We don't write down blocks to disk if they may have been
22772277 // corrupted, so this should be impossible unless we're having hardware
22782278 // 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. " ) );
22802280 }
22812281 LogError (" %s: Consensus::CheckBlock: %s\n " , __func__, state.ToString ());
22822282 return false ;
@@ -2702,7 +2702,7 @@ bool Chainstate::FlushStateToDisk(
27022702 if (fDoFullFlush || fPeriodicWrite ) {
27032703 // Ensure we can write block index
27042704 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!" ));
27062706 }
27072707 {
27082708 LOG_TIME_MILLIS_WITH_CATEGORY (" write block and undo data to disk" , BCLog::BENCH);
@@ -2720,7 +2720,7 @@ bool Chainstate::FlushStateToDisk(
27202720 LOG_TIME_MILLIS_WITH_CATEGORY (" write block index to disk" , BCLog::BENCH);
27212721
27222722 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. " ) );
27242724 }
27252725 }
27262726 // Finally remove any pruned files
@@ -2742,11 +2742,11 @@ bool Chainstate::FlushStateToDisk(
27422742 // an overestimation, as most will delete an existing entry or
27432743 // overwrite one. Still, use a conservative safety factor of 2.
27442744 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!" ));
27462746 }
27472747 // Flush the chainstate (which may refer to block index entries).
27482748 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. " ) );
27502750 m_last_flush = nNow;
27512751 full_flush_completed = true ;
27522752 TRACE5 (utxocache, flush,
@@ -2762,7 +2762,7 @@ bool Chainstate::FlushStateToDisk(
27622762 m_chainman.m_options .signals ->ChainStateFlushed (this ->GetRole (), m_chain.GetLocator ());
27632763 }
27642764 } 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 () ));
27662766 }
27672767 return true ;
27682768}
@@ -2998,7 +2998,7 @@ bool Chainstate::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew,
29982998 if (!pblock) {
29992999 std::shared_ptr<CBlock> pblockNew = std::make_shared<CBlock>();
30003000 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. " ) );
30023002 }
30033003 pthisBlock = pblockNew;
30043004 } else {
@@ -3185,7 +3185,7 @@ bool Chainstate::ActivateBestChainStep(BlockValidationState& state, CBlockIndex*
31853185 // If we're unable to disconnect a block during normal operation,
31863186 // then that is a failure of our local system -- we should abort
31873187 // 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. " ) );
31893189 return false ;
31903190 }
31913191 fBlocksDisconnected = true ;
@@ -4345,7 +4345,7 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,
43454345 }
43464346 ReceivedBlockTransactions (block, pindex, blockPos);
43474347 } 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 () ));
43494349 }
43504350
43514351 // TODO: FlushStateToDisk() handles flushing of both block and chainstate
@@ -5029,7 +5029,7 @@ void ChainstateManager::LoadExternalBlockFile(
50295029 }
50305030 }
50315031 } 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 () ));
50335033 }
50345034 LogPrintf (" Loaded %i blocks from external file in %dms\n " , nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now () - start));
50355035}
@@ -5539,8 +5539,8 @@ bool ChainstateManager::ActivateSnapshot(
55395539 snapshot_chainstate.reset ();
55405540 bool removed = DeleteCoinsDBFromDisk (*snapshot_datadir, /* is_snapshot=*/ true );
55415541 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)));
55445544 }
55455545 }
55465546 return false ;
@@ -5879,7 +5879,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
58795879 user_error = strprintf (Untranslated (" %s\n %s" ), user_error, util::ErrorString (rename_result));
58805880 }
58815881
5882- GetNotifications ().fatalError (user_error. original , user_error );
5882+ GetNotifications ().fatalError (user_error);
58835883 };
58845884
58855885 if (index_new.GetBlockHash () != snapshot_blockhash) {
@@ -6220,9 +6220,9 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
62206220 const fs::filesystem_error& err) {
62216221 LogPrintf (" Error renaming path (%s) -> (%s): %s\n " ,
62226222 fs::PathToString (p_old), fs::PathToString (p_new), err.what ());
6223- GetNotifications ().fatalError (strprintf (
6223+ GetNotifications ().fatalError (strprintf (_ (
62246224 " Rename of '%s' -> '%s' failed. "
6225- " Cannot clean up the background chainstate leveldb directory." ,
6225+ " Cannot clean up the background chainstate leveldb directory." ) ,
62266226 fs::PathToString (p_old), fs::PathToString (p_new)));
62276227 };
62286228
0 commit comments