@@ -944,6 +944,7 @@ int64_t CWalletTx::GetTxTime() const
944
944
945
945
int64_t CWalletTx::GetComputedTxTime () const
946
946
{
947
+ LOCK (cs_main);
947
948
if (IsZerocoinSpend () || IsZerocoinMint ()) {
948
949
if (IsInMainChain ())
949
950
return mapBlockIndex.at (hashBlock)->GetBlockTime ();
@@ -1045,6 +1046,7 @@ CAmount CWalletTx::GetCredit(const isminefilter& filter) const
1045
1046
1046
1047
CAmount CWalletTx::GetImmatureCredit (bool fUseCache ) const
1047
1048
{
1049
+ LOCK (cs_main);
1048
1050
if ((IsCoinBase () || IsCoinStake ()) && GetBlocksToMaturity () > 0 && IsInMainChain ()) {
1049
1051
if (fUseCache && fImmatureCreditCached )
1050
1052
return nImmatureCreditCached;
@@ -1258,6 +1260,7 @@ CAmount CWalletTx::GetDenominatedCredit(bool unconfirmed, bool fUseCache) const
1258
1260
1259
1261
CAmount CWalletTx::GetImmatureWatchOnlyCredit (const bool & fUseCache ) const
1260
1262
{
1263
+ LOCK (cs_main);
1261
1264
if (IsCoinBase () && GetBlocksToMaturity () > 0 && IsInMainChain ()) {
1262
1265
if (fUseCache && fImmatureWatchCreditCached )
1263
1266
return nImmatureWatchCreditCached;
@@ -1544,6 +1547,7 @@ bool CWalletTx::InMempool() const
1544
1547
1545
1548
void CWalletTx::RelayWalletTransaction (std::string strCommand)
1546
1549
{
1550
+ LOCK (cs_main);
1547
1551
if (!IsCoinBase ()) {
1548
1552
if (GetDepthInMainChain () == 0 ) {
1549
1553
uint256 hash = GetHash ();
@@ -2078,6 +2082,7 @@ bool less_then_denom(const COutput& out1, const COutput& out2)
2078
2082
2079
2083
bool CWallet::SelectStakeCoins (std::list<std::unique_ptr<CStakeInput> >& listInputs, CAmount nTargetAmount)
2080
2084
{
2085
+ LOCK (cs_main);
2081
2086
// Add PIV
2082
2087
vector<COutput> vCoins;
2083
2088
AvailableCoins (vCoins, true , NULL , false , STAKABLE_COINS);
@@ -2142,6 +2147,7 @@ bool CWallet::SelectStakeCoins(std::list<std::unique_ptr<CStakeInput> >& listInp
2142
2147
2143
2148
bool CWallet::MintableCoins ()
2144
2149
{
2150
+ LOCK (cs_main);
2145
2151
CAmount nBalance = GetBalance ();
2146
2152
CAmount nZpivBalance = GetZerocoinBalance (false );
2147
2153
@@ -4075,6 +4081,7 @@ void CWallet::AutoZeromint()
4075
4081
4076
4082
void CWallet::AutoCombineDust ()
4077
4083
{
4084
+ LOCK2 (cs_main, cs_wallet);
4078
4085
if (chainActive.Tip ()->nTime < (GetAdjustedTime () - 300 ) || IsLocked ()) {
4079
4086
return ;
4080
4087
}
@@ -4166,6 +4173,7 @@ void CWallet::AutoCombineDust()
4166
4173
4167
4174
bool CWallet::MultiSend ()
4168
4175
{
4176
+ LOCK2 (cs_main, cs_wallet);
4169
4177
// Stop the old blocks from sending multisends
4170
4178
if (chainActive.Tip ()->nTime < (GetAdjustedTime () - 300 ) || IsLocked ()) {
4171
4179
return false ;
@@ -4373,6 +4381,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex*& pindexRet, bool enableIX)
4373
4381
4374
4382
int CMerkleTx::GetBlocksToMaturity () const
4375
4383
{
4384
+ LOCK (cs_main);
4376
4385
if (!(IsCoinBase () || IsCoinStake ()))
4377
4386
return 0 ;
4378
4387
return max (0 , (Params ().COINBASE_MATURITY () + 1 ) - GetDepthInMainChain ());
0 commit comments