mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
More of 11634: wallet: Add missing cs_wallet/cs_KeyStore locks to wallet
This commit is contained in:
parent
21b98ba189
commit
25f5611d1a
@ -58,11 +58,12 @@ public:
|
||||
|
||||
CWalletTx& AddTxToChain(uint256 nTxHash)
|
||||
{
|
||||
auto it = wallet->mapWallet.find(nTxHash);
|
||||
assert(it != wallet->mapWallet.end());
|
||||
std::map<uint256, CWalletTx>::iterator it;
|
||||
CMutableTransaction blocktx;
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
it = wallet->mapWallet.find(nTxHash);
|
||||
assert(it != wallet->mapWallet.end());
|
||||
blocktx = CMutableTransaction(*it->second.tx);
|
||||
}
|
||||
CreateAndProcessBlock({blocktx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
|
||||
|
@ -1043,6 +1043,8 @@ bool CWallet::AccountMove(std::string strFrom, std::string strTo, CAmount nAmoun
|
||||
|
||||
bool CWallet::GetLabelDestination(CTxDestination &dest, const std::string& label, bool bForceNew)
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
|
||||
WalletBatch batch(*database);
|
||||
|
||||
CAccount account;
|
||||
@ -2474,6 +2476,8 @@ CAmount CWalletTx::GetAnonymizedCredit(const CCoinControl* coinControl) const
|
||||
if (!pwallet)
|
||||
return 0;
|
||||
|
||||
AssertLockHeld(pwallet->cs_wallet);
|
||||
|
||||
// Exclude coinbase and conflicted txes
|
||||
if (IsCoinBase() || GetDepthInMainChain() < 0)
|
||||
return 0;
|
||||
@ -2514,6 +2518,8 @@ CAmount CWalletTx::GetDenominatedCredit(bool unconfirmed, bool fUseCache) const
|
||||
if (pwallet == nullptr)
|
||||
return 0;
|
||||
|
||||
AssertLockHeld(pwallet->cs_wallet);
|
||||
|
||||
// Must wait until coinbase is safely deep enough in the chain before valuing it
|
||||
if (IsCoinBase() && GetBlocksToMaturity() > 0)
|
||||
return 0;
|
||||
@ -3725,6 +3731,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
|
||||
}
|
||||
|
||||
auto calculateFee = [&](CAmount& nFee) -> bool {
|
||||
AssertLockHeld(cs_wallet);
|
||||
nBytes = CalculateMaximumSignedTxSize(txNew, this, coin_control.fAllowWatchOnly);
|
||||
if (nBytes < 0) {
|
||||
strFailReason = _("Signing transaction failed");
|
||||
|
@ -785,7 +785,7 @@ private:
|
||||
/* HD derive new child key (on internal or external chain) */
|
||||
void DeriveNewChildKey(WalletBatch &batch, const CKeyMetadata& metadata, CKey& secretRet, uint32_t nAccountIndex, bool fInternal /*= false*/) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
std::set<int64_t> setInternalKeyPool;
|
||||
std::set<int64_t> setInternalKeyPool GUARDED_BY(cs_wallet);
|
||||
std::set<int64_t> setExternalKeyPool GUARDED_BY(cs_wallet);
|
||||
int64_t m_max_keypool_index GUARDED_BY(cs_wallet) = 0;
|
||||
std::map<CKeyID, int64_t> m_pool_key_to_index;
|
||||
|
Loading…
Reference in New Issue
Block a user