Documentation
¶
Index ¶
- Constants
- Variables
- func Fatalf(format string, args ...interface{})
- func NewStoppableListener(addr string, stopc <-chan struct{}) (*stoppableListener, error)
- type AddressTxes
- type ExtraSeal
- type InvalidRaftOrdering
- type Raft
- func (r *Raft) BuildExtraSeal(headerHash common.Hash) []byte
- func (r *Raft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) error
- func (r *Raft) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (r *Raft) SetId(raftId uint16)
- type SpeculativeChain
- func (chain *SpeculativeChain) Accept(acceptedBlock *types.Block)
- func (chain *SpeculativeChain) Clear(block *types.Block)
- func (chain *SpeculativeChain) Extend(block *types.Block)
- func (chain *SpeculativeChain) Head() *types.Block
- func (chain *SpeculativeChain) SetHead(block *types.Block)
- func (chain *SpeculativeChain) UnwindFrom(invalidHash common.Hash, headBlock *types.Block)
- func (chain *SpeculativeChain) WithoutProposedTxes(addrTxes AddressTxes) AddressTxes
Constants ¶
const ( MinterRole = 1 TickerMS = 100 // Raft's ticker interval SnapshotPeriod = 250 // Snapshot after this many raft messages )
Variables ¶
var ( BlockReward *big.Int = new(big.Int).Mul(big.NewInt(1e+18), big.NewInt(20)) BlockAttenuation *big.Int = big.NewInt(2500000) )
var (
AppliedDbKey = []byte("applied")
)
var ExtraVanity = 32 // Fixed number of extra-data prefix bytes reserved for arbitrary signer vanity
Functions ¶
func Fatalf ¶
func Fatalf(format string, args ...interface{})
TODO: this is just copied over from cmd/utils/cmd.go. dedupe Fatalf formats a message to standard error and exits the program. The message is also printed to standard output if standard error is redirected to a different file.
func NewStoppableListener ¶
Types ¶
type AddressTxes ¶
type AddressTxes map[common.Address]types.Transactions
type InvalidRaftOrdering ¶
type Raft ¶
func New ¶
func New(nodeKey *ecdsa.PrivateKey) *Raft
func (*Raft) BuildExtraSeal ¶ added in v1.0.6
func (*Raft) FinalizeAndAssemble ¶
type SpeculativeChain ¶
type SpeculativeChain struct {
// contains filtered or unexported fields
}
The speculative chain represents blocks that we have minted which haven't been accepted into the chain yet, building on each other in a chain. It has three basic operations: * add new block to end * accept / remove oldest block * unwind / remove invalid blocks to the end
Additionally: * clear state when we stop minting * set the parent when we're not minting (so it's always current)
func NewSpeculativeChain ¶
func NewSpeculativeChain() *SpeculativeChain
func (*SpeculativeChain) Accept ¶
func (chain *SpeculativeChain) Accept(acceptedBlock *types.Block)
Accept this block, removing it from the speculative chain
func (*SpeculativeChain) Clear ¶
func (chain *SpeculativeChain) Clear(block *types.Block)
func (*SpeculativeChain) Extend ¶
func (chain *SpeculativeChain) Extend(block *types.Block)
Append a new speculative block
func (*SpeculativeChain) Head ¶
func (chain *SpeculativeChain) Head() *types.Block
func (*SpeculativeChain) SetHead ¶
func (chain *SpeculativeChain) SetHead(block *types.Block)
Set the parent of the speculative chain
Note: This is only called when not minter
func (*SpeculativeChain) UnwindFrom ¶
func (chain *SpeculativeChain) UnwindFrom(invalidHash common.Hash, headBlock *types.Block)
Remove all blocks in the chain from the specified one until the end
func (*SpeculativeChain) WithoutProposedTxes ¶
func (chain *SpeculativeChain) WithoutProposedTxes(addrTxes AddressTxes) AddressTxes