wallet2: reject duplicate outputs in reserve proofs

(cherry picked from commit 2827d7fe84ad4102dd9f3284eb98da8f0d66266d)
This commit is contained in:
selsta
2026-05-06 10:52:36 -04:00
committed by jwinterm
parent cc821f5bd8
commit e8c2387c24
+9
View File
@@ -13426,6 +13426,15 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
catch(...) {} catch(...) {}
THROW_WALLET_EXCEPTION_IF(!loaded, error::wallet_internal_error, "Failed to parse reserve proof signature data"); THROW_WALLET_EXCEPTION_IF(!loaded, error::wallet_internal_error, "Failed to parse reserve proof signature data");
std::unordered_set<crypto::key_image> seen_key_images;
std::set<std::pair<crypto::hash, uint64_t>> seen_outputs;
for (const reserve_proof_entry &proof : proofs)
{
THROW_WALLET_EXCEPTION_IF(!seen_key_images.insert(proof.key_image).second, error::wallet_internal_error, "Duplicate key image in reserve proof");
THROW_WALLET_EXCEPTION_IF(!seen_outputs.emplace(proof.txid, proof.index_in_tx).second, error::wallet_internal_error, "Duplicate output in reserve proof");
}
THROW_WALLET_EXCEPTION_IF(subaddr_spendkeys.count(address.m_spend_public_key) == 0, error::wallet_internal_error, THROW_WALLET_EXCEPTION_IF(subaddr_spendkeys.count(address.m_spend_public_key) == 0, error::wallet_internal_error,
"The given address isn't found in the proof"); "The given address isn't found in the proof");