blockv0

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMerkleRootOfReceiptList

func CalcMerkleRootOfReceiptList(
	receipts module.ReceiptList,
	txs module.TransactionList,
	height int64,
) []byte

func CalcMerkleRootOfReceiptSlice

func CalcMerkleRootOfReceiptSlice(
	receipts []txresult.Receipt,
	txs []module.Transaction,
	height int64,
) []byte

func CalcOriginalReceiptHash

func CalcOriginalReceiptHash(
	r module.Receipt,
	txHash []byte,
	height int64,
	txIndex int,
) []byte

Types

type Block

type Block interface {
	Version() string
	ID() []byte
	Height() int64
	Timestamp() int64
	PrevID() []byte
	Votes() *BlockVoteList
	Proposer() module.Address
	Validators() *RepsList
	NextValidators() *RepsList
	NormalTransactions() []module.Transaction
	LogsBloom() module.LogsBloom
	Verify(prev Block) error
	ToJSON(version module.JSONVersion) (interface{}, error)
}

func ParseBlock

func ParseBlock(b []byte, lc Store) (Block, error)

func ParseBlockV01a

func ParseBlockV01a(b []byte) (Block, error)

func ParseBlockV03

func ParseBlockV03(b []byte, lc Store) (Block, error)

type BlockV01a

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

func (*BlockV01a) Height

func (b *BlockV01a) Height() int64

func (*BlockV01a) ID

func (b *BlockV01a) ID() []byte

func (*BlockV01a) LogsBloom

func (b *BlockV01a) LogsBloom() module.LogsBloom

func (*BlockV01a) NextValidators

func (b *BlockV01a) NextValidators() *RepsList

func (*BlockV01a) NormalTransactions

func (b *BlockV01a) NormalTransactions() []module.Transaction

func (*BlockV01a) PrevID

func (b *BlockV01a) PrevID() []byte

func (*BlockV01a) Proposer

func (b *BlockV01a) Proposer() module.Address

func (*BlockV01a) String

func (b *BlockV01a) String() string

func (*BlockV01a) Timestamp

func (b *BlockV01a) Timestamp() int64

func (*BlockV01a) ToJSON

func (b *BlockV01a) ToJSON(version module.JSONVersion) (interface{}, error)

func (*BlockV01a) Validators

func (b *BlockV01a) Validators() *RepsList

func (*BlockV01a) Verify

func (b *BlockV01a) Verify(prev Block) error

func (*BlockV01a) Version

func (b *BlockV01a) Version() string

func (*BlockV01a) Votes

func (b *BlockV01a) Votes() *BlockVoteList

type BlockV03

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

func (*BlockV03) GetNextLeader added in v0.9.7

func (b *BlockV03) GetNextLeader() module.Address

func (*BlockV03) Height

func (b *BlockV03) Height() int64

func (*BlockV03) ID

func (b *BlockV03) ID() []byte

func (*BlockV03) LeaderVotes added in v0.9.7

func (b *BlockV03) LeaderVotes() *LeaderVoteList

func (*BlockV03) LogsBloom

func (b *BlockV03) LogsBloom() module.LogsBloom

func (*BlockV03) NextLeader added in v0.9.7

func (b *BlockV03) NextLeader() common.Address

func (*BlockV03) NextValidators

func (b *BlockV03) NextValidators() *RepsList

func (*BlockV03) NormalTransactions

func (b *BlockV03) NormalTransactions() []module.Transaction

func (*BlockV03) PrevID

func (b *BlockV03) PrevID() []byte

func (*BlockV03) PrevVotes added in v0.9.7

func (b *BlockV03) PrevVotes() *BlockVoteList

func (*BlockV03) Proposer

func (b *BlockV03) Proposer() module.Address

func (*BlockV03) ReceiptsHash

func (b *BlockV03) ReceiptsHash() []byte

func (*BlockV03) RepsHash added in v0.9.7

func (b *BlockV03) RepsHash() []byte

func (*BlockV03) Signature added in v0.9.7

func (b *BlockV03) Signature() common.Signature

func (*BlockV03) StateHash added in v0.9.7

func (b *BlockV03) StateHash() []byte

func (*BlockV03) Timestamp

func (b *BlockV03) Timestamp() int64

func (*BlockV03) ToJSON

func (b *BlockV03) ToJSON(rcpVersion module.JSONVersion) (interface{}, error)

func (*BlockV03) Validators

func (b *BlockV03) Validators() *RepsList

func (*BlockV03) Verify

func (b *BlockV03) Verify(prev Block) error

func (*BlockV03) Version

func (b *BlockV03) Version() string

func (*BlockV03) Votes

func (b *BlockV03) Votes() *BlockVoteList

type BlockV03JSON

type BlockV03JSON struct {
	Hash             common.HexBytes    `json:"hash"`
	Version          string             `json:"version"`
	PrevHash         common.HexHash     `json:"prevHash"`
	TransactionsHash common.HexHash     `json:"transactionsHash"`
	StateHash        common.HexHash     `json:"stateHash"`
	ReceiptsHash     common.HexHash     `json:"receiptsHash"`
	RepsHash         common.HexHash     `json:"repsHash"`
	NextRepsHash     common.HexHash     `json:"nextRepsHash"`
	LeaderVotesHash  common.HexHash     `json:"leaderVotesHash"`
	PrevVotesHash    common.HexHash     `json:"prevVotesHash"`
	LogsBloom        txresult.LogsBloom `json:"logsBloom"`
	Timestamp        common.HexInt64    `json:"timestamp"`
	Transactions     []Transaction      `json:"transactions"`
	LeaderVotes      *LeaderVoteList    `json:"leaderVotes"`
	PrevVotes        *BlockVoteList     `json:"prevVotes"`
	Height           common.HexInt64    `json:"height"`
	Leader           common.Address     `json:"leader"`
	NextLeader       common.Address     `json:"nextLeader"`
	Signature        common.Signature   `json:"signature"`
}

type BlockVote

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

func (*BlockVote) Hash

func (v *BlockVote) Hash() []byte

func (*BlockVote) MarshalJSON added in v0.9.7

func (v *BlockVote) MarshalJSON() ([]byte, error)

func (*BlockVote) Round

func (v *BlockVote) Round() int

func (*BlockVote) UnmarshalJSON

func (v *BlockVote) UnmarshalJSON(b []byte) error

func (*BlockVote) Verify

func (v *BlockVote) Verify() error

type BlockVoteJSON

type BlockVoteJSON struct {
	BlockVoteJSONSharable
	BlockVoteJSONIndividual
}

type BlockVoteJSONIndividual added in v0.9.7

type BlockVoteJSONIndividual struct {
	Rep       common.Address   `json:"rep"`
	Timestamp common.HexInt64  `json:"timestamp"`
	Signature common.Signature `json:"signature"`
}

type BlockVoteJSONSharable added in v0.9.7

type BlockVoteJSONSharable struct {
	BlockHeight common.HexInt64  `json:"blockHeight"`
	Round_      *int             `json:"round_,omitempty"`
	Round       *common.HexInt64 `json:"round,omitempty"`
	BlockHash   common.HexHash   `json:"blockHash"`
}

func (*BlockVoteJSONSharable) Equal added in v0.9.7

type BlockVoteList

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

func (*BlockVoteList) CheckVoters

func (s *BlockVoteList) CheckVoters(reps *RepsList, voted []bool) error

func (*BlockVoteList) Hash

func (s *BlockVoteList) Hash() []byte

func (*BlockVoteList) MarshalJSON

func (s *BlockVoteList) MarshalJSON() ([]byte, error)

func (*BlockVoteList) Quorum

func (s *BlockVoteList) Quorum() []byte

func (*BlockVoteList) RLPDecodeSelf added in v0.9.7

func (s *BlockVoteList) RLPDecodeSelf(d codec.Decoder) error

func (*BlockVoteList) RLPEncodeSelf added in v0.9.7

func (s *BlockVoteList) RLPEncodeSelf(e codec.Encoder) error

func (*BlockVoteList) Root added in v0.9.7

func (s *BlockVoteList) Root() []byte

func (*BlockVoteList) UnmarshalJSON

func (s *BlockVoteList) UnmarshalJSON(b []byte) error

func (*BlockVoteList) Verify

func (s *BlockVoteList) Verify(reps *RepsList) error

type LeaderVote

type LeaderVote struct {
	LeaderVoteSharable
	LeaderVoteIndividual
	// contains filtered or unexported fields
}

func (*LeaderVote) Hash

func (v *LeaderVote) Hash() []byte

func (*LeaderVote) Verify

func (v *LeaderVote) Verify() error

type LeaderVoteIndividual added in v0.9.7

type LeaderVoteIndividual struct {
	Rep       common.Address  `json:"rep"`
	Timestamp common.HexInt64 `json:"timestamp"`
	Signature []byte          `json:"signature"`
}

type LeaderVoteList

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

func (*LeaderVoteList) HasQuorumFor added in v0.9.7

func (s *LeaderVoteList) HasQuorumFor(addr module.Address) bool

func (*LeaderVoteList) Hash

func (s *LeaderVoteList) Hash() []byte

func (*LeaderVoteList) MarshalJSON

func (s *LeaderVoteList) MarshalJSON() ([]byte, error)

func (*LeaderVoteList) RLPDecodeSelf added in v0.9.7

func (s *LeaderVoteList) RLPDecodeSelf(d codec.Decoder) error

func (*LeaderVoteList) RLPEncodeSelf added in v0.9.7

func (s *LeaderVoteList) RLPEncodeSelf(e codec.Encoder) error

func (*LeaderVoteList) Root added in v0.9.7

func (s *LeaderVoteList) Root() []byte

func (*LeaderVoteList) UnmarshalJSON

func (s *LeaderVoteList) UnmarshalJSON(b []byte) error

func (*LeaderVoteList) Verify

func (s *LeaderVoteList) Verify(reps *RepsList) error

type LeaderVoteSharable added in v0.9.7

type LeaderVoteSharable struct {
	BlockHeight common.HexInt64 `json:"blockHeight"`
	OldLeader   common.Address  `json:"oldLeader"`
	NewLeader   common.Address  `json:"newLeader"`
	Round       int             `json:"round_"`
}

func (*LeaderVoteSharable) Equal added in v0.9.7

type RepJSON

type RepJSON struct {
	Address *common.Address `json:"address,omitempty"`
	ID      *common.Address `json:"id,omitempty"`
	P2P     string          `json:"p2pEndPoint,omitempty"`
}

func (*RepJSON) Normalize added in v0.9.7

func (r *RepJSON) Normalize()

type RepsList

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

func (*RepsList) Get

func (l *RepsList) Get(i int) module.Address

func (*RepsList) GetValidatorList added in v0.9.7

func (l *RepsList) GetValidatorList(dbase db.Database) (module.ValidatorList, error)

func (*RepsList) Hash

func (l *RepsList) Hash() []byte

func (*RepsList) Size

func (l *RepsList) Size() int

func (*RepsList) ToJSON

func (l *RepsList) ToJSON(version module.JSONVersion) (interface{}, error)

func (*RepsList) UnmarshalJSON

func (l *RepsList) UnmarshalJSON(bs []byte) error

type Store

type Store interface {
	GetRepsByHash(hash []byte) (*RepsList, error)
}

type Transaction

type Transaction struct {
	module.Transaction
}

func (*Transaction) MarshalJSON

func (t *Transaction) MarshalJSON() ([]byte, error)

func (Transaction) String

func (t Transaction) String() string

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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