Skip to content

Commit

Permalink
feat: configure localtxmonitor client
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <[email protected]>
  • Loading branch information
wolf31o2 committed Mar 3, 2024
1 parent 515662b commit 91202b4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
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()),

Check failure on line 34 in internal/node/node.go

View workflow job for this annotation

GitHub Actions / go-test (1.20.x, ubuntu-latest)

undefined: ouroboros.WithLocalTxMonitorConfig

Check failure on line 34 in internal/node/node.go

View workflow job for this annotation

GitHub Actions / go-test (1.21.x, ubuntu-latest)

undefined: ouroboros.WithLocalTxMonitorConfig
ouroboros.WithLocalTxSubmissionConfig(buildLocalTxSubmissionConfig()),
)
if err != nil {
Expand Down

0 comments on commit 91202b4

Please sign in to comment.