xrpld
Loading...
Searching...
No Matches
SHAMapAccountStateLeafNode.h
1#pragma once
2
3#include <xrpl/basics/CountedObject.h>
4#include <xrpl/protocol/HashPrefix.h>
5#include <xrpl/protocol/digest.h>
6#include <xrpl/shamap/SHAMapItem.h>
7#include <xrpl/shamap/SHAMapLeafNode.h>
8
9namespace xrpl {
10
13 public CountedObject<SHAMapAccountStateLeafNode>
14{
15public:
16 SHAMapAccountStateLeafNode(boost::intrusive_ptr<SHAMapItem const> item, std::uint32_t cowid)
17 : SHAMapLeafNode(std::move(item), cowid)
18 {
19 updateHash();
20 }
21
23 boost::intrusive_ptr<SHAMapItem const> item,
25 SHAMapHash const& hash)
26 : SHAMapLeafNode(std::move(item), cowid, hash)
27 {
28 }
29
35
37 getType() const final
38 {
40 }
41
42 void
43 updateHash() final
44 {
46 }
47
48 void
50 {
51 s.addRaw(item_->slice());
52 s.addBitString(item_->key());
54 }
55
56 void
58 {
59 s.add32(HashPrefix::LeafNode);
60 s.addRaw(item_->slice());
61 s.addBitString(item_->key());
62 }
63};
64
65} // namespace xrpl
SHAMapAccountStateLeafNode(boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid, SHAMapHash const &hash)
void serializeWithPrefix(Serializer &s) const final
Serialize the node in a format appropriate for hashing.
void updateHash() final
Recalculate the hash of this node.
SHAMapAccountStateLeafNode(boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid)
SHAMapTreeNodePtr clone(std::uint32_t cowid) const final
Make a copy of this node, setting the owner.
SHAMapNodeType getType() const final
Determines the type of node.
void serializeForWire(Serializer &s) const final
Serialize the node in a format appropriate for sending over the wire.
boost::intrusive_ptr< SHAMapItem const > item_
SHAMapLeafNode(boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid)
std::uint32_t cowid() const
Returns the SHAMap that owns this node.
STL namespace.
SharedPtr< T > makeShared(A &&... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
intr_ptr::SharedPtr< SHAMapTreeNode > SHAMapTreeNodePtr
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
Definition digest.h:204
static constexpr unsigned char const kWireTypeAccountState
@ LeafNode
account state
Definition HashPrefix.h:42