hmy

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBloomIndexer

func NewBloomIndexer(db ethdb.Database, size, confirms uint64) *core.ChainIndexer

NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.

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

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

AccountManager ...

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) 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() []staking.RPCTransactionError

GetCurrentStakingErrorSink ..

func (*APIBackend) GetCurrentTransactionErrorSink

func (b *APIBackend) GetCurrentTransactionErrorSink() []types.RPCTransactionError

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) 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) 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) 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) 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. TODO: this is not implemented or verified yet for harmony.

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) 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) 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,
) (*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

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) 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 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(ctx context.Context, header *block.Header) error

Process implements core.ChainIndexerBackend, adding a new header's bloom into the index.

func (*BloomIndexer) Reset

func (b *BloomIndexer) Reset(ctx context.Context, section uint64, lastSectionHead common.Hash) error

Reset implements core.ChainIndexerBackend, starting a new bloombits index section.

type Harmony

type Harmony struct {
	APIBackend *APIBackend

	// TODO(ricl): put this into config object
	// TODO(ricl): this is never set. Will result in nil pointer bug
	// 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) 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
	AccountManager() *accounts.Manager
	GetBalanceOfAddress(address common.Address) (*big.Int, error)
	GetNonceOfAddress(address common.Address) uint64
	GetTransactionsHistory(address, txType, order string) ([]common.Hash, error)
	IsCurrentlyLeader() bool
	ErroredStakingTransactionSink() []staking.RPCTransactionError
	ErroredTransactionSink() []types.RPCTransactionError
	PendingCXReceipts() []*types.CXReceiptsProof
}

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