Skip to content

Commit 7854d78

Browse files
committed
chore: update go-ouroboros-network to 0.14.0
Fixes #34
1 parent 5f8d8ac commit 7854d78

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
require (
66
github.com/Bitrue-exchange/libada-go v0.0.1-rc
7-
github.com/cloudstruct/go-ouroboros-network v0.13.4
7+
github.com/cloudstruct/go-ouroboros-network v0.14.0
88
github.com/fxamacker/cbor/v2 v2.4.0
99
github.com/gin-contrib/zap v0.0.2
1010
github.com/gin-gonic/gin v1.7.7

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
6262
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
6363
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
6464
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
65-
github.com/cloudstruct/go-ouroboros-network v0.13.4 h1:kWehEv0UpVIKMkaLpfMK3aWFGwZza/nGib9jQJriH6U=
66-
github.com/cloudstruct/go-ouroboros-network v0.13.4/go.mod h1:06ggUMerJLwKJkVi5DLX1QMDz8r+R8o92rht7Z4ss9k=
65+
github.com/cloudstruct/go-ouroboros-network v0.14.0 h1:1X56wtgo2a8BLYNuCADjWH1mC6Z0NjkkYrfNtXbyzE0=
66+
github.com/cloudstruct/go-ouroboros-network v0.14.0/go.mod h1:06ggUMerJLwKJkVi5DLX1QMDz8r+R8o92rht7Z4ss9k=
6767
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
6868
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
6969
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=

internal/api/api.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,6 @@ func handleSubmitTx(c *gin.Context) {
158158
NetworkMagic: uint32(cfg.Node.NetworkMagic),
159159
ErrorChan: errorChan,
160160
UseNodeToNodeProtocol: false,
161-
LocalTxSubmissionCallbackConfig: &localtxsubmission.CallbackConfig{
162-
AcceptTxFunc: func() error {
163-
// Return transaction ID
164-
c.String(202, txIdHex)
165-
doneChan <- true
166-
// Increment custom metric
167-
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_count").Inc(nil)
168-
return nil
169-
},
170-
RejectTxFunc: func(reason interface{}) error {
171-
c.String(400, fmt.Sprintf("transaction rejected by node: %#v", reason))
172-
doneChan <- true
173-
// Increment custom metric
174-
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
175-
return nil
176-
},
177-
},
178161
}
179162
oConn, err := ouroboros.New(oOpts)
180163
defer func() {
@@ -214,6 +197,25 @@ func handleSubmitTx(c *gin.Context) {
214197
doneChan <- true
215198
}
216199
}()
200+
// Start local-tx-submission protocol
201+
localTxSubmissionCallbackConfig := &localtxsubmission.CallbackConfig{
202+
AcceptTxFunc: func() error {
203+
// Return transaction ID
204+
c.String(202, txIdHex)
205+
doneChan <- true
206+
// Increment custom metric
207+
_ = ginmetrics.GetMonitor().GetMetric("tx_submit_count").Inc(nil)
208+
return nil
209+
},
210+
RejectTxFunc: func(reason interface{}) error {
211+
c.String(400, fmt.Sprintf("transaction rejected by node: %#v", reason))
212+
doneChan <- true
213+
// Increment custom metric
214+
_ = ginmetrics.GetMonitor().GetMetric("tx_failure_count").Inc(nil)
215+
return nil
216+
},
217+
}
218+
oConn.LocalTxSubmission.Start(localTxSubmissionCallbackConfig)
217219
// TODO: figure out better way to determine era
218220
if err = oConn.LocalTxSubmission.SubmitTx(block.TX_TYPE_ALONZO, txRawBytes); err != nil {
219221
logger.Errorf("failure submitting transaction: %s", err)

0 commit comments

Comments
 (0)