Documentation ¶
Overview ¶
Package backend implements backend for istanbul consensus engine.
Index ¶
- Constants
- func New(rewardbase common.Address, config *istanbul.Config, ...) consensus.Istanbul
- type API
- func (api *API) Candidates() map[common.Address]bool
- func (api *API) Discard(address common.Address)
- func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
- func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error)
- func (api *API) GetValidators(number *rpc.BlockNumber) ([]common.Address, error)
- func (api *API) GetValidatorsAtHash(hash common.Hash) ([]common.Address, error)
- func (api *API) Propose(address common.Address, auth bool)
- type APIExtension
- func (api *APIExtension) GetBlockWithConsensusInfoByHash(blockHash common.Hash) (map[string]interface{}, error)
- func (api *APIExtension) GetBlockWithConsensusInfoByNumber(number *rpc.BlockNumber) (map[string]interface{}, error)
- func (api *APIExtension) GetBlockWithConsensusInfoByNumberRange(start *rpc.BlockNumber, end *rpc.BlockNumber) (map[string]interface{}, error)
- func (api *APIExtension) GetCommittee(number *rpc.BlockNumber) ([]common.Address, error)
- func (api *APIExtension) GetCommitteeSize(number *rpc.BlockNumber) (int, error)
- func (api *APIExtension) GetCouncil(number *rpc.BlockNumber) ([]common.Address, error)
- func (api *APIExtension) GetCouncilSize(number *rpc.BlockNumber) (int, error)
- type Snapshot
Constants ¶
const (
IstanbulMsg = 0x11
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a user facing RPC API to dump Istanbul state
func (*API) Candidates ¶
Candidates returns the current candidates the node tries to uphold and vote on.
func (*API) Discard ¶
Discard drops a currently running candidate, stopping the validator from casting further votes (either for or against).
func (*API) GetSnapshot ¶
func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
GetSnapshot retrieves the state snapshot at a given block.
func (*API) GetSnapshotAtHash ¶
GetSnapshotAtHash retrieves the state snapshot at a given block.
func (*API) GetValidators ¶
GetValidators retrieves the list of authorized validators at the specified block.
func (*API) GetValidatorsAtHash ¶
GetValidatorsAtHash retrieves the state snapshot at a given block.
type APIExtension ¶
type APIExtension struct {
// contains filtered or unexported fields
}
API extended by Klaytn developers
func (*APIExtension) GetBlockWithConsensusInfoByHash ¶
func (api *APIExtension) GetBlockWithConsensusInfoByHash(blockHash common.Hash) (map[string]interface{}, error)
func (*APIExtension) GetBlockWithConsensusInfoByNumber ¶
func (api *APIExtension) GetBlockWithConsensusInfoByNumber(number *rpc.BlockNumber) (map[string]interface{}, error)
TODO-Klaytn: This API functions should be managed with API functions with namespace "klay"
func (*APIExtension) GetBlockWithConsensusInfoByNumberRange ¶
func (api *APIExtension) GetBlockWithConsensusInfoByNumberRange(start *rpc.BlockNumber, end *rpc.BlockNumber) (map[string]interface{}, error)
func (*APIExtension) GetCommittee ¶
func (api *APIExtension) GetCommittee(number *rpc.BlockNumber) ([]common.Address, error)
func (*APIExtension) GetCommitteeSize ¶
func (api *APIExtension) GetCommitteeSize(number *rpc.BlockNumber) (int, error)
func (*APIExtension) GetCouncil ¶
func (api *APIExtension) GetCouncil(number *rpc.BlockNumber) ([]common.Address, error)
GetCouncil retrieves the list of authorized validators at the specified block.
func (*APIExtension) GetCouncilSize ¶
func (api *APIExtension) GetCouncilSize(number *rpc.BlockNumber) (int, error)
type Snapshot ¶
type Snapshot struct { Epoch uint64 // The number of blocks after which to checkpoint and reset the pending votes Number uint64 // Block number where the snapshot was created Hash common.Hash // Block hash where the snapshot was created ValSet istanbul.ValidatorSet // Set of authorized validators at this moment Policy uint64 CommitteeSize uint64 Votes []governance.GovernanceVote // List of votes cast in chronological order Tally []governance.GovernanceTallyItem // Current vote tally to avoid recalculating }
Snapshot is the state of the authorization voting at a given point in time.
func (*Snapshot) MarshalJSON ¶
Marshal to a json byte array
func (*Snapshot) UnmarshalJSON ¶
Unmarshal from a json byte array