message: Fix CWalletTx::IsTrusted() return incorrect for spend
diff: @@ -1784,8 +1784,9 @@ bool CWalletTx::InStempool() const {
  }
  bool CWalletTx::IsTrusted() const {
  - // Quick answer in most cases
  - if (!CheckFinalTx(*this))
  + // Quick answer in most cases.
  + // Zerocoin spend is always false due to it use nSequence incorrectly.
  + if (!IsZerocoinSpend() && !CheckFinalTx(*this))
  return false;
  int nDepth = GetDepthInMainChain();
  if (nDepth >= 1)
  @@ -1802,6 +1803,11 @@ bool CWalletTx::IsTrusted() const {
  // Trusted if all inputs are from us and are in the mempool:
  BOOST_FOREACH(const CTxIn &txin, vin)
  {
  + if (txin.IsZerocoinSpend() || txin.IsZerocoinSpendV3()) {
  + if (!(pwallet->IsMine(txin) & ISMINE_SPENDABLE)) {
  + return false;
  + }
  + } else {
  // Transactions not sent by us: not trusted
  const CWalletTx *parent = pwallet->GetWalletTx(txin.prevout.hash);
  if (parent == NULL)
  @@ -1810,6 +1816,8 @@ bool CWalletTx::IsTrusted() const {
  if (pwallet->IsMine(parentOut) != ISMINE_SPENDABLE)
  return false;
  }
  + }
  +
  return true;
  }
  