@@ -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