mirror of
https://github.com/lightninglabs/loop
synced 2024-11-09 19:10:47 +00:00
loopd+lsat: add LSAT cost configuration parameters
This commit is contained in:
parent
d9597e8387
commit
8aeeaefbaf
@ -4,6 +4,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
|
"github.com/lightninglabs/loop/lsat"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -40,6 +41,8 @@ type config struct {
|
|||||||
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB"`
|
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB"`
|
||||||
|
|
||||||
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems"`
|
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems"`
|
||||||
|
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."`
|
||||||
|
|
||||||
Lnd *lndConfig `group:"lnd" namespace:"lnd"`
|
Lnd *lndConfig `group:"lnd" namespace:"lnd"`
|
||||||
|
|
||||||
@ -60,6 +63,8 @@ var defaultConfig = config{
|
|||||||
MaxLogFiles: defaultMaxLogFiles,
|
MaxLogFiles: defaultMaxLogFiles,
|
||||||
MaxLogFileSize: defaultMaxLogFileSize,
|
MaxLogFileSize: defaultMaxLogFileSize,
|
||||||
DebugLevel: defaultLogLevel,
|
DebugLevel: defaultLogLevel,
|
||||||
|
MaxLSATCost: lsat.DefaultMaxCostSats,
|
||||||
|
MaxLSATFee: lsat.DefaultMaxRoutingFeeSats,
|
||||||
Lnd: &lndConfig{
|
Lnd: &lndConfig{
|
||||||
Host: "localhost:10009",
|
Host: "localhost:10009",
|
||||||
},
|
},
|
||||||
|
@ -33,10 +33,14 @@ const (
|
|||||||
// challenge.
|
// challenge.
|
||||||
AuthHeader = "WWW-Authenticate"
|
AuthHeader = "WWW-Authenticate"
|
||||||
|
|
||||||
// MaxRoutingFee is the maximum routing fee in satoshis that we are
|
// DefaultMaxCostSats is the default maximum amount in satoshis that we
|
||||||
// going to pay to acquire an LSAT token.
|
// are going to pay for an LSAT automatically. Does not include routing
|
||||||
// TODO(guggero): make this configurable
|
// fees.
|
||||||
MaxRoutingFeeSats = 10
|
DefaultMaxCostSats = 1000
|
||||||
|
|
||||||
|
// DefaultMaxRoutingFeeSats is the default maximum routing fee in
|
||||||
|
// satoshis that we are going to pay to acquire an LSAT token.
|
||||||
|
DefaultMaxRoutingFeeSats = 10
|
||||||
|
|
||||||
// PaymentTimeout is the maximum time we allow a payment to take before
|
// PaymentTimeout is the maximum time we allow a payment to take before
|
||||||
// we stop waiting for it.
|
// we stop waiting for it.
|
||||||
@ -238,7 +242,7 @@ func (i *Interceptor) payLsatToken(ctx context.Context, md *metadata.MD) (
|
|||||||
payCtx, cancel := context.WithTimeout(ctx, PaymentTimeout)
|
payCtx, cancel := context.WithTimeout(ctx, PaymentTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
respChan := i.lnd.Client.PayInvoice(
|
respChan := i.lnd.Client.PayInvoice(
|
||||||
payCtx, invoiceStr, MaxRoutingFeeSats, nil,
|
payCtx, invoiceStr, DefaultMaxRoutingFeeSats, nil,
|
||||||
)
|
)
|
||||||
select {
|
select {
|
||||||
case result := <-respChan:
|
case result := <-respChan:
|
||||||
|
Loading…
Reference in New Issue
Block a user