police

package
v0.0.0-...-e1f35ab Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: LGPL-3.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPolicePassphrase

func GetPolicePassphrase() string

func SetPolicePassphrase

func SetPolicePassphrase(passphrase string)

Types

type Backend

type Backend interface {
	GetEleHeaderByNumber(number uint64) *types_elephant.Header
	GetEleHeadersFromPeer(from uint64, amount int, shardingID uint16, lampNum uint64) ([]*types_elephant.Header, error)
	SignVerifyResult(data []byte, passphrase string) ([]byte, error)
	BroadcastPoliceVerify(result *Result)
	DeliverVerifiedResult(result *Result)
}

Backend wraps all methods required for verifying.

type HeaderWithHeight

type HeaderWithHeight struct {
	ShardingID  uint16
	LampBase    *common.Hash
	Header      *common.Hash
	BlockNumber uint64

	PreviousHeaders []*common.Hash // Hashes of the verified headers from last to this one
}

func (*HeaderWithHeight) BlockHash

func (match *HeaderWithHeight) BlockHash() common.Hash

func (*HeaderWithHeight) BlockNum

func (match *HeaderWithHeight) BlockNum() uint64

type Lamp

type Lamp interface {
	GetValidHeadersByBlockNum(blockNum uint64) map[uint16]*types.VerifiedValid
	CurrEleSealersBlockNum() rpc.BlockNumber
}

Lamp wraps all methods required for verifying.

type Officer

type Officer struct {
	// contains filtered or unexported fields
}

officer is the main object which takes care of applying messages to the new state

func New

func New(elephant Backend, eth Lamp) *Officer

func (*Officer) IsBusying

func (self *Officer) IsBusying() bool

func (self *Officer) SetReturnCh(ch chan<- *Result) { self.returnCh = ch }

func (*Officer) PushWork

func (self *Officer) PushWork(work *Work)

func (*Officer) SetEtherbase

func (self *Officer) SetEtherbase(coinbase common.Address)

func (*Officer) Start

func (self *Officer) Start(coinbase common.Address)

func (*Officer) Stop

func (self *Officer) Stop()

func (*Officer) Work

func (self *Officer) Work() chan<- *Work

type Result

type Result struct {
	Match *HeaderWithHeight // the sharding header's hash matching with the tx root hash fetched from the liaison
	Sign  string
}

type Work

type Work struct {
	ShardingTxBatch *types_elephant.ShardingTxBatch
}

Work is the officer task that shall be verified

Jump to

Keyboard shortcuts

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