aboutsummaryrefslogtreecommitdiff
path: root/src/ringct/rctTypes.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-01-17 21:50:03 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-11 13:37:28 +0000
commit9ce9f8caf6e290088711ce4d5d90c1507a837bf2 (patch)
tree00ec50f673c5a114352d5f95fcd81938df4dd5ab /src/ringct/rctTypes.h
parentperformance_tests: add tx checking tests with more than 2 outputs (diff)
downloadmonero-9ce9f8caf6e290088711ce4d5d90c1507a837bf2.tar.xz
bulletproofs: add multi output bulletproofs to rct
Diffstat (limited to 'src/ringct/rctTypes.h')
-rw-r--r--src/ringct/rctTypes.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h
index 68f04b0f1..5574c7784 100644
--- a/src/ringct/rctTypes.h
+++ b/src/ringct/rctTypes.h
@@ -213,6 +213,8 @@ namespace rct {
END_SERIALIZE()
};
+ size_t n_bulletproof_amounts(const std::vector<Bulletproof> &proofs);
+
//A container to hold all signatures necessary for RingCT
// rangeSigs holds all the rangeproof data of a transaction
// MG holds the MLSAG signature of a transaction
@@ -227,6 +229,7 @@ namespace rct {
RCTTypeFullBulletproof = 3,
RCTTypeSimpleBulletproof = 4,
};
+ enum RangeProofType { RangeProofBorromean, RangeProofBulletproof, RangeProofMultiOutputBulletproof };
struct rctSigBase {
uint8_t type;
key message;
@@ -310,15 +313,19 @@ namespace rct {
{
ar.tag("bp");
ar.begin_array();
- PREPARE_CUSTOM_VECTOR_SERIALIZATION(outputs, bulletproofs);
- if (bulletproofs.size() != outputs)
+ uint32_t nbp = bulletproofs.size();
+ FIELD(nbp)
+ PREPARE_CUSTOM_VECTOR_SERIALIZATION(nbp, bulletproofs);
+ if (bulletproofs.size() > outputs)
return false;
- for (size_t i = 0; i < outputs; ++i)
+ for (size_t i = 0; i < nbp; ++i)
{
FIELDS(bulletproofs[i])
- if (outputs - i > 1)
+ if (nbp - i > 1)
ar.delimit_array();
}
+ if (n_bulletproof_amounts(bulletproofs) != outputs)
+ return false;
ar.end_array();
}
else
@@ -519,6 +526,9 @@ namespace rct {
//int[64] to uint long long
xmr_amount b2d(bits amountb);
+ bool is_rct_simple(int type);
+ bool is_rct_bulletproof(int type);
+
static inline const rct::key &pk2rct(const crypto::public_key &pk) { return (const rct::key&)pk; }
static inline const rct::key &sk2rct(const crypto::secret_key &sk) { return (const rct::key&)sk; }
static inline const rct::key &ki2rct(const crypto::key_image &ki) { return (const rct::key&)ki; }