node

package
v1.3.21 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: GPL-3.0 Imports: 86 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SendTransactionsPipe is the pipe used for sending new transactions
	SendTransactionsPipe = "send transactions pipe"
)
View Source
const (

	// SoftRestartMessage is the custom message used when the node does a soft restart operation
	SoftRestartMessage = "Shuffled out - soft restart"
)

Variables

View Source
var ErrAccountNotFound = errors.New("account not found")

ErrAccountNotFound signals that an account was not found in trie

View Source
var ErrCannotCastAccountHandlerToUserAccountHandler = errors.New("cannot cast account handler to user account handler")

ErrCannotCastAccountHandlerToUserAccountHandler signals that an account handler cannot be cast to user account handler

View Source
var ErrCannotCastUserAccountHandlerToVmCommonUserAccountHandler = errors.New("cannot cast user account handler to vm common user account handler")

ErrCannotCastUserAccountHandlerToVmCommonUserAccountHandler signals that an user account handler cannot be cast to vm common user account handler

View Source
var ErrCannotRetrieveTransaction = errors.New("transaction cannot be retrieved")

ErrCannotRetrieveTransaction signals that a transaction was not found

View Source
var ErrDataFieldTooBig = errors.New("data field is too big")

ErrDataFieldTooBig signals that the data field is too big

View Source
var ErrDifferentSenderShardId = errors.New("different shard ID between the transaction sender shard ID and current node shard ID")

ErrDifferentSenderShardId signals that a different shard ID was detected between the sender shard ID and the current node shard ID

View Source
var ErrEmptyQueryHandlerName = errors.New("empty query handler name")

ErrEmptyQueryHandlerName signals that an empty string can not be used to be used in the query handler container

View Source
var ErrEmptyRootHash = errors.New("empty root hash")

ErrEmptyRootHash signals that the current committed root hash is empty

View Source
var ErrInvalidAddressLength = errors.New("invalid address length")

ErrInvalidAddressLength signals that an invalid address length has been provided

View Source
var ErrInvalidChainIDInTransaction = errors.New("invalid chain ID")

ErrInvalidChainIDInTransaction signals that an invalid chain id has been provided in transaction

View Source
var ErrInvalidESDTRole = errors.New("invalid ESDT role")

ErrInvalidESDTRole signals that an invalid ESDT role has been provided

View Source
var ErrInvalidReceiverUsernameLength = errors.New("invalid receiver username length")

ErrInvalidReceiverUsernameLength signals that the length of the receiver username is invalid

View Source
var ErrInvalidSenderUsernameLength = errors.New("invalid sender username length")

ErrInvalidSenderUsernameLength signals that the length of the sender username is invalid

View Source
var ErrInvalidSignatureLength = errors.New("invalid signature length")

ErrInvalidSignatureLength signals that an invalid signature length has been provided

View Source
var ErrInvalidTransactionVersion = errors.New("invalid transaction version")

ErrInvalidTransactionVersion signals that an invalid transaction version has been 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 ErrMetachainOnlyEndpoint = errors.New("the endpoint is only available on metachain nodes")

ErrMetachainOnlyEndpoint signals that an endpoint was called, but it is only available for metachain nodes

View Source
var ErrNegativeOrZeroConsensusGroupSize = errors.New("group size should be a strict positive number")

ErrNegativeOrZeroConsensusGroupSize signals that 0 elements consensus group is not supported

View Source
var ErrNilAccountsAdapter = errors.New("trying to set nil accounts adapter")

ErrNilAccountsAdapter signals that a nil accounts adapter has been provided

View Source
var ErrNilBootstrapComponents = errors.New("nil bootstrap componennts")

ErrNilBootstrapComponents signals that a nil bootstrap components instance has been provided

View Source
var ErrNilCoreComponents = errors.New("nil core components")

ErrNilCoreComponents signals that a nil core components instance has been provided

View Source
var ErrNilCryptoComponents = errors.New("nil crypto components")

ErrNilCryptoComponents signals that a nil crypto components instance has been provided

View Source
var ErrNilDataComponents = errors.New("nil data components")

ErrNilDataComponents signals that a nil data components instance has been provided

View Source
var ErrNilDataPool = errors.New("trying to set nil data pool")

ErrNilDataPool signals that a nil data pool has been provided

View Source
var ErrNilESDTNFTStorageHandler = errors.New("nil esdt and nft storage handler")

ErrNilESDTNFTStorageHandler signals that a nil esdt and nft storage handler has been provided

View Source
var ErrNilHardforkTrigger = errors.New("nil hardfork trigger")

ErrNilHardforkTrigger signals that a nil hardfork trigger has been provided

View Source
var ErrNilMarshalizer = errors.New("trying to set nil marshalizer")

ErrNilMarshalizer signals that a nil marshalizer has been provided

View Source
var ErrNilNetworkComponents = errors.New("nil network components")

ErrNilNetworkComponents signals that a nil network components instance has been provided

View Source
var ErrNilNodeStopChannel = errors.New("nil node stop channel")

ErrNilNodeStopChannel signals that a nil channel for node process stop has been provided

View Source
var ErrNilPeerDenialEvaluator = errors.New("nil peer denial evaluator")

ErrNilPeerDenialEvaluator signals that a nil peer denial evaluator was provided

View Source
var ErrNilPrivateKey = errors.New("trying to set nil private key")

ErrNilPrivateKey signals that a nil private key has been provided

View Source
var ErrNilProcessComponents = errors.New("nil process components")

ErrNilProcessComponents signals that a nil process components instance has been provided

View Source
var ErrNilPubkeyConverter = errors.New("trying to use a nil pubkey converter")

ErrNilPubkeyConverter signals that a nil public key converter has been provided

View Source
var ErrNilQueryHandler = errors.New("nil query handler")

ErrNilQueryHandler signals that a nil query handler has been provided

View Source
var ErrNilRequestedItemsHandler = errors.New("nil requested items handler")

ErrNilRequestedItemsHandler signals that a nil requested items handler was provided

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

ErrNilShardCoordinator signals that a nil shard coordinator has been provided

View Source
var ErrNilSingleSig = errors.New("trying to set nil singlesig")

ErrNilSingleSig signals that a nil singlesig object has been provided

View Source
var ErrNilStateComponents = errors.New("nil state components")

ErrNilStateComponents signals that a nil state components instance has been provided

View Source
var ErrNilStatusComponents = errors.New("nil status components")

ErrNilStatusComponents signals that a nil status components instance has been provided

View Source
var ErrNilStatusComputer = errors.New("nil transaction status computer")

ErrNilStatusComputer signals that user account has a nil data trie

View Source
var ErrNilTxAccumulator = errors.New("nil tx accumulator")

ErrNilTxAccumulator signals that a nil Accumulator instance has been provided

View Source
var ErrNoTxToProcess = errors.New("no transaction to process")

ErrNoTxToProcess signals that no transaction were sent for processing

View Source
var ErrNodeCloseFailed = errors.New("node closing failed ")

ErrNodeCloseFailed signals that the close function of the node failed

View Source
var ErrQueryHandlerAlreadyExists = errors.New("query handler already exists")

ErrQueryHandlerAlreadyExists signals that the query handler is already registered

View Source
var ErrSystemBusyGeneratingTransactions = errors.New("system busy while generating bulk transactions")

ErrSystemBusyGeneratingTransactions signals that to many transactions are trying to get generated

View Source
var ErrTransactionNotFound = errors.New("transaction not found")

ErrTransactionNotFound signals that a transaction was not found

View Source
var ErrTransactionValueLengthTooBig = errors.New("value length is too big")

ErrTransactionValueLengthTooBig signals that a too big value has been given to a transaction

View Source
var ErrUnknownPeerID = errors.New("unknown peer ID")

ErrUnknownPeerID signals that the provided peer is unknown by the current node

View Source
var ErrZeroRoundDurationNotSupported = errors.New("0 round duration time is not supported")

ErrZeroRoundDurationNotSupported signals that 0 seconds round duration is not supported

Functions

func NewNodeRunner added in v1.2.0

func NewNodeRunner(cfgs *config.Configs) (*nodeRunner, error)

NewNodeRunner creates a nodeRunner instance

Types

type HardforkTrigger added in v1.0.102

type HardforkTrigger interface {
	TriggerReceived(payload []byte, data []byte, pkBytes []byte) (bool, error)
	RecordedTriggerMessage() ([]byte, bool)
	Trigger(epoch uint32, withEarlyEndOfEpoch bool) error
	CreateData() []byte
	AddCloser(closer update.Closer) error
	NotifyTriggerReceived() <-chan struct{}
	IsSelfTrigger() bool
	IsInterfaceNil() bool
}

HardforkTrigger defines the behavior of a hardfork trigger

func CreateHardForkTrigger added in v1.2.0

func CreateHardForkTrigger(
	config *config.Config,
	epochConfig *config.EpochConfig,
	shardCoordinator sharding.Coordinator,
	nodesCoordinator sharding.NodesCoordinator,
	nodesShuffledOut update.Closer,
	coreData factory.CoreComponentsHolder,
	stateComponents factory.StateComponentsHolder,
	data factory.DataComponentsHolder,
	crypto factory.CryptoComponentsHolder,
	process factory.ProcessComponentsHolder,
	network factory.NetworkComponentsHolder,
	epochStartNotifier factory.EpochStartNotifierWithConfirm,
	importStartHandler update.ImportStartHandler,
	workingDir string,
) (HardforkTrigger, error)

CreateHardForkTrigger is the hard fork trigger factory TODO: move this to process components

type HeartbeatHandler added in v1.1.3

type HeartbeatHandler interface {
	Monitor() *process.Monitor
	Sender() *process.Sender
	IsInterfaceNil() bool
}

HeartbeatHandler defines the behavior of a heartbeat handler

type NetworkShardingCollector

type NetworkShardingCollector interface {
	UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32)
	UpdatePeerIdSubType(pid core.PeerID, peerSubType core.P2PPeerSubType)
	GetPeerInfo(pid core.PeerID) core.P2PPeerInfo
	IsInterfaceNil() bool
}

NetworkShardingCollector defines the updating methods used by the network sharding component The interface assures that the collected data will be used by the p2p network sharding components

type Node

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

Node is a structure that holds all managed components

func CreateNode added in v1.2.0

func CreateNode(
	config *config.Config,
	bootstrapComponents factory.BootstrapComponentsHandler,
	coreComponents factory.CoreComponentsHandler,
	cryptoComponents factory.CryptoComponentsHandler,
	dataComponents factory.DataComponentsHandler,
	networkComponents factory.NetworkComponentsHandler,
	processComponents factory.ProcessComponentsHandler,
	stateComponents factory.StateComponentsHandler,
	statusComponents factory.StatusComponentsHandler,
	heartbeatComponents factory.HeartbeatComponentsHandler,
	consensusComponents factory.ConsensusComponentsHandler,
	epochConfig config.EpochConfig,
	bootstrapRoundIndex uint64,
	isInImportMode bool,
) (*Node, error)

CreateNode is the node factory

func NewNode

func NewNode(opts ...Option) (*Node, error)

NewNode creates a new Node instance

func (*Node) AddQueryHandler added in v1.0.110

func (n *Node) AddQueryHandler(name string, handler debug.QueryHandler) error

AddQueryHandler adds a query handler in cache

func (*Node) ApplyOptions

func (n *Node) ApplyOptions(opts ...Option) error

ApplyOptions can set up different configurable options of a Node instance

func (*Node) Close added in v1.2.0

func (n *Node) Close() error

Close closes all underlying components

func (*Node) CreateShardedStores

func (n *Node) CreateShardedStores() error

CreateShardedStores instantiate sharded cachers for Transactions and Headers

func (*Node) CreateTransaction

func (n *Node) CreateTransaction(
	nonce uint64,
	value string,
	receiver string,
	receiverUsername []byte,
	sender string,
	senderUsername []byte,
	gasPrice uint64,
	gasLimit uint64,
	dataField []byte,
	signatureHex string,
	chainID string,
	version uint32,
	options uint32,
) (*transaction.Transaction, []byte, error)

CreateTransaction will return a transaction from all the required fields

func (*Node) DecodeAddressPubkey added in v1.0.104

func (n *Node) DecodeAddressPubkey(pk string) ([]byte, error)

DecodeAddressPubkey will try to decode the provided address public key string

func (*Node) DirectTrigger added in v1.0.102

func (n *Node) DirectTrigger(epoch uint32, withEarlyEndOfEpoch bool) error

DirectTrigger will start the hardfork trigger

func (*Node) EncodeAddressPubkey added in v1.0.104

func (n *Node) EncodeAddressPubkey(pk []byte) (string, error)

EncodeAddressPubkey will encode the provided address public key bytes to string

func (*Node) GenerateAndSendBulkTransactions

func (n *Node) GenerateAndSendBulkTransactions(
	receiverHex string,
	value *big.Int,
	numOfTxs uint64,
	sk crypto.PrivateKey,
	whiteList func([]*transaction.Transaction),
	chainID []byte,
	minTxVersion uint32,
) error

GenerateAndSendBulkTransactions is a method for generating and propagating a set of transactions to be processed. It is mainly used for demo purposes

func (*Node) GenerateTransaction

func (n *Node) GenerateTransaction(senderHex string, receiverHex string, value *big.Int, transactionData string, privateKey crypto.PrivateKey, chainID []byte, minTxVersion uint32) (*transaction.Transaction, error)

GenerateTransaction generates a new transaction with sender, receiver, amount and code

func (*Node) GetAccount

func (n *Node) GetAccount(address string) (api.AccountResponse, error)

GetAccount will return account details for a given address

func (*Node) GetAllESDTTokens added in v1.1.12

func (n *Node) GetAllESDTTokens(address string) (map[string]*esdt.ESDigitalToken, error)

GetAllESDTTokens returns all the ESDTs that the given address interacted with

func (*Node) GetAllIssuedESDTs added in v1.1.42

func (n *Node) GetAllIssuedESDTs(tokenType string) ([]string, error)

GetAllIssuedESDTs returns all the issued esdt tokens, works only on metachain

func (*Node) GetAppStatusHandler

func (n *Node) GetAppStatusHandler() core.AppStatusHandler

GetAppStatusHandler will return the current status handler

func (*Node) GetBalance

func (n *Node) GetBalance(address string) (*big.Int, error)

GetBalance gets the balance for a specific address

func (*Node) GetBlockByHash added in v1.0.147

func (n *Node) GetBlockByHash(hash string, withTxs bool) (*api.Block, error)

GetBlockByHash return the block for a given hash

func (*Node) GetBlockByNonce added in v1.0.147

func (n *Node) GetBlockByNonce(nonce uint64, withTxs bool) (*api.Block, error)

GetBlockByNonce returns the block for a given nonce

func (*Node) GetBlockByRound added in v1.2.23

func (n *Node) GetBlockByRound(round uint64, withTxs bool) (*api.Block, error)

func (*Node) GetBootstrapComponents added in v1.2.0

func (n *Node) GetBootstrapComponents() mainFactory.BootstrapComponentsHolder

GetBootstrapComponents returns the bootstrap components

func (*Node) GetCode added in v1.1.22

func (n *Node) GetCode(codeHash []byte) []byte

GetCode returns the code for the given code hash

func (*Node) GetConsensusComponents added in v1.2.0

func (n *Node) GetConsensusComponents() mainFactory.ConsensusComponentsHolder

GetConsensusComponents returns the consensus components

func (*Node) GetConsensusGroupSize added in v1.2.0

func (n *Node) GetConsensusGroupSize() int

GetConsensusGroupSize returns the configured consensus size

func (*Node) GetCoreComponents added in v1.2.0

func (n *Node) GetCoreComponents() mainFactory.CoreComponentsHolder

GetCoreComponents returns the core components

func (*Node) GetCryptoComponents added in v1.2.0

func (n *Node) GetCryptoComponents() mainFactory.CryptoComponentsHolder

GetCryptoComponents returns the crypto components

func (*Node) GetDataComponents added in v1.2.0

func (n *Node) GetDataComponents() mainFactory.DataComponentsHolder

GetDataComponents returns the data components

func (*Node) GetESDTData added in v1.1.39

func (n *Node) GetESDTData(address, tokenID string, nonce uint64) (*esdt.ESDigitalToken, error)

GetESDTData returns the esdt balance and properties from a given account

func (*Node) GetESDTsRoles added in v1.2.10

func (n *Node) GetESDTsRoles(address string) (map[string][]string, error)

GetESDTsRoles returns all the tokens identifiers and roles for the given address

func (*Node) GetESDTsWithRole added in v1.1.58

func (n *Node) GetESDTsWithRole(address string, role string) ([]string, error)

GetESDTsWithRole returns all the tokens with the given role for the given address

func (*Node) GetHardforkTrigger added in v1.2.0

func (n *Node) GetHardforkTrigger() HardforkTrigger

GetHardforkTrigger returns the hardfork trigger

func (*Node) GetHeartbeatComponents added in v1.2.0

func (n *Node) GetHeartbeatComponents() mainFactory.HeartbeatComponentsHolder

GetHeartbeatComponents returns the heartbeat components

func (*Node) GetHeartbeats

func (n *Node) GetHeartbeats() []heartbeatData.PubKeyHeartbeat

GetHeartbeats returns the heartbeat status for each public key defined in genesis.json

func (*Node) GetKeyValuePairs added in v1.1.29

func (n *Node) GetKeyValuePairs(address string) (map[string]string, error)

GetKeyValuePairs returns all the key-value pairs under the address

func (*Node) GetNFTTokenIDsRegisteredByAddress added in v1.1.58

func (n *Node) GetNFTTokenIDsRegisteredByAddress(address string) ([]string, error)

GetNFTTokenIDsRegisteredByAddress returns all the token identifiers for semi or non fungible tokens registered by the address

func (*Node) GetNetworkComponents added in v1.2.0

func (n *Node) GetNetworkComponents() mainFactory.NetworkComponentsHolder

GetNetworkComponents returns the network components

func (*Node) GetPeerInfo added in v1.0.130

func (n *Node) GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error)

GetPeerInfo returns information about a peer id

func (*Node) GetProcessComponents added in v1.2.0

func (n *Node) GetProcessComponents() mainFactory.ProcessComponentsHolder

GetProcessComponents returns the process components

func (*Node) GetProof added in v1.2.23

func (n *Node) GetProof(rootHash string, key string) (*common.GetProofResponse, error)

GetProof returns the Merkle proof for the given address and root hash

func (*Node) GetProofDataTrie added in v1.2.23

func (n *Node) GetProofDataTrie(rootHash string, address string, key string) (*common.GetProofResponse, *common.GetProofResponse, error)

GetProofDataTrie returns the Merkle Proof for the given address, and another Merkle Proof for the given key, if it exists in the dataTrie

func (*Node) GetQueryHandler added in v1.0.110

func (n *Node) GetQueryHandler(name string) (debug.QueryHandler, error)

GetQueryHandler returns the query handler if existing

func (*Node) GetStateComponents added in v1.2.0

func (n *Node) GetStateComponents() mainFactory.StateComponentsHolder

GetStateComponents returns the state components

func (*Node) GetStatusComponents added in v1.2.0

func (n *Node) GetStatusComponents() mainFactory.StatusComponentsHolder

GetStatusComponents returns the status components

func (*Node) GetTokenSupply added in v1.2.16

func (n *Node) GetTokenSupply(token string) (*api.ESDTSupply, error)

GetTokenSupply returns the provided token supply from current shard

func (*Node) GetTransaction

func (n *Node) GetTransaction(txHash string, withResults bool) (*transaction.ApiTransactionResult, error)

GetTransaction gets the transaction based on the given hash. It will search in the cache and the storage and will return the transaction in a format which can be respected by all types of transactions (normal, reward or unsigned)

func (*Node) GetUsername added in v1.1.1

func (n *Node) GetUsername(address string) (string, error)

GetUsername gets the username for a specific address

func (*Node) GetValueForKey added in v1.0.125

func (n *Node) GetValueForKey(address string, key string) (string, error)

GetValueForKey will return the value for a key from a given account

func (*Node) IsInImportMode added in v1.2.0

func (n *Node) IsInImportMode() bool

IsInImportMode returns true if the node is in import mode

func (*Node) IsInterfaceNil

func (n *Node) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Node) IsSelfTrigger added in v1.0.102

func (n *Node) IsSelfTrigger() bool

IsSelfTrigger returns true if the trigger's registered public key matches the self public key

func (*Node) SendBulkTransactions

func (n *Node) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

SendBulkTransactions sends the provided transactions as a bulk, optimizing transfer between nodes

func (*Node) ValidateTransaction

func (n *Node) ValidateTransaction(tx *transaction.Transaction) error

ValidateTransaction will validate a transaction

func (*Node) ValidateTransactionForSimulation added in v1.1.4

func (n *Node) ValidateTransactionForSimulation(tx *transaction.Transaction, checkSignature bool) error

ValidateTransactionForSimulation will validate a transaction for use in transaction simulation process

func (*Node) ValidatorStatisticsApi

func (n *Node) ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)

ValidatorStatisticsApi will return the statistics for all the validators from the initial nodes pub keys

func (*Node) VerifyProof added in v1.2.23

func (n *Node) VerifyProof(rootHash string, address string, proof [][]byte) (bool, error)

VerifyProof verifies the given Merkle proof

type Option

type Option func(*Node) error

Option represents a functional configuration parameter that can operate

over the None struct.

func WithAddressSignatureSize added in v1.1.22

func WithAddressSignatureSize(signatureSize int) Option

WithAddressSignatureSize sets up an addressSignatureSize option for the Node

func WithBootstrapComponents added in v1.2.0

func WithBootstrapComponents(bootstrapComponents factory.BootstrapComponentsHandler) Option

WithBootstrapComponents sets up the Node bootstrap components

func WithBootstrapRoundIndex

func WithBootstrapRoundIndex(bootstrapRoundIndex uint64) Option

WithBootstrapRoundIndex sets up a bootstrapRoundIndex option for the Node

func WithConsensusComponents added in v1.2.0

func WithConsensusComponents(consensusComponents factory.ConsensusComponentsHandler) Option

WithConsensusComponents sets up the Node consensus components

func WithConsensusGroupSize

func WithConsensusGroupSize(consensusGroupSize int) Option

WithConsensusGroupSize sets up the consensus group size option for the Node

func WithConsensusType

func WithConsensusType(consensusType string) Option

WithConsensusType sets up the consensus type option for the Node

func WithCoreComponents added in v1.2.0

func WithCoreComponents(coreComponents factory.CoreComponentsHandler) Option

WithCoreComponents sets up the Node core components

func WithCryptoComponents added in v1.2.0

func WithCryptoComponents(cryptoComponents factory.CryptoComponentsHandler) Option

WithCryptoComponents sets up Node crypto components

func WithDataComponents added in v1.2.0

func WithDataComponents(dataComponents factory.DataComponentsHandler) Option

WithDataComponents sets up the Node data components

func WithESDTNFTStorageHandler added in v1.3.3

func WithESDTNFTStorageHandler(storageHandler vmcommon.ESDTNFTStorageHandler) Option

WithESDTNFTStorageHandler sets the esdt nft storage handler

func WithEnableSignTxWithHashEpoch added in v1.1.12

func WithEnableSignTxWithHashEpoch(enableSignTxWithHashEpoch uint32) Option

WithEnableSignTxWithHashEpoch sets up enableSignTxWithHashEpoch for the node

func WithGenesisTime

func WithGenesisTime(genesisTime time.Time) Option

WithGenesisTime sets up the genesis time option for the Node

func WithHardforkTrigger added in v1.0.102

func WithHardforkTrigger(hardforkTrigger HardforkTrigger) Option

WithHardforkTrigger sets up a hardfork trigger

func WithHeartbeatComponents added in v1.2.0

func WithHeartbeatComponents(heartbeatComponents factory.HeartbeatComponentsHandler) Option

WithHeartbeatComponents sets up the Node heartbeat components

func WithImportMode added in v1.1.15

func WithImportMode(importMode bool) Option

WithImportMode sets up the flag if the node is running in import mode

func WithInitialNodesPubKeys

func WithInitialNodesPubKeys(pubKeys map[uint32][]string) Option

WithInitialNodesPubKeys sets up the initial nodes public key option for the Node

func WithNetworkComponents added in v1.2.0

func WithNetworkComponents(networkComponents factory.NetworkComponentsHandler) Option

WithNetworkComponents sets up the Node network components

func WithNodeStopChannel added in v1.0.103

func WithNodeStopChannel(channel chan endProcess.ArgEndProcess) Option

WithNodeStopChannel sets up the channel which will handle closing the node

func WithPeerDenialEvaluator added in v1.0.133

func WithPeerDenialEvaluator(handler p2p.PeerDenialEvaluator) Option

WithPeerDenialEvaluator sets up a peer denial evaluator for the Node

func WithProcessComponents added in v1.2.0

func WithProcessComponents(processComponents factory.ProcessComponentsHandler) Option

WithProcessComponents sets up the Node process components

func WithPublicKeySize added in v1.0.103

func WithPublicKeySize(publicKeySize int) Option

WithPublicKeySize sets up a publicKeySize option for the Node

func WithRequestedItemsHandler

func WithRequestedItemsHandler(requestedItemsHandler dataRetriever.RequestedItemsHandler) Option

WithRequestedItemsHandler sets up a requested items handler for the Node

func WithRoundDuration

func WithRoundDuration(roundDuration uint64) Option

WithRoundDuration sets up the round duration option for the Node

func WithStateComponents added in v1.2.0

func WithStateComponents(stateComponents factory.StateComponentsHandler) Option

WithStateComponents sets up the Node state components

func WithStatusComponents added in v1.2.0

func WithStatusComponents(statusComponents factory.StatusComponentsHandler) Option

WithStatusComponents sets up the Node status components

func WithTxAccumulator

func WithTxAccumulator(accumulator core.Accumulator) Option

WithTxAccumulator sets up a transaction accumulator handler for the Node

func WithValidatorSignatureSize added in v1.1.22

func WithValidatorSignatureSize(signatureSize int) Option

WithValidatorSignatureSize sets up a validatorSignatureSize option for the Node

type P2PAntifloodHandler

type P2PAntifloodHandler interface {
	CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error
	ResetForTopic(topic string)
	SetMaxMessagesForTopic(topic string, maxNum uint32)
	ApplyConsensusSize(size int)
	BlacklistPeer(peer core.PeerID, reason string, duration time.Duration)
	IsInterfaceNil() bool
}

P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages

type P2PMessenger

type P2PMessenger interface {
	io.Closer
	Bootstrap() error
	Broadcast(topic string, buff []byte)
	BroadcastOnChannel(channel string, topic string, buff []byte)
	BroadcastOnChannelBlocking(channel string, topic string, buff []byte) error
	CreateTopic(name string, createChannelForTopic bool) error
	HasTopic(name string) bool
	RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error
	PeerAddresses(pid core.PeerID) []string
	IsConnectedToTheNetwork() bool
	ID() core.PeerID
	Peers() []core.PeerID
	IsInterfaceNil() bool
}

P2PMessenger defines a subset of the p2p.Messenger interface

type Throttler added in v1.0.125

type Throttler interface {
	CanProcess() bool
	StartProcessing()
	EndProcessing()
	IsInterfaceNil() bool
}

Throttler can monitor the number of the currently running go routines

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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