aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2026-04-29 13:33:17 +0000
committertobtoht <tob@featherwallet.org>2026-04-29 13:33:17 +0000
commite38364c07e4921d3cf33cce1eb56aa19478acc34 (patch)
tree7414d82b62c78a13c96aac7b02f9e4df8c567f08
parent31fbbc11bdc5b78223a98b12a523ff0b10ecc5d5 (diff)
parent2827d7fe84ad4102dd9f3284eb98da8f0d66266d (diff)
downloadmonzero-core-e38364c07e4921d3cf33cce1eb56aa19478acc34.tar.gz
monzero-core-e38364c07e4921d3cf33cce1eb56aa19478acc34.tar.xz
monzero-core-e38364c07e4921d3cf33cce1eb56aa19478acc34.zip
Merge pull request #10473
2827d7f wallet2: reject duplicate outputs in reserve proofs (selsta)
-rw-r--r--src/wallet/wallet2.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e8170131c..723635481 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -13400,6 +13400,15 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
catch(...) {}
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,
"The given address isn't found in the proof");