From 93f5c625f058ee1f81c02c8bb03744b28bbde90a Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 9 Aug 2016 21:34:09 +0100 Subject: rct: rework v2 txes into prunable and non prunable data Nothing is pruned, but this allows easier changes later. --- src/ringct/rctTypes.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/ringct/rctTypes.h') diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index 98876a08c..8211fbaed 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -177,12 +177,9 @@ namespace rct { RCTTypeFull = 0, RCTTypeSimple = 1, }; - struct rctSig { + struct rctSigBase { uint8_t type; key message; - vector rangeSigs; - mgSig MG; // for non simple rct - vector MGs; // for simple rct ctkeyM mixRing; //the set of all pubkeys / copy //pairs that you mix with keyV pseudoOuts; //C - for simple rct @@ -190,14 +187,9 @@ namespace rct { ctkeyV outPk; xmr_amount txnFee; // contains b - BEGIN_SERIALIZE_OBJECT() + BEGIN_SERIALIZE() FIELD(type) // FIELD(message) - not serialized, it can be reconstructed - FIELD(rangeSigs) - if (type == RCTTypeSimple) - FIELD(MGs) - else - FIELD(MG) // FIELD(mixRing) - not serialized, it can be reconstructed if (type == RCTTypeSimple) FIELD(pseudoOuts) @@ -218,6 +210,23 @@ namespace rct { FIELD(txnFee) END_SERIALIZE() }; + struct rctSigPrunable { + vector rangeSigs; + vector MGs; // simple rct has N, full has 1 + + BEGIN_SERIALIZE() + FIELD(rangeSigs) + FIELD(MGs) + END_SERIALIZE() + }; + struct rctSig: public rctSigBase { + rctSigPrunable p; + + BEGIN_SERIALIZE_OBJECT() + FIELDS(*static_cast(this)) + FIELDS(p); + END_SERIALIZE() + }; //other basepoint H = toPoint(cn_fast_hash(G)), G the basepoint static const key H = { {0x8b, 0x65, 0x59, 0x70, 0x15, 0x37, 0x99, 0xaf, 0x2a, 0xea, 0xdc, 0x9f, 0xf1, 0xad, 0xd0, 0xea, 0x6c, 0x72, 0x51, 0xd5, 0x41, 0x54, 0xcf, 0xa9, 0x2c, 0x17, 0x3a, 0x0d, 0xd3, 0x9c, 0x1f, 0x94} }; -- cgit v1.2.3