From fc99c8b320721884d53d2408b0200f16c552fec2 Mon Sep 17 00:00:00 2001 From: carla Date: Wed, 15 Apr 2020 09:10:21 +0200 Subject: [PATCH] multi: add confirmation target to loop in --- cmd/loop/loopin.go | 40 ++++++- cmd/loop/quote.go | 11 +- loopd/swapclient_server.go | 37 +++++- loopd/swapclient_server_test.go | 75 ++++++++++++- looprpc/client.pb.go | 193 +++++++++++++++++--------------- looprpc/client.proto | 5 + looprpc/client.swagger.json | 5 + 7 files changed, 258 insertions(+), 108 deletions(-) diff --git a/cmd/loop/loopin.go b/cmd/loop/loopin.go index b8592c3..3037f9b 100644 --- a/cmd/loop/loopin.go +++ b/cmd/loop/loopin.go @@ -18,12 +18,29 @@ var ( Usage: "the pubkey of the last hop to use for this swap", } + confTargetFlag = cli.Uint64Flag{ + Name: "conf_target", + Usage: "the target number of blocks the on-chain " + + "htlc broadcast by the swap client should " + + "confirm within", + } + loopInCommand = cli.Command{ Name: "in", Usage: "perform an on-chain to off-chain swap (loop in)", ArgsUsage: "amt", Description: ` - Send the amount in satoshis specified by the amt argument off-chain.`, + Send the amount in satoshis specified by the amt argument + off-chain. + + By default the swap client will create and broadcast the + on-chain htlc. The fee priority of this transaction can + optionally be set using the conf_target flag. + + The external flag can be set to publish the on chain htlc + independently. Note that this flag cannot be set with the + conf_target flag. + `, Flags: []cli.Flag{ cli.Uint64Flag{ Name: "amt", @@ -33,6 +50,7 @@ var ( Name: "external", Usage: "expect htlc to be published externally", }, + confTargetFlag, lastHopFlag, }, Action: loopIn, @@ -66,10 +84,21 @@ func loopIn(ctx *cli.Context) error { defer cleanup() external := ctx.Bool("external") + htlcConfTarget := int32(ctx.Uint64(confTargetFlag.Name)) + + // External and confirmation target are mutually exclusive; either the + // on chain htlc is being externally broadcast, or we are creating the + // on chain htlc with a desired confirmation target. Fail if both are + // set. + if external && htlcConfTarget != 0 { + return fmt.Errorf("external and conf_target both set") + } + quote, err := client.GetLoopInQuote( context.Background(), &looprpc.QuoteRequest{ Amt: int64(amt), + ConfTarget: htlcConfTarget, ExternalHtlc: external, }, ) @@ -96,10 +125,11 @@ func loopIn(ctx *cli.Context) error { } req := &looprpc.LoopInRequest{ - Amt: int64(amt), - MaxMinerFee: int64(limits.maxMinerFee), - MaxSwapFee: int64(limits.maxSwapFee), - ExternalHtlc: external, + Amt: int64(amt), + MaxMinerFee: int64(limits.maxMinerFee), + MaxSwapFee: int64(limits.maxSwapFee), + ExternalHtlc: external, + HtlcConfTarget: htlcConfTarget, } if ctx.IsSet(lastHopFlag.Name) { diff --git a/cmd/loop/quote.go b/cmd/loop/quote.go index 6396da1..6c917ef 100644 --- a/cmd/loop/quote.go +++ b/cmd/loop/quote.go @@ -22,15 +22,8 @@ var quoteInCommand = cli.Command{ Usage: "get a quote for the cost of a loop in swap", ArgsUsage: "amt", Description: "Allows to determine the cost of a swap up front", - Flags: []cli.Flag{ - cli.Uint64Flag{ - Name: "conf_target", - Usage: "the target number of blocks the on-chain " + - "htlc broadcast by the swap client should " + - "confirm within", - }, - }, - Action: quoteIn, + Flags: []cli.Flag{confTargetFlag}, + Action: quoteIn, } func quoteIn(ctx *cli.Context) error { diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index 377c263..c896d5c 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -361,9 +361,16 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context, log.Infof("Loop in quote request received") + htlcConfTarget, err := validateLoopInRequest( + req.ConfTarget, req.ExternalHtlc, + ) + if err != nil { + return nil, err + } + quote, err := s.impl.LoopInQuote(ctx, &loop.LoopInQuoteRequest{ Amount: btcutil.Amount(req.Amt), - HtlcConfTarget: loop.DefaultHtlcConfTarget, + HtlcConfTarget: htlcConfTarget, ExternalHtlc: req.ExternalHtlc, }) if err != nil { @@ -381,11 +388,18 @@ func (s *swapClientServer) LoopIn(ctx context.Context, log.Infof("Loop in request received") + htlcConfTarget, err := validateLoopInRequest( + in.HtlcConfTarget, in.ExternalHtlc, + ) + if err != nil { + return nil, err + } + req := &loop.LoopInRequest{ Amount: btcutil.Amount(in.Amt), MaxMinerFee: btcutil.Amount(in.MaxMinerFee), MaxSwapFee: btcutil.Amount(in.MaxSwapFee), - HtlcConfTarget: loop.DefaultHtlcConfTarget, + HtlcConfTarget: htlcConfTarget, ExternalHtlc: in.ExternalHtlc, } if in.LastHop != nil { @@ -489,3 +503,22 @@ func validateConfTarget(target, defaultTarget int32) (int32, error) { return target, nil } } + +// validateLoopInRequest fails if the mutually exclusive conf target and +// external parameters are both set. +func validateLoopInRequest(htlcConfTarget int32, external bool) (int32, error) { + // If the htlc is going to be externally set, the htlcConfTarget should + // not be set, because it has no relevance when the htlc is external. + if external && htlcConfTarget != 0 { + return 0, errors.New("external and htlc conf target cannot " + + "both be set") + } + + // If the htlc is being externally published, we do not need to set a + // confirmation target. + if external { + return 0, nil + } + + return validateConfTarget(htlcConfTarget, loop.DefaultHtlcConfTarget) +} diff --git a/loopd/swapclient_server_test.go b/loopd/swapclient_server_test.go index 0494de4..5ad3718 100644 --- a/loopd/swapclient_server_test.go +++ b/loopd/swapclient_server_test.go @@ -1,6 +1,10 @@ package loopd -import "testing" +import ( + "testing" + + "github.com/lightninglabs/loop" +) // TestValidateConfTarget tests all failure and success cases for our conf // target validation function, including the case where we replace a zero @@ -70,3 +74,72 @@ func TestValidateConfTarget(t *testing.T) { }) } } + +// TestValidateLoopInRequest tests validation of loop in requests. +func TestValidateLoopInRequest(t *testing.T) { + tests := []struct { + name string + external bool + confTarget int32 + expectErr bool + expectedTarget int32 + }{ + { + name: "external and htlc conf set", + external: true, + confTarget: 1, + expectErr: true, + expectedTarget: 0, + }, + { + name: "external and no conf", + external: true, + confTarget: 0, + expectErr: false, + expectedTarget: 0, + }, + { + name: "not external, zero conf", + external: false, + confTarget: 0, + expectErr: false, + expectedTarget: loop.DefaultHtlcConfTarget, + }, + { + name: "not external, bad conf", + external: false, + confTarget: 1, + expectErr: true, + expectedTarget: 0, + }, + { + name: "not external, ok conf", + external: false, + confTarget: 5, + expectErr: false, + expectedTarget: 5, + }, + } + + for _, test := range tests { + test := test + + t.Run(test.name, func(t *testing.T) { + external := test.external + conf, err := validateLoopInRequest( + test.confTarget, external, + ) + + haveErr := err != nil + if haveErr != test.expectErr { + t.Fatalf("expected err: %v, got: %v", + test.expectErr, err) + } + + if conf != test.expectedTarget { + t.Fatalf("expected: %v, got: %v", + test.expectedTarget, conf) + } + }) + } +} diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 496f9fa..51bd965 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -291,7 +291,10 @@ type LoopInRequest struct { //* //If external_htlc is true, we expect the htlc to be published by an external //actor. - ExternalHtlc bool `protobuf:"varint,5,opt,name=external_htlc,json=externalHtlc,proto3" json:"external_htlc,omitempty"` + ExternalHtlc bool `protobuf:"varint,5,opt,name=external_htlc,json=externalHtlc,proto3" json:"external_htlc,omitempty"` + //* + //The number of blocks that the on chain htlc should confirm within. + HtlcConfTarget int32 `protobuf:"varint,6,opt,name=htlc_conf_target,json=htlcConfTarget,proto3" json:"htlc_conf_target,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -357,6 +360,13 @@ func (m *LoopInRequest) GetExternalHtlc() bool { return false } +func (m *LoopInRequest) GetHtlcConfTarget() int32 { + if m != nil { + return m.HtlcConfTarget + } + return 0 +} + type SwapResponse struct { //* //Swap identifier to track status in the update stream that is returned from @@ -1170,97 +1180,98 @@ func init() { func init() { proto.RegisterFile("client.proto", fileDescriptor_014de31d7ac8c57c) } var fileDescriptor_014de31d7ac8c57c = []byte{ - // 1435 bytes of a gzipped FileDescriptorProto + // 1448 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcb, 0x6e, 0xdb, 0x46, - 0x14, 0x0d, 0x25, 0xd9, 0x92, 0xae, 0x28, 0x8a, 0x1e, 0x27, 0xb6, 0xac, 0x36, 0x88, 0xc3, 0x36, - 0xad, 0xe3, 0x45, 0xd4, 0x38, 0xab, 0x06, 0x45, 0x01, 0x47, 0x56, 0x62, 0x19, 0x7e, 0x95, 0x92, - 0x03, 0x24, 0x1b, 0x66, 0x2c, 0x8e, 0x2d, 0xa2, 0x22, 0x87, 0xe1, 0x8c, 0x12, 0x1b, 0x41, 0x36, - 0xfd, 0x85, 0xee, 0xba, 0xec, 0xa6, 0xeb, 0xae, 0xfb, 0x19, 0xfd, 0x85, 0x7e, 0x42, 0xb7, 0x05, - 0x8a, 0x79, 0x88, 0x22, 0x2d, 0x3b, 0x8b, 0xec, 0xc4, 0x33, 0x67, 0xce, 0x5c, 0xde, 0xc7, 0x19, - 0x0a, 0xcc, 0xe1, 0x38, 0x20, 0x11, 0x7f, 0x14, 0x27, 0x94, 0x53, 0x54, 0x1e, 0x53, 0x1a, 0x27, - 0xf1, 0xb0, 0xf5, 0xe5, 0x39, 0xa5, 0xe7, 0x63, 0xd2, 0xc6, 0x71, 0xd0, 0xc6, 0x51, 0x44, 0x39, - 0xe6, 0x01, 0x8d, 0x98, 0xa2, 0x39, 0xbf, 0x15, 0xc1, 0xda, 0xa7, 0x34, 0x3e, 0x9a, 0x70, 0x97, - 0xbc, 0x9d, 0x10, 0xc6, 0x91, 0x0d, 0x45, 0x1c, 0xf2, 0xa6, 0xb1, 0x6e, 0x6c, 0x14, 0x5d, 0xf1, - 0x13, 0x21, 0x28, 0xf9, 0x84, 0xf1, 0x66, 0x61, 0xdd, 0xd8, 0xa8, 0xba, 0xf2, 0x37, 0x6a, 0xc3, - 0xed, 0x10, 0x5f, 0x78, 0xec, 0x3d, 0x8e, 0xbd, 0x84, 0x4e, 0x78, 0x10, 0x9d, 0x7b, 0x67, 0x84, - 0x34, 0x8b, 0x72, 0xdb, 0x52, 0x88, 0x2f, 0xfa, 0xef, 0x71, 0xec, 0xaa, 0x95, 0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, 0x1a, 0xcb, 0x72, 0x98, 0x6e, 0x59, 0x3c, 0xef, 0xd2, 0x18, 0x7d, 0x05, - 0x75, 0x72, 0xc1, 0x49, 0x12, 0xe1, 0xb1, 0x37, 0xe2, 0xe3, 0xa1, 0xac, 0x41, 0xc5, 0x35, 0xa7, - 0xe0, 0x2e, 0x1f, 0x0f, 0x9d, 0x37, 0x60, 0xca, 0x72, 0x13, 0x16, 0xd3, 0x88, 0x11, 0x84, 0xa0, - 0x10, 0xf8, 0x32, 0xcc, 0xea, 0xb3, 0x42, 0xd3, 0x70, 0x0b, 0x81, 0x2f, 0xce, 0x08, 0x7c, 0xef, - 0xf4, 0x92, 0x13, 0x26, 0x43, 0x30, 0xdd, 0x72, 0xe0, 0x3f, 0x13, 0x8f, 0xe8, 0x3e, 0x98, 0x42, - 0xda, 0xc3, 0xbe, 0x9f, 0x10, 0xc6, 0x74, 0xa3, 0xd5, 0x04, 0xb6, 0xad, 0x20, 0xc7, 0x06, 0xeb, - 0x80, 0x46, 0x01, 0xa7, 0x89, 0xce, 0x85, 0xf3, 0x5f, 0x01, 0x40, 0x1c, 0xda, 0xe7, 0x98, 0x4f, - 0xd8, 0xb5, 0x6d, 0x2b, 0x82, 0x28, 0xdc, 0x18, 0x44, 0x2d, 0x1f, 0xc4, 0x03, 0x28, 0xf1, 0xcb, - 0x58, 0xa5, 0xc7, 0xda, 0x5a, 0x7a, 0xa4, 0x07, 0xe8, 0x91, 0x38, 0x63, 0x70, 0x19, 0x13, 0x57, - 0x2e, 0xa3, 0x0d, 0x58, 0x60, 0x1c, 0x73, 0xd5, 0xb6, 0xd6, 0x16, 0xca, 0xf1, 0x44, 0x2c, 0xc4, - 0x55, 0x04, 0xf4, 0x2d, 0x34, 0x82, 0x28, 0xe0, 0x81, 0x2a, 0x3a, 0x0f, 0xc2, 0x69, 0xff, 0x5a, - 0x33, 0x78, 0x10, 0x84, 0xaa, 0xf3, 0x44, 0xf6, 0x27, 0xb1, 0x8f, 0x39, 0x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0x4a, 0x95, 0xb2, 0x5d, 0x71, 0x7e, 0x37, 0xc0, 0xfc, 0x69, 0x42, 0x39, 0xb9, - 0x79, 0x44, 0x65, 0x45, 0x66, 0x46, 0x51, 0x90, 0x46, 0x01, 0xc3, 0x99, 0x47, 0xcc, 0x8d, 0x58, - 0x71, 0x7e, 0xc4, 0x3e, 0x6d, 0x24, 0xa5, 0x4f, 0x1b, 0xc9, 0x9f, 0x06, 0xd4, 0x75, 0x90, 0x3a, - 0x49, 0x6b, 0x50, 0x49, 0x2d, 0x43, 0x85, 0x5a, 0x66, 0xda, 0x2f, 0xee, 0x02, 0x64, 0xdc, 0x54, - 0xf9, 0x49, 0x35, 0x4e, 0xad, 0xf4, 0x0b, 0xa8, 0x5e, 0xb5, 0x92, 0x4a, 0x38, 0xf5, 0x11, 0xe9, - 0x8c, 0x22, 0x48, 0x7c, 0x19, 0x92, 0x88, 0x7b, 0xf2, 0xda, 0x50, 0x86, 0xd2, 0x90, 0xc1, 0x29, - 0x7c, 0x47, 0x24, 0xea, 0x2e, 0xc0, 0x70, 0xcc, 0xdf, 0x79, 0x3e, 0x19, 0x73, 0x2c, 0x4b, 0xb4, - 0xe0, 0x56, 0x05, 0xb2, 0x23, 0x00, 0xa7, 0x01, 0xf5, 0x01, 0xfd, 0x99, 0x44, 0x69, 0xa1, 0x7f, - 0x00, 0x6b, 0x0a, 0xe8, 0x97, 0xd8, 0x84, 0x45, 0x2e, 0x11, 0xdd, 0x59, 0xb3, 0x59, 0xdc, 0x67, - 0x98, 0x4b, 0xb2, 0xab, 0x19, 0xce, 0x5f, 0x05, 0xa8, 0xa6, 0xa8, 0xc8, 0xf8, 0x29, 0x66, 0xc4, - 0x0b, 0xf1, 0x10, 0x27, 0x94, 0x46, 0xba, 0xbf, 0x4c, 0x01, 0x1e, 0x68, 0x4c, 0x0c, 0xca, 0xf4, - 0x3d, 0x46, 0x98, 0x8d, 0x64, 0x2a, 0x4c, 0xb7, 0xa6, 0xb1, 0x5d, 0x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1, 0xbb, 0x2e, 0xfb, 0x07, 0x5d, 0xf7, 0x2b, 0x8a, 0xfe, 0x42, 0x3f, 0xa1, 0xdb, 0x02, + 0xc5, 0x3c, 0x44, 0x91, 0x96, 0x9d, 0x45, 0x76, 0xe6, 0x99, 0x33, 0x67, 0xee, 0xdc, 0xc7, 0x19, + 0x19, 0xcc, 0xd1, 0x38, 0x20, 0x11, 0x7f, 0x14, 0x27, 0x94, 0x53, 0x54, 0x19, 0x53, 0x1a, 0x27, + 0xf1, 0xa8, 0xfd, 0xe5, 0x19, 0xa5, 0x67, 0x63, 0xd2, 0xc1, 0x71, 0xd0, 0xc1, 0x51, 0x44, 0x39, + 0xe6, 0x01, 0x8d, 0x98, 0xa2, 0x39, 0xbf, 0x15, 0xc1, 0xda, 0xa3, 0x34, 0x3e, 0x9c, 0x70, 0x97, + 0xbc, 0x9d, 0x10, 0xc6, 0x91, 0x0d, 0x45, 0x1c, 0xf2, 0x96, 0xb1, 0x66, 0xac, 0x17, 0x5d, 0xf1, + 0x27, 0x42, 0x50, 0xf2, 0x09, 0xe3, 0xad, 0xc2, 0x9a, 0xb1, 0x5e, 0x73, 0xe5, 0xdf, 0xa8, 0x03, + 0xb7, 0x43, 0x7c, 0xe1, 0xb1, 0xf7, 0x38, 0xf6, 0x12, 0x3a, 0xe1, 0x41, 0x74, 0xe6, 0x9d, 0x12, + 0xd2, 0x2a, 0xca, 0x6d, 0x8b, 0x21, 0xbe, 0x18, 0xbc, 0xc7, 0xb1, 0xab, 0x56, 0x9e, 0x13, 0x82, + 0x9e, 0xc0, 0xb2, 0xd8, 0x10, 0x27, 0x24, 0xc6, 0x97, 0xb9, 0x2d, 0x25, 0xb9, 0x65, 0x29, 0xc4, + 0x17, 0x47, 0x72, 0x31, 0xb3, 0x69, 0x0d, 0xcc, 0xf4, 0x14, 0x41, 0x5d, 0x90, 0x54, 0xd0, 0xea, + 0x82, 0xf1, 0x35, 0x58, 0x19, 0x59, 0x11, 0x78, 0x59, 0x72,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29, 0x67, 0xa4, 0x73, 0x36, 0xe8, 0xac, 0x49, 0xe9, 0x36, 0x6a, 0xe5, 0xa4, 0xdf, + 0x0a, 0x4e, 0xe7, 0x03, 0x0e, 0xf9, 0x47, 0xf4, 0x1a, 0xac, 0x17, 0x84, 0xab, 0x62, 0x7f, 0x56, + 0xf4, 0xab, 0xf2, 0x88, 0x25, 0xb4, 0x98, 0x69, 0x01, 0x1d, 0xfc, 0x9b, 0x8c, 0xf6, 0x67, 0x85, + 0x7f, 0x4f, 0x6a, 0xaf, 0xa2, 0x95, 0xac, 0x76, 0x36, 0xfa, 0x57, 0xd0, 0x10, 0x27, 0x4c, 0x7d, + 0x8f, 0x65, 0xfa, 0x37, 0x67, 0xae, 0xed, 0x95, 0x39, 0x3c, 0x3f, 0x13, 0xa8, 0x29, 0x8f, 0x60, + 0x98, 0x77, 0x94, 0xa1, 0x9e, 0x94, 0xe5, 0xbf, 0x1a, 0x4f, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0xc7, 0x1e, 0x66, 0x37, 0xa1, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/looprpc/client.proto b/looprpc/client.proto index f7e53e8..0e58de7 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -219,6 +219,11 @@ message LoopInRequest { actor. */ bool external_htlc = 5; + + /** + The number of blocks that the on chain htlc should confirm within. + */ + int32 htlc_conf_target = 6; } message SwapResponse { diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index b711ae1..388cda6 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -307,6 +307,11 @@ "type": "boolean", "format": "boolean", "description": "*\nIf external_htlc is true, we expect the htlc to be published by an external\nactor." + }, + "htlc_conf_target": { + "type": "integer", + "format": "int32", + "description": "*\nThe number of blocks that the on chain htlc should confirm within." } } },