Skip to content

Commit 76ca6e9

Browse files
authored
feat(Dockerfile): upgrade golang version from 1.20.4 to 1.21.4 for latest features and security updates (#68)
docs(README.md): update flags documentation to reflect recent changes and additions feat(flags.go): increase swapPublicationOffset from 30m to 60m for more flexibility feat(flags.go): add new flag sweepConfTarget for configurable confirmation targets refactor(loop_provider.go): replace hardcoded SweepConfTarget with configurable value from flags fix(loop_provider.go): remove unnecessary whitespace for cleaner code
1 parent bfa36b9 commit 76ca6e9

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20.4-alpine AS builder
1+
FROM golang:1.21.4-alpine AS builder
22
WORKDIR /src/
33
COPY . .
44
RUN go get -d -v ./...

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ Usage:
1111
liquidator [flags]
1212
1313
Flags:
14+
--backoffCoefficient float Coefficient to apply to the backoff (default 0.95)
15+
--backoffLimit float Limit coefficient of the backoff (default 0.1)
1416
-h, --help help for liquidator
17+
--limitFees float Limit fees for swaps e.g. 0.01 = 1% (default 0.007)
1518
--lndconnecturis string CSV of lndconnect strings to connect to lnd(s)
16-
--backoffCoefficient float Coefficient to apply to the backoff (default: 0.95)
17-
--backoffLimit float Limit coefficient of the backoff (default: 0.1)
18-
--limitFees float Limit to total Swap Fees (default 0.007 -> 0.7% Swap size)
1919
--logFormat string Log format from: {text, json} (default "text")
2020
--logLevel string Log level from values: {trace, debug, info, warn, error, fatal, panic} (default "info")
2121
--loopdconnecturis string CSV of loopdconnect strings to connect to loopd(s)
2222
--nodeguardHost string Hostname:port to connect to nodeguard
2323
--pollingInterval string Interval to poll data (default "15s")
24-
--retriesBeforeBackoff int Number of retries before applying backoff to the swap (default: 3)
25-
--swapPublicationOffset string Swap publication deadline offset (Maximum time for the swap provider to publish the swap) (default "30m")
24+
--retriesBeforeBackoff int Number of retries before applying backoff to the swap (default 3)
25+
--swapPublicationOffset string Swap publication deadline offset (Maximum time for the swap provider to publish the swap) (default "60m")
26+
--sweepConfTarget string Target number of confirmations for swaps, this uses bitcoin core broken estimator, procced with caution (default "400")
2627
```
2728
# Requirements
2829
This project uses [just](https://github.com/casey/just) with the following recipes

flags.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func init() {
9898
viper.BindPFlag("nodeguardHost", rootCmd.Flags().Lookup("nodeguardHost"))
9999

100100
//Swap Publication Offset in minutes
101-
rootCmd.Flags().String("swapPublicationOffset", "30m", "Swap publication deadline offset (Maximum time for the swap provider to publish the swap)")
101+
rootCmd.Flags().String("swapPublicationOffset", "60m", "Swap publication deadline offset (Maximum time for the swap provider to publish the swap)")
102102
viper.BindPFlag("swapPublicationOffset", rootCmd.Flags().Lookup("swapPublicationOffset"))
103103

104104
// Retries before applying backoff to the swap
@@ -117,6 +117,10 @@ func init() {
117117
rootCmd.Flags().Float64("limitFees", 0.007, "Limit fees for swaps e.g. 0.01 = 1%")
118118
viper.BindPFlag("limitFees", rootCmd.Flags().Lookup("limitFees"))
119119

120+
//Sweep conf
121+
rootCmd.Flags().String("sweepConfTarget", "400", "Target number of confirmations for swaps, this uses bitcoin core broken estimator, procced with caution")
122+
viper.BindPFlag("sweepConfTarget", rootCmd.Flags().Lookup("sweepConfTarget"))
123+
120124
//Now we set the global vars
121125

122126
pollingInterval = viper.GetDuration("pollingInterval")

provider/loop_provider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (l *LoopProvider) RequestReverseSubmarineSwap(ctx context.Context, request
247247

248248
sumFees := quote.SwapFeeSat + quote.HtlcSweepFeeSat + quote.PrepayAmtSat
249249
maximumFeesAllowed := int64(float64(request.SatsAmount) * limitFees)
250-
250+
251251
if sumFees > maximumFeesAllowed {
252252
err := fmt.Errorf("swap fees are greater than max limit fees, quote fees: %d, maximum fees allowed: %d", sumFees, maximumFeesAllowed)
253253
log.Error(err)
@@ -272,7 +272,7 @@ func (l *LoopProvider) RequestReverseSubmarineSwap(ctx context.Context, request
272272
MaxPrepayRoutingFee: int64(limits.maxPrepayRoutingFee),
273273
MaxSwapRoutingFee: int64(limits.maxSwapRoutingFee),
274274
OutgoingChanSet: request.ChannelSet,
275-
SweepConfTarget: 3, //TODO Make this configurable
275+
SweepConfTarget: viper.GetInt32("sweepConfTarget"),
276276
HtlcConfirmations: 3,
277277
//The publication deadline is maximum the offset of the swap deadline conf plus the current time
278278
SwapPublicationDeadline: uint64(time.Now().Add(viper.GetDuration("swapPublicationOffset") * time.Minute).Unix()),

0 commit comments

Comments
 (0)