veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::ValidationState Class Reference

Class that is used for storing validation state. More...

Detailed Description

ValidationState can be in 3 states:

  • valid (when default initialized)
  • invalid - validation failed. Example: invalid signature in transaction.

Definition at line 28 of file validation_state.hpp.

#include <validation_state.hpp>

+ Collaboration diagram for altintegration::ValidationState:

Public Member Functions

std::string toString () const
 
void reset ()
 
bool Invalid (const std::string &reject_reason, const std::string &debug_message="")
 
bool Invalid (const std::string &reject_reason, const std::string &debug_message, size_t index)
 Changes this ValidationState into "INVALID" mode. More...
 
bool Invalid (const std::string &reject_reason, size_t index)
 
bool IsValid () const
 
bool IsInvalid () const
 
std::string GetDebugMessage () const
 
std::vector< std::string > GetPathParts () const
 
std::string GetPath () const
 

Constructor & Destructor Documentation

◆ ValidationState()

altintegration::ValidationState::ValidationState ( )
inline

Definition at line 30 of file validation_state.hpp.

30: m_mode(MODE_VALID) {}

Member Function Documentation

◆ GetDebugMessage()

std::string altintegration::ValidationState::GetDebugMessage ( ) const
inline

Definition at line 65 of file validation_state.hpp.

65{ return m_debug_message; }

◆ Invalid() [1/2]

bool altintegration::ValidationState::Invalid ( const std::string &  reject_reason,
const std::string &  debug_message,
size_t  index 
)
inline
Parameters
reject_reason- supply a short, unique message that identifies this class of validation. Example: mandatory-script-verify-flag-failed
debug_message- supply arbitrary message that will help to debug the error.
indexindex in for loop
Returns
always returns false

Definition at line 52 of file validation_state.hpp.

54 {
55 stack_trace.push_back(std::to_string(index));
56 return Invalid(reject_reason, debug_message);
57 }

◆ Invalid() [2/2]

bool altintegration::ValidationState::Invalid ( const std::string &  reject_reason,
size_t  index 
)
inline

Definition at line 59 of file validation_state.hpp.

59 {
60 return Invalid(reject_reason, "", index);
61 }

◆ IsInvalid()

bool altintegration::ValidationState::IsInvalid ( ) const
inline

Definition at line 64 of file validation_state.hpp.

64{ return m_mode == MODE_INVALID; }

◆ IsValid()

bool altintegration::ValidationState::IsValid ( ) const
inline

Definition at line 63 of file validation_state.hpp.

63{ return m_mode == MODE_VALID; }

◆ reset()

void altintegration::ValidationState::reset ( )
inline

Definition at line 34 of file validation_state.hpp.

34 {
35 stack_trace.clear();
36 m_debug_message.clear();
37 m_mode = MODE_VALID;
38 }

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