data

package
v1.0.57 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidBodyType = errors.New("invalid body type")

ErrInvalidBodyType signals an invalid header pointer was provided

View Source
var ErrInvalidHeaderType = errors.New("invalid header type")

ErrInvalidHeaderType signals an invalid header pointer was provided

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided such as NaN to an integer field

View Source
var ErrMiniBlockEmpty = errors.New("mini block is empty")

ErrMiniBlockEmpty signals that mini block is empty

View Source
var ErrNilAddressConverter = errors.New("nil address converter")

ErrNilAddressConverter signals that nil address converter was provided

View Source
var ErrNilBlockBody = errors.New("nil block body")

ErrNilBlockBody signals that block body is nil

View Source
var ErrNilBurnAddress = errors.New("nil burn address")

ErrNilBurnAddress signals that nil burn address was provided

View Source
var ErrNilCacher = errors.New("nil cacher")

ErrNilCacher signals that a nil cache has been provided

View Source
var ErrNilElrondAddress = errors.New("nil elrond address")

ErrNilElrondAddress signals that nil elrond address was provided

View Source
var ErrNilHeadersDataPool = errors.New("nil headers data pool")

ErrNilHeadersDataPool signals that a nil header pool has been provided

View Source
var ErrNilHeadersNoncesDataPool = errors.New("nil headers nonces cache")

ErrNilHeadersNoncesDataPool signals that a nil header - nonce cache

View Source
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")

ErrNilNodesCoordinator signals that nil shard coordinator was provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator")

ErrNilShardCoordinator signals that nil shard coordinator was provided

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that wrong type was provided

Functions

This section is empty.

Types

type BodyHandler

type BodyHandler interface {
	// IntegrityAndValidity checks the integrity and validity of the block
	IntegrityAndValidity() error
	// IsInterfaceNil returns true if there is no value under the interface
	IsInterfaceNil() bool
}

BodyHandler interface for a block body

type CapnpHelper added in v1.0.3

type CapnpHelper interface {
	// Save saves the serialized data of the implementer type into a stream through Capnp protocol
	Save(w io.Writer) error
	// Load loads the data from the stream into a go structure through Capnp protocol
	Load(r io.Reader) error
}

CapnpHelper is an interface that defines methods needed for serializing and deserializing Capnp structures into Go structures and viceversa

type ChainHandler

type ChainHandler interface {
	GetGenesisHeader() HeaderHandler
	SetGenesisHeader(gb HeaderHandler) error
	GetGenesisHeaderHash() []byte
	SetGenesisHeaderHash(hash []byte)
	GetCurrentBlockHeader() HeaderHandler
	SetCurrentBlockHeader(bh HeaderHandler) error
	GetCurrentBlockHeaderHash() []byte
	SetCurrentBlockHeaderHash(hash []byte)
	GetCurrentBlockBody() BodyHandler
	SetCurrentBlockBody(body BodyHandler) error
	GetLocalHeight() int64
	SetLocalHeight(height int64)
	GetNetworkHeight() int64
	SetNetworkHeight(height int64)
	HasBadBlock(blockHash []byte) bool
	PutBadBlock(blockHash []byte)
	IsInterfaceNil() bool
}

ChainHandler is the interface defining the functionality a blockchain should implement

type ConsensusRewardData

type ConsensusRewardData struct {
	Round     uint64
	Epoch     uint32
	PubKeys   []string
	Addresses []string
}

ConsensusRewardData holds the required data for rewarding validators in a specific round and epoch

type DBWriteCacher

type DBWriteCacher interface {
	Put(key, val []byte) error
	Get(key []byte) ([]byte, error)
	IsInterfaceNil() bool
}

DBWriteCacher is used to cache changes made to the trie, and only write to the database when it's needed

type HeaderHandler

type HeaderHandler interface {
	GetShardID() uint32
	GetNonce() uint64
	GetEpoch() uint32
	GetRound() uint64
	GetRootHash() []byte
	GetValidatorStatsRootHash() []byte
	GetPrevHash() []byte
	GetPrevRandSeed() []byte
	GetRandSeed() []byte
	GetPubKeysBitmap() []byte
	GetSignature() []byte
	GetLeaderSignature() []byte
	GetTimeStamp() uint64
	GetTxCount() uint32

	SetNonce(n uint64)
	SetEpoch(e uint32)
	SetRound(r uint64)
	SetTimeStamp(ts uint64)
	SetRootHash(rHash []byte)
	SetValidatorStatsRootHash(rHash []byte)
	SetPrevHash(pvHash []byte)
	SetPrevRandSeed(pvRandSeed []byte)
	SetRandSeed(randSeed []byte)
	SetPubKeysBitmap(pkbm []byte)
	SetSignature(sg []byte)
	SetLeaderSignature(sg []byte)
	SetTxCount(txCount uint32)

	GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32

	IsInterfaceNil() bool
	ItemsInBody() uint32
	ItemsInHeader() uint32
	Clone() HeaderHandler
}

HeaderHandler defines getters and setters for header data holder

type TransactionHandler

type TransactionHandler interface {
	IsInterfaceNil() bool

	GetValue() *big.Int
	GetNonce() uint64
	GetData() string
	GetRecvAddress() []byte
	GetSndAddress() []byte
	GetGasLimit() uint64
	GetGasPrice() uint64

	SetValue(*big.Int)
	SetData(string)
	SetRecvAddress([]byte)
	SetSndAddress([]byte)
}

TransactionHandler defines the type of executable transaction

type Trie

type Trie interface {
	Get(key []byte) ([]byte, error)
	Update(key, value []byte) error
	Delete(key []byte) error
	Root() ([]byte, error)
	Prove(key []byte) ([][]byte, error)
	VerifyProof(proofs [][]byte, key []byte) (bool, error)
	Commit() error
	Recreate(root []byte) (Trie, error)
	String() string
	DeepClone() (Trie, error)
	GetAllLeaves() (map[string][]byte, error)
	IsInterfaceNil() bool
}

Trie is an interface for Merkle Trees implementations

Jump to

Keyboard shortcuts

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