depositcache

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: GPL-3.0 Imports: 12 Imported by: 61

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositCache

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

DepositCache stores all in-memory deposit objects. This stores all the deposit related data that is required by the beacon-node.

func NewDepositCache

func NewDepositCache() *DepositCache

NewDepositCache instantiates a new deposit cache

func (*DepositCache) AllDeposits

func (dc *DepositCache) AllDeposits(ctx context.Context, beforeBlk *big.Int) []*ethpb.Deposit

AllDeposits returns a list of deposits all historical deposits until the given block number (inclusive). If no block is specified then this method returns all historical deposits.

func (*DepositCache) DepositByPubkey

func (dc *DepositCache) DepositByPubkey(ctx context.Context, pubKey []byte) (*ethpb.Deposit, *big.Int)

DepositByPubkey looks through historical deposits and finds one which contains a certain public key within its deposit data.

func (*DepositCache) DepositsNumberAndRootAtHeight

func (dc *DepositCache) DepositsNumberAndRootAtHeight(ctx context.Context, blockHeight *big.Int) (uint64, [32]byte)

DepositsNumberAndRootAtHeight returns number of deposits made prior to blockheight and the root that corresponds to the latest deposit at that blockheight.

func (*DepositCache) InsertDeposit

func (dc *DepositCache) InsertDeposit(ctx context.Context, d *ethpb.Deposit, blockNum *big.Int, index int, depositRoot [32]byte)

InsertDeposit into the database. If deposit or block number are nil then this method does nothing.

func (*DepositCache) InsertPendingDeposit

func (dc *DepositCache) InsertPendingDeposit(ctx context.Context, d *ethpb.Deposit, blockNum *big.Int, index int, depositRoot [32]byte)

InsertPendingDeposit into the database. If deposit or block number are nil then this method does nothing.

func (*DepositCache) MarkPubkeyForChainstart

func (dc *DepositCache) MarkPubkeyForChainstart(ctx context.Context, pubkey string)

MarkPubkeyForChainstart sets the pubkey deposit status to true.

func (*DepositCache) PendingContainers

func (dc *DepositCache) PendingContainers(ctx context.Context, beforeBlk *big.Int) []*DepositContainer

PendingContainers returns a list of deposit containers until the given block number (inclusive).

func (*DepositCache) PendingDeposits

func (dc *DepositCache) PendingDeposits(ctx context.Context, beforeBlk *big.Int) []*ethpb.Deposit

PendingDeposits returns a list of deposits until the given block number (inclusive). If no block is specified then this method returns all pending deposits.

func (*DepositCache) PrunePendingDeposits

func (dc *DepositCache) PrunePendingDeposits(ctx context.Context, merkleTreeIndex int)

PrunePendingDeposits removes any deposit which is older than the given deposit merkle tree index.

func (*DepositCache) PubkeyInChainstart

func (dc *DepositCache) PubkeyInChainstart(ctx context.Context, pubkey string) bool

PubkeyInChainstart returns bool for whether the pubkey passed in has deposited.

func (*DepositCache) RemovePendingDeposit

func (dc *DepositCache) RemovePendingDeposit(ctx context.Context, d *ethpb.Deposit)

RemovePendingDeposit from the database. The deposit is indexed by the Index. This method does nothing if deposit ptr is nil.

type DepositContainer

type DepositContainer struct {
	Deposit *ethpb.Deposit
	Block   *big.Int
	Index   int
	// contains filtered or unexported fields
}

DepositContainer object for holding the deposit and a reference to the block in which the deposit transaction was included in the proof of work chain.

type DepositFetcher

type DepositFetcher interface {
	AllDeposits(ctx context.Context, beforeBlk *big.Int) []*ethpb.Deposit
	DepositByPubkey(ctx context.Context, pubKey []byte) (*ethpb.Deposit, *big.Int)
	DepositsNumberAndRootAtHeight(ctx context.Context, blockHeight *big.Int) (uint64, [32]byte)
}

DepositFetcher defines a struct which can retrieve deposit information from a store.

type PendingDepositsFetcher

type PendingDepositsFetcher interface {
	PendingContainers(ctx context.Context, beforeBlk *big.Int) []*DepositContainer
}

PendingDepositsFetcher specifically outlines a struct that can retrieve deposits which have not yet been included in the chain.

Jump to

Keyboard shortcuts

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