xrpld
Loading...
Searching...
No Matches
SHAMapTxLeafNode.h
1#pragma once
2
3#include <xrpl/basics/CountedObject.h>
4#include <xrpl/basics/IntrusivePointer.h>
5#include <xrpl/basics/SHAMapHash.h>
6#include <xrpl/protocol/HashPrefix.h>
7#include <xrpl/protocol/Serializer.h>
8#include <xrpl/protocol/digest.h>
9#include <xrpl/shamap/SHAMapItem.h>
10#include <xrpl/shamap/SHAMapLeafNode.h>
11#include <xrpl/shamap/SHAMapTreeNode.h>
12
13#include <cstdint>
14#include <utility>
15
16namespace xrpl {
17
21class SHAMapTxLeafNode final : public SHAMapLeafNode, public CountedObject<SHAMapTxLeafNode>
22{
23public:
24 SHAMapTxLeafNode(boost::intrusive_ptr<SHAMapItem const> item, std::uint32_t cowid)
25 : SHAMapLeafNode(std::move(item), cowid)
26 {
27 updateHash();
28 }
29
31 boost::intrusive_ptr<SHAMapItem const> item,
33 SHAMapHash const& hash)
34 : SHAMapLeafNode(std::move(item), cowid, hash)
35 {
36 }
37
43
45 getType() const final
46 {
48 }
49
50 void
55
56 void
58 {
59 s.addRaw(item_->slice());
61 }
62
63 void
65 {
67 s.addRaw(item_->slice());
68 }
69};
70
71} // namespace xrpl
boost::intrusive_ptr< SHAMapItem const > item_
SHAMapLeafNode(boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid)
void updateHash() final
Recalculate the hash of this node.
void serializeWithPrefix(Serializer &s) const final
Serialize the node in a format appropriate for hashing.
SHAMapTxLeafNode(boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid, SHAMapHash const &hash)
SHAMapNodeType getType() const final
Determines the type of node.
SHAMapTreeNodePtr clone(std::uint32_t cowid) const final
Make a copy of this node, setting the owner.
SHAMapTxLeafNode(boost::intrusive_ptr< SHAMapItem const > item, std::uint32_t cowid)
void serializeForWire(Serializer &s) const final
Serialize the node in a format appropriate for sending over the wire.
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:215
static constexpr unsigned char const kWireTypeTransaction
@ TransactionId
transaction plus signature to give transaction ID
Definition HashPrefix.h:39