deb

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VotingWaitTime = 10 // 리그에서 블록 투표시 기다리는 시간
)

Variables

This section is empty.

Functions

func MakeRand

func MakeRand(joinNonce uint64, otprn common.Hash, coinbase common.Address, pBlockHash common.Hash) int64

TODO : andus >> Rand 생성

func ValidationFairSignature

func ValidationFairSignature(hash common.Hash, sig []byte, fairAddr common.Address) bool

Types

type API

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

API is a user facing RPC API to allow controlling the signer and voting mechanisms of the proof-of-deb scheme.

func (*API) GetFairnodeAddress

func (api *API) GetFairnodeAddress() string

func (*API) GetJoinNonce

func (api *API) GetJoinNonce() uint64

type Deb

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

Deb is the proof-of-Deb consensus engine proposed to support the

func New

func New(config *params.DebConfig, db ethdb.Database) *Deb

New creates a andusChain proof-of-deb consensus engine with the initial signers set to the ones provided by the user.

func (*Deb) APIs

func (c *Deb) APIs(chain consensus.ChainReader) []rpc.API

APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.

func (*Deb) Author

func (c *Deb) Author(header *types.Header) (common.Address, error)

Author implements consensus.Engine, returning the Ethereum address recovered from the signature in the header's extra-data section.

func (*Deb) CalcDifficulty

func (c *Deb) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int

CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have based on the previous blocks in the chain and the current signer.

func (*Deb) ChangeJoinNonceAndReword

func (c *Deb) ChangeJoinNonceAndReword(chainid *big.Int, state *state.StateDB, txs []*types.Transaction, coinbase common.Address)

채굴자 보상 : JOINTX 갯수만큼 100% 지금

func (*Deb) Close

func (c *Deb) Close() error

Close implements consensus.Engine. It's a noop for clique as there is are no background threads.

func (*Deb) CompareBlock

func (c *Deb) CompareBlock(myBlock, receivedBlock *fairtypes.VoteBlock) *fairtypes.VoteBlock

다른데서 받은 투표 블록을 비교하여 위닝 블록으로 교체 하는 함수

func (*Deb) FairNodeSigCheck

func (c *Deb) FairNodeSigCheck(recivedBlock *types.Block, rSig []byte) (error, ErrorType)

func (*Deb) Finalize

func (c *Deb) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

Finalize implements consensus.Engine, ensuring no uncles are set, nor block rewards given, and returns the final block.

func (*Deb) Prepare

func (c *Deb) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.

func (*Deb) Seal

func (c *Deb) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

Seal implements consensus.Engine, attempting to create a sealed block using the local signing credentials.

func (*Deb) SealHash

func (c *Deb) SealHash(header *types.Header) common.Hash

SealHash returns the hash of a block prior to it being sealed.

func (*Deb) SendMiningBlockAndVoting

func (c *Deb) SendMiningBlockAndVoting(chain consensus.ChainReader, tsfBlock *fairtypes.VoteBlock, isVoting *bool)

func (*Deb) SetChans

func (c *Deb) SetChans(chans fairtypes.Channals)

func (*Deb) SetManager

func (c *Deb) SetManager(manager client)

func (*Deb) SetSignKey

func (c *Deb) SetSignKey(signKey *ecdsa.PrivateKey)

func (*Deb) SignBlockHeader

func (c *Deb) SignBlockHeader(blockHash []byte) ([]byte, error)

TODO : andus >> 생성된 블록(브로드케스팅용) 서명

func (*Deb) ValidateJointx

func (c *Deb) ValidateJointx(voteBlock *fairtypes.VoteBlock) bool

투표블록 서명 검증하고 난이도 검증

func (*Deb) ValidationBlockWidthJoinTx

func (c *Deb) ValidationBlockWidthJoinTx(chainid *big.Int, block *types.Block, joinNonce uint64) error

func (*Deb) ValidationVoteBlock

func (c *Deb) ValidationVoteBlock(chain consensus.ChainReader, voteblock *types.Block) error

func (*Deb) ValidationVoteBlockSign

func (c *Deb) ValidationVoteBlockSign(voteBlock *fairtypes.VoteBlock) bool

투표블록 서명 검증하고 난이도 검증

func (*Deb) VerifyHeader

func (c *Deb) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

VerifyHeader checks whether a header conforms to the consensus rules.

func (*Deb) VerifyHeaders

func (c *Deb) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).

func (*Deb) VerifySeal

func (c *Deb) VerifySeal(chain consensus.ChainReader, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.

func (*Deb) VerifyUncles

func (c *Deb) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.

type ErrorType

type ErrorType int
const (
	ErrNonFairNodeSig ErrorType = iota
	ErrGetPubKeyError
	ErrNotMatchFairAddress
)

Jump to

Keyboard shortcuts

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