utils

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2025 License: GPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ****************************************
	// **                                    **
	// **         GLOBAL FLAGS               **
	// **                                    **
	// ****************************************
	ConfigDirFlag = Flag{
		Name:         c_GlobalFlagPrefix + "config-dir",
		Abbreviation: "c",
		Value:        xdg.ConfigHome + "/" + constants.APP_NAME + "/",
		Usage:        "config directory" + generateEnvDoc(c_GlobalFlagPrefix+"config-dir"),
	}

	DataDirFlag = Flag{
		Name:         c_GlobalFlagPrefix + "data-dir",
		Abbreviation: "d",
		Value:        filepath.Join(xdg.DataHome, constants.APP_NAME),
		Usage:        "data directory" + generateEnvDoc(c_GlobalFlagPrefix+"data-dir"),
	}

	InitConfigFlag = Flag{
		Name:  c_GlobalFlagPrefix + "init-cfg",
		Value: false,
		Usage: "initialize a new config file, if one does not already exist",
	}

	AncientDirFlag = Flag{
		Name:  c_GlobalFlagPrefix + "datadir-ancient",
		Value: "",
		Usage: "Data directory for ancient chain segments (default = inside chaindata)" + generateEnvDoc(c_GlobalFlagPrefix+"datadir-ancient"),
	}

	LogLevelFlag = Flag{
		Name:         c_GlobalFlagPrefix + "log-level",
		Abbreviation: "l",
		Value:        "info",
		Usage:        "log level (trace, debug, info, warn, error, fatal, panic)" + generateEnvDoc(c_GlobalFlagPrefix+"log-level"),
	}

	LogSizeFlag = Flag{
		Name:  c_GlobalFlagPrefix + "log-size",
		Value: 500,
		Usage: "maximum log file size in MB before rolling (default = no limit)" + generateEnvDoc(c_GlobalFlagPrefix+"log-size"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// **         NODE FLAGS                 **
	// **                                    **
	// ****************************************
	IPAddrFlag = Flag{
		Name:         c_NodeFlagPrefix + "ipaddr",
		Abbreviation: "i",
		Value:        "0.0.0.0",
		Usage:        "ip address to listen on" + generateEnvDoc(c_NodeFlagPrefix+"ipaddr"),
	}

	P2PPortFlag = Flag{
		Name:         c_NodeFlagPrefix + "port",
		Abbreviation: "p",
		Value:        "4002",
		Usage:        "p2p port to listen on" + generateEnvDoc(c_NodeFlagPrefix+"port"),
	}

	BootPeersFlag = Flag{
		Name:  c_NodeFlagPrefix + "bootpeers",
		Value: []string{},
		Usage: "list of bootstrap peers. Syntax: <multiaddress1>,<multiaddress2>,..." + generateEnvDoc(c_NodeFlagPrefix+"bootpeers"),
	}

	PortMapFlag = Flag{
		Name:  c_NodeFlagPrefix + "portmap",
		Value: true,
		Usage: "enable NAT portmap" + generateEnvDoc(c_NodeFlagPrefix+"portmap"),
	}

	KeyFileFlag = Flag{
		Name:         c_NodeFlagPrefix + "private-key",
		Abbreviation: "k",
		Value:        "",
		Usage:        "file containing node private key" + generateEnvDoc(c_NodeFlagPrefix+"private-key"),
	}

	MinPeersFlag = Flag{
		Name:  c_NodeFlagPrefix + "min-peers",
		Value: "5",
		Usage: "minimum number of peers to maintain connectivity with" + generateEnvDoc(c_NodeFlagPrefix+"min-peers"),
	}

	MaxPeersFlag = Flag{
		Name:  c_NodeFlagPrefix + "max-peers",
		Value: "50",
		Usage: "maximum number of peers to maintain connectivity with" + generateEnvDoc(c_NodeFlagPrefix+"max-peers"),
	}

	LocationFlag = Flag{
		Name:  c_NodeFlagPrefix + "location",
		Value: "",
		Usage: "region and zone location" + generateEnvDoc(c_NodeFlagPrefix+"location"),
	}

	SoloFlag = Flag{
		Name:         c_NodeFlagPrefix + "solo",
		Abbreviation: "s",
		Value:        false,
		Usage:        "start the node as a solo node (will not reach out to bootstrap peers)" + generateEnvDoc(c_NodeFlagPrefix+"solo"),
	}

	DBEngineFlag = Flag{
		Name:  c_NodeFlagPrefix + "db-engine",
		Value: "leveldb",
		Usage: "Backing database implementation to use ('leveldb' or 'pebble')" + generateEnvDoc(c_NodeFlagPrefix+"db-engine"),
	}

	NetworkIdFlag = Flag{
		Name:  c_NodeFlagPrefix + "networkid",
		Value: 1,
		Usage: "Explicitly set network id (integer)(For testnets: use --garden)" + generateEnvDoc(c_NodeFlagPrefix+"networkid"),
	}

	SlicesRunningFlag = Flag{
		Name:  c_NodeFlagPrefix + "slices",
		Value: "[0 0]",
		Usage: "All the slices that are running on this node" + generateEnvDoc(c_NodeFlagPrefix+"slices"),
	}

	DevPeriodFlag = Flag{
		Name:  c_NodeFlagPrefix + "dev-period",
		Value: 0,
		Usage: "Block period to use for the dev network (integer) (0 = mine only if transaction pending)" + generateEnvDoc(c_NodeFlagPrefix+"dev-period"),
	}

	IdentityFlag = Flag{
		Name:  c_NodeFlagPrefix + "identity",
		Value: "",
		Usage: "Custom node name" + generateEnvDoc(c_NodeFlagPrefix+"identity"),
	}

	DocRootFlag = Flag{
		Name:  c_NodeFlagPrefix + "docroot",
		Value: xdg.DataHome,
		Usage: "Document Root for HTTPClient file scheme" + generateEnvDoc(c_NodeFlagPrefix+"docroot"),
	}

	SnapshotFlag = Flag{
		Name:  c_NodeFlagPrefix + "snapshot",
		Value: true,
		Usage: `Enables snapshot-database mode (default = true)` + generateEnvDoc(c_NodeFlagPrefix+"snapshot"),
	}

	TxLookupLimitFlag = Flag{
		Name:  c_NodeFlagPrefix + "txlookuplimit",
		Value: quaiconfig.Defaults.TxLookupLimit,
		Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)" + generateEnvDoc(c_NodeFlagPrefix+"txlookuplimit"),
	}

	WhitelistFlag = Flag{
		Name:  c_NodeFlagPrefix + "whitelist",
		Value: "",
		Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)" + generateEnvDoc(c_NodeFlagPrefix+"whitelist"),
	}

	BloomFilterSizeFlag = Flag{
		Name:  c_NodeFlagPrefix + "bloomfilter-size",
		Value: 2048,
		Usage: "Megabytes of memory allocated to bloom-filter for pruning" + generateEnvDoc(c_NodeFlagPrefix+"bloomfilter-size"),
	}

	TxPoolLocalsFlag = Flag{
		Name:  c_TXPoolPrefix + "locals",
		Value: "",
		Usage: "Comma separated accounts to treat as locals (no flush, priority inclusion)" + generateEnvDoc(c_TXPoolPrefix+"locals"),
	}

	TxPoolNoLocalsFlag = Flag{
		Name:  c_TXPoolPrefix + "nolocals",
		Value: false,
		Usage: "Disables price exemptions for locally submitted transactions" + generateEnvDoc(c_TXPoolPrefix+"nolocals"),
	}

	TxPoolSyncTxWithReturnFlag = Flag{
		Name:  c_TXPoolPrefix + "sync-tx-with-return",
		Value: true,
		Usage: "Shares the tx with the sharing client with syncronous return (also bypasses local pool, only use it with combination of sharing clients)" + generateEnvDoc(c_TXPoolPrefix+"sync-tx-with-return"),
	}

	TxPoolJournalFlag = Flag{
		Name:  c_TXPoolPrefix + "journal",
		Value: core.DefaultTxPoolConfig.Journal,
		Usage: "Disk journal for local transaction to survive node restarts" + generateEnvDoc(c_TXPoolPrefix+"journal"),
	}

	TxPoolRejournalFlag = Flag{
		Name:  c_TXPoolPrefix + "rejournal",
		Value: core.DefaultTxPoolConfig.Rejournal,
		Usage: "Time interval to regenerate the local transaction journal" + generateEnvDoc(c_TXPoolPrefix+"rejournal"),
	}

	TxPoolPriceLimitFlag = Flag{
		Name:  c_TXPoolPrefix + "pricelimit",
		Value: quaiconfig.Defaults.TxPool.PriceLimit,
		Usage: "Minimum gas price limit to enforce for acceptance into the pool" + generateEnvDoc(c_TXPoolPrefix+"pricelimit"),
	}

	TxPoolPriceBumpFlag = Flag{
		Name:  c_TXPoolPrefix + "pricebump",
		Value: quaiconfig.Defaults.TxPool.PriceBump,
		Usage: "Price bump percentage to replace an already existing transaction" + generateEnvDoc(c_TXPoolPrefix+"pricebump"),
	}

	TxPoolAccountSlotsFlag = Flag{
		Name:  c_TXPoolPrefix + "accountslots",
		Value: quaiconfig.Defaults.TxPool.AccountSlots,
		Usage: "Minimum number of executable transaction slots guaranteed per account" + generateEnvDoc(c_TXPoolPrefix+"accountslots"),
	}

	TxPoolGlobalSlotsFlag = Flag{
		Name:  c_TXPoolPrefix + "globalslots",
		Value: quaiconfig.Defaults.TxPool.GlobalSlots,
		Usage: "Maximum number of executable transaction slots for all accounts" + generateEnvDoc(c_TXPoolPrefix+"globalslots"),
	}

	TxPoolAccountQueueFlag = Flag{
		Name:  c_TXPoolPrefix + "accountqueue",
		Value: quaiconfig.Defaults.TxPool.AccountQueue,
		Usage: "Maximum number of non-executable transaction slots permitted per account" + generateEnvDoc(c_TXPoolPrefix+"accountqueue"),
	}

	TxPoolGlobalQueueFlag = Flag{
		Name:  c_TXPoolPrefix + "globalqueue",
		Value: quaiconfig.Defaults.TxPool.GlobalQueue,
		Usage: "Maximum number of non-executable transaction slots for all accounts" + generateEnvDoc(c_TXPoolPrefix+"globalqueue"),
	}

	TxPoolLifetimeFlag = Flag{
		Name:  c_TXPoolPrefix + "lifetime",
		Value: quaiconfig.Defaults.TxPool.Lifetime,
		Usage: "Maximum amount of time non-executable transaction are queued" + generateEnvDoc(c_TXPoolPrefix+"lifetime"),
	}

	TxPoolSharingClientsFlag = Flag{
		Name:  c_TXPoolPrefix + "sharing-clients",
		Value: "",
		Usage: "Comma separated list of clients end points that the node would directy share the transactions with" + generateEnvDoc(c_TXPoolPrefix+"sharing-clients"),
	}

	CacheFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache",
		Value: 1024,
		Usage: "Megabytes of memory allocated to internal caching (default = 4096 quai full node, 128 light mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache"),
	}

	CacheDatabaseFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-database",
		Value: 50,
		Usage: "Percentage of cache memory allowance to use for database io" + generateEnvDoc(c_NodeFlagPrefix+"cache-database"),
	}

	CacheTrieFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-trie",
		Value: 15,
		Usage: "Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache-trie"),
	}

	CacheTrieJournalFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-trie-journal",
		Value: quaiconfig.Defaults.TrieCleanCacheJournal,
		Usage: "Disk journal directory for trie cache to survive node restarts" + generateEnvDoc(c_NodeFlagPrefix+"cache-trie-journal"),
	}

	CacheTrieRejournalFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-trie-rejournal",
		Value: quaiconfig.Defaults.TrieCleanCacheRejournal,
		Usage: "Time interval to regenerate the trie cache journal" + generateEnvDoc(c_NodeFlagPrefix+"cache-trie-rejournal"),
	}

	CacheGCFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-gc",
		Value: 25,
		Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache-gc"),
	}

	CacheSnapshotFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-snapshot",
		Value: 10,
		Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)" + generateEnvDoc(c_NodeFlagPrefix+"cache-snapshot"),
	}

	CacheNoPrefetchFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-noprefetch",
		Value: false,
		Usage: "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)" + generateEnvDoc(c_NodeFlagPrefix+"cache-noprefetch"),
	}

	CachePreimagesFlag = Flag{
		Name:  c_NodeFlagPrefix + "cache-preimages",
		Value: false,
		Usage: "Enable recording the SHA3/keccak preimages of trie keys" + generateEnvDoc(c_NodeFlagPrefix+"cache-preimages"),
	}

	ConsensusEngineFlag = Flag{
		Name:  c_NodeFlagPrefix + "consensus-engine",
		Value: "progpow",
		Usage: "Consensus engine that the blockchain will run and verify blocks using" + generateEnvDoc(c_NodeFlagPrefix+"consensus-engine"),
	}

	MinerGasPriceFlag = Flag{
		Name:  c_NodeFlagPrefix + "miner-gasprice",
		Value: newBigIntValue(quaiconfig.Defaults.Miner.GasPrice),
		Usage: "Minimum gas price for mining a transaction" + generateEnvDoc(c_NodeFlagPrefix+"miner-gasprice"),
	}

	UnlockedAccountFlag = Flag{
		Name:  c_NodeFlagPrefix + "unlock",
		Value: "",
		Usage: "Comma separated list of accounts to unlock" + generateEnvDoc(c_NodeFlagPrefix+"unlock"),
	}

	PasswordFileFlag = Flag{
		Name:  c_NodeFlagPrefix + "password",
		Value: "",
		Usage: "Password file to use for non-interactive password input" + generateEnvDoc(c_NodeFlagPrefix+"password"),
	}

	KeyStoreDirFlag = Flag{
		Name:  c_NodeFlagPrefix + "keystore",
		Value: "",
		Usage: "Directory for the keystore (default = inside the datadir)",
	}

	VMEnableDebugFlag = Flag{
		Name:  c_NodeFlagPrefix + "vmdebug",
		Value: false,
		Usage: "Record information useful for VM and contract debugging" + generateEnvDoc(c_NodeFlagPrefix+"vmdebug"),
	}

	PprofFlag = Flag{
		Name:  c_NodeFlagPrefix + "pprof",
		Value: false,
		Usage: "Enable the pprof HTTP server",
	}

	InsecureUnlockAllowedFlag = Flag{
		Name:  c_NodeFlagPrefix + "allow-insecure-unlock",
		Value: false,
		Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http" + generateEnvDoc(c_NodeFlagPrefix+"allow-insecure-unlock"),
	}

	QuaiCoinbaseFlag = Flag{
		Name:  c_NodeFlagPrefix + "quai-coinbases",
		Value: "0x0000000000000000000000000000000000000001",
		Usage: "Input TOML string or path to TOML file" + generateEnvDoc(c_NodeFlagPrefix+"quai-coinbase"),
	}

	QiCoinbaseFlag = Flag{
		Name:  c_NodeFlagPrefix + "qi-coinbases",
		Value: "0x0080000000000000000000000000000000000001",
		Usage: "Input TOML string or path to TOML file" + generateEnvDoc(c_NodeFlagPrefix+"qi-coinbase"),
	}

	LockupContractAddressFlag = Flag{
		Name:  c_NodeFlagPrefix + "lockup-contract-address",
		Value: "",
		Usage: "Address of the lockup smart contract to send coinbase rewards to" + generateEnvDoc(c_NodeFlagPrefix+"lockup-contract-address"),
	}

	MinerPreferenceFlag = Flag{
		Name:  c_NodeFlagPrefix + "miner-preference",
		Value: 0.5,
		Usage: "Indicates preference towards mining Quai or Qi. Any value between 0 and 1 is valid. Neutral: 0.5, Quai only: 0, Qi only: 1" + generateEnvDoc(c_NodeFlagPrefix+"miner-preference"),
	}

	CoinbaseLockupFlag = Flag{
		Name:  c_NodeFlagPrefix + "coinbase-lockup",
		Value: 0,
		Usage: "Lockup byte used to determine the number of blocks that coinbase rewards are locked for" + generateEnvDoc(c_NodeFlagPrefix+"coinbase-lockup"),
	}

	IndexAddressUtxos = Flag{
		Name:  c_NodeFlagPrefix + "index-address-utxos",
		Value: false,
		Usage: "Index address utxos" + generateEnvDoc(c_NodeFlagPrefix+"index-address-utxos"),
	}

	ReIndex = Flag{
		Name:  c_NodeFlagPrefix + "reindex",
		Value: false,
		Usage: "Re-index the UTXO indexer. This will take a long time!" + generateEnvDoc(c_NodeFlagPrefix+"reindex"),
	}

	ValidateIndexer = Flag{
		Name:  c_NodeFlagPrefix + "validate-indexer",
		Value: false,
		Usage: "Validate the UTXO indexer. This will take a long time!" + generateEnvDoc(c_NodeFlagPrefix+"validate-index"),
	}

	EnvironmentFlag = Flag{
		Name:  c_NodeFlagPrefix + "environment",
		Value: params.ColosseumName,
		Usage: "environment to run in (local, colosseum, garden, orchard, lighthouse, dev)" + generateEnvDoc(c_NodeFlagPrefix+"environment"),
	}

	QuaiStatsURLFlag = Flag{
		Name:  c_NodeFlagPrefix + "quaistats",
		Value: "",
		Usage: "Reporting URL of a quaistats service (nodename:secret@host:port)" + generateEnvDoc(c_NodeFlagPrefix+"quaistats"),
	}

	SendFullStatsFlag = Flag{
		Name:  c_NodeFlagPrefix + "sendfullstats",
		Value: false,
		Usage: "Send full stats boolean flag for quaistats" + generateEnvDoc(c_NodeFlagPrefix+"sendfullstats"),
	}

	StartingExpansionNumberFlag = Flag{
		Name:  c_NodeFlagPrefix + "starting-expansion-num",
		Value: 0,
		Usage: "Start the node at the expansion number preferred" + generateEnvDoc(c_NodeFlagPrefix+"starting-expansion-num"),
	}

	NodeLogLevelFlag = Flag{
		Name:  c_NodeFlagPrefix + "log-level",
		Value: "info",
		Usage: "log level (trace, debug, info, warn, error, fatal, panic)" + generateEnvDoc(c_GlobalFlagPrefix+"log-level"),
	}

	GenesisNonce = Flag{
		Name:  c_NodeFlagPrefix + "genesis-nonce",
		Value: "23621466532946281564673705261963422",
		Usage: "Nonce hex string to use for the genesis block" + generateEnvDoc(c_NodeFlagPrefix+"genesis-nonce"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// ** 	      RPC FLAGS                  **
	// **                                    **
	// ****************************************
	HTTPEnabledFlag = Flag{
		Name:  c_RPCFlagPrefix + "http",
		Value: true,
		Usage: "Enable the HTTP-RPC server" + generateEnvDoc(c_RPCFlagPrefix+"http"),
	}

	HTTPListenAddrFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-addr",
		Value: node.DefaultHTTPHost,
		Usage: "HTTP-RPC server listening interface" + generateEnvDoc(c_RPCFlagPrefix+"http-addr"),
	}

	HTTPCORSDomainFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-corsdomain",
		Value: "",
		Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)" + generateEnvDoc(c_RPCFlagPrefix+"http-corsdomain"),
	}

	HTTPVirtualHostsFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-vhosts",
		Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
		Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard." + generateEnvDoc(c_RPCFlagPrefix+"http-vhosts"),
	}

	HTTPApiFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-api",
		Value: "",
		Usage: "API's offered over the HTTP-RPC interface" + generateEnvDoc(c_RPCFlagPrefix+"http-api"),
	}

	HTTPPathPrefixFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-rpcprefix",
		Value: "",
		Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths." + generateEnvDoc(c_RPCFlagPrefix+"http-rpcprefix"),
	}

	HTTPPortStartFlag = Flag{
		Name:  c_RPCFlagPrefix + "http-port",
		Value: 9001,
		Usage: "HTTP-RPC server listening port" + generateEnvDoc(c_RPCFlagPrefix+"http-port"),
	}

	WSEnabledFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws",
		Value: true,
		Usage: "Enable the WS-RPC server" + generateEnvDoc(c_RPCFlagPrefix+"ws"),
	}

	WSListenAddrFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-addr",
		Value: node.DefaultWSHost,
		Usage: "WS-RPC server listening interface" + generateEnvDoc(c_RPCFlagPrefix+"ws-addr"),
	}

	WSMaxSubsFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-max-subs",
		Value: 1000,
		Usage: "maximum concurrent subscribers to the WS-RPC server",
	}

	WSApiFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-api",
		Value: "",
		Usage: "API's offered over the WS-RPC interface" + generateEnvDoc(c_RPCFlagPrefix+"ws-api"),
	}

	WSAllowedOriginsFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-origins",
		Value: "",
		Usage: "Origins from which to accept websockets requests" + generateEnvDoc(c_RPCFlagPrefix+"ws-origins"),
	}

	WSPathPrefixFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-rpcprefix",
		Value: "",
		Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths." + generateEnvDoc(c_RPCFlagPrefix+"ws-rpcprefix"),
	}

	WSPortStartFlag = Flag{
		Name:  c_RPCFlagPrefix + "ws-port",
		Value: 8001,
		Usage: "WS-RPC server listening port" + generateEnvDoc(c_RPCFlagPrefix+"ws-port"),
	}

	PreloadJSFlag = Flag{
		Name:  c_RPCFlagPrefix + "preload",
		Value: "",
		Usage: "Comma separated list of JavaScript files to preload into the console" + generateEnvDoc(c_RPCFlagPrefix+"preload"),
	}

	RPCGlobalTxFeeCapFlag = Flag{
		Name:  c_RPCFlagPrefix + "txfeecap",
		Value: 0,
		Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
	}

	RPCGlobalGasCapFlag = Flag{
		Name:  c_RPCFlagPrefix + "gascap",
		Value: quaiconfig.Defaults.RPCGasCap,
		Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)" + generateEnvDoc(c_RPCFlagPrefix+"gascap"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// **         WORKSHARE FLAGS            **
	// **                                    **
	// ****************************************
	WorkShareMiningFlag = Flag{
		Name:  c_WorkShareFlagPrefix + "mining",
		Value: false,
		Usage: "Enable workshare mining" + generateEnvDoc(c_WorkShareFlagPrefix+"mining"),
	}

	WorkShareThresholdFlag = Flag{
		Name:  c_WorkShareFlagPrefix + "threshold",
		Value: 10,
		Usage: "Threshold for workshare" + generateEnvDoc(c_WorkShareFlagPrefix+"threshold"),
	}

	WorkShareMinerEndpoints = Flag{
		Name:  c_WorkShareFlagPrefix + "miners",
		Value: "",
		Usage: "RPC endpoint to send minimally mined transactions for further working" + generateEnvDoc(c_WorkShareFlagPrefix+"miners"),
	}
	WorkShareP2PThreshold = Flag{
		Name:  c_WorkShareFlagPrefix + "p2pthreshold",
		Value: 7,
		Usage: "This is the workshares to be accepted by the node through the p2p layer" + generateEnvDoc(c_WorkShareFlagPrefix+"ws-percent"),
	}
)
View Source
var (
	// ****************************************
	// **                                    **
	// **         METRICS FLAGS              **
	// **                                    **
	// ****************************************
	MetricsEnabledFlag = Flag{
		Name:  c_MetricsFlagPrefix + "enabled",
		Value: false,
		Usage: "Enable metrics collection and reporting" + generateEnvDoc(c_MetricsFlagPrefix+"enabled"),
	}
	MetricsEnabledExpensiveFlag = Flag{
		Name:  c_MetricsFlagPrefix + "metrics-expensive",
		Value: false,
		Usage: "Enable expensive metrics collection and reporting" + generateEnvDoc(c_MetricsFlagPrefix+"metrics-expensive"),
	}
	MetricsHTTPFlag = Flag{
		Name:  c_MetricsFlagPrefix + "metrics-addr",
		Value: metrics_config.DefaultConfig.HTTP,
		Usage: "Enable stand-alone metrics HTTP server listening interface" + generateEnvDoc(c_MetricsFlagPrefix+"metrics-addr"),
	}
	MetricsPortFlag = Flag{
		Name:  c_MetricsFlagPrefix + "metrics-port",
		Value: metrics_config.DefaultConfig.Port,
		Usage: "Metrics HTTP server listening port" + generateEnvDoc(c_MetricsFlagPrefix+"metrics-port"),
	}
)
View Source
var PeersFlags = []Flag{
	PeersLogLevelFlag,
}
View Source
var (
	// ****************************************
	// **                                    **
	// **           PEERS FLAGS              **
	// **                                    **
	// ****************************************
	PeersLogLevelFlag = Flag{
		Name:  c_PeersFlagPrefix + "log-level",
		Value: "info",
		Usage: "log level (trace, debug, info, warn, error, fatal, panic)" + generateEnvDoc(c_GlobalFlagPrefix+"log-level"),
	}
)

Functions

func CheckExclusive

func CheckExclusive(args ...interface{})

CheckExclusive verifies that only a single instance of the provided flags was set by the user. Each flag might optionally be followed by a string type to specialize it further.

func CopyConstraintMap

func CopyConstraintMap(constraintMap map[string]common.Hash) map[string]common.Hash

func CreateAndBindFlag

func CreateAndBindFlag(flag Flag, cmd *cobra.Command)

func EnablePprof

func EnablePprof()

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf formats a message to standard error and exits the program. The message is also printed to standard output if standard error is redirected to a different file.

func GetGenesisNonce

func GetGenesisNonce() (uint64, []byte)

func GetHttpPort

func GetHttpPort(nodeLocation common.Location) int

func GetRunningRegions

func GetRunningRegions(runningSlices []common.Location) []byte

getRegionsRunning returns the regions running

func GetRunningZones

func GetRunningZones() []common.Location

GetRunningZones returns the slices that are processing state (which are only zones)

func GetWSPort

func GetWSPort(nodeLocation common.Location) int

func HexAddress

func HexAddress(account string, nodeLocation common.Location) (common.Address, error)

HexAddress converts an account specified directly as a hex encoded string or a key index in the key store to an internal account representation.

func InitConfig

func InitConfig()

InitConfig initializes the viper config instance ensuring that environment variables take precedence over config file parameters. Environment variables should be prefixed with the application name (e.g. QUAI_LOG_LEVEL). If the flag SAVE_CONFIG_FILE is set to true, the config file will be saved or updated with the current config parameters. It panics if an error occurs while reading the config file.

func IsValidEnvironment

func IsValidEnvironment(env string) bool

func MakeChainDatabase

func MakeChainDatabase(stack *node.Node, readonly bool) ethdb.Database

MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails.

func MakeConsolePreloads

func MakeConsolePreloads() []string

MakeConsolePreloads retrieves the absolute paths for the console JavaScript scripts to preload before starting.

func MakeDatabaseHandles

func MakeDatabaseHandles() int

MakeDatabaseHandles raises out the number of allowed file handles per process for Quai and returns half of the allowance to assign to the database.

func MakeGenesis

func MakeGenesis() *core.Genesis

func MakePasswordList

func MakePasswordList() []string

MakePasswordList reads password lines from the file specified by the global --password flag.

func OpenBackendDB

func OpenBackendDB() (*leveldb.DB, error)

func ParseCoinbaseAddresses

func ParseCoinbaseAddresses() (map[string]common.Address, error)

ParseCoinbaseAddresses reads the coinbase addresses and performs necessary validation.

func PrintConstraintMap

func PrintConstraintMap(constraintMap map[string]common.Hash)

func ReIndexChainIndexer

func ReIndexChainIndexer()

func RegisterQuaiService

func RegisterQuaiService(stack *node.Node, p2p quai.NetworkingAPI, cfg quaiconfig.Config, nodeCtx int, currentExpansionNumber uint8, startingExpansionNumber uint64, genesisBlock *types.WorkObject, logger *log.Logger) (quaiapi.Backend, error)

RegisterQuaiService adds a Quai client to the stack. The second return value is the full node instance, which may be nil if the node is running as a light client.

func RegisterQuaiStatsService

func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string, sendfullstats bool)

RegisterQuaiStatsService configures the Quai Stats daemon and adds it to the given node.

func SetNodeConfig

func SetNodeConfig(cfg *node.Config, nodeLocation common.Location, logger *log.Logger)

SetNodeConfig applies node-related command line flags to the config.

func SetQuaiConfig

func SetQuaiConfig(stack *node.Node, cfg *quaiconfig.Config, slicesRunning []common.Location, nodeLocation common.Location, currentExpansionNumber uint8, logger *log.Logger)

SetQuaiConfig applies quai-related command line flags to the config.

func SplitAndTrim

func SplitAndTrim(input string) (ret []string)

SplitAndTrim splits input separated by a comma and trims excessive white space from the substrings.

func SplitTagsFlag

func SplitTagsFlag(tagsFlag string) map[string]string

func StartNode

func StartNode(stack *node.Node)

func ValidateChainIndexer

func ValidateChainIndexer()

func WriteDefaultConfigFile

func WriteDefaultConfigFile(configDir string, configFileName string, configType string) error

Write the default values of each flag to a file

Types

type BigIntValue

type BigIntValue big.Int

**************************************** ** ** ** BIG INT FLAG ** ** & CUSTOM VALUE ** ** ** ****************************************

func (*BigIntValue) Set

func (b *BigIntValue) Set(val string) error

func (*BigIntValue) String

func (b *BigIntValue) String() string

func (*BigIntValue) Type

func (b *BigIntValue) Type() string

type Flag

type Flag struct {
	Name         string
	Abbreviation string
	Value        interface{}
	Usage        string
}

GenericFlag encapsulates common attributes and an interface for value

func (*Flag) GetAbbreviation

func (f *Flag) GetAbbreviation() string

func (*Flag) GetName

func (f *Flag) GetName() string

Implementing the Flag interface

func (*Flag) GetUsage

func (f *Flag) GetUsage() string

func (*Flag) GetValue

func (f *Flag) GetValue() interface{}

type HierarchicalCoordinator

type HierarchicalCoordinator struct {
	// contains filtered or unexported fields
}

func NewHierarchicalCoordinator

func NewHierarchicalCoordinator(p2p quai.NetworkingAPI, logLevel string, nodeWg *sync.WaitGroup, startingExpansionNumber uint64) *HierarchicalCoordinator

NewHierarchicalCoordinator creates a new instance of the HierarchicalCoordinator

func (*HierarchicalCoordinator) Add

func (hc *HierarchicalCoordinator) Add(entropy *big.Int, node NodeSet, newPendingHeaders *PendingHeaders)

func (*HierarchicalCoordinator) BuildPendingHeaders

func (hc *HierarchicalCoordinator) BuildPendingHeaders(wo *types.WorkObject, order int, newEntropy *big.Int)

func (*HierarchicalCoordinator) CalculateLeaders

func (hc *HierarchicalCoordinator) CalculateLeaders(badHashes map[common.Hash]bool) []Node

func (*HierarchicalCoordinator) ChainEventLoop

func (hc *HierarchicalCoordinator) ChainEventLoop(chainEvent chan core.ChainEvent, sub event.Subscription)

func (*HierarchicalCoordinator) ComputeMapPending

func (hc *HierarchicalCoordinator) ComputeMapPending(head core.ChainEvent)

func (*HierarchicalCoordinator) ComputePendingHeader

func (hc *HierarchicalCoordinator) ComputePendingHeader(wg *sync.WaitGroup, primeNode, regionNode, zoneNode common.Hash, location common.Location)

func (*HierarchicalCoordinator) ComputePendingHeaders

func (hc *HierarchicalCoordinator) ComputePendingHeaders(nodeSet NodeSet)

func (*HierarchicalCoordinator) ConsensusBackend

func (hc *HierarchicalCoordinator) ConsensusBackend() quai.ConsensusAPI

func (*HierarchicalCoordinator) Get

func (hc *HierarchicalCoordinator) Get(entropy *big.Int) (NodeSet, bool)

func (*HierarchicalCoordinator) GetBackend

func (hc *HierarchicalCoordinator) GetBackend(location common.Location) quaiapi.Backend

func (*HierarchicalCoordinator) GetBackendForLocationAndOrder

func (hc *HierarchicalCoordinator) GetBackendForLocationAndOrder(location common.Location, order int) quaiapi.Backend

func (*HierarchicalCoordinator) GetContextLocation

func (hc *HierarchicalCoordinator) GetContextLocation(location common.Location, ctx int) common.Location

func (*HierarchicalCoordinator) GetNodeListForLocation

func (hc *HierarchicalCoordinator) GetNodeListForLocation(location common.Location, badHashesList map[common.Hash]bool) []Node

func (*HierarchicalCoordinator) InitPendingHeaders

func (hc *HierarchicalCoordinator) InitPendingHeaders()

func (*HierarchicalCoordinator) IsAncestor

func (hc *HierarchicalCoordinator) IsAncestor(ancestor common.Hash, header common.Hash, headerLoc common.Location, order int) bool

func (*HierarchicalCoordinator) MapConstructProc

func (hc *HierarchicalCoordinator) MapConstructProc()

func (*HierarchicalCoordinator) NodeFromHash

func (hc *HierarchicalCoordinator) NodeFromHash(hash common.Hash, location common.Location) (Node, error)

func (*HierarchicalCoordinator) PendingHeadersMap

func (hc *HierarchicalCoordinator) PendingHeadersMap()

func (*HierarchicalCoordinator) ReapplicationLoop

func (hc *HierarchicalCoordinator) ReapplicationLoop(head core.ChainEvent)

func (*HierarchicalCoordinator) StartHierarchicalCoordinator

func (hc *HierarchicalCoordinator) StartHierarchicalCoordinator() error

func (*HierarchicalCoordinator) StartQuaiBackend

func (hc *HierarchicalCoordinator) StartQuaiBackend() (*quai.QuaiBackend, error)

Create a new instance of the QuaiBackend consensus service

func (*HierarchicalCoordinator) Stop

func (hc *HierarchicalCoordinator) Stop()

func (*HierarchicalCoordinator) TriggerTreeExpansion

func (hc *HierarchicalCoordinator) TriggerTreeExpansion(block *types.WorkObject) error

type Node

type Node struct {
	// contains filtered or unexported fields
}

func (*Node) Empty

func (ch *Node) Empty() bool

type NodeSet

type NodeSet struct {
	// contains filtered or unexported fields
}

func (*NodeSet) Copy

func (ns *NodeSet) Copy() NodeSet

func (*NodeSet) Entropy

func (ns *NodeSet) Entropy(numRegions int, numZones int) *big.Int

func (*NodeSet) Extendable

func (ns *NodeSet) Extendable(wo *types.WorkObject, order int) bool

func (*NodeSet) Update

func (ns *NodeSet) Update(wo *types.WorkObject, entropy *big.Int, order int)

type PendingHeaders

type PendingHeaders struct {
	// contains filtered or unexported fields
}

func NewPendingHeaders

func NewPendingHeaders() *PendingHeaders

type TextMarshaler

type TextMarshaler interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

**************************************** ** ** ** TEXT MARSHALER FLAG ** ** & CUSTOM VALUE ** ** ** ****************************************

type TextMarshalerValue

type TextMarshalerValue struct {
	Value encoding.TextMarshaler
}

func NewTextMarshalerValue

func NewTextMarshalerValue(val encoding.TextMarshaler) *TextMarshalerValue

func (*TextMarshalerValue) Set

func (t *TextMarshalerValue) Set(val string) error

func (*TextMarshalerValue) String

func (t *TextMarshalerValue) String() string

func (*TextMarshalerValue) Type

func (t *TextMarshalerValue) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳