Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions submit/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package submit

import (
"fmt"
"math"
"time"

ouroboros "github.com/blinklabs-io/gouroboros"
Expand All @@ -34,6 +35,10 @@ type Config struct {
}

func SubmitTx(cfg *Config, txRawBytes []byte) (string, error) {
// Fail fast if timeout is too large
if cfg.Timeout > math.MaxInt64 {
return "", fmt.Errorf("given timeout too large")
}
// Determine transaction type (era)
txType, err := ledger.DetermineTransactionType(txRawBytes)
if err != nil {
Expand Down Expand Up @@ -82,6 +87,7 @@ func SubmitTx(cfg *Config, txRawBytes []byte) (string, error) {
oConn.Close()
}()
// Submit the transaction
// #nosec G115
if err := oConn.LocalTxSubmission().Client.SubmitTx(uint16(txType), txRawBytes); err != nil {
return "", fmt.Errorf("%s", err.Error())
}
Expand Down