diff --git a/internal/node/localtxmonitor.go b/internal/node/localtxmonitor.go new file mode 100644 index 0000000..44e732c --- /dev/null +++ b/internal/node/localtxmonitor.go @@ -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, + ), + ) +} diff --git a/internal/node/node.go b/internal/node/node.go index 91be4ae..f63909c 100644 --- a/internal/node/node.go +++ b/internal/node/node.go @@ -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 {