Documentation ¶
Index ¶
- Variables
- func CheckValidatorSignature(valSet ValidatorSet, data []byte, sig []byte) (common.Address, error)
- func GetSignatureAddress(data []byte, sig []byte) (common.Address, error)
- func RLPHash(v interface{}) (h common.Hash)
- type Backend
- type Config
- type ConsensusDataEvent
- type D_commit
- type D_select
- type FinalCommittedEvent
- type MessageEvent
- type Preprepare
- type Proposal
- type ProposalQman
- type ProposalSelector
- type ProposerPolicy
- type QmanDataEvent
- type Request
- type RequestEvent
- type RequestEventQman
- type RequestQman
- type Subject
- type Validator
- type ValidatorSet
- type Validators
- type View
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = &Config{ RequestTimeout: 5000, BlockPeriod: 2, BlockPauseTime: 2, ProposerPolicy: RoundRobin, Epoch: 30000, }
var ( // current validator set. ErrUnauthorizedAddress = errors.New("unauthorized address") )
Functions ¶
func CheckValidatorSignature ¶
func GetSignatureAddress ¶
GetSignatureAddress gets the signer address from the signature
Types ¶
type Backend ¶
type Backend interface { // Address returns the owner's address Address() common.Address // Validators returns the validator set Validators(proposal Proposal) ValidatorSet // old istanbul method, I'll remove it in the future after debuging // EventMux returns the event mux in backend EventMux() *event.TypeMux // Send sends a message to specific target : 특정 노드에 보낼때, Send(payload []byte, target common.Address) error // Broadcast sends a message to all validators : 전체 노드에 보낼때, 기 정의된 Validator집합에.. Broadcast(valSet ValidatorSet, payload []byte) error // Multicast sends a message to specific targets Multicast(payload []byte, targets []common.Address) error // Commit delivers an approved proposal to backend. // The delivered proposal will be put into blockchain. Commit(proposal Proposal, seals []byte) error // NextRound is called when we want to trigger next Seal() NextRound() error // Verify verifies the proposal. Verify(Proposal) error // Sign signs input data with the backend's private key Sign([]byte) ([]byte, error) // CheckSignature verifies the signature by checking if it's signed by // the given validator CheckSignature(data []byte, addr common.Address, sig []byte) error }
Backend provides application specific functions for Istanbul core
type Config ¶
type Config struct { RequestTimeout uint64 `toml:",omitempty"` // The timeout for each Istanbul round in milliseconds. This timeout should be larger than BlockPauseTime BlockPeriod uint64 `toml:",omitempty"` // Default minimum difference between two consecutive block's timestamps in second BlockPauseTime uint64 `toml:",omitempty"` // Delay time if no tx in block, the value should be larger than BlockPeriod ProposerPolicy ProposerPolicy `toml:",omitempty"` // The policy for proposer selection Epoch uint64 `toml:",omitempty"` // The number of blocks after which to checkpoint and reset the pending votes }
type ConsensusDataEvent ¶
type FinalCommittedEvent ¶
type MessageEvent ¶
type MessageEvent struct {
Payload []byte
}
type Preprepare ¶
type Proposal ¶
type Proposal interface { // Number retrieves the sequence number of this proposal. Number() *big.Int // Hash retrieves the hash of this proposal. Hash() common.Hash EncodeRLP(w io.Writer) error DecodeRLP(s *rlp.Stream) error String() string }
Proposal supports retrieving height(of Block) and serialized block to be used during PoDC consensus. Proposal block ?
type ProposalQman ¶
type ProposalQman interface { // Number retrieves the sequence number of this proposal. Number() *big.Int // Hash retrieves the hash of this proposal. Hash() common.Hash EncodeRLP(w io.Writer) error DecodeRLP(s *rlp.Stream) error String() string }
Qmanager data exchange format Proposal supports retrieving height and serialized block to be used during Istanbul consensus.
type ProposalSelector ¶
type ProposalSelector func(ValidatorSet, common.Address, uint64) Validator
type ProposerPolicy ¶
type ProposerPolicy uint64
const ( RoundRobin ProposerPolicy = iota Sticky QRF )
type QmanDataEvent ¶
type RequestEvent ¶
type RequestEvent struct {
Proposal Proposal
}
-----------------------------------------
type RequestEventQman ¶
type RequestEventQman struct {
Proposal Proposal
}
type RequestQman ¶
type RequestQman struct {
Proposal ProposalQman
}
type Subject ¶
func (*Subject) DecodeRLP ¶
DecodeRLP implements rlp.Decoder, and load the consensus fields from a RLP stream.
type ValidatorSet ¶
type ValidatorSet interface { // Calculate the proposer CalcProposer(lastProposer common.Address, round uint64) // 최초 Proposer 가 누군지 계산 ,, // Return the validator size Size() int // Return the validator array List() []Validator // Get validator by index GetByIndex(i uint64) Validator // Get validator by given address GetByAddress(addr common.Address) (int, Validator) // Get current proposer GetProposer() Validator // Check whether the validator with given address is a proposer IsProposer(address common.Address) bool // Add validator AddValidator(address common.Address) bool // Remove validator RemoveValidator(address common.Address) bool // Copy validator set Copy() ValidatorSet // Get the maximum number of faulty nodes F() int }
type Validators ¶
type Validators []Validator // go 배열 표현
type Validators []validator.ValidatorElement // go 배열 표현
func (Validators) Len ¶
func (slice Validators) Len() int
설명 : Validators = [ address, String, Tag ] [ ... ] [ ... ] ......... Validator node
|-------------------------| | enode address(20 byte) |-------------------------|
String인데,,String()모르겠으나, 그냥 문자열, Validator 를 나타내는
|-------------------------|
Tag를 새로 달았음.
|-------------------------| ............ N 개 Validators
func (Validators) Less ¶
func (slice Validators) Less(i, j int) bool
func (Validators) Swap ¶
func (slice Validators) Swap(i, j int)
type View ¶
View includes a round number and a sequence number. Sequence is the block number we'd like to commit. Each round has a number and is composed by 3 steps: preprepare, prepare and commit.
If the given block is not accepted by validators, a round change will occur and the validators start a new round with round+1.
func (*View) DecodeRLP ¶
DecodeRLP implements rlp.Decoder, and load the consensus fields from a RLP stream.