mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
wallet: introduce 'SetWalletFlagWithDB'
This commit is contained in:
parent
6052c7891d
commit
122d103ca2
2 changed files with 10 additions and 1 deletions
|
@ -1701,10 +1701,16 @@ bool CWallet::CanGetAddresses(bool internal) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::SetWalletFlag(uint64_t flags)
|
void CWallet::SetWalletFlag(uint64_t flags)
|
||||||
|
{
|
||||||
|
WalletBatch batch(GetDatabase());
|
||||||
|
return SetWalletFlagWithDB(batch, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWallet::SetWalletFlagWithDB(WalletBatch& batch, uint64_t flags)
|
||||||
{
|
{
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
m_wallet_flags |= flags;
|
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");
|
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
|
// Same as 'AddActiveScriptPubKeyMan' but designed for use within a batch transaction context
|
||||||
void AddActiveScriptPubKeyManWithDb(WalletBatch& batch, uint256 id, OutputType type, bool internal);
|
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
|
//! Cache of descriptor ScriptPubKeys used for IsMine. Maps ScriptPubKey to set of spkms
|
||||||
std::unordered_map<CScript, std::vector<ScriptPubKeyMan*>, SaltedSipHasher> m_cached_spks;
|
std::unordered_map<CScript, std::vector<ScriptPubKeyMan*>, SaltedSipHasher> m_cached_spks;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue