global

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const StakePubkeyIndexFileName = "stake_pubkeys.idx"

StakePubkeyIndexFileName is the name of the stake pubkey index file

Variables

This section is empty.

Functions

func BankhashConfirmedForSlot

func BankhashConfirmedForSlot(slot uint64, bankHash solana.Hash) int

func BlockHeight

func BlockHeight() uint64

func CalcUnixTimeForClockSysvar

func CalcUnixTimeForClockSysvar() bool

func ClearEpochStakes

func ClearEpochStakes(epoch uint64)

ClearEpochStakes removes all stakes for a specific epoch. Used on resume to force rebuild from AccountsDB.

func ClearPendingStakePubkeys

func ClearPendingStakePubkeys()

ClearPendingStakePubkeys discards any pending stake pubkeys without writing them. Used for rollback on failed block replay.

func DeleteStakeCacheItem

func DeleteStakeCacheItem(pubkey solana.PublicKey)

func DeleteVoteCacheItem

func DeleteVoteCacheItem(pubkey solana.PublicKey)

func DeserializeAndLoadEpochStakes

func DeserializeAndLoadEpochStakes(data []byte) (uint64, error)

DeserializeAndLoadEpochStakes deserializes and loads epoch stakes from JSON. Returns the epoch number that was loaded.

func Epoch

func Epoch() uint64

func EpochAuthorizedVoters

func EpochAuthorizedVoters() *epochstakes.EpochAuthorizedVotersCache

func EpochStakes

func EpochStakes(epoch uint64) map[solana.PublicKey]uint64

func EpochStakesVoteAccts

func EpochStakesVoteAccts(epoch uint64) map[solana.PublicKey]*epochstakes.VoteAccount

func EpochTotalStake

func EpochTotalStake(epoch uint64) uint64

func FlushPendingStakePubkeys

func FlushPendingStakePubkeys(accountsDbDir string) (int, error)

FlushPendingStakePubkeys appends any new stake pubkeys discovered during replay to the stake pubkey index file. Called after each block commit. Returns the number of pubkeys flushed.

func GetAllCachedEpochs

func GetAllCachedEpochs() []uint64

GetAllCachedEpochs returns all epochs currently in the epoch stakes cache.

func HasEpochStakes

func HasEpochStakes(epoch uint64) bool

func IncrTransactionCount

func IncrTransactionCount(num uint64)

func LatestBlockHash

func LatestBlockHash() [32]byte

func LeaderForSlot

func LeaderForSlot(slot uint64) (solana.PublicKey, bool)

func LoadStakePubkeyIndex

func LoadStakePubkeyIndex(accountsDbDir string) ([]solana.PublicKey, error)

LoadStakePubkeyIndex reads the stake pubkey index file and returns deduplicated pubkeys. Validates that file length is a multiple of 32 bytes.

func ManageBlockHeight

func ManageBlockHeight() bool

func ManageLeaderSchedule

func ManageLeaderSchedule() bool

func PutEpochAuthorizedVoter

func PutEpochAuthorizedVoter(voteAcct solana.PublicKey, authorizedVoter solana.PublicKey)

func PutEpochStakesEntry

func PutEpochStakesEntry(epoch uint64, pubkey solana.PublicKey, stake uint64, voteAcct *epochstakes.VoteAccount)

func PutEpochTotalStake

func PutEpochTotalStake(epoch uint64, totalStake uint64)

func PutSlotConfirmed

func PutSlotConfirmed(slot uint64)

func PutStakeCacheItem

func PutStakeCacheItem(pubkey solana.PublicKey, delegation *sealevel.Delegation)

PutStakeCacheItem adds or updates a stake cache entry during replay. If this is a NEW pubkey (not already in cache), it's added to pendingNewStakePubkeys for later append to the index file via FlushPendingStakePubkeys.

func PutStakeCacheItemBulk

func PutStakeCacheItemBulk(pubkey solana.PublicKey, delegation *sealevel.Delegation)

PutStakeCacheItemBulk adds a stake cache entry during bulk population (startup). Does NOT track new pubkeys - use this when loading cache from index/snapshot/scan to avoid enqueueing the entire cache on rebuild.

func PutVoteCacheItem

func PutVoteCacheItem(pubkey solana.PublicKey, voteState *sealevel.VoteStateVersions)

func SaveStakePubkeyIndex

func SaveStakePubkeyIndex(accountsDbDir string) error

SaveStakePubkeyIndex writes the current stake cache pubkeys to the index file. This compacts the index by removing duplicates and closed accounts. Used during graceful shutdown.

func SerializeEpochStakes

func SerializeEpochStakes(epoch uint64) ([]byte, error)

SerializeEpochStakes serializes the stakes for a single epoch to JSON.

func SetBlockHeight

func SetBlockHeight(blockHeight uint64)

func SetCalcUnixTimeForClockSysvar

func SetCalcUnixTimeForClockSysvar(calcUnixTime bool)

func SetEpoch

func SetEpoch(epoch uint64)

func SetForkChoice

func SetForkChoice(forkChoice *forkchoice.ForkChoiceService)

func SetLatestBlockHash

func SetLatestBlockHash(blockHash [32]byte)

func SetLeaderSchedule

func SetLeaderSchedule(ls *leaderschedule.LeaderSchedule)

func SetManageBlockHeight

func SetManageBlockHeight(manageBlockHeight bool)

func SetManageLeaderSchedule

func SetManageLeaderSchedule(manageLeaderSchedule bool)

func SetSlot

func SetSlot(slot uint64)

func Slot

func Slot() uint64

func SlotConfirmed

func SlotConfirmed(slot uint64) bool

func StakeCache

func StakeCache() map[solana.PublicKey]*sealevel.Delegation

func StakeCacheSnapshot

func StakeCacheSnapshot() map[solana.PublicKey]*sealevel.Delegation

func StakeForVoteAcct

func StakeForVoteAcct(epoch uint64, voteAcct solana.PublicKey) uint64

func SubmitBlockToForkChoiceService

func SubmitBlockToForkChoiceService(slot uint64, txs []*solana.Transaction)

func TransactionCount

func TransactionCount() uint64

func VoteCache

func VoteCache() map[solana.PublicKey]*sealevel.VoteStateVersions

func VoteCacheItem

func VoteCacheItem(pubkey solana.PublicKey) *sealevel.VoteStateVersions

func VoteCacheSnapshot

func VoteCacheSnapshot() map[solana.PublicKey]*sealevel.VoteStateVersions

Types

type GlobalCtx

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

func (*GlobalCtx) BlockHeight

func (globctx *GlobalCtx) BlockHeight() uint64

func (*GlobalCtx) Epoch

func (globctx *GlobalCtx) Epoch() uint64

func (*GlobalCtx) IncrTransactionCount

func (globctx *GlobalCtx) IncrTransactionCount(num uint64)

func (*GlobalCtx) LatestBlockhash

func (globctx *GlobalCtx) LatestBlockhash() [32]byte

func (*GlobalCtx) SetBlockHeight

func (globctx *GlobalCtx) SetBlockHeight(blockHeight uint64)

func (*GlobalCtx) SetEpoch

func (globctx *GlobalCtx) SetEpoch(epoch uint64)

func (*GlobalCtx) SetLatestBlockhash

func (globctx *GlobalCtx) SetLatestBlockhash(blockhash [32]byte)

func (*GlobalCtx) SetSlot

func (globctx *GlobalCtx) SetSlot(slot uint64)

func (*GlobalCtx) Slot

func (globctx *GlobalCtx) Slot() uint64

func (*GlobalCtx) TransactionCount

func (globctx *GlobalCtx) TransactionCount() uint64

Jump to

Keyboard shortcuts

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