Browse Source

Merge pull request #65 from wpaulino/sweep-conf-target

multi: expose confirmation target for loop out HTLC sweeps
pull/68/head
Olaoluwa Osuntokun 1 year ago
committed by GitHub
parent
commit
e8d696e119
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 229 additions and 83 deletions
  1. +6
    -0
      client.go
  2. +11
    -1
      cmd/loop/loopout.go
  3. +15
    -4
      cmd/loop/quote.go
  4. +37
    -3
      cmd/loopd/swapclient_server.go
  5. +33
    -10
      loopout.go
  6. +92
    -65
      looprpc/client.pb.go
  7. +8
    -0
      looprpc/client.pb.gw.go
  8. +14
    -0
      looprpc/client.proto
  9. +13
    -0
      looprpc/client.swagger.json

+ 6
- 0
client.go View File

@ -42,6 +42,12 @@ var (
// is too soon for us.
ErrExpiryTooFar = errors.New("swap expiry too far")
// ErrSweepConfTargetTooFar is returned when the client proposes a
// confirmation target to sweep the on-chain HTLC of a Loop Out that is
// beyond the expiration height proposed by the server.
ErrSweepConfTargetTooFar = errors.New("sweep confirmation target is " +
"beyond swap expiration height")
serverRPCTimeout = 30 * time.Second
republishDelay = 10 * time.Second

+ 11
- 1
cmd/loop/loopout.go View File

@ -36,6 +36,13 @@ var loopOutCommand = cli.Command{
Name: "amt",
Usage: "the amount in satoshis to loop out",
},
cli.Uint64Flag{
Name: "conf_target",
Usage: "the number of blocks from the swap " +
"initiation height that the on-chain HTLC " +
"should be swept within",
Value: uint64(loop.DefaultSweepConfTarget),
},
},
Action: loopOut,
}
@ -75,8 +82,10 @@ func loopOut(ctx *cli.Context) error {
}
defer cleanup()
sweepConfTarget := int32(ctx.Uint64("conf_target"))
quoteReq := &looprpc.QuoteRequest{
Amt: int64(amt),
Amt: int64(amt),
ConfTarget: sweepConfTarget,
}
quote, err := client.LoopOutQuote(context.Background(), quoteReq)
if err != nil {
@ -103,6 +112,7 @@ func loopOut(ctx *cli.Context) error {
MaxPrepayRoutingFee: int64(*limits.maxPrepayRoutingFee),
MaxSwapRoutingFee: int64(*limits.maxSwapRoutingFee),
LoopOutChannel: unchargeChannel,
SweepConfTarget: sweepConfTarget,
})
if err != nil {
return err

+ 15
- 4
cmd/loop/quote.go View File

@ -12,12 +12,22 @@ var quoteCommand = cli.Command{
Usage: "get a quote for the cost of a swap",
ArgsUsage: "amt",
Description: "Allows to determine the cost of a swap up front",
Action: quote,
Flags: []cli.Flag{
cli.Uint64Flag{
Name: "conf_target",
Usage: "the number of blocks from the swap " +
"initiation height that the on-chain HTLC " +
"should be swept within in a Loop Out",
Value: 6,
},
},
Action: quote,
}
func quote(ctx *cli.Context) error {
// Show command help if no arguments and flags were provided.
if ctx.NArg() < 1 {
// Show command help if the incorrect number arguments and/or flags were
// provided.
if ctx.NArg() != 1 || ctx.NumFlags() > 1 {
cli.ShowCommandHelp(ctx, "quote")
return nil
}
@ -36,7 +46,8 @@ func quote(ctx *cli.Context) error {
ctxb := context.Background()
resp, err := client.LoopOutQuote(ctxb, &looprpc.QuoteRequest{
Amt: int64(amt),
Amt: int64(amt),
ConfTarget: int32(ctx.Uint64("conf_target")),
})
if err != nil {
return err

+ 37
- 3
cmd/loopd/swapclient_server.go View File

@ -16,7 +16,14 @@ import (
"github.com/lightninglabs/loop/looprpc"
)
const completedSwapsCount = 5
const (
completedSwapsCount = 5
// minConfTarget is the minimum confirmation target we'll allow clients
// to specify. This is driven by the minimum confirmation target allowed
// by the backing fee estimator.
minConfTarget = 2
)
// swapClientServer implements the grpc service exposed by loopd.
type swapClientServer struct {
@ -34,6 +41,13 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
logger.Infof("Loop out request received")
sweepConfTarget, err := validateConfTarget(
in.SweepConfTarget, loop.DefaultSweepConfTarget,
)
if err != nil {
return nil, err
}
var sweepAddr btcutil.Address
if in.Dest == "" {
// Generate sweep address if none specified.
@ -60,7 +74,7 @@ func (s *swapClientServer) LoopOut(ctx context.Context,
MaxPrepayRoutingFee: btcutil.Amount(in.MaxPrepayRoutingFee),
MaxSwapRoutingFee: btcutil.Amount(in.MaxSwapRoutingFee),
MaxSwapFee: btcutil.Amount(in.MaxSwapFee),
SweepConfTarget: defaultConfTarget,
SweepConfTarget: sweepConfTarget,
}
if in.LoopOutChannel != 0 {
req.LoopOutChannel = &in.LoopOutChannel
@ -242,9 +256,15 @@ func (s *swapClientServer) LoopOutTerms(ctx context.Context,
func (s *swapClientServer) LoopOutQuote(ctx context.Context,
req *looprpc.QuoteRequest) (*looprpc.QuoteResponse, error) {
confTarget, err := validateConfTarget(
req.ConfTarget, loop.DefaultSweepConfTarget,
)
if err != nil {
return nil, err
}
quote, err := s.impl.LoopOutQuote(ctx, &loop.LoopOutQuoteRequest{
Amount: btcutil.Amount(req.Amt),
SweepConfTarget: defaultConfTarget,
SweepConfTarget: confTarget,
})
if err != nil {
return nil, err
@ -323,3 +343,17 @@ func (s *swapClientServer) LoopIn(ctx context.Context,
HtlcAddress: htlc.String(),
}, nil
}
// validateConfTarget ensures the given confirmation target is valid. If one
// isn't specified (0 value), then the default target is used.
func validateConfTarget(target, defaultTarget int32) (int32, error) {
switch {
// Ensure the target respects our minimum threshold.
case target < minConfTarget:
return 0, fmt.Errorf("a confirmation target of at least %v "+
"must be provided", minConfTarget)
default:
return target, nil
}
}

+ 33
- 10
loopout.go View File

@ -20,7 +20,18 @@ import (
var (
// MinLoopOutPreimageRevealDelta configures the minimum number of
// remaining blocks before htlc expiry required to reveal preimage.
MinLoopOutPreimageRevealDelta = int32(20)
MinLoopOutPreimageRevealDelta int32 = 20
// DefaultSweepConfTarget is the default confirmation target we'll use
// when sweeping on-chain HTLCs.
DefaultSweepConfTarget int32 = 6
// DefaultSweepConfTargetDelta is the delta of blocks from a Loop Out
// swap's expiration height at which we begin to use the default sweep
// confirmation target.
//
// TODO(wilmer): tune?
DefaultSweepConfTargetDelta int32 = DefaultSweepConfTarget * 2
)
// loopOutSwap contains all the in-memory state related to a pending loop out
@ -577,22 +588,29 @@ func (s *loopOutSwap) sweep(ctx context.Context,
htlcValue btcutil.Amount) error {
witnessFunc := func(sig []byte) (wire.TxWitness, error) {
return s.htlc.GenSuccessWitness(
sig, s.Preimage,
)
return s.htlc.GenSuccessWitness(sig, s.Preimage)
}
// Calculate sweep tx fee
// Calculate the transaction fee based on the confirmation target
// required to sweep the HTLC before the timeout. We'll use the
// confirmation target provided by the client unless we've come too
// close to the expiration height, in which case we'll use the default
// if it is better than what the client provided.
confTarget := s.SweepConfTarget
if s.CltvExpiry-s.height >= DefaultSweepConfTargetDelta &&
confTarget > DefaultSweepConfTarget {
confTarget = DefaultSweepConfTarget
}
fee, err := s.sweeper.GetSweepFee(
ctx, s.htlc.AddSuccessToEstimator,
s.SweepConfTarget,
ctx, s.htlc.AddSuccessToEstimator, confTarget,
)
if err != nil {
return err
}
// Ensure it doesn't exceed our maximum fee allowed.
if fee > s.MaxMinerFee {
s.log.Warnf("Required miner fee %v exceeds max of %v",
s.log.Warnf("Required fee %v exceeds max miner fee of %v",
fee, s.MaxMinerFee)
if s.state == loopdb.StatePreimageRevealed {
@ -608,8 +626,7 @@ func (s *loopOutSwap) sweep(ctx context.Context,
// Create sweep tx.
sweepTx, err := s.sweeper.CreateSweepTx(
ctx, s.height, s.htlc, htlcOutpoint,
s.ReceiverKey, witnessFunc,
ctx, s.height, s.htlc, htlcOutpoint, s.ReceiverKey, witnessFunc,
htlcValue, fee, s.DestAddr,
)
if err != nil {
@ -686,5 +703,11 @@ func validateLoopOutContract(lnd *lndclient.LndServices,
return ErrExpiryTooSoon
}
// Ensure the client has provided a sweep confirmation target that does
// not exceed the height at which we revert back to using the default.
if height+request.SweepConfTarget >= response.expiry-DefaultSweepConfTargetDelta {
return ErrSweepConfTargetTooFar
}
return nil
}

+ 92
- 65
looprpc/client.pb.go View File

@ -154,7 +154,11 @@ type LoopOutRequest struct {
//*
//The channel to loop out, the channel to loop out is selected based on the
//lowest routing fee for the swap payment to the server.
LoopOutChannel uint64 `protobuf:"varint,8,opt,name=loop_out_channel,json=loopOutChannel,proto3" json:"loop_out_channel,omitempty"`
LoopOutChannel uint64 `protobuf:"varint,8,opt,name=loop_out_channel,json=loopOutChannel,proto3" json:"loop_out_channel,omitempty"`
//*
//The number of blocks from the on-chain HTLC's confirmation height that it
//should be swept within.
SweepConfTarget int32 `protobuf:"varint,9,opt,name=sweep_conf_target,json=sweepConfTarget,proto3" json:"sweep_conf_target,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -241,6 +245,13 @@ func (m *LoopOutRequest) GetLoopOutChannel() uint64 {
return 0
}
func (m *LoopOutRequest) GetSweepConfTarget() int32 {
if m != nil {
return m.SweepConfTarget
}
return 0
}
type LoopInRequest struct {
//*
//Requested swap amount in sat. This does not include the swap and miner
@ -683,7 +694,13 @@ func (m *TermsResponse) GetCltvDelta() int32 {
type QuoteRequest struct {
//*
//The amount to swap in satoshis.
Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"`
Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"`
//*
//The confirmation target that should be used either for the sweep of the
//on-chain HTLC broadcast by the swap server in the case of a Loop Out, or for
//the confirmation of the on-chain HTLC broadcast by the swap client in the
//case of a Loop In.
ConfTarget int32 `protobuf:"varint,2,opt,name=conf_target,json=confTarget,proto3" json:"conf_target,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -721,6 +738,13 @@ func (m *QuoteRequest) GetAmt() int64 {
return 0
}
func (m *QuoteRequest) GetConfTarget() int32 {
if m != nil {
return m.ConfTarget
}
return 0
}
type QuoteResponse struct {
//*
//The fee that the swap server is charging for the swap.
@ -799,69 +823,72 @@ func init() {
func init() { proto.RegisterFile("client.proto", fileDescriptor_014de31d7ac8c57c) }
var fileDescriptor_014de31d7ac8c57c = []byte{
// 992 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x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69, 0x69, 0x9e, 0x35, 0xe9, 0x75, 0xbb, 0xad, 0x49, 0x17, 0x3c, 0x66, 0x77, 0xa4,
0x74, 0x1b, 0xb5, 0x0a, 0xd2, 0x6f, 0x05, 0xa7, 0xf7, 0x0b, 0x8e, 0xf8, 0xaf, 0xe8, 0x47, 0xb0,
0x5e, 0x11, 0xae, 0x3a, 0xf4, 0x31, 0xd5, 0x17, 0x04, 0x3e, 0xa6, 0xc6, 0x37, 0xbb, 0xf2, 0xff,
0x80, 0xe7, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xf8, 0xf2, 0xb9, 0x76, 0x3e, 0x08, 0x00, 0x00,
// 1028 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x5d, 0x73, 0x1a, 0x37,
0x14, 0x0d, 0x0b, 0x36, 0x70, 0x0d, 0x0b, 0x56, 0x12, 0x87, 0xd2, 0x66, 0x4a, 0x69, 0x93, 0x32,
0x7e, 0x30, 0xad, 0xf3, 0xd0, 0x69, 0x5f, 0x3a, 0x04, 0x93, 0x98, 0x19, 0xdb, 0xb8, 0x0b, 0xce,
0x4c, 0x9f, 0x34, 0x0a, 0x08, 0x7b, 0x67, 0x76, 0xa5, 0xcd, 0x4a, 0xf8, 0x63, 0x3a, 0x7d, 0xe9,
0x3f, 0x68, 0xfb, 0x57, 0xfa, 0x4f, 0xfa, 0xde, 0xa7, 0xfe, 0x90, 0x8e, 0xae, 0x96, 0x35, 0x0b,
0xf5, 0x4b, 0xde, 0xf0, 0xd1, 0xd1, 0xd1, 0xd5, 0xbd, 0xe7, 0x68, 0x0d, 0x95, 0x69, 0xe0, 0x73,
0xa1, 0x0f, 0xa2, 0x58, 0x6a, 0x49, 0x8a, 0x81, 0x94, 0x51, 0x1c, 0x4d, 0x9b, 0x9f, 0x5d, 0x4a,
0x79, 0x19, 0xf0, 0x2e, 0x8b, 0xfc, 0x2e,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0x28, 0xd8, 0x2c, 0xf7, 0xf1, 0xa3, 0x43, 0x3c,
0x28, 0x26, 0x9f, 0x11, 0xf2, 0x2c, 0x8d, 0x5f, 0xf6, 0xc3, 0xd2, 0x7c, 0x9a, 0xc9, 0xe5, 0xb2,
0x79, 0xed, 0x67, 0xbf, 0xfd, 0xfd, 0xef, 0x9f, 0xce, 0x6e, 0xbb, 0xd2, 0xbd, 0xfe, 0xb6, 0x6b,
0x18, 0x5d, 0xb9, 0xd0, 0x3f, 0xe4, 0xf6, 0xc9, 0x77, 0xb0, 0x6d, 0x5f, 0x4e, 0xb2, 0x97, 0x91,
0x4c, 0x9f, 0xd2, 0x07, 0x14, 0xc9, 0xf7, 0x50, 0x4c, 0x5e, 0x9e, 0x95, 0x62, 0xb2, 0x6f, 0x51,
0xf3, 0xf1, 0xc6, 0x23, 0xb1, 0x50, 0xdf, 0xe4, 0xc8, 0xcf, 0x50, 0x49, 0xaa, 0xc6, 0xdc, 0x90,
0xfb, 0x13, 0x56, 0x83, 0xd5, 0xdc, 0x5b, 0x87, 0x93, 0xbb, 0x34, 0xf1, 0x2e, 0x4f, 0x08, 0x59,
0xbd, 0x4b, 0x57, 0xa3, 0x14, 0x4d, 0xa5, 0xd1, 0x3c, 0x2b, 0xd2, 0xab, 0x7e, 0x5c, 0x91, 0xce,
0x78, 0xac, 0xdd, 0x42, 0xe9, 0x26, 0x69, 0x64, 0xa4, 0x3f, 0x18, 0x4e, 0xf7, 0x17, 0x16, 0xea,
0x5f, 0xc9, 0x8f, 0xe0, 0xbe, 0xe5, 0xda, 0x76, 0xe8, 0x63, 0xaa, 0xcf, 0x08, 0x7c, 0x4c, 0x8d,
0xef, 0xb7, 0xf1, 0x9f, 0x8a, 0x57, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x09, 0x80, 0x8f, 0x06,
0x8b, 0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

+ 8
- 0
looprpc/client.pb.gw.go View File

@ -50,6 +50,10 @@ func request_SwapClient_LoopOutTerms_0(ctx context.Context, marshaler runtime.Ma
}
var (
filter_SwapClient_LoopOutQuote_0 = &utilities.DoubleArray{Encoding: map[string]int{"amt": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_SwapClient_LoopOutQuote_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuoteRequest
var metadata runtime.ServerMetadata
@ -72,6 +76,10 @@ func request_SwapClient_LoopOutQuote_0(ctx context.Context, marshaler runtime.Ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "amt", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_SwapClient_LoopOutQuote_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.LoopOutQuote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err

+ 14
- 0
looprpc/client.proto View File

@ -127,6 +127,12 @@ message LoopOutRequest {
lowest routing fee for the swap payment to the server.
*/
uint64 loop_out_channel = 8;
/**
The number of blocks from the on-chain HTLC's confirmation height that it
should be swept within.
*/
int32 sweep_conf_target = 9;
}
message LoopInRequest {
@ -328,6 +334,14 @@ message QuoteRequest {
The amount to swap in satoshis.
*/
int64 amt = 1;
/**
The confirmation target that should be used either for the sweep of the
on-chain HTLC broadcast by the swap server in the case of a Loop Out, or for
the confirmation of the on-chain HTLC broadcast by the swap client in the
case of a Loop In.
*/
int32 conf_target = 2;
}
message QuoteResponse {

+ 13
- 0
looprpc/client.swagger.json View File

@ -61,6 +61,14 @@
"required": true,
"type": "string",
"format": "int64"
},
{
"name": "conf_target",
"description": "*\nThe confirmation target that should be used either for the sweep of the\non-chain HTLC broadcast by the swap server in the case of a Loop Out, or for\nthe confirmation of the on-chain HTLC broadcast by the swap client in the\ncase of a Loop In.",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
}
],
"tags": [
@ -128,6 +136,11 @@
"type": "string",
"format": "uint64",
"description": "*\nThe channel to loop out, the channel to loop out is selected based on the\nlowest routing fee for the swap payment to the server."
},
"sweep_conf_target": {
"type": "integer",
"format": "int32",
"description": "*\nThe number of blocks from the on-chain HTLC's confirmation height that it\nshould be swept within."
}
}
},

Loading…
Cancel
Save