Documentation
¶
Index ¶
- Constants
- func BankhashConfirmedForSlot(slot uint64, bankHash solana.Hash) int
- func BlockHeight() uint64
- func CalcUnixTimeForClockSysvar() bool
- func ClearEpochStakes(epoch uint64)
- func ClearEpochVoteStateSnapshots()
- func ClearPendingStakePubkeys()
- func CompactStakePubkeyIndex(accountsDbDir string) error
- func DeleteVoteCacheItem(pubkey solana.PublicKey)
- func DeserializeAndLoadEpochStakes(data []byte) (uint64, error)
- func EnqueuePendingStakePubkey(pubkey solana.PublicKey)
- func Epoch() uint64
- func EpochAuthorizedVoters() *epochstakes.EpochAuthorizedVotersCache
- func EpochStakes(epoch uint64) map[solana.PublicKey]uint64
- func EpochStakesVoteAccts(epoch uint64) map[solana.PublicKey]*epochstakes.VoteAccount
- func EpochTotalStake(epoch uint64) uint64
- func EpochVoteStateSnapshot(epoch uint64) map[solana.PublicKey]*sealevel.VoteStateVersions
- func FlushPendingStakePubkeys(accountsDbDir string) (int, error)
- func GetAllCachedEpochs() []uint64
- func HasEpochStakes(epoch uint64) bool
- func HasForkChoice() bool
- func IncrTransactionCount(num uint64)
- func LatestBlockHash() [32]byte
- func LeaderForSlot(slot uint64) (solana.PublicKey, bool)
- func LoadStakePubkeyIndex(accountsDbDir string) ([]accountsdb.StakeIndexEntry, error)
- func ManageLeaderSchedule() bool
- func PutEpochAuthorizedVoter(voteAcct solana.PublicKey, authorizedVoter solana.PublicKey)
- func PutEpochStakesEntry(epoch uint64, pubkey solana.PublicKey, stake uint64, ...)
- func PutEpochTotalStake(epoch uint64, totalStake uint64)
- func PutEpochVoteStateSnapshot(epoch uint64, snapshot map[solana.PublicKey]*sealevel.VoteStateVersions)
- func PutSlotConfirmed(slot uint64)
- func PutVoteCacheItem(pubkey solana.PublicKey, voteState *sealevel.VoteStateVersions)
- func SerializeEpochStakes(epoch uint64) ([]byte, error)
- func SetBlockHeight(blockHeight uint64)
- func SetCalcUnixTimeForClockSysvar(calcUnixTime bool)
- func SetEpoch(epoch uint64)
- func SetEpochAuthorizedVoters(cache *epochstakes.EpochAuthorizedVotersCache)
- func SetForkChoice(forkChoice *forkchoice.ForkChoiceService)
- func SetLatestBlockHash(blockHash [32]byte)
- func SetLeaderSchedule(ls *leaderschedule.LeaderSchedule)
- func SetManageLeaderSchedule(manageLeaderSchedule bool)
- func SetSlot(slot uint64)
- func Slot() uint64
- func SlotConfirmed(slot uint64) bool
- func StakeForVoteAcct(epoch uint64, voteAcct solana.PublicKey) uint64
- func StreamStakeAccounts(acctsDb *accountsdb.AccountsDb, slot uint64, ...) (int, error)
- func SubmitBlockToForkChoiceService(slot uint64, txs []*solana.Transaction)
- func TransactionCount() uint64
- func VoteCache() map[solana.PublicKey]*sealevel.VoteStateVersions
- func VoteCacheItem(pubkey solana.PublicKey) *sealevel.VoteStateVersions
- func VoteCacheSnapshot() map[solana.PublicKey]*sealevel.VoteStateVersions
- type GlobalCtx
- func (globctx *GlobalCtx) BlockHeight() uint64
- func (globctx *GlobalCtx) Epoch() uint64
- func (globctx *GlobalCtx) IncrTransactionCount(num uint64)
- func (globctx *GlobalCtx) LatestBlockhash() [32]byte
- func (globctx *GlobalCtx) SetBlockHeight(blockHeight uint64)
- func (globctx *GlobalCtx) SetEpoch(epoch uint64)
- func (globctx *GlobalCtx) SetLatestBlockhash(blockhash [32]byte)
- func (globctx *GlobalCtx) SetSlot(slot uint64)
- func (globctx *GlobalCtx) Slot() uint64
- func (globctx *GlobalCtx) TransactionCount() uint64
Constants ¶
const StakePubkeyIndexFileName = "stake_pubkeys.idx"
StakePubkeyIndexFileName is the name of the stake pubkey index file
Variables ¶
This section is empty.
Functions ¶
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 ClearEpochVoteStateSnapshots ¶
func ClearEpochVoteStateSnapshots()
func ClearPendingStakePubkeys ¶
func ClearPendingStakePubkeys()
ClearPendingStakePubkeys discards any pending stake pubkeys without writing them. Used for rollback on failed block replay.
func CompactStakePubkeyIndex ¶
CompactStakePubkeyIndex rewrites the index file from the cached deduplicated entries. Only triggers when at least compactThreshold entries have been appended since last compaction. Should be called at epoch boundary when the cache is already populated.
func DeleteVoteCacheItem ¶
func DeserializeAndLoadEpochStakes ¶
DeserializeAndLoadEpochStakes deserializes and loads epoch stakes from JSON. Returns the epoch number that was loaded.
func EnqueuePendingStakePubkey ¶
EnqueuePendingStakePubkey records a stake pubkey for later append to the index file. Called during tx processing when a stake account is created or modified. Deduplication happens at index load time (LoadStakePubkeyIndex keeps last occurrence).
func EpochAuthorizedVoters ¶
func EpochAuthorizedVoters() *epochstakes.EpochAuthorizedVotersCache
func EpochStakesVoteAccts ¶
func EpochStakesVoteAccts(epoch uint64) map[solana.PublicKey]*epochstakes.VoteAccount
func EpochTotalStake ¶
func EpochVoteStateSnapshot ¶
func EpochVoteStateSnapshot(epoch uint64) map[solana.PublicKey]*sealevel.VoteStateVersions
func FlushPendingStakePubkeys ¶
FlushPendingStakePubkeys appends any new stake entries discovered during replay to the stake pubkey index file. Called after each block commit. Writes 48-byte records to match the header written at snapshot time. Returns the number of entries flushed.
func GetAllCachedEpochs ¶
func GetAllCachedEpochs() []uint64
GetAllCachedEpochs returns all epochs currently in the epoch stakes cache.
func HasEpochStakes ¶
func HasForkChoice ¶
func HasForkChoice() bool
func IncrTransactionCount ¶
func IncrTransactionCount(num uint64)
func LatestBlockHash ¶
func LatestBlockHash() [32]byte
func LoadStakePubkeyIndex ¶
func LoadStakePubkeyIndex(accountsDbDir string) ([]accountsdb.StakeIndexEntry, error)
LoadStakePubkeyIndex reads the stake pubkey index file, auto-detecting format. Returns deduplicated entries sorted by (FileId, Offset) for sequential I/O. Results are cached after first load; subsequent calls return the cached slice. IMPORTANT: The returned slice is shared — callers must NOT mutate it. Legacy format: 32-byte pubkeys with no location hints (FileId=0, Offset=0). Current format: 8-byte header ("STKI" + version) + 48-byte records (pubkey + fileId + offset).
func ManageLeaderSchedule ¶
func ManageLeaderSchedule() bool
func PutEpochAuthorizedVoter ¶
func PutEpochStakesEntry ¶
func PutEpochStakesEntry(epoch uint64, pubkey solana.PublicKey, stake uint64, voteAcct *epochstakes.VoteAccount)
func PutEpochTotalStake ¶
func PutEpochVoteStateSnapshot ¶
func PutEpochVoteStateSnapshot(epoch uint64, snapshot map[solana.PublicKey]*sealevel.VoteStateVersions)
func PutSlotConfirmed ¶
func PutSlotConfirmed(slot uint64)
func PutVoteCacheItem ¶
func PutVoteCacheItem(pubkey solana.PublicKey, voteState *sealevel.VoteStateVersions)
func SerializeEpochStakes ¶
SerializeEpochStakes serializes the stakes for a single epoch to JSON.
func SetBlockHeight ¶
func SetBlockHeight(blockHeight uint64)
func SetCalcUnixTimeForClockSysvar ¶
func SetCalcUnixTimeForClockSysvar(calcUnixTime bool)
func SetEpochAuthorizedVoters ¶
func SetEpochAuthorizedVoters(cache *epochstakes.EpochAuthorizedVotersCache)
SetEpochAuthorizedVoters replaces the entire authorized voters cache. Called at epoch boundaries after rebuilding from vote accounts.
func SetForkChoice ¶
func SetForkChoice(forkChoice *forkchoice.ForkChoiceService)
func SetLatestBlockHash ¶
func SetLatestBlockHash(blockHash [32]byte)
func SetLeaderSchedule ¶
func SetLeaderSchedule(ls *leaderschedule.LeaderSchedule)
func SetManageLeaderSchedule ¶
func SetManageLeaderSchedule(manageLeaderSchedule bool)
func SlotConfirmed ¶
func StreamStakeAccounts ¶
func StreamStakeAccounts( acctsDb *accountsdb.AccountsDb, slot uint64, fn func(pubkey solana.PublicKey, delegation *sealevel.Delegation, creditsObserved uint64), ) (int, error)
StreamStakeAccounts iterates all stake accounts from the pubkey index, calling fn for each valid delegation. Returns count of processed accounts. This streams directly from AccountsDB without building a full stake cache. Entries are sorted by (FileId, Offset) and batched by FileId for sequential I/O.
func SubmitBlockToForkChoiceService ¶
func SubmitBlockToForkChoiceService(slot uint64, txs []*solana.Transaction)
func TransactionCount ¶
func TransactionCount() uint64
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
}