Evgeniy Stratonikov
bd2b1a0521
mpt: add Size
method to trie nodes
...
Knowing serialized size of the node is useful for
preallocating byte-slice in advance.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 12:01:16 +03:00
Evgeniy Stratonikov
43ee671f36
mpt: do not allocate NodeObject for serialization
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 10:28:19 +03:00
Evgeniy Stratonikov
5b1f6207de
mpt: reduce max key length
...
The constant used is actually a nibbled-path restriction.
Clarify this and make them private.
2021-06-04 11:09:17 +03:00
Anna Shaleva
8c358aa556
mpt: change MaxKeyLength for LeafNode
2021-04-01 10:20:16 +03:00
Anna Shaleva
b9927c39ee
mpt: refactor nodes serialisation
...
It should be serialised with type in case if it's a children node.
The type can be either HashT or EmptyT.
2021-04-01 10:19:57 +03:00
Roman Khimov
475bf2445a
mpt: restructure nodes a bit, implement serialization and hash cache
...
It drastically reduces the number of allocations and hash calculations.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00
Evgenii Stratonikov
f0b85f8af7
mpt: implement JSON marshaling/unmarshaling
...
Because there is no distinct type field in JSONized nodes, distinction
is made via payload itself, thus all unmarshaling is done via
NodeObject.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00
Evgenii Stratonikov
dc6741bce7
mpt: implement MPT trie
...
MPT is a trie with a branching factor = 16, i.e. it consists of sequences in
16-element alphabet.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00