ptn

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: GPL-3.0, GPL-3.0 Imports: 62 Imported by: 0

Documentation

Overview

Package ptn implements the PalletOne protocol.

Package ptn is a generated GoMock package.

Index

Constants

View Source
const (
	// Protocol messages belonging to ptn/1
	StatusMsg          = 0x00
	NewBlockHashesMsg  = 0x01
	TxMsg              = 0x02
	GetBlockHeadersMsg = 0x03
	BlockHeadersMsg    = 0x04
	GetBlockBodiesMsg  = 0x05
	BlockBodiesMsg     = 0x06
	NewBlockMsg        = 0x07
	NewBlockHeaderMsg  = 0x08
	VSSDealMsg         = 0x09
	VSSResponseMsg     = 0x0a
	SigShareMsg        = 0x0b
	GroupSigMsg        = 0x0c
	GetLeafNodesMsg    = 0x0d
	LeafNodesMsg       = 0x0e
	ContractMsg        = 0x0f
	ElectionMsg        = 0x10
	AdapterMsg         = 0x11

	GetNodeDataMsg = 0x20
	NodeDataMsg    = 0x21
)

ptn 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 (
	TestNetKeys   []string
	TestNetValues []string
	MainNetKeys   []string
	MainNetValues []string
)
View Source
var (
	// Chain index prefixes (use `i` + single byte to avoid mixing data types).
	BloomBitsIndexPrefix = []byte("iB") // BloomBitsIndexPrefix is the data table of a chain indexer to track its progress
)
View Source
var DefaultConfig = Config{
	SyncMode:      downloader.FastSync,
	NetworkId:     1,
	LightServ:     10,
	LightPeers:    25,
	CorsPeers:     0,
	DatabaseCache: 768,
	TrieCache:     256,
	TrieTimeout:   5 * time.Minute,
	CryptoLib:     []byte{0, 0},

	TxPool:         txspool.DefaultTxPoolConfig,
	Dag:            dagconfig.DagConfig,
	MediatorPlugin: mediatorplugin.DefaultConfig,
	Jury:           jury.DefaultConfig,
	Contract:       *contractcfg.NewContractConfig(),
}

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

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

Number of implemented message corresponding to different protocol versions.

View Source
var ProtocolName = "ptn"

Official short name of the protocol used during capability negotiation.

View Source
var ProtocolVersions = []uint{ptn1}

Supported versions of the ptn protocol (first is primary).

Functions

func CreateDB

func CreateDB(ctx *node.ServiceContext, config *Config) (palletdb.Database, error)

CreateDB creates the chain database.

Types

type BloomIndexer

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

BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index for the Ethereum 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 *modules.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 PalletOne 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

	// Cors client options
	//CorsServ  int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
	CorsPeers 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
	//Etherbase    common.Address `toml:",omitempty"`
	MinerThreads int    `toml:",omitempty"`
	ExtraData    []byte `toml:",omitempty"`
	CryptoLib    []byte

	// Transaction pool options
	TxPool txspool.TxPoolConfig `toml:"-"`

	// Enables tracking of SHA3 preimages in the VM
	EnablePreimageRecording bool
	// DAG options
	Dag dagconfig.Config `toml:"-"`

	//jury Account
	Jury jury.Config `toml:"-"`

	//Contract config
	Contract contractcfg.Config `toml:"-"`

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

	// append by Albert·Gou
	MediatorPlugin mediatorplugin.Config `toml:"-"`
}

type LesServer

type LesServer interface {
	Start(srvr *p2p.Server, corss *p2p.Server, syncCh chan bool)
	Stop()
	Protocols() []p2p.Protocol
	CorsProtocols() []p2p.Protocol
	StartCorsSync() (string, error)

	SubscribeCeEvent(ch chan<- *modules.Header) event.Subscription
}

type Mockproducer

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

Mockproducer is a mock of producer interface

func NewMockproducer

func NewMockproducer(ctrl *gomock.Controller) *Mockproducer

NewMockproducer creates a new mock instance

func (*Mockproducer) AddToDealBuf added in v1.0.1

func (m *Mockproducer) AddToDealBuf(deal *mediatorplugin.VSSDealEvent)

AddToDealBuf mocks base method

func (*Mockproducer) AddToResponseBuf

func (m *Mockproducer) AddToResponseBuf(resp *mediatorplugin.VSSResponseEvent)

AddToResponseBuf mocks base method

func (*Mockproducer) AddToTBLSRecoverBuf

func (m *Mockproducer) AddToTBLSRecoverBuf(sigShare *mediatorplugin.SigShareEvent)

AddToTBLSRecoverBuf mocks base method

func (*Mockproducer) AddToTBLSSignBufs

func (m *Mockproducer) AddToTBLSSignBufs(newHash common.Hash)

AddToTBLSSignBufs mocks base method

func (*Mockproducer) EXPECT

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

func (*Mockproducer) IsLocalMediator added in v1.0.4

func (m *Mockproducer) IsLocalMediator(add common.Address) bool

IsLocalMediator mocks base method

func (*Mockproducer) LocalHaveActiveMediator

func (m *Mockproducer) LocalHaveActiveMediator() bool

LocalHaveActiveMediator mocks base method

func (*Mockproducer) LocalHavePrecedingMediator

func (m *Mockproducer) LocalHavePrecedingMediator() bool

LocalHavePrecedingMediator mocks base method

func (*Mockproducer) SubscribeGroupSigEvent

func (m *Mockproducer) SubscribeGroupSigEvent(ch chan<- mediatorplugin.GroupSigEvent) event.Subscription

SubscribeGroupSigEvent mocks base method

func (*Mockproducer) SubscribeNewProducedUnitEvent

func (m *Mockproducer) SubscribeNewProducedUnitEvent(ch chan<- mediatorplugin.NewProducedUnitEvent) event.Subscription

SubscribeNewProducedUnitEvent mocks base method

func (*Mockproducer) SubscribeSigShareEvent

func (m *Mockproducer) SubscribeSigShareEvent(ch chan<- mediatorplugin.SigShareEvent) event.Subscription

SubscribeSigShareEvent mocks base method

func (*Mockproducer) SubscribeVSSDealEvent

func (m *Mockproducer) SubscribeVSSDealEvent(ch chan<- mediatorplugin.VSSDealEvent) event.Subscription

SubscribeVSSDealEvent mocks base method

func (*Mockproducer) SubscribeVSSResponseEvent

func (m *Mockproducer) SubscribeVSSResponseEvent(ch chan<- mediatorplugin.VSSResponseEvent) event.Subscription

SubscribeVSSResponseEvent mocks base method

func (*Mockproducer) UpdateMediatorsDKG

func (m *Mockproducer) UpdateMediatorsDKG(isRenew bool)

UpdateMediatorsDKG mocks base method

type MockproducerMockRecorder

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

MockproducerMockRecorder is the mock recorder for Mockproducer

func (*MockproducerMockRecorder) AddToDealBuf added in v1.0.1

func (mr *MockproducerMockRecorder) AddToDealBuf(deal interface{}) *gomock.Call

AddToDealBuf indicates an expected call of AddToDealBuf

func (*MockproducerMockRecorder) AddToResponseBuf

func (mr *MockproducerMockRecorder) AddToResponseBuf(resp interface{}) *gomock.Call

AddToResponseBuf indicates an expected call of AddToResponseBuf

func (*MockproducerMockRecorder) AddToTBLSRecoverBuf

func (mr *MockproducerMockRecorder) AddToTBLSRecoverBuf(sigShare interface{}) *gomock.Call

AddToTBLSRecoverBuf indicates an expected call of AddToTBLSRecoverBuf

func (*MockproducerMockRecorder) AddToTBLSSignBufs

func (mr *MockproducerMockRecorder) AddToTBLSSignBufs(newHash interface{}) *gomock.Call

AddToTBLSSignBufs indicates an expected call of AddToTBLSSignBufs

func (*MockproducerMockRecorder) IsLocalMediator added in v1.0.4

func (mr *MockproducerMockRecorder) IsLocalMediator(add interface{}) *gomock.Call

IsLocalMediator indicates an expected call of IsLocalMediator

func (*MockproducerMockRecorder) LocalHaveActiveMediator

func (mr *MockproducerMockRecorder) LocalHaveActiveMediator() *gomock.Call

LocalHaveActiveMediator indicates an expected call of LocalHaveActiveMediator

func (*MockproducerMockRecorder) LocalHavePrecedingMediator

func (mr *MockproducerMockRecorder) LocalHavePrecedingMediator() *gomock.Call

LocalHavePrecedingMediator indicates an expected call of LocalHavePrecedingMediator

func (*MockproducerMockRecorder) SubscribeGroupSigEvent

func (mr *MockproducerMockRecorder) SubscribeGroupSigEvent(ch interface{}) *gomock.Call

SubscribeGroupSigEvent indicates an expected call of SubscribeGroupSigEvent

func (*MockproducerMockRecorder) SubscribeNewProducedUnitEvent

func (mr *MockproducerMockRecorder) SubscribeNewProducedUnitEvent(ch interface{}) *gomock.Call

SubscribeNewProducedUnitEvent indicates an expected call of SubscribeNewProducedUnitEvent

func (*MockproducerMockRecorder) SubscribeSigShareEvent

func (mr *MockproducerMockRecorder) SubscribeSigShareEvent(ch interface{}) *gomock.Call

SubscribeSigShareEvent indicates an expected call of SubscribeSigShareEvent

func (*MockproducerMockRecorder) SubscribeVSSDealEvent

func (mr *MockproducerMockRecorder) SubscribeVSSDealEvent(ch interface{}) *gomock.Call

SubscribeVSSDealEvent indicates an expected call of SubscribeVSSDealEvent

func (*MockproducerMockRecorder) SubscribeVSSResponseEvent

func (mr *MockproducerMockRecorder) SubscribeVSSResponseEvent(ch interface{}) *gomock.Call

SubscribeVSSResponseEvent indicates an expected call of SubscribeVSSResponseEvent

func (*MockproducerMockRecorder) UpdateMediatorsDKG

func (mr *MockproducerMockRecorder) UpdateMediatorsDKG(isRenew interface{}) *gomock.Call

UpdateMediatorsDKG indicates an expected call of UpdateMediatorsDKG

type NodeInfo

type NodeInfo struct {
	Network uint64 `json:"network"` // PalletOne network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
	Index   uint64
	Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block
	Head    common.Hash `json:"head"`    // SHA3 hash of the host's best owned block
}

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

type PalletOne

type PalletOne struct {
	ApiBackend *PtnApiBackend
	// contains filtered or unexported fields
}

PalletOne implements the PalletOne full node service.

func New

func New(ctx *node.ServiceContext, config *Config, cache palletcache.ICache, isTestNet bool) (*PalletOne, error)

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

func (*PalletOne) APIs

func (s *PalletOne) 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 (*PalletOne) AccountManager

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

func (*PalletOne) AdapterBroadcast

func (s *PalletOne) AdapterBroadcast(event jury.AdapterEvent)

func (*PalletOne) AddCorsServer

func (p *PalletOne) AddCorsServer(cs LesServer) *PalletOne

func (*PalletOne) AddLesServer

func (p *PalletOne) AddLesServer(ls LesServer)

func (*PalletOne) ContractBroadcast

func (s *PalletOne) ContractBroadcast(event jury.ContractEvent, local bool)

func (*PalletOne) ContractProcessor

func (s *PalletOne) ContractProcessor() *jury.Processor

func (*PalletOne) CorsProtocols

func (s *PalletOne) CorsProtocols() []p2p.Protocol

func (*PalletOne) CorsServer

func (s *PalletOne) CorsServer() LesServer

func (*PalletOne) Dag

func (s *PalletOne) Dag() dag.IDag

func (*PalletOne) Downloader

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

func (*PalletOne) ElectionBroadcast

func (s *PalletOne) ElectionBroadcast(event jury.ElectionEvent, local bool)

func (*PalletOne) Engine

func (s *PalletOne) Engine() core.ConsensusEngine

func (*PalletOne) EthVersion

func (s *PalletOne) EthVersion() int

func (*PalletOne) EventMux

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

func (*PalletOne) GenesisHash added in v1.0.2

func (s *PalletOne) GenesisHash() common.Hash

func (*PalletOne) GetKeyStore

func (p *PalletOne) GetKeyStore() *keystore.KeyStore

@author Albert·Gou

func (*PalletOne) GetLocalActiveMediators

func (s *PalletOne) GetLocalActiveMediators() []common.Address

func (*PalletOne) GetLocalMediators

func (s *PalletOne) GetLocalMediators() []common.Address

func (*PalletOne) IsListening

func (s *PalletOne) IsListening() bool

func (*PalletOne) LocalHaveActiveMediator

func (s *PalletOne) LocalHaveActiveMediator() bool

func (*PalletOne) MockContractLocalSend

func (s *PalletOne) MockContractLocalSend(event jury.ContractEvent)

func (*PalletOne) NetVersion

func (s *PalletOne) NetVersion() uint64

func (*PalletOne) ProManager

func (s *PalletOne) ProManager() *ProtocolManager

func (*PalletOne) Protocols

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

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

func (*PalletOne) SignAndSendTransaction

func (p *PalletOne) SignAndSendTransaction(addr common.Address, tx *modules.Transaction) error

@author Albert·Gou

func (*PalletOne) SignGenericTransaction

func (p *PalletOne) SignGenericTransaction(from common.Address, tx *modules.Transaction) (*modules.Transaction, error)

func (*PalletOne) Start

func (s *PalletOne) Start(srvr *p2p.Server, corss *p2p.Server) error

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

func (*PalletOne) Stop

func (s *PalletOne) Stop() error

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

func (*PalletOne) TransferPtn

func (p *PalletOne) TransferPtn(from, to string, amount decimal.Decimal,
	text *string) (*ptnapi.TxExecuteResult, error)

@author Albert·Gou

func (*PalletOne) TxPool

func (s *PalletOne) TxPool() txspool.ITxPool

func (*PalletOne) UnitDb

func (s *PalletOne) UnitDb() ptndb.Database

type PeerInfo

type PeerInfo struct {
	Version int `json:"version"` // PalletOne protocol version negotiated
	//Difficulty uint64 `json:"difficulty"` // Total difficulty of the peer's blockchain
	Index uint64 `json:"index"` // Total difficulty 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 PalletOne sub-protocol metadata known about a connected peer.

type PrivateDebugAPI

type PrivateDebugAPI struct {
}

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

type PublicDebugAPI struct {
	ptn *PalletOne
}

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

func NewPublicDebugAPI(ptn *PalletOne) *PublicDebugAPI {
	return &PublicDebugAPI{ptn: ptn}
}

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

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

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

func NewProtocolManager

func NewProtocolManager(mode downloader.SyncMode, networkId uint64, gasToken modules.AssetId, txpool txPool,
	dag dag.IDag, mux *event.TypeMux, producer producer, genesis *modules.Unit,
	contractProc consensus.ContractInf, engine core.ConsensusEngine, contract *contracts.Contract, pDocker *utils.PalletOneDocker) (*ProtocolManager, error)

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

func (*ProtocolManager) AdapterBroadcast

func (pm *ProtocolManager) AdapterBroadcast(event jury.AdapterEvent)

func (*ProtocolManager) AdapterMsg

func (pm *ProtocolManager) AdapterMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) BlockBodiesMsg

func (pm *ProtocolManager) BlockBodiesMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) BlockHeadersMsg

func (pm *ProtocolManager) BlockHeadersMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) BroadcastCe

func (pm *ProtocolManager) BroadcastCe(ce []byte)

test for p2p broadcast

func (*ProtocolManager) BroadcastGroupSig

func (pm *ProtocolManager) BroadcastGroupSig(groupSig *mp.GroupSigEvent)

@author Albert·Gou BroadcastGroupSig will propagate the group signature of unit to p2p network

func (*ProtocolManager) BroadcastSigShare added in v1.0.4

func (pm *ProtocolManager) BroadcastSigShare(sigShare *mp.SigShareEvent)

func (*ProtocolManager) BroadcastTx

func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *modules.Transaction)

BroadcastTx will propagate a transaction to all peers which are not known to already have the given transaction.

func (*ProtocolManager) BroadcastUnit

func (pm *ProtocolManager) BroadcastUnit(unit *modules.Unit, propagate bool)

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

func (*ProtocolManager) BroadcastVSSDeal added in v1.0.4

func (pm *ProtocolManager) BroadcastVSSDeal(deal *mp.VSSDealEvent)

func (*ProtocolManager) BroadcastVSSResponse added in v1.0.4

func (pm *ProtocolManager) BroadcastVSSResponse(deal *mp.VSSResponseEvent)

func (*ProtocolManager) ContractBroadcast

func (pm *ProtocolManager) ContractBroadcast(event jury.ContractEvent, local bool)

func (*ProtocolManager) ContractMsg

func (pm *ProtocolManager) ContractMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) ContractReqLocalSend

func (pm *ProtocolManager) ContractReqLocalSend(event jury.ContractEvent)

func (*ProtocolManager) ElectionBroadcast

func (pm *ProtocolManager) ElectionBroadcast(event jury.ElectionEvent, local bool)

func (*ProtocolManager) ElectionMsg

func (pm *ProtocolManager) ElectionMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) GetActiveMediatorPeers

func (pm *ProtocolManager) GetActiveMediatorPeers() map[string]*peer

GetActiveMediatorPeers retrieves a list of peers that active mediator. If the value is nil, it is the node itself @author Albert·Gou

func (*ProtocolManager) GetBlockBodiesMsg

func (pm *ProtocolManager) GetBlockBodiesMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) GetBlockHeadersMsg

func (pm *ProtocolManager) GetBlockHeadersMsg(msg p2p.Msg, p *peer) error

Block header query, collect the requested headers and reply

func (*ProtocolManager) GetLeafNodesMsg

func (pm *ProtocolManager) GetLeafNodesMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) GetNodeDataMsg

func (pm *ProtocolManager) GetNodeDataMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) GetPeer

func (pm *ProtocolManager) GetPeer(node *discover.Node) (p *peer, self bool)

GetPeer, retrieve specified peer. If it is the node itself, p is nil and self is true @author Albert·Gou

func (*ProtocolManager) GroupSigMsg

func (pm *ProtocolManager) GroupSigMsg(msg p2p.Msg, p *peer) error

GroupSigMsg

func (*ProtocolManager) IsExistInCache

func (pm *ProtocolManager) IsExistInCache(id []byte) bool

func (*ProtocolManager) LocalHandle

func (pm *ProtocolManager) LocalHandle(p *peer) error

func (*ProtocolManager) NewBlockHashesMsg

func (pm *ProtocolManager) NewBlockHashesMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) NewBlockMsg

func (pm *ProtocolManager) NewBlockMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) NodeDataMsg

func (pm *ProtocolManager) NodeDataMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) NodeInfo

func (pm *ProtocolManager) NodeInfo(genesisHash common.Hash) *NodeInfo

NodeInfo retrieves some protocol metadata about the running host node.

func (*ProtocolManager) SigShareMsg

func (pm *ProtocolManager) SigShareMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(srvr *p2p.Server, maxPeers int, syncCh chan bool)

func (*ProtocolManager) StatusMsg

func (pm *ProtocolManager) StatusMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

func (*ProtocolManager) TxMsg

func (pm *ProtocolManager) TxMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) VSSDealMsg

func (pm *ProtocolManager) VSSDealMsg(msg p2p.Msg, p *peer) error

func (*ProtocolManager) VSSResponseMsg

func (pm *ProtocolManager) VSSResponseMsg(msg p2p.Msg, p *peer) error

type PtnApiBackend

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

PtnApiBackend implements ethapi.Backend for full nodes

func (*PtnApiBackend) AccountManager

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

func (*PtnApiBackend) BloomStatus

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

func (*PtnApiBackend) ChainDb

func (b *PtnApiBackend) ChainDb() ptndb.Database

func (*PtnApiBackend) ContractDeploy

func (b *PtnApiBackend) ContractDeploy(templateId []byte, txid string, args [][]byte,
	timeout time.Duration) (deployId []byte, err error)

func (*PtnApiBackend) ContractDeployReqTx

func (b *PtnApiBackend) ContractDeployReqTx(from, to common.Address, daoAmount, daoFee uint64, templateId []byte,
	args [][]byte, extData []byte, timeout time.Duration) (common.Hash, common.Address, error)

func (*PtnApiBackend) ContractDeployReqTxFee added in v1.0.3

func (b *PtnApiBackend) ContractDeployReqTxFee(from, to common.Address, daoAmount, daoFee uint64, templateId []byte,
	args [][]byte, extData []byte, timeout time.Duration) (fee float64, size float64, tm uint32, err error)

func (*PtnApiBackend) ContractInstall

func (b *PtnApiBackend) ContractInstall(ccName string, ccPath string, ccVersion string, ccDescription, ccAbi,
	ccLanguage string) ([]byte, error)

func (*PtnApiBackend) ContractInstallReqTx

func (b *PtnApiBackend) ContractInstallReqTx(from, to common.Address, daoAmount, daoFee uint64, tplName,
	path, version string, description, abi, language string, addrs []common.Address) (reqId common.Hash,
	tplId []byte, err error)

func (*PtnApiBackend) ContractInstallReqTxFee added in v1.0.3

func (b *PtnApiBackend) ContractInstallReqTxFee(from, to common.Address, daoAmount, daoFee uint64, tplName,
	path, version string, description, abi, language string, addrs []common.Address) (fee float64, size float64, tm uint32,
	err error)

func (*PtnApiBackend) ContractInvoke

func (b *PtnApiBackend) ContractInvoke(deployId []byte, txid string, args [][]byte,
	timeout time.Duration) ([]byte, error)

func (*PtnApiBackend) ContractInvokeReqTokenTx

func (b *PtnApiBackend) ContractInvokeReqTokenTx(from, to common.Address, token *modules.Asset,
	amountToken, fee uint64, contractAddress common.Address, args [][]byte, timeout uint32) (reqId common.Hash, err error)

func (*PtnApiBackend) ContractInvokeReqTx

func (b *PtnApiBackend) ContractInvokeReqTx(from, to common.Address, daoAmount, daoFee uint64, certID *big.Int,
	contractAddress common.Address, args [][]byte, timeout uint32) (reqId common.Hash, err error)

func (*PtnApiBackend) ContractInvokeReqTxFee added in v1.0.3

func (b *PtnApiBackend) ContractInvokeReqTxFee(from, to common.Address, daoAmount, daoFee uint64, certID *big.Int,
	contractAddress common.Address, args [][]byte, timeout uint32) (fee float64, size float64, tm uint32, err error)

func (*PtnApiBackend) ContractQuery

func (b *PtnApiBackend) ContractQuery(id []byte, args [][]byte, timeout time.Duration) (rspPayload []byte, err error)

func (*PtnApiBackend) ContractStop

func (b *PtnApiBackend) ContractStop(deployId []byte, txid string, deleteImage bool) error

func (*PtnApiBackend) ContractStopReqTx

func (b *PtnApiBackend) ContractStopReqTx(from, to common.Address, daoAmount, daoFee uint64, contractId common.Address,
	deleteImage bool) (reqId common.Hash, err error)

func (*PtnApiBackend) ContractStopReqTxFee added in v1.0.3

func (b *PtnApiBackend) ContractStopReqTxFee(from, to common.Address, daoAmount, daoFee uint64, contractId common.Address,
	deleteImage bool) (fee float64, size float64, tm uint32, err error)

func (*PtnApiBackend) Dag

func (b *PtnApiBackend) Dag() dag.IDag

func (*PtnApiBackend) DecodeJsonTx added in v1.0.3

func (b *PtnApiBackend) DecodeJsonTx(hexStr string) (string, error)

func (*PtnApiBackend) DecodeTx

func (b *PtnApiBackend) DecodeTx(hexStr string) (string, error)

func (*PtnApiBackend) Downloader

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

func (*PtnApiBackend) ElectionVrf

func (b *PtnApiBackend) ElectionVrf(id uint32) ([]byte, error)

func (*PtnApiBackend) EncodeTx

func (b *PtnApiBackend) EncodeTx(jsonStr string) (string, error)

func (*PtnApiBackend) EventMux

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

func (*PtnApiBackend) GetAddrByOutPoint

func (b *PtnApiBackend) GetAddrByOutPoint(outPoint *modules.OutPoint) (common.Address, error)

func (*PtnApiBackend) GetAddrOutpoints

func (b *PtnApiBackend) GetAddrOutpoints(addr string) ([]modules.OutPoint, error)

func (*PtnApiBackend) GetAddrRawUtxos

func (b *PtnApiBackend) GetAddrRawUtxos(addr string) (map[modules.OutPoint]*modules.Utxo, error)

func (*PtnApiBackend) GetAddrTokenFlow added in v1.0.3

func (b *PtnApiBackend) GetAddrTokenFlow(addr, token string) ([]*ptnjson.TokenFlowJson, error)

func (*PtnApiBackend) GetAddrTxHistory

func (b *PtnApiBackend) GetAddrTxHistory(addr string) ([]*ptnjson.TxHistoryJson, error)

func (*PtnApiBackend) GetAddrUtxos

func (b *PtnApiBackend) GetAddrUtxos(addr string) ([]*ptnjson.UtxoJson, error)

func (*PtnApiBackend) GetAddrUtxos2 added in v1.0.3

func (b *PtnApiBackend) GetAddrUtxos2(addr string) ([]*ptnjson.UtxoJson, error)

func (*PtnApiBackend) GetAddressBalanceStatistics added in v1.0.1

func (b *PtnApiBackend) GetAddressBalanceStatistics(token string, topN int) (*statistics.TokenAddressBalanceJson,
	error)

func (*PtnApiBackend) GetAllContractTpl

func (b *PtnApiBackend) GetAllContractTpl() ([]*ptnjson.ContractTemplateJson, error)

func (*PtnApiBackend) GetAllContracts

func (b *PtnApiBackend) GetAllContracts() ([]*ptnjson.ContractJson, error)

func (*PtnApiBackend) GetAllData added in v1.0.4

func (b *PtnApiBackend) GetAllData() ([][]byte, [][]byte)

func (*PtnApiBackend) GetAllUtxos

func (b *PtnApiBackend) GetAllUtxos() ([]*ptnjson.UtxoJson, error)

func (*PtnApiBackend) GetAssetExistence added in v1.0.1

func (b *PtnApiBackend) GetAssetExistence(asset string) ([]*ptnjson.ProofOfExistenceJson, error)

func (*PtnApiBackend) GetAssetTxHistory

func (b *PtnApiBackend) GetAssetTxHistory(asset *modules.Asset) ([]*ptnjson.TxHistoryJson, error)

func (*PtnApiBackend) GetChainParameters

func (b *PtnApiBackend) GetChainParameters() *core.ChainParameters

func (*PtnApiBackend) GetCommon

func (b *PtnApiBackend) GetCommon(key []byte, stableDb bool) ([]byte, error)

func (*PtnApiBackend) GetCommonByPrefix

func (b *PtnApiBackend) GetCommonByPrefix(prefix []byte, stableDb bool) map[string][]byte

func (*PtnApiBackend) GetContract

func (b *PtnApiBackend) GetContract(addr common.Address) (*ptnjson.ContractJson, error)

GetContract

func (*PtnApiBackend) GetContractInvokeHistory added in v1.0.3

func (b *PtnApiBackend) GetContractInvokeHistory(addr string) ([]*ptnjson.ContractInvokeHistoryJson, error)

func (*PtnApiBackend) GetContractState

func (b *PtnApiBackend) GetContractState(contractid []byte, key string) ([]byte, *modules.StateVersion, error)

func (*PtnApiBackend) GetContractStateJsonByPrefix added in v1.0.3

func (b *PtnApiBackend) GetContractStateJsonByPrefix(contractid []byte, prefix string) ([]ptnjson.ContractStateJson, error)

func (*PtnApiBackend) GetContractStatesByPrefix

func (b *PtnApiBackend) GetContractStatesByPrefix(contractid []byte,
	prefix string) (map[string]*modules.ContractStateValue, error)

func (*PtnApiBackend) GetContractTpl added in v1.0.1

func (b *PtnApiBackend) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)

func (*PtnApiBackend) GetContractsByTpl

func (b *PtnApiBackend) GetContractsByTpl(tplId []byte) ([]*ptnjson.ContractJson, error)

func (*PtnApiBackend) GetContractsWithJuryAddr added in v1.0.5

func (b *PtnApiBackend) GetContractsWithJuryAddr(addr common.Hash) []*modules.Contract

func (*PtnApiBackend) GetFileInfo

func (b *PtnApiBackend) GetFileInfo(filehash string) ([]*modules.FileInfo, error)

func (*PtnApiBackend) GetHeader

func (b *PtnApiBackend) GetHeader(hash common.Hash) (*modules.Header, error)

Get Header

func (*PtnApiBackend) GetHeaderByHash

func (b *PtnApiBackend) GetHeaderByHash(hash common.Hash) (*modules.Header, error)

func (*PtnApiBackend) GetHeaderByNumber

func (b *PtnApiBackend) GetHeaderByNumber(number *modules.ChainIndex) (*modules.Header, error)

func (*PtnApiBackend) GetJuryAccount

func (b *PtnApiBackend) GetJuryAccount() []common.Address

func (*PtnApiBackend) GetKeyStore

func (b *PtnApiBackend) GetKeyStore() *keystore.KeyStore

func (*PtnApiBackend) GetPoolTransaction

func (b *PtnApiBackend) GetPoolTransaction(hash common.Hash) *modules.Transaction

func (*PtnApiBackend) GetPoolTransactions

func (b *PtnApiBackend) GetPoolTransactions() (modules.Transactions, error)

func (*PtnApiBackend) GetPoolTxsByAddr

func (b *PtnApiBackend) GetPoolTxsByAddr(addr string) ([]*txspool.TxPoolTransaction, error)

func (*PtnApiBackend) GetPrefix

func (b *PtnApiBackend) GetPrefix(prefix string) map[string][]byte

func (*PtnApiBackend) GetProofTxInfoByHash

func (s *PtnApiBackend) GetProofTxInfoByHash(strtxhash string) ([][]byte, error)

func (*PtnApiBackend) GetStxoEntry added in v1.0.1

func (b *PtnApiBackend) GetStxoEntry(outpoint *modules.OutPoint) (*ptnjson.StxoJson, error)

func (*PtnApiBackend) GetTd

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

func (*PtnApiBackend) GetTrieSyncProgress

func (b *PtnApiBackend) GetTrieSyncProgress() (uint64, error)

func (*PtnApiBackend) GetTxByHash

func (b *PtnApiBackend) GetTxByHash(hash common.Hash) (*ptnjson.TxWithUnitInfoJson, error)

func (*PtnApiBackend) GetTxByReqId

func (b *PtnApiBackend) GetTxByReqId(hash common.Hash) (*ptnjson.TxWithUnitInfoJson, error)

func (*PtnApiBackend) GetTxByTxid_back

func (b *PtnApiBackend) GetTxByTxid_back(txid string) (*ptnjson.GetTxIdResult, error)

func (*PtnApiBackend) GetTxHashByReqId

func (b *PtnApiBackend) GetTxHashByReqId(reqid common.Hash) (common.Hash, error)

func (*PtnApiBackend) GetTxPoolTxByHash

func (b *PtnApiBackend) GetTxPoolTxByHash(hash common.Hash) (*ptnjson.TxPoolTxJson, error)

GetPoolTxByHash return a json of the tx in pool.

func (*PtnApiBackend) GetTxSearchEntry

func (b *PtnApiBackend) GetTxSearchEntry(hash common.Hash) (*ptnjson.TxSerachEntryJson, error)

func (*PtnApiBackend) GetUnit

func (b *PtnApiBackend) GetUnit(hash common.Hash) *modules.Unit

Get Unit

func (*PtnApiBackend) GetUnitByHash

func (b *PtnApiBackend) GetUnitByHash(hash common.Hash) *modules.Unit

func (*PtnApiBackend) GetUnitByNumber

func (b *PtnApiBackend) GetUnitByNumber(number *modules.ChainIndex) *modules.Unit

func (*PtnApiBackend) GetUnitNumber

func (b *PtnApiBackend) GetUnitNumber(hash common.Hash) uint64

Get UnitNumber

func (*PtnApiBackend) GetUnitTxsHashHex

func (b *PtnApiBackend) GetUnitTxsHashHex(hash common.Hash) ([]string, error)

func (*PtnApiBackend) GetUnitTxsInfo

func (b *PtnApiBackend) GetUnitTxsInfo(hash common.Hash) ([]*ptnjson.TxSummaryJson, error)

func (*PtnApiBackend) GetUnitsByIndex

func (b *PtnApiBackend) GetUnitsByIndex(start, end decimal.Decimal, asset string) []*modules.Unit

func (*PtnApiBackend) GetUnstableUnits

func (b *PtnApiBackend) GetUnstableUnits() []*ptnjson.UnitSummaryJson

func (*PtnApiBackend) GetUtxoEntry

func (b *PtnApiBackend) GetUtxoEntry(outpoint *modules.OutPoint) (*ptnjson.UtxoJson, error)

func (*PtnApiBackend) HeaderByNumber

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

func (*PtnApiBackend) MemdagInfos added in v1.0.4

func (b *PtnApiBackend) MemdagInfos() (*modules.MemdagInfos, error)

func (*PtnApiBackend) ProofTransactionByHash

func (s *PtnApiBackend) ProofTransactionByHash(tx string) (string, error)

func (*PtnApiBackend) ProofTransactionByRlptx

func (s *PtnApiBackend) ProofTransactionByRlptx(rlptx [][]byte) (string, error)

func (*PtnApiBackend) ProtocolVersion

func (b *PtnApiBackend) ProtocolVersion() int

func (*PtnApiBackend) QueryDbByKey

func (b *PtnApiBackend) QueryDbByKey(key []byte) *ptnjson.DbRowJson

func (*PtnApiBackend) QueryDbByPrefix

func (b *PtnApiBackend) QueryDbByPrefix(prefix []byte) []*ptnjson.DbRowJson

func (*PtnApiBackend) QueryProofOfExistenceByReference

func (b *PtnApiBackend) QueryProofOfExistenceByReference(ref string) ([]*ptnjson.ProofOfExistenceJson, error)

func (*PtnApiBackend) Queued

func (b *PtnApiBackend) Queued() ([]*txspool.TxPoolTransaction, error)

func (*PtnApiBackend) SaveCommon

func (b *PtnApiBackend) SaveCommon(key, val []byte) error

func (*PtnApiBackend) SendConsensus

func (b *PtnApiBackend) SendConsensus(ctx context.Context) error

func (*PtnApiBackend) SendContractInvokeReqTx added in v1.0.1

func (b *PtnApiBackend) SendContractInvokeReqTx(requestTx *modules.Transaction) (reqId common.Hash, err error)

func (*PtnApiBackend) SendTx

func (b *PtnApiBackend) SendTx(ctx context.Context, signedTx *modules.Transaction) error

func (*PtnApiBackend) SendTxs added in v1.0.1

func (b *PtnApiBackend) SendTxs(ctx context.Context, signedTxs []*modules.Transaction) []error

func (*PtnApiBackend) ServiceFilter

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

func (*PtnApiBackend) SetHead

func (b *PtnApiBackend) SetHead(number uint64)

func (*PtnApiBackend) SignAndSendRequest

func (b *PtnApiBackend) SignAndSendRequest(addr common.Address, tx *modules.Transaction) error

func (*PtnApiBackend) SignAndSendTransaction

func (b *PtnApiBackend) SignAndSendTransaction(addr common.Address, tx *modules.Transaction) error

func (*PtnApiBackend) StartCorsSync

func (b *PtnApiBackend) StartCorsSync() (string, error)

func (*PtnApiBackend) StateAndHeaderByNumber

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

func (*PtnApiBackend) Stats

func (b *PtnApiBackend) Stats() (int, int, int)

func (*PtnApiBackend) SubscribeTxPreEvent

func (b *PtnApiBackend) SubscribeTxPreEvent(ch chan<- modules.TxPreEvent) event.Subscription

func (*PtnApiBackend) SuggestPrice

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

func (*PtnApiBackend) SyncUTXOByAddr

func (b *PtnApiBackend) SyncUTXOByAddr(addr string) string

func (*PtnApiBackend) TransferPtn

func (b *PtnApiBackend) TransferPtn(from, to string, amount decimal.Decimal,
	text *string) (*ptnapi.TxExecuteResult, error)

func (*PtnApiBackend) TxPool

func (b *PtnApiBackend) TxPool() txspool.ITxPool

func (*PtnApiBackend) TxPoolContent

func (*PtnApiBackend) UpdateJuryAccount

func (b *PtnApiBackend) UpdateJuryAccount(addr common.Address, pwd string) bool

type PublicPalletOneAPI

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

PublicPalletOneAPI provides an API to access PalletOne full node-related information.

func NewPublicPalletOneAPI

func NewPublicPalletOneAPI(p *PalletOne) *PublicPalletOneAPI

NewPublicPalletOneAPI creates a new PalletOne protocol API for full nodes.

func (*PublicPalletOneAPI) Coinbase

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

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

func (*PublicPalletOneAPI) Hashrate

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

Hashrate returns the POW hashrate

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 Tag

type Tag uint64

type TraceConfig

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

TraceConfig holds extra parameters to trace functions.

type TransferPtnArgs

type TransferPtnArgs struct {
	From   string          `json:"from"`
	To     string          `json:"to"`
	Amount decimal.Decimal `json:"amount"`
	Text   *string         `json:"text"`
}

type TxDesc

type TxDesc struct {

	// StartingPriority is the priority of the transaction when it was added
	// to the pool.
	StartingPriority float64
	// contains filtered or unexported fields
}

TxDesc is a descriptor containing a transaction in the mempool along with additional metadata.

Directories

Path Synopsis
Package downloader contains the manual full chain synchronization.
Package downloader contains the manual full chain synchronization.
Package fetcher contains the block announcement based synchronization.
Package fetcher contains the block announcement based synchronization.
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