Don’t trust mempool tx when using `asOfHeight`

This commit is contained in:
Greg Pfeil 2022-11-21 18:54:11 -07:00
parent 71b5f99ede
commit 77fb36a422
1 changed files with 3 additions and 0 deletions

View File

@ -5052,6 +5052,9 @@ bool CWalletTx::IsTrusted(const std::optional<int>& asOfHeight) const
int nDepth = GetDepthInMainChain(asOfHeight);
if (nDepth >= 1)
return true;
if (asOfHeight.has_value() && nDepth == 0)
// dont trust mempool tx if using `asOfHeight`
return false;
if (nDepth < 0)
return false;
if (!bSpendZeroConfChange || !IsFromMe(ISMINE_ALL)) // using wtx's cached debit