Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_root_extension.hpp
Go to the documentation of this file.
1#pragma once
3#include <string>
4
5namespace sysio { namespace chain {
6
7struct s_header {
12
13 s_header() = default;
14 s_header(const name& contract, const checksum256_type& prev, const checksum256_type& curr, const checksum256_type& root)
15 : contract_name(contract), previous_s_id(prev), current_s_id(curr), current_s_root(root) {}
16
17 // Copy constructor (default)
18 s_header(const s_header& other) = default;
19
20 // Copy assignment operator
21 s_header& operator=(const s_header& other) {
22 if (this != &other) {
23 contract_name = other.contract_name;
24 previous_s_id = other.previous_s_id;
25 current_s_id = other.current_s_id;
26 current_s_root = other.current_s_root;
27 }
28 return *this;
29 }
30
31 friend bool operator == (const s_header& a, const s_header& b) {
32 return std::tie(a.contract_name, a.previous_s_id, a.current_s_id, a.current_s_root) ==
34 }
35
36 std::string to_string() const {
37 return "\n\tContract Name: " + contract_name.to_string() +
38 "\n\tPrevious S-ID: " + previous_s_id.str() +
39 "\n\tCurrent S-ID: " + current_s_id.str() +
40 "\n\tCurrent S-Root: " + current_s_root.str();
41 }
42};
43
45 static constexpr uint16_t extension_id() { return 2; } // Unique ID for the extension
46 static constexpr bool enforce_unique() { return true; } // Enforces that each block can only have one such extension
47
49
50 s_root_extension() = default;
51 explicit s_root_extension(const s_header& header)
52 : s_header_data(header) {}
53
54 friend bool operator == (const s_root_extension& a, const s_root_extension& b) {
55 return a.s_header_data == b.s_header_data;
56 }
57};
58
59}} // namespace sysio::chain
60
62 (contract_name)
63 (previous_s_id)
64 (current_s_id)
65 (current_s_root))
66
68 (s_header_data))
string str() const
Definition sha256.cpp:26
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
unsigned short uint16_t
Definition stdint.h:125
Immutable except for fc::from_variant.
Definition name.hpp:43
std::string to_string() const
Definition name.cpp:19
checksum256_type current_s_id
std::string to_string() const
friend bool operator==(const s_header &a, const s_header &b)
checksum256_type current_s_root
s_header(const name &contract, const checksum256_type &prev, const checksum256_type &curr, const checksum256_type &root)
checksum256_type previous_s_id
s_header(const s_header &other)=default
s_header & operator=(const s_header &other)
static constexpr uint16_t extension_id()
s_root_extension(const s_header &header)
static constexpr bool enforce_unique()
friend bool operator==(const s_root_extension &a, const s_root_extension &b)