veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::Endorsement< EndorsedHash, ContainingHash, Container > Struct Template Reference

Detailed Description

template<class EndorsedHash, class ContainingHash, class Container>
struct altintegration::Endorsement< EndorsedHash, ContainingHash, Container >
Protecting Chain:
A - B - C - D - E - F - G - H - I - J
/
block of proof
Protected Chain:
A - B - C - D - E - F - G - H - I - J
/ /
endorsed hash containing hash
Fully in-memory chain representation.
Definition: chain.hpp:25

"endorsed hash" is a block hash that is endorsed by POP TX. "block of proof" is a block from protecting chain that contains a tx with proof. "containing hash" is a block which contains POP TX which endorses "endorsed block"

Template Parameters
EndorsedHash
ContainingHash
Container

Definition at line 37 of file endorsement.hpp.

#include <endorsement.hpp>

+ Collaboration diagram for altintegration::Endorsement< EndorsedHash, ContainingHash, Container >:

Public Types

using type = Endorsement< EndorsedHash, ContainingHash, Container >
 
using id_t = uint256
 
using endorsed_hash_t = EndorsedHash
 
using containing_hash_t = ContainingHash
 
using container_t = Container
 

Public Member Functions

void toVbkEncoding (WriteStream &stream) const
 
std::vector< uint8_t > toVbkEncoding () const
 
type::id_t getId () const
 
bool operator== (const type &other) const
 
bool operator!= (const type &other) const
 
std::string toPrettyString (size_t level=0) const
 

Static Public Member Functions

static type fromContainer (const Container &c)
 
static type fromContainer (const Container &c, const EndorsedHash &containingHash, const EndorsedHash &endorsedHash)
 
static std::shared_ptr< typefromContainerPtr (const Container &c, const EndorsedHash &containingHash, const EndorsedHash &endorsedHash)
 
static std::shared_ptr< typefromContainerPtr (const Container &c)
 
static type::id_t getId (const Container &c)
 
static const std::string name ()
 

Public Attributes

id_t id
 
EndorsedHash endorsedHash
 
EndorsedHash containingHash
 
ContainingHash blockOfProof
 

Friends

bool operator< (const type &a, const type &b)
 

Member Typedef Documentation

◆ container_t

template<class EndorsedHash , class ContainingHash , class Container >
using altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::container_t = Container

Definition at line 42 of file endorsement.hpp.

◆ containing_hash_t

template<class EndorsedHash , class ContainingHash , class Container >
using altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::containing_hash_t = ContainingHash

Definition at line 41 of file endorsement.hpp.

◆ endorsed_hash_t

template<class EndorsedHash , class ContainingHash , class Container >
using altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::endorsed_hash_t = EndorsedHash

Definition at line 40 of file endorsement.hpp.

◆ id_t

template<class EndorsedHash , class ContainingHash , class Container >
using altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::id_t = uint256

Definition at line 39 of file endorsement.hpp.

◆ type

template<class EndorsedHash , class ContainingHash , class Container >
using altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::type = Endorsement<EndorsedHash, ContainingHash, Container>

Definition at line 38 of file endorsement.hpp.

Member Function Documentation

◆ fromContainerPtr() [1/2]

template<class EndorsedHash , class ContainingHash , class Container >
static std::shared_ptr< type > altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::fromContainerPtr ( const Container &  c)
inlinestatic

Definition at line 77 of file endorsement.hpp.

77 {
78 return std::make_shared<type>(fromContainer(c));
79 }

◆ fromContainerPtr() [2/2]

template<class EndorsedHash , class ContainingHash , class Container >
static std::shared_ptr< type > altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::fromContainerPtr ( const Container &  c,
const EndorsedHash &  containingHash,
const EndorsedHash &  endorsedHash 
)
inlinestatic

Definition at line 69 of file endorsement.hpp.

72 {
73 return std::make_shared<type>(
74 fromContainer(c, containingHash, endorsedHash));
75 }

◆ getId()

template<class EndorsedHash , class ContainingHash , class Container >
type::id_t altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::getId ( ) const
inline

Definition at line 83 of file endorsement.hpp.

83{ return id; }

◆ operator!=()

template<class EndorsedHash , class ContainingHash , class Container >
bool altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::operator!= ( const type other) const
inline

Definition at line 97 of file endorsement.hpp.

97{ return !operator==(other); }

◆ operator==()

template<class EndorsedHash , class ContainingHash , class Container >
bool altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::operator== ( const type other) const
inline

Definition at line 85 of file endorsement.hpp.

85{ return id == other.id; }

◆ toPrettyString()

template<class EndorsedHash , class ContainingHash , class Container >
std::string altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::toPrettyString ( size_t  level = 0) const
inline

Definition at line 99 of file endorsement.hpp.

99 {
100 return format(
101 "{}{}Endorsement{{id={}, containing={}, endorsed={}, blockOfProof={}}}",
102 std::string(level, ' '),
103 type::name(),
104 HexStr(id),
105 HexStr(containingHash),
106 HexStr(endorsedHash),
107 HexStr(blockOfProof));
108 }
std::string HexStr(const T itbegin, const T itend)
Convert bytes to hex.
Definition: strutil.hpp:44

◆ toVbkEncoding() [1/2]

template<class EndorsedHash , class ContainingHash , class Container >
std::vector< uint8_t > altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::toVbkEncoding ( ) const
inline

Definition at line 57 of file endorsement.hpp.

57 {
58 WriteStream stream;
59 toVbkEncoding(stream);
60 return stream.data();
61 }

◆ toVbkEncoding() [2/2]

template<class EndorsedHash , class ContainingHash , class Container >
void altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::toVbkEncoding ( WriteStream stream) const
inline

Definition at line 50 of file endorsement.hpp.

50 {
51 writeSingleByteLenValue(stream, id);
52 writeSingleByteLenValue(stream, endorsedHash);
53 writeSingleByteLenValue(stream, containingHash);
54 writeSingleByteLenValue(stream, blockOfProof);
55 }
void writeSingleByteLenValue(WriteStream &stream, Slice< const uint8_t > value)
Write single byte length value, which consists of N bytes vector Appends 1 byte data length to the st...

Friends And Related Function Documentation

◆ operator<

template<class EndorsedHash , class ContainingHash , class Container >
bool operator< ( const type a,
const type b 
)
friend

Definition at line 87 of file endorsement.hpp.

87 {
88 if (a.id < b.id) return true;
89 if (a.id > b.id) return false;
90 if (a.endorsedHash < b.endorsedHash) return true;
91 if (a.endorsedHash > b.endorsedHash) return false;
92 if (a.containingHash < b.containingHash) return true;
93 if (a.containingHash > b.containingHash) return false;
94 return a.blockOfProof < b.blockOfProof;
95 }

Member Data Documentation

◆ blockOfProof

template<class EndorsedHash , class ContainingHash , class Container >
ContainingHash altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::blockOfProof

Definition at line 48 of file endorsement.hpp.

◆ containingHash

template<class EndorsedHash , class ContainingHash , class Container >
EndorsedHash altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::containingHash

Definition at line 47 of file endorsement.hpp.

◆ endorsedHash

template<class EndorsedHash , class ContainingHash , class Container >
EndorsedHash altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::endorsedHash

Definition at line 46 of file endorsement.hpp.

◆ id

template<class EndorsedHash , class ContainingHash , class Container >
id_t altintegration::Endorsement< EndorsedHash, ContainingHash, Container >::id

Definition at line 45 of file endorsement.hpp.


The documentation for this struct was generated from the following file: