cpc

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: GPL-3.0 Imports: 55 Imported by: 4

Documentation

Overview

Package cpc implements the cpchain protocol.

Index

Constants

View Source
const (
	// Protocol messages belonging to eth/62
	StatusMsg          = 0x00
	NewBlockHashesMsg  = 0x01
	TxMsg              = 0x02
	GetBlockHeadersMsg = 0x03
	BlockHeadersMsg    = 0x04
	GetBlockBodiesMsg  = 0x05
	BlockBodiesMsg     = 0x06
	NewBlockMsg        = 0x07
	GetBlocksMsg       = 0x08
	BlocksMsg          = 0x09

	// Protocol messages belonging to eth/63
	GetNodeDataMsg = 0x0d
	NodeDataMsg    = 0x0e
	GetReceiptsMsg = 0x0f
	ReceiptsMsg    = 0x10
)

eth protocol message codes

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

Variables

View Source
var DefaultConfig = Config{
	NetworkId:     configs.MainnetNetworkId,
	DatabaseCache: 768,
	TrieCache:     256,
	TrieTimeout:   60 * time.Minute,
	GasPrice:      big.NewInt(18 * configs.Shannon),

	TxPool: core.DefaultTxPoolConfig,
	GPO: gasprice.Config{
		Blocks:     20,
		Percentile: 60,
	},
	PrivateTx: private.DefaultConfig(),
	SyncMode:  syncer.FullSync,
}

DefaultConfig contains default settings.

View Source
var ProtocolLengths = []uint64{100}

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

View Source
var ProtocolName = "cpc"

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

View Source
var ProtocolVersions = []uint{configs.Cpc1}

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

View Source
var (
	StartSyncerLoop chan string = make(chan string)
)

Functions

func CreateDB

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

CreateDB creates the chain database.

func NewBloomIndexer

func NewBloomIndexer(db database.Database, size uint64) *core.ChainIndexer

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

Types

type APIBackend

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

APIBackend implements cpcapi.Backend for full nodes

func (*APIBackend) AccountManager

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

func (*APIBackend) BlockByNumber

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

func (*APIBackend) BlockReward

func (b *APIBackend) BlockReward(blockNum rpc.BlockNumber) *big.Int

func (*APIBackend) BloomStatus

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

func (*APIBackend) CalcRptInfo

func (b *APIBackend) CalcRptInfo(address common.Address, addresses []common.Address, blockNum uint64) int64

func (*APIBackend) ChainConfig

func (b *APIBackend) ChainConfig() *configs.ChainConfig

ChainConfig returns the active chain configuration.

func (*APIBackend) ChainDb

func (b *APIBackend) ChainDb() database.Database

func (*APIBackend) CommitteMember

func (b *APIBackend) CommitteMember() []common.Address

CommitteMember return current committe

func (*APIBackend) CurrentBlock

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

func (*APIBackend) CurrentProposerIndex

func (b *APIBackend) CurrentProposerIndex() uint64

CurrentProposerIndex return current proposer index, (0,1,...,11)

func (*APIBackend) CurrentTerm

func (b *APIBackend) CurrentTerm() uint64

CurrentTerm return current term

func (*APIBackend) CurrentView

func (b *APIBackend) CurrentView() uint64

CurrentView return current view, (0,1,2)

func (*APIBackend) Downloader

func (b *APIBackend) Downloader() syncer.Syncer

func (*APIBackend) EventMux

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

func (*APIBackend) GetBlock

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

func (*APIBackend) GetEVM

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

func (*APIBackend) GetLogs

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

func (*APIBackend) GetPoolNonce

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

func (*APIBackend) GetPoolTransaction

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

func (*APIBackend) GetPoolTransactions

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

func (*APIBackend) GetPrivateReceipt

func (b *APIBackend) GetPrivateReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*APIBackend) GetReceipts

func (b *APIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

func (*APIBackend) HeaderByNumber

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

func (*APIBackend) ProposerOf

func (b *APIBackend) ProposerOf(blockNum rpc.BlockNumber) (common.Address, error)

func (*APIBackend) Proposers

func (b *APIBackend) Proposers(blockNum rpc.BlockNumber) ([]common.Address, error)

Proposers returns block Proposers information

func (*APIBackend) ProtocolVersion

func (b *APIBackend) ProtocolVersion() int

func (*APIBackend) RNode

func (b *APIBackend) RNode() ([]common.Address, uint64)

RNode returns current RNode information

func (*APIBackend) RemoteDB

func (b *APIBackend) RemoteDB() database.RemoteDatabase

RemoteDB returns remote database instance.

func (*APIBackend) SendTx

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

func (*APIBackend) ServiceFilter

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

func (*APIBackend) SetHead

func (b *APIBackend) SetHead(number uint64)

func (*APIBackend) StateAndHeaderByNumber

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

func (*APIBackend) Stats

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

func (*APIBackend) SubscribeChainEvent

func (b *APIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*APIBackend) SubscribeChainHeadEvent

func (b *APIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription

func (*APIBackend) SubscribeChainSideEvent

func (b *APIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription

func (*APIBackend) SubscribeLogsEvent

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

func (*APIBackend) SubscribeNewTxsEvent

func (b *APIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

func (*APIBackend) SubscribeRemovedLogsEvent

func (b *APIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*APIBackend) SuggestPrice

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

func (*APIBackend) SupportPrivateTx

func (b *APIBackend) SupportPrivateTx(ctx context.Context) (bool, error)

func (*APIBackend) TermLen

func (b *APIBackend) TermLen() uint64

TermLen return current TermLen

func (*APIBackend) TxPoolContent

func (b *APIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)

func (*APIBackend) Validators

func (b *APIBackend) Validators(blockNr rpc.BlockNumber) ([]common.Address, error)

Validators returns current block Validators information

func (*APIBackend) ViewLen

func (b *APIBackend) ViewLen() uint64

ViewLen return current ViewLen

type BadBlockArgs

type BadBlockArgs struct {
	Hash  common.Hash            `json:"hash"`
	Block map[string]interface{} `json:"block"`
	RLP   string                 `json:"rlp"`
}

BadBlockArgs represents the entries in the list returned when bad blocks are queried.

type BloomIndexer

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

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

func (*BloomIndexer) Commit

func (b *BloomIndexer) Commit() error

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

func (*BloomIndexer) Process

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

Process implements core.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 core.ChainIndexerBackend, starting a new bloombits index section.

type Config

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

	// Protocol options
	NetworkId uint64 // Network ID to use for selecting peers to connect to
	NoPruning bool   // TODO: remove it {AC}

	// Database options
	SkipBcVersionCheck bool `toml:"-"`
	DatabaseHandles    int  `toml:"-"`
	DatabaseCache      int
	TrieCache          int
	TrieTimeout        time.Duration

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

	// Transaction pool options
	TxPool core.TxPoolConfig

	// Gas Price Oracle options
	GPO gasprice.Config

	// Enables tracking of SHA3 preimages in the VM
	EnablePreimageRecording bool

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

	// Private Tx related configuration
	PrivateTx private.Config

	SyncMode syncer.SyncMode `toml:"-"`
}

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 CpchainService

type CpchainService struct {

	// chain service backend
	APIBackend          *APIBackend
	AdmissionApiBackend admission.ApiBackend
	// contains filtered or unexported fields
}

CpchainService implements the CpchainService full node service.

func New

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

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

func (*CpchainService) APIs

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

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

func (*CpchainService) AccountManager

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

func (*CpchainService) AddLesServer

func (s *CpchainService) AddLesServer(ls LesServer)

func (*CpchainService) BlockChain

func (s *CpchainService) BlockChain() *core.BlockChain

func (*CpchainService) ChainDb

func (s *CpchainService) ChainDb() database.Database

func (*CpchainService) Coinbase

func (s *CpchainService) Coinbase() (coinbase common.Address, err error)

func (*CpchainService) CpcVersion

func (s *CpchainService) CpcVersion() int

func (*CpchainService) CreateConsensusEngine

func (s *CpchainService) CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *configs.ChainConfig,
	db database.Database) consensus.Engine

CreateConsensusEngine creates the required type of consensus engine instance for an Cpchain service

func (*CpchainService) Downloader

func (s *CpchainService) Downloader() syncer.Syncer

func (*CpchainService) Engine

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

func (*CpchainService) EventMux

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

func (*CpchainService) IsListening

func (s *CpchainService) IsListening() bool

func (*CpchainService) IsMining

func (s *CpchainService) IsMining() bool

func (*CpchainService) Miner

func (s *CpchainService) Miner() *miner.Miner

func (*CpchainService) NetVersion

func (s *CpchainService) NetVersion() uint64

func (*CpchainService) Protocols

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

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

func (*CpchainService) RemoteDB

func (s *CpchainService) RemoteDB() database.RemoteDatabase

func (*CpchainService) ResetWithGenesisBlock

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

func (*CpchainService) SetAsMiner

func (s *CpchainService) SetAsMiner(isMiner bool)

SetAsMiner sets dpor engine as miner

func (*CpchainService) SetAsValidator

func (s *CpchainService) SetAsValidator()

SetAsValidator sets the node as validator and it cannot set back to false once it is set to true.

func (*CpchainService) SetCoinbase

func (s *CpchainService) SetCoinbase(coinbase common.Address)

SetCoinbase sets the mining reward address.

func (*CpchainService) SetupValidator

func (s *CpchainService) SetupValidator() error

func (*CpchainService) Start

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

start implements node.service, starting all internal goroutines needed by the cpchain protocol implementation.

func (*CpchainService) StartMining

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

func (*CpchainService) Stop

func (s *CpchainService) Stop() error

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

func (*CpchainService) StopMining

func (s *CpchainService) StopMining()

func (*CpchainService) TxPool

func (s *CpchainService) TxPool() *core.TxPool

type LesServer

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

type NodeInfo

type NodeInfo struct {
	Network uint64               `json:"network"` // cpchain network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
	Height  *big.Int             `json:"height"`  // height of the host's blockchain
	Genesis common.Hash          `json:"genesis"` // SHA3 hash of the host's genesis block
	Config  *configs.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 Cpchain sub-protocol metadata known about the host peer.

type PeerInfo

type PeerInfo struct {
	Version int      `json:"version"` // cpchain protocol version negotiated
	Height  *big.Int `json:"height"`  // height 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 cpchain sub-protocol metadata known about a connected peer.

type PrivateAdminAPI

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

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

func NewPrivateAdminAPI

func NewPrivateAdminAPI(eth *CpchainService) *PrivateAdminAPI

NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the cpchain 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 cpchain full node APIs exposed over the private debugging endpoint.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *configs.ChainConfig, service *CpchainService) *PrivateDebugAPI

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

func (*PrivateDebugAPI) GetBadBlocks

func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*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)

GetModifiedAccountsByNumber 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) StorageRangeAt

func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error)

StorageRangeAt returns the storage at the given block height and transaction index.

func (*PrivateDebugAPI) TraceBlock

func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, 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 *CpchainService) *PrivateMinerAPI

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

func (*PrivateMinerAPI) SetCoinbase

func (api *PrivateMinerAPI) SetCoinbase(coinbase common.Address) bool

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) 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 ProtocolManager

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

func NewProtocolManager

func NewProtocolManager(config *configs.ChainConfig, networkID uint64, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *core.BlockChain, chaindb database.Database, coinbase common.Address, syncMode syncer.SyncMode) (*ProtocolManager, error)

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

func (*ProtocolManager) BroadcastBlock

func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool)

BroadcastBlock will either propagate a block to a subset of it's peers, or will only announce it's availability (depending what's requested).

func (*ProtocolManager) BroadcastTxs

func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions, force bool)

BroadcastTxs will propagate a batch of transactions to all peers which are not known to already have the given transaction.

func (*ProtocolManager) NodeInfo

func (pm *ProtocolManager) NodeInfo() *NodeInfo

NodeInfo retrieves some protocol metadata about the running host node.

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(maxPeers int)

Start starts all the blockchain synchronization mechanisms

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

Stop stops all

func (*ProtocolManager) SyncFromBestPeer

func (pm *ProtocolManager) SyncFromBestPeer()

func (*ProtocolManager) SyncFromPeer

func (pm *ProtocolManager) SyncFromPeer(p *p2p.Peer)

type PublicCpchainAPI

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

PublicCpchainAPI provides an API to access cpchain full node-related information.

func NewPublicCpchainAPI

func NewPublicCpchainAPI(e *CpchainService) *PublicCpchainAPI

NewPublicCpchainAPI creates a new cpchain protocol API for full nodes.

func (*PublicCpchainAPI) Coinbase

func (api *PublicCpchainAPI) Coinbase() (common.Address, error)

Coinbase is the address that mining rewards will be send to (alias for Coinbase)

func (*PublicCpchainAPI) Cpcbase

func (api *PublicCpchainAPI) Cpcbase() (common.Address, error)

Coinbase is the address that mining rewards will be send to

type PublicDebugAPI

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

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

func NewPublicDebugAPI

func NewPublicDebugAPI(eth *CpchainService) *PublicDebugAPI

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

func (*PublicDebugAPI) DporPeers

func (api *PublicDebugAPI) DporPeers() ([]*backend.PeerInfo, error)

DporPeers retrieves all the information we know about each individual peer at the dpor protocol level

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 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 *CpchainService) *PublicMinerAPI

NewPublicMinerAPI create a new PublicMinerAPI instance.

func (*PublicMinerAPI) Mining

func (api *PublicMinerAPI) Mining() bool

Mining returns an indication if this node is currently mining.

type StorageRangeResult

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

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.

Directories

Path Synopsis
Package fetcher is for new block body/hash broadcast msg handling.
Package fetcher is for new block body/hash broadcast msg handling.
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 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