From 4d6fdae0046741effb09e9f305f2016d3619d73e Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 19 Mar 2021 11:49:53 +0100 Subject: [PATCH] funding+order: move DefaultBatchStepTimeout We need to use the DefaultBatchStepTimeout variable outside of the funding manager as well and move it to the order package to not create a circular dependency when accessing it from the root package. --- funding/manager.go | 11 ----------- order/batch.go | 12 ++++++++++++ server.go | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/funding/manager.go b/funding/manager.go index adc0f99..881d31a 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -26,17 +26,6 @@ import ( "google.golang.org/grpc/status" ) -var ( - // DefaultBatchStepTimeout is the default time we allow an action that - // blocks the batch conversation (like peer connection establishment or - // channel open) to take. If any action takes longer, we might reject - // the order from that slow peer. This value SHOULD be lower than the - // defaultMsgTimeout on the server side otherwise nodes might get kicked - // out of the match making process for timing out even though it was - // their peer's fault. - DefaultBatchStepTimeout = 15 * time.Second -) - // MatchRejectErr is an error type that is returned from the funding manager if // the trader rejects certain orders instead of the whole batch. type MatchRejectErr struct { diff --git a/order/batch.go b/order/batch.go index 7567bbb..265b39e 100644 --- a/order/batch.go +++ b/order/batch.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "net" + "time" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/wire" @@ -27,6 +28,17 @@ const ( MaxBatchIDHistoryLookup = 10_000 ) +var ( + // DefaultBatchStepTimeout is the default time we allow an action that + // blocks the batch conversation (like peer connection establishment or + // channel open) to take. If any action takes longer, we might reject + // the order from that slow peer. This value SHOULD be lower than the + // defaultMsgTimeout on the server side otherwise nodes might get kicked + // out of the match making process for timing out even though it was + // their peer's fault. + DefaultBatchStepTimeout = 15 * time.Second +) + // BatchVersion is the type for the batch verification protocol. type BatchVersion uint32 diff --git a/server.go b/server.go index 3a4f381..7b6ec90 100644 --- a/server.go +++ b/server.go @@ -462,7 +462,7 @@ func (s *Server) setupClient() error { WalletKit: s.lndServices.WalletKit, LightningClient: s.lndServices.Client, BaseClient: s.lndClient, - BatchStepTimeout: funding.DefaultBatchStepTimeout, + BatchStepTimeout: order.DefaultBatchStepTimeout, NewNodesOnly: s.cfg.NewNodesOnly, PendingOpenChannels: make( chan *lnrpc.ChannelEventUpdate_PendingOpenChannel,