man

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 79 Imported by: 15

Documentation

Overview

Package man implements the Matrix protocol.

Index

Constants

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

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

man protocol message codes

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

Variables

View Source
var (
	SnapshootNumber   uint64
	SnapshootHash     string
	SaveSnapStart     uint64
	SaveSnapPeriod    uint64 = 300
	SnaploadFromLocal int    = 0
)
View Source
var DefaultConfig = Config{
	SyncMode: downloader.FastSync,
	Manash: manash.Config{
		CacheDir:       "manash",
		CachesInMem:    2,
		CachesOnDisk:   3,
		DatasetsInMem:  1,
		DatasetsOnDisk: 2,
	},
	NetworkId:     1,
	LightPeers:    100,
	DatabaseCache: 768,
	TrieCache:     256,
	TrieTimeout:   5 * time.Minute,
	GasPrice:      big.NewInt(18 * params.Shannon),

	TxPool: core.DefaultTxPoolConfig,
	GPO: gasprice.Config{
		Blocks:     20,
		Percentile: 60,
	},
}

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

View Source
var MsgCenter *mc.Center
View Source
var ProtocolLengths = []uint64{21, 8}

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

View Source
var ProtocolName = "man"

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

View Source
var ProtocolVersions = []uint{man63, man62}

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

Functions

func CreateConsensusEngine

func CreateConsensusEngine(ctx *pod.ServiceContext, config *manash.Config, chainConfig *params.ChainConfig, db mandb.Database) consensus.Engine

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

func CreateDB

func CreateDB(ctx *pod.ServiceContext, config *Config, name string) (mandb.Database, error)

CreateDB creates the chain database.

func NewBloomIndexer

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

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

func SendUdpTransactions

func SendUdpTransactions(txser []types.SelfTransaction) error

SendUdpTransactions

Types

type AllReward added in v1.1.1

type AllReward struct {
	Time      TimeZone
	Miner     []RewardMount
	Validator []RewardMount
	Interest  []InterestReward
}

type BloomIndexer

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

BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index for the Matrix 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 Matrix main net block is used.
	Genesis *core.Genesis `toml:",omitempty"`

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

	// Light client options
	LightServ  int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
	LightPeers int `toml:",omitempty"` // Maximum number of LES client peers

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

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

	// Manash options
	Manash manash.Config

	// 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:"-"`
}

func (Config) MarshalTOML

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

func (*Config) UnmarshalTOML

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

type InterestReward added in v1.1.1

type InterestReward struct {
	Account  string
	Reward   *big.Int
	VipLevel common.VIPRoleType
	Stock    uint16
	Deposit  *big.Int
}

type LesServer

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

type ManAPIBackend added in v1.1.1

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

ManAPIBackend implements manapi.Backend for full nodes

func (*ManAPIBackend) AccountManager added in v1.1.1

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

func (*ManAPIBackend) BlockByNumber added in v1.1.1

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

func (*ManAPIBackend) BloomStatus added in v1.1.1

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

func (*ManAPIBackend) ChainConfig added in v1.1.1

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

func (*ManAPIBackend) ChainDb added in v1.1.1

func (b *ManAPIBackend) ChainDb() mandb.Database

func (*ManAPIBackend) Config added in v1.1.1

func (b *ManAPIBackend) Config() *Config

func (*ManAPIBackend) CurrentBlock added in v1.1.1

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

func (*ManAPIBackend) Downloader added in v1.1.1

func (b *ManAPIBackend) Downloader() *downloader.Downloader

func (*ManAPIBackend) EventMux added in v1.1.1

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

func (*ManAPIBackend) FetcherNotify added in v1.1.1

func (b *ManAPIBackend) FetcherNotify(hash common.Hash, number uint64)

func (*ManAPIBackend) Genesis added in v1.1.1

func (b *ManAPIBackend) Genesis() *types.Block

func (*ManAPIBackend) GetBlock added in v1.1.1

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

func (*ManAPIBackend) GetDepositAccount added in v1.1.1

func (b *ManAPIBackend) GetDepositAccount(signAccount common.Address, blockHash common.Hash) (common.Address, error)

func (*ManAPIBackend) GetEVM added in v1.1.1

func (b *ManAPIBackend) GetEVM(ctx context.Context, msg txinterface.Message, state *state.StateDBManage, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*ManAPIBackend) GetFutureRewards added in v1.1.1

func (b *ManAPIBackend) GetFutureRewards(state *state.StateDBManage, number rpc.BlockNumber) (interface{}, error)

func (*ManAPIBackend) GetLogs added in v1.1.1

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

func (*ManAPIBackend) GetPoolNonce added in v1.1.1

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

func (*ManAPIBackend) GetPoolTransaction added in v1.1.1

func (b *ManAPIBackend) GetPoolTransaction(hash common.Hash) types.SelfTransaction

func (*ManAPIBackend) GetPoolTransactions added in v1.1.1

func (b *ManAPIBackend) GetPoolTransactions() (types.SelfTransactions, error)

func (*ManAPIBackend) GetReceipts added in v1.1.1

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

func (*ManAPIBackend) GetState added in v1.1.1

func (b *ManAPIBackend) GetState() (*state.StateDBManage, error)

func (*ManAPIBackend) GetTd added in v1.1.1

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

func (*ManAPIBackend) HeaderByHash added in v1.1.2

func (b *ManAPIBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*ManAPIBackend) HeaderByNumber added in v1.1.1

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

func (*ManAPIBackend) ImportSuperBlock added in v1.1.1

func (b *ManAPIBackend) ImportSuperBlock(ctx context.Context, filePath string) (common.Hash, error)

func (*ManAPIBackend) NetRPCService added in v1.1.1

func (b *ManAPIBackend) NetRPCService() *manapi.PublicNetAPI

func (*ManAPIBackend) NetWorkID added in v1.1.1

func (b *ManAPIBackend) NetWorkID() uint64

func (*ManAPIBackend) ProtocolVersion added in v1.1.1

func (b *ManAPIBackend) ProtocolVersion() int

func (*ManAPIBackend) SendBroadTx added in v1.1.1

func (b *ManAPIBackend) SendBroadTx(ctx context.Context, signedTx types.SelfTransaction, bType bool) error

func (*ManAPIBackend) SendTx added in v1.1.1

func (b *ManAPIBackend) SendTx(ctx context.Context, signedTx types.SelfTransaction) error

TODO 调用该方法的时候应该返回错误的切片

func (*ManAPIBackend) ServiceFilter added in v1.1.1

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

func (*ManAPIBackend) SetHead added in v1.1.1

func (b *ManAPIBackend) SetHead(number uint64)

func (*ManAPIBackend) SignTx added in v1.1.1

func (b *ManAPIBackend) SignTx(signedTx types.SelfTransaction, chainID *big.Int, blkHash common.Hash, signHeight uint64, usingEntrust bool) (types.SelfTransaction, error)

func (*ManAPIBackend) StateAndHeaderByHash added in v1.1.2

func (b *ManAPIBackend) StateAndHeaderByHash(ctx context.Context, hash common.Hash) (*state.StateDBManage, *types.Header, error)

func (*ManAPIBackend) StateAndHeaderByNumber added in v1.1.1

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

func (*ManAPIBackend) Stats added in v1.1.1

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

func (*ManAPIBackend) SubscribeChainEvent added in v1.1.1

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

func (*ManAPIBackend) SubscribeChainHeadEvent added in v1.1.1

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

func (*ManAPIBackend) SubscribeChainSideEvent added in v1.1.1

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

func (*ManAPIBackend) SubscribeLogsEvent added in v1.1.1

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

func (*ManAPIBackend) SubscribeNewTxsEvent added in v1.1.1

func (b *ManAPIBackend) SubscribeNewTxsEvent(ch chan core.NewTxsEvent) event.Subscription

func (*ManAPIBackend) SubscribeRemovedLogsEvent added in v1.1.1

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

func (*ManAPIBackend) SuggestPrice added in v1.1.1

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

func (*ManAPIBackend) SyncMode added in v1.1.1

func (b *ManAPIBackend) SyncMode() downloader.SyncMode

func (*ManAPIBackend) TxPoolContent added in v1.1.1

func (b *ManAPIBackend) TxPoolContent() (ntxs map[common.Address]types.SelfTransactions, btxs map[common.Address]types.SelfTransactions)

TODO 应该将返回值加入切片中否则以后多一种交易就要添加一个返回值

type Matrix added in v1.1.1

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

Matrix implements the Matrix full node service.

func New

func New(ctx *pod.ServiceContext, config *Config) (*Matrix, error)

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

func (*Matrix) APIs added in v1.1.1

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

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

func (*Matrix) AccountManager added in v1.1.1

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

func (*Matrix) AddLesServer added in v1.1.1

func (s *Matrix) AddLesServer(ls LesServer)

func (*Matrix) BlockChain added in v1.1.1

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

func (*Matrix) CA added in v1.1.1

func (s *Matrix) CA() *ca.Identity

func (*Matrix) ChainDb added in v1.1.1

func (s *Matrix) ChainDb() mandb.Database

func (*Matrix) DPOSEngine added in v1.1.1

func (s *Matrix) DPOSEngine() consensus.DPOSEngine

func (*Matrix) Downloader added in v1.1.1

func (s *Matrix) Downloader() *downloader.Downloader

func (*Matrix) Engine added in v1.1.1

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

func (*Matrix) EventMux added in v1.1.1

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

func (*Matrix) FetcherNotify added in v1.1.1

func (s *Matrix) FetcherNotify(hash common.Hash, number uint64, addr common.Address)
func (s *Matrix) FetcherNotify(hash common.Hash, number uint64) {
	ids := ca.GetRolesByGroup(common.RoleValidator | common.RoleBroadcast)
	selfId := p2p.ServerP2p.Self().ID.String()
	for _, id := range ids {
		if id.String() == selfId {
			log.Info("func FetcherNotify  NodeID is same ", "selfID", selfId, "ca`s nodeID", id.String())
			continue
		}
		peer := s.protocolManager.Peers.Peer(id.String()[:16])
		if peer == nil {
			continue
		}
		s.protocolManager.fetcher.Notify(id.String()[:16], hash, number, time.Now(), peer.RequestOneHeader, peer.RequestBodies)
	}
}

func (*Matrix) HD added in v1.1.1

func (s *Matrix) HD() *msgsend.HD

func (*Matrix) IsListening added in v1.1.1

func (s *Matrix) IsListening() bool

func (*Matrix) IsMining added in v1.1.1

func (s *Matrix) IsMining() bool

func (*Matrix) ManBlkDeal added in v1.1.1

func (s *Matrix) ManBlkDeal() *blkmanage.ManBlkManage

func (*Matrix) ManVersion added in v1.1.1

func (s *Matrix) ManVersion() int

func (*Matrix) Manerbase added in v1.1.1

func (s *Matrix) Manerbase() (eb common.Address, err error)

func (*Matrix) Miner added in v1.1.1

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

func (*Matrix) MsgCenter added in v1.1.1

func (s *Matrix) MsgCenter() *mc.Center

func (*Matrix) NetVersion added in v1.1.1

func (s *Matrix) NetVersion() uint64

func (*Matrix) OLConsensus added in v1.1.1

func (s *Matrix) OLConsensus() *olconsensus.TopNodeService

func (*Matrix) Protocols added in v1.1.1

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

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

func (*Matrix) Random added in v1.1.1

func (s *Matrix) Random() *baseinterface.Random

func (*Matrix) ReElection added in v1.1.1

func (s *Matrix) ReElection() *reelection.ReElection

func (*Matrix) ResetWithGenesisBlock added in v1.1.1

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

func (*Matrix) SignHelper added in v1.1.1

func (s *Matrix) SignHelper() *signhelper.SignHelper

func (*Matrix) Start added in v1.1.1

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

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

func (*Matrix) StartMining added in v1.1.1

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

func (*Matrix) Stop added in v1.1.1

func (s *Matrix) Stop() error

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

func (*Matrix) StopMining added in v1.1.1

func (s *Matrix) StopMining()

func (*Matrix) TxPool added in v1.1.1

func (s *Matrix) TxPool() *core.TxPoolManager

type NodeInfo

type NodeInfo struct {
	Network    uint64              `json:"network"`    // Matrix network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
	Difficulty *big.Int            `json:"difficulty"` // Total difficulty 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 Matrix sub-protocol metadata known about the host peer.

type PeerInfo

type PeerInfo struct {
	Version       int      `json:"version"`       // Matrix protocol version negotiated
	Difficulty    *big.Int `json:"difficulty"`    // Total difficulty of the peer's blockchain
	Head          string   `json:"head"`          // SHA3 hash of the peer's best owned block
	SuperBlockNum uint64   `json:"superBlockNum"` // SuperBlockHash
	SuperBlockSeq uint64   `json:"superBlockSeq"` // SuperBlockHash
}

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

type PrivateAdminAPI

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

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

func NewPrivateAdminAPI

func NewPrivateAdminAPI(man *Matrix) *PrivateAdminAPI

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

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *params.ChainConfig, man *Matrix) *PrivateDebugAPI

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

func (*PrivateDebugAPI) EvilFunc added in v1.1.2

func (api *PrivateDebugAPI) EvilFunc(types string, arg1, arg2, arg3 uint32) error

func (*PrivateDebugAPI) GetBadBlocks

func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]core.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) GetCommit added in v1.1.1

func (api *PrivateDebugAPI) GetCommit(ctx context.Context) ([]common.CommitContext, error)

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) 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 *Matrix) *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) TestChangeRole

func (api *PrivateMinerAPI) TestChangeRole(kind string, blocknum string, leader string)

func (*PrivateMinerAPI) TestHeaderGen

func (api *PrivateMinerAPI) TestHeaderGen(kind string, s string)

func (*PrivateMinerAPI) TestLocalMining

func (api *PrivateMinerAPI) TestLocalMining(kind string, s string)

type ProtocolManager

type ProtocolManager struct {

	//	peers      *peerSet
	Peers        *peerSet
	SubProtocols []p2p.Protocol

	Msgcenter *mc.Center
	// 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 *core.BlockChain, chaindb mandb.Database, MsgCenter *mc.Center) (*ProtocolManager, error)

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

func (*ProtocolManager) AllBroadcastBlock added in v1.1.1

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

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

func (pm *ProtocolManager) BroadcastBlockHeader(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). todo: debug

func (*ProtocolManager) BroadcastTxs

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

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)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

func (*ProtocolManager) WaitForDownLoadMode added in v1.1.1

func (pm *ProtocolManager) WaitForDownLoadMode()

lb WaitForDownLoadMode ...

type PublicDebugAPI

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

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

func NewPublicDebugAPI

func NewPublicDebugAPI(man *Matrix) *PublicDebugAPI

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

func (*PublicDebugAPI) DumpBlock

func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber, cointyp string, addr string) ([]state.CoinDump, error)

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

func (*PublicDebugAPI) DumpBlockAccount added in v1.1.2

func (api *PublicDebugAPI) DumpBlockAccount(blockNr rpc.BlockNumber, address common.Address) (state.Dump, error)

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

type PublicMatrixAPI

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

PublicMatrixAPI provides an API to access Matrix full node-related information.

func NewPublicMatrixAPI

func NewPublicMatrixAPI(e *Matrix) *PublicMatrixAPI

NewPublicMatrixAPI creates a new Matrix protocol API for full nodes.

func (*PublicMatrixAPI) Coinbase

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

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

func (*PublicMatrixAPI) Hashrate

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

Hashrate returns the POW hashrate

func (*PublicMatrixAPI) Manerbase

func (api *PublicMatrixAPI) Manerbase() (common.Address, error)

Manerbase is the address that mining rewards will be send to

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 *Matrix) *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/difficulty

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(nonce types.BlockNonce, solution, digest 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 RewardMount added in v1.1.1

type RewardMount struct {
	Account  string
	Reward   *big.Int
	VipLevel common.VIPRoleType
	Stock    uint16
}

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 TimeZone added in v1.1.1

type TimeZone struct {
	Start uint64
	Stop  uint64
}

type TraceConfig

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

TraceConfig holds extra parameters to trace functions.

Directories

Path Synopsis
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
Package fetcher contains the block announcement based synchronisation.
Package fetcher contains the block announcement based synchronisation.
Package filters implements an matrix filtering system for block, transactions and log events.
Package filters implements an matrix 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