diff --git a/src/txmempool.cpp b/src/txmempool.cpp index f563109f1c8da2..dcffc12605768d 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -884,7 +884,8 @@ void CTxMemPool::FindScriptPubKey(const std::set& needles, std::map 0; ) { + for (size_t txo_index = tx.vout.size(); txo_index > 0; ) { + --txo_index; const CTxOut& txo = tx.vout[txo_index]; if (needles.count(txo.scriptPubKey)) { out_results.emplace(COutPoint(hash, txo_index), Coin(txo, MEMPOOL_HEIGHT, false));