diff options
Diffstat (limited to 'ledger/catchpointwriter_test.go')
-rw-r--r-- | ledger/catchpointwriter_test.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ledger/catchpointwriter_test.go b/ledger/catchpointwriter_test.go index b3882f1f7..0b14f5524 100644 --- a/ledger/catchpointwriter_test.go +++ b/ledger/catchpointwriter_test.go @@ -34,6 +34,8 @@ import ( "github.com/algorand/go-algorand/config" "github.com/algorand/go-algorand/crypto" "github.com/algorand/go-algorand/data/basics" + "github.com/algorand/go-algorand/ledger/ledgercore" + ledgertesting "github.com/algorand/go-algorand/ledger/testing" "github.com/algorand/go-algorand/protocol" "github.com/algorand/go-algorand/test/partitiontest" ) @@ -182,18 +184,16 @@ func TestBasicCatchpointWriter(t *testing.T) { delete(config.Consensus, testProtocolVersion) os.RemoveAll(temporaryDirectroy) }() - accts := randomAccounts(300, false) + accts := ledgertesting.RandomAccounts(300, false) ml := makeMockLedgerForTracker(t, true, 10, testProtocolVersion, []map[basics.Address]basics.AccountData{accts}) defer ml.Close() - au := &accountUpdates{} conf := config.GetDefaultLocal() conf.CatchpointInterval = 1 conf.Archival = true - au.initialize(conf, ".", protoParams, accts) - defer au.close() - err := au.loadFromDisk(ml) + au := newAcctUpdates(t, ml, conf, ".") + err := au.loadFromDisk(ml, 0) require.NoError(t, err) au.close() fileName := filepath.Join(temporaryDirectroy, "15.catchpoint") @@ -283,17 +283,15 @@ func TestFullCatchpointWriter(t *testing.T) { os.RemoveAll(temporaryDirectroy) }() - accts := randomAccounts(BalancesPerCatchpointFileChunk*3, false) + accts := ledgertesting.RandomAccounts(BalancesPerCatchpointFileChunk*3, false) ml := makeMockLedgerForTracker(t, true, 10, testProtocolVersion, []map[basics.Address]basics.AccountData{accts}) defer ml.Close() - au := &accountUpdates{} conf := config.GetDefaultLocal() conf.CatchpointInterval = 1 conf.Archival = true - au.initialize(conf, ".", protoParams, accts) - defer au.close() - err := au.loadFromDisk(ml) + au := newAcctUpdates(t, ml, conf, ".") + err := au.loadFromDisk(ml, 0) require.NoError(t, err) au.close() fileName := filepath.Join(temporaryDirectroy, "15.catchpoint") @@ -315,7 +313,7 @@ func TestFullCatchpointWriter(t *testing.T) { require.NoError(t, err) // create a ledger. - var initState InitState + var initState ledgercore.InitState initState.Block.CurrentProtocol = protocol.ConsensusCurrentVersion l, err := OpenLedger(ml.log, "TestFullCatchpointWriter", true, initState, conf) require.NoError(t, err) |