geecCore

package
v0.0.0-...-e7ebba5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeecExaimeReply = 0x01
	GeecElectMsg    = 0x02
	GeecQueryReply  = 0x03
)
View Source
const (
	QUERY_EMPTY       = 0
	QUERY_CONFIRMED   = 1
	QUERY_UNCONFIRMED = 2
)
View Source
const (
	ELEC_Candidate = 0x01
	ELEC_Voted     = 0x02
	ELEC_ELECTED   = 0x03
)
View Source
const (
	WB_PASSED  = 0x00
	WB_CURRENT = 0x01
	WB_TIMEOUT = 0x02
)

Variables

This section is empty.

Functions

func CalcConfidence

func CalcConfidence(parentConf uint64, block *types.Block) uint64

Types

type GeecMember

type GeecMember struct {
	Referee      common.Address
	Addr         common.Address
	JoinedBlock  uint64 //at which round the candidate joined as candidate
	TTL          uint64 //the “total” term for the candidate
	Ip           net.IP
	Port         int
	RenewedTimes uint64
}

type GeecUDPMsg

type GeecUDPMsg struct {
	Code    uint8
	Author  common.Address
	Payload []byte
}

type ProposeResult

type ProposeResult struct {
	BlockNum   uint64
	Supporters []common.Address
}

type QueryReply

type QueryReply struct {
	BlockNum  uint64
	Author    common.Address
	Empty     bool
	BlockHash common.Hash
	Retry     uint64
	Version   uint64
}

type QueryResult

type QueryResult struct {
	BlockNum   uint64
	Supporters []common.Address
	Stat       uint
	Version    uint64
	Confimred  bool
	Hash       common.Hash
}

type State

type State interface {
	Init(hc interface{}, chaindb interface{}, coninbase common.Address) error

	//NewTerm (start uint64, len uint64, seed uint64) error
	//Validate (writer p2p.MsgReadWriter, blockNum uint64) bool
	AppendRegReq(registratoin *types.Registratoin)

	Register(mux *event.TypeMux, ipstr string, portStr string, renew uint64)
	RecvExamineReply(reply *ValidateReply)
	GetWorkingBlock() *WorkingBlock
	RecvQueryReply(reply *QueryReply)
}

type ThwMiner

type ThwMiner interface {
	StopMining()
	StartMining(local bool) error
	IsMining() bool
}

type ValidateReply

type ValidateReply struct {
	BlockNum   uint64
	Author     common.Address
	Accepted   bool
	Retry      uint64
	FillBlocks []*types.Block //Thats are not real empty block.
}

type ValidateRequest

type ValidateRequest struct {
	BlockNum uint64
	Author   common.Address
	Retry    uint64
	Version  uint64
	IPstr    string
	Port     uint

	Block     *types.Block
	EmptyList []uint64
}

type WorkingBlock

type WorkingBlock struct {
	BlkNum uint64
	//PendingBlock    []byte
	MaxVersion         int64
	MaxValidateRetry   int64
	MaxValidateVersion int64
	MaxQueryRetry      int64
	Mu                 *sync.Mutex
	//Electing for proposer
	ElectState        uint8
	Supporters        *hashset.Set
	MyRand            uint64
	Delegator         common.Address
	NCandidates       uint64
	ElectionThreshold uint64

	Delegator_Ipstr    string
	Delegator_Port     uint
	Max_Election_Retry uint64
	//validating
	IsProposer        bool
	ValidateReplies   *hashmap.Map
	ValidateThreshold uint64
	ValidateSucceeded bool
	//query
	QueryReplies       *hashmap.Map
	QueryEmptyCount    uint64
	QueryNonEmptyCount uint64
	QueryThreshold     uint64
	QueryRecvMajority  bool
	//util, not changed during move
	R        *rand.Rand
	Coinbase common.Address
	Cond     *sync.Cond
}

func NewWorkingBlock

func NewWorkingBlock(coinbase common.Address) *WorkingBlock

func (*WorkingBlock) Move

func (wb *WorkingBlock) Move(blkNum uint64)

IMPORTANT This method must be called when the lock is held.

func (*WorkingBlock) Wait

func (wb *WorkingBlock) Wait(num uint64) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL