block

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultNotFinalizedError = errors.CodeBlock + iota
)

Variables

View Source
var (
	ErrResultNotFinalized = errors.NewBase(ResultNotFinalizedError, "ResultNotFinalized")
)

Functions

func GetBlockHeaderHashByHeight added in v1.1.1

func GetBlockHeaderHashByHeight(
	dbase db.Database,
	c codec.Codec,
	height int64,
) ([]byte, error)

func GetBlockVersion added in v1.1.1

func GetBlockVersion(
	dbase db.Database,
	c codec.Codec,
	height int64,
) (int, error)

func GetCommitVoteListBytesByHeight added in v1.1.1

func GetCommitVoteListBytesByHeight(
	dbase db.Database,
	c codec.Codec,
	height int64,
) ([]byte, error)

func GetLastHeight added in v0.9.4

func GetLastHeight(dbase db.Database) (int64, error)

func GetLastHeightOf

func GetLastHeightOf(dbase db.Database) int64

func GetLastHeightWithCodec added in v1.1.1

func GetLastHeightWithCodec(dbase db.Database, c codec.Codec) (int64, error)

func NewBlockV2Handler added in v0.9.6

func NewBlockV2Handler(chain base.Chain) base.BlockHandler

func NewManager

func NewManager(
	chain module.Chain,
	timestamper module.Timestamper,
	handlers []base.BlockHandler,
) (module.BlockManager, error)

NewManager creates BlockManager.

func PeekVersion added in v0.9.8

func PeekVersion(r io.Reader) (int, io.Reader, error)

func ReadVersion added in v0.9.10

func ReadVersion(r io.Reader) (int, error)

func ResetDB added in v0.9.4

func ResetDB(d db.Database, c codec.Codec, height int64) error

func WriteTransactionLocators added in v0.9.7

func WriteTransactionLocators(
	dbase db.Database,
	height int64,
	ptl module.TransactionList,
	ntl module.TransactionList,
) error

Types

type Chain added in v0.9.10

type Chain interface {
	Database() db.Database
	Wallet() module.Wallet
	ServiceManager() module.ServiceManager
	NID() int
	CID() int
	GenesisStorage() module.GenesisStorage
	CommitVoteSetDecoder() module.CommitVoteSetDecoder
	Genesis() []byte
}

type RefCounter

type RefCounter interface {
	RefCount() int
}

type RefTracer

type RefTracer struct {
	Logger log.Logger
	// contains filtered or unexported fields
}

func (*RefTracer) TraceDispose

func (rt *RefTracer) TraceDispose(rc RefCounter)

func (*RefTracer) TraceNew

func (rt *RefTracer) TraceNew(rc RefCounter)

func (*RefTracer) TraceRef

func (rt *RefTracer) TraceRef(rc RefCounter)

func (*RefTracer) TraceUnref

func (rt *RefTracer) TraceUnref(rc RefCounter)

type ServiceManager added in v0.9.10

type ServiceManager interface {
	module.TransitionManager
	TransactionFromBytes(b []byte, blockVersion int) (module.Transaction, error)
	GetChainID(result []byte) (int64, error)
	GetNetworkID(result []byte) (int64, error)
	GetNextBlockVersion(result []byte) int
	ImportResult(result []byte, vh []byte, src db.Database) error
	GenesisTransactionFromBytes(b []byte, blockVersion int) (module.Transaction, error)
	TransactionListFromHash(hash []byte) module.TransactionList
	ReceiptListFromResult(result []byte, g module.TransactionGroup) (module.ReceiptList, error)
	SendTransaction(result []byte, tx interface{}) ([]byte, error)
	ValidatorListFromHash(hash []byte) module.ValidatorList
	TransactionListFromSlice(txs []module.Transaction, version int) module.TransactionList
	SendTransactionAndWait(result []byte, tx interface{}) ([]byte, <-chan interface{}, error)
	WaitTransactionResult(id []byte) (<-chan interface{}, error)
	ExportResult(result []byte, vh []byte, dst db.Database) error
}

Jump to

Keyboard shortcuts

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