Documentation ¶
Index ¶
- Constants
- func New(config *pbft.Config, privateKey *ecdsa.PrivateKey, db ethdb.Database) consensus.Pbft
- type API
- func (api *API) Candidates() map[common.Address]bool
- func (api *API) Discard(address common.Address)
- func (api *API) GetSignersFromBlock(number *rpc.BlockNumber) (*BlockSigners, error)
- func (api *API) GetSignersFromBlockByHash(hash common.Hash) (*BlockSigners, error)
- 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) NodeAddress() common.Address
- func (api *API) Propose(address common.Address, auth bool)
- type BlockSigners
- type Snapshot
- type Tally
- type Vote
Constants ¶
const ( PbftMsg = 0x11 NewBlockMsg = 0x07 )
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) GetSignersFromBlock ¶
func (api *API) GetSignersFromBlock(number *rpc.BlockNumber) (*BlockSigners, error)
GetSignersFromBlock returns the signers and minter for a given block number, or the latest block available if none is specified
func (*API) GetSignersFromBlockByHash ¶
func (api *API) GetSignersFromBlockByHash(hash common.Hash) (*BlockSigners, error)
GetSignersFromBlockByHash returns the signers and minter for a given block hash
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.
func (*API) NodeAddress ¶
NodeAddress returns the public address that is used to sign block headers in IBFT
type BlockSigners ¶
type BlockSigners struct { Number uint64 Hash common.Hash Author common.Address Committers []common.Address }
BlockSigners is contains who created and who signed a particular block, denoted by its number and hash
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 Votes []*Vote // List of votes cast in chronological order Tally map[common.Address]Tally // Current vote tally to avoid recalculating ValSet pbft.ValidatorSet // Set of authorized validators at this moment }
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
type Tally ¶
type Tally struct { Authorize bool `json:"authorize"` // Whether the vote it about authorizing or kicking someone Votes int `json:"votes"` // Number of votes until now wanting to pass the proposal }
Tally is a simple vote tally to keep the current score of votes. Votes that go against the proposal aren't counted since it's equivalent to not voting.
type Vote ¶
type Vote struct { Validator common.Address `json:"validator"` // Authorized validator that cast this vote Block uint64 `json:"block"` // Block number the vote was cast in (expire old votes) Address common.Address `json:"address"` // Account being voted on to change its authorization Authorize bool `json:"authorize"` // Whether to authorize or deauthorize the voted account }
Vote represents a single vote that an authorized validator made to modify the list of authorizations.