Documentation ¶
Index ¶
- func DefaultDataDir() string
- func DefaultMinerP2PConf() p2p.Config
- func DefaultP2PConf() p2p.Config
- type BaseComponent
- type BlockValidator
- type Chain
- type ChainVerifiersReader
- func (verifier *ChainVerifiersReader) CurrentVerifiers() []common.Address
- func (verifier *ChainVerifiersReader) GetPBFTPrimaryNode() common.Address
- func (verifier *ChainVerifiersReader) NextVerifiers() []common.Address
- func (verifier *ChainVerifiersReader) PrimaryNode() common.Address
- func (verifier *ChainVerifiersReader) ShouldChangeVerifier() bool
- func (verifier *ChainVerifiersReader) VerifiersTotalCount() int
- type CsNode
- type ExtraServiceFunc
- type ExtraServiceFuncConfig
- type MsgSender
- type Node
- type NodeConfig
- func (conf NodeConfig) FullChainDBDir() string
- func (conf NodeConfig) GetAllowHosts() []string
- func (conf NodeConfig) GetIsStartMine() bool
- func (conf NodeConfig) GetIsUploadNodeData() int
- func (conf NodeConfig) GetNodeHTTPPort() string
- func (conf NodeConfig) GetNodeName() string
- func (conf NodeConfig) GetNodeP2PPort() string
- func (conf NodeConfig) GetNodeType() int
- func (conf NodeConfig) GetPMetricsPort() int
- func (conf NodeConfig) GetUploadURL() string
- func (conf NodeConfig) HttpEndpoint() string
- func (conf NodeConfig) IpcEndpoint() string
- func (conf NodeConfig) LightChainDBDir() string
- func (conf NodeConfig) SoftWalletDir() string
- func (conf NodeConfig) SoftWalletFile() string
- func (conf NodeConfig) SoftWalletName() string
- func (conf NodeConfig) WsEndpoint() string
- type NodeService
- type VerifiersReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDataDir ¶
func DefaultDataDir() string
DefaultDataDir is the default data directory to use for the databases and other persistence requirements.
func DefaultMinerP2PConf ¶
Types ¶
type BaseComponent ¶
type BaseComponent struct { DipperinConfig *service.DipperinConfig // contains filtered or unexported fields }
type BlockValidator ¶
type BlockValidator interface { Valid(block model.AbstractBlock) error FullValid(block model.AbstractBlock) error }
type Chain ¶
type Chain interface { InsertBlocks(blocks []model.AbstractBlock) error Genesis() model.AbstractBlock CurrentBlock() model.AbstractBlock CurrentHeader() model.AbstractHeader CurrentSeed() (common.Hash, uint64) IsChangePoint(block model.AbstractBlock, isProcessPackageBlock bool) bool GetLastChangePoint(block model.AbstractBlock) *uint64 GetSlotByNum(num uint64) *uint64 GetSlot(block model.AbstractBlock) *uint64 GetCurrVerifiers() []common.Address GetVerifiers(round uint64) []common.Address GetNextVerifiers() []common.Address GetBlock(hash common.Hash, number uint64) model.AbstractBlock GetBlockByHash(hash common.Hash) model.AbstractBlock GetBlockByNumber(number uint64) model.AbstractBlock GetLatestNormalBlock() model.AbstractBlock HasBlock(hash common.Hash, number uint64) bool GetBody(hash common.Hash) model.AbstractBody GetBodyRLP(hash common.Hash) rlp.RawValue GetHeader(hash common.Hash, number uint64) model.AbstractHeader GetHeaderByHash(hash common.Hash) model.AbstractHeader GetHeaderByNumber(number uint64) model.AbstractHeader GetHeaderRLP(hash common.Hash) rlp.RawValue HasHeader(hash common.Hash, number uint64) bool GetBlockNumber(hash common.Hash) *uint64 GetTransaction(txHash common.Hash) (model.AbstractTransaction, common.Hash, uint64, uint64) GetStateStorage() state_processor.StateStorage CurrentState() (*state_processor.AccountStateDB, error) StateAtByBlockNumber(num uint64) (*state_processor.AccountStateDB, error) StateAtByStateRoot(root common.Hash) (*state_processor.AccountStateDB, error) ValidTx(tx model.AbstractTransaction) error GetSeenCommit(height uint64) []model.AbstractVerification SaveBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error }
fixme use cs_chain
type ChainVerifiersReader ¶
type ChainVerifiersReader struct {
// contains filtered or unexported fields
}
func MakeVerifiersReader ¶
func MakeVerifiersReader(fullChain cs_chain.Chain) *ChainVerifiersReader
TODO: change back to the permission
func (*ChainVerifiersReader) CurrentVerifiers ¶
func (verifier *ChainVerifiersReader) CurrentVerifiers() []common.Address
func (*ChainVerifiersReader) GetPBFTPrimaryNode ¶
func (verifier *ChainVerifiersReader) GetPBFTPrimaryNode() common.Address
fetch the primary node that have proposed the current block. But if it's the last block of the current round, then it should return the primary node of the next round.
func (*ChainVerifiersReader) NextVerifiers ¶
func (verifier *ChainVerifiersReader) NextVerifiers() []common.Address
func (*ChainVerifiersReader) PrimaryNode ¶
func (verifier *ChainVerifiersReader) PrimaryNode() common.Address
fetch the primary node that have proposed the current block
func (*ChainVerifiersReader) ShouldChangeVerifier ¶
func (verifier *ChainVerifiersReader) ShouldChangeVerifier() bool
func (*ChainVerifiersReader) VerifiersTotalCount ¶
func (verifier *ChainVerifiersReader) VerifiersTotalCount() int
type CsNode ¶
type CsNode struct {
// contains filtered or unexported fields
}
func NewCsNode ¶
func NewCsNode(services []NodeService) *CsNode
func (*CsNode) AddService ¶
func (n *CsNode) AddService(service NodeService)
type ExtraServiceFunc ¶
type ExtraServiceFunc func(c ExtraServiceFuncConfig) (apis []rpc.API, services []NodeService)
type ExtraServiceFuncConfig ¶
type ExtraServiceFuncConfig struct { service.DipperinConfig ChainService *service.MercuryFullChainService }
type MsgSender ¶
type MsgSender struct {
// contains filtered or unexported fields
}
func (*MsgSender) BroadcastEiBlock ¶
func (m *MsgSender) BroadcastEiBlock(block model.AbstractBlock)
func (*MsgSender) BroadcastMsg ¶
type Node ¶
type Node interface { // add extra service before node start AddService(service NodeService) Start() error Stop() Wait() }
manage dipperin app lifetime
func NewBftNode ¶
func NewBftNode(nodeConfig NodeConfig) (n Node)
type NodeConfig ¶
type NodeConfig struct { // cur node name Name string P2PListener string IPCPath string // app data dir DataDir string // HTTPHost is the host interface on which to start the HTTP RPC server. If this // field is empty, no HTTP API endpoint will be started. HTTPHost string `toml:",omitempty"` // HTTPPort is the TCP port number on which to start the HTTP RPC server. The // default zero value is/ valid and will pick a port number randomly (useful // for ephemeral nodes). HTTPPort int `toml:",omitempty"` // WSHost is the host interface on which to start the websocket RPC server. If // this field is empty, no websocket API endpoint will be started. WSHost string `toml:",omitempty"` // WSPort is the TCP port number on which to start the websocket RPC server. The // default zero value is/ valid and will pick a port number randomly (useful for // ephemeral nodes). WSPort int `toml:",omitempty"` // 0 normal 1 mine master 2 verifier NodeType int // Set debug mode, 0 is single node not broadcast, 1 is multi-node with PBFT, 2 is multi-node with PBFT and election DebugMode int SoftWalletPassword string SoftWalletPassPhrase string SoftWalletPath string IsStartMine bool //used to set the default account of pbft DefaultAccountKey string // Whether it includes browser function. 0 is not, 1 is IsScanner int IsUploadNodeData int //whether tps monitoring function 0 is not 1 is IsPerformance int // example http://127.0.0.1:8080 UploadURL string NoDiscovery int Nat string AllowHosts []string PMetricsPort int ExtraServiceFunc ExtraServiceFunc }
start a dipperin node config node config only in here, other module should use interface to use this config
func (NodeConfig) FullChainDBDir ¶
func (conf NodeConfig) FullChainDBDir() string
full and fast use same dir, fast to full should start sync history states
func (NodeConfig) GetAllowHosts ¶
func (conf NodeConfig) GetAllowHosts() []string
func (NodeConfig) GetIsStartMine ¶
func (conf NodeConfig) GetIsStartMine() bool
func (NodeConfig) GetIsUploadNodeData ¶
func (conf NodeConfig) GetIsUploadNodeData() int
func (NodeConfig) GetNodeHTTPPort ¶
func (conf NodeConfig) GetNodeHTTPPort() string
func (NodeConfig) GetNodeName ¶
func (conf NodeConfig) GetNodeName() string
func (NodeConfig) GetNodeP2PPort ¶
func (conf NodeConfig) GetNodeP2PPort() string
func (NodeConfig) GetNodeType ¶
func (conf NodeConfig) GetNodeType() int
func (NodeConfig) GetPMetricsPort ¶
func (conf NodeConfig) GetPMetricsPort() int
func (NodeConfig) GetUploadURL ¶
func (conf NodeConfig) GetUploadURL() string
func (NodeConfig) HttpEndpoint ¶
func (conf NodeConfig) HttpEndpoint() string
func (NodeConfig) IpcEndpoint ¶
func (conf NodeConfig) IpcEndpoint() string
func (NodeConfig) LightChainDBDir ¶
func (conf NodeConfig) LightChainDBDir() string
func (NodeConfig) SoftWalletDir ¶
func (conf NodeConfig) SoftWalletDir() string
func (NodeConfig) SoftWalletFile ¶
func (conf NodeConfig) SoftWalletFile() string
func (NodeConfig) SoftWalletName ¶
func (conf NodeConfig) SoftWalletName() string
func (NodeConfig) WsEndpoint ¶
func (conf NodeConfig) WsEndpoint() string
type NodeService ¶
type NodeService interface { Start() error Stop() }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.