aboutsummaryrefslogtreecommitdiff
path: root/src/ringct/rctSigs.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-02-14 17:45:04 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2022-04-05 18:50:22 +0000
commit4c94cfecfcb96c218b37234eda2f9c262821cf7c (patch)
treeaf8183f3dacf18298fe0f6f5493c2dc48ebcc1cd /src/ringct/rctSigs.cpp
parentringct: port some of vtnerd's review changes from BP+ to BP (diff)
downloadmonero-4c94cfecfcb96c218b37234eda2f9c262821cf7c.tar.xz
store outPk/8 in the tx for speed
It avoids dividing by 8 when deserializing a tx, which is a slow operation, and multiplies by 8 when verifying and extracing the amount, which is much faster as well as less frequent
Diffstat (limited to '')
-rw-r--r--src/ringct/rctSigs.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp
index 961d83a9e..d7883baac 100644
--- a/src/ringct/rctSigs.cpp
+++ b/src/ringct/rctSigs.cpp
@@ -1205,7 +1205,7 @@ namespace rct {
rv.p.bulletproofs_plus.clear();
if (bulletproof_or_plus)
{
- const bool plus = rv.type == RCTTypeBulletproofPlus;
+ const bool plus = is_rct_bulletproof_plus(rv.type);
size_t n_amounts = outamounts.size();
size_t amounts_proved = 0;
if (rct_config.range_proof_type == RangeProofPaddedBulletproof)
@@ -1235,7 +1235,10 @@ namespace rct {
}
for (i = 0; i < outamounts.size(); ++i)
{
- rv.outPk[i].mask = rct::scalarmult8(C[i]);
+ if (plus)
+ rv.outPk[i].mask = C[i];
+ else
+ rv.outPk[i].mask = rct::scalarmult8(C[i]);
outSk[i].mask = masks[i];
}
}
@@ -1273,7 +1276,10 @@ namespace rct {
}
for (i = 0; i < batch_size; ++i)
{
- rv.outPk[i + amounts_proved].mask = rct::scalarmult8(C[i]);
+ if (plus)
+ rv.outPk[i + amounts_proved].mask = C[i];
+ else
+ rv.outPk[i + amounts_proved].mask = rct::scalarmult8(C[i]);
outSk[i + amounts_proved].mask = masks[i];
}
amounts_proved += batch_size;
@@ -1480,7 +1486,10 @@ namespace rct {
rct::keyV masks(rv.outPk.size());
for (size_t i = 0; i < rv.outPk.size(); i++) {
- masks[i] = rv.outPk[i].mask;
+ if (bulletproof_plus)
+ masks[i] = rct::scalarmult8(rv.outPk[i].mask);
+ else
+ masks[i] = rv.outPk[i].mask;
}
key sumOutpks = addKeys(masks);
DP(sumOutpks);
@@ -1640,6 +1649,8 @@ namespace rct {
mask = ecdh_info.mask;
key amount = ecdh_info.amount;
key C = rv.outPk[i].mask;
+ if (is_rct_bulletproof_plus(rv.type))
+ C = scalarmult8(C);
DP("C");
DP(C);
key Ctmp;
@@ -1671,6 +1682,8 @@ namespace rct {
mask = ecdh_info.mask;
key amount = ecdh_info.amount;
key C = rv.outPk[i].mask;
+ if (is_rct_bulletproof_plus(rv.type))
+ C = scalarmult8(C);
DP("C");
DP(C);
key Ctmp;