@@ -235,8 +235,7 @@ static std::set<std::string> g_unloading_wallet_set GUARDED_BY(g_wallet_release_
235
235
static void FlushAndDeleteWallet (CWallet* wallet)
236
236
{
237
237
const std::string name = wallet->GetName ();
238
- wallet->WalletLogPrintf (" Releasing wallet %s..\n " , name);
239
- wallet->Flush ();
238
+ wallet->WalletLogPrintf (" Releasing wallet\n " );
240
239
delete wallet;
241
240
// Wallet is now released, notify WaitForDeleteWallet, if any.
242
241
{
@@ -682,11 +681,6 @@ bool CWallet::HasWalletSpend(const CTransactionRef& tx) const
682
681
return false ;
683
682
}
684
683
685
- void CWallet::Flush ()
686
- {
687
- GetDatabase ().Flush ();
688
- }
689
-
690
684
void CWallet::Close ()
691
685
{
692
686
GetDatabase ().Close ();
@@ -859,15 +853,9 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
859
853
}
860
854
Lock ();
861
855
862
- // Need to completely rewrite the wallet file; if we don't, bdb might keep
856
+ // Need to completely rewrite the wallet file; if we don't, the database might keep
863
857
// bits of the unencrypted private key in slack space in the database file.
864
858
GetDatabase ().Rewrite ();
865
-
866
- // BDB seems to have a bad habit of writing old data into
867
- // slack space in .dat files; that is bad if the old data is
868
- // unencrypted private keys. So:
869
- GetDatabase ().ReloadDbEnv ();
870
-
871
859
}
872
860
NotifyStatusChanged (this );
873
861
@@ -1016,11 +1004,11 @@ bool CWallet::IsSpentKey(const CScript& scriptPubKey) const
1016
1004
return false ;
1017
1005
}
1018
1006
1019
- CWalletTx* CWallet::AddToWallet (CTransactionRef tx, const TxState& state, const UpdateWalletTxFn& update_wtx, bool fFlushOnClose , bool rescanning_old_block)
1007
+ CWalletTx* CWallet::AddToWallet (CTransactionRef tx, const TxState& state, const UpdateWalletTxFn& update_wtx, bool rescanning_old_block)
1020
1008
{
1021
1009
LOCK (cs_wallet);
1022
1010
1023
- WalletBatch batch (GetDatabase (), fFlushOnClose );
1011
+ WalletBatch batch (GetDatabase ());
1024
1012
1025
1013
uint256 hash = tx->GetHash ();
1026
1014
@@ -1230,7 +1218,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const SyncTxS
1230
1218
// Block disconnection override an abandoned tx as unconfirmed
1231
1219
// which means user may have to call abandontransaction again
1232
1220
TxState tx_state = std::visit ([](auto && s) -> TxState { return s; }, state);
1233
- CWalletTx* wtx = AddToWallet (MakeTransactionRef (tx), tx_state, /* update_wtx=*/ nullptr , /* fFlushOnClose= */ false , rescanning_old_block);
1221
+ CWalletTx* wtx = AddToWallet (MakeTransactionRef (tx), tx_state, /* update_wtx=*/ nullptr , rescanning_old_block);
1234
1222
if (!wtx) {
1235
1223
// Can only be nullptr if there was a db write error (missing db, read-only db or a db engine internal writing error).
1236
1224
// As we only store arriving transaction in this process, and we don't want an inconsistent state, let's throw an error.
@@ -1325,8 +1313,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, int conflicting_height, c
1325
1313
}
1326
1314
1327
1315
void CWallet::RecursiveUpdateTxState (const uint256& tx_hash, const TryUpdatingStateFn& try_updating_state) {
1328
- // Do not flush the wallet here for performance reasons
1329
- WalletBatch batch (GetDatabase (), false );
1316
+ WalletBatch batch (GetDatabase ());
1330
1317
RecursiveUpdateTxState (&batch, tx_hash, try_updating_state);
1331
1318
}
1332
1319
@@ -3179,7 +3166,6 @@ bool CWallet::AttachChain(const std::shared_ptr<CWallet>& walletInstance, interf
3179
3166
}
3180
3167
walletInstance->m_attaching_chain = false ;
3181
3168
walletInstance->chainStateFlushed (ChainstateRole::NORMAL, chain.getTipLocator ());
3182
- walletInstance->GetDatabase ().IncrementUpdateCounter ();
3183
3169
}
3184
3170
walletInstance->m_attaching_chain = false ;
3185
3171
0 commit comments