chainservice

package
v2.5.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOption

type BuildOption func(*Builder)

BuildOption customizes a Builder before it registers protocols. It exists so callers that only have a config.Config — itx.NewServer and everything above it — can still reach the protocol-level functional options, without any of those options having to travel through a package-level variable.

func WithRewardingOptions

func WithRewardingOptions(opts ...rewarding.Option) BuildOption

WithRewardingOptions supplies extra options to rewarding.NewProtocol.

func WithStakingOptions

func WithStakingOptions(opts ...staking.Option) BuildOption

WithStakingOptions supplies extra options to staking.NewProtocol.

type Builder

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

Builder is a builder to build chainservice

func NewBuilder

func NewBuilder(cfg config.Config, opts ...BuildOption) *Builder

NewBuilder creates a new chainservice builder

func (*Builder) Build

func (builder *Builder) Build() (*ChainService, error)

Build builds a chainservice

func (*Builder) BuildForSubChain

func (builder *Builder) BuildForSubChain() (*ChainService, error)

BuildForSubChain builds a chainservice for subchain

func (*Builder) BuildForTest

func (builder *Builder) BuildForTest() (*ChainService, error)

BuildForTest builds a chainservice for test purpose

func (*Builder) SetActionPool

func (builder *Builder) SetActionPool(ap actpool.ActPool) *Builder

SetActionPool sets the action pool instance

func (*Builder) SetBlockDAO

func (builder *Builder) SetBlockDAO(bd blockdao.BlockDAO) *Builder

SetBlockDAO sets the blockdao instance

func (*Builder) SetBlockSync

func (builder *Builder) SetBlockSync(bs blocksync.BlockSync) *Builder

SetBlockSync sets the block sync instance

func (*Builder) SetBlockchain

func (builder *Builder) SetBlockchain(bc blockchain.Blockchain) *Builder

SetBlockchain sets the blockchain instance

func (*Builder) SetElectionCommittee

func (builder *Builder) SetElectionCommittee(c committee.Committee) *Builder

SetElectionCommittee sets the election committee instance

func (*Builder) SetFactory

func (builder *Builder) SetFactory(f factory.Factory) *Builder

SetFactory sets the factory instance

func (*Builder) SetP2PAgent

func (builder *Builder) SetP2PAgent(agent p2p.Agent) *Builder

SetP2PAgent sets the P2PAgent instance

func (*Builder) SetRPCStats

func (builder *Builder) SetRPCStats(stats *nodestats.APILocalStats) *Builder

SetRPCStats sets the RPCStats instance

func (*Builder) SetRewardingOptions

func (builder *Builder) SetRewardingOptions(opts ...rewarding.Option) *Builder

SetRewardingOptions appends options passed to rewarding.NewProtocol.

func (*Builder) SetStakingOptions

func (builder *Builder) SetStakingOptions(opts ...staking.Option) *Builder

SetStakingOptions appends options passed to staking.NewProtocol.

type ChainService

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

ChainService is a blockchain service with all blockchain components.

func (*ChainService) ActionPool

func (cs *ChainService) ActionPool() actpool.ActPool

ActionPool returns the Action pool

func (*ChainService) BlockDAO

func (cs *ChainService) BlockDAO() blockdao.BlockDAO

BlockDAO returns the blockdao

func (*ChainService) BlockSync

func (cs *ChainService) BlockSync() blocksync.BlockSync

BlockSync returns the block syncer

func (*ChainService) Blockchain

func (cs *ChainService) Blockchain() blockchain.Blockchain

Blockchain returns the Blockchain

func (*ChainService) ChainID

func (cs *ChainService) ChainID() uint32

ChainID returns ChainID.

func (*ChainService) Consensus

func (cs *ChainService) Consensus() consensus.Consensus

Consensus returns the consensus instance

func (*ChainService) Filter added in v2.3.0

func (cs *ChainService) Filter(messageType iotexrpc.MessageType, msg proto.Message, cap int) bool

func (*ChainService) HandleAction

func (cs *ChainService) HandleAction(ctx context.Context, actPb *iotextypes.Action) error

HandleAction handles incoming action request.

func (*ChainService) HandleActionHash

func (cs *ChainService) HandleActionHash(ctx context.Context, actHash hash.Hash256, from string) error

HandleActionHash handles incoming action hash request.

func (*ChainService) HandleActionRequest

func (cs *ChainService) HandleActionRequest(ctx context.Context, peer peer.AddrInfo, actHash hash.Hash256) error

func (*ChainService) HandleBlock

func (cs *ChainService) HandleBlock(ctx context.Context, peer string, pbBlock *iotextypes.Block) error

HandleBlock handles incoming block request.

func (*ChainService) HandleBundle added in v2.4.0

func (cs *ChainService) HandleBundle(ctx context.Context, bundlePb *iotextypes.Bundle) error

HandleBundle handles incoming bundle request.

func (*ChainService) HandleConsensusMsg

func (cs *ChainService) HandleConsensusMsg(msg *iotextypes.ConsensusMessage) error

HandleConsensusMsg handles incoming consensus message.

func (*ChainService) HandleNodeInfo

func (cs *ChainService) HandleNodeInfo(ctx context.Context, peer string, msg *iotextypes.NodeInfo) error

HandleNodeInfo handles nodeinfo message.

func (*ChainService) HandleNodeInfoRequest

func (cs *ChainService) HandleNodeInfoRequest(ctx context.Context, peer peer.AddrInfo, msg *iotextypes.NodeInfoRequest) error

HandleNodeInfoRequest handles request node info message

func (*ChainService) HandleSyncRequest

func (cs *ChainService) HandleSyncRequest(ctx context.Context, peer peer.AddrInfo, sync *iotexrpc.BlockSync) error

HandleSyncRequest handles incoming sync request.

func (*ChainService) NewAPIServer

func (cs *ChainService) NewAPIServer(cfg api.Config, archive bool) (*api.ServerV2, error)

NewAPIServer creates a new api server

func (*ChainService) NodeInfoManager

func (cs *ChainService) NodeInfoManager() *nodeinfo.InfoManager

NodeInfoManager returns the delegate manager

func (*ChainService) Pause added in v2.2.1

func (cs *ChainService) Pause(pause bool)

func (*ChainService) Registry

func (cs *ChainService) Registry() *protocol.Registry

Registry returns a pointer to the registry

func (*ChainService) ReportFullness

func (cs *ChainService) ReportFullness(_ context.Context, messageType iotexrpc.MessageType, msg proto.Message, fullness float32)

ReportFullness switch on or off block sync

func (*ChainService) Start

func (cs *ChainService) Start(ctx context.Context) error

Start starts the server

func (*ChainService) StateFactory

func (cs *ChainService) StateFactory() factory.Factory

StateFactory returns the state factory

func (*ChainService) Stop

func (cs *ChainService) Stop(ctx context.Context) error

Stop stops the server

func (*ChainService) UpdateProducerKeys added in v2.3.7

func (cs *ChainService) UpdateProducerKeys(keys []crypto.PrivateKey) error

UpdateProducerKeys refreshes consensus and node-info producer keys without restarting the process.

Jump to

Keyboard shortcuts

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