Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
avalanche Namespace Reference

Classes

class  CompactProofs
 
struct  Config
 
struct  ConflictingProofComparator
 Compare conflicting proofs. More...
 
class  Delegation
 
class  DelegationBuilder
 
struct  DelegationId
 
class  DelegationState
 
class  Hello
 
struct  LimitedProofId
 
struct  ManualWinners
 
struct  next_request_time
 
struct  Node
 
struct  Peer
 
class  PeerManager
 
struct  PendingNode
 
class  Poll
 
struct  PrefilledProof
 
class  Processor
 
class  Proof
 
struct  proof_index
 
class  ProofBuilder
 
struct  ProofComparatorByScore
 Compare proofs by score, then by id in case of equality. More...
 
struct  ProofId
 
class  ProofPool
 Map a proof to each utxo. More...
 
struct  ProofPoolEntry
 
struct  ProofPoolEntryProofIdKeyExtractor
 
struct  ProofRadixTreeAdapter
 Radix tree adapter for storing a proof as a tree element. More...
 
struct  ProofRefComparatorByAddress
 Compare proof references by pointer address. More...
 
struct  ProofRefCompare
 
class  ProofRegistrationState
 
class  ProofsRequest
 
class  ProofValidationState
 
struct  query_timeout
 
struct  RemoteProof
 
class  Response
 
class  SaltedProofHasher
 
class  SaltedProofIdHasher
 
struct  score_index
 
struct  ShortIdProcessorPrefilledProofAdapter
 
class  SignedStake
 
struct  Slot
 
class  Stake
 
struct  StakeCommitment
 
class  StakeContenderCache
 Cache to track stake contenders for recent blocks. More...
 
struct  StakeContenderCacheEntry
 
struct  StakeContenderId
 StakeContenderIds are unique for each block to ensure that the peer polling for their acceptance has strong guarantees that a newly finalizing block does not disrupt determining if the previous block had valid stake winners. More...
 
struct  stakecontenderid_index
 
struct  TestProofBuilder
 
struct  TestVoteRecord
 
class  Vote
 
class  VoteItemUpdate
 
struct  VoteMapComparator
 
struct  VoteRecord
 Vote history. More...
 

Typedefs

using ProofShortIdProcessor = ShortIdProcessor< PrefilledProof, ShortIdProcessorPrefilledProofAdapter, ProofRefCompare >
 
using AnyVoteItem = std::variant< const ProofRef, const CBlockIndex *, const CTransactionRef >
 
using VoteMap = std::map< AnyVoteItem, VoteRecord, VoteMapComparator >
 
using StakeId = uint256
 
using ProofRef = RCUPtr< const Proof >
 
using ProofIdSet = std::unordered_set< ProofId, SaltedProofIdHasher >
 

Enumerations

enum class  ProofRegistrationResult {
  NONE = 0 , ALREADY_REGISTERED , IMMATURE , INVALID ,
  CONFLICTING , REJECTED , COOLDOWN_NOT_ELAPSED , DANGLING ,
  MISSING_UTXO
}
 
enum struct  VoteStatus : uint8_t {
  Invalid , Rejected , Accepted , Finalized ,
  Stale
}
 
enum  StakeContenderStatus : uint8_t { UNKNOWN = 0 , ACCEPTED = (1 << 0) , IN_WINNER_SET = (1 << 1) }
 
enum class  ProofValidationResult {
  NONE = 0 , NO_STAKE , DUST_THRESHOLD , DUPLICATE_STAKE ,
  WRONG_STAKE_ORDERING , INVALID_STAKE_SIGNATURE , TOO_MANY_UTXOS , INVALID_PAYOUT_SCRIPT ,
  INVALID_PROOF_SIGNATURE , EXPIRED , MISSING_UTXO , COINBASE_MISMATCH ,
  HEIGHT_MISMATCH , AMOUNT_MISMATCH , NON_STANDARD_DESTINATION , DESTINATION_NOT_SUPPORTED ,
  DESTINATION_MISMATCH , IMMATURE_UTXO
}
 
enum class  DelegationResult { NONE = 0 , INVALID_SIGNATURE , TOO_MANY_LEVELS }
 

Functions

template<typename L , typename F >
static bool reduceLevels (uint256 &hash, const std::vector< L > &levels, F f)
 
template<typename L >
static bool reduceLevels (uint256 &hash, const std::vector< L > &levels)
 
static bool isImmatureState (const ProofValidationState &state)
 
PeerId selectPeerImpl (const std::vector< Slot > &slots, const uint64_t slot, const uint64_t max)
 Internal methods that are exposed for testing purposes.
 
static const uint256 GetVoteItemId (const AnyVoteItem &item)
 
static bool VerifyProof (const Amount &stakeUtxoDustThreshold, const Proof &proof, bilingual_str &error)
 
static bool VerifyDelegation (const Delegation &dg, const CPubKey &expectedPubKey, bilingual_str &error)
 
static bool isNull (const AnyVoteItem &item)
 
static bool IsStandardPayoutScript (const CScript &scriptPubKey)
 
ProofRef buildRandomProof (Chainstate &active_chainstate, uint32_t score, int height, const CKey &masterKey)
 
bool hasDustStake (const ProofRef &proof)
 

Variables

constexpr size_t MAX_DELEGATION_LEVELS {20}
 The maximum number of delegation levels we are willing to verify.
 
static constexpr uint64_t PEERS_DUMP_VERSION {1}
 
static constexpr uint32_t AVALANCHE_MAX_IMMATURE_PROOFS = 4000
 Maximum number of immature proofs the peer manager will accept from the network.
 
static constexpr Amount PROOF_DUST_THRESHOLD = 100 * COIN
 Minimum amount per utxo.
 
constexpr uint32_t MIN_VALID_PROOF_SCORE = 100 * PROOF_DUST_THRESHOLD / COIN
 
const CScript UNSPENDABLE_ECREG_PAYOUT_SCRIPT
 

Typedef Documentation

◆ AnyVoteItem

Definition at line 87 of file processor.h.

◆ ProofIdSet

Definition at line 52 of file proofpool.h.

◆ ProofRef

Definition at line 185 of file proof.h.

◆ ProofShortIdProcessor

Definition at line 50 of file compactproofs.h.

◆ StakeId

Definition at line 44 of file proof.h.

◆ VoteMap

Definition at line 139 of file processor.h.

Enumeration Type Documentation

◆ DelegationResult

Enumerator
NONE 
INVALID_SIGNATURE 
TOO_MANY_LEVELS 

Definition at line 37 of file validation.h.

◆ ProofRegistrationResult

Enumerator
NONE 
ALREADY_REGISTERED 
IMMATURE 
INVALID 
CONFLICTING 
REJECTED 
COOLDOWN_NOT_ELAPSED 
DANGLING 
MISSING_UTXO 

Definition at line 145 of file peermanager.h.

◆ ProofValidationResult

Enumerator
NONE 
NO_STAKE 
DUST_THRESHOLD 
DUPLICATE_STAKE 
WRONG_STAKE_ORDERING 
INVALID_STAKE_SIGNATURE 
TOO_MANY_UTXOS 
INVALID_PAYOUT_SCRIPT 
INVALID_PROOF_SIGNATURE 
EXPIRED 
MISSING_UTXO 
COINBASE_MISMATCH 
HEIGHT_MISMATCH 
AMOUNT_MISMATCH 
NON_STANDARD_DESTINATION 
DESTINATION_NOT_SUPPORTED 
DESTINATION_MISMATCH 
IMMATURE_UTXO 

Definition at line 12 of file validation.h.

◆ StakeContenderStatus

Enumerator
UNKNOWN 
ACCEPTED 
IN_WINNER_SET 

Definition at line 25 of file stakecontendercache.h.

◆ VoteStatus

Enumerator
Invalid 
Rejected 
Accepted 
Finalized 
Stale 

Definition at line 79 of file processor.h.

Function Documentation

◆ buildRandomProof()

ProofRef avalanche::buildRandomProof ( Chainstate active_chainstate,
uint32_t  score,
int  height,
const CKey masterKey 
)

Definition at line 20 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVoteItemId()

static const uint256 avalanche::GetVoteItemId ( const AnyVoteItem item)
static

Definition at line 39 of file processor.cpp.

Here is the caller graph for this function:

◆ hasDustStake()

bool avalanche::hasDustStake ( const ProofRef proof)

Definition at line 41 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isImmatureState()

static bool avalanche::isImmatureState ( const ProofValidationState state)
static

Definition at line 202 of file peermanager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isNull()

static bool avalanche::isNull ( const AnyVoteItem item)
static

Definition at line 412 of file processor.cpp.

Here is the caller graph for this function:

◆ IsStandardPayoutScript()

static bool avalanche::IsStandardPayoutScript ( const CScript scriptPubKey)
static

Definition at line 111 of file proof.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduceLevels() [1/2]

template<typename L >
static bool avalanche::reduceLevels ( uint256 hash,
const std::vector< L > &  levels 
)
static

Definition at line 52 of file delegation.cpp.

Here is the call graph for this function:

◆ reduceLevels() [2/2]

template<typename L , typename F >
static bool avalanche::reduceLevels ( uint256 hash,
const std::vector< L > &  levels,
F  f 
)
static

Definition at line 36 of file delegation.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectPeerImpl()

PeerId avalanche::selectPeerImpl ( const std::vector< Slot > &  slots,
const uint64_t  slot,
const uint64_t  max 
)

Internal methods that are exposed for testing purposes.

Definition at line 927 of file peermanager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyDelegation()

static bool avalanche::VerifyDelegation ( const Delegation dg,
const CPubKey expectedPubKey,
bilingual_str error 
)
static

Definition at line 89 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyProof()

static bool avalanche::VerifyProof ( const Amount stakeUtxoDustThreshold,
const Proof proof,
bilingual_str error 
)
static

Definition at line 57 of file processor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ AVALANCHE_MAX_IMMATURE_PROOFS

constexpr uint32_t avalanche::AVALANCHE_MAX_IMMATURE_PROOFS = 4000
staticconstexpr

Maximum number of immature proofs the peer manager will accept from the network.

Note that reorgs can cause the immature pool to temporarily exceed this limit, but a change in chaintip cause previously reorged proofs to be trimmed.

Definition at line 44 of file peermanager.h.

◆ MAX_DELEGATION_LEVELS

constexpr size_t avalanche::MAX_DELEGATION_LEVELS {20}
constexpr

The maximum number of delegation levels we are willing to verify.

A Schnorr signature verification takes about 35us on a 2022 average machine, so 20 levels will roughly take under 1ms (accounting some overhead) while being more than enough to cover all the real world usage.

Definition at line 26 of file delegation.h.

◆ MIN_VALID_PROOF_SCORE

constexpr uint32_t avalanche::MIN_VALID_PROOF_SCORE = 100 * PROOF_DUST_THRESHOLD / COIN
constexpr

Definition at line 17 of file util.h.

◆ PEERS_DUMP_VERSION

constexpr uint64_t avalanche::PEERS_DUMP_VERSION {1}
staticconstexpr

Definition at line 29 of file peermanager.cpp.

◆ PROOF_DUST_THRESHOLD

constexpr Amount avalanche::PROOF_DUST_THRESHOLD = 100 * COIN
staticconstexpr

Minimum amount per utxo.

Definition at line 40 of file proof.h.

◆ UNSPENDABLE_ECREG_PAYOUT_SCRIPT

const CScript avalanche::UNSPENDABLE_ECREG_PAYOUT_SCRIPT
Initial value:
=
Serialized script, used inside transaction inputs and outputs.
Definition script.h:424
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
@ OP_CHECKSIG
Definition script.h:163
@ OP_EQUALVERIFY
Definition script.h:120

Definition at line 19 of file util.h.