add rct to the protocol

It is not yet constrained to a fork, so don't use on the real network
or you'll be orphaned or rejected.
This commit is contained in:
moneromooo-monero
2016-06-15 23:37:13 +01:00
parent 211d1db762
commit dc4aad7eb5
26 changed files with 1219 additions and 285 deletions

View File

@@ -537,22 +537,30 @@ namespace rct {
bool verRct(const rctSig & rv) {
CHECK_AND_ASSERT_THROW_MES(rv.outPk.size() == rv.rangeSigs.size(), "Mismatched sizes of rv.outPk and rv.rangeSigs");
size_t i = 0;
bool rvb = true;
bool tmp;
DP("range proofs verified?");
for (i = 0; i < rv.outPk.size(); i++) {
tmp = verRange(rv.outPk[i].mask, rv.rangeSigs[i]);
DP(tmp);
rvb = (rvb && tmp);
}
//compute txn fee
key txnFeeKey = scalarmultH(d2h(rv.txnFee));
bool mgVerd = verRctMG(rv.MG, rv.mixRing, rv.outPk, txnFeeKey);
DP("mg sig verified?");
DP(mgVerd);
// some rct ops can throw
try
{
size_t i = 0;
bool rvb = true;
bool tmp;
DP("range proofs verified?");
for (i = 0; i < rv.outPk.size(); i++) {
tmp = verRange(rv.outPk[i].mask, rv.rangeSigs[i]);
DP(tmp);
rvb = (rvb && tmp);
}
//compute txn fee
key txnFeeKey = scalarmultH(d2h(rv.txnFee));
bool mgVerd = verRctMG(rv.MG, rv.mixRing, rv.outPk, txnFeeKey);
DP("mg sig verified?");
DP(mgVerd);
return (rvb && mgVerd);
return (rvb && mgVerd);
}
catch(...)
{
return false;
}
}
//RingCT protocol