mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 71bdf0bff1 into merged_master (Bitcoin PR bitcoin/bitcoin#22626)
This commit is contained in:
commit
8d89f4e102
8 changed files with 45 additions and 176 deletions
23
src/txdb.cpp
23
src/txdb.cpp
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <txdb.h>
|
||||
|
||||
#include <chain.h>
|
||||
#include <node/ui_interface.h>
|
||||
#include <pow.h>
|
||||
#include <random.h>
|
||||
|
|
@ -35,6 +36,28 @@ static const char DB_PEGIN_FLAG = 'w';
|
|||
// static const char DB_INVALID_BLOCK_Q = 'q'; // No longer used, but avoid reuse.
|
||||
static const char DB_PAK = 'p';
|
||||
|
||||
// Keys used in previous version that might still be found in the DB:
|
||||
static constexpr uint8_t DB_TXINDEX_BLOCK{'T'};
|
||||
// uint8_t DB_TXINDEX{'t'}
|
||||
|
||||
std::optional<bilingual_str> 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 can not 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 _("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;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct CoinEntry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue