From 3c0e1d9aa8b958c397d6f8d87f367f8b4d97b669 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Thu, 10 Mar 2022 00:20:37 +0800 Subject: [PATCH] CWallet::GetConflictS: Handle conflicting Orchard spends. Co-authored by: Kris Nuttycombe --- src/wallet/wallet.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9d07ec3a8..68d8dd327 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1476,7 +1476,18 @@ set CWallet::GetConflicts(const uint256& txid) const } } - // TODO ORCHARD; see #5593 + for (uint32_t i = 0; i < wtx.GetOrchardBundle().GetNumActions(); i++) { + OrchardOutPoint op(wtx.GetHash(), i); + auto potential_spends = pwalletMain->orchardWallet.GetPotentialSpends(op); + + if (potential_spends.size() <= 1) { + continue; // No conflict if zero or one spends + } + for (const uint256 txid : potential_spends) { + // TODO: Take into account transaction expiry; see #5585 + result.insert(txid); + } + } return result; }