diff options
Diffstat (limited to 'src/ringct')
-rw-r--r-- | src/ringct/rctSigs.cpp | 12 | ||||
-rw-r--r-- | src/ringct/rctTypes.h | 12 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index c252645f8..d031f6c79 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -563,7 +563,7 @@ namespace rct { } rctSig rv; - rv.simple = false; + rv.type = RCTTypeFull; rv.outPk.resize(destinations.size()); rv.rangeSigs.resize(destinations.size()); rv.ecdhInfo.resize(destinations.size()); @@ -625,7 +625,7 @@ namespace rct { } rctSig rv; - rv.simple = true; + rv.type = RCTTypeSimple; rv.message = message; rv.outPk.resize(destinations.size()); rv.rangeSigs.resize(destinations.size()); @@ -700,7 +700,7 @@ namespace rct { // uses the attached ecdh info to find the amounts represented by each output commitment // must know the destination private key to find the correct amount, else will return a random number bool verRct(const rctSig & rv, const ctkeyM &mixRing, const keyV &II, const ctkeyV &outPk, const key &message) { - CHECK_AND_ASSERT_MES(!rv.simple, false, "verRct called on simple rctSig"); + CHECK_AND_ASSERT_MES(rv.type == RCTTypeFull, false, "verRct called on non-full rctSig"); CHECK_AND_ASSERT_MES(outPk.size() == rv.rangeSigs.size(), false, "Mismatched sizes of outPk and rv.rangeSigs"); CHECK_AND_ASSERT_MES(outPk.size() == rv.ecdhInfo.size(), false, "Mismatched sizes of outPk and rv.ecdhInfo"); @@ -739,7 +739,7 @@ namespace rct { size_t i = 0; bool rvb = true; - CHECK_AND_ASSERT_MES(rv.simple, false, "verRctSimple called on non simple rctSig"); + CHECK_AND_ASSERT_MES(rv.type == RCTTypeSimple, false, "verRctSimple called on non simple rctSig"); CHECK_AND_ASSERT_MES(outPk.size() == rv.rangeSigs.size(), false, "Mismatched sizes of outPk and rv.rangeSigs"); CHECK_AND_ASSERT_MES(outPk.size() == rv.ecdhInfo.size(), false, "Mismatched sizes of outPk and rv.ecdhInfo"); CHECK_AND_ASSERT_MES(rv.pseudoOuts.size() == rv.MGs.size(), false, "Mismatched sizes of rv.pseudoOuts and rv.MGs"); @@ -803,7 +803,7 @@ namespace rct { // uses the attached ecdh info to find the amounts represented by each output commitment // must know the destination private key to find the correct amount, else will return a random number static xmr_amount decodeRctMain(const rctSig & rv, const key & sk, unsigned int i, key & mask, void (*decode)(ecdhTuple&, const key&)) { - CHECK_AND_ASSERT_MES(!rv.simple, false, "decodeRct called on simple rctSig"); + CHECK_AND_ASSERT_MES(rv.type == RCTTypeFull, false, "decodeRct called on non-full rctSig"); CHECK_AND_ASSERT_THROW_MES(rv.rangeSigs.size() > 0, "Empty rv.rangeSigs"); CHECK_AND_ASSERT_THROW_MES(rv.outPk.size() == rv.rangeSigs.size(), "Mismatched sizes of rv.outPk and rv.rangeSigs"); CHECK_AND_ASSERT_THROW_MES(i < rv.ecdhInfo.size(), "Bad index"); @@ -840,7 +840,7 @@ namespace rct { } static xmr_amount decodeRctSimpleMain(const rctSig & rv, const key & sk, unsigned int i, key &mask, void (*decode)(ecdhTuple &ecdh, const key&)) { - CHECK_AND_ASSERT_MES(rv.simple, false, "decodeRct called on non simple rctSig"); + CHECK_AND_ASSERT_MES(rv.type == RCTTypeSimple, false, "decodeRct called on non simple rctSig"); CHECK_AND_ASSERT_THROW_MES(rv.rangeSigs.size() > 0, "Empty rv.rangeSigs"); CHECK_AND_ASSERT_THROW_MES(rv.outPk.size() == rv.rangeSigs.size(), "Mismatched sizes of rv.outPk and rv.rangeSigs"); CHECK_AND_ASSERT_THROW_MES(i < rv.ecdhInfo.size(), "Bad index"); diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index 8df403c68..98876a08c 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -173,8 +173,12 @@ namespace rct { // ecdhInfo holds an encoded mask / amount to be passed to each receiver // outPk contains public keypairs which are destinations (P, C), // P = address, C = commitment to amount + enum { + RCTTypeFull = 0, + RCTTypeSimple = 1, + }; struct rctSig { - bool simple; + uint8_t type; key message; vector<rangeSig> rangeSigs; mgSig MG; // for non simple rct @@ -187,15 +191,15 @@ namespace rct { xmr_amount txnFee; // contains b BEGIN_SERIALIZE_OBJECT() - FIELD(simple) + FIELD(type) // FIELD(message) - not serialized, it can be reconstructed FIELD(rangeSigs) - if (simple) + if (type == RCTTypeSimple) FIELD(MGs) else FIELD(MG) // FIELD(mixRing) - not serialized, it can be reconstructed - if (simple) + if (type == RCTTypeSimple) FIELD(pseudoOuts) FIELD(ecdhInfo) if (typename Archive<W>::is_saving()) { |