Build enough information into the leaf nodes so that they can be parsed

without knowledge of the objects they contain. This will allow new
transaction or account formats to be added (possibly with larger data sizes)
without breaking the ability to parse the hash trees. It also simplifies
the operation-specific tree code (since it doesn't have to parse the raw
leaf data).
This commit is contained in:
JoelKatz
2011-11-28 13:59:34 -08:00
parent e87a027df2
commit ebb9a9c255
6 changed files with 94 additions and 28 deletions

View File

@@ -21,6 +21,7 @@ class Serializer
Serializer(const std::vector<unsigned char> &data) : mData(data) { ; }
// assemble functions
int add16(uint16);
int add32(uint32); // ledger indexes, account sequence
int add64(uint64); // timestamps, amounts
int add160(const uint160&); // account names, hankos
@@ -28,6 +29,7 @@ class Serializer
int addRaw(const std::vector<unsigned char> &vector);
// disassemble functions
bool get16(uint16&, int offset) const;
bool get32(uint32&, int offset) const;
bool get64(uint64&, int offset) const;
bool get160(uint160&, int offset) const;