-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): update gouroboros to 0.55.0
Signed-off-by: Chris Gianelloni <[email protected]>
- Loading branch information
Showing
3 changed files
with
7 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,8 @@ import ( | |
// @contact.url https://blinklabs.io | ||
// @contact.email [email protected] | ||
|
||
// @license.name Apache 2.0 | ||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
// @license.name Apache 2.0 | ||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html | ||
func Start(cfg *config.Config) error { | ||
// Disable gin debug and color output | ||
gin.SetMode(gin.ReleaseMode) | ||
|
@@ -321,13 +321,13 @@ func handleSubmitTx(c *gin.Context) { | |
oConn.Close() | ||
}() | ||
// Determine transaction type (era) | ||
txType, err := determineTransactionType(txRawBytes) | ||
txType, err := ledger.DetermineTransactionType(txRawBytes) | ||
if err != nil { | ||
c.JSON(400, "could not parse transaction to determine type") | ||
return | ||
} | ||
// Submit the transaction | ||
if err := oConn.LocalTxSubmission().Client.SubmitTx(txType, txRawBytes); err != nil { | ||
if err := oConn.LocalTxSubmission().Client.SubmitTx(uint16(txType), txRawBytes); err != nil { | ||
if c.GetHeader("Accept") == "application/cbor" { | ||
txRejectErr := err.(localtxsubmission.TransactionRejectedError) | ||
c.Data(400, "application/cbor", txRejectErr.ReasonCbor) | ||
|
@@ -343,29 +343,3 @@ func handleSubmitTx(c *gin.Context) { | |
// Increment custom metric | ||
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_count").Inc(nil) | ||
} | ||
|
||
func determineTransactionType(data []byte) (uint16, error) { | ||
// TODO: uncomment this once the following issue is resolved: | ||
// https://github.com/blinklabs-io/gouroboros/issues/206 | ||
/* | ||
if _, err := ledger.NewByronTransactionFromCbor(data); err == nil { | ||
return ledger.TX_TYPE_BYRON, nil | ||
} | ||
*/ | ||
if _, err := ledger.NewShelleyTransactionFromCbor(data); err == nil { | ||
return ledger.TX_TYPE_SHELLEY, nil | ||
} | ||
if _, err := ledger.NewAllegraTransactionFromCbor(data); err == nil { | ||
return ledger.TX_TYPE_ALLEGRA, nil | ||
} | ||
if _, err := ledger.NewMaryTransactionFromCbor(data); err == nil { | ||
return ledger.TX_TYPE_MARY, nil | ||
} | ||
if _, err := ledger.NewAlonzoTransactionFromCbor(data); err == nil { | ||
return ledger.TX_TYPE_ALONZO, nil | ||
} | ||
if _, err := ledger.NewBabbageTransactionFromCbor(data); err == nil { | ||
return ledger.TX_TYPE_BABBAGE, nil | ||
} | ||
return 0, fmt.Errorf("unknown transaction type") | ||
} |