18typedef std::pair<std::vector<uint8_t>, std::vector<uint8_t>>
KeyValPair;
25 std::vector<bilingual_str> &
warnings) {
30 std::unique_ptr<WalletDatabase> database =
37 std::shared_ptr<BerkeleyEnvironment> env =
40 if (!env->Open(
error)) {
54 int result = env->dbenv->dbrename(
nullptr, filename.c_str(),
nullptr,
73 Db db(env->dbenv.get(), 0);
78 Untranslated(
"Salvage: Database salvage found errors, all data may "
79 "not be recoverable."));
83 Untranslated(
"Salvage: Database salvage failed with result %d."),
111 Untranslated(
"Salvage: WARNING: Number of keys in data "
112 "does not match number of values."));
123 "file while reading salvage output."));
131 Untranslated(
"Salvage(aggressive) found no records in %s."),
136 std::unique_ptr<Db>
pdbCopy = std::make_unique<Db>(env->dbenv.get(), 0);
170 Untranslated(
"WARNING: WalletBatch::Recover skipping %s: %s"),
std::shared_ptr< BerkeleyEnvironment > GetWalletEnv(const fs::path &wallet_path, std::string &database_filename)
Get BerkeleyEnvironment and database filename given a wallet path.
Double ended buffer combining vector and stream-like interfaces.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
static bool IsKeyType(const std::string &strType)
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
static constexpr int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
bool error(const char *fmt, const Args &...args)
const std::string HDCHAIN
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static const char * HEADER_END
static const char * DATA_END
std::pair< std::vector< uint8_t >, std::vector< uint8_t > > KeyValPair
bool RecoverDatabaseFile(const fs::path &file_path, bilingual_str &error, std::vector< bilingual_str > &warnings)
static bool KeyFilter(const std::string &type)
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
template std::vector< std::byte > ParseHex(std::string_view)
std::unique_ptr< WalletDatabase > MakeDatabase(const fs::path &path, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error)
static bool ReadKeyValue(CWallet *pwallet, CDataStream &ssKey, CDataStream &ssValue, CWalletScanState &wss, std::string &strType, std::string &strErr, const KeyFilterFn &filter_fn=nullptr) EXCLUSIVE_LOCKS_REQUIRED(pwallet -> cs_wallet)
std::unique_ptr< WalletDatabase > CreateDummyWalletDatabase()
Return object for accessing dummy database with no read/write capabilities.