message: [Wallet] GetAvailableP2CSCoins improved.
diff: @@ -1925,26 +1925,18 @@ void CWallet::GetAvailableP2CSCoins(std::vector<COutput>& vCoins) const {
  if (!pcoin->IsTrusted())
  continue;
  - if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0)
  - continue;
  -
  - int nDepth = pcoin->GetDepthInMainChain(false);
  -
  - // We should not consider coins which aren't at least in our mempool
  - // It's possible for these to be conflicted via ancestors which we may never be able to detect
  - if (nDepth == 0 && !pcoin->InMempool())
  - continue;
  -
  if (pcoin->HasP2CSOutputs()) {
  - for (unsigned int i = 0; i < (int) pcoin->vout.size(); i++) {
  + for (int i = 0; i < (int) pcoin->vout.size(); i++) {
  const auto &utxo = pcoin->vout[i];
  - isminetype mine = IsMine(utxo);
  +
  if (IsSpent(wtxid, i))
  continue;
  if (utxo.scriptPubKey.IsPayToColdStaking()) {
  - bool fIsValid = mine & ISMINE_COLD || mine & ISMINE_SPENDABLE_DELEGATED;
  - vCoins.emplace_back(COutput(pcoin, i, nDepth, fIsValid));
  + isminetype mine = IsMine(utxo);
  + if (mine & ISMINE_COLD || mine & ISMINE_SPENDABLE_DELEGATED)
  + // Depth is not used, no need waste resources and set it for now.
  + vCoins.emplace_back(COutput(pcoin, i, 0, true));
  }
  }
  }
  