Documentation ¶
Overview ¶
Copyright 2018 The go-hpb Authors Modified based on go-ethereum, which Copyright (C) 2014 The go-ethereum Authors.
The go-hpb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The go-hpb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the go-hpb. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018 The go-hpb Authors Modified based on go-ethereum, which Copyright (C) 2014 The go-ethereum Authors.
The go-hpb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The go-hpb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the go-hpb. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- func FindHpbNode(address common.Address, addresses []common.Address) bool
- func PreDealNodeInfo(pairs []p2p.HwPair) (error, []p2p.HwPair)
- func SetNetNodeType(snapa *snapshots.HpbNodeSnap) error
- type API
- func (api *API) Discard(address common.Address, confRand string)
- func (api *API) GetCandidateNodeSnap(number *rpc.BlockNumber) (*snapshots.CadNodeSnap, error)
- func (api *API) GetCandidateNodes(number *rpc.BlockNumber) (snapshots.CadNodeSnap, error)
- func (api *API) GetHpbNodeSnap(number *rpc.BlockNumber) (*snapshots.HpbNodeSnap, error)
- func (api *API) GetHpbNodeSnapAtHash(hash common.Hash) (*snapshots.HpbNodeSnap, error)
- func (api *API) GetHpbNodes(number *rpc.BlockNumber) ([]common.Address, error)
- func (api *API) GetLatestBlockHeader(number *rpc.BlockNumber) (header *types.Header)
- func (api *API) Proposals() map[common.Address]bool
- func (api *API) Propose(address common.Address, confRand string, auth bool)
- type BandWithStatics
- type Prometheus
- func (c *Prometheus) APIs(chain consensus.ChainReader) []rpc.API
- func (c *Prometheus) Author(header *types.Header) (common.Address, error)
- func (c *Prometheus) Authorize(signer common.Address, signFn SignerFn)
- func (c *Prometheus) CalculateRewards(chain consensus.ChainReader, state *state.StateDB, header *types.Header, ...) error
- func (c *Prometheus) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (c *Prometheus) GenBlockWithSig(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
- func (c *Prometheus) GetAllBalances(addrlist []common.Address, state *state.StateDB) (map[common.Address]big.Int, error)
- func (c *Prometheus) GetAllBalancesByCoin(addrlist []common.Address, coinlist []common.Address, state *state.StateDB) (map[common.Address]big.Int, error)
- func (c *Prometheus) GetBandwithRes(addrlist []common.Address, chain consensus.ChainReader, number uint64) (map[common.Address]int, error)
- func (c *Prometheus) GetBlockNumberFromBlockSetContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (error, uint64)
- func (c *Prometheus) GetCoinAddressFromElectionContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []common.Address, []common.Address)
- func (c *Prometheus) GetCoinAddressFromNewContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []common.Address, []common.Address)
- func (c *Prometheus) GetNextRand(lastrand []byte, number uint64) ([]byte, error)
- func (c *Prometheus) GetNodeinfoFromContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []p2p.HwPair)
- func (c *Prometheus) GetNodeinfoFromElectContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []p2p.HwPair)
- func (c *Prometheus) GetNodeinfoFromNewContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []p2p.HwPair)
- func (c *Prometheus) GetRankingRes(voteres map[common.Address]big.Int, addrlist []common.Address) (map[common.Address]int, error)
- func (c *Prometheus) GetSelectPrehp(state *state.StateDB, chain consensus.ChainReader, header *types.Header, ...) ([]*snapshots.CadWinner, []byte, error)
- func (c *Prometheus) GetSinger() common.Address
- func (c *Prometheus) GetVoteRes(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, *big.Int, map[common.Address]big.Int)
- func (c *Prometheus) GetVoteResFromElectionContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, map[common.Address]big.Int)
- func (c *Prometheus) GetVoteResFromNewContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, map[common.Address]big.Int)
- func (c *Prometheus) PrepareBlockHeader(chain consensus.ChainReader, header *types.Header, state *state.StateDB) error
- func (c *Prometheus) SetNetTopology(chain consensus.ChainReader, headers []*types.Header)
- func (c *Prometheus) SetNetTypeByOneHeader(chain consensus.ChainReader, header *types.Header, parents []*types.Header)
- func (c *Prometheus) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool, ...) error
- func (c *Prometheus) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool, ...) (chan<- struct{}, <-chan error)
- func (c *Prometheus) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (c *Prometheus) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type SignerFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetNetNodeType ¶
func SetNetNodeType(snapa *snapshots.HpbNodeSnap) error
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) GetCandidateNodeSnap ¶
func (api *API) GetCandidateNodeSnap(number *rpc.BlockNumber) (*snapshots.CadNodeSnap, error)
func (*API) GetCandidateNodes ¶
func (api *API) GetCandidateNodes(number *rpc.BlockNumber) (snapshots.CadNodeSnap, error)
func (*API) GetHpbNodeSnap ¶
func (api *API) GetHpbNodeSnap(number *rpc.BlockNumber) (*snapshots.HpbNodeSnap, error)
func (*API) GetHpbNodeSnapAtHash ¶
func (*API) GetHpbNodes ¶
func (*API) GetLatestBlockHeader ¶
func (api *API) GetLatestBlockHeader(number *rpc.BlockNumber) (header *types.Header)
type BandWithStatics ¶
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
func InstancePrometheus ¶
func InstancePrometheus() *Prometheus
InstanceBlockChain returns the singleton of BlockChain.
func New ¶
func New(config *config.PrometheusConfig, db hpbdb.Database) *Prometheus
func (*Prometheus) APIs ¶
func (c *Prometheus) APIs(chain consensus.ChainReader) []rpc.API
API for the terminal
func (*Prometheus) Authorize ¶
func (c *Prometheus) Authorize(signer common.Address, signFn SignerFn)
Authorize injects a private key into the consensus engine to mint new blocks with.
func (*Prometheus) CalculateRewards ¶
func (c *Prometheus) CalculateRewards(chain consensus.ChainReader, state *state.StateDB, header *types.Header, uncles []*types.Header) error
func (*Prometheus) GenBlockWithSig ¶
func (c *Prometheus) GenBlockWithSig(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)
generate blocks by giving the signature
func (*Prometheus) GetAllBalances ¶
func (*Prometheus) GetAllBalancesByCoin ¶
func (c *Prometheus) GetAllBalancesByCoin(addrlist []common.Address, coinlist []common.Address, state *state.StateDB) (map[common.Address]big.Int, error)
- GetAllBalancesByCoin *
- In: addrlist hpnode addresses from contract coinlist hpHolderCoin addresses from contract,Correspond addrlist by index state a pointer to stateDB
- Out: mapBalance hpnode address->hpHolderCoin address's balance *
- This function will get the balance of the coinaddress corresponding to the hpnode address.
- To separate Coinbase account and holdercoin address
func (*Prometheus) GetBandwithRes ¶
func (c *Prometheus) GetBandwithRes(addrlist []common.Address, chain consensus.ChainReader, number uint64) (map[common.Address]int, error)
input number, return key is commonAddress, order is value
func (*Prometheus) GetBlockNumberFromBlockSetContract ¶
func (c *Prometheus) GetBlockNumberFromBlockSetContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB, key string) (error, uint64)
* GetBlockNumberFromBlockSetContract * * This function will get a block number from contract with given key.
func (*Prometheus) GetCoinAddressFromElectionContract ¶
func (c *Prometheus) GetCoinAddressFromElectionContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []common.Address, []common.Address)
* GetCoinAddressFromElectionContract * * This function will get all coinbase addresses and holdercoin addresses. * coinbase address and holdercoin address correspond by index
func (*Prometheus) GetCoinAddressFromNewContract ¶
func (c *Prometheus) GetCoinAddressFromNewContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []common.Address, []common.Address)
* GetCoinAddressFromNewContract * * This function will get all coinbase addresses and holdercoin addresses. * coinbase address and holdercoin address correspond by index
func (*Prometheus) GetNextRand ¶
func (c *Prometheus) GetNextRand(lastrand []byte, number uint64) ([]byte, error)
func (*Prometheus) GetNodeinfoFromContract ¶
func (c *Prometheus) GetNodeinfoFromContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []p2p.HwPair)
func (*Prometheus) GetNodeinfoFromElectContract ¶
func (c *Prometheus) GetNodeinfoFromElectContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []p2p.HwPair)
* GetNodeinfoFromElectContract * * This function will get all boenodes by contract.
func (*Prometheus) GetNodeinfoFromNewContract ¶
func (c *Prometheus) GetNodeinfoFromNewContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, []p2p.HwPair)
* GetNodeinfoFromNewContract * * This function will get all boenodes by contract.
func (*Prometheus) GetRankingRes ¶
func (*Prometheus) GetSelectPrehp ¶
func (*Prometheus) GetSinger ¶
func (c *Prometheus) GetSinger() common.Address
func (*Prometheus) GetVoteRes ¶
func (*Prometheus) GetVoteResFromElectionContract ¶
func (c *Prometheus) GetVoteResFromElectionContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, map[common.Address]big.Int)
* GetVoteResFromElectionContract * * This function will get voteresult by contract.
func (*Prometheus) GetVoteResFromNewContract ¶
func (c *Prometheus) GetVoteResFromNewContract(chain consensus.ChainReader, header *types.Header, state *state.StateDB) (error, map[common.Address]big.Int)
* GetVoteResFromNewContract * * This function will get voteresult by contract.
func (*Prometheus) PrepareBlockHeader ¶
func (c *Prometheus) PrepareBlockHeader(chain consensus.ChainReader, header *types.Header, state *state.StateDB) error
Prepare function for Block
func (*Prometheus) SetNetTopology ¶
func (c *Prometheus) SetNetTopology(chain consensus.ChainReader, headers []*types.Header)
func (*Prometheus) SetNetTypeByOneHeader ¶
func (c *Prometheus) SetNetTypeByOneHeader(chain consensus.ChainReader, header *types.Header, parents []*types.Header)
func (*Prometheus) VerifyHeader ¶
func (c *Prometheus) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool, mode config.SyncMode) error
Verify one header
func (*Prometheus) VerifyHeaders ¶
func (c *Prometheus) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool, mode config.SyncMode) (chan<- struct{}, <-chan error)
Verify the headers
func (*Prometheus) VerifySeal ¶
func (c *Prometheus) VerifySeal(chain consensus.ChainReader, header *types.Header) error
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*Prometheus) VerifyUncles ¶
func (c *Prometheus) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.