multi: add loop out routing hints config parameter for opt-in

pull/420/head
carla 3 years ago
parent 2e5a2823bc
commit 9e91e4ed15
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -107,6 +107,10 @@ type ClientConfig struct {
// for a loop out swap. When greater than one, a multi-part payment may
// be attempted.
LoopOutMaxParts uint32
// LoopOutRoutingHints indicates whether to use server-provided routing
// hints to improve off-chain routing.
LoopOutRoutingHints bool
}
// NewClient returns a new instance to initiate swaps with.
@ -146,6 +150,7 @@ func NewClient(dbDir string, cfg *ClientConfig) (*Client, func(), error) {
sweeper: sweeper,
createExpiryTimer: config.CreateExpiryTimer,
loopOutMaxParts: cfg.LoopOutMaxParts,
routingHints: cfg.LoopOutRoutingHints,
cancelSwap: swapServerClient.CancelLoopOutSwap,
})

@ -25,6 +25,7 @@ type executorConfig struct {
createExpiryTimer func(expiry time.Duration) <-chan time.Time
loopOutMaxParts uint32
routingHints bool
cancelSwap func(ctx context.Context, details *outCancelDetails) error
}
@ -146,6 +147,7 @@ func (s *executor) run(mainCtx context.Context,
blockEpochChan: queue.ChanOut(),
timerFactory: s.executorConfig.createExpiryTimer,
loopOutMaxParts: s.executorConfig.loopOutMaxParts,
routingHints: s.executorConfig.routingHints,
cancelSwap: s.executorConfig.cancelSwap,
}, height)
if err != nil && err != context.Canceled {

@ -129,7 +129,8 @@ type Config struct {
MaxLSATCost uint32 `long:"maxlsatcost" description:"Maximum cost in satoshis that loopd is going to pay for an LSAT token automatically. Does not include routing fees."`
MaxLSATFee uint32 `long:"maxlsatfee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an LSAT token."`
LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."`
LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."`
LoopOutRoutingHints bool `long:"loopouthints" description:"Whether to use server-provided hints to improve the success rate of off-chain routing. Note that enabling this setting will apply updates to lnd's mission control state."`
Lnd *lndConfig `group:"lnd" namespace:"lnd"`

@ -17,14 +17,15 @@ func getClient(config *Config, lnd *lndclient.LndServices) (*loop.Client,
func(), error) {
clientConfig := &loop.ClientConfig{
ServerAddress: config.Server.Host,
ProxyAddress: config.Server.Proxy,
SwapServerNoTLS: config.Server.NoTLS,
TLSPathServer: config.Server.TLSPath,
Lnd: lnd,
MaxLsatCost: btcutil.Amount(config.MaxLSATCost),
MaxLsatFee: btcutil.Amount(config.MaxLSATFee),
LoopOutMaxParts: config.LoopOutMaxParts,
ServerAddress: config.Server.Host,
ProxyAddress: config.Server.Proxy,
SwapServerNoTLS: config.Server.NoTLS,
TLSPathServer: config.Server.TLSPath,
Lnd: lnd,
MaxLsatCost: btcutil.Amount(config.MaxLSATCost),
MaxLsatFee: btcutil.Amount(config.MaxLSATFee),
LoopOutMaxParts: config.LoopOutMaxParts,
LoopOutRoutingHints: config.LoopOutRoutingHints,
}
swapClient, cleanUp, err := loop.NewClient(config.DataDir, clientConfig)

@ -85,6 +85,7 @@ type executeConfig struct {
blockEpochChan <-chan interface{}
timerFactory func(d time.Duration) <-chan time.Time
loopOutMaxParts uint32
routingHints bool
cancelSwap func(context.Context, *outCancelDetails) error
}

Loading…
Cancel
Save