Skip to content

Commit

Permalink
remove knockOfflineCandidates from roundCowParent interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cce committed Dec 19, 2024
1 parent b94f083 commit 567780a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
4 changes: 0 additions & 4 deletions ledger/eval/appcow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ func (ml *emptyLedger) onlineStake() (basics.MicroAlgos, error) {
return basics.MicroAlgos{}, nil
}

func (ml *emptyLedger) knockOfflineCandidates() (map[basics.Address]basics.OnlineAccountData, error) {
return nil, nil
}

func (ml *emptyLedger) lookupAppParams(addr basics.Address, aidx basics.AppIndex, cacheOnly bool) (ledgercore.AppParamsDelta, bool, error) {
return ledgercore.AppParamsDelta{}, true, nil
}
Expand Down
5 changes: 0 additions & 5 deletions ledger/eval/cow.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type roundCowParent interface {
// lookup retrieves agreement data about an address, querying the ledger if necessary.
lookupAgreement(basics.Address) (basics.OnlineAccountData, error)
onlineStake() (basics.MicroAlgos, error)
knockOfflineCandidates() (map[basics.Address]basics.OnlineAccountData, error)

// lookupAppParams, lookupAssetParams, lookupAppLocalState, and lookupAssetHolding retrieve data for a given address and ID.
// If cacheOnly is set, the ledger DB will not be queried, and only the cache will be consulted.
Expand Down Expand Up @@ -192,10 +191,6 @@ func (cb *roundCowState) lookupAgreement(addr basics.Address) (data basics.Onlin
return cb.lookupParent.lookupAgreement(addr)
}

func (cb *roundCowState) knockOfflineCandidates() (map[basics.Address]basics.OnlineAccountData, error) {
return cb.lookupParent.knockOfflineCandidates()
}

func (cb *roundCowState) lookupAppParams(addr basics.Address, aidx basics.AppIndex, cacheOnly bool) (ledgercore.AppParamsDelta, bool, error) {
params, ok := cb.mods.Accts.GetAppParams(addr, aidx)
if ok {
Expand Down
4 changes: 0 additions & 4 deletions ledger/eval/cow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ func (ml *mockLedger) onlineStake() (basics.MicroAlgos, error) {
return basics.Algos(55_555), nil
}

func (ml *mockLedger) knockOfflineCandidates() (map[basics.Address]basics.OnlineAccountData, error) {
return nil, nil
}

func (ml *mockLedger) lookupAppParams(addr basics.Address, aidx basics.AppIndex, cacheOnly bool) (ledgercore.AppParamsDelta, bool, error) {
params, ok := ml.balanceMap[addr].AppParams[aidx]
return ledgercore.AppParamsDelta{Params: &params}, ok, nil // XXX make a copy?
Expand Down
8 changes: 2 additions & 6 deletions ledger/eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ func (x *roundCowBase) lookupAgreement(addr basics.Address) (basics.OnlineAccoun
return ad, err
}

func (x *roundCowBase) knockOfflineCandidates() (map[basics.Address]basics.OnlineAccountData, error) {
return x.l.GetKnockOfflineCandidates(x.rnd, x.proto)
}

// onlineStake returns the total online stake as of the start of the round. It
// caches the result to prevent repeated calls to the ledger.
func (x *roundCowBase) onlineStake() (basics.MicroAlgos, error) {
Expand Down Expand Up @@ -1680,7 +1676,7 @@ func (eval *BlockEvaluator) generateKnockOfflineAccountsList(participating []bas
// First, ask the ledger for the top N online accounts, with their latest
// online account data, current up to the previous round.
if maxSuspensions > 0 {
knockOfflineCandidates, err := eval.state.knockOfflineCandidates()
knockOfflineCandidates, err := eval.l.GetKnockOfflineCandidates(eval.prevHeader.Round, eval.proto)
if err != nil {
// Log an error and keep going; generating lists of absent and expired
// accounts is not required by block validation rules.
Expand Down Expand Up @@ -1708,7 +1704,7 @@ func (eval *BlockEvaluator) generateKnockOfflineAccountsList(participating []bas
if !found {
continue
}
// This will overwrite data from the knockOfflineCandidates() list, if they were modified in the current block.
// This will overwrite data from the knockOfflineCandidates list, if they were modified in the current block.
candidates[accountAddr] = candidateData{
VoteLastValid: acctData.VoteLastValid,
VoteID: acctData.VoteID,
Expand Down

0 comments on commit 567780a

Please sign in to comment.