Skip to content

Commit

Permalink
stellar#4728: fixed static check warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Mar 17, 2023
1 parent 33c1f7d commit 2fcb6f0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 45 deletions.
38 changes: 38 additions & 0 deletions services/horizon/internal/actions/operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package actions

import (
"database/sql"
"encoding/hex"
"fmt"
"net/http/httptest"
"testing"
"time"

"github.com/guregu/null"
"github.com/stellar/go/ingest"
"github.com/stellar/go/protocols/horizon/operations"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/ledger"
Expand All @@ -16,6 +18,7 @@ import (
supportProblem "github.com/stellar/go/support/render/problem"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/assert"
)

func TestInvokeHostFnDetailsInPaymentOperations(t *testing.T) {
Expand Down Expand Up @@ -829,3 +832,38 @@ func TestOperation_IncludeTransaction(t *testing.T) {
tt.Assert.NotNil(op.Transaction)
tt.Assert.Equal(op.TransactionHash, op.Transaction.ID)
}

type testTransaction struct {
index uint32
envelopeXDR string
resultXDR string
feeChangesXDR string
metaXDR string
hash string
}

func buildLedgerTransaction(t *testing.T, tx testTransaction) ingest.LedgerTransaction {
transaction := ingest.LedgerTransaction{
Index: tx.index,
Envelope: xdr.TransactionEnvelope{},
Result: xdr.TransactionResultPair{},
FeeChanges: xdr.LedgerEntryChanges{},
UnsafeMeta: xdr.TransactionMeta{},
}

tt := assert.New(t)

err := xdr.SafeUnmarshalBase64(tx.envelopeXDR, &transaction.Envelope)
tt.NoError(err)
err = xdr.SafeUnmarshalBase64(tx.resultXDR, &transaction.Result.Result)
tt.NoError(err)
err = xdr.SafeUnmarshalBase64(tx.metaXDR, &transaction.UnsafeMeta)
tt.NoError(err)
err = xdr.SafeUnmarshalBase64(tx.feeChangesXDR, &transaction.FeeChanges)
tt.NoError(err)

_, err = hex.Decode(transaction.Result.TransactionHash[:], []byte(tx.hash))
tt.NoError(err)

return transaction
}
45 changes: 0 additions & 45 deletions services/horizon/internal/actions/test.go

This file was deleted.

0 comments on commit 2fcb6f0

Please sign in to comment.