cn

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: GPL-3.0 Imports: 57 Imported by: 0

Documentation

Overview

Package cn implements components related to Klaytn Node.

Package cn is a generated GoMock package.

Package cn is a generated GoMock package.

Index

Constants

View Source
const (
	BlockChannel uint = iota
	TxChannel
	ConsensusChannel
	MiscChannel
	MaxChannel
)
View Source
const (

	// DefaultMaxResendTxCount is the number of resending transactions to peer in order to prevent the txs from missing.
	DefaultMaxResendTxCount = 1000

	// DefaultTxResendInterval is the second of resending transactions period.
	DefaultTxResendInterval = 4
)
View Source
const (
	// Protocol messages belonging to klay/62
	StatusMsg                   = 0x00
	NewBlockHashesMsg           = 0x01
	BlockHeaderFetchRequestMsg  = 0x02
	BlockHeaderFetchResponseMsg = 0x03
	BlockBodiesFetchRequestMsg  = 0x04
	BlockBodiesFetchResponseMsg = 0x05
	TxMsg                       = 0x06
	BlockHeadersRequestMsg      = 0x07
	BlockHeadersMsg             = 0x08
	BlockBodiesRequestMsg       = 0x09
	BlockBodiesMsg              = 0x0a
	NewBlockMsg                 = 0x0b

	// Protocol messages belonging to klay/63
	NodeDataRequestMsg = 0x0c
	NodeDataMsg        = 0x0d
	ReceiptsRequestMsg = 0x0e
	ReceiptsMsg        = 0x0f

	MsgCodeEnd = 0x10
)

Klaytn protocol message codes TODO-Klaytn-Issue751 Protocol message should be refactored. Present code is not used.

View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNetworkIdMismatch
	ErrGenesisBlockMismatch
	ErrChainIDMismatch
	ErrNoStatusMsg
	ErrExtraStatusMsg
	ErrSuspendedPeer
	ErrUnexpectedTxType
	ErrFailedToGetStateDB
)
View Source
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message

Variables

View Source
var ChannelOfMessage = map[uint64]int{
	StatusMsg:                   p2p.ConnDefault,
	NewBlockHashesMsg:           p2p.ConnDefault,
	BlockHeaderFetchRequestMsg:  p2p.ConnDefault,
	BlockHeaderFetchResponseMsg: p2p.ConnDefault,
	BlockBodiesFetchRequestMsg:  p2p.ConnDefault,
	BlockBodiesFetchResponseMsg: p2p.ConnDefault,
	TxMsg:                       p2p.ConnTxMsg,
	BlockHeadersRequestMsg:      p2p.ConnDefault,
	BlockHeadersMsg:             p2p.ConnDefault,
	BlockBodiesRequestMsg:       p2p.ConnDefault,
	BlockBodiesMsg:              p2p.ConnDefault,
	NewBlockMsg:                 p2p.ConnDefault,

	NodeDataRequestMsg: p2p.ConnDefault,
	NodeDataMsg:        p2p.ConnDefault,
	ReceiptsRequestMsg: p2p.ConnDefault,
	ReceiptsMsg:        p2p.ConnDefault,
}

ChannelOfMessage is a map with the index of the channel per message

View Source
var ConcurrentOfChannel = []int{
	p2p.ConnDefault: 1,
	p2p.ConnTxMsg:   3,
}
View Source
var DefaultConfig = Config{
	SyncMode:          downloader.FullSync,
	NetworkId:         params.CypressNetworkId,
	LevelDBCacheSize:  768,
	TrieCacheSize:     512,
	TrieTimeout:       5 * time.Minute,
	TrieBlockInterval: blockchain.DefaultBlockInterval,
	GasPrice:          big.NewInt(18 * params.Ston),

	TxPool: blockchain.DefaultTxPoolConfig,
	GPO: gasprice.Config{
		Blocks:     20,
		Percentile: 60,
	},
	WsEndpoint: "localhost:8546",

	Istanbul: *istanbul.DefaultConfig,
}

DefaultConfig contains default settings for use on the Klaytn main net.

View Source
var ProtocolLengths = []uint64{17, 8}

ProtocolLengths are the number of implemented message corresponding to different protocol versions.

View Source
var ProtocolName = "klay"

ProtocolName is the official short name of the protocol used during capability negotiation.

View Source
var ProtocolVersions = []uint{klay63, klay62}

ProtocolVersions are the upported versions of the klay protocol (first is primary).

Functions

func CreateCliqueEngine

func CreateCliqueEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, db database.DBManager) consensus.Engine

CreateConsensusEngine creates the required type of consensus engine instance for a Klaytn service

func CreateConsensusEngine

func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, db database.DBManager, gov *governance.Governance, nodetype p2p.ConnType) consensus.Engine

CreateConsensusEngine creates the required type of consensus engine instance for a Klaytn service

func CreateDB

func CreateDB(ctx *node.ServiceContext, config *Config, name string) database.DBManager

CreateDB creates the chain database.

func NewBloomIndexer

func NewBloomIndexer(db database.DBManager, size uint64) *blockchain.ChainIndexer

NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.

Types

type BlockChain added in v1.2.0

type BlockChain interface {
	Genesis() *types.Block

	CurrentBlock() *types.Block
	CurrentFastBlock() *types.Block
	HasBlock(hash common.Hash, number uint64) bool
	GetBlock(hash common.Hash, number uint64) *types.Block
	GetBlockByHash(hash common.Hash) *types.Block
	GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash

	CurrentHeader() *types.Header
	HasHeader(hash common.Hash, number uint64) bool
	GetHeader(hash common.Hash, number uint64) *types.Header
	GetHeaderByHash(hash common.Hash) *types.Header
	GetHeaderByNumber(number uint64) *types.Header

	GetTd(hash common.Hash, number uint64) *big.Int
	GetTdByHash(hash common.Hash) *big.Int

	GetBodyRLP(hash common.Hash) rlp.RawValue

	GetReceiptsByBlockHash(blockHash common.Hash) types.Receipts

	InsertChain(chain types.Blocks) (int, error)
	TrieNode(hash common.Hash) ([]byte, error)
	Config() *params.ChainConfig
	State() (*state.StateDB, error)
	Rollback(chain []common.Hash)
	InsertReceiptChain(blockChain types.Blocks, receiptChain []types.Receipts) (int, error)
	InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error)
	FastSyncCommitHead(hash common.Hash) error
}

BlockChain is an interface of blockchain.BlockChain used by ProtocolManager.

type BloomIndexer

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

BloomIndexer implements a blockchain.ChainIndexer, building up a rotated bloom bits index for the Klaytn header bloom filters, permitting blazing fast filtering.

func (*BloomIndexer) Commit

func (b *BloomIndexer) Commit() error

Commit implements blockchain.ChainIndexerBackend, finalizing the bloom section and writing it out into the database.

func (*BloomIndexer) Process

func (b *BloomIndexer) Process(header *types.Header)

Process implements blockchain.ChainIndexerBackend, adding a new header's bloom into the index.

func (*BloomIndexer) Reset

func (b *BloomIndexer) Reset(section uint64, lastSectionHead common.Hash) error

Reset implements blockchain.ChainIndexerBackend, starting a new bloombits index section.

type ByPassValidator

type ByPassValidator struct{}

func (ByPassValidator) ValidatePeerType

func (v ByPassValidator) ValidatePeerType(addr common.Address) error

type CN

type CN struct {
	APIBackend *CNAPIBackend
	// contains filtered or unexported fields
}

CN implements the Klaytn consensus node service.

func New

func New(ctx *node.ServiceContext, config *Config) (*CN, error)

New creates a new CN object (including the initialisation of the common CN object)

func (*CN) APIs

func (s *CN) APIs() []rpc.API

APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.

func (*CN) AccountManager

func (s *CN) AccountManager() *accounts.Manager

func (*CN) AddLesServer

func (s *CN) AddLesServer(ls LesServer)

func (*CN) BlockChain

func (s *CN) BlockChain() *blockchain.BlockChain

func (*CN) ChainDB

func (s *CN) ChainDB() database.DBManager

func (*CN) Components

func (s *CN) Components() []interface{}

func (*CN) Engine

func (s *CN) Engine() consensus.Engine

func (*CN) EventMux

func (s *CN) EventMux() *event.TypeMux

func (*CN) IsListening

func (s *CN) IsListening() bool

func (*CN) IsMining

func (s *CN) IsMining() bool

func (*CN) Miner

func (s *CN) Miner() *work.Miner

func (*CN) NetVersion

func (s *CN) NetVersion() uint64

func (*CN) Progress added in v1.1.0

func (s *CN) Progress() klaytn.SyncProgress

func (*CN) ProtocolVersion

func (s *CN) ProtocolVersion() int

func (*CN) Protocols

func (s *CN) Protocols() []p2p.Protocol

Protocols implements node.Service, returning all the currently configured network protocols to start.

func (*CN) ReBroadcastTxs

func (s *CN) ReBroadcastTxs(transactions types.Transactions)

func (*CN) ResetWithGenesisBlock

func (s *CN) ResetWithGenesisBlock(gb *types.Block)

func (*CN) Rewardbase

func (s *CN) Rewardbase() (eb common.Address, err error)

func (*CN) RewardbaseWallet

func (s *CN) RewardbaseWallet() (accounts.Wallet, error)

func (*CN) SetComponents

func (s *CN) SetComponents(component []interface{})

func (*CN) SetRewardbase

func (s *CN) SetRewardbase(rewardbase common.Address)

func (*CN) Start

func (s *CN) Start(srvr p2p.Server) error

Start implements node.Service, starting all internal goroutines needed by the Klaytn protocol implementation.

func (*CN) StartMining

func (s *CN) StartMining(local bool) error

func (*CN) Stop

func (s *CN) Stop() error

Stop implements node.Service, terminating all internal goroutines used by the Klaytn protocol.

func (*CN) StopMining

func (s *CN) StopMining()

func (*CN) TxPool

func (s *CN) TxPool() *blockchain.TxPool

type CNAPIBackend

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

CNAPIBackend implements api.Backend for full nodes

func (*CNAPIBackend) AccountManager

func (b *CNAPIBackend) AccountManager() *accounts.Manager

func (*CNAPIBackend) BlockByNumber

func (b *CNAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

func (*CNAPIBackend) BloomStatus

func (b *CNAPIBackend) BloomStatus() (uint64, uint64)

func (*CNAPIBackend) ChainConfig

func (b *CNAPIBackend) ChainConfig() *params.ChainConfig

func (*CNAPIBackend) ChainDB

func (b *CNAPIBackend) ChainDB() database.DBManager

func (*CNAPIBackend) CurrentBlock

func (b *CNAPIBackend) CurrentBlock() *types.Block

func (*CNAPIBackend) EventMux

func (b *CNAPIBackend) EventMux() *event.TypeMux

func (*CNAPIBackend) GetBlock

func (b *CNAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*CNAPIBackend) GetBlockReceipts

func (b *CNAPIBackend) GetBlockReceipts(ctx context.Context, hash common.Hash) types.Receipts

GetBlockReceipts retrieves the receipts for all transactions with given block hash.

func (*CNAPIBackend) GetBlockReceiptsInCache

func (b *CNAPIBackend) GetBlockReceiptsInCache(blockHash common.Hash) types.Receipts

GetBlockReceiptsInCache retrieves receipts for a given block hash in cache.

func (*CNAPIBackend) GetEVM

func (b *CNAPIBackend) GetEVM(ctx context.Context, msg blockchain.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*CNAPIBackend) GetLogs

func (b *CNAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

func (*CNAPIBackend) GetNonceInCache

func (b *CNAPIBackend) GetNonceInCache(addr common.Address) (uint64, bool)

GetNonceInCache returns (cachedNonce, true) if nonce exists in cache. If not, it returns (0, false).

func (*CNAPIBackend) GetPoolNonce

func (b *CNAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) uint64

func (*CNAPIBackend) GetPoolTransaction

func (b *CNAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction

func (*CNAPIBackend) GetPoolTransactions

func (b *CNAPIBackend) GetPoolTransactions() (types.Transactions, error)

func (*CNAPIBackend) GetTd

func (b *CNAPIBackend) GetTd(blockHash common.Hash) *big.Int

func (*CNAPIBackend) GetTxAndLookupInfo

func (b *CNAPIBackend) GetTxAndLookupInfo(hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)

GetTxAndLookupInfo retrieves a tx and lookup info for a given transaction hash.

func (*CNAPIBackend) GetTxAndLookupInfoInCache

func (b *CNAPIBackend) GetTxAndLookupInfoInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)

GetTxAndLookupInfoInCache retrieves a tx and lookup info for a given transaction hash in cache.

func (*CNAPIBackend) GetTxLookupInfoAndReceipt

func (b *CNAPIBackend) GetTxLookupInfoAndReceipt(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)

GetTxLookupInfoAndReceipt retrieves a tx and lookup info and receipt for a given transaction hash.

func (*CNAPIBackend) GetTxLookupInfoAndReceiptInCache

func (b *CNAPIBackend) GetTxLookupInfoAndReceiptInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)

GetTxLookupInfoAndReceiptInCache retrieves a tx and lookup info and receipt for a given transaction hash in cache.

func (*CNAPIBackend) HeaderByNumber

func (b *CNAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*CNAPIBackend) IsParallelDBWrite

func (b *CNAPIBackend) IsParallelDBWrite() bool

func (*CNAPIBackend) IsSenderTxHashIndexingEnabled

func (b *CNAPIBackend) IsSenderTxHashIndexingEnabled() bool

func (*CNAPIBackend) Progress added in v1.1.0

func (b *CNAPIBackend) Progress() klaytn.SyncProgress

func (*CNAPIBackend) ProtocolVersion

func (b *CNAPIBackend) ProtocolVersion() int

func (*CNAPIBackend) SendTx

func (b *CNAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

func (*CNAPIBackend) ServiceFilter

func (b *CNAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*CNAPIBackend) SetHead

func (b *CNAPIBackend) SetHead(number uint64)

func (*CNAPIBackend) StateAndHeaderByNumber

func (b *CNAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

func (*CNAPIBackend) Stats

func (b *CNAPIBackend) Stats() (pending int, queued int)

func (*CNAPIBackend) SubscribeChainEvent

func (b *CNAPIBackend) SubscribeChainEvent(ch chan<- blockchain.ChainEvent) event.Subscription

func (*CNAPIBackend) SubscribeChainHeadEvent

func (b *CNAPIBackend) SubscribeChainHeadEvent(ch chan<- blockchain.ChainHeadEvent) event.Subscription

func (*CNAPIBackend) SubscribeChainSideEvent

func (b *CNAPIBackend) SubscribeChainSideEvent(ch chan<- blockchain.ChainSideEvent) event.Subscription

func (*CNAPIBackend) SubscribeLogsEvent

func (b *CNAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*CNAPIBackend) SubscribeNewTxsEvent

func (b *CNAPIBackend) SubscribeNewTxsEvent(ch chan<- blockchain.NewTxsEvent) event.Subscription

func (*CNAPIBackend) SubscribeRemovedLogsEvent

func (b *CNAPIBackend) SubscribeRemovedLogsEvent(ch chan<- blockchain.RemovedLogsEvent) event.Subscription

func (*CNAPIBackend) SuggestPrice

func (b *CNAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

func (*CNAPIBackend) TxPoolContent

type ChannelManager

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

func NewChannelManager

func NewChannelManager(channelSize int) *ChannelManager

NewChannelManager returns a new ChannelManager. The ChannelManager manages the channel for the msg code.

func (*ChannelManager) GetChannelWithMsgCode

func (cm *ChannelManager) GetChannelWithMsgCode(idx int, msgCode uint64) (chan p2p.Msg, error)

GetChannelWithMsgCode returns the channel corresponding to msgCode.

func (*ChannelManager) RegisterChannelWithIndex

func (cm *ChannelManager) RegisterChannelWithIndex(idx int, channelId uint, channel chan p2p.Msg)

RegisterChannelWithIndex registers the channel corresponding to network and channel ID.

func (*ChannelManager) RegisterMsgCode

func (cm *ChannelManager) RegisterMsgCode(channelId uint, msgCode uint64)

RegisterMsgCode registers the channel id corresponding to msgCode.

type Config

type Config struct {
	// The genesis block, which is inserted if the database is empty.
	// If nil, the Klaytn main net block is used.
	Genesis *blockchain.Genesis `toml:",omitempty"`

	// Protocol options
	NetworkId uint64 // Network ID to use for selecting peers to connect to
	SyncMode  downloader.SyncMode
	NoPruning bool

	// Service chain options
	ParentOperatorAddr *common.Address `toml:",omitempty"` // A hex account address in the parent chain used to sign a child chain transaction.
	AnchoringPeriod    uint64          // Period when child chain sends an anchoring transaction to the parent chain. Default value is 1.
	SentChainTxsLimit  uint64          // Number of chain transactions stored for resending. Default value is 1000.

	// Database options
	SkipBcVersionCheck     bool `toml:"-"`
	PartitionedDB          bool
	NumStateTriePartitions uint
	LevelDBCompression     database.LevelDBCompressionType
	LevelDBBufferPool      bool
	LevelDBCacheSize       int
	TrieCacheSize          int
	TrieTimeout            time.Duration
	TrieBlockInterval      uint
	SenderTxHashIndexing   bool
	ParallelDBWrite        bool
	StateDBCaching         bool
	TxPoolStateCache       bool
	TrieCacheLimit         int

	// Mining-related options
	ServiceChainSigner common.Address `toml:",omitempty"`
	ExtraData          []byte         `toml:",omitempty"`
	GasPrice           *big.Int

	// Reward
	Rewardbase common.Address `toml:",omitempty"`

	// Transaction pool options
	TxPool blockchain.TxPoolConfig

	// Gas Price Oracle options
	GPO gasprice.Config

	// Enables tracking of SHA3 preimages in the VM
	EnablePreimageRecording bool
	// Istanbul options
	Istanbul istanbul.Config

	// Miscellaneous options
	DocRoot string `toml:"-"`

	WsEndpoint string `toml:",omitempty"`

	// Tx Resending options
	TxResendInterval  uint64
	TxResendCount     int
	TxResendUseLegacy bool

	// Service Chain
	NoAccountCreation bool

	// use separate network different from baobab or cypress
	IsPrivate bool
}

func (Config) MarshalTOML

func (c Config) MarshalTOML() (interface{}, error)

MarshalTOML marshals as TOML.

func (*Config) UnmarshalTOML

func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error

UnmarshalTOML unmarshals from TOML.

type LesServer

type LesServer interface {
	Start(srvr p2p.Server)
	Stop()
	Protocols() []p2p.Protocol
	SetBloomBitsIndexer(bbIndexer *blockchain.ChainIndexer)
}

type MockPeer added in v1.2.0

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

MockPeer is a mock of Peer interface

func NewMockPeer added in v1.2.0

func NewMockPeer(ctrl *gomock.Controller) *MockPeer

NewMockPeer creates a new mock instance

func (*MockPeer) AddToKnownBlocks added in v1.2.0

func (m *MockPeer) AddToKnownBlocks(arg0 common.Hash)

AddToKnownBlocks mocks base method

func (*MockPeer) AddToKnownTxs added in v1.2.0

func (m *MockPeer) AddToKnownTxs(arg0 common.Hash)

AddToKnownTxs mocks base method

func (*MockPeer) AsyncSendNewBlock added in v1.2.0

func (m *MockPeer) AsyncSendNewBlock(arg0 *types.Block, arg1 *big.Int)

AsyncSendNewBlock mocks base method

func (*MockPeer) AsyncSendNewBlockHash added in v1.2.0

func (m *MockPeer) AsyncSendNewBlockHash(arg0 *types.Block)

AsyncSendNewBlockHash mocks base method

func (*MockPeer) AsyncSendTransactions added in v1.2.0

func (m *MockPeer) AsyncSendTransactions(arg0 types.Transactions)

AsyncSendTransactions mocks base method

func (*MockPeer) Broadcast added in v1.2.0

func (m *MockPeer) Broadcast()

Broadcast mocks base method

func (*MockPeer) Close added in v1.2.0

func (m *MockPeer) Close()

Close mocks base method

func (*MockPeer) ConnType added in v1.2.0

func (m *MockPeer) ConnType() p2p.ConnType

ConnType mocks base method

func (*MockPeer) DisconnectP2PPeer added in v1.2.0

func (m *MockPeer) DisconnectP2PPeer(arg0 p2p.DiscReason)

DisconnectP2PPeer mocks base method

func (*MockPeer) EXPECT added in v1.2.0

func (m *MockPeer) EXPECT() *MockPeerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPeer) FetchBlockBodies added in v1.2.0

func (m *MockPeer) FetchBlockBodies(arg0 []common.Hash) error

FetchBlockBodies mocks base method

func (*MockPeer) FetchBlockHeader added in v1.2.0

func (m *MockPeer) FetchBlockHeader(arg0 common.Hash) error

FetchBlockHeader mocks base method

func (*MockPeer) GetAddr added in v1.2.0

func (m *MockPeer) GetAddr() common.Address

GetAddr mocks base method

func (*MockPeer) GetChainID added in v1.2.0

func (m *MockPeer) GetChainID() *big.Int

GetChainID mocks base method

func (*MockPeer) GetID added in v1.2.0

func (m *MockPeer) GetID() string

GetID mocks base method

func (*MockPeer) GetP2PPeer added in v1.2.0

func (m *MockPeer) GetP2PPeer() *p2p.Peer

GetP2PPeer mocks base method

func (*MockPeer) GetP2PPeerID added in v1.2.0

func (m *MockPeer) GetP2PPeerID() discover.NodeID

GetP2PPeerID mocks base method

func (*MockPeer) GetRW added in v1.2.0

func (m *MockPeer) GetRW() p2p.MsgReadWriter

GetRW mocks base method

func (*MockPeer) GetVersion added in v1.2.0

func (m *MockPeer) GetVersion() int

GetVersion mocks base method

func (*MockPeer) Handle added in v1.2.0

func (m *MockPeer) Handle(arg0 *ProtocolManager) error

Handle mocks base method

func (*MockPeer) Handshake added in v1.2.0

func (m *MockPeer) Handshake(arg0 uint64, arg1, arg2 *big.Int, arg3, arg4 common.Hash) error

Handshake mocks base method

func (*MockPeer) Head added in v1.2.0

func (m *MockPeer) Head() (common.Hash, *big.Int)

Head mocks base method

func (*MockPeer) Info added in v1.2.0

func (m *MockPeer) Info() *PeerInfo

Info mocks base method

func (*MockPeer) KnowsBlock added in v1.2.0

func (m *MockPeer) KnowsBlock(arg0 common.Hash) bool

KnowsBlock mocks base method

func (*MockPeer) KnowsTx added in v1.2.0

func (m *MockPeer) KnowsTx(arg0 common.Hash) bool

KnowsTx mocks base method

func (*MockPeer) ReSendTransactions added in v1.2.0

func (m *MockPeer) ReSendTransactions(arg0 types.Transactions) error

ReSendTransactions mocks base method

func (*MockPeer) RegisterConsensusMsgCode added in v1.2.0

func (m *MockPeer) RegisterConsensusMsgCode(arg0 uint64)

RegisterConsensusMsgCode mocks base method

func (*MockPeer) RequestBodies added in v1.2.0

func (m *MockPeer) RequestBodies(arg0 []common.Hash) error

RequestBodies mocks base method

func (*MockPeer) RequestHeadersByHash added in v1.2.0

func (m *MockPeer) RequestHeadersByHash(arg0 common.Hash, arg1, arg2 int, arg3 bool) error

RequestHeadersByHash mocks base method

func (*MockPeer) RequestHeadersByNumber added in v1.2.0

func (m *MockPeer) RequestHeadersByNumber(arg0 uint64, arg1, arg2 int, arg3 bool) error

RequestHeadersByNumber mocks base method

func (*MockPeer) RequestNodeData added in v1.2.0

func (m *MockPeer) RequestNodeData(arg0 []common.Hash) error

RequestNodeData mocks base method

func (*MockPeer) RequestReceipts added in v1.2.0

func (m *MockPeer) RequestReceipts(arg0 []common.Hash) error

RequestReceipts mocks base method

func (*MockPeer) Send added in v1.2.0

func (m *MockPeer) Send(arg0 uint64, arg1 interface{}) error

Send mocks base method

func (*MockPeer) SendBlockBodies added in v1.2.0

func (m *MockPeer) SendBlockBodies(arg0 []*blockBody) error

SendBlockBodies mocks base method

func (*MockPeer) SendBlockBodiesRLP added in v1.2.0

func (m *MockPeer) SendBlockBodiesRLP(arg0 []rlp.RawValue) error

SendBlockBodiesRLP mocks base method

func (*MockPeer) SendBlockHeaders added in v1.2.0

func (m *MockPeer) SendBlockHeaders(arg0 []*types.Header) error

SendBlockHeaders mocks base method

func (*MockPeer) SendFetchedBlockBodiesRLP added in v1.2.0

func (m *MockPeer) SendFetchedBlockBodiesRLP(arg0 []rlp.RawValue) error

SendFetchedBlockBodiesRLP mocks base method

func (*MockPeer) SendFetchedBlockHeader added in v1.2.0

func (m *MockPeer) SendFetchedBlockHeader(arg0 *types.Header) error

SendFetchedBlockHeader mocks base method

func (*MockPeer) SendNewBlock added in v1.2.0

func (m *MockPeer) SendNewBlock(arg0 *types.Block, arg1 *big.Int) error

SendNewBlock mocks base method

func (*MockPeer) SendNewBlockHashes added in v1.2.0

func (m *MockPeer) SendNewBlockHashes(arg0 []common.Hash, arg1 []uint64) error

SendNewBlockHashes mocks base method

func (*MockPeer) SendNodeData added in v1.2.0

func (m *MockPeer) SendNodeData(arg0 [][]byte) error

SendNodeData mocks base method

func (*MockPeer) SendReceiptsRLP added in v1.2.0

func (m *MockPeer) SendReceiptsRLP(arg0 []rlp.RawValue) error

SendReceiptsRLP mocks base method

func (*MockPeer) SendTransactions added in v1.2.0

func (m *MockPeer) SendTransactions(arg0 types.Transactions) error

SendTransactions mocks base method

func (*MockPeer) SetAddr added in v1.2.0

func (m *MockPeer) SetAddr(arg0 common.Address)

SetAddr mocks base method

func (*MockPeer) SetHead added in v1.2.0

func (m *MockPeer) SetHead(arg0 common.Hash, arg1 *big.Int)

SetHead mocks base method

func (*MockPeer) UpdateRWImplementationVersion added in v1.2.0

func (m *MockPeer) UpdateRWImplementationVersion()

UpdateRWImplementationVersion mocks base method

type MockPeerMockRecorder added in v1.2.0

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

MockPeerMockRecorder is the mock recorder for MockPeer

func (*MockPeerMockRecorder) AddToKnownBlocks added in v1.2.0

func (mr *MockPeerMockRecorder) AddToKnownBlocks(arg0 interface{}) *gomock.Call

AddToKnownBlocks indicates an expected call of AddToKnownBlocks

func (*MockPeerMockRecorder) AddToKnownTxs added in v1.2.0

func (mr *MockPeerMockRecorder) AddToKnownTxs(arg0 interface{}) *gomock.Call

AddToKnownTxs indicates an expected call of AddToKnownTxs

func (*MockPeerMockRecorder) AsyncSendNewBlock added in v1.2.0

func (mr *MockPeerMockRecorder) AsyncSendNewBlock(arg0, arg1 interface{}) *gomock.Call

AsyncSendNewBlock indicates an expected call of AsyncSendNewBlock

func (*MockPeerMockRecorder) AsyncSendNewBlockHash added in v1.2.0

func (mr *MockPeerMockRecorder) AsyncSendNewBlockHash(arg0 interface{}) *gomock.Call

AsyncSendNewBlockHash indicates an expected call of AsyncSendNewBlockHash

func (*MockPeerMockRecorder) AsyncSendTransactions added in v1.2.0

func (mr *MockPeerMockRecorder) AsyncSendTransactions(arg0 interface{}) *gomock.Call

AsyncSendTransactions indicates an expected call of AsyncSendTransactions

func (*MockPeerMockRecorder) Broadcast added in v1.2.0

func (mr *MockPeerMockRecorder) Broadcast() *gomock.Call

Broadcast indicates an expected call of Broadcast

func (*MockPeerMockRecorder) Close added in v1.2.0

func (mr *MockPeerMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockPeerMockRecorder) ConnType added in v1.2.0

func (mr *MockPeerMockRecorder) ConnType() *gomock.Call

ConnType indicates an expected call of ConnType

func (*MockPeerMockRecorder) DisconnectP2PPeer added in v1.2.0

func (mr *MockPeerMockRecorder) DisconnectP2PPeer(arg0 interface{}) *gomock.Call

DisconnectP2PPeer indicates an expected call of DisconnectP2PPeer

func (*MockPeerMockRecorder) FetchBlockBodies added in v1.2.0

func (mr *MockPeerMockRecorder) FetchBlockBodies(arg0 interface{}) *gomock.Call

FetchBlockBodies indicates an expected call of FetchBlockBodies

func (*MockPeerMockRecorder) FetchBlockHeader added in v1.2.0

func (mr *MockPeerMockRecorder) FetchBlockHeader(arg0 interface{}) *gomock.Call

FetchBlockHeader indicates an expected call of FetchBlockHeader

func (*MockPeerMockRecorder) GetAddr added in v1.2.0

func (mr *MockPeerMockRecorder) GetAddr() *gomock.Call

GetAddr indicates an expected call of GetAddr

func (*MockPeerMockRecorder) GetChainID added in v1.2.0

func (mr *MockPeerMockRecorder) GetChainID() *gomock.Call

GetChainID indicates an expected call of GetChainID

func (*MockPeerMockRecorder) GetID added in v1.2.0

func (mr *MockPeerMockRecorder) GetID() *gomock.Call

GetID indicates an expected call of GetID

func (*MockPeerMockRecorder) GetP2PPeer added in v1.2.0

func (mr *MockPeerMockRecorder) GetP2PPeer() *gomock.Call

GetP2PPeer indicates an expected call of GetP2PPeer

func (*MockPeerMockRecorder) GetP2PPeerID added in v1.2.0

func (mr *MockPeerMockRecorder) GetP2PPeerID() *gomock.Call

GetP2PPeerID indicates an expected call of GetP2PPeerID

func (*MockPeerMockRecorder) GetRW added in v1.2.0

func (mr *MockPeerMockRecorder) GetRW() *gomock.Call

GetRW indicates an expected call of GetRW

func (*MockPeerMockRecorder) GetVersion added in v1.2.0

func (mr *MockPeerMockRecorder) GetVersion() *gomock.Call

GetVersion indicates an expected call of GetVersion

func (*MockPeerMockRecorder) Handle added in v1.2.0

func (mr *MockPeerMockRecorder) Handle(arg0 interface{}) *gomock.Call

Handle indicates an expected call of Handle

func (*MockPeerMockRecorder) Handshake added in v1.2.0

func (mr *MockPeerMockRecorder) Handshake(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call

Handshake indicates an expected call of Handshake

func (*MockPeerMockRecorder) Head added in v1.2.0

func (mr *MockPeerMockRecorder) Head() *gomock.Call

Head indicates an expected call of Head

func (*MockPeerMockRecorder) Info added in v1.2.0

func (mr *MockPeerMockRecorder) Info() *gomock.Call

Info indicates an expected call of Info

func (*MockPeerMockRecorder) KnowsBlock added in v1.2.0

func (mr *MockPeerMockRecorder) KnowsBlock(arg0 interface{}) *gomock.Call

KnowsBlock indicates an expected call of KnowsBlock

func (*MockPeerMockRecorder) KnowsTx added in v1.2.0

func (mr *MockPeerMockRecorder) KnowsTx(arg0 interface{}) *gomock.Call

KnowsTx indicates an expected call of KnowsTx

func (*MockPeerMockRecorder) ReSendTransactions added in v1.2.0

func (mr *MockPeerMockRecorder) ReSendTransactions(arg0 interface{}) *gomock.Call

ReSendTransactions indicates an expected call of ReSendTransactions

func (*MockPeerMockRecorder) RegisterConsensusMsgCode added in v1.2.0

func (mr *MockPeerMockRecorder) RegisterConsensusMsgCode(arg0 interface{}) *gomock.Call

RegisterConsensusMsgCode indicates an expected call of RegisterConsensusMsgCode

func (*MockPeerMockRecorder) RequestBodies added in v1.2.0

func (mr *MockPeerMockRecorder) RequestBodies(arg0 interface{}) *gomock.Call

RequestBodies indicates an expected call of RequestBodies

func (*MockPeerMockRecorder) RequestHeadersByHash added in v1.2.0

func (mr *MockPeerMockRecorder) RequestHeadersByHash(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

RequestHeadersByHash indicates an expected call of RequestHeadersByHash

func (*MockPeerMockRecorder) RequestHeadersByNumber added in v1.2.0

func (mr *MockPeerMockRecorder) RequestHeadersByNumber(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

RequestHeadersByNumber indicates an expected call of RequestHeadersByNumber

func (*MockPeerMockRecorder) RequestNodeData added in v1.2.0

func (mr *MockPeerMockRecorder) RequestNodeData(arg0 interface{}) *gomock.Call

RequestNodeData indicates an expected call of RequestNodeData

func (*MockPeerMockRecorder) RequestReceipts added in v1.2.0

func (mr *MockPeerMockRecorder) RequestReceipts(arg0 interface{}) *gomock.Call

RequestReceipts indicates an expected call of RequestReceipts

func (*MockPeerMockRecorder) Send added in v1.2.0

func (mr *MockPeerMockRecorder) Send(arg0, arg1 interface{}) *gomock.Call

Send indicates an expected call of Send

func (*MockPeerMockRecorder) SendBlockBodies added in v1.2.0

func (mr *MockPeerMockRecorder) SendBlockBodies(arg0 interface{}) *gomock.Call

SendBlockBodies indicates an expected call of SendBlockBodies

func (*MockPeerMockRecorder) SendBlockBodiesRLP added in v1.2.0

func (mr *MockPeerMockRecorder) SendBlockBodiesRLP(arg0 interface{}) *gomock.Call

SendBlockBodiesRLP indicates an expected call of SendBlockBodiesRLP

func (*MockPeerMockRecorder) SendBlockHeaders added in v1.2.0

func (mr *MockPeerMockRecorder) SendBlockHeaders(arg0 interface{}) *gomock.Call

SendBlockHeaders indicates an expected call of SendBlockHeaders

func (*MockPeerMockRecorder) SendFetchedBlockBodiesRLP added in v1.2.0

func (mr *MockPeerMockRecorder) SendFetchedBlockBodiesRLP(arg0 interface{}) *gomock.Call

SendFetchedBlockBodiesRLP indicates an expected call of SendFetchedBlockBodiesRLP

func (*MockPeerMockRecorder) SendFetchedBlockHeader added in v1.2.0

func (mr *MockPeerMockRecorder) SendFetchedBlockHeader(arg0 interface{}) *gomock.Call

SendFetchedBlockHeader indicates an expected call of SendFetchedBlockHeader

func (*MockPeerMockRecorder) SendNewBlock added in v1.2.0

func (mr *MockPeerMockRecorder) SendNewBlock(arg0, arg1 interface{}) *gomock.Call

SendNewBlock indicates an expected call of SendNewBlock

func (*MockPeerMockRecorder) SendNewBlockHashes added in v1.2.0

func (mr *MockPeerMockRecorder) SendNewBlockHashes(arg0, arg1 interface{}) *gomock.Call

SendNewBlockHashes indicates an expected call of SendNewBlockHashes

func (*MockPeerMockRecorder) SendNodeData added in v1.2.0

func (mr *MockPeerMockRecorder) SendNodeData(arg0 interface{}) *gomock.Call

SendNodeData indicates an expected call of SendNodeData

func (*MockPeerMockRecorder) SendReceiptsRLP added in v1.2.0

func (mr *MockPeerMockRecorder) SendReceiptsRLP(arg0 interface{}) *gomock.Call

SendReceiptsRLP indicates an expected call of SendReceiptsRLP

func (*MockPeerMockRecorder) SendTransactions added in v1.2.0

func (mr *MockPeerMockRecorder) SendTransactions(arg0 interface{}) *gomock.Call

SendTransactions indicates an expected call of SendTransactions

func (*MockPeerMockRecorder) SetAddr added in v1.2.0

func (mr *MockPeerMockRecorder) SetAddr(arg0 interface{}) *gomock.Call

SetAddr indicates an expected call of SetAddr

func (*MockPeerMockRecorder) SetHead added in v1.2.0

func (mr *MockPeerMockRecorder) SetHead(arg0, arg1 interface{}) *gomock.Call

SetHead indicates an expected call of SetHead

func (*MockPeerMockRecorder) UpdateRWImplementationVersion added in v1.2.0

func (mr *MockPeerMockRecorder) UpdateRWImplementationVersion() *gomock.Call

UpdateRWImplementationVersion indicates an expected call of UpdateRWImplementationVersion

type MockPeerSet added in v1.2.0

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

MockPeerSet is a mock of PeerSet interface

func NewMockPeerSet added in v1.2.0

func NewMockPeerSet(ctrl *gomock.Controller) *MockPeerSet

NewMockPeerSet creates a new mock instance

func (*MockPeerSet) BestPeer added in v1.2.0

func (m *MockPeerSet) BestPeer() Peer

BestPeer mocks base method

func (*MockPeerSet) CNPeers added in v1.2.0

func (m *MockPeerSet) CNPeers() map[common.Address]Peer

CNPeers mocks base method

func (*MockPeerSet) CNWithoutTx added in v1.2.0

func (m *MockPeerSet) CNWithoutTx(arg0 common.Hash) []Peer

CNWithoutTx mocks base method

func (*MockPeerSet) Close added in v1.2.0

func (m *MockPeerSet) Close()

Close mocks base method

func (*MockPeerSet) ENPeers added in v1.2.0

func (m *MockPeerSet) ENPeers() map[common.Address]Peer

ENPeers mocks base method

func (*MockPeerSet) EXPECT added in v1.2.0

func (m *MockPeerSet) EXPECT() *MockPeerSetMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockPeerSet) Len added in v1.2.0

func (m *MockPeerSet) Len() int

Len mocks base method

func (*MockPeerSet) PNPeers added in v1.2.0

func (m *MockPeerSet) PNPeers() map[common.Address]Peer

PNPeers mocks base method

func (*MockPeerSet) Peer added in v1.2.0

func (m *MockPeerSet) Peer(arg0 string) Peer

Peer mocks base method

func (*MockPeerSet) Peers added in v1.2.0

func (m *MockPeerSet) Peers() map[string]Peer

Peers mocks base method

func (*MockPeerSet) PeersWithoutBlock added in v1.2.0

func (m *MockPeerSet) PeersWithoutBlock(arg0 common.Hash) []Peer

PeersWithoutBlock mocks base method

func (*MockPeerSet) PeersWithoutTx added in v1.2.0

func (m *MockPeerSet) PeersWithoutTx(arg0 common.Hash) []Peer

PeersWithoutTx mocks base method

func (*MockPeerSet) Register added in v1.2.0

func (m *MockPeerSet) Register(arg0 Peer) error

Register mocks base method

func (*MockPeerSet) RegisterValidator added in v1.2.0

func (m *MockPeerSet) RegisterValidator(arg0 p2p.ConnType, arg1 p2p.PeerTypeValidator)

RegisterValidator mocks base method

func (*MockPeerSet) SamplePeersToSendBlock added in v1.2.0

func (m *MockPeerSet) SamplePeersToSendBlock(arg0 *types.Block, arg1 p2p.ConnType) []Peer

SamplePeersToSendBlock mocks base method

func (*MockPeerSet) SampleResendPeersByType added in v1.2.0

func (m *MockPeerSet) SampleResendPeersByType(arg0 p2p.ConnType) []Peer

SampleResendPeersByType mocks base method

func (*MockPeerSet) TypePeersWithoutTx added in v1.2.0

func (m *MockPeerSet) TypePeersWithoutTx(arg0 common.Hash, arg1 p2p.ConnType) []Peer

TypePeersWithoutTx mocks base method

func (*MockPeerSet) Unregister added in v1.2.0

func (m *MockPeerSet) Unregister(arg0 string) error

Unregister mocks base method

func (*MockPeerSet) UpdateTypePeersWithoutTxs added in v1.2.0

func (m *MockPeerSet) UpdateTypePeersWithoutTxs(arg0 *types.Transaction, arg1 p2p.ConnType, arg2 map[Peer]types.Transactions)

UpdateTypePeersWithoutTxs mocks base method

type MockPeerSetMockRecorder added in v1.2.0

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

MockPeerSetMockRecorder is the mock recorder for MockPeerSet

func (*MockPeerSetMockRecorder) BestPeer added in v1.2.0

func (mr *MockPeerSetMockRecorder) BestPeer() *gomock.Call

BestPeer indicates an expected call of BestPeer

func (*MockPeerSetMockRecorder) CNPeers added in v1.2.0

func (mr *MockPeerSetMockRecorder) CNPeers() *gomock.Call

CNPeers indicates an expected call of CNPeers

func (*MockPeerSetMockRecorder) CNWithoutTx added in v1.2.0

func (mr *MockPeerSetMockRecorder) CNWithoutTx(arg0 interface{}) *gomock.Call

CNWithoutTx indicates an expected call of CNWithoutTx

func (*MockPeerSetMockRecorder) Close added in v1.2.0

func (mr *MockPeerSetMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockPeerSetMockRecorder) ENPeers added in v1.2.0

func (mr *MockPeerSetMockRecorder) ENPeers() *gomock.Call

ENPeers indicates an expected call of ENPeers

func (*MockPeerSetMockRecorder) Len added in v1.2.0

func (mr *MockPeerSetMockRecorder) Len() *gomock.Call

Len indicates an expected call of Len

func (*MockPeerSetMockRecorder) PNPeers added in v1.2.0

func (mr *MockPeerSetMockRecorder) PNPeers() *gomock.Call

PNPeers indicates an expected call of PNPeers

func (*MockPeerSetMockRecorder) Peer added in v1.2.0

func (mr *MockPeerSetMockRecorder) Peer(arg0 interface{}) *gomock.Call

Peer indicates an expected call of Peer

func (*MockPeerSetMockRecorder) Peers added in v1.2.0

func (mr *MockPeerSetMockRecorder) Peers() *gomock.Call

Peers indicates an expected call of Peers

func (*MockPeerSetMockRecorder) PeersWithoutBlock added in v1.2.0

func (mr *MockPeerSetMockRecorder) PeersWithoutBlock(arg0 interface{}) *gomock.Call

PeersWithoutBlock indicates an expected call of PeersWithoutBlock

func (*MockPeerSetMockRecorder) PeersWithoutTx added in v1.2.0

func (mr *MockPeerSetMockRecorder) PeersWithoutTx(arg0 interface{}) *gomock.Call

PeersWithoutTx indicates an expected call of PeersWithoutTx

func (*MockPeerSetMockRecorder) Register added in v1.2.0

func (mr *MockPeerSetMockRecorder) Register(arg0 interface{}) *gomock.Call

Register indicates an expected call of Register

func (*MockPeerSetMockRecorder) RegisterValidator added in v1.2.0

func (mr *MockPeerSetMockRecorder) RegisterValidator(arg0, arg1 interface{}) *gomock.Call

RegisterValidator indicates an expected call of RegisterValidator

func (*MockPeerSetMockRecorder) SamplePeersToSendBlock added in v1.2.0

func (mr *MockPeerSetMockRecorder) SamplePeersToSendBlock(arg0, arg1 interface{}) *gomock.Call

SamplePeersToSendBlock indicates an expected call of SamplePeersToSendBlock

func (*MockPeerSetMockRecorder) SampleResendPeersByType added in v1.2.0

func (mr *MockPeerSetMockRecorder) SampleResendPeersByType(arg0 interface{}) *gomock.Call

SampleResendPeersByType indicates an expected call of SampleResendPeersByType

func (*MockPeerSetMockRecorder) TypePeersWithoutTx added in v1.2.0

func (mr *MockPeerSetMockRecorder) TypePeersWithoutTx(arg0, arg1 interface{}) *gomock.Call

TypePeersWithoutTx indicates an expected call of TypePeersWithoutTx

func (*MockPeerSetMockRecorder) Unregister added in v1.2.0

func (mr *MockPeerSetMockRecorder) Unregister(arg0 interface{}) *gomock.Call

Unregister indicates an expected call of Unregister

func (*MockPeerSetMockRecorder) UpdateTypePeersWithoutTxs added in v1.2.0

func (mr *MockPeerSetMockRecorder) UpdateTypePeersWithoutTxs(arg0, arg1, arg2 interface{}) *gomock.Call

UpdateTypePeersWithoutTxs indicates an expected call of UpdateTypePeersWithoutTxs

type NodeInfo

type NodeInfo struct {
	// TODO-Klaytn describe predefined network ID below
	Network    uint64              `json:"network"`    // Klaytn network ID
	BlockScore *big.Int            `json:"blockscore"` // Total blockscore of the host's blockchain
	Genesis    common.Hash         `json:"genesis"`    // SHA3 hash of the host's genesis block
	Config     *params.ChainConfig `json:"config"`     // Chain configuration for the fork rules
	Head       common.Hash         `json:"head"`       // SHA3 hash of the host's best owned block
}

NodeInfo represents a short summary of the Klaytn sub-protocol metadata known about the host peer.

type Peer

type Peer interface {
	// Broadcast is a write loop that multiplexes block propagations, announcements
	// and transaction broadcasts into the remote peer. The goal is to have an async
	// writer that does not lock up node internals.
	Broadcast()

	// Close signals the broadcast goroutine to terminate.
	Close()

	// Info gathers and returns a collection of metadata known about a peer.
	Info() *PeerInfo

	// SetHead updates the head hash and total blockscore of the peer.
	SetHead(hash common.Hash, td *big.Int)

	// AddToKnownBlocks adds a block hash to knownBlocksCache for the peer, ensuring that the block will
	// never be propagated to this particular peer.
	AddToKnownBlocks(hash common.Hash)

	// AddToKnownTxs adds a transaction hash to knownTxsCache for the peer, ensuring that it
	// will never be propagated to this particular peer.
	AddToKnownTxs(hash common.Hash)

	// Send writes an RLP-encoded message with the given code.
	// data should have been encoded as an RLP list.
	Send(msgcode uint64, data interface{}) error

	// SendTransactions sends transactions to the peer and includes the hashes
	// in its transaction hash set for future reference.
	SendTransactions(txs types.Transactions) error

	// ReSendTransactions sends txs to a peer in order to prevent the txs from missing.
	ReSendTransactions(txs types.Transactions) error

	// AsyncSendTransactions sends transactions asynchronously to the peer.
	AsyncSendTransactions(txs types.Transactions)

	// SendNewBlockHashes announces the availability of a number of blocks through
	// a hash notification.
	SendNewBlockHashes(hashes []common.Hash, numbers []uint64) error

	// AsyncSendNewBlockHash queues the availability of a block for propagation to a
	// remote peer. If the peer's broadcast queue is full, the event is silently
	// dropped.
	AsyncSendNewBlockHash(block *types.Block)

	// SendNewBlock propagates an entire block to a remote peer.
	SendNewBlock(block *types.Block, td *big.Int) error

	// AsyncSendNewBlock queues an entire block for propagation to a remote peer. If
	// the peer's broadcast queue is full, the event is silently dropped.
	AsyncSendNewBlock(block *types.Block, td *big.Int)

	// SendBlockHeaders sends a batch of block headers to the remote peer.
	SendBlockHeaders(headers []*types.Header) error

	// SendFetchedBlockHeader sends a block header to the remote peer, requested by fetcher.
	SendFetchedBlockHeader(header *types.Header) error

	// SendBlockBodies sends a batch of block contents to the remote peer.
	SendBlockBodies(bodies []*blockBody) error

	// SendBlockBodiesRLP sends a batch of block contents to the remote peer from
	// an already RLP encoded format.
	SendBlockBodiesRLP(bodies []rlp.RawValue) error

	// SendFetchedBlockBodiesRLP sends a batch of block contents to the remote peer from
	// an already RLP encoded format, requested by fetcher.
	SendFetchedBlockBodiesRLP(bodies []rlp.RawValue) error

	// SendNodeDataRLP sends a batch of arbitrary internal data, corresponding to the
	// hashes requested.
	SendNodeData(data [][]byte) error

	// SendReceiptsRLP sends a batch of transaction receipts, corresponding to the
	// ones requested from an already RLP encoded format.
	SendReceiptsRLP(receipts []rlp.RawValue) error

	// FetchBlockHeader is a wrapper around the header query functions to fetch a
	// single header. It is used solely by the fetcher.
	FetchBlockHeader(hash common.Hash) error

	// FetchBlockBodies fetches a batch of blocks' bodies corresponding to the hashes
	// specified. If uses different message type from RequestBodies.
	// It is used solely by the fetcher.
	FetchBlockBodies(hashes []common.Hash) error

	// Handshake executes the Klaytn protocol handshake, negotiating version number,
	// network IDs, difficulties, head, and genesis blocks and returning error.
	Handshake(network uint64, chainID, td *big.Int, head common.Hash, genesis common.Hash) error

	// ConnType returns the conntype of the peer.
	ConnType() p2p.ConnType

	// GetID returns the id of the peer.
	GetID() string

	// GetP2PPeerID returns the id of the p2p.Peer.
	GetP2PPeerID() discover.NodeID

	// GetChainID returns the chain id of the peer.
	GetChainID() *big.Int

	// GetAddr returns the address of the peer.
	GetAddr() common.Address

	// SetAddr sets the address of the peer.
	SetAddr(addr common.Address)

	// GetVersion returns the version of the peer.
	GetVersion() int

	// KnowsBlock returns if the peer is known to have the block, based on knownBlocksCache.
	KnowsBlock(hash common.Hash) bool

	// KnowsTx returns if the peer is known to have the transaction, based on knownTxsCache.
	KnowsTx(hash common.Hash) bool

	// GetP2PPeer returns the p2p.
	GetP2PPeer() *p2p.Peer

	// DisconnectP2PPeer disconnects the p2p peer with the given reason.
	DisconnectP2PPeer(discReason p2p.DiscReason)

	// GetRW returns the MsgReadWriter of the peer.
	GetRW() p2p.MsgReadWriter

	// Handle is the callback invoked to manage the life cycle of a Klaytn Peer. When
	// this function terminates, the Peer is disconnected.
	Handle(pm *ProtocolManager) error

	// UpdateRWImplementationVersion updates the version of the implementation of RW.
	UpdateRWImplementationVersion()

	// Peer encapsulates the methods required to synchronise with a remote full peer.
	downloader.Peer

	// RegisterConsensusMsgCode registers the channel of consensus msg.
	RegisterConsensusMsgCode(msgCode uint64)
}

type PeerInfo

type PeerInfo struct {
	Version    int      `json:"version"`    // Klaytn protocol version negotiated
	BlockScore *big.Int `json:"blockscore"` // Total blockscore of the peer's blockchain
	Head       string   `json:"head"`       // SHA3 hash of the peer's best owned block
}

PeerInfo represents a short summary of the Klaytn sub-protocol metadata known about a connected peer.

type PeerSet added in v1.2.0

type PeerSet interface {
	Register(p Peer) error
	Unregister(id string) error

	Peers() map[string]Peer
	CNPeers() map[common.Address]Peer
	ENPeers() map[common.Address]Peer
	PNPeers() map[common.Address]Peer
	Peer(id string) Peer
	Len() int

	PeersWithoutBlock(hash common.Hash) []Peer

	SamplePeersToSendBlock(block *types.Block, nodeType p2p.ConnType) []Peer
	SampleResendPeersByType(nodeType p2p.ConnType) []Peer

	PeersWithoutTx(hash common.Hash) []Peer
	TypePeersWithoutTx(hash common.Hash, nodetype p2p.ConnType) []Peer
	CNWithoutTx(hash common.Hash) []Peer
	UpdateTypePeersWithoutTxs(tx *types.Transaction, nodeType p2p.ConnType, peersWithoutTxsMap map[Peer]types.Transactions)

	BestPeer() Peer
	RegisterValidator(connType p2p.ConnType, validator p2p.PeerTypeValidator)
	Close()
}

type PrivateAdminAPI

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

PrivateAdminAPI is the collection of CN full node-related APIs exposed over the private admin endpoint.

func NewPrivateAdminAPI

func NewPrivateAdminAPI(cn *CN) *PrivateAdminAPI

NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the CN service.

func (*PrivateAdminAPI) ExportChain

func (api *PrivateAdminAPI) ExportChain(file string) (bool, error)

ExportChain exports the current blockchain into a local file.

func (*PrivateAdminAPI) ImportChain

func (api *PrivateAdminAPI) ImportChain(file string) (bool, error)

ImportChain imports a blockchain from a local file.

type PrivateDebugAPI

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

PrivateDebugAPI is the collection of CN full node APIs exposed over the private debugging endpoint.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *params.ChainConfig, cn *CN) *PrivateDebugAPI

NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the CN service.

func (*PrivateDebugAPI) GetBadBlocks

func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]blockchain.BadBlockArgs, error)

GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes

func (*PrivateDebugAPI) GetModifiedAccountsByHash

func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)

GetModifiedAccountsByHash returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.

With one parameter, returns the list of accounts modified in the specified block.

func (*PrivateDebugAPI) GetModifiedAccountsByNumber

func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)

GetModifiedAccountsByumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.

With one parameter, returns the list of accounts modified in the specified block.

func (*PrivateDebugAPI) Preimage

func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

Preimage is a debug API function that returns the preimage for a sha3 hash, if known.

func (*PrivateDebugAPI) StandardTraceBadBlockToFile

func (api *PrivateDebugAPI) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)

StandardTraceBadBlockToFile dumps the structured logs created during the execution of EVM against a block pulled from the pool of bad ones to the local file system and returns a list of files to the caller.

func (*PrivateDebugAPI) StandardTraceBlockToFile

func (api *PrivateDebugAPI) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)

StandardTraceBlockToFile dumps the structured logs created during the execution of EVM to the local file system and returns a list of files to the caller.

func (*PrivateDebugAPI) TraceBadBlock

func (api *PrivateDebugAPI) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)

TraceBadBlock returns the structured logs created during the execution of EVM against a block pulled from the pool of bad ones and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlock

func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob hexutil.Bytes, config *TraceConfig) ([]*txTraceResult, error)

TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlockByHash

func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockByHash returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlockByNumber

func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockByNumber returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlockFromFile

func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockFromFile returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceChain

func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)

TraceChain returns the structured logs created during the execution of EVM between two blocks (excluding start) and returns them as a JSON object.

func (*PrivateDebugAPI) TraceTransaction

func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)

TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.

type PrivateMinerAPI

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

PrivateMinerAPI provides private RPC methods to control the miner. These methods can be abused by external users and must be considered insecure for use by untrusted users.

func NewPrivateMinerAPI

func NewPrivateMinerAPI(e *CN) *PrivateMinerAPI

NewPrivateMinerAPI create a new RPC service which controls the miner of this node.

func (*PrivateMinerAPI) GetHashrate

func (api *PrivateMinerAPI) GetHashrate() uint64

GetHashrate returns the current hashrate of the miner.

func (*PrivateMinerAPI) SetExtra

func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)

SetExtra sets the extra data string that is included when this miner mines a block.

func (*PrivateMinerAPI) SetGasPrice

func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool

SetGasPrice sets the minimum accepted gas price for the miner.

func (*PrivateMinerAPI) SetRewardbase

func (api *PrivateMinerAPI) SetRewardbase(rewardbase common.Address) bool

SetRewardbase sets the rewardbase of the CN.

func (*PrivateMinerAPI) Start

func (api *PrivateMinerAPI) Start(threads *int) error

Start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.

func (*PrivateMinerAPI) Stop

func (api *PrivateMinerAPI) Stop() bool

Stop the miner

type PrivateServiceChainAdminAPI

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

PrivateAdminAPI is the collection of sc full node-related APIs exposed over the private admin endpoint.

func NewPrivateServiceChainAdminAPI

func NewPrivateServiceChainAdminAPI(sc *ServiceChain) *PrivateServiceChainAdminAPI

NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the sc service.

func (*PrivateServiceChainAdminAPI) ExportChain

func (api *PrivateServiceChainAdminAPI) ExportChain(file string) (bool, error)

ExportChain exports the current blockchain into a local file.

func (*PrivateServiceChainAdminAPI) ImportChain

func (api *PrivateServiceChainAdminAPI) ImportChain(file string) (bool, error)

ImportChain imports a blockchain from a local file.

type PrivateServiceChainDebugAPI

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

PrivateDebugAPI is the collection of sc full node APIs exposed over the private debugging endpoint.

func NewPrivateServiceChainDebugAPI

func NewPrivateServiceChainDebugAPI(config *params.ChainConfig, sc *ServiceChain) *PrivateServiceChainDebugAPI

NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the sc service.

func (*PrivateServiceChainDebugAPI) GetBadBlocks

GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes

func (*PrivateServiceChainDebugAPI) GetModifiedAccountsByHash

func (api *PrivateServiceChainDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)

GetModifiedAccountsByHash returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.

With one parameter, returns the list of accounts modified in the specified block.

func (*PrivateServiceChainDebugAPI) GetModifiedAccountsByNumber

func (api *PrivateServiceChainDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)

GetModifiedAccountsByumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.

With one parameter, returns the list of accounts modified in the specified block.

func (*PrivateServiceChainDebugAPI) Preimage

Preimage is a debug API function that returns the preimage for a sha3 hash, if known.

type PrivateServiceChainMinerAPI

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

PrivateMinerAPI provides private RPC methods to control the miner. These methods can be abused by external users and must be considered insecure for use by untrusted users.

func NewPrivateServiceChainMinerAPI

func NewPrivateServiceChainMinerAPI(e *ServiceChain) *PrivateServiceChainMinerAPI

NewPrivateMinerAPI create a new RPC service which controls the miner of this node.

func (*PrivateServiceChainMinerAPI) GetHashrate

func (api *PrivateServiceChainMinerAPI) GetHashrate() uint64

GetHashrate returns the current hashrate of the miner.

func (*PrivateServiceChainMinerAPI) SetExtra

func (api *PrivateServiceChainMinerAPI) SetExtra(extra string) (bool, error)

SetExtra sets the extra data string that is included when this miner mines a block.

func (*PrivateServiceChainMinerAPI) SetGasPrice

func (api *PrivateServiceChainMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool

SetGasPrice sets the minimum accepted gas price for the miner.

func (*PrivateServiceChainMinerAPI) Start

func (api *PrivateServiceChainMinerAPI) Start(threads *int) error

Start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.

func (*PrivateServiceChainMinerAPI) Stop

func (api *PrivateServiceChainMinerAPI) Stop() bool

Stop the miner

type ProtocolManager

type ProtocolManager struct {
	SubProtocols []p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager

func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkId uint64, mux *event.TypeMux,
	txpool TxPool, engine consensus.Engine, blockchain BlockChain, chainDB database.DBManager,
	nodetype p2p.ConnType, cnconfig *Config) (*ProtocolManager, error)

NewProtocolManager returns a new Klaytn sub protocol manager. The Klaytn sub protocol manages peers capable with the Klaytn network.

func (*ProtocolManager) BroadcastBlock

func (pm *ProtocolManager) BroadcastBlock(block *types.Block)

BroadcastBlock will propagate a block to a subset of its peers. If current node is CN, it will send block to all PN peers + sampled CN peers without block. However, if there are more than 5 PN peers, it will sample 5 PN peers. If current node is not CN, it will send block to sampled peers except CNs.

func (*ProtocolManager) BroadcastBlockHash

func (pm *ProtocolManager) BroadcastBlockHash(block *types.Block)

BroadcastBlockHash will propagate a blockHash to a subset of its peers.

func (*ProtocolManager) BroadcastTxs

func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)

BroadcastTxs propagates a batch of transactions to its peers which are not known to already have the given transaction.

func (*ProtocolManager) Enqueue

func (pm *ProtocolManager) Enqueue(id string, block *types.Block)

Below functions are used in Istanbul BFT consensus. Enqueue wraps fetcher's Enqueue function to insert the given block.

func (*ProtocolManager) FindCNPeers

func (pm *ProtocolManager) FindCNPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer

func (*ProtocolManager) FindPeers

func (pm *ProtocolManager) FindPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer

func (*ProtocolManager) GetCNPeers

func (pm *ProtocolManager) GetCNPeers() map[common.Address]consensus.Peer

func (*ProtocolManager) GetENPeers

func (pm *ProtocolManager) GetENPeers() map[common.Address]consensus.Peer

func (*ProtocolManager) GetPeers

func (pm *ProtocolManager) GetPeers() []common.Address

func (*ProtocolManager) NodeInfo

func (pm *ProtocolManager) NodeInfo() *NodeInfo

NodeInfo retrieves some protocol metadata about the running host node.

func (*ProtocolManager) ReBroadcastTxs

func (pm *ProtocolManager) ReBroadcastTxs(txs types.Transactions)

ReBroadcastTxs sends transactions, not considering whether the peer has the transaction or not. Only PN and EN rebroadcast transactions to its peers, a CN does not rebroadcast transactions.

func (*ProtocolManager) RegisterValidator

func (pm *ProtocolManager) RegisterValidator(connType p2p.ConnType, validator p2p.PeerTypeValidator)

istanbul BFT

func (*ProtocolManager) SetRewardbase

func (pm *ProtocolManager) SetRewardbase(addr common.Address)

func (*ProtocolManager) SetRewardbaseWallet

func (pm *ProtocolManager) SetRewardbaseWallet(wallet accounts.Wallet)

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(maxPeers int)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

type ProtocolManagerFetcher added in v1.2.0

type ProtocolManagerFetcher interface {
	Enqueue(peer string, block *types.Block) error
	FilterBodies(peer string, transactions [][]*types.Transaction, time time.Time) [][]*types.Transaction
	FilterHeaders(peer string, headers []*types.Header, time time.Time) []*types.Header
	Notify(peer string, hash common.Hash, number uint64, time time.Time, headerFetcher fetcher.HeaderRequesterFn, bodyFetcher fetcher.BodyRequesterFn) error
	Start()
	Stop()
}

ProtocolManagerFetcher is an interface of fetcher.Fetcher used by ProtocolManager.

type PublicDebugAPI

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

PublicDebugAPI is the collection of Klaytn full node APIs exposed over the public debugging endpoint.

func NewPublicDebugAPI

func NewPublicDebugAPI(cn *CN) *PublicDebugAPI

NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Klaytn service.

func (*PublicDebugAPI) DumpBlock

func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)

DumpBlock retrieves the entire state of the database at a given block.

type PublicKlayAPI

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

PublicKlayAPI provides an API to access Klaytn CN-related information.

func NewPublicKlayAPI

func NewPublicKlayAPI(e *CN) *PublicKlayAPI

NewPublicKlayAPI creates a new Klaytn protocol API for full nodes.

func (*PublicKlayAPI) Hashrate

func (api *PublicKlayAPI) Hashrate() hexutil.Uint64

Hashrate returns the POW hashrate

func (*PublicKlayAPI) Rewardbase

func (api *PublicKlayAPI) Rewardbase() (common.Address, error)

Rewardbase is the address that consensus rewards will be send to

type PublicKlayServiceChainAPI

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

PublicKlayAPI provides an API to access Klaytn CN-related information.

func NewPublicKlayServiceChainAPI

func NewPublicKlayServiceChainAPI(sc *ServiceChain) *PublicKlayServiceChainAPI

NewPublicKlayAPI creates a new Klaytn protocol API for full nodes.

func (*PublicKlayServiceChainAPI) Hashrate

func (api *PublicKlayServiceChainAPI) Hashrate() hexutil.Uint64

Hashrate returns the POW hashrate

func (*PublicKlayServiceChainAPI) Signer

func (api *PublicKlayServiceChainAPI) Signer() (common.Address, error)

Signer is the address that signing the block.

type PublicMinerAPI

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

PublicMinerAPI provides an API to control the miner. It offers only methods that operate on data that pose no security risk when it is publicly accessible.

func NewPublicMinerAPI

func NewPublicMinerAPI(e *CN) *PublicMinerAPI

NewPublicMinerAPI create a new PublicMinerAPI instance.

func (*PublicMinerAPI) GetWork

func (api *PublicMinerAPI) GetWork() ([3]string, error)

GetWork returns a work package for external miner. The work package consists of 3 strings result[0], 32 bytes hex encoded current block header pow-hash result[1], 32 bytes hex encoded seed hash used for DAG result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/blockscore

func (*PublicMinerAPI) Mining

func (api *PublicMinerAPI) Mining() bool

Mining returns an indication if this node is currently mining.

func (*PublicMinerAPI) SubmitHashrate

func (api *PublicMinerAPI) SubmitHashrate(hashrate hexutil.Uint64, id common.Hash) bool

SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node. It accepts the miner hash rate and an identifier which must be unique between nodes.

func (*PublicMinerAPI) SubmitWork

func (api *PublicMinerAPI) SubmitWork(solution common.Hash) bool

SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note, this is not an indication if the provided work was valid!

type PublicServiceChainDebugAPI

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

PublicDebugAPI is the collection of Klaytn full node APIs exposed over the public debugging endpoint.

func NewPublicServiceChainDebugAPI

func NewPublicServiceChainDebugAPI(sc *ServiceChain) *PublicServiceChainDebugAPI

NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Klaytn service.

func (*PublicServiceChainDebugAPI) DumpBlock

func (api *PublicServiceChainDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)

DumpBlock retrieves the entire state of the database at a given block.

type PublicServiceChainMinerAPI

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

PublicMinerAPI provides an API to control the miner. It offers only methods that operate on data that pose no security risk when it is publicly accessible.

func NewPublicServiceChainMinerAPI

func NewPublicServiceChainMinerAPI(e *ServiceChain) *PublicServiceChainMinerAPI

NewPublicMinerAPI create a new PublicMinerAPI instance.

func (*PublicServiceChainMinerAPI) GetWork

func (api *PublicServiceChainMinerAPI) GetWork() ([3]string, error)

GetWork returns a work package for external miner. The work package consists of 3 strings result[0], 32 bytes hex encoded current block header pow-hash result[1], 32 bytes hex encoded seed hash used for DAG result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/blockScore

func (*PublicServiceChainMinerAPI) Mining

func (api *PublicServiceChainMinerAPI) Mining() bool

Mining returns an indication if this node is currently mining.

func (*PublicServiceChainMinerAPI) SubmitWork

func (api *PublicServiceChainMinerAPI) SubmitWork(solution common.Hash) bool

SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note, this is not an indication if the provided work was valid!

type ServiceChain

type ServiceChain struct {
	APIBackend *ServiceChainAPIBackend
	// contains filtered or unexported fields
}

ServiceChain implements the Klaytn servicechain node service.

func NewServiceChain

func NewServiceChain(ctx *node.ServiceContext, config *Config) (*ServiceChain, error)

New creates a new ServiceChain object (including the initialisation of the common ServiceChain object)

func (*ServiceChain) APIs

func (s *ServiceChain) APIs() []rpc.API

APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.

func (*ServiceChain) AccountManager

func (s *ServiceChain) AccountManager() *accounts.Manager

func (*ServiceChain) BlockChain

func (s *ServiceChain) BlockChain() *blockchain.BlockChain

func (*ServiceChain) ChainDB

func (s *ServiceChain) ChainDB() database.DBManager

func (*ServiceChain) Components

func (s *ServiceChain) Components() []interface{}

func (*ServiceChain) Engine

func (s *ServiceChain) Engine() consensus.Engine

func (*ServiceChain) EventMux

func (s *ServiceChain) EventMux() *event.TypeMux

func (*ServiceChain) IsListening

func (s *ServiceChain) IsListening() bool

func (*ServiceChain) IsMining

func (s *ServiceChain) IsMining() bool

func (*ServiceChain) Miner

func (s *ServiceChain) Miner() *work.Miner

func (*ServiceChain) NetVersion

func (s *ServiceChain) NetVersion() uint64

func (*ServiceChain) Progress added in v1.1.0

func (s *ServiceChain) Progress() klaytn.SyncProgress

func (*ServiceChain) ProtocolVersion

func (s *ServiceChain) ProtocolVersion() int

func (*ServiceChain) Protocols

func (s *ServiceChain) Protocols() []p2p.Protocol

Protocols implements node.Service, returning all the currently configured network protocols to start.

func (*ServiceChain) ReBroadcastTxs

func (s *ServiceChain) ReBroadcastTxs(transactions types.Transactions)

func (*ServiceChain) ResetWithGenesisBlock

func (s *ServiceChain) ResetWithGenesisBlock(gb *types.Block)

func (*ServiceChain) SetComponents

func (s *ServiceChain) SetComponents(component []interface{})

func (*ServiceChain) Signer

func (s *ServiceChain) Signer() (eb common.Address, err error)

func (*ServiceChain) Start

func (s *ServiceChain) Start(srvr p2p.Server) error

Start implements node.Service, starting all internal goroutines needed by the Klaytn protocol implementation.

func (*ServiceChain) StartMining

func (s *ServiceChain) StartMining(local bool) error

func (*ServiceChain) Stop

func (s *ServiceChain) Stop() error

Stop implements node.Service, terminating all internal goroutines used by the Klaytn protocol.

func (*ServiceChain) StopMining

func (s *ServiceChain) StopMining()

func (*ServiceChain) TxPool

func (s *ServiceChain) TxPool() *blockchain.TxPool

type ServiceChainAPIBackend

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

ServiceChainAPIBackend implements api.Backend for full nodes

func (*ServiceChainAPIBackend) AccountManager

func (b *ServiceChainAPIBackend) AccountManager() *accounts.Manager

func (*ServiceChainAPIBackend) BlockByNumber

func (b *ServiceChainAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

func (*ServiceChainAPIBackend) BloomStatus

func (b *ServiceChainAPIBackend) BloomStatus() (uint64, uint64)

func (*ServiceChainAPIBackend) ChainConfig

func (b *ServiceChainAPIBackend) ChainConfig() *params.ChainConfig

func (*ServiceChainAPIBackend) ChainDB

func (*ServiceChainAPIBackend) CurrentBlock

func (b *ServiceChainAPIBackend) CurrentBlock() *types.Block

func (*ServiceChainAPIBackend) EventMux

func (b *ServiceChainAPIBackend) EventMux() *event.TypeMux

func (*ServiceChainAPIBackend) GetBlock

func (b *ServiceChainAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*ServiceChainAPIBackend) GetBlockReceipts

func (b *ServiceChainAPIBackend) GetBlockReceipts(ctx context.Context, hash common.Hash) types.Receipts

GetBlockReceipts retrieves the receipts for all transactions with given block hash.

func (*ServiceChainAPIBackend) GetBlockReceiptsInCache

func (b *ServiceChainAPIBackend) GetBlockReceiptsInCache(blockHash common.Hash) types.Receipts

GetBlockReceiptsInCache retrieves receipts for a given block hash in cache.

func (*ServiceChainAPIBackend) GetEVM

func (b *ServiceChainAPIBackend) GetEVM(ctx context.Context, msg blockchain.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*ServiceChainAPIBackend) GetLogs

func (b *ServiceChainAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

func (*ServiceChainAPIBackend) GetNonceInCache

func (b *ServiceChainAPIBackend) GetNonceInCache(addr common.Address) (uint64, bool)

GetNonceInCache returns (cachedNonce, true) if nonce exists in cache. If not, it returns (0, false).

func (*ServiceChainAPIBackend) GetPoolNonce

func (b *ServiceChainAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) uint64

func (*ServiceChainAPIBackend) GetPoolTransaction

func (b *ServiceChainAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction

func (*ServiceChainAPIBackend) GetPoolTransactions

func (b *ServiceChainAPIBackend) GetPoolTransactions() (types.Transactions, error)

func (*ServiceChainAPIBackend) GetTd

func (b *ServiceChainAPIBackend) GetTd(blockHash common.Hash) *big.Int

func (*ServiceChainAPIBackend) GetTxAndLookupInfo

func (b *ServiceChainAPIBackend) GetTxAndLookupInfo(hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)

GetTxAndLookupInfo retrieves a tx and lookup info for a given transaction hash.

func (*ServiceChainAPIBackend) GetTxAndLookupInfoInCache

func (b *ServiceChainAPIBackend) GetTxAndLookupInfoInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)

GetTxAndLookupInfoInCache retrieves a tx and lookup info for a given transaction hash in cache.

func (*ServiceChainAPIBackend) GetTxLookupInfoAndReceipt

func (b *ServiceChainAPIBackend) GetTxLookupInfoAndReceipt(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)

GetTxLookupInfoAndReceipt retrieves a tx and lookup info and receipt for a given transaction hash.

func (*ServiceChainAPIBackend) GetTxLookupInfoAndReceiptInCache

func (b *ServiceChainAPIBackend) GetTxLookupInfoAndReceiptInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)

GetTxLookupInfoAndReceiptInCache retrieves a tx and lookup info and receipt for a given transaction hash in cache.

func (*ServiceChainAPIBackend) HeaderByNumber

func (b *ServiceChainAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*ServiceChainAPIBackend) IsParallelDBWrite

func (b *ServiceChainAPIBackend) IsParallelDBWrite() bool

func (*ServiceChainAPIBackend) IsSenderTxHashIndexingEnabled

func (b *ServiceChainAPIBackend) IsSenderTxHashIndexingEnabled() bool

func (*ServiceChainAPIBackend) Progress added in v1.1.0

func (*ServiceChainAPIBackend) ProtocolVersion

func (b *ServiceChainAPIBackend) ProtocolVersion() int

func (*ServiceChainAPIBackend) SendTx

func (b *ServiceChainAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

func (*ServiceChainAPIBackend) ServiceFilter

func (b *ServiceChainAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*ServiceChainAPIBackend) SetHead

func (b *ServiceChainAPIBackend) SetHead(number uint64)

func (*ServiceChainAPIBackend) StateAndHeaderByNumber

func (b *ServiceChainAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

func (*ServiceChainAPIBackend) Stats

func (b *ServiceChainAPIBackend) Stats() (pending int, queued int)

func (*ServiceChainAPIBackend) SubscribeChainEvent

func (b *ServiceChainAPIBackend) SubscribeChainEvent(ch chan<- blockchain.ChainEvent) event.Subscription

func (*ServiceChainAPIBackend) SubscribeChainHeadEvent

func (b *ServiceChainAPIBackend) SubscribeChainHeadEvent(ch chan<- blockchain.ChainHeadEvent) event.Subscription

func (*ServiceChainAPIBackend) SubscribeChainSideEvent

func (b *ServiceChainAPIBackend) SubscribeChainSideEvent(ch chan<- blockchain.ChainSideEvent) event.Subscription

func (*ServiceChainAPIBackend) SubscribeLogsEvent

func (b *ServiceChainAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*ServiceChainAPIBackend) SubscribeNewTxsEvent

func (b *ServiceChainAPIBackend) SubscribeNewTxsEvent(ch chan<- blockchain.NewTxsEvent) event.Subscription

func (*ServiceChainAPIBackend) SubscribeRemovedLogsEvent

func (b *ServiceChainAPIBackend) SubscribeRemovedLogsEvent(ch chan<- blockchain.RemovedLogsEvent) event.Subscription

func (*ServiceChainAPIBackend) SuggestPrice

func (b *ServiceChainAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

func (*ServiceChainAPIBackend) TxPoolContent

type StakingHandler added in v1.1.0

type StakingHandler interface {
	SetStakingManager(manager *reward.StakingManager)
	GetStakingManager() *reward.StakingManager
}

type StdTraceConfig

type StdTraceConfig struct {
	*vm.LogConfig
	Reexec *uint64
	TxHash common.Hash
}

StdTraceConfig holds extra parameters to standard-json trace functions.

type StorageRangeResult

type StorageRangeResult struct {
	Storage storageMap   `json:"storage"`
	NextKey *common.Hash `json:"nextKey"` // nil if Storage includes the last key in the statedb.
}

StorageRangeResult is the result of a debug_storageRangeAt API call.

type TraceConfig

type TraceConfig struct {
	*vm.LogConfig
	Tracer  *string
	Timeout *string
	Reexec  *uint64
}

TraceConfig holds extra parameters to trace functions.

type TxPool added in v1.2.0

type TxPool interface {
	// HandleTxMsg should add the given transactions to the pool.
	HandleTxMsg(types.Transactions)

	// Pending should return pending transactions.
	// The slice should be modifiable by the caller.
	Pending() (map[common.Address]types.Transactions, error)

	CachedPendingTxsByCount(count int) types.Transactions

	// SubscribeNewTxsEvent should return an event subscription of
	// NewTxsEvent and send events to the given channel.
	SubscribeNewTxsEvent(chan<- blockchain.NewTxsEvent) event.Subscription
}

TxPool is an interface of blockchain.TxPool used by ProtocolManager.

Directories

Path Synopsis
Package filters implements an ethereum filtering system for block, transactions and log events.
Package filters implements an ethereum filtering system for block, transactions and log events.
Package gasprice contains Oracle type which recommends gas prices based on recent blocks.
Package gasprice contains Oracle type which recommends gas prices based on recent blocks.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package tracers is a collection of JavaScript transaction tracers.
Package tracers is a collection of JavaScript transaction tracers.
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
Package tracers contains the actual JavaScript tracer assets.

Jump to

Keyboard shortcuts

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