mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 01:42:58 +01:00
wallet: introduce 'SetWalletFlagWithDB'
This commit is contained in:
parent
6052c7891d
commit
122d103ca2
@ -1701,10 +1701,16 @@ bool CWallet::CanGetAddresses(bool internal) const
|
||||
}
|
||||
|
||||
void CWallet::SetWalletFlag(uint64_t flags)
|
||||
{
|
||||
WalletBatch batch(GetDatabase());
|
||||
return SetWalletFlagWithDB(batch, flags);
|
||||
}
|
||||
|
||||
void CWallet::SetWalletFlagWithDB(WalletBatch& batch, uint64_t flags)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
m_wallet_flags |= flags;
|
||||
if (!WalletBatch(GetDatabase()).WriteWalletFlags(m_wallet_flags))
|
||||
if (!batch.WriteWalletFlags(m_wallet_flags))
|
||||
throw std::runtime_error(std::string(__func__) + ": writing wallet flags failed");
|
||||
}
|
||||
|
||||
|
@ -422,6 +422,9 @@ private:
|
||||
// Same as 'AddActiveScriptPubKeyMan' but designed for use within a batch transaction context
|
||||
void AddActiveScriptPubKeyManWithDb(WalletBatch& batch, uint256 id, OutputType type, bool internal);
|
||||
|
||||
/** Store wallet flags */
|
||||
void SetWalletFlagWithDB(WalletBatch& batch, uint64_t flags);
|
||||
|
||||
//! Cache of descriptor ScriptPubKeys used for IsMine. Maps ScriptPubKey to set of spkms
|
||||
std::unordered_map<CScript, std::vector<ScriptPubKeyMan*>, SaltedSipHasher> m_cached_spks;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user