@@ -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
{
@@ -686,11 +685,6 @@ bool CWallet::HasWalletSpend(const CTransactionRef& tx) const
686
685
return false ;
687
686
}
688
687
689
- void CWallet::Flush ()
690
- {
691
- GetDatabase ().Flush ();
692
- }
693
-
694
688
void CWallet::Close ()
695
689
{
696
690
GetDatabase ().Close ();
@@ -863,15 +857,9 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
863
857
}
864
858
Lock ();
865
859
866
- // Need to completely rewrite the wallet file; if we don't, bdb might keep
860
+ // Need to completely rewrite the wallet file; if we don't, the database might keep
867
861
// bits of the unencrypted private key in slack space in the database file.
868
862
GetDatabase ().Rewrite ();
869
-
870
- // BDB seems to have a bad habit of writing old data into
871
- // slack space in .dat files; that is bad if the old data is
872
- // unencrypted private keys. So:
873
- GetDatabase ().ReloadDbEnv ();
874
-
875
863
}
876
864
NotifyStatusChanged (this );
877
865
@@ -1020,11 +1008,11 @@ bool CWallet::IsSpentKey(const CScript& scriptPubKey) const
1020
1008
return false ;
1021
1009
}
1022
1010
1023
- CWalletTx* CWallet::AddToWallet (CTransactionRef tx, const TxState& state, const UpdateWalletTxFn& update_wtx, bool fFlushOnClose , bool rescanning_old_block)
1011
+ CWalletTx* CWallet::AddToWallet (CTransactionRef tx, const TxState& state, const UpdateWalletTxFn& update_wtx, bool rescanning_old_block)
1024
1012
{
1025
1013
LOCK (cs_wallet);
1026
1014
1027
- WalletBatch batch (GetDatabase (), fFlushOnClose );
1015
+ WalletBatch batch (GetDatabase ());
1028
1016
1029
1017
uint256 hash = tx->GetHash ();
1030
1018
@@ -1234,7 +1222,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const SyncTxS
1234
1222
// Block disconnection override an abandoned tx as unconfirmed
1235
1223
// which means user may have to call abandontransaction again
1236
1224
TxState tx_state = std::visit ([](auto && s) -> TxState { return s; }, state);
1237
- CWalletTx* wtx = AddToWallet (MakeTransactionRef (tx), tx_state, /* update_wtx=*/ nullptr , /* fFlushOnClose= */ false , rescanning_old_block);
1225
+ CWalletTx* wtx = AddToWallet (MakeTransactionRef (tx), tx_state, /* update_wtx=*/ nullptr , rescanning_old_block);
1238
1226
if (!wtx) {
1239
1227
// Can only be nullptr if there was a db write error (missing db, read-only db or a db engine internal writing error).
1240
1228
// As we only store arriving transaction in this process, and we don't want an inconsistent state, let's throw an error.
@@ -1329,8 +1317,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, int conflicting_height, c
1329
1317
}
1330
1318
1331
1319
void CWallet::RecursiveUpdateTxState (const uint256& tx_hash, const TryUpdatingStateFn& try_updating_state) {
1332
- // Do not flush the wallet here for performance reasons
1333
- WalletBatch batch (GetDatabase (), false );
1320
+ WalletBatch batch (GetDatabase ());
1334
1321
RecursiveUpdateTxState (&batch, tx_hash, try_updating_state);
1335
1322
}
1336
1323
@@ -3200,7 +3187,6 @@ bool CWallet::AttachChain(const std::shared_ptr<CWallet>& walletInstance, interf
3200
3187
}
3201
3188
walletInstance->m_attaching_chain = false ;
3202
3189
walletInstance->chainStateFlushed (ChainstateRole::NORMAL, chain.getTipLocator ());
3203
- walletInstance->GetDatabase ().IncrementUpdateCounter ();
3204
3190
}
3205
3191
walletInstance->m_attaching_chain = false ;
3206
3192
0 commit comments