state

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default values.
	// Cache parameters.
	// 500 MiB.
	DefaultCacheSize = 500 * 1024 * 1024

	// Bloom filter parameters.
	// Number of elements in Bloom Filter.
	DefaultBloomFilterSize = 2e8
	// Acceptable false positive for Bloom Filter (0.01%).
	DefaultBloomFilterFalsePositiveProbability = 0.0001

	// Db parameters.
	DefaultWriteBuffer         = 32 * 1024 * 1024
	DefaultCompactionTableSize = 8 * 1024 * 1024
	DefaultCompactionTotalSize = 10 * 1024 * 1024

	// Block storage parameters.
	// DefaultOffsetLen is the amount of bytes needed to store offset of transactions in blockchain file.
	DefaultOffsetLen = 8
	// DefaultHeaderOffsetLen is the amount of bytes needed to store offset of headers in headers file.
	DefaultHeaderOffsetLen = 8

	// StateVersion is current version of state internal storage formats.
	// It increases when backward compatibility with previous storage version is lost.
	StateVersion = 13

	// Memory limit for address transactions. flush() is called when this
	// limit is exceeded.
	AddressTransactionsMemLimit = 50 * 1024 * 1024
	// Number of keys per flush() call.
	AddressTransactionsMaxKeys = 4000

	// Maximum size of transactions by addresses file.
	// Then it is sorted and saved to DB.
	MaxAddressTransactionsFileSize = 2 * 1024 * 1024 * 1024 // 2 GiB.
)
View Source
const (
	FailFreeInvokeComplexity           = 1000
	FreeVerifierComplexity             = 200
	MaxVerifierScriptComplexityReduced = 2000
	MaxVerifierScriptComplexity        = 4000
	MaxCallableScriptComplexityV12     = 2000
	MaxCallableScriptComplexityV34     = 4000
	MaxCallableScriptComplexityV5      = 10000
	MaxCallableScriptComplexityV6      = 52000
)
View Source
const (
	EthereumTransferWavesKind = iota + 1
	EthereumTransferAssetsKind
	EthereumInvokeKind
)
View Source
const (
	FeeUnit = 100000

	SetScriptTransactionV6Fee = 1
)

Variables

View Source
var (
	DefaultOpenFilesCacheCapacity = 500
)

Functions

func CalculateScore added in v0.3.0

func CalculateScore(baseTarget uint64) (*big.Int, error)

func GuessEthereumTransactionKind added in v0.10.0

func GuessEthereumTransactionKind(data []byte) (int64, error)

func IsInvalidInput added in v0.10.0

func IsInvalidInput(err error) bool

func IsNotFound added in v0.3.0

func IsNotFound(err error) bool

func IsTxCommitmentError added in v0.8.0

func IsTxCommitmentError(err error) bool

func ReadMainnetBlocksToHeight added in v0.5.0

func ReadMainnetBlocksToHeight(height proto.Height) ([]*proto.Block, error)

This function is used for testing in other packages. This is more convenient, because blocks are stored in state's subdir.

Types

type ErrorType added in v0.3.0

type ErrorType byte
const (
	// Unmarshal error (for example, of block or transaction).
	DeserializationError ErrorType = iota + 1
	NotFoundError
	SerializationError
	TxValidationError
	TxCommitmentError
	ValidationError
	RollbackError
	// Errors occurring while getting data from database.
	RetrievalError
	// Errors occurring while updating/modifying state data.
	ModificationError
	InvalidInputError
	IncompatibilityError
	// DB or block storage Close() error.
	ClosureError
	// Minor technical errors which shouldn't ever happen.
	Other
)

type LeaseStatus added in v0.9.0

type LeaseStatus byte
const (
	LeaseActive LeaseStatus = iota
	LeaseCanceled
)

type MaxScriptsComplexityInBlock added in v0.9.0

type MaxScriptsComplexityInBlock struct {
	BeforeActivationRideV5Feature int
	AfterActivationRideV5Feature  int
}

func NewMaxScriptsComplexityInBlock added in v0.9.0

func NewMaxScriptsComplexityInBlock() MaxScriptsComplexityInBlock

func (MaxScriptsComplexityInBlock) GetMaxScriptsComplexityInBlock added in v0.9.0

func (a MaxScriptsComplexityInBlock) GetMaxScriptsComplexityInBlock(isRideV5Activated bool) int

type NonThreadSafeState added in v0.6.0

type NonThreadSafeState = State

type State

type State interface {
	StateInfo
	StateModifier
}

func NewState added in v0.3.0

func NewState(dataDir string, amend bool, params StateParams, settings *settings.BlockchainSettings) (State, error)

NewState() creates State. dataDir is path to directory to store all data, it's also possible to provide folder with existing data, and state will try to sync and use it in this case. params are state parameters (see below). settings are blockchain settings (settings.MainNetSettings, settings.TestNetSettings or custom settings).

type StateError added in v0.3.0

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

func NewStateError added in v0.3.0

func NewStateError(errorType ErrorType, originalError error) StateError

func (StateError) Error added in v0.3.0

func (err StateError) Error() string

func (StateError) Type added in v0.8.0

func (err StateError) Type() ErrorType

func (StateError) Unwrap added in v0.10.0

func (err StateError) Unwrap() error

type StateInfo added in v0.5.0

type StateInfo interface {
	// Block getters.
	TopBlock() *proto.Block
	Block(blockID proto.BlockID) (*proto.Block, error)
	BlockByHeight(height proto.Height) (*proto.Block, error)
	// Header getters.
	Header(blockID proto.BlockID) (*proto.BlockHeader, error)
	HeaderByHeight(height proto.Height) (*proto.BlockHeader, error)
	// Height returns current blockchain height.
	Height() (proto.Height, error)
	// Height <---> blockID converters.
	BlockIDToHeight(blockID proto.BlockID) (proto.Height, error)
	HeightToBlockID(height proto.Height) (proto.BlockID, error)
	WavesBalance(account proto.Recipient) (uint64, error)
	// FullWavesBalance returns complete Waves balance record.
	FullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error)
	EffectiveBalance(account proto.Recipient, startHeight, endHeight proto.Height) (uint64, error)
	// AssetBalance retrieves balance of account in specific currency, asset is asset's ID.
	AssetBalance(account proto.Recipient, assetID proto.AssetID) (uint64, error)
	// WavesAddressesNumber returns total number of Waves addresses in state.
	// It is extremely slow, so it is recommended to only use for testing purposes.
	WavesAddressesNumber() (uint64, error)

	// Get cumulative blocks score at given height.
	ScoreAtHeight(height proto.Height) (*big.Int, error)
	// Get current blockchain score (at top height).
	CurrentScore() (*big.Int, error)

	// Retrieve current blockchain settings.
	BlockchainSettings() (*settings.BlockchainSettings, error)

	// Features.
	VotesNum(featureID int16) (uint64, error)
	VotesNumAtHeight(featureID int16, height proto.Height) (uint64, error)
	IsActivated(featureID int16) (bool, error)
	IsActiveAtHeight(featureID int16, height proto.Height) (bool, error)
	ActivationHeight(featureID int16) (proto.Height, error)
	IsApproved(featureID int16) (bool, error)
	IsApprovedAtHeight(featureID int16, height proto.Height) (bool, error)
	ApprovalHeight(featureID int16) (proto.Height, error)
	AllFeatures() ([]int16, error)
	EstimatorVersion() (int, error)

	// Aliases.
	AddrByAlias(alias proto.Alias) (proto.WavesAddress, error)

	// Accounts data storage.
	RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error)
	RetrieveEntry(account proto.Recipient, key string) (proto.DataEntry, error)
	RetrieveIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)
	RetrieveBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)
	RetrieveStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error)
	RetrieveBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)

	// Transactions.
	TransactionByID(id []byte) (proto.Transaction, error)
	TransactionByIDWithStatus(id []byte) (proto.Transaction, bool, error)
	TransactionHeightByID(id []byte) (uint64, error)
	// NewAddrTransactionsIterator() returns iterator to iterate all transactions that affected
	// given address.
	// Iterator will move in range from most recent to oldest transactions.
	NewAddrTransactionsIterator(addr proto.Address) (TransactionIterator, error)

	// Asset fee sponsorship.
	AssetIsSponsored(assetID proto.AssetID) (bool, error)
	AssetInfo(assetID proto.AssetID) (*proto.AssetInfo, error)
	FullAssetInfo(assetID proto.AssetID) (*proto.FullAssetInfo, error)
	NFTList(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID) ([]*proto.FullAssetInfo, error)
	// Script information.
	ScriptInfoByAccount(account proto.Recipient) (*proto.ScriptInfo, error)
	ScriptInfoByAsset(assetID proto.AssetID) (*proto.ScriptInfo, error)
	NewestScriptByAccount(account proto.Recipient) (*ast.Tree, error)
	NewestScriptBytesByAccount(account proto.Recipient) (proto.Script, error)

	// Leases.
	IsActiveLeasing(leaseID crypto.Digest) (bool, error)

	// Invoke results.
	InvokeResultByID(invokeID crypto.Digest) (*proto.ScriptResult, error)
	// True if state stores additional information in order to provide extended API.
	ProvidesExtendedApi() (bool, error)
	// True if state stores and calculates state hashes for each block height.
	ProvidesStateHashes() (bool, error)

	// State hashes.
	StateHashAtHeight(height uint64) (*proto.StateHash, error)

	// Map on readable state. Way to apply multiple operations under same lock.
	MapR(func(StateInfo) (interface{}, error)) (interface{}, error)

	// HitSourceAtHeight reads hit source stored in state.
	HitSourceAtHeight(height proto.Height) ([]byte, error)

	// ShouldPersisAddressTransactions checks if PersisAddressTransactions
	// should be called.
	ShouldPersistAddressTransactions() (bool, error)
}

StateInfo returns information that corresponds to latest fully applied block. This should be used for APIs and other modules where stable, fully verified state is needed. Methods of this interface are thread-safe.

func NewThreadSafeReadWrapper added in v0.6.0

func NewThreadSafeReadWrapper(mu *sync.RWMutex, s StateInfo) StateInfo

type StateModifier added in v0.3.0

type StateModifier interface {
	// AddBlock adds single block to state.
	// It's not recommended using this function when you are able to accumulate big blocks batch,
	// since it's much more efficient to add many blocks at once.
	AddBlock(block []byte) (*proto.Block, error)
	AddDeserializedBlock(block *proto.Block) (*proto.Block, error)
	// AddBlocks adds batch of new blocks to state.
	AddBlocks(blocks [][]byte) error
	// AddDeserializedBlocks marshals blocks to binary and calls AddBlocks.
	AddDeserializedBlocks(blocks []*proto.Block) (*proto.Block, error)
	// Rollback functionality.
	RollbackToHeight(height proto.Height) error
	RollbackTo(removalEdge proto.BlockID) error

	// -------------------------
	// Validation functionality (for UTX).
	// -------------------------
	// ValidateNextTx() validates transaction against state, taking into account all the previous changes from transactions
	// that were added using ValidateNextTx() until you call ResetValidationList().
	// Returns TxCommitmentError or other state error or nil.
	// When TxCommitmentError is returned, state MUST BE cleared using ResetValidationList().
	ValidateNextTx(tx proto.Transaction, currentTimestamp, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) error
	// ResetValidationList() resets the validation list, so you can ValidateNextTx() from scratch after calling it.
	ResetValidationList()

	// Func internally calls ResetValidationList.
	TxValidation(func(validation TxValidation) error) error

	// Way to call multiple operations under same lock.
	Map(func(state NonThreadSafeState) error) error

	// State will provide extended API data after returning.
	StartProvidingExtendedApi() error

	// PersisAddressTransactions sorts and saves transactions to storage.
	PersistAddressTransactions() error

	Close() error
}

StateModifier contains all the methods needed to modify node's state. Methods of this interface are not thread-safe.

func NewThreadSafeWriteWrapper added in v0.6.0

func NewThreadSafeWriteWrapper(i *int32, mu *sync.RWMutex, s State) StateModifier

type StateParams added in v0.3.0

type StateParams struct {
	StorageParams
	ValidationParams
	// When StoreExtendedApiData is true, state builds additional data required for API.
	StoreExtendedApiData bool
	// ProvideExtendedApi specifies whether state must provide data for extended API.
	ProvideExtendedApi bool
	// BuildStateHashes enables building and storing state hashes by height.
	BuildStateHashes bool
}

func DefaultStateParams added in v0.3.0

func DefaultStateParams() StateParams

func DefaultTestingStateParams added in v0.3.0

func DefaultTestingStateParams() StateParams

type StorageParams added in v0.3.0

type StorageParams struct {
	OffsetLen       int
	HeaderOffsetLen int
	DbParams        keyvalue.KeyValParams
}

func DefaultStorageParams added in v0.3.0

func DefaultStorageParams() StorageParams

func DefaultTestingStorageParams added in v0.3.0

func DefaultTestingStorageParams() StorageParams

type ThreadSafeReadWrapper added in v0.6.0

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

func (*ThreadSafeReadWrapper) ActivationHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) ActivationHeight(featureID int16) (proto.Height, error)

func (*ThreadSafeReadWrapper) AddrByAlias added in v0.6.0

func (a *ThreadSafeReadWrapper) AddrByAlias(alias proto.Alias) (proto.WavesAddress, error)

func (*ThreadSafeReadWrapper) AllFeatures added in v0.6.0

func (a *ThreadSafeReadWrapper) AllFeatures() ([]int16, error)

func (*ThreadSafeReadWrapper) ApprovalHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) ApprovalHeight(featureID int16) (proto.Height, error)

func (*ThreadSafeReadWrapper) AssetBalance added in v0.10.0

func (a *ThreadSafeReadWrapper) AssetBalance(account proto.Recipient, asset proto.AssetID) (uint64, error)

func (*ThreadSafeReadWrapper) AssetInfo added in v0.6.0

func (a *ThreadSafeReadWrapper) AssetInfo(assetID proto.AssetID) (*proto.AssetInfo, error)

func (*ThreadSafeReadWrapper) AssetIsSponsored added in v0.6.0

func (a *ThreadSafeReadWrapper) AssetIsSponsored(assetID proto.AssetID) (bool, error)

func (*ThreadSafeReadWrapper) Block added in v0.6.0

func (a *ThreadSafeReadWrapper) Block(blockID proto.BlockID) (*proto.Block, error)

func (*ThreadSafeReadWrapper) BlockByHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) BlockByHeight(height proto.Height) (*proto.Block, error)

func (*ThreadSafeReadWrapper) BlockIDToHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) BlockIDToHeight(blockID proto.BlockID) (proto.Height, error)

func (*ThreadSafeReadWrapper) BlockchainSettings added in v0.6.0

func (a *ThreadSafeReadWrapper) BlockchainSettings() (*settings.BlockchainSettings, error)

func (*ThreadSafeReadWrapper) CurrentScore added in v0.6.0

func (a *ThreadSafeReadWrapper) CurrentScore() (*big.Int, error)

func (*ThreadSafeReadWrapper) EffectiveBalance added in v0.8.0

func (a *ThreadSafeReadWrapper) EffectiveBalance(account proto.Recipient, startHeight, endHeight proto.Height) (uint64, error)

func (*ThreadSafeReadWrapper) EstimatorVersion added in v0.8.0

func (a *ThreadSafeReadWrapper) EstimatorVersion() (int, error)

func (*ThreadSafeReadWrapper) FullAssetInfo added in v0.6.0

func (a *ThreadSafeReadWrapper) FullAssetInfo(assetID proto.AssetID) (*proto.FullAssetInfo, error)

func (*ThreadSafeReadWrapper) FullWavesBalance added in v0.6.0

func (a *ThreadSafeReadWrapper) FullWavesBalance(account proto.Recipient) (*proto.FullWavesBalance, error)

func (*ThreadSafeReadWrapper) Header added in v0.6.0

func (a *ThreadSafeReadWrapper) Header(blockID proto.BlockID) (*proto.BlockHeader, error)

func (*ThreadSafeReadWrapper) HeaderByHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) HeaderByHeight(height proto.Height) (*proto.BlockHeader, error)

func (*ThreadSafeReadWrapper) Height added in v0.6.0

func (a *ThreadSafeReadWrapper) Height() (proto.Height, error)

func (*ThreadSafeReadWrapper) HeightToBlockID added in v0.6.0

func (a *ThreadSafeReadWrapper) HeightToBlockID(height proto.Height) (proto.BlockID, error)

func (*ThreadSafeReadWrapper) HitSourceAtHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) HitSourceAtHeight(height proto.Height) ([]byte, error)

func (*ThreadSafeReadWrapper) InvokeResultByID added in v0.6.0

func (a *ThreadSafeReadWrapper) InvokeResultByID(invokeID crypto.Digest) (*proto.ScriptResult, error)

func (*ThreadSafeReadWrapper) IsActivated added in v0.6.0

func (a *ThreadSafeReadWrapper) IsActivated(featureID int16) (bool, error)

func (*ThreadSafeReadWrapper) IsActiveAtHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) IsActiveAtHeight(featureID int16, height proto.Height) (bool, error)

func (*ThreadSafeReadWrapper) IsActiveLeasing added in v0.6.0

func (a *ThreadSafeReadWrapper) IsActiveLeasing(leaseID crypto.Digest) (bool, error)

func (*ThreadSafeReadWrapper) IsApproved added in v0.6.0

func (a *ThreadSafeReadWrapper) IsApproved(featureID int16) (bool, error)

func (*ThreadSafeReadWrapper) IsApprovedAtHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) IsApprovedAtHeight(featureID int16, height proto.Height) (bool, error)

func (*ThreadSafeReadWrapper) MapR added in v0.6.0

func (a *ThreadSafeReadWrapper) MapR(f func(StateInfo) (interface{}, error)) (interface{}, error)

func (*ThreadSafeReadWrapper) NFTList added in v0.8.0

func (a *ThreadSafeReadWrapper) NFTList(account proto.Recipient, limit uint64, afterAssetID *proto.AssetID) ([]*proto.FullAssetInfo, error)

func (*ThreadSafeReadWrapper) NewAddrTransactionsIterator added in v0.6.0

func (a *ThreadSafeReadWrapper) NewAddrTransactionsIterator(addr proto.Address) (TransactionIterator, error)

func (*ThreadSafeReadWrapper) NewestScriptByAccount added in v0.10.0

func (a *ThreadSafeReadWrapper) NewestScriptByAccount(recipient proto.Recipient) (*ast.Tree, error)

func (*ThreadSafeReadWrapper) NewestScriptBytesByAccount added in v0.10.0

func (a *ThreadSafeReadWrapper) NewestScriptBytesByAccount(recipient proto.Recipient) (proto.Script, error)

func (*ThreadSafeReadWrapper) ProvidesExtendedApi added in v0.6.0

func (a *ThreadSafeReadWrapper) ProvidesExtendedApi() (bool, error)

func (*ThreadSafeReadWrapper) ProvidesStateHashes added in v0.6.0

func (a *ThreadSafeReadWrapper) ProvidesStateHashes() (bool, error)

func (*ThreadSafeReadWrapper) RetrieveBinaryEntry added in v0.6.0

func (a *ThreadSafeReadWrapper) RetrieveBinaryEntry(account proto.Recipient, key string) (*proto.BinaryDataEntry, error)

func (*ThreadSafeReadWrapper) RetrieveBooleanEntry added in v0.6.0

func (a *ThreadSafeReadWrapper) RetrieveBooleanEntry(account proto.Recipient, key string) (*proto.BooleanDataEntry, error)

func (*ThreadSafeReadWrapper) RetrieveEntries added in v0.6.0

func (a *ThreadSafeReadWrapper) RetrieveEntries(account proto.Recipient) ([]proto.DataEntry, error)

func (*ThreadSafeReadWrapper) RetrieveEntry added in v0.6.0

func (a *ThreadSafeReadWrapper) RetrieveEntry(account proto.Recipient, key string) (proto.DataEntry, error)

func (*ThreadSafeReadWrapper) RetrieveIntegerEntry added in v0.6.0

func (a *ThreadSafeReadWrapper) RetrieveIntegerEntry(account proto.Recipient, key string) (*proto.IntegerDataEntry, error)

func (*ThreadSafeReadWrapper) RetrieveStringEntry added in v0.6.0

func (a *ThreadSafeReadWrapper) RetrieveStringEntry(account proto.Recipient, key string) (*proto.StringDataEntry, error)

func (*ThreadSafeReadWrapper) ScoreAtHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) ScoreAtHeight(height proto.Height) (*big.Int, error)

func (*ThreadSafeReadWrapper) ScriptInfoByAccount added in v0.6.0

func (a *ThreadSafeReadWrapper) ScriptInfoByAccount(account proto.Recipient) (*proto.ScriptInfo, error)

func (*ThreadSafeReadWrapper) ScriptInfoByAsset added in v0.6.0

func (a *ThreadSafeReadWrapper) ScriptInfoByAsset(assetID proto.AssetID) (*proto.ScriptInfo, error)

func (*ThreadSafeReadWrapper) ShouldPersistAddressTransactions added in v0.7.0

func (a *ThreadSafeReadWrapper) ShouldPersistAddressTransactions() (bool, error)

func (*ThreadSafeReadWrapper) StateHashAtHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) StateHashAtHeight(height uint64) (*proto.StateHash, error)

func (*ThreadSafeReadWrapper) TopBlock added in v0.6.0

func (a *ThreadSafeReadWrapper) TopBlock() *proto.Block

func (*ThreadSafeReadWrapper) TransactionByID added in v0.6.0

func (a *ThreadSafeReadWrapper) TransactionByID(id []byte) (proto.Transaction, error)

func (*ThreadSafeReadWrapper) TransactionByIDWithStatus added in v0.7.0

func (a *ThreadSafeReadWrapper) TransactionByIDWithStatus(id []byte) (proto.Transaction, bool, error)

func (*ThreadSafeReadWrapper) TransactionHeightByID added in v0.6.0

func (a *ThreadSafeReadWrapper) TransactionHeightByID(id []byte) (uint64, error)

func (*ThreadSafeReadWrapper) VotesNum added in v0.6.0

func (a *ThreadSafeReadWrapper) VotesNum(featureID int16) (uint64, error)

func (*ThreadSafeReadWrapper) VotesNumAtHeight added in v0.6.0

func (a *ThreadSafeReadWrapper) VotesNumAtHeight(featureID int16, height proto.Height) (uint64, error)

func (*ThreadSafeReadWrapper) WavesAddressesNumber added in v0.6.0

func (a *ThreadSafeReadWrapper) WavesAddressesNumber() (uint64, error)

func (*ThreadSafeReadWrapper) WavesBalance added in v0.10.0

func (a *ThreadSafeReadWrapper) WavesBalance(account proto.Recipient) (uint64, error)

type ThreadSafeState added in v0.6.0

type ThreadSafeState struct {
	StateInfo
	StateModifier
}

func NewThreadSafeState added in v0.6.0

func NewThreadSafeState(s State) *ThreadSafeState

type ThreadSafeWriteWrapper added in v0.6.0

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

func (*ThreadSafeWriteWrapper) AddBlock added in v0.6.0

func (a *ThreadSafeWriteWrapper) AddBlock(block []byte) (*proto.Block, error)

func (*ThreadSafeWriteWrapper) AddBlocks added in v0.10.0

func (a *ThreadSafeWriteWrapper) AddBlocks(blocks [][]byte) error

func (*ThreadSafeWriteWrapper) AddDeserializedBlock added in v0.6.0

func (a *ThreadSafeWriteWrapper) AddDeserializedBlock(block *proto.Block) (*proto.Block, error)

func (*ThreadSafeWriteWrapper) AddDeserializedBlocks added in v0.10.0

func (a *ThreadSafeWriteWrapper) AddDeserializedBlocks(blocks []*proto.Block) (*proto.Block, error)

func (*ThreadSafeWriteWrapper) Close added in v0.6.0

func (a *ThreadSafeWriteWrapper) Close() error

func (*ThreadSafeWriteWrapper) Map added in v0.6.0

func (a *ThreadSafeWriteWrapper) Map(f func(state NonThreadSafeState) error) error

func (*ThreadSafeWriteWrapper) PersistAddressTransactions added in v0.7.0

func (a *ThreadSafeWriteWrapper) PersistAddressTransactions() error

func (*ThreadSafeWriteWrapper) ResetValidationList added in v0.6.0

func (a *ThreadSafeWriteWrapper) ResetValidationList()

func (*ThreadSafeWriteWrapper) RollbackTo added in v0.6.0

func (a *ThreadSafeWriteWrapper) RollbackTo(removalEdge proto.BlockID) error

func (*ThreadSafeWriteWrapper) RollbackToHeight added in v0.6.0

func (a *ThreadSafeWriteWrapper) RollbackToHeight(height proto.Height) error

func (*ThreadSafeWriteWrapper) StartProvidingExtendedApi added in v0.6.0

func (a *ThreadSafeWriteWrapper) StartProvidingExtendedApi() error

func (*ThreadSafeWriteWrapper) TxValidation added in v0.6.0

func (a *ThreadSafeWriteWrapper) TxValidation(f func(validation TxValidation) error) error

func (*ThreadSafeWriteWrapper) ValidateNextTx added in v0.6.0

func (a *ThreadSafeWriteWrapper) ValidateNextTx(_ proto.Transaction, _, _ uint64, _ proto.BlockVersion, _ bool) error

type TransactionIterator added in v0.5.0

type TransactionIterator interface {
	Transaction() (proto.Transaction, bool, error)
	Next() bool
	Release()
	Error() error
}

TransactionIterator can be used to iterate through transactions of given address. One instance is only valid for iterating once. Transaction() returns current transaction. Next() moves iterator to next position, it must be called first time at the beginning. Release() must be called after using iterator. Error() should return nil if iterating was successful.

type TxValidation added in v0.6.0

type TxValidation interface {
	ValidateNextTx(tx proto.Transaction, currentTimestamp, parentTimestamp uint64, blockVersion proto.BlockVersion, acceptFailed bool) error
}

type ValidationParams added in v0.3.0

type ValidationParams struct {
	VerificationGoroutinesNum int
	Time                      types.Time
}

ValidationParams are validation parameters. VerificationGoroutinesNum specifies how many goroutines will be run for verification of transactions and blocks signatures.

Jump to

Keyboard shortcuts

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