Documentation ¶
Index ¶
- Constants
- func Factory(ctx context.Context, config *consensus.Config, privateKey *ecdsa.PrivateKey, ...) (consensus.Consensus, error)
- func FrontierDifficulty(time int64, parent *types.Header) uint64
- func HomesteadDifficulty(time int64, parent *types.Header) uint64
- func MetropolisDifficulty(time int64, parent *types.Header, bombDelay uint64) uint64
- type Cache
- type Ethash
- func (e *Ethash) CalcDifficulty(time int64, parent *types.Header) uint64
- func (e *Ethash) Close() error
- func (e *Ethash) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (e *Ethash) Seal(chain consensus.ChainReader, block *types.Block, ctx context.Context) (*types.Block, error)
- func (e *Ethash) SetDAOBlock(n uint64)
- func (e *Ethash) SetFakePow()
- func (e *Ethash) VerifyHeader(chain consensus.ChainReader, header *types.Header, uncle, seal bool) error
Constants ¶
const ByzantiumBombDelay = 3000000
ByzantiumBombDelay is the bomb delay for the Byzantium fork
const ConstantinopleBombDelay = 5000000
ConstantinopleBombDelay is the bomb delay for the Constantinople fork
const REVISION = 23
REVISION is the spec revision number of Ethash
Variables ¶
This section is empty.
Functions ¶
func Factory ¶
func Factory(ctx context.Context, config *consensus.Config, privateKey *ecdsa.PrivateKey, db storage.Storage, logger hclog.Logger) (consensus.Consensus, error)
Factory is the factory method to create an Ethash consensus
func FrontierDifficulty ¶
FrontierDifficulty is the difficulty calculation for the frontier fork
func HomesteadDifficulty ¶
HomesteadDifficulty is the difficulty calculation for the homestead fork
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a 16 MB pseudorandom cache.
type Ethash ¶
type Ethash struct {
// contains filtered or unexported fields
}
Ethash is the ethash consensus algorithm
func (*Ethash) CalcDifficulty ¶
CalcDifficulty calculates the difficulty at a given time.
func (*Ethash) Prepare ¶
Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.
func (*Ethash) Seal ¶
func (e *Ethash) Seal(chain consensus.ChainReader, block *types.Block, ctx context.Context) (*types.Block, error)
Seal seals the block
func (*Ethash) SetDAOBlock ¶
SetDAOBlock sets the dao block, only to be used during tests
func (*Ethash) SetFakePow ¶
func (e *Ethash) SetFakePow()
SetFakePow sets the fakePow flag to true, only used on tests.
func (*Ethash) VerifyHeader ¶
func (e *Ethash) VerifyHeader(chain consensus.ChainReader, header *types.Header, uncle, seal bool) error
VerifyHeader verifies the header is correct