chain

package
v0.0.0-...-c80a3f0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MainnetRules = Rules{
		IsHomestead:      true,
		IsEIP150:         true,
		IsEIP155:         true,
		IsEIP158:         true,
		IsByzantium:      true,
		IsConstantinople: true,
		IsPetersburg:     true,
		IsIstanbul:       true,
		IsBerlin:         true,
		IsLondon:         true,
	}
	CliqueRules = Rules{
		IsHomestead:      true,
		IsEIP150:         true,
		IsEIP155:         true,
		IsEIP158:         true,
		IsByzantium:      true,
		IsConstantinople: true,
		IsPetersburg:     true,
		IsIstanbul:       true,
		IsBerlin:         true,
		IsLondon:         false,
	}
	DevRules = CliqueRules
)

Functions

func CanonicalHash

func CanonicalHash(db kv.Getter, number uint64, buf []byte) ([]byte, error)

func CurrentBlockNumber

func CurrentBlockNumber(db kv.Getter) (*uint64, error)

func HeadHeaderHash

func HeadHeaderHash(db kv.Getter) ([]byte, error)

HeadHeaderHash retrieves the hash of the current canonical head header.

func HeaderNumber

func HeaderNumber(db kv.Getter, hash []byte) (*uint64, error)

HeaderNumber returns the header number assigned to a hash.

Types

type Config

type Config struct {
	MuirGlacierBlock *big.Int `json:"muirGlacierBlock,omitempty"` // EIP-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
	EIP155Block      *big.Int `json:"eip155Block,omitempty"`      // EIP155 HF block
	HomesteadBlock   *big.Int `json:"homesteadBlock,omitempty"`   // Homestead switch block (nil = no fork, 0 = already homestead)
	DAOForkBlock     *big.Int `json:"daoForkBlock,omitempty"`     // TheDAO hard-fork switch block (nil = no fork)
	ByzantiumBlock   *big.Int `json:"byzantiumBlock,omitempty"`   // Byzantium switch block (nil = no fork, 0 = already on byzantium)
	// EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150)
	EIP150Block         *big.Int `json:"eip150Block,omitempty"`         // EIP150 HF block (nil = no fork)
	ChainID             *big.Int `json:"chainId"`                       // chainId identifies the current chain and is used for replay protection
	EIP158Block         *big.Int `json:"eip158Block,omitempty"`         // EIP158 HF block
	ArrowGlacierBlock   *big.Int `json:"arrowGlacierBlock,omitempty"`   // EIP-4345 (bomb delay) switch block (nil = no fork, 0 = already activated)
	ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
	PetersburgBlock     *big.Int `json:"petersburgBlock,omitempty"`     // Petersburg switch block (nil = same as Constantinople)
	IstanbulBlock       *big.Int `json:"istanbulBlock,omitempty"`       // Istanbul switch block (nil = no fork, 0 = already on istanbul)
	LondonBlock         *big.Int `json:"londonBlock,omitempty"`         // London switch block (nil = no fork, 0 = already on london)
	BerlinBlock         *big.Int `json:"berlinBlock,omitempty"`         // Berlin switch block (nil = no fork, 0 = already on berlin)
	ChainName           string
	DAOForkSupport      bool `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork
}

Config is the core config which determines the blockchain settings.

Config is stored in the database on a per block basis. This means that any network, identified by its genesis block, can have its own set of configuration options.

func GetConfig

func GetConfig(db kv.Getter, buf []byte) (*Config, error)

GetConfig retrieves the consensus settings based on the given genesis hash.

type Rules

type Rules struct {
	IsHomestead, IsEIP150, IsEIP155, IsEIP158               bool
	IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
	IsBerlin, IsLondon                                      bool
}

Rules wraps Config and is merely syntactic sugar or can be used for functions that do not have or require information about the block.

Rules is a one time interface meaning that it shouldn't be used in between transition phases.

func NewRules

func NewRules(c *Config, num uint64) Rules

func (Rules) Changed

func (r Rules) Changed(c *Config, num uint64) bool

Jump to

Keyboard shortcuts

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