depositcache

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: GPL-3.0 Imports: 14 Imported by: 68

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) AllDepositContainers added in v0.3.0

func (dc *DepositCache) AllDepositContainers(ctx context.Context) []*dbpb.DepositContainer

AllDepositContainers returns a list of deposits all historical deposit containers until the given block number.

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 uint64, index int64, depositRoot [32]byte)

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

func (*DepositCache) InsertDepositContainers added in v0.3.0

func (dc *DepositCache) InsertDepositContainers(ctx context.Context, ctrs []*dbpb.DepositContainer)

InsertDepositContainers inserts a set of deposit containers into our deposit cache.

func (*DepositCache) InsertPendingDeposit

func (dc *DepositCache) InsertPendingDeposit(ctx context.Context, d *ethpb.Deposit, blockNum uint64, index int64, 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) []*dbpb.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 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) []*dbpb.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