config

package
v0.78.5-pre Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string

Version the version of the node, set at build time.

Functions

This section is empty.

Types

type ApplicationConfiguration

type ApplicationConfiguration struct {
	Address           string                  `yaml:"Address"`
	AttemptConnPeers  int                     `yaml:"AttemptConnPeers"`
	DBConfiguration   storage.DBConfiguration `yaml:"DBConfiguration"`
	DialTimeout       time.Duration           `yaml:"DialTimeout"`
	LogPath           string                  `yaml:"LogPath"`
	MaxPeers          int                     `yaml:"MaxPeers"`
	MinPeers          int                     `yaml:"MinPeers"`
	NodePort          uint16                  `yaml:"NodePort"`
	PingInterval      time.Duration           `yaml:"PingInterval"`
	PingTimeout       time.Duration           `yaml:"PingTimeout"`
	Pprof             metrics.Config          `yaml:"Pprof"`
	Prometheus        metrics.Config          `yaml:"Prometheus"`
	ProtoTickInterval time.Duration           `yaml:"ProtoTickInterval"`
	Relay             bool                    `yaml:"Relay"`
	RPC               rpc.Config              `yaml:"RPC"`
	UnlockWallet      wallet.Config           `yaml:"UnlockWallet"`
}

ApplicationConfiguration config specific to the node.

type Config

type Config struct {
	ProtocolConfiguration    ProtocolConfiguration    `yaml:"ProtocolConfiguration"`
	ApplicationConfiguration ApplicationConfiguration `yaml:"ApplicationConfiguration"`
}

Config top level struct representing the config for the node.

func Load

func Load(path string, netMode NetMode) (Config, error)

Load attempts to load the config from the given path for the given netMode.

func (Config) GenerateUserAgent

func (c Config) GenerateUserAgent() string

GenerateUserAgent creates user agent string based on build time environment.

type NetMode

type NetMode uint32

NetMode describes the mode the blockchain will operate on.

const (
	// ModeMainNet contains magic code used in the NEO main official network.
	ModeMainNet NetMode = 0x00746e41 // 7630401
	// ModeTestNet contains magic code used in the NEO testing network.
	ModeTestNet NetMode = 0x74746e41 // 1953787457
	// ModePrivNet contains magic code usually used for NEO private networks.
	ModePrivNet NetMode = 56753 // docker privnet
	// ModeUnitTestNet is a stub magic code used for testing purposes.
	ModeUnitTestNet NetMode = 0
)

func (NetMode) String

func (n NetMode) String() string

String implements the stringer interface.

type ProtocolConfiguration

type ProtocolConfiguration struct {
	AddressVersion byte `yaml:"AddressVersion"`
	// EnableStateRoot specifies if exchange of state roots should be enabled.
	EnableStateRoot bool `yaml:"EnableStateRoot"`
	// KeepOnlyLatestState specifies if MPT should only store latest state.
	// If true, DB size will be smaller, but older roots won't be accessible.
	// This value should remain the same for the same database.
	KeepOnlyLatestState bool `yaml:"KeepOnlyLatestState"`
	// FeePerExtraByte sets the expected per-byte fee for
	// transactions exceeding the MaxFreeTransactionSize.
	FeePerExtraByte float64 `yaml:"FeePerExtraByte"`
	// FreeGasLimit is an amount of GAS which can be spent for free.
	// It can change over time, thus it's a map of block height to the
	// respective GAS limit.
	FreeGasLimit         map[uint32]util.Fixed8 `yaml:"FreeGasLimit"`
	LowPriorityThreshold float64                `yaml:"LowPriorityThreshold"`
	Magic                NetMode                `yaml:"Magic"`
	// Maximum number of transactions allowed to be packed into block.
	MaxTransactionsPerBlock map[uint32]int `yaml:"MaxTransactionsPerBlock"`
	// Maximum size of low priority transaction in bytes.
	MaxFreeTransactionSize int `yaml:"MaxFreeTransactionSize"`
	// Maximum number of low priority transactions accepted into block.
	MaxFreeTransactionsPerBlock map[uint32]int `yaml:"MaxFreeTransactionsPerBlock"`
	// MinimumNetworkFee sets the minimum required network fee for transaction to pass validation.
	MinimumNetworkFee util.Fixed8 `yaml:"MinimumNetworkFee"`
	MemPoolSize       int         `yaml:"MemPoolSize"`
	// NoBonusHeight is the height where GAS generation stops.
	NoBonusHeight uint32 `yaml:"NoBonusHeight"`
	// SaveStorageBatch enables storage batch saving before every persist.
	SaveStorageBatch  bool     `yaml:"SaveStorageBatch"`
	SecondsPerBlock   int      `yaml:"SecondsPerBlock"`
	SeedList          []string `yaml:"SeedList"`
	StandbyValidators []string `yaml:"StandbyValidators"`
	// StateRootEnableIndex specifies starting height for state root calculations and exchange.
	StateRootEnableIndex uint32    `yaml:"StateRootEnableIndex"`
	SystemFee            SystemFee `yaml:"SystemFee"`
	// Whether to verify received blocks.
	VerifyBlocks bool `yaml:"VerifyBlocks"`
	// Whether to verify transactions in received blocks.
	VerifyTransactions bool `yaml:"VerifyTransactions"`
}

ProtocolConfiguration represents the protocol config.

func (*ProtocolConfiguration) GetFreeGas added in v0.78.0

func (p *ProtocolConfiguration) GetFreeGas(block uint32) util.Fixed8

GetFreeGas returns FreeGasLimit value for given block height.

func (*ProtocolConfiguration) GetMaxFreeTxPerBlock added in v0.78.0

func (p *ProtocolConfiguration) GetMaxFreeTxPerBlock(block uint32) int

GetMaxFreeTxPerBlock returns MaxFreeTransactionsPerBlock value for given block height.

func (*ProtocolConfiguration) GetMaxTxPerBlock added in v0.78.0

func (p *ProtocolConfiguration) GetMaxTxPerBlock(block uint32) int

GetMaxTxPerBlock returns MaxTransactionsPerBlock value for given block height.

type SystemFee

type SystemFee struct {
	EnrollmentTransaction int64 `yaml:"EnrollmentTransaction"`
	IssueTransaction      int64 `yaml:"IssueTransaction"`
	PublishTransaction    int64 `yaml:"PublishTransaction"`
	RegisterTransaction   int64 `yaml:"RegisterTransaction"`
}

SystemFee fees related to system.

func (SystemFee) TryGetValue

func (s SystemFee) TryGetValue(txType transaction.TXType) util.Fixed8

TryGetValue returns the system fee base on transaction type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL