Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 committed Sep 21, 2024
1 parent 62e10a1 commit 6c37b8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func newServer(t *testing.T, cm *chain.Manager, e *explorer.Explorer, listenAddr

go func() {
if err := server.Serve(httpListener); err != nil && !errors.Is(err, http.ErrServerClosed) && !errors.Is(err, net.ErrClosed) {
t.Fatal(err)
return
}
}()

Expand Down
5 changes: 3 additions & 2 deletions internal/testutil/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func MineBlock(state consensus.State, txns []types.Transaction, minerAddr types.
return b
}

// SignTransactionWithRevisions signs a transaction using the specified private
// SignTransactionWithContracts signs a transaction using the specified private
// keys, including contract revisions.
func SignTransactionWithContracts(cs consensus.State, pk, renterPK, hostPK types.PrivateKey, txn *types.Transaction) {
appendSig := func(key types.PrivateKey, pubkeyIndex uint64, parentID types.Hash256) {
Expand All @@ -144,7 +144,8 @@ func SignTransactionWithContracts(cs consensus.State, pk, renterPK, hostPK types
}
}

// SignTransaction signs a transaction using the specified private keys.
// SignTransaction signs a transaction that does not have any revisions with
// the specified private key.
func SignTransaction(cs consensus.State, pk types.PrivateKey, txn *types.Transaction) {
if len(txn.FileContractRevisions) > 0 {
panic("use SignTransactionWithContracts instead")
Expand Down
3 changes: 3 additions & 0 deletions internal/testutil/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"go.sia.tech/explored/explorer"
)

// Check checks if two values of the same type are equal and fails otherwise.
func Check[T any](t *testing.T, desc string, expect, got T) {
if !reflect.DeepEqual(expect, got) {
t.Fatalf("expected %v %s, got %v", expect, desc, got)
Expand Down Expand Up @@ -145,6 +146,8 @@ func CheckMetrics(t *testing.T, db explorer.Store, cm *chain.Manager, expected e
// don't check circulating supply here because it requires a lot of accounting
}

// CheckChainIndices checks that the chain indices that a transaction was in
// from the explorer match the expected chain indices.
func CheckChainIndices(t *testing.T, db explorer.Store, txnID types.TransactionID, expected []types.ChainIndex) {
indices, err := db.TransactionChainIndices(txnID, 0, 100)
switch {
Expand Down

0 comments on commit 6c37b8b

Please sign in to comment.