hmy

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains on the server side.
	BloomBitsBlocks uint64 = 4096
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBackend

type APIBackend struct {
	TotalStakingCache struct {
		sync.Mutex
		BlockHeight  int64
		TotalStaking *big.Int
	}
	// contains filtered or unexported fields
}

APIBackend An implementation of internal/hmyapi/Backend. Full client.

func (*APIBackend) BlockByNumber

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

BlockByNumber ...

func (*APIBackend) BloomStatus

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

BloomStatus ... TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) ChainConfig

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

ChainConfig ...

func (*APIBackend) ChainDb

func (b *APIBackend) ChainDb() ethdb.Database

ChainDb ...

func (*APIBackend) CurrentBlock

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

CurrentBlock ...

func (*APIBackend) EventMux

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

EventMux ... TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) GetAccountNonce added in v1.3.8

func (b *APIBackend) GetAccountNonce(
	ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (uint64, error)

GetAccountNonce returns the nonce value of the given address for the given block number

func (*APIBackend) GetAllValidatorAddresses added in v1.3.0

func (b *APIBackend) GetAllValidatorAddresses() []common.Address

GetAllValidatorAddresses returns the up to date validator candidates for next epoch

func (*APIBackend) GetBalance

func (b *APIBackend) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*big.Int, error)

GetBalance returns balance of an given address.

func (*APIBackend) GetBlock

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

GetBlock ...

func (*APIBackend) GetCurrentBadBlocks added in v1.3.4

func (b *APIBackend) GetCurrentBadBlocks() []core.BadBlock

GetCurrentBadBlocks ..

func (*APIBackend) GetCurrentStakingErrorSink added in v1.3.0

func (b *APIBackend) GetCurrentStakingErrorSink() types.TransactionErrorReports

GetCurrentStakingErrorSink ..

func (*APIBackend) GetCurrentTransactionErrorSink

func (b *APIBackend) GetCurrentTransactionErrorSink() types.TransactionErrorReports

GetCurrentTransactionErrorSink ..

func (*APIBackend) GetCurrentUtilityMetrics added in v1.3.1

func (b *APIBackend) GetCurrentUtilityMetrics() (*network.UtilityMetric, error)

GetCurrentUtilityMetrics ..

func (*APIBackend) GetDelegationsByDelegator added in v1.3.0

func (b *APIBackend) GetDelegationsByDelegator(
	delegator common.Address,
) ([]common.Address, []*staking.Delegation)

GetDelegationsByDelegator returns all delegation information of a delegator

func (*APIBackend) GetDelegationsByDelegatorByBlock added in v1.3.11

func (b *APIBackend) GetDelegationsByDelegatorByBlock(
	delegator common.Address, block *types.Block,
) ([]common.Address, []*staking.Delegation)

GetDelegationsByDelegatorByBlock returns all delegation information of a delegator

func (*APIBackend) GetDelegationsByValidator added in v1.3.0

func (b *APIBackend) GetDelegationsByValidator(validator common.Address) []*staking.Delegation

GetDelegationsByValidator returns all delegation information of a validator

func (*APIBackend) GetEVM

func (b *APIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.DB, header *block.Header) (*vm.EVM, func() error, error)

GetEVM returns a new EVM entity

func (*APIBackend) GetElectedValidatorAddresses added in v1.3.2

func (b *APIBackend) GetElectedValidatorAddresses() []common.Address

GetElectedValidatorAddresses returns the address of elected validators for current epoch

func (b *APIBackend) GetLastCrossLinks() ([]*types.CrossLink, error)

GetLastCrossLinks ..

func (*APIBackend) GetLatestChainHeaders added in v1.2.7

func (b *APIBackend) GetLatestChainHeaders() *block.HeaderPair

GetLatestChainHeaders ..

func (*APIBackend) GetLogs

func (b *APIBackend) GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error)

GetLogs ...

func (*APIBackend) GetMedianRawStakeSnapshot added in v1.3.0

func (b *APIBackend) GetMedianRawStakeSnapshot() (
	*committee.CompletedEPoSRound, error,
)

GetMedianRawStakeSnapshot ..

func (*APIBackend) GetNodeMetadata added in v1.3.8

func (b *APIBackend) GetNodeMetadata() commonRPC.NodeMetadata

GetNodeMetadata ..

func (*APIBackend) GetPendingCXReceipts added in v1.1.1

func (b *APIBackend) GetPendingCXReceipts() []*types.CXReceiptsProof

GetPendingCXReceipts ..

func (*APIBackend) GetPoolNonce

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

GetPoolNonce ...

func (*APIBackend) GetPoolStats added in v1.3.11

func (b *APIBackend) GetPoolStats() (pendingCount, queuedCount int)

GetPoolStats returns the number of pending and queued transactions

func (*APIBackend) GetPoolTransaction

func (b *APIBackend) GetPoolTransaction(hash common.Hash) types.PoolTransaction

GetPoolTransaction ...

func (*APIBackend) GetPoolTransactions

func (b *APIBackend) GetPoolTransactions() (types.PoolTransactions, error)

GetPoolTransactions returns pool transactions.

func (*APIBackend) GetReceipts

func (b *APIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

GetReceipts ...

func (*APIBackend) GetShardID

func (b *APIBackend) GetShardID() uint32

GetShardID returns shardID of this node

func (*APIBackend) GetShardState added in v1.3.0

func (b *APIBackend) GetShardState() (*shard.State, error)

GetShardState ...

func (*APIBackend) GetStakingTransactionsCount added in v1.3.8

func (b *APIBackend) GetStakingTransactionsCount(address, txType string) (uint64, error)

GetStakingTransactionsCount returns the number of staking transactions of address.

func (*APIBackend) GetStakingTransactionsHistory added in v1.3.7

func (b *APIBackend) GetStakingTransactionsHistory(address, txType, order string) ([]common.Hash, error)

GetStakingTransactionsHistory returns list of staking transactions hashes of address.

func (*APIBackend) GetSuperCommittees added in v1.3.2

func (b *APIBackend) GetSuperCommittees() (*quorum.Transition, error)

GetSuperCommittees ..

func (*APIBackend) GetTotalStakingSnapshot added in v1.3.2

func (b *APIBackend) GetTotalStakingSnapshot() *big.Int

GetTotalStakingSnapshot ..

func (*APIBackend) GetTransactionsCount added in v1.3.8

func (b *APIBackend) GetTransactionsCount(address, txType string) (uint64, error)

GetTransactionsCount returns the number of regular transactions of address.

func (*APIBackend) GetTransactionsHistory

func (b *APIBackend) GetTransactionsHistory(address, txType, order string) ([]common.Hash, error)

GetTransactionsHistory returns list of transactions hashes of address.

func (*APIBackend) GetValidatorInformation added in v1.3.0

func (b *APIBackend) GetValidatorInformation(
	addr common.Address, block *types.Block,
) (*staking.ValidatorRPCEnchanced, error)

GetValidatorInformation returns the information of validator

func (*APIBackend) GetValidatorSelfDelegation added in v1.3.0

func (b *APIBackend) GetValidatorSelfDelegation(addr common.Address) *big.Int

GetValidatorSelfDelegation returns the amount of staking after applying all delegated stakes

func (*APIBackend) GetValidators added in v1.3.0

func (b *APIBackend) GetValidators(epoch *big.Int) (*shard.Committee, error)

GetValidators returns validators for a particular epoch.

func (*APIBackend) HeaderByHash

func (b *APIBackend) HeaderByHash(ctx context.Context, blockHash common.Hash) (*block.Header, error)

HeaderByHash ...

func (*APIBackend) HeaderByNumber

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

HeaderByNumber ...

func (*APIBackend) IsLeader

func (b *APIBackend) IsLeader() bool

IsLeader exposes if node is currently leader

func (*APIBackend) NetVersion

func (b *APIBackend) NetVersion() uint64

NetVersion returns net version

func (*APIBackend) ProtocolVersion

func (b *APIBackend) ProtocolVersion() int

ProtocolVersion ...

func (*APIBackend) RPCGasCap

func (b *APIBackend) RPCGasCap() *big.Int

RPCGasCap returns the gas cap of rpc

func (*APIBackend) ResendCx

func (b *APIBackend) ResendCx(ctx context.Context, txID common.Hash) (uint64, bool)

ResendCx retrieve blockHash from txID and add blockHash to CxPool for resending Note that cross shard txn is only for regular txns, not for staking txns, so the input txn hash is expected to be regular txn hash

func (*APIBackend) SendStakingTx

func (b *APIBackend) SendStakingTx(
	ctx context.Context,
	newStakingTx *staking.StakingTransaction) error

SendStakingTx adds a staking transaction

func (*APIBackend) SendTx

func (b *APIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

SendTx ...

func (*APIBackend) ServiceFilter

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

ServiceFilter ...

func (*APIBackend) SingleFlightForgetKey added in v1.3.9

func (b *APIBackend) SingleFlightForgetKey(key string)

SingleFlightForgetKey ...

func (*APIBackend) SingleFlightRequest added in v1.3.9

func (b *APIBackend) SingleFlightRequest(
	key string,
	fn func() (interface{}, error),
) (interface{}, error)

SingleFlightRequest ...

func (*APIBackend) StateAndHeaderByNumber

func (b *APIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.DB, *block.Header, error)

StateAndHeaderByNumber ...

func (*APIBackend) SubscribeChainEvent

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

SubscribeChainEvent subcribes chain event. TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) SubscribeChainHeadEvent

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

SubscribeChainHeadEvent subcribes chain head event. TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) SubscribeChainSideEvent

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

SubscribeChainSideEvent subcribes chain side event. TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) SubscribeLogsEvent

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

SubscribeLogsEvent subcribes log event. TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) SubscribeNewTxsEvent

func (b *APIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

SubscribeNewTxsEvent subcribes new tx event. TODO: this is not implemented or verified yet for harmony.

func (*APIBackend) SubscribeRemovedLogsEvent

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

SubscribeRemovedLogsEvent subcribes removed logs event. TODO: this is not implemented or verified yet for harmony.

type Harmony

type Harmony struct {
	APIBackend *APIBackend

	// RPCGasCap is the global gas cap for eth-call variants.
	RPCGasCap *big.Int `toml:",omitempty"`
	// contains filtered or unexported fields
}

Harmony implements the Harmony full node service.

func New

func New(
	nodeAPI NodeAPI, txPool *core.TxPool,
	cxPool *core.CxPool, eventMux *event.TypeMux, shardID uint32,
) (*Harmony, error)

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

func (*Harmony) BeaconChain added in v1.2.7

func (s *Harmony) BeaconChain() *core.BlockChain

BeaconChain ...

func (*Harmony) BlockChain

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

BlockChain ...

func (*Harmony) CxPool

func (s *Harmony) CxPool() *core.CxPool

CxPool is used to store the blockHashes, where the corresponding block contains the cross shard receipts to be sent

func (*Harmony) NetVersion

func (s *Harmony) NetVersion() uint64

NetVersion returns the network version, i.e. network ID identifying which network we are using

func (*Harmony) TxPool

func (s *Harmony) TxPool() *core.TxPool

TxPool ...

type NodeAPI

type NodeAPI interface {
	AddPendingStakingTransaction(*staking.StakingTransaction) error
	AddPendingTransaction(newTx *types.Transaction) error
	Blockchain() *core.BlockChain
	Beaconchain() *core.BlockChain
	GetBalanceOfAddress(address common.Address) (*big.Int, error)
	GetNonceOfAddress(address common.Address) uint64
	GetTransactionsHistory(address, txType, order string) ([]common.Hash, error)
	GetStakingTransactionsHistory(address, txType, order string) ([]common.Hash, error)
	GetTransactionsCount(address, txType string) (uint64, error)
	GetStakingTransactionsCount(address, txType string) (uint64, error)
	IsCurrentlyLeader() bool
	ReportStakingErrorSink() types.TransactionErrorReports
	ReportPlainErrorSink() types.TransactionErrorReports
	PendingCXReceipts() []*types.CXReceiptsProof
	GetNodeBootTime() int64
	PeerConnectivity() (int, int, int)
}

NodeAPI is the list of functions from node used to call rpc apis.

Jump to

Keyboard shortcuts

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