diff --git a/pkg/replay/leader_schedule_local.go b/pkg/replay/leader_schedule_local.go index 4ce6047a..7812bd34 100644 --- a/pkg/replay/leader_schedule_local.go +++ b/pkg/replay/leader_schedule_local.go @@ -255,6 +255,7 @@ func RebuildVoteCacheFromAccountsDB( // Read vote account from AccountsDB voteAcct, err := acctsDb.GetAccount(slot, item.pk) if err != nil { + global.DeleteVoteCacheItem(item.pk) missingCount.Add(1) missingStake.Add(item.stake) errorsMu.Lock() @@ -276,6 +277,7 @@ func RebuildVoteCacheFromAccountsDB( // Unmarshal vote state versionedVoteState, err := sealevel.UnmarshalVersionedVoteState(voteAcct.Data) if err != nil { + global.DeleteVoteCacheItem(item.pk) unmarshalErrCount.Add(1) unmarshalErrStake.Add(item.stake) errorsMu.Lock() @@ -298,6 +300,7 @@ func RebuildVoteCacheFromAccountsDB( nodePk := versionedVoteState.NodePubkey() var zeroPk solana.PublicKey if nodePk == zeroPk { + global.DeleteVoteCacheItem(item.pk) zeroNodePkCount.Add(1) zeroNodePkStake.Add(item.stake) errorsMu.Lock() diff --git a/pkg/replay/transaction.go b/pkg/replay/transaction.go index 3eb1e901..66632299 100644 --- a/pkg/replay/transaction.go +++ b/pkg/replay/transaction.go @@ -230,7 +230,11 @@ func recordStakeAndVoteAccounts(slotCtx *sealevel.SlotCtx, execCtx *sealevel.Exe continue } - if modifiedVoteAccts && acct.Owner == a.VoteProgramAddr { + if acct.Lamports == 0 || acct.Owner != a.VoteProgramAddr { + if global.VoteCacheItem(acct.Key) != nil { + global.DeleteVoteCacheItem(acct.Key) + } + } else if modifiedVoteAccts { recordVoteTimestampAndSlot(slotCtx, acct) newVersionedVoteState, wasModified := execCtx.ModifiedVoteStates[acct.Key] if wasModified {