external

package
v1.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

ErrInvalidValue signals that the value provided is invalid

View Source
var ErrMetablockNotFoundInLocalStorage = errors.New("metablock was not found in local storage")

ErrMetablockNotFoundInLocalStorage signals that the required metablock was not found in local storage

View Source
var ErrNilBlockChain = errors.New("nil block chain")

ErrNilBlockChain signals that an operation has been attempted to or with a nil blockchain

View Source
var ErrNilHash = errors.New("nil hash")

ErrNilHash signals that a nil hash has been provided

View Source
var ErrNilMarshalizer = errors.New("nil Marshalizer")

ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation

View Source
var ErrNilProposerResolver = errors.New("proposer validator is nil")

ErrNilProposerResolver is raised when a valid proposer resolver is expected but nil used

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

ErrNilShardCoordinator signals that an operation has been attempted to or with a nil shard coordinator

View Source
var ErrNilStore = errors.New("nil data storage service")

ErrNilStore signals that the provided storage service is nil

View Source
var ErrOperationNotSupported = errors.New("operation is not supported on this node")

ErrOperationNotSupported signals that the operation is not supported

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

ErrWrongTypeAssertion signals that a wrong type assertion occurred

Functions

This section is empty.

Types

type BlockHeader added in v1.0.3

type BlockHeader struct {
	ShardId        uint32
	Nonce          uint64
	Hash           []byte
	PrevHash       []byte
	StateRootHash  []byte
	ProposerPubKey []byte
	PubKeysBitmap  []byte
	BlockSize      int64
	TimeStamp      uint64
	TxCount        uint32
}

BlockHeader is the entity used to hold relevant info about a recent block (notarized)

type ExternalResolver added in v1.0.3

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

ExternalResolver is a struct used to gather relevant info about the blockchain status

func NewExternalResolver added in v1.0.3

func NewExternalResolver(
	coordinator sharding.Coordinator,
	chainHandler data.ChainHandler,
	storage dataRetriever.StorageService,
	marshalizer marshal.Marshalizer,
	proposerResolver ProposerResolver,
) (*ExternalResolver, error)

NewExternalResolver creates a new struct responsible with the gathering of relevant blockchain info

func (*ExternalResolver) RecentNotarizedBlocks added in v1.0.3

func (er *ExternalResolver) RecentNotarizedBlocks(maxShardHeadersNum int) ([]*BlockHeader, error)

RecentNotarizedBlocks computes last notarized [maxShardHeadersNum] shard headers (by metachain node) it starts from the most recent notarized metablock, fetches shard blocks and process the data from shards blocks After it completes the current metablock it moves to the previous metablock, process the data and so on It stops if it reaches the genesis block or it gathers [maxShardHeadersNum] shard headers

func (*ExternalResolver) RetrieveShardBlock added in v1.0.3

func (er *ExternalResolver) RetrieveShardBlock(blockHash []byte) (*ShardBlockInfo, error)

RetrieveShardBlock retrieves a shard block info containing header and transactions

type ProposerResolver added in v1.0.3

type ProposerResolver interface {
	ResolveProposer(shardId uint32, roundIndex uint32, prevRandomSeed []byte) ([]byte, error)
}

ProposerResolver defines how a struct will determine a block proposer

type RecentBlock added in v1.0.3

type RecentBlock struct {
	ShardId        uint32
	Nonce          uint64
	Hash           []byte
	PrevHash       []byte
	StateRootHash  []byte
	ProposerPubKey []byte
	PubKeysBitmap  []byte
	BlockSize      int64
	TimeStamp      uint64
	TxCount        uint32
}

RecentBlock is the entity used to hold relevant info about a recent block (notarized)

type ShardBlockInfo added in v1.0.3

type ShardBlockInfo struct {
	BlockHeader
	Transactions []TransactionInfo
}

ShardBlockInfo represents a notarized shard block with transactions

type TransactionInfo added in v1.0.3

type TransactionInfo struct {
	Nonce             uint64
	SenderAddress     []byte
	SenderShard       uint32
	ReceiverAddress   []byte
	ReceiverShard     uint32
	MiniblockHash     []byte
	SenderBlockHash   []byte
	ReceiverBlockHash []byte
	Balance           *big.Int
	Data              []byte
	Status            TransactionStatus
	Result            []byte
}

TransactionInfo is the entity used to hold relevant info about a transaction

type TransactionStatus added in v1.0.3

type TransactionStatus byte

TransactionStatus represents the status of a known transaction

const (
	// TxUnknown represents an unknown transaction
	TxUnknown TransactionStatus = iota
	// TxPending represents a pending transaction (found only in datapools)
	TxPending
	// TxFailed represents a failed notarized transaction
	TxFailed
	// TxProcessing represents a transaction that is notarized only in sender shard
	TxProcessing
	// TxSucceed represents a succeeded transaction, fully notarized
	TxSucceed
)

Jump to

Keyboard shortcuts

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