mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
wallet: remove db mode string
We never need to open database in read-only mode as it's controlled separately for every batch. Also we can safely create database if it doesn't exist already because require_existing option is verified in MakeDatabase before creating a new WalletDatabase instance.
This commit is contained in:
@@ -791,7 +791,7 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
|
||||
|
||||
wtx.mapValue["replaced_by_txid"] = newHash.ToString();
|
||||
|
||||
WalletBatch batch(*database, "r+");
|
||||
WalletBatch batch(*database);
|
||||
|
||||
bool success = true;
|
||||
if (!batch.WriteTx(wtx)) {
|
||||
@@ -863,7 +863,7 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const CWalletTx::Confirmatio
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
|
||||
WalletBatch batch(*database, "r+", fFlushOnClose);
|
||||
WalletBatch batch(*database, fFlushOnClose);
|
||||
|
||||
uint256 hash = tx->GetHash();
|
||||
|
||||
@@ -1062,7 +1062,7 @@ bool CWallet::AbandonTransaction(const uint256& hashTx)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
|
||||
WalletBatch batch(*database, "r+");
|
||||
WalletBatch batch(*database);
|
||||
|
||||
std::set<uint256> todo;
|
||||
std::set<uint256> done;
|
||||
@@ -1125,7 +1125,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, int conflicting_height, c
|
||||
return;
|
||||
|
||||
// Do not flush the wallet here for performance reasons
|
||||
WalletBatch batch(*database, "r+", false);
|
||||
WalletBatch batch(*database, false);
|
||||
|
||||
std::set<uint256> todo;
|
||||
std::set<uint256> done;
|
||||
@@ -3190,7 +3190,7 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||
LOCK(cs_wallet);
|
||||
|
||||
fFirstRunRet = false;
|
||||
DBErrors nLoadWalletRet = WalletBatch(*database,"cr+").LoadWallet(this);
|
||||
DBErrors nLoadWalletRet = WalletBatch(*database).LoadWallet(this);
|
||||
if (nLoadWalletRet == DBErrors::NEED_REWRITE)
|
||||
{
|
||||
if (database->Rewrite("\x04pool"))
|
||||
@@ -3217,7 +3217,7 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||
DBErrors CWallet::ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut)
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
DBErrors nZapSelectTxRet = WalletBatch(*database, "cr+").ZapSelectTx(vHashIn, vHashOut);
|
||||
DBErrors nZapSelectTxRet = WalletBatch(*database).ZapSelectTx(vHashIn, vHashOut);
|
||||
for (const uint256& hash : vHashOut) {
|
||||
const auto& it = mapWallet.find(hash);
|
||||
wtxOrdered.erase(it->second.m_it_wtxOrdered);
|
||||
|
||||
Reference in New Issue
Block a user