message: [Wallet] Add some LOCK to avoid crash
diff: @@ -944,6 +944,7 @@ int64_t CWalletTx::GetTxTime() const
  int64_t CWalletTx::GetComputedTxTime() const
  {
  + LOCK(cs_main);
  if (IsZerocoinSpend() || IsZerocoinMint()) {
  if (IsInMainChain())
  return mapBlockIndex.at(hashBlock)->GetBlockTime();
  @@ -1045,6 +1046,7 @@ CAmount CWalletTx::GetCredit(const isminefilter& filter) const
  CAmount CWalletTx::GetImmatureCredit(bool fUseCache) const
  {
  + LOCK(cs_main);
  if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0 && IsInMainChain()) {
  if (fUseCache && fImmatureCreditCached)
  return nImmatureCreditCached;
  @@ -1258,6 +1260,7 @@ CAmount CWalletTx::GetDenominatedCredit(bool unconfirmed, bool fUseCache) const
  CAmount CWalletTx::GetImmatureWatchOnlyCredit(const bool& fUseCache) const
  {
  + LOCK(cs_main);
  if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain()) {
  if (fUseCache && fImmatureWatchCreditCached)
  return nImmatureWatchCreditCached;
  @@ -1544,6 +1547,7 @@ bool CWalletTx::InMempool() const
  void CWalletTx::RelayWalletTransaction(std::string strCommand)
  {
  + LOCK(cs_main);
  if (!IsCoinBase()) {
  if (GetDepthInMainChain() == 0) {
  uint256 hash = GetHash();
  @@ -2078,6 +2082,7 @@ bool less_then_denom(const COutput& out1, const COutput& out2)
  bool CWallet::SelectStakeCoins(std::list<std::unique_ptr<CStakeInput> >& listInputs, CAmount nTargetAmount)
  {
  + LOCK(cs_main);
  //Add PIV
  vector<COutput> vCoins;
  AvailableCoins(vCoins, true, NULL, false, STAKABLE_COINS);
  @@ -2142,6 +2147,7 @@ bool CWallet::SelectStakeCoins(std::list<std::unique_ptr<CStakeInput> >& listInp
  bool CWallet::MintableCoins()
  {
  + LOCK(cs_main);
  CAmount nBalance = GetBalance();
  CAmount nZpivBalance = GetZerocoinBalance(false);
  @@ -4075,6 +4081,7 @@ void CWallet::AutoZeromint()
  void CWallet::AutoCombineDust()
  {
  + LOCK2(cs_main, cs_wallet);
  if (chainActive.Tip()->nTime < (GetAdjustedTime() - 300) || IsLocked()) {
  return;
  }
  @@ -4166,6 +4173,7 @@ void CWallet::AutoCombineDust()
  bool CWallet::MultiSend()
  {
  + LOCK2(cs_main, cs_wallet);
  // Stop the old blocks from sending multisends
  if (chainActive.Tip()->nTime < (GetAdjustedTime() - 300) || IsLocked()) {
  return false;
  @@ -4373,6 +4381,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex*& pindexRet, bool enableIX)
  int CMerkleTx::GetBlocksToMaturity() const
  {
  + LOCK(cs_main);
  if (!(IsCoinBase() || IsCoinStake()))
  return 0;
  return max(0, (Params().COINBASE_MATURITY() + 1) - GetDepthInMainChain());
  