aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorselsta <selsta@sent.at>2026-04-27 18:52:42 +0200
committerselsta <selsta@sent.at>2026-04-27 22:15:03 +0200
commit11543143b9b69713bfcfa9a38b97ceb80dc64047 (patch)
tree6ca93a89a44f276f445aad9df8505ff5fe63a5fb /src
parentb2d591eac4f192d813deb34d6d7d426a6122f212 (diff)
downloadmonzero-core-11543143b9b69713bfcfa9a38b97ceb80dc64047.tar.gz
monzero-core-11543143b9b69713bfcfa9a38b97ceb80dc64047.tar.xz
monzero-core-11543143b9b69713bfcfa9a38b97ceb80dc64047.zip
wallet2: use decodeRct for reserve proof amount validation
also update check_tx_key_helper for consistency
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index b57ae3b69..e70219529 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -12847,19 +12847,8 @@ void wallet2::check_tx_key_helper(const cryptonote::transaction &tx, const crypt
}
else
{
- crypto::secret_key scalar1;
- crypto::derivation_to_scalar(found_derivation, n, scalar1);
- rct::ecdhTuple ecdh_info = tx.rct_signatures.ecdhInfo[n];
- rct::ecdhDecode(ecdh_info, rct::sk2rct(scalar1), tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG || tx.rct_signatures.type == rct::RCTTypeBulletproofPlus);
- const rct::key C = tx.rct_signatures.outPk[n].mask;
- rct::key Ctmp;
- THROW_WALLET_EXCEPTION_IF(sc_check(ecdh_info.mask.bytes) != 0, error::wallet_internal_error, "Bad ECDH input mask");
- THROW_WALLET_EXCEPTION_IF(sc_check(ecdh_info.amount.bytes) != 0, error::wallet_internal_error, "Bad ECDH input amount");
- rct::addKeys2(Ctmp, ecdh_info.mask, ecdh_info.amount, rct::H);
- if (rct::equalKeys(C, Ctmp))
- amount = rct::h2d(ecdh_info.amount);
- else
- amount = 0;
+ rct::key mask;
+ amount = decodeRct(tx.rct_signatures, found_derivation, n, mask, hw::get_device("default"));
}
received += amount;
}
@@ -13501,11 +13490,8 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
if (amount == 0)
{
// decode rct
- crypto::secret_key shared_secret;
- crypto::derivation_to_scalar(derivation, proof.index_in_tx, shared_secret);
- rct::ecdhTuple ecdh_info = tx.rct_signatures.ecdhInfo[proof.index_in_tx];
- rct::ecdhDecode(ecdh_info, rct::sk2rct(shared_secret), tx.rct_signatures.type == rct::RCTTypeBulletproof2 || tx.rct_signatures.type == rct::RCTTypeCLSAG || tx.rct_signatures.type == rct::RCTTypeBulletproofPlus);
- amount = rct::h2d(ecdh_info.amount);
+ rct::key mask_;
+ amount = decodeRct(tx.rct_signatures, derivation, proof.index_in_tx, mask_, hw::get_device("default"));
}
total += amount;
if (kispent_res.spent_status[i])