Electroneum
Loading...
Searching...
No Matches
tools::hashchain Class Reference

#include <wallet2.h>

Public Member Functions

 hashchain ()
size_t size () const
size_t offset () const
const crypto::hashgenesis () const
void push_back (const crypto::hash &hash)
bool is_in_bounds (size_t idx) const
const crypto::hashoperator[] (size_t idx) const
crypto::hashoperator[] (size_t idx)
void crop (size_t height)
void clear ()
bool empty () const
void trim (size_t height)
void refill (const crypto::hash &hash)
template<class t_archive>
void serialize (t_archive &a, const unsigned int ver)

Detailed Description

Definition at line 176 of file wallet2.h.

Constructor & Destructor Documentation

◆ hashchain()

tools::hashchain::hashchain ( )
inline

Definition at line 179 of file wallet2.h.

179: m_genesis(crypto::null_hash), m_offset(0) {}

Member Function Documentation

◆ clear()

void tools::hashchain::clear ( )
inline

Definition at line 189 of file wallet2.h.

189{ m_offset = 0; m_blockchain.clear(); }
Here is the caller graph for this function:

◆ crop()

void tools::hashchain::crop ( size_t height)
inline

Definition at line 188 of file wallet2.h.

188{ m_blockchain.resize(height - m_offset); }
uint64_t height
Here is the caller graph for this function:

◆ empty()

bool tools::hashchain::empty ( ) const
inline

Definition at line 190 of file wallet2.h.

190{ return m_blockchain.empty() && m_offset == 0; }
Here is the caller graph for this function:

◆ genesis()

const crypto::hash & tools::hashchain::genesis ( ) const
inline

Definition at line 183 of file wallet2.h.

183{ return m_genesis; }
Here is the caller graph for this function:

◆ is_in_bounds()

bool tools::hashchain::is_in_bounds ( size_t idx) const
inline

Definition at line 185 of file wallet2.h.

185{ return idx >= m_offset && idx < size(); }
size_t size() const
Definition wallet2.h:181
Here is the call graph for this function:

◆ offset()

size_t tools::hashchain::offset ( ) const
inline

Definition at line 182 of file wallet2.h.

182{ return m_offset; }
Here is the caller graph for this function:

◆ operator[]() [1/2]

crypto::hash & tools::hashchain::operator[] ( size_t idx)
inline

Definition at line 187 of file wallet2.h.

187{ return m_blockchain[idx - m_offset]; }

◆ operator[]() [2/2]

const crypto::hash & tools::hashchain::operator[] ( size_t idx) const
inline

Definition at line 186 of file wallet2.h.

186{ return m_blockchain[idx - m_offset]; }

◆ push_back()

void tools::hashchain::push_back ( const crypto::hash & hash)
inline

Definition at line 184 of file wallet2.h.

184{ if (m_offset == 0 && m_blockchain.empty()) m_genesis = hash; m_blockchain.push_back(hash); }
POD_CLASS hash
Definition hash.h:50
Here is the caller graph for this function:

◆ refill()

void tools::hashchain::refill ( const crypto::hash & hash)
inline

Definition at line 192 of file wallet2.h.

192{ m_blockchain.push_back(hash); --m_offset; }

◆ serialize()

template<class t_archive>
void tools::hashchain::serialize ( t_archive & a,
const unsigned int ver )
inline

Definition at line 195 of file wallet2.h.

196 {
197 a & m_offset;
198 a & m_genesis;
199 a & m_blockchain;
200 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124

◆ size()

size_t tools::hashchain::size ( ) const
inline

Definition at line 181 of file wallet2.h.

181{ return m_blockchain.size() + m_offset; }
Here is the caller graph for this function:

◆ trim()

void tools::hashchain::trim ( size_t height)
inline

Definition at line 191 of file wallet2.h.

191{ while (height > m_offset && m_blockchain.size() > 1) { m_blockchain.pop_front(); ++m_offset; } m_blockchain.shrink_to_fit(); }
Here is the caller graph for this function:

The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/wallet/wallet2.h