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.
This commit is contained in:
Oliver Gugger 2021-03-19 11:49:53 +01:00
parent fc09828d95
commit 4d6fdae004
No known key found for this signature in database
GPG key ID: 8E4256593F177720
3 changed files with 13 additions and 12 deletions

View file

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

View file

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

View file

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