Skip to content

Commit

Permalink
feat: configure localtxmonitor client (#116)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <[email protected]>
  • Loading branch information
wolf31o2 authored Mar 7, 2024
1 parent 72657fe commit 3802e12
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/blinklabs-io/cardano-node-api
go 1.20

require (
github.com/blinklabs-io/gouroboros v0.72.0
github.com/blinklabs-io/gouroboros v0.73.0
github.com/fxamacker/cbor/v2 v2.6.0
github.com/gin-contrib/zap v1.1.0
github.com/gin-gonic/gin v1.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/blinklabs-io/gouroboros v0.72.0 h1:HI9DFQ3wi+pr8iOPH7jOr31rNRf2ij7jA2v3dv+2vOQ=
github.com/blinklabs-io/gouroboros v0.72.0/go.mod h1:1Vpk6pm86JBKHi5riBQv4EAKixX+XvttWv1o6DewLBg=
github.com/blinklabs-io/gouroboros v0.73.0 h1:ZbTUoWo7KgDxOHhIqnWFOTrIJtcr6S5XmPQ5eEU//hE=
github.com/blinklabs-io/gouroboros v0.73.0/go.mod h1:cvu7kpPIso3IS5Dexfq4m7sMnyLMsLFOE5jjDBEtC7E=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.11.2 h1:ywfwo0a/3j9HR8wsYGWsIWl2mvRsI950HyoxiBERw5A=
Expand Down
35 changes: 35 additions & 0 deletions internal/node/localtxmonitor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2024 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package node

import (
"time"

"github.com/blinklabs-io/gouroboros/protocol/localtxmonitor"

"github.com/blinklabs-io/cardano-node-api/internal/config"
)

func buildLocalTxMonitorConfig() localtxmonitor.Config {
cfg := config.GetConfig()
return localtxmonitor.NewConfig(
localtxmonitor.WithAcquireTimeout(
time.Duration(cfg.Node.Timeout) * time.Second,
),
localtxmonitor.WithQueryTimeout(
time.Duration(cfg.Node.Timeout) * time.Second,
),
)
}
1 change: 1 addition & 0 deletions internal/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func GetConnection() (*ouroboros.Connection, error) {
ouroboros.WithNodeToNode(false),
ouroboros.WithKeepAlive(true),
ouroboros.WithChainSyncConfig(buildChainSyncConfig()),
ouroboros.WithLocalTxMonitorConfig(buildLocalTxMonitorConfig()),
ouroboros.WithLocalTxSubmissionConfig(buildLocalTxSubmissionConfig()),
)
if err != nil {
Expand Down

0 comments on commit 3802e12

Please sign in to comment.