Filter returned Orchard notes by minimum confirmations.

This commit is contained in:
Kris Nuttycombe 2022-03-01 16:30:29 -07:00
parent f9380572c1
commit bd50fbbb94
2 changed files with 8 additions and 8 deletions

View File

@ -174,8 +174,7 @@ class WalletAccountsTest(BitcoinTestFramework):
# visible with minconf=0.
self.sync_all()
self.check_balance(0, 0, ua0, {'sapling': 9})
# TODO: Uncomment once CWallet::FindSpendableInputs returns Orchard notes.
#self.check_balance(0, 0, ua0, {'sapling': 9, 'orchard': 10}, 0)
self.check_balance(0, 0, ua0, {'sapling': 9, 'orchard': 10}, 0)
self.nodes[2].generate(1)
self.sync_all()

View File

@ -1978,14 +1978,15 @@ SpendableInputs CWallet::FindSpendableInputs(
}, selector.GetPattern());
for (const auto& ivk : orchardIvks) {
// TODO ORCHARD: Allow the minimum number of confirmations
// to be specified
std::vector<OrchardNoteMetadata> incomingNotes;
orchardWallet.GetFilteredNotes(incomingNotes, ivk, true, true, true);
unspent.orchardNoteMetadata.insert(
unspent.orchardNoteMetadata.begin(),
incomingNotes.begin(),
incomingNotes.end());
for (const auto& noteMeta : incomingNotes) {
auto mit = mapWallet.find(noteMeta.GetOutPoint().hash);
if (mit != mapWallet.end() && mit->second.GetDepthInMainChain() >= minDepth) {
unspent.orchardNoteMetadata.push_back(noteMeta);
}
}
}
return unspent;