Set number of confirmations for Orchard notes returned by FindSpendableInputs

This commit is contained in:
Kris Nuttycombe 2022-03-07 10:06:52 -07:00
parent 3b5fc4e583
commit 38f4afa80c
1 changed files with 4 additions and 2 deletions

View File

@ -2034,13 +2034,15 @@ SpendableInputs CWallet::FindSpendableInputs(
std::vector<OrchardNoteMetadata> incomingNotes;
orchardWallet.GetFilteredNotes(incomingNotes, ivk, true, true);
for (const auto& noteMeta : incomingNotes) {
for (auto& noteMeta : incomingNotes) {
if (IsOrchardSpent(noteMeta.GetOutPoint())) {
continue;
}
auto mit = mapWallet.find(noteMeta.GetOutPoint().hash);
if (mit != mapWallet.end() && mit->second.GetDepthInMainChain() >= minDepth) {
auto confirmations = mit->second.GetDepthInMainChain();
if (mit != mapWallet.end() && confirmations >= minDepth) {
noteMeta.SetConfirmations(confirmations);
unspent.orchardNoteMetadata.push_back(noteMeta);
}
}