Skip to content

Commit 122d103

Browse files
committed
wallet: introduce 'SetWalletFlagWithDB'
1 parent 6052c78 commit 122d103

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1701,10 +1701,16 @@ bool CWallet::CanGetAddresses(bool internal) const
17011701
}
17021702

17031703
void CWallet::SetWalletFlag(uint64_t flags)
1704+
{
1705+
WalletBatch batch(GetDatabase());
1706+
return SetWalletFlagWithDB(batch, flags);
1707+
}
1708+
1709+
void CWallet::SetWalletFlagWithDB(WalletBatch& batch, uint64_t flags)
17041710
{
17051711
LOCK(cs_wallet);
17061712
m_wallet_flags |= flags;
1707-
if (!WalletBatch(GetDatabase()).WriteWalletFlags(m_wallet_flags))
1713+
if (!batch.WriteWalletFlags(m_wallet_flags))
17081714
throw std::runtime_error(std::string(__func__) + ": writing wallet flags failed");
17091715
}
17101716

src/wallet/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
422422
// Same as 'AddActiveScriptPubKeyMan' but designed for use within a batch transaction context
423423
void AddActiveScriptPubKeyManWithDb(WalletBatch& batch, uint256 id, OutputType type, bool internal);
424424

425+
/** Store wallet flags */
426+
void SetWalletFlagWithDB(WalletBatch& batch, uint64_t flags);
427+
425428
//! Cache of descriptor ScriptPubKeys used for IsMine. Maps ScriptPubKey to set of spkms
426429
std::unordered_map<CScript, std::vector<ScriptPubKeyMan*>, SaltedSipHasher> m_cached_spks;
427430

0 commit comments

Comments
 (0)