local

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detail

type Detail struct {
	Version     uint32         `json:"version"`
	BlockHash   common.Hash    `json:"block_hash"`
	BlockNumber hexutil.Uint64 `json:"block_number"`

	// just for json
	Rewards  []*RewardInfo `json:"rewards" rlp:"-"`
	InnerTxs []*InnerTx    `json:"inner_txs" rlp:"-"`

	// just for rlp
	RewardsPayload []byte `json:"-"`
	InnerTxPayload []byte `json:"-"`
}

func (*Detail) DecodeRLP

func (d *Detail) DecodeRLP(s *rlp.Stream) error

func (*Detail) EncodeRLP

func (d *Detail) EncodeRLP(w io.Writer) error

type DetailDB

type DetailDB interface {
	NewRecorder() DetailRecorder
	WriteDetail(d *Detail)
	ReadDetail(blockHash common.Hash) *Detail
	Close()
}

func FakeDetailDB

func FakeDetailDB() DetailDB

func NewDetailDB

func NewDetailDB(db youdb.Database, isWatch bool) DetailDB

type DetailRecorder

type DetailRecorder interface {
	IsWatch() bool
	Init(blockHash common.Hash, number uint64)
	AddReward(validator, coinbase common.Address, value *big.Int)
	AddInnerTx(parent common.Hash, from, to common.Address, value *big.Int, gasLimit uint64)
	Finalize() *Detail
}

func FakeRecorder

func FakeRecorder() DetailRecorder

type InnerTx

type InnerTx struct {
	ParentHash common.Hash    `json:"parent_hash"`
	From       common.Address `json:"from"`
	To         common.Address `json:"to"`
	Value      *big.Int       `json:"value"`
	GasLimit   uint64         `json:"gas_limit"`
}

func (InnerTx) MarshalJSON

func (i InnerTx) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*InnerTx) UnmarshalJSON

func (i *InnerTx) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type RewardInfo

type RewardInfo struct {
	Validator common.Address `json:"validator"`
	Coinbase  common.Address `json:"coinbase"`
	Reward    *big.Int       `json:"reward"`
}

func (RewardInfo) MarshalJSON

func (r RewardInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*RewardInfo) UnmarshalJSON

func (r *RewardInfo) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

Jump to

Keyboard shortcuts

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