From 567780ad5acea961a768055324cf811d2349c0d0 Mon Sep 17 00:00:00 2001 From: cce <51567+cce@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:45:00 -0500 Subject: [PATCH] remove knockOfflineCandidates from roundCowParent interface --- ledger/eval/appcow_test.go | 4 ---- ledger/eval/cow.go | 5 ----- ledger/eval/cow_test.go | 4 ---- ledger/eval/eval.go | 8 ++------ 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/ledger/eval/appcow_test.go b/ledger/eval/appcow_test.go index 54aea0ece4..6f5e39b305 100644 --- a/ledger/eval/appcow_test.go +++ b/ledger/eval/appcow_test.go @@ -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 } diff --git a/ledger/eval/cow.go b/ledger/eval/cow.go index 68bc5bb124..046fb46598 100644 --- a/ledger/eval/cow.go +++ b/ledger/eval/cow.go @@ -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. @@ -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 { diff --git a/ledger/eval/cow_test.go b/ledger/eval/cow_test.go index 2192272bf1..138e2562ad 100644 --- a/ledger/eval/cow_test.go +++ b/ledger/eval/cow_test.go @@ -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: ¶ms}, ok, nil // XXX make a copy? diff --git a/ledger/eval/eval.go b/ledger/eval/eval.go index 10e42f266b..5537b5ed7b 100644 --- a/ledger/eval/eval.go +++ b/ledger/eval/eval.go @@ -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) { @@ -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. @@ -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,