diff --git a/exp/lighthorizon/adapters/transaction_test.go b/exp/lighthorizon/adapters/transaction_test.go index 6699083f6f..5a8ba4ab80 100644 --- a/exp/lighthorizon/adapters/transaction_test.go +++ b/exp/lighthorizon/adapters/transaction_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stellar/go/exp/lighthorizon/common" + "github.com/stellar/go/exp/lighthorizon/ingester" "github.com/stellar/go/ingest" "github.com/stellar/go/network" protocol "github.com/stellar/go/protocols/horizon" @@ -52,15 +53,17 @@ func TestTransactionAdapter(t *testing.T) { closeTimestamp := expectedTx.LedgerCloseTime.UTC().Unix() tx := common.Transaction{ - LedgerTransaction: &ingest.LedgerTransaction{ - Index: 0, - Envelope: txEnv, - Result: xdr.TransactionResultPair{ - TransactionHash: xdr.Hash{}, - Result: txResult, + LedgerTransaction: &ingester.LedgerTransaction{ + LedgerTransaction: &ingest.LedgerTransaction{ + Index: 0, + Envelope: txEnv, + Result: xdr.TransactionResultPair{ + TransactionHash: xdr.Hash{}, + Result: txResult, + }, + FeeChanges: txFeeMeta, + UnsafeMeta: txMeta, }, - FeeChanges: txFeeMeta, - UnsafeMeta: txMeta, }, LedgerHeader: &xdr.LedgerHeader{ LedgerSeq: xdr.Uint32(expectedTx.Ledger), diff --git a/exp/lighthorizon/ingester/mock_ingester.go b/exp/lighthorizon/ingester/mock_ingester.go index 3eb3f9a740..62c377ce78 100644 --- a/exp/lighthorizon/ingester/mock_ingester.go +++ b/exp/lighthorizon/ingester/mock_ingester.go @@ -3,6 +3,7 @@ package ingester import ( "context" + "github.com/stellar/go/historyarchive" "github.com/stellar/go/xdr" "github.com/stretchr/testify/mock" ) @@ -28,6 +29,11 @@ func (m *MockIngester) GetLedger(ctx context.Context, sequence uint32) (xdr.Seri return args.Get(0).(xdr.SerializedLedgerCloseMeta), args.Error(1) } +func (m *MockIngester) PrepareRange(ctx context.Context, r historyarchive.Range) error { + args := m.Called(ctx, r) + return args.Error(0) +} + type MockLedgerTransactionReader struct { mock.Mock } diff --git a/exp/lighthorizon/services/main_test.go b/exp/lighthorizon/services/main_test.go index f29c715dcc..a8a3958214 100644 --- a/exp/lighthorizon/services/main_test.go +++ b/exp/lighthorizon/services/main_test.go @@ -146,11 +146,10 @@ func mockArchiveAndIndex(ctx context.Context) (ingester.Ingester, index.Store) { mockArchive. On("NewLedgerTransactionReader", expectedLedger1).Return(mockReaderLedger1, nil).Once(). On("NewLedgerTransactionReader", expectedLedger2).Return(mockReaderLedger2, nil).Once(). - On("NewLedgerTransactionReader", expectedLedger3).Return(mockReaderLedger3, nil). - On( - "NewLedgerTransactionReader", - mock.AnythingOfType("ingester.LedgerTransaction")). - Return(mockReaderLedgerTheRest, nil) + On("NewLedgerTransactionReader", expectedLedger3).Return(mockReaderLedger3, nil).Once(). + On("NewLedgerTransactionReader", mock.AnythingOfType("xdr.SerializedLedgerCloseMeta")). + Return(mockReaderLedgerTheRest, nil). + On("PrepareRange", mock.Anything, mock.Anything).Return(nil) // should be 24784 activeChk := uint32(index.GetCheckpointNumber(uint32(startLedgerSeq)))