Documentation ¶
Overview ¶
Copyright 2019 The go-smilo Authors Copyright 2017 The go-ethereum Authors This file is part of the go-ethereum library.
The go-ethereum library 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-ethereum library 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-ethereum library. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- func AccumulateRewards(communityAddress string, state *state.StateDB, header *types.Header)
- func New(config *sport.Config, privateKey *ecdsa.PrivateKey, db ethdb.Database) consensus.SmiloBFT
- type API
- func (api *API) Discard(address common.Address)
- func (api *API) GetFullnodes(blockNum *rpc.BlockNumber) (address []common.Address, err error)
- func (api *API) GetFullnodesByHash(hash common.Hash) ([]common.Address, error)
- func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
- func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error)
- func (api *API) Proposals() map[common.Address]bool
- func (api *API) Propose(address common.Address, auth bool)
- type Snapshot
- type Tally
- type Vote
Constants ¶
const (
NewBlockMsg = 0x07
)
Variables ¶
This section is empty.
Functions ¶
func AccumulateRewards ¶
AccumulateRewards (override from ethash) credits the coinbase of the given block with the mining reward. The total reward consists of the static block reward and rewards for the community.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a user facing RPC API to dump smilobft state
func (*API) Discard ¶
Discard (clique override) drops a currently running candidate, stopping the fullnode from casting further votes (either for or against).
func (*API) GetFullnodes ¶
GetFullnodes return a array of fullnodes for a block
func (*API) GetFullnodesByHash ¶
GetFullnodesByHash return a array of fullnodes for a bash
func (*API) GetSnapshot ¶
func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
GetSnapshot (clique override) retrieves the state snapshot at a given block.
func (*API) GetSnapshotAtHash ¶
GetSnapshotAtHash (clique override) retrieves the state snapshot at a given block.
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 FullnodeSet sport.FullnodeSet // Set of authorized fullnodes 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 { Fullnode common.Address `json:"fullnode"` // Authorized fullnode that cast this vote BlockNum 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 fullnode made to modify the list of authorizations.