Documentation ¶
Index ¶
- Constants
- type DebtInfo
- type DebtManager
- func (m *DebtManager) AddDebtMap(debtMap [][]*types.Debt, height uint64)
- func (m *DebtManager) AddDebts(debts []*types.Debt)
- func (m *DebtManager) GetAll() []*DebtInfo
- func (m *DebtManager) Has(hash common.Hash) bool
- func (m *DebtManager) Remove(hash common.Hash)
- func (m *DebtManager) TimingChecking()
- type PeerInfo
- type PrivateDebugAPI
- type PrivateMinerAPI
- func (api *PrivateMinerAPI) GetCoinbase() (string, error)
- func (api *PrivateMinerAPI) GetTarget() string
- func (api *PrivateMinerAPI) SetCoinbase(coinbaseStr string) (bool, error)
- func (api *PrivateMinerAPI) SetGpuBlocksThreads(blocks int, threads int) (bool, error)
- func (api *PrivateMinerAPI) SetThreads(threads int) (bool, error)
- func (api *PrivateMinerAPI) Start() (bool, error)
- func (api *PrivateMinerAPI) Status() (string, error)
- func (api *PrivateMinerAPI) Stop() (bool, error)
- type PublicScdoAPI
- func (api *PublicScdoAPI) Call(contract, payload string, height int64) (map[string]interface{}, error)
- func (api *PublicScdoAPI) EstimateGas(tx *types.Transaction) (uint64, error)
- func (api *PublicScdoAPI) GeneratePayload(abiJSON string, methodName string, args []string) (string, error)
- func (api *PublicScdoAPI) GetCurrentWorkHeader() map[string]interface{}
- func (api *PublicScdoAPI) GetInfo() (api2.GetMinerInfo2, error)
- func (api *PublicScdoAPI) GetLogs(height int64, contractAddress common.Address, abiJSON, eventName string) ([]api2.GetLogsResponse, error)
- func (api *PublicScdoAPI) GetShardNum(account common.Address) (uint, error)
- func (api *PublicScdoAPI) GetWork() map[string]interface{}
- func (api *PublicScdoAPI) SubmitNonce(height uint64, nonce uint64) error
- type ScdoBackend
- func (sd *ScdoBackend) ChainBackend() api.Chain
- func (sd *ScdoBackend) GetBlock(hash common.Hash, height int64) (*types.Block, error)
- func (sd *ScdoBackend) GetBlockTotalDifficulty(hash common.Hash) (*big.Int, error)
- func (sd *ScdoBackend) GetNetVersion() string
- func (sd *ScdoBackend) GetNetWorkID() string
- func (sd *ScdoBackend) GetP2pServer() *p2p.Server
- func (sd *ScdoBackend) GetReceiptByTxHash(hash common.Hash) (*types.Receipt, error)
- func (sd *ScdoBackend) GetTransaction(pool api.PoolCore, bcStore store.BlockchainStore, txHash common.Hash) (*types.Transaction, *api.BlockIndex, error)
- func (sd *ScdoBackend) GetUDPerver() *discovery.UDP
- func (sd *ScdoBackend) IsSyncing() bool
- func (sd *ScdoBackend) Log() *log.ScdoLog
- func (sd *ScdoBackend) ProtocolBackend() api.Protocol
- func (sd *ScdoBackend) TxPoolBackend() api.Pool
- type ScdoProtocol
- func (s *ScdoProtocol) Downloader() *downloader.Downloader
- func (sp *ScdoProtocol) FindPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer
- func (p *ScdoProtocol) GetProtocolVersion() (uint, error)
- func (p *ScdoProtocol) SendDifferentShardTx(tx *types.Transaction, shard uint)
- func (sp *ScdoProtocol) Start()
- func (sp *ScdoProtocol) Stop()
- type ScdoService
- func (s *ScdoService) APIs() (apis []rpc.API)
- func (s *ScdoService) AccountStateDB() database.Database
- func (s *ScdoService) BlockChain() *core.Blockchain
- func (s *ScdoService) DebtPool() *core.DebtPool
- func (s *ScdoService) Downloader() *downloader.Downloader
- func (s *ScdoService) Miner() *miner.Miner
- func (s *ScdoService) MonitorChainHeaderChange()
- func (s *ScdoService) NetVersion() string
- func (s *ScdoService) NetWorkID() string
- func (s *ScdoService) P2PServer() *p2p.Server
- func (s *ScdoService) Protocols() (protos []p2p.Protocol)
- func (s *ScdoService) Start(srvr *p2p.Server) error
- func (s *ScdoService) Stop() error
- func (s *ScdoService) TxPool() *core.TransactionPool
- type ServiceContext
- type TpsInfo
- type TransactionPoolAPI
Constants ¶
const ( // BlockChainDir blockchain data directory based on config.DataRoot BlockChainDir = "/db/blockchain" // AccountStateDir account state info directory based on config.DataRoot AccountStateDir = "/db/accountState" // DebtManagerDir to-be-sent debt directory based on config.DataRoot DebtManagerDir = "/db/debtManager" // BlockChainRecoveryPointFile is used to store the recovery point info of blockchain. BlockChainRecoveryPointFile = "recoveryPoint.json" )
const (
// DiscHandShakeErr peer handshake error
DiscHandShakeErr = "disconnect because got handshake error"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DebtManager ¶
type DebtManager struct {
// contains filtered or unexported fields
}
func NewDebtManager ¶
func NewDebtManager(debtChecker types.DebtVerifier, p propagateDebts, chain *core.Blockchain, debtManagerDB database.Database) *DebtManager
func (*DebtManager) AddDebtMap ¶
func (m *DebtManager) AddDebtMap(debtMap [][]*types.Debt, height uint64)
func (*DebtManager) AddDebts ¶
func (m *DebtManager) AddDebts(debts []*types.Debt)
func (*DebtManager) GetAll ¶
func (m *DebtManager) GetAll() []*DebtInfo
func (*DebtManager) Remove ¶
func (m *DebtManager) Remove(hash common.Hash)
func (*DebtManager) TimingChecking ¶
func (m *DebtManager) TimingChecking()
type PeerInfo ¶
type PeerInfo struct { Version uint `json:"version"` // Scdo 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 }
PeerInfo represents a short summary of a connected peer.
type PrivateDebugAPI ¶
type PrivateDebugAPI struct {
// contains filtered or unexported fields
}
PrivateDebugAPI provides an API to access full node-related information for debug.
func NewPrivateDebugAPI ¶
func NewPrivateDebugAPI(s *ScdoService) *PrivateDebugAPI
NewPrivateDebugAPI creates a new NewPrivateDebugAPI object for rpc service.
func (*PrivateDebugAPI) DumpHeap ¶
func (api *PrivateDebugAPI) DumpHeap(fileName string, gcBeforeDump bool) (string, error)
DumpHeap dumps the heap usage.
func (*PrivateDebugAPI) GetTPS ¶
func (api *PrivateDebugAPI) GetTPS() (*TpsInfo, error)
GetTPS get tps info
func (*PrivateDebugAPI) PrintBlock ¶
func (api *PrivateDebugAPI) PrintBlock(height int64) (*types.Block, error)
PrintBlock retrieves a block and returns its pretty printed form, when height is -1 the chain head is returned
type PrivateMinerAPI ¶
type PrivateMinerAPI struct {
// contains filtered or unexported fields
}
PrivateMinerAPI provides an API to access miner information.
func NewPrivateMinerAPI ¶
func NewPrivateMinerAPI(s *ScdoService) *PrivateMinerAPI
NewPrivateMinerAPI creates a new PrivateMinerAPI object for miner rpc service.
func (*PrivateMinerAPI) GetCoinbase ¶
func (api *PrivateMinerAPI) GetCoinbase() (string, error)
GetCoinbase API is used to get the coinbase.
func (*PrivateMinerAPI) GetTarget ¶
func (api *PrivateMinerAPI) GetTarget() string
func (*PrivateMinerAPI) SetCoinbase ¶
func (api *PrivateMinerAPI) SetCoinbase(coinbaseStr string) (bool, error)
SetCoinbase API is used to set the coinbase.
func (*PrivateMinerAPI) SetGpuBlocksThreads ¶
func (api *PrivateMinerAPI) SetGpuBlocksThreads(blocks int, threads int) (bool, error)
SetBlocksThreads API is used to set the number of thread blocks and blocks.
func (*PrivateMinerAPI) SetThreads ¶
func (api *PrivateMinerAPI) SetThreads(threads int) (bool, error)
SetThreads API is used to set the number of threads.
func (*PrivateMinerAPI) Start ¶
func (api *PrivateMinerAPI) Start() (bool, error)
Start API is used to start the miner with the given number of threads.
func (*PrivateMinerAPI) Status ¶
func (api *PrivateMinerAPI) Status() (string, error)
Status API is used to view the miner's status.
func (*PrivateMinerAPI) Stop ¶
func (api *PrivateMinerAPI) Stop() (bool, error)
Stop API is used to stop the miner.
type PublicScdoAPI ¶
type PublicScdoAPI struct {
// contains filtered or unexported fields
}
PublicScdoAPI provides an API to access full node-related information.
func NewPublicScdoAPI ¶
func NewPublicScdoAPI(s *ScdoService) *PublicScdoAPI
NewPublicScodAPI creates a new PublicScdoAPI object for rpc service.
func (*PublicScdoAPI) Call ¶
func (api *PublicScdoAPI) Call(contract, payload string, height int64) (map[string]interface{}, error)
Call is to execute a given transaction on a statedb of a given block height. It does not affect this statedb and blockchain and is useful for executing and retrieve values.
func (*PublicScdoAPI) EstimateGas ¶
func (api *PublicScdoAPI) EstimateGas(tx *types.Transaction) (uint64, error)
EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.
func (*PublicScdoAPI) GeneratePayload ¶
func (api *PublicScdoAPI) GeneratePayload(abiJSON string, methodName string, args []string) (string, error)
GeneratePayload according to abi json string and methodName and args to generate payload hex string
func (*PublicScdoAPI) GetCurrentWorkHeader ¶
func (api *PublicScdoAPI) GetCurrentWorkHeader() map[string]interface{}
func (*PublicScdoAPI) GetInfo ¶
func (api *PublicScdoAPI) GetInfo() (api2.GetMinerInfo2, error)
GetInfo gets the account address that mining rewards will be send to.
func (*PublicScdoAPI) GetLogs ¶
func (api *PublicScdoAPI) GetLogs(height int64, contractAddress common.Address, abiJSON, eventName string) ([]api2.GetLogsResponse, error)
GetLogs Get the logs that satisfies the condition in the block by height and filter
func (*PublicScdoAPI) GetShardNum ¶
func (api *PublicScdoAPI) GetShardNum(account common.Address) (uint, error)
GetShardNum gets the account shard number . if the address is valid, return the corresponding shard number, otherwise return 0
func (*PublicScdoAPI) GetWork ¶
func (api *PublicScdoAPI) GetWork() map[string]interface{}
GetWork get the work needed to be done
func (*PublicScdoAPI) SubmitNonce ¶
func (api *PublicScdoAPI) SubmitNonce(height uint64, nonce uint64) error
type ScdoBackend ¶
type ScdoBackend struct {
// contains filtered or unexported fields
}
func (*ScdoBackend) ChainBackend ¶
func (sd *ScdoBackend) ChainBackend() api.Chain
ChainBackend block chain db
func (*ScdoBackend) GetBlockTotalDifficulty ¶
GetBlockTotalDifficulty return total difficulty
func (*ScdoBackend) GetNetVersion ¶
func (sd *ScdoBackend) GetNetVersion() string
GetNetVersion net version
func (*ScdoBackend) GetP2pServer ¶
func (sd *ScdoBackend) GetP2pServer() *p2p.Server
GetP2pServer p2p server
func (*ScdoBackend) GetReceiptByTxHash ¶
GetReceiptByTxHash get receipt by transaction hash
func (*ScdoBackend) GetTransaction ¶
func (sd *ScdoBackend) GetTransaction(pool api.PoolCore, bcStore store.BlockchainStore, txHash common.Hash) (*types.Transaction, *api.BlockIndex, error)
GetTransaction return tx
func (*ScdoBackend) GetUDPerver ¶
func (sd *ScdoBackend) GetUDPerver() *discovery.UDP
GetUDPServer UDP server
func (*ScdoBackend) ProtocolBackend ¶
func (sd *ScdoBackend) ProtocolBackend() api.Protocol
ProtocolBackend return protocol
func (*ScdoBackend) TxPoolBackend ¶
func (sd *ScdoBackend) TxPoolBackend() api.Pool
TxPoolBackend tx pool
type ScdoProtocol ¶
ScdoProtocol service implementation of scdo
func NewScdoProtocol ¶
func NewScdoProtocol(scdo *ScdoService, log *log.ScdoLog) (s *ScdoProtocol, err error)
NewScdoProtocol create ScdoProtocol
func (*ScdoProtocol) Downloader ¶
func (s *ScdoProtocol) Downloader() *downloader.Downloader
Downloader return a pointer of the downloader
func (*ScdoProtocol) GetProtocolVersion ¶
func (p *ScdoProtocol) GetProtocolVersion() (uint, error)
func (*ScdoProtocol) SendDifferentShardTx ¶
func (p *ScdoProtocol) SendDifferentShardTx(tx *types.Transaction, shard uint)
SendDifferentShardTx send tx to different shards
func (*ScdoProtocol) Start ¶
func (sp *ScdoProtocol) Start()
func (*ScdoProtocol) Stop ¶
func (sp *ScdoProtocol) Stop()
Stop stops protocol, called when scdoService quits.
type ScdoService ¶
type ScdoService struct {
// contains filtered or unexported fields
}
ScdoService implements full node service.
func NewScdoService ¶
func NewScdoService(ctx context.Context, conf *node.Config, log *log.ScdoLog, engine consensus.Engine, verifier types.DebtVerifier, startHeight int, isPoolMode bool) (s *ScdoService, err error)
NewScdoService create ScdoService
func (*ScdoService) APIs ¶
func (s *ScdoService) APIs() (apis []rpc.API)
APIs implements node.Service, returning the collection of RPC services the scdo package offers. must to make sure that the order of the download api is 5; we get the download api by 5
func (*ScdoService) AccountStateDB ¶
func (s *ScdoService) AccountStateDB() database.Database
AccountStateDB return account state db
func (*ScdoService) BlockChain ¶
func (s *ScdoService) BlockChain() *core.Blockchain
BlockChain get blockchain
func (*ScdoService) Downloader ¶
func (s *ScdoService) Downloader() *downloader.Downloader
Downloader get downloader
func (*ScdoService) MonitorChainHeaderChange ¶
func (s *ScdoService) MonitorChainHeaderChange()
MonitorChainHeaderChange monitor and handle chain header event
func (*ScdoService) P2PServer ¶
func (s *ScdoService) P2PServer() *p2p.Server
P2PServer get p2pServer
func (*ScdoService) Protocols ¶
func (s *ScdoService) Protocols() (protos []p2p.Protocol)
Protocols implements node.Service, returning all the currently configured network protocols to start.
func (*ScdoService) Start ¶
func (s *ScdoService) Start(srvr *p2p.Server) error
Start implements node.Service, starting goroutines needed by ScdoService.
func (*ScdoService) Stop ¶
func (s *ScdoService) Stop() error
Stop implements node.Service, terminating all internal goroutines.
type ServiceContext ¶
type ServiceContext struct {
DataDir string
}
ServiceContext is a collection of service configuration inherited from node
type TransactionPoolAPI ¶
type TransactionPoolAPI struct {
// contains filtered or unexported fields
}
TransactionPoolAPI provides an API to access transaction pool information.
func NewTransactionPoolAPI ¶
func NewTransactionPoolAPI(s *ScdoService) *TransactionPoolAPI
NewTransactionPoolAPI creates a new PrivateTransactionPoolAPI object for transaction pool rpc service.
func (*TransactionPoolAPI) GetDebtByHash ¶
func (api *TransactionPoolAPI) GetDebtByHash(debtHash string) (map[string]interface{}, error)
GetDebtByHash return the debt info by debt hash
func (*TransactionPoolAPI) GetPendingDebts ¶
func (api *TransactionPoolAPI) GetPendingDebts() ([]*types.Debt, error)
GetPendingDebts returns all pending debts