Skip to content

Commit ab58b2c

Browse files
glozowfanquake
authored andcommitted
[wallet] never try to spend from unconfirmed TRUC that already has ancestors
Github-Pull: #33528 Rebased-From: e753fad
1 parent d872277 commit ab58b2c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/wallet/spend.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,11 @@ CoinsResult AvailableCoins(const CWallet& wallet,
403403
if (wtx.tx->version != TRUC_VERSION) continue;
404404
// this unconfirmed v3 transaction already has a child
405405
if (wtx.truc_child_in_mempool.has_value()) continue;
406+
407+
// this unconfirmed v3 transaction has a parent: spending would create a third generation
408+
size_t ancestors, descendants;
409+
wallet.chain().getTransactionAncestry(wtx.tx->GetHash(), ancestors, descendants);
410+
if (ancestors > 1) continue;
406411
} else {
407412
if (wtx.tx->version == TRUC_VERSION) continue;
408413
Assume(!wtx.truc_child_in_mempool.has_value());

0 commit comments

Comments
 (0)