Electroneum
rct::rctSigPrunable Struct Reference

#include <rctTypes.h>

Collaboration diagram for rct::rctSigPrunable:

Public Member Functions

template<bool W, template< bool > class Archive>
bool serialize_rctsig_prunable (Archive< W > &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin)
 

Public Attributes

std::vector< rangeSigrangeSigs
 
std::vector< Bulletproofbulletproofs
 
std::vector< mgSigMGs
 
keyV pseudoOuts
 

Detailed Description

Definition at line 318 of file rctTypes.h.

Member Function Documentation

◆ serialize_rctsig_prunable()

template<bool W, template< bool > class Archive>
bool rct::rctSigPrunable::serialize_rctsig_prunable ( Archive< W > &  ar,
uint8_t  type,
size_t  inputs,
size_t  outputs,
size_t  mixin 
)
inline

Definition at line 325 of file rctTypes.h.

326  {
327  if (type == RCTTypeNull)
328  return ar.stream().good();
329  if (type != RCTTypeFull && type != RCTTypeSimple && type != RCTTypeBulletproof && type != RCTTypeBulletproof2)
330  return false;
331  if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2)
332  {
333  uint32_t nbp = bulletproofs.size();
334  if (type == RCTTypeBulletproof2)
335  VARINT_FIELD(nbp)
336  else
337  FIELD(nbp)
338  ar.tag("bp");
339  ar.begin_array();
340  if (nbp > outputs)
341  return false;
343  for (size_t i = 0; i < nbp; ++i)
344  {
345  FIELDS(bulletproofs[i])
346  if (nbp - i > 1)
347  ar.delimit_array();
348  }
350  return false;
351  ar.end_array();
352  }
353  else
354  {
355  ar.tag("rangeSigs");
356  ar.begin_array();
358  if (rangeSigs.size() != outputs)
359  return false;
360  for (size_t i = 0; i < outputs; ++i)
361  {
362  FIELDS(rangeSigs[i])
363  if (outputs - i > 1)
364  ar.delimit_array();
365  }
366  ar.end_array();
367  }
368 
369  ar.tag("MGs");
370  ar.begin_array();
371  // we keep a byte for size of MGs, because we don't know whether this is
372  // a simple or full rct signature, and it's starting to annoy the hell out of me
373  size_t mg_elements = (type == RCTTypeSimple || type == RCTTypeBulletproof || type == RCTTypeBulletproof2) ? inputs : 1;
375  if (MGs.size() != mg_elements)
376  return false;
377  for (size_t i = 0; i < mg_elements; ++i)
378  {
379  // we save the MGs contents directly, because we want it to save its
380  // arrays and matrices without the size prefixes, and the load can't
381  // know what size to expect if it's not in the data
382  ar.begin_object();
383  ar.tag("ss");
384  ar.begin_array();
385  PREPARE_CUSTOM_VECTOR_SERIALIZATION(mixin + 1, MGs[i].ss);
386  if (MGs[i].ss.size() != mixin + 1)
387  return false;
388  for (size_t j = 0; j < mixin + 1; ++j)
389  {
390  ar.begin_array();
391  size_t mg_ss2_elements = ((type == RCTTypeSimple || type == RCTTypeBulletproof || type == RCTTypeBulletproof2) ? 1 : inputs) + 1;
392  PREPARE_CUSTOM_VECTOR_SERIALIZATION(mg_ss2_elements, MGs[i].ss[j]);
393  if (MGs[i].ss[j].size() != mg_ss2_elements)
394  return false;
395  for (size_t k = 0; k < mg_ss2_elements; ++k)
396  {
397  FIELDS(MGs[i].ss[j][k])
398  if (mg_ss2_elements - k > 1)
399  ar.delimit_array();
400  }
401  ar.end_array();
402 
403  if (mixin + 1 - j > 1)
404  ar.delimit_array();
405  }
406  ar.end_array();
407 
408  ar.tag("cc");
409  FIELDS(MGs[i].cc)
410  // MGs[i].II not saved, it can be reconstructed
411  ar.end_object();
412 
413  if (mg_elements - i > 1)
414  ar.delimit_array();
415  }
416  ar.end_array();
417  if (type == RCTTypeBulletproof || type == RCTTypeBulletproof2)
418  {
419  ar.tag("pseudoOuts");
420  ar.begin_array();
422  if (pseudoOuts.size() != inputs)
423  return false;
424  for (size_t i = 0; i < inputs; ++i)
425  {
426  FIELDS(pseudoOuts[i])
427  if (inputs - i > 1)
428  ar.delimit_array();
429  }
430  ar.end_array();
431  }
432  return ar.stream().good();
433  }
size_t n_bulletproof_max_amounts(const Bulletproof &proof)
Definition: rctTypes.cpp:278
std::vector< mgSig > MGs
Definition: rctTypes.h:321
std::vector< rangeSig > rangeSigs
Definition: rctTypes.h:319
unsigned int uint32_t
Definition: stdint.h:126
#define FIELDS(f)
does not add a tag to the serialized value
#define VARINT_FIELD(f)
tags and serializes the varint f
#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec)
#define FIELD(f)
tags the field with the variable name and then serializes it
std::vector< Bulletproof > bulletproofs
Definition: rctTypes.h:320
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bulletproofs

std::vector<Bulletproof> rct::rctSigPrunable::bulletproofs

Definition at line 320 of file rctTypes.h.

◆ MGs

std::vector<mgSig> rct::rctSigPrunable::MGs

Definition at line 321 of file rctTypes.h.

◆ pseudoOuts

keyV rct::rctSigPrunable::pseudoOuts

Definition at line 322 of file rctTypes.h.

◆ rangeSigs

std::vector<rangeSig> rct::rctSigPrunable::rangeSigs

Definition at line 319 of file rctTypes.h.


The documentation for this struct was generated from the following file: