[wallet] never try to spend from unconfirmed TRUC that already has ancestors

Github-Pull: #33528
Rebased-From: e753fadfd01cb8a4a8de3bddc7391481551cca89
This commit is contained in:
glozow 2025-10-02 17:52:16 -04:00 committed by fanquake
parent d872277db5
commit ab58b2c0f8
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -403,6 +403,11 @@ CoinsResult AvailableCoins(const CWallet& wallet,
if (wtx.tx->version != TRUC_VERSION) continue;
// this unconfirmed v3 transaction already has a child
if (wtx.truc_child_in_mempool.has_value()) continue;
// this unconfirmed v3 transaction has a parent: spending would create a third generation
size_t ancestors, descendants;
wallet.chain().getTransactionAncestry(wtx.tx->GetHash(), ancestors, descendants);
if (ancestors > 1) continue;
} else {
if (wtx.tx->version == TRUC_VERSION) continue;
Assume(!wtx.truc_child_in_mempool.has_value());