wallet: introduce 'SetWalletFlagWithDB'
This commit is contained in:
2 files changed
+10
-1
No files matched your search
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user