ftservice

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

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

CreateDB creates the chain database.

Types

type APIBackend

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

APIBackend implements ftserviceapi.Backend for full nodes

func (*APIBackend) APIs

func (b *APIBackend) APIs() []rpc.API

APIs returns apis

func (*APIBackend) AddBadNode added in v0.0.8

func (b *APIBackend) AddBadNode(url string) error

AddBadNode add a bad Node and would cause the node disconnected

func (*APIBackend) AddPeer

func (b *APIBackend) AddPeer(url string) error

AddPeer add a P2P peer

func (*APIBackend) AddTrustedPeer

func (b *APIBackend) AddTrustedPeer(url string) error

AddTrustedPeer allows a remote node to always connect, even if slots are full

func (*APIBackend) BadNodes added in v0.0.8

func (b *APIBackend) BadNodes() []string

BadNodes returns all bad nodes.

func (*APIBackend) BadNodesCount added in v0.0.8

func (b *APIBackend) BadNodesCount() int

BadNodesCount returns the number of bad nodes.

func (*APIBackend) BlockByNumber

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

func (*APIBackend) ChainConfig

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

ChainConfig returns the active chain configuration.

func (*APIBackend) ChainDb

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

func (*APIBackend) CurrentBlock

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

func (*APIBackend) Engine

func (b *APIBackend) Engine() consensus.IEngine

APIs returns apis

func (*APIBackend) GetAccountManager

func (b *APIBackend) GetAccountManager() (*accountmanager.AccountManager, error)

func (*APIBackend) GetBadBlocks added in v0.0.7

func (b *APIBackend) GetBadBlocks(ctx context.Context) ([]*types.Block, error)

func (*APIBackend) GetBlock

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

func (*APIBackend) GetBlockDetailLog added in v0.0.7

func (b *APIBackend) GetBlockDetailLog(ctx context.Context, blockNr rpc.BlockNumber) *types.BlockAndResult

func (*APIBackend) GetDetailTxByFilter added in v0.0.7

func (b *APIBackend) GetDetailTxByFilter(ctx context.Context, filterFn func(common.Name) bool, blockNr rpc.BlockNumber, lookbackNum uint64) []*types.DetailTx

func (*APIBackend) GetDetailTxsLog added in v0.0.7

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

func (*APIBackend) GetEVM

func (b *APIBackend) GetEVM(ctx context.Context, account *accountmanager.AccountManager, state *state.StateDB, from common.Name, assetID uint64, gasPrice *big.Int, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*APIBackend) GetFeeManager added in v0.0.8

func (b *APIBackend) GetFeeManager() (*feemanager.FeeManager, error)

GetFeeManager get fee manager

func (*APIBackend) GetFeeManagerByTime added in v0.0.8

func (b *APIBackend) GetFeeManagerByTime(time uint64) (*feemanager.FeeManager, error)

GetFeeManagerByTime get fee manager

func (*APIBackend) GetLogs

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

func (*APIBackend) GetPoolTransaction

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

func (*APIBackend) GetPoolTransactions

func (b *APIBackend) GetPoolTransactions() ([]*types.Transaction, error)

func (*APIBackend) GetReceipts

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

func (*APIBackend) GetTd

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

func (*APIBackend) GetTxsByFilter added in v0.0.7

func (b *APIBackend) GetTxsByFilter(ctx context.Context, filterFn func(common.Name) bool, blockNr rpc.BlockNumber, lookbackNum uint64) []common.Hash

func (*APIBackend) HeaderByNumber

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

func (*APIBackend) PeerCount

func (b *APIBackend) PeerCount() int

PeerCount returns the number of connected peers.

func (*APIBackend) Peers

func (b *APIBackend) Peers() []string

Peers returns all connected peers.

func (*APIBackend) RemovePeer

func (b *APIBackend) RemovePeer(url string) error

RemovePeer remove a P2P peer

func (*APIBackend) RemoveTrustedPeer

func (b *APIBackend) RemoveTrustedPeer(url string) error

RemoveTrustedPeer removes a remote node from the trusted peer set, but it does not disconnect it automatically.

func (*APIBackend) SelfNode

func (b *APIBackend) SelfNode() string

SelfNode returns the local node's endpoint information.

func (*APIBackend) SendTx

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

func (*APIBackend) SetGasPrice

func (b *APIBackend) SetGasPrice(gasPrice *big.Int) bool

func (*APIBackend) SetStatePruning added in v0.0.8

func (b *APIBackend) SetStatePruning(enable bool) (bool, uint64)

SetStatePruning set state pruning

func (*APIBackend) StateAndHeaderByNumber

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

func (*APIBackend) Stats

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

func (*APIBackend) SuggestPrice

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

func (*APIBackend) TxPoolContent

func (b *APIBackend) TxPoolContent() (map[common.Name][]*types.Transaction, map[common.Name][]*types.Transaction)

type Config

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

	// Database options
	DatabaseHandles int
	DatabaseCache   int `mapstructure:"databasecache"`

	// Transaction pool options
	TxPool *txpool.Config `mapstructure:"txpool"`

	// Gas Price Oracle options
	GasPrice gasprice.Config `mapstructure:"gpo"`

	// miner
	Miner *MinerConfig `mapstructure:"miner"`

	MetricsConf *metrics.Config `mapstructure:"metrics"`

	StatePruning    bool `mapstructure:"statepruning"`
	ContractLogFlag bool `mapstructure:"contractlog"`
}

Config ftservice config

type FtService

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

FtService implements the fractal service.

func New

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

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

func (*FtService) APIs

func (fs *FtService) APIs() []rpc.API

APIs return the collection of RPC services the ftservice package offers.

func (*FtService) BlockChain

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

func (*FtService) ChainDb

func (s *FtService) ChainDb() fdb.Database

func (*FtService) Engine

func (s *FtService) Engine() consensus.IEngine

func (*FtService) GasPrice

func (fs *FtService) GasPrice() *big.Int

func (*FtService) Protocols

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

func (*FtService) SetGasPrice

func (fs *FtService) SetGasPrice(gasPrice *big.Int) bool

func (*FtService) Start

func (fs *FtService) Start() error

Start implements node.Service, starting all internal goroutines.

func (*FtService) Stop

func (fs *FtService) Stop() error

Stop implements node.Service, terminating all internal goroutine

func (*FtService) TxPool

func (s *FtService) TxPool() *txpool.TxPool

type MinerConfig

type MinerConfig struct {
	Start       bool     `mapstructure:"start"`
	Name        string   `mapstructure:"name"`
	PrivateKeys []string `mapstructure:"private"`
	ExtraData   string   `mapstructure:"extra"`
}

MinerConfig miner config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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