state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: AGPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcVoteSeq

func CalcVoteSeq(blockHeight uint64) uint64

seq 0 is the genesis block seq 1 is the the block height 1, to block height RoundVoteBlockNums seq 2 is the block height RoundVoteBlockNums + 1 to block height 2 * RoundVoteBlockNums consensus node of the current round is the final result of previous round

Types

type ConsensusNode

type ConsensusNode struct {
	XPub    chainkd.XPub
	VoteNum uint64
	Order   uint64
}

type UtxoViewpoint

type UtxoViewpoint struct {
	Entries map[bc.Hash]*storage.UtxoEntry
}

UtxoViewpoint represents a view into the set of unspent transaction outputs

func NewUtxoViewpoint

func NewUtxoViewpoint() *UtxoViewpoint

NewUtxoViewpoint returns a new empty unspent transaction output view.

func (*UtxoViewpoint) ApplyBlock

func (view *UtxoViewpoint) ApplyBlock(block *bc.Block, txStatus *bc.TransactionStatus) error

func (*UtxoViewpoint) ApplyTransaction

func (view *UtxoViewpoint) ApplyTransaction(block *bc.Block, tx *bc.Tx, statusFail bool) error

func (*UtxoViewpoint) CanSpend

func (view *UtxoViewpoint) CanSpend(hash *bc.Hash) bool

func (*UtxoViewpoint) DetachBlock

func (view *UtxoViewpoint) DetachBlock(block *bc.Block, txStatus *bc.TransactionStatus) error

func (*UtxoViewpoint) DetachTransaction

func (view *UtxoViewpoint) DetachTransaction(tx *bc.Tx, statusFail bool) error

func (*UtxoViewpoint) HasUtxo

func (view *UtxoViewpoint) HasUtxo(hash *bc.Hash) bool

type VoteResult

type VoteResult struct {
	Seq         uint64
	NumOfVote   map[string]uint64
	BlockHash   bc.Hash
	BlockHeight uint64
}

VoteResult represents a snapshot of each round of DPOS voting Seq indicates the sequence of current votes, which start from zero NumOfVote indicates the number of votes each consensus node receives, the key of map represent public key Finalized indicates whether this vote is finalized

func (*VoteResult) ApplyBlock

func (v *VoteResult) ApplyBlock(block *types.Block) error

func (*VoteResult) ConsensusNodes

func (v *VoteResult) ConsensusNodes() (map[string]*ConsensusNode, error)

func (*VoteResult) DetachBlock

func (v *VoteResult) DetachBlock(block *types.Block) error

func (*VoteResult) Fork

func (v *VoteResult) Fork() *VoteResult

func (*VoteResult) IsFinalize

func (v *VoteResult) IsFinalize() bool

Jump to

Keyboard shortcuts

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