mirror of
https://github.com/monero-project/monero.git
synced 2026-07-30 23:50:24 -07:00
Merge pull request #10471
1154314 wallet2: use decodeRct for reserve proof amount validation (selsta)
This commit is contained in:
+4
-18
@@ -12849,19 +12849,8 @@ void wallet2::check_tx_key_helper(const cryptonote::transaction &tx, const crypt
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
crypto::secret_key scalar1;
|
rct::key mask;
|
||||||
crypto::derivation_to_scalar(found_derivation, n, scalar1);
|
amount = decodeRct(tx.rct_signatures, found_derivation, n, mask, hw::get_device("default"));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
received += amount;
|
received += amount;
|
||||||
}
|
}
|
||||||
@@ -13503,11 +13492,8 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
|
|||||||
if (amount == 0)
|
if (amount == 0)
|
||||||
{
|
{
|
||||||
// decode rct
|
// decode rct
|
||||||
crypto::secret_key shared_secret;
|
rct::key mask_;
|
||||||
crypto::derivation_to_scalar(derivation, proof.index_in_tx, shared_secret);
|
amount = decodeRct(tx.rct_signatures, derivation, proof.index_in_tx, mask_, hw::get_device("default"));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
total += amount;
|
total += amount;
|
||||||
if (kispent_res.spent_status[i])
|
if (kispent_res.spent_status[i])
|
||||||
|
|||||||
Reference in New Issue
Block a user