Documentation ¶
Index ¶
- Constants
- Variables
- func NewNodeRunner(cfgs *config.Configs) (*nodeRunner, error)
- type HardforkTrigger
- type HeartbeatHandler
- type NetworkShardingCollector
- type Node
- func (n *Node) AddQueryHandler(name string, handler debug.QueryHandler) error
- func (n *Node) ApplyOptions(opts ...Option) error
- func (n *Node) Close() error
- func (n *Node) CreateShardedStores() error
- func (n *Node) CreateTransaction(nonce uint64, value string, receiver string, receiverUsername []byte, ...) (*transaction.Transaction, []byte, error)
- func (n *Node) DecodeAddressPubkey(pk string) ([]byte, error)
- func (n *Node) DirectTrigger(epoch uint32, withEarlyEndOfEpoch bool) error
- func (n *Node) EncodeAddressPubkey(pk []byte) (string, error)
- func (n *Node) GenerateAndSendBulkTransactions(receiverHex string, value *big.Int, numOfTxs uint64, sk crypto.PrivateKey, ...) error
- func (n *Node) GenerateTransaction(senderHex string, receiverHex string, value *big.Int, transactionData string, ...) (*transaction.Transaction, error)
- func (n *Node) GetAccount(address string) (api.AccountResponse, error)
- func (n *Node) GetAllESDTTokens(address string) (map[string]*esdt.ESDigitalToken, error)
- func (n *Node) GetAllIssuedESDTs(tokenType string) ([]string, error)
- func (n *Node) GetAppStatusHandler() core.AppStatusHandler
- func (n *Node) GetBalance(address string) (*big.Int, error)
- func (n *Node) GetBlockByHash(hash string, withTxs bool) (*api.Block, error)
- func (n *Node) GetBlockByNonce(nonce uint64, withTxs bool) (*api.Block, error)
- func (n *Node) GetBootstrapComponents() mainFactory.BootstrapComponentsHolder
- func (n *Node) GetCode(codeHash []byte) []byte
- func (n *Node) GetConsensusComponents() mainFactory.ConsensusComponentsHolder
- func (n *Node) GetConsensusGroupSize() int
- func (n *Node) GetCoreComponents() mainFactory.CoreComponentsHolder
- func (n *Node) GetCryptoComponents() mainFactory.CryptoComponentsHolder
- func (n *Node) GetDataComponents() mainFactory.DataComponentsHolder
- func (n *Node) GetESDTData(address, tokenID string, nonce uint64) (*esdt.ESDigitalToken, error)
- func (n *Node) GetESDTsRoles(address string) (map[string][]string, error)
- func (n *Node) GetESDTsWithRole(address string, role string) ([]string, error)
- func (n *Node) GetHardforkTrigger() HardforkTrigger
- func (n *Node) GetHeartbeatComponents() mainFactory.HeartbeatComponentsHolder
- func (n *Node) GetHeartbeats() []heartbeatData.PubKeyHeartbeat
- func (n *Node) GetKeyValuePairs(address string) (map[string]string, error)
- func (n *Node) GetNFTTokenIDsRegisteredByAddress(address string) ([]string, error)
- func (n *Node) GetNetworkComponents() mainFactory.NetworkComponentsHolder
- func (n *Node) GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error)
- func (n *Node) GetProcessComponents() mainFactory.ProcessComponentsHolder
- func (n *Node) GetQueryHandler(name string) (debug.QueryHandler, error)
- func (n *Node) GetStateComponents() mainFactory.StateComponentsHolder
- func (n *Node) GetStatusComponents() mainFactory.StatusComponentsHolder
- func (n *Node) GetTransaction(txHash string, withResults bool) (*transaction.ApiTransactionResult, error)
- func (n *Node) GetUsername(address string) (string, error)
- func (n *Node) GetValueForKey(address string, key string) (string, error)
- func (n *Node) IsInImportMode() bool
- func (n *Node) IsInterfaceNil() bool
- func (n *Node) IsSelfTrigger() bool
- func (n *Node) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)
- func (n *Node) ValidateTransaction(tx *transaction.Transaction) error
- func (n *Node) ValidateTransactionForSimulation(tx *transaction.Transaction, checkSignature bool) error
- func (n *Node) ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)
- type Option
- func WithAddressSignatureSize(signatureSize int) Option
- func WithBootstrapComponents(bootstrapComponents factory.BootstrapComponentsHandler) Option
- func WithBootstrapRoundIndex(bootstrapRoundIndex uint64) Option
- func WithConsensusComponents(consensusComponents factory.ConsensusComponentsHandler) Option
- func WithConsensusGroupSize(consensusGroupSize int) Option
- func WithConsensusType(consensusType string) Option
- func WithCoreComponents(coreComponents factory.CoreComponentsHandler) Option
- func WithCryptoComponents(cryptoComponents factory.CryptoComponentsHandler) Option
- func WithDataComponents(dataComponents factory.DataComponentsHandler) Option
- func WithEnableSignTxWithHashEpoch(enableSignTxWithHashEpoch uint32) Option
- func WithGenesisTime(genesisTime time.Time) Option
- func WithHardforkTrigger(hardforkTrigger HardforkTrigger) Option
- func WithHeartbeatComponents(heartbeatComponents factory.HeartbeatComponentsHandler) Option
- func WithImportMode(importMode bool) Option
- func WithInitialNodesPubKeys(pubKeys map[uint32][]string) Option
- func WithNetworkComponents(networkComponents factory.NetworkComponentsHandler) Option
- func WithNetworkShardingCollector(networkShardingCollector NetworkShardingCollector) Option
- func WithNodeRedundancyHandler(nodeRedundancyHandler consensus.NodeRedundancyHandler) Option
- func WithNodeStopChannel(channel chan endProcess.ArgEndProcess) Option
- func WithPeerDenialEvaluator(handler p2p.PeerDenialEvaluator) Option
- func WithProcessComponents(processComponents factory.ProcessComponentsHandler) Option
- func WithPublicKeySize(publicKeySize int) Option
- func WithRequestedItemsHandler(requestedItemsHandler dataRetriever.RequestedItemsHandler) Option
- func WithRoundDuration(roundDuration uint64) Option
- func WithStateComponents(stateComponents factory.StateComponentsHandler) Option
- func WithStatusComponents(statusComponents factory.StatusComponentsHandler) Option
- func WithTxAccumulator(accumulator core.Accumulator) Option
- func WithValidatorSignatureSize(signatureSize int) Option
- type P2PAntifloodHandler
- type P2PMessenger
- type Throttler
Constants ¶
const (
// SendTransactionsPipe is the pipe used for sending new transactions
SendTransactionsPipe = "send transactions pipe"
)
const (
// SoftRestartMessage is the custom message used when the node does a soft restart operation
SoftRestartMessage = "Shuffled out - soft restart"
)
Variables ¶
var ErrAccountNotFound = errors.New("account not found")
ErrAccountNotFound signals that an account was not found in trie
var ErrCannotRetrieveTransaction = errors.New("transaction cannot be retrieved")
ErrCannotRetrieveTransaction signals that a transaction was not found
var ErrDataFieldTooBig = errors.New("data field is too big")
ErrDataFieldTooBig signals that the data field is too big
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
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
var ErrInvalidAddressLength = errors.New("invalid address length")
ErrInvalidAddressLength signals that an invalid address length has been provided
var ErrInvalidChainIDInTransaction = errors.New("invalid chain ID")
ErrInvalidChainIDInTransaction signals that an invalid chain id has been provided in transaction
var ErrInvalidESDTRole = errors.New("invalid ESDT role")
ErrInvalidESDTRole signals that an invalid ESDT role has been provided
var ErrInvalidReceiverUsernameLength = errors.New("invalid receiver username length")
ErrInvalidReceiverUsernameLength signals that the length of the receiver username is invalid
var ErrInvalidSenderUsernameLength = errors.New("invalid sender username length")
ErrInvalidSenderUsernameLength signals that the length of the sender username is invalid
var ErrInvalidSignatureLength = errors.New("invalid signature length")
ErrInvalidSignatureLength signals that an invalid signature length has been provided
var ErrInvalidTransactionVersion = errors.New("invalid transaction version")
ErrInvalidTransactionVersion signals that an invalid transaction version has been provided
var ErrInvalidValue = errors.New("invalid value")
ErrInvalidValue signals that an invalid value has been provided such as NaN to an integer field
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
var ErrNegativeOrZeroConsensusGroupSize = errors.New("group size should be a strict positive number")
ErrNegativeOrZeroConsensusGroupSize signals that 0 elements consensus group is not supported
var ErrNilAccountsAdapter = errors.New("trying to set nil accounts adapter")
ErrNilAccountsAdapter signals that a nil accounts adapter has been provided
var ErrNilBlockHeader = errors.New("nil block header")
ErrNilBlockHeader signals that current block header is nil
var ErrNilBootstrapComponents = errors.New("nil bootstrap componennts")
ErrNilBootstrapComponents signals that a nil bootstrap components instance has been provided
var ErrNilCoreComponents = errors.New("nil core components")
ErrNilCoreComponents signals that a nil core components instance has been provided
var ErrNilCryptoComponents = errors.New("nil crypto components")
ErrNilCryptoComponents signals that a nil crypto components instance has been provided
var ErrNilDataComponents = errors.New("nil data components")
ErrNilDataComponents signals that a nil data components instance has been provided
var ErrNilDataPool = errors.New("trying to set nil data pool")
ErrNilDataPool signals that a nil data pool has been provided
var ErrNilHardforkTrigger = errors.New("nil hardfork trigger")
ErrNilHardforkTrigger signals that a nil hardfork trigger has been provided
var ErrNilMarshalizer = errors.New("trying to set nil marshalizer")
ErrNilMarshalizer signals that a nil marshalizer has been provided
var ErrNilNetworkComponents = errors.New("nil network components")
ErrNilNetworkComponents signals that a nil network components instance has been provided
var ErrNilNetworkShardingCollector = errors.New("nil network sharding collector")
ErrNilNetworkShardingCollector defines the error for setting a nil network sharding collector
var ErrNilNodeRedundancyHandler = errors.New("nil node redundancy handler")
ErrNilNodeRedundancyHandler signals that provided node redundancy handler is nil
var ErrNilNodeStopChannel = errors.New("nil node stop channel")
ErrNilNodeStopChannel signals that a nil channel for node process stop has been provided
var ErrNilPeerDenialEvaluator = errors.New("nil peer denial evaluator")
ErrNilPeerDenialEvaluator signals that a nil peer denial evaluator was provided
var ErrNilPrivateKey = errors.New("trying to set nil private key")
ErrNilPrivateKey signals that a nil private key has been provided
var ErrNilProcessComponents = errors.New("nil process components")
ErrNilProcessComponents signals that a nil process components instance has been provided
var ErrNilPubkeyConverter = errors.New("trying to use a nil pubkey converter")
ErrNilPubkeyConverter signals that a nil public key converter has been provided
var ErrNilQueryHandler = errors.New("nil query handler")
ErrNilQueryHandler signals that a nil query handler has been provided
var ErrNilRequestedItemsHandler = errors.New("nil requested items handler")
ErrNilRequestedItemsHandler signals that a nil requested items handler was provided
var ErrNilShardCoordinator = errors.New("trying to set nil shard coordinator")
ErrNilShardCoordinator signals that a nil shard coordinator has been provided
var ErrNilSingleSig = errors.New("trying to set nil singlesig")
ErrNilSingleSig signals that a nil singlesig object has been provided
var ErrNilStateComponents = errors.New("nil state components")
ErrNilStateComponents signals that a nil state components instance has been provided
var ErrNilStatusComponents = errors.New("nil status components")
ErrNilStatusComponents signals that a nil status components instance has been provided
var ErrNilStatusComputer = errors.New("nil transaction status computer")
ErrNilStatusComputer signals that user account has a nil data trie
var ErrNilTxAccumulator = errors.New("nil tx accumulator")
ErrNilTxAccumulator signals that a nil Accumulator instance has been provided
var ErrNoTxToProcess = errors.New("no transaction to process")
ErrNoTxToProcess signals that no transaction were sent for processing
var ErrNodeCloseFailed = errors.New("node closing failed ")
ErrNodeCloseFailed signals that the close function of the node failed
var ErrQueryHandlerAlreadyExists = errors.New("query handler already exists")
ErrQueryHandlerAlreadyExists signals that the query handler is already registered
var ErrSystemBusyGeneratingTransactions = errors.New("system busy while generating bulk transactions")
ErrSystemBusyGeneratingTransactions signals that to many transactions are trying to get generated
var ErrTransactionNotFound = errors.New("transaction not found")
ErrTransactionNotFound signals that a transaction was not found
var ErrTransactionValueLengthTooBig = errors.New("value length is too big")
ErrTransactionValueLengthTooBig signals that a too big value has been given to a transaction
var ErrUnknownPeerID = errors.New("unknown peer ID")
ErrUnknownPeerID signals that the provided peer is unknown by the current node
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
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, bootstrapRoundIndex uint64, isInImportMode bool, ) (*Node, error)
CreateNode is the node factory
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 ¶
ApplyOptions can set up different configurable options of a Node instance
func (*Node) CreateShardedStores ¶
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
DecodeAddressPubkey will try to decode the provided address public key string
func (*Node) DirectTrigger ¶ added in v1.0.102
DirectTrigger will start the hardfork trigger
func (*Node) EncodeAddressPubkey ¶ added in v1.0.104
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
GetAllESDTTokens returns all the ESDTs that the given address interacted with
func (*Node) GetAllIssuedESDTs ¶ added in v1.1.42
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 ¶
GetBalance gets the balance for a specific address
func (*Node) GetBlockByHash ¶ added in v1.0.147
GetBlockByHash return the block for a given hash
func (*Node) GetBlockByNonce ¶ added in v1.0.147
GetBlockByNonce returns the block for a given nonce
func (*Node) GetBootstrapComponents ¶ added in v1.2.0
func (n *Node) GetBootstrapComponents() mainFactory.BootstrapComponentsHolder
GetBootstrapComponents returns the bootstrap components
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
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
GetESDTData returns the esdt balance and properties from a given account
func (*Node) GetESDTsRoles ¶ added in v1.2.10
GetESDTsRoles returns all the tokens identifiers and roles for the given address
func (*Node) GetESDTsWithRole ¶ added in v1.1.58
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
GetKeyValuePairs returns all the key-value pairs under the address
func (*Node) GetNFTTokenIDsRegisteredByAddress ¶ added in v1.1.58
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) 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) 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
GetUsername gets the username for a specific address
func (*Node) GetValueForKey ¶ added in v1.0.125
GetValueForKey will return the value for a key from a given account
func (*Node) IsInImportMode ¶ added in v1.2.0
IsInImportMode returns true if the node is in import mode
func (*Node) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
func (*Node) IsSelfTrigger ¶ added in v1.0.102
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
type Option ¶
Option represents a functional configuration parameter that can operate
over the None struct.
func WithAddressSignatureSize ¶ added in v1.1.22
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 ¶
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 ¶
WithConsensusGroupSize sets up the consensus group size option for the Node
func WithConsensusType ¶
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 WithEnableSignTxWithHashEpoch ¶ added in v1.1.12
WithEnableSignTxWithHashEpoch sets up enableSignTxWithHashEpoch for the node
func WithGenesisTime ¶
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
WithImportMode sets up the flag if the node is running in import mode
func WithInitialNodesPubKeys ¶
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 WithNetworkShardingCollector ¶
func WithNetworkShardingCollector(networkShardingCollector NetworkShardingCollector) Option
WithNetworkShardingCollector sets up a network sharding updater for the Node
func WithNodeRedundancyHandler ¶ added in v1.1.31
func WithNodeRedundancyHandler(nodeRedundancyHandler consensus.NodeRedundancyHandler) Option
WithNodeRedundancyHandler sets up a node redundancy handler for the node
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
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 ¶
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
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