diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-09-01 15:35:23 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-05-24 08:55:47 -0400 |
commit | 8aa8f73adce72e1ae855b43413c1f65504423cb7 (patch) | |
tree | 4a62bc784ac4d924708fdaee81354707e8247786 /src/txdb.cpp | |
parent | 5f49cb1bc8e6ba0671c21bf6292d2d3de43fd001 (diff) | |
download | bitcoin-8aa8f73adce72e1ae855b43413c1f65504423cb7.tar.xz |
refactor: Replace std::optional<bilingual_str> with util::Result
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r-- | src/txdb.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp index 15351a4355..b2095bd4a3 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -31,22 +31,22 @@ static constexpr uint8_t DB_COINS{'c'}; static constexpr uint8_t DB_TXINDEX_BLOCK{'T'}; // uint8_t DB_TXINDEX{'t'} -std::optional<bilingual_str> CheckLegacyTxindex(CBlockTreeDB& block_tree_db) +util::Result<void> CheckLegacyTxindex(CBlockTreeDB& block_tree_db) { CBlockLocator ignored{}; if (block_tree_db.Read(DB_TXINDEX_BLOCK, ignored)) { - return _("The -txindex upgrade started by a previous version cannot be completed. Restart with the previous version or run a full -reindex."); + return util::Error{_("The -txindex upgrade started by a previous version cannot be completed. Restart with the previous version or run a full -reindex.")}; } bool txindex_legacy_flag{false}; block_tree_db.ReadFlag("txindex", txindex_legacy_flag); if (txindex_legacy_flag) { // Disable legacy txindex and warn once about occupied disk space if (!block_tree_db.WriteFlag("txindex", false)) { - return Untranslated("Failed to write block index db flag 'txindex'='0'"); + return util::Error{Untranslated("Failed to write block index db flag 'txindex'='0'")}; } - return _("The block index db contains a legacy 'txindex'. To clear the occupied disk space, run a full -reindex, otherwise ignore this error. This error message will not be displayed again."); + return util::Error{_("The block index db contains a legacy 'txindex'. To clear the occupied disk space, run a full -reindex, otherwise ignore this error. This error message will not be displayed again.")}; } - return std::nullopt; + return {}; } bool CCoinsViewDB::NeedsUpgrade() |