Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions ledger/acctonline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestAcctOnline(t *testing.T) {
conf := config.GetDefaultLocal()
maxDeltaLookback := conf.MaxAcctLookback

au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()

_, totals, err := au.LatestTotals()
Expand Down Expand Up @@ -462,7 +462,7 @@ func TestAcctOnlineCache(t *testing.T) {
conf.MaxAcctLookback = val
maxDeltaLookback := conf.MaxAcctLookback

au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()

_, totals, err := au.LatestTotals()
Expand Down Expand Up @@ -723,7 +723,7 @@ func TestAcctOnlineRoundParamsCache(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, ao := newAcctUpdates(t, ml, conf, ".")
au, ao := newAcctUpdates(t, ml, conf)
defer au.close()
defer ao.close()

Expand Down Expand Up @@ -871,7 +871,7 @@ func TestAcctOnlineCacheDBSync(t *testing.T) {
conf := config.GetDefaultLocal()
conf.MaxAcctLookback = maxBalLookback

au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()
_, totals, err := au.LatestTotals()
require.NoError(t, err)
Expand Down Expand Up @@ -951,7 +951,7 @@ func TestAcctOnlineCacheDBSync(t *testing.T) {
conf := config.GetDefaultLocal()
conf.MaxAcctLookback = 4

au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()
_, totals, err := au.LatestTotals()
require.NoError(t, err)
Expand Down Expand Up @@ -999,7 +999,7 @@ func TestAcctOnlineCacheDBSync(t *testing.T) {
const maxDeltaLookback = 0
conf.MaxAcctLookback = maxDeltaLookback

au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()
_, totals, err := au.LatestTotals()
require.NoError(t, err)
Expand Down Expand Up @@ -1152,7 +1152,7 @@ func TestAcctOnlineVotersLongerHistory(t *testing.T) {
defer ml.Close()
conf := config.GetDefaultLocal()

au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()
_, totals, err := au.LatestTotals()
require.NoError(t, err)
Expand Down Expand Up @@ -1292,7 +1292,7 @@ func TestAcctOnlineTop(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()

top, err := oa.onlineTop(0, 0, 5)
Expand Down Expand Up @@ -1383,7 +1383,7 @@ func TestAcctOnlineTopInBatches(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
_, oa := newAcctUpdates(t, ml, conf, ".")
_, oa := newAcctUpdates(t, ml, conf)
defer oa.close()

top, err := oa.onlineTop(0, 0, 2048)
Expand Down Expand Up @@ -1427,7 +1427,7 @@ func TestAcctOnlineTopBetweenCommitAndPostCommit(t *testing.T) {
}

conf := config.GetDefaultLocal()
au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()
ml.trackers.trackers = append([]ledgerTracker{stallingTracker}, ml.trackers.trackers...)

Expand Down Expand Up @@ -1518,7 +1518,7 @@ func TestAcctOnlineTopDBBehindMemRound(t *testing.T) {
}

conf := config.GetDefaultLocal()
au, oa := newAcctUpdates(t, ml, conf, ".")
au, oa := newAcctUpdates(t, ml, conf)
defer oa.close()
ml.trackers.trackers = append([]ledgerTracker{stallingTracker}, ml.trackers.trackers...)

Expand Down
35 changes: 18 additions & 17 deletions ledger/acctupdates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (au *accountUpdates) allBalances(rnd basics.Round) (bals map[basics.Address
return
}

func newAcctUpdates(tb testing.TB, l *mockLedgerForTracker, conf config.Local, dbPathPrefix string) (*accountUpdates, *onlineAccounts) {
func newAcctUpdates(tb testing.TB, l *mockLedgerForTracker, conf config.Local) (*accountUpdates, *onlineAccounts) {
au := &accountUpdates{}
au.initialize(conf)
ao := &onlineAccounts{}
Expand All @@ -270,7 +270,8 @@ func newAcctUpdates(tb testing.TB, l *mockLedgerForTracker, conf config.Local, d
_, err := trackerDBInitialize(l, false, ".")
require.NoError(tb, err)

l.trackers.initialize(l, []ledgerTracker{au, ao, &txTail{}}, conf)
err = l.trackers.initialize(l, []ledgerTracker{au, ao, &txTail{}}, conf)
require.NoError(tb, err)
err = l.trackers.loadFromDisk(l)
require.NoError(tb, err)

Expand Down Expand Up @@ -481,7 +482,7 @@ func TestAcctUpdates(t *testing.T) {
ml := makeMockLedgerForTracker(t, true, initialBlocksCount, protocol.ConsensusCurrentVersion, accts)
defer ml.Close()

au, ao := newAcctUpdates(t, ml, conf, ".")
au, ao := newAcctUpdates(t, ml, conf)
defer au.close()
defer ao.close()

Expand Down Expand Up @@ -604,7 +605,7 @@ func TestAcctUpdatesFastUpdates(t *testing.T) {
ml := makeMockLedgerForTracker(t, true, initialBlocksCount, protocol.ConsensusCurrentVersion, accts)
defer ml.Close()

au, ao := newAcctUpdates(t, ml, conf, ".")
au, ao := newAcctUpdates(t, ml, conf)
defer au.close()
defer ao.close()

Expand Down Expand Up @@ -692,7 +693,7 @@ func BenchmarkBalancesChanges(b *testing.B) {

conf := config.GetDefaultLocal()
maxAcctLookback := conf.MaxAcctLookback
au, ao := newAcctUpdates(b, ml, conf, ".")
au, ao := newAcctUpdates(b, ml, conf)
defer au.close()
defer ao.close()

Expand Down Expand Up @@ -834,7 +835,7 @@ func TestLargeAccountCountCatchpointGeneration(t *testing.T) {
ml := makeMockLedgerForTracker(t, true, initialBlocksCount, testProtocolVersion, accts)
defer ml.Close()

au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

// cover 10 genesis blocks
Expand Down Expand Up @@ -938,7 +939,7 @@ func TestAcctUpdatesUpdatesCorrectness(t *testing.T) {
}

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

// cover 10 genesis blocks
Expand Down Expand Up @@ -1297,7 +1298,7 @@ func BenchmarkLargeMerkleTrieRebuild(b *testing.B) {

cfg := config.GetDefaultLocal()
cfg.Archival = true
au, _ := newAcctUpdates(b, ml, cfg, ".")
au, _ := newAcctUpdates(b, ml, cfg)
defer au.close()

// at this point, the database was created. We want to fill the accounts data
Expand Down Expand Up @@ -1637,7 +1638,7 @@ func TestAcctUpdatesCachesInitialization(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)

// cover initialRounds genesis blocks
rewardLevel := uint64(0)
Expand Down Expand Up @@ -1697,7 +1698,7 @@ func TestAcctUpdatesCachesInitialization(t *testing.T) {
ml2.deltas = ml.deltas

conf = config.GetDefaultLocal()
au, _ = newAcctUpdates(t, ml2, conf, ".")
au, _ = newAcctUpdates(t, ml2, conf)
defer au.close()

// make sure the deltas array end up containing only the most recent 320 rounds.
Expand Down Expand Up @@ -1735,7 +1736,7 @@ func TestAcctUpdatesSplittingConsensusVersionCommits(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

// cover initialRounds genesis blocks
Expand Down Expand Up @@ -1853,7 +1854,7 @@ func TestAcctUpdatesSplittingConsensusVersionCommitsBoundary(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

// cover initialRounds genesis blocks
Expand Down Expand Up @@ -2001,7 +2002,7 @@ func TestAcctUpdatesResources(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

var addr1 basics.Address
Expand Down Expand Up @@ -2204,7 +2205,7 @@ func TestAcctUpdatesLookupLatest(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()
for addr, acct := range accts {
acctData, validThrough, withoutRewards, err := au.lookupLatest(addr)
Expand Down Expand Up @@ -2250,7 +2251,7 @@ func testAcctUpdatesLookupRetry(t *testing.T, assertFn func(au *accountUpdates,
ml := makeMockLedgerForTracker(t, false, initialBlocksCount, testProtocolVersion, accts)
defer ml.Close()

au, ao := newAcctUpdates(t, ml, conf, ".")
au, ao := newAcctUpdates(t, ml, conf)
defer au.close()
defer ao.close()

Expand Down Expand Up @@ -2499,7 +2500,7 @@ func TestAcctUpdatesLookupLatestCacheRetry(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

var addr1 basics.Address
Expand Down Expand Up @@ -2637,7 +2638,7 @@ func TestAcctUpdatesLookupResources(t *testing.T) {
defer ml.Close()

conf := config.GetDefaultLocal()
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
defer au.close()

var addr1 basics.Address
Expand Down
4 changes: 2 additions & 2 deletions ledger/catchpointwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestBasicCatchpointWriter(t *testing.T) {
conf := config.GetDefaultLocal()
conf.CatchpointInterval = 1
conf.Archival = true
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
err := au.loadFromDisk(ml, 0)
require.NoError(t, err)
au.close()
Expand Down Expand Up @@ -293,7 +293,7 @@ func TestFullCatchpointWriter(t *testing.T) {
conf := config.GetDefaultLocal()
conf.CatchpointInterval = 1
conf.Archival = true
au, _ := newAcctUpdates(t, ml, conf, ".")
au, _ := newAcctUpdates(t, ml, conf)
err := au.loadFromDisk(ml, 0)
require.NoError(t, err)
au.close()
Expand Down