Documentation ¶
Index ¶
- Variables
- func ApplyVote1HardFork(statedb *state.StateDB, blockNumber *big.Int, timestamp uint64)
- func CalcRewards(height *big.Int) *big.Int
- func CheckAddingReport(state vm.StateDB, report []byte, blockNumber *big.Int) (*types.Header, *types.Header, error)
- func CheckPoint(chainID *big.Int, blockHeight uint64, blockHash common.Hash) (isInRange bool, err error)
- func CheckPointsInBlockChain(chainID *big.Int, chain types.Blocks) (int, error)
- func CheckPointsInHeaderChain(chainID *big.Int, chain []*types.Header) (int, error)
- func DatongRLP(header *types.Header) []byte
- func DecodeLogData(data []byte) (interface{}, error)
- func DecodePunishTickets(data []byte) ([]common.Hash, error)
- func DecodeReport(report []byte) (*types.Header, *types.Header, error)
- func DecodeTxInput(input []byte) (interface{}, error)
- func GenerateGenesisExtraData(old []byte, ticketNumber uint64) []byte
- func InitCheckPoints(file string)
- func IsInCheckPointsRange(blockHeight uint64) bool
- func ProcessReport(heade1, header2 *types.Header, reporter common.Address, state vm.StateDB, ...) []common.Hash
- func ReportIllegal(header1, header2 *types.Header)
- func SetHeaders(parents []*types.Header)
- func VerifySignature(header *types.Header) error
- type API
- type DaTong
- func (dt *DaTong) APIs(chain consensus.ChainReader) []rpc.API
- func (dt *DaTong) Author(header *types.Header) (common.Address, error)
- func (dt *DaTong) Authorize(signer common.Address, signFn SignerFn)
- func (dt *DaTong) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (dt *DaTong) Close() error
- func (dt *DaTong) Finalize(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, ...) error
- func (dt *DaTong) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, ...) (*types.Block, error)
- func (c *DaTong) PreProcess(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB) error
- func (dt *DaTong) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (dt *DaTong) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (dt *DaTong) SealHash(header *types.Header) (hash common.Hash)
- func (dt *DaTong) SetChainConfig(chainConfig *params.ChainConfig)
- func (dt *DaTong) SetStateCache(stateCache state.Database)
- func (dt *DaTong) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (dt *DaTong) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (c *DaTong) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (dt *DaTong) VerifySeal2(chain consensus.ChainReader, header, parent *types.Header) error
- func (dt *DaTong) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type DisInfo
- type DisInfoWithIndex
- type DistanceSlice
- type SignerFn
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
var ( CheckPoints map[uint64]common.Hash LastCheckPoint uint64 )
var (
ErrNoTicket = errors.New("Miner doesn't have ticket")
)
var (
MinBlockTime uint64 = 7 // 7 seconds
)
Functions ¶
func ApplyVote1HardFork ¶
-------------------------- vote1 fork -------------------------
func CheckAddingReport ¶
func CheckPoint ¶
func CheckPointsInBlockChain ¶
func DecodeLogData ¶
DecodeLogData decode log data
func DecodeTxInput ¶
func InitCheckPoints ¶
func InitCheckPoints(file string)
func IsInCheckPointsRange ¶
func ProcessReport ¶
func ProcessReport(heade1, header2 *types.Header, reporter common.Address, state vm.StateDB, height *big.Int, timestamp uint64) []common.Hash
punish miner and reward reporter
func ReportIllegal ¶
func SetHeaders ¶
func VerifySignature ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API wacom
func (*API) GetSnapshot ¶
func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
GetSnapshot wacom
type DaTong ¶
type DaTong struct {
// contains filtered or unexported fields
}
DaTong wacom
func (*DaTong) APIs ¶
func (dt *DaTong) APIs(chain consensus.ChainReader) []rpc.API
APIs returns the RPC APIs this consensus engine provides.
func (*DaTong) Author ¶
Author retrieves the Ethereum address of the account that minted the given block, which may be different from the header's coinbase if a consensus engine is based on signatures.
func (*DaTong) CalcDifficulty ¶
func (dt *DaTong) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have.
func (*DaTong) FinalizeAndAssemble ¶
func (dt *DaTong) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
Finalize runs any post-transaction state modifications (e.g. block rewards) and assembles the final block. Note: The block header and state database might be updated to reflect any consensus rules that happen at finalization (e.g. block rewards).
func (*DaTong) PreProcess ¶
func (c *DaTong) PreProcess(chain consensus.ChainReader, header *types.Header, statedb *state.StateDB) error
PreProcess update state if needed from various block info used with some PoS Systems
func (*DaTong) Prepare ¶
Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.
func (*DaTong) Seal ¶
func (dt *DaTong) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal generates a new sealing request for the given input block and pushes the result into the given channel.
Note, the method returns immediately and will send the result async. More than one result may also be returned depending on the consensus algorothm.
func (*DaTong) SetChainConfig ¶
func (dt *DaTong) SetChainConfig(chainConfig *params.ChainConfig)
func (*DaTong) SetStateCache ¶
func (*DaTong) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules of the stock Ethereum ethash engine.
func (*DaTong) VerifyHeaders ¶
func (dt *DaTong) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications.
func (*DaTong) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*DaTong) VerifySeal2 ¶
func (*DaTong) VerifyUncles ¶
VerifyUncles verifies that the given block's uncles conform to the consensus rules of the stock Ethereum ethash engine.
type DisInfoWithIndex ¶
type DisInfoWithIndex struct {
// contains filtered or unexported fields
}
type DistanceSlice ¶
type DistanceSlice []*DisInfo
func (DistanceSlice) Len ¶
func (s DistanceSlice) Len() int
func (DistanceSlice) Less ¶
func (s DistanceSlice) Less(i, j int) bool
func (DistanceSlice) Swap ¶
func (s DistanceSlice) Swap(i, j int)