scdo

package
v0.0.0-...-f58d8a1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: LGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// DiscHandShakeErr peer handshake error
	DiscHandShakeErr = "disconnect because got handshake error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DebtInfo

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

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

func (m *DebtManager) Has(hash common.Hash) bool

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 NewScdoBackend

func NewScdoBackend(s *ScdoService) *ScdoBackend

NewScdoBackend backend

func (*ScdoBackend) ChainBackend

func (sd *ScdoBackend) ChainBackend() api.Chain

ChainBackend block chain db

func (*ScdoBackend) GetBlock

func (sd *ScdoBackend) GetBlock(hash common.Hash, height int64) (*types.Block, error)

GetBlock returns the requested block by hash or height

func (*ScdoBackend) GetBlockTotalDifficulty

func (sd *ScdoBackend) GetBlockTotalDifficulty(hash common.Hash) (*big.Int, error)

GetBlockTotalDifficulty return total difficulty

func (*ScdoBackend) GetNetVersion

func (sd *ScdoBackend) GetNetVersion() string

GetNetVersion net version

func (*ScdoBackend) GetNetWorkID

func (sd *ScdoBackend) GetNetWorkID() string

GetNetWorkID net id

func (*ScdoBackend) GetP2pServer

func (sd *ScdoBackend) GetP2pServer() *p2p.Server

GetP2pServer p2p server

func (*ScdoBackend) GetReceiptByTxHash

func (sd *ScdoBackend) GetReceiptByTxHash(hash common.Hash) (*types.Receipt, error)

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

func (sd *ScdoBackend) IsSyncing() bool

IsSyncing check status

func (*ScdoBackend) Log

func (sd *ScdoBackend) Log() *log.ScdoLog

Log return log pointer

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

type ScdoProtocol struct {
	p2p.Protocol
	// contains filtered or unexported fields
}

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

func (sp *ScdoProtocol) FindPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer

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

func (s *ScdoService) DebtPool() *core.DebtPool

DebtPool debt pool

func (*ScdoService) Downloader

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

Downloader get downloader

func (*ScdoService) Miner

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

Miner get miner

func (*ScdoService) MonitorChainHeaderChange

func (s *ScdoService) MonitorChainHeaderChange()

MonitorChainHeaderChange monitor and handle chain header event

func (*ScdoService) NetVersion

func (s *ScdoService) NetVersion() string

NetVersion net version

func (*ScdoService) NetWorkID

func (s *ScdoService) NetWorkID() string

NetWorkID net id

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.

func (*ScdoService) TxPool

func (s *ScdoService) TxPool() *core.TransactionPool

TxPool tx pool

type ServiceContext

type ServiceContext struct {
	DataDir string
}

ServiceContext is a collection of service configuration inherited from node

type TpsInfo

type TpsInfo struct {
	StartHeight uint64
	EndHeight   uint64
	Count       uint64
	Duration    uint64
}

TpsInfo tps detail info

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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