rct: rework v2 txes into prunable and non prunable data

Nothing is pruned, but this allows easier changes later.
This commit is contained in:
moneromooo-monero
2016-08-28 21:30:18 +01:00
parent d93746b6d3
commit 93f5c625f0
8 changed files with 154 additions and 91 deletions
+19 -10
View File
@@ -177,12 +177,9 @@ namespace rct {
RCTTypeFull = 0,
RCTTypeSimple = 1,
};
struct rctSig {
struct rctSigBase {
uint8_t type;
key message;
vector<rangeSig> rangeSigs;
mgSig MG; // for non simple rct
vector<mgSig> 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<rangeSig> rangeSigs;
vector<mgSig> 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<rctSigBase *>(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} };