Skip to content

Commit 2ccddcf

Browse files
committed
refactor tests
Signed-off-by: Joshua Kim <[email protected]>
1 parent f8a113b commit 2ccddcf

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

vms/avm/vm.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"net/http"
1111
"reflect"
1212
"sync"
13-
"time"
1413

1514
"github.com/gorilla/rpc/v2"
1615
"github.com/prometheus/client_golang/prometheus"
@@ -395,7 +394,7 @@ func (vm *VM) Linearize(ctx context.Context, stopVertexID ids.ID, toEngine chan<
395394
stopVertexID,
396395
vm.Config.Upgrades.CortinaTime,
397396
); err != nil {
398-
return err
397+
return fmt.Errorf("failed to initialize legacy chain state: %w", err)
399398
}
400399

401400
stateMigration := vm.StateMigrationFactory.New(
@@ -524,10 +523,6 @@ func (vm *VM) GetUTXO(utxoID ids.ID) (*avax.UTXO, error) {
524523
return vm.state.GetUTXO(utxoID)
525524
}
526525

527-
func (vm *VM) GetLastAcceptedTimestamp() time.Time {
528-
return vm.state.GetTimestamp()
529-
}
530-
531526
/*
532527
******************************************************************************
533528
********************************** JSON API **********************************

vms/avm/vm_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,6 @@ func TestVMLinearizeStateMigration(t *testing.T) {
823823
}
824824

825825
require.Equal(numBlocks, wantBlkIDs.Len())
826-
wantLastAcceptedTimestamp := vm.GetLastAcceptedTimestamp()
827826

828827
db, err = memdb.Copy(db)
829828
require.NoError(vm.Shutdown(context.Background()))
@@ -879,12 +878,10 @@ func TestVMLinearizeStateMigration(t *testing.T) {
879878
require.Equal(wantUTXO.InputID(), gotUTXO.InputID())
880879
}
881880

881+
wantLastAcceptedBlkID, _, _ := wantBlkIDs.Newest()
882882
gotLastAcceptedBlkID, err := vm.LastAccepted(context.Background())
883883
require.NoError(err)
884-
wantLastAcceptedBlkID, _, ok := wantBlkIDs.Newest()
885-
require.True(ok)
886884
require.Equal(wantLastAcceptedBlkID, gotLastAcceptedBlkID)
887-
require.Equal(wantLastAcceptedTimestamp, vm.GetLastAcceptedTimestamp())
888885

889886
db, err = memdb.Copy(db)
890887
require.NoError(vm.Shutdown(context.Background()))

0 commit comments

Comments
 (0)