Skip to content

src/primitives/transaction_validity.cpp

Functions

Name
OUTCOME_CPP_DEFINE_CATEGORY_3(sgns::primitives , InvalidTransaction , e )
OUTCOME_CPP_DEFINE_CATEGORY_3(sgns::primitives , UnknownTransaction , e )

Functions Documentation

function OUTCOME_CPP_DEFINE_CATEGORY_3

OUTCOME_CPP_DEFINE_CATEGORY_3(
    sgns::primitives ,
    InvalidTransaction ,
    e 
)

function OUTCOME_CPP_DEFINE_CATEGORY_3

OUTCOME_CPP_DEFINE_CATEGORY_3(
    sgns::primitives ,
    UnknownTransaction ,
    e 
)

Source code

#include "primitives/transaction_validity.hpp"

OUTCOME_CPP_DEFINE_CATEGORY_3(sgns::primitives, InvalidTransaction, e) {
  using E = sgns::primitives::InvalidTransaction;
  switch (e) {
    case E::Call:
      return "The call of the transaction is not expected";
    case E::Payment:
      return "General error to do with the inability to pay some fees (e.g. "
             "account balance too low)";
    case E::Future:
      return "General error to do with the transaction not yet being valid "
             "(e.g. nonce too high)";
    case E::Stale:
      return "General error to do with the transaction being outdated (e.g. "
             "nonce too low)";
    case E::BadProof:
      return "General error to do with the transaction's proofs (e.g. "
             "signature)";
    case E::AncientBirthBlock:
      return "The transaction birth block is ancient";
    case E::ExhaustsResources:
      return "The transaction would exhaust the resources of current block. "
             "The transaction might be valid, but there are not enough "
             "resources left in the current block";
    case E::Custom:
      return "Custom invalid error";
  }
}

OUTCOME_CPP_DEFINE_CATEGORY_3(sgns::primitives, UnknownTransaction, e) {
  using E = sgns::primitives::UnknownTransaction;
  switch (e) {
    case E::CannotLookup:
      return "Could not lookup some information that is required to validate "
             "the transaction";
    case E::NoUnsignedValidator:
      return "No validator found for the given unsigned transaction";
    case E::Custom:
      return "Custom unknown error";
  }
}

Updated on 2026-03-04 at 13:10:44 -0800