[][src]Module grin_core::global

Values that should be shared across all modules, without necessarily having to pass them all over the place, but aren't consensus values. should be used sparingly.

Structs

GLOBAL_CHAIN_TYPE

Global chain_type that must be initialized once on node startup. This is accessed via get_chain_type() which allows the global value to be overridden on a per-thread basis (for testing).

GLOBAL_NRD_FEATURE_ENABLED

Global feature flag for NRD kernel support. If enabled NRD kernels are treated as valid after HF3 (based on header version). If disabled NRD kernels are invalid regardless of header version or block height.

Enums

ChainTypes

Types of chain a server can run with, dictates the genesis block and and mining parameters used.

Constants

AUTOMATED_TESTING_COINBASE_MATURITY

Automated testing coinbase maturity

AUTOMATED_TESTING_CUT_THROUGH_HORIZON

Testing cut through horizon in blocks

AUTOMATED_TESTING_MIN_EDGE_BITS

Automated testing edge_bits

AUTOMATED_TESTING_PROOF_SIZE

Automated testing proof size

CHAIN_TYPE

Mainnet|Floonet|UserTesting|AutomatedTesting

COMPACTION_CHECK

Trigger compaction check on average every day for all nodes. Randomized per node - roll the dice on every block to decide. Will compact the txhashset to remove pruned data. Will also remove old blocks and associated data from the database. For a node configured as "archival_mode = true" only the txhashset will be compacted.

NRD_FEATURE_ENABLED

Local feature flag for NRD kernel support.

PEER_EXPIRATION_REMOVE_TIME

Constant that expresses defunct peer timeout in seconds to be used in checks.

PROTOCOL_VERSION

An enum collecting sets of parameters used throughout the code wherever mining is needed. This should allow for different sets of parameters for different purposes, e.g. CI, User testing, production values Define these here, as they should be developer-set, not really tweakable by users The default "local" protocol version for this node. We negotiate compatible versions with each peer via Hand/Shake. Note: We also use a specific (possible different) protocol version for both the backend database and MMR data files. This defines the p2p layer protocol version for this node.

STUCK_PEER_KICK_TIME

If a peer's last updated difficulty is 2 hours ago and its difficulty's lower than ours, we're sure this peer is a stuck node, and we will kick out such kind of stuck peers.

TESTING_INITIAL_DIFFICULTY

Testing initial block difficulty

TESTING_INITIAL_GRAPH_WEIGHT

Testing initial graph weight

TESTING_MAX_BLOCK_WEIGHT

Testing max_block_weight (artifically low, just enough to support a few txs).

TESTING_STATE_SYNC_THRESHOLD

Testing state sync threshold in blocks

TESTING_TXHASHSET_ARCHIVE_INTERVAL

Number of blocks to reuse a txhashset zip for (automated testing and user testing).

TXHASHSET_ARCHIVE_INTERVAL

Number of blocks to reuse a txhashset zip for.

USER_TESTING_COINBASE_MATURITY

User testing coinbase maturity

USER_TESTING_CUT_THROUGH_HORIZON

Testing cut through horizon in blocks

USER_TESTING_MIN_EDGE_BITS

User testing edge_bits

USER_TESTING_PROOF_SIZE

User testing proof size

Functions

base_edge_bits

Reference edge_bits used to compute factor on higher Cuck(at)oo graph sizes, while the min_edge_bits can be changed on a soft fork, changing base_edge_bits is a hard fork.

coinbase_maturity

Coinbase maturity for coinbases to be spent

create_pow_context

Return either a cuckoo context or a cuckatoo context Single change point

cut_through_horizon

Horizon at which we can cut-through and do full local pruning

difficulty_data_to_vector

Converts an iterator of block difficulty data to more a more manageable vector and pads if needed (which will) only be needed for the first few blocks after genesis

get_chain_type

Get the chain type via thread_local, fallback to global chain_type.

init_global_chain_type

One time initialization of the global chain_type. Will panic if we attempt to re-initialize this (via OneTime).

init_global_nrd_enabled

One time initialization of the global chain_type. Will panic if we attempt to re-initialize this (via OneTime).

initial_block_difficulty

Initial mining difficulty

initial_graph_weight

Initial mining secondary scale

is_floonet

Are we in floonet? Note: We do not have a corresponding is_mainnet() as we want any tests to be as close as possible to "mainnet" configuration as possible. We want to avoid missing any mainnet only code paths.

is_nrd_enabled

Is the NRD feature flag enabled? Look at thread local config first. If not set fallback to global config. Default to false if global config unset.

is_production_mode

Are we in production mode? Production defined as a live public network, testnet[n] or mainnet.

max_block_weight

Maximum allowed block weight.

max_tx_weight

Maximum allowed transaction weight (1 weight unit ~= 32 bytes)

min_edge_bits

The minimum acceptable edge_bits

proofsize

The proofsize

set_local_chain_type

Set the chain type on a per-thread basis via thread_local storage.

set_local_nrd_enabled

Explicitly enable the NRD global feature flag.

state_sync_threshold

Threshold at which we can request a txhashset (and full blocks from)

txhashset_archive_interval

Number of blocks to reuse a txhashset zip for.