blocks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolID is the ID of protocol
	ProtocolID = "blocks"
	// BlockHistoryTableName is the table name of block history
	BlockHistoryTableName = "block_history"
	// ProductivityTableName is the table name of block producers' productivity
	ProductivityTableName = "productivity_history"
	// ExpectedProducerTableName is a table required by productivity table
	ExpectedProducerTableName = "expected_producer_history"
	// ProducerTableName is a table required by productivity table
	ProducerTableName = "producer_history"
	// EpochProducerIndexName is the index name of epoch number and producer's name on block history table
	EpochProducerIndexName = "epoch_producer_index"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHistory

type BlockHistory struct {
	EpochNumber             uint64
	BlockHeight             uint64
	BlockHash               string
	Transfer                uint64
	Execution               uint64
	DepositToRewaringFund   uint64
	ClaimFromRewardingFund  uint64
	GrantReward             uint64
	PutPollResult           uint64
	GasConsumed             uint64
	ProducerAddress         string
	ProducerName            string
	ExpectedProducerAddress string
	ExpectedProducerName    string
	Timestamp               uint64
}

BlockHistory defines the schema of "block history" table

type ProductivityHistory

type ProductivityHistory struct {
	EpochNumber        uint64
	ProducerName       string
	Production         uint64
	ExpectedProduction uint64
}

ProductivityHistory defines the schema of "productivity history" view

type Protocol

type Protocol struct {
	Store                 s.Store
	NumDelegates          uint64
	NumCandidateDelegates uint64
	NumSubEpochs          uint64
	ActiveBlockProducers  []string
	OperatorAddrToName    map[string]string
}

Protocol defines the protocol of indexing blocks

func NewProtocol

func NewProtocol(store s.Store, numDelegates uint64, numCandidateDelegates uint64, numSubEpochs uint64) *Protocol

NewProtocol creates a new protocol

func (*Protocol) CreateTables

func (p *Protocol) CreateTables(ctx context.Context) error

CreateTables creates tables

func (*Protocol) HandleBlock

func (p *Protocol) HandleBlock(ctx context.Context, tx *sql.Tx, blk *block.Block) error

HandleBlock handles blocks

func (*Protocol) Initialize

func (p *Protocol) Initialize(context.Context, *sql.Tx, *indexprotocol.Genesis) error

Initialize initializes blocks index protocol

Jump to

Keyboard shortcuts

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