Log txid for double spends and missing anchors

This makes debugging failed transactions much easier.
This commit is contained in:
Duke Leto
2022-06-02 21:43:10 -04:00
parent 967ad5b077
commit 421edc8979

View File

@@ -578,13 +578,13 @@ bool CCoinsViewCache::HaveShieldedRequirements(const CTransaction& tx) const
{
for (const SpendDescription &spendDescription : tx.vShieldedSpend) {
if (GetNullifier(spendDescription.nullifier, SAPLING)) { // Prevent double spends
LogPrintf("%s: sapling nullifier %s exists, preventing double spend\n", __FUNCTION__, spendDescription.nullifier.GetHex().c_str());
LogPrintf("%s: sapling nullifier %s exists, preventing double spend in tx %s\n", __FUNCTION__, spendDescription.nullifier.GetHex().c_str(), tx.GetHash().GetHex().c_str());
return false;
}
SaplingMerkleTree tree;
if (!GetSaplingAnchorAt(spendDescription.anchor, tree)) {
LogPrintf("%s: missing sapling anchor: %s \n", __FUNCTION__, spendDescription.anchor.GetHex().c_str());
LogPrintf("%s: missing sapling anchor: %s in tx %s \n", __FUNCTION__, spendDescription.anchor.GetHex().c_str(), tx.GetHash().GetHex().c_str());
return false;
}
}