From 535e964ec938ebde6ef1227748953dea1d70e11f Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 11 Feb 2020 13:25:03 +0100 Subject: [PATCH 1/2] loopdb: migrate loop in channel to last hop A database field was already in place to allow channel selection for loop in. Unfortunately this field, which contains a short channel id, isn't easily usable for controlling the loop server payment. Because of non-strict forwarding, it is only possible to constrain a route to a specific last hop pubkey. This commit converts the existing field into a pubkey field. --- client.go | 4 +- interface.go | 7 +- loopd/swapclient_server.go | 9 +- loopdb/loopin.go | 24 +- loopdb/meta.go | 1 + loopdb/migration_03_last_hop.go | 86 +++++++ loopdb/store_test.go | 5 +- loopin.go | 2 +- looprpc/client.pb.go | 198 ++++++++-------- looprpc/client.pb.gw.go | 387 +------------------------------- looprpc/client.proto | 8 +- looprpc/client.swagger.json | 35 +-- 12 files changed, 252 insertions(+), 514 deletions(-) create mode 100644 loopdb/migration_03_last_hop.go diff --git a/client.go b/client.go index 27f7e6a..bf95ba2 100644 --- a/client.go +++ b/client.go @@ -437,9 +437,9 @@ func (s *Client) waitForInitialized(ctx context.Context) error { func (s *Client) LoopIn(globalCtx context.Context, request *LoopInRequest) (*lntypes.Hash, btcutil.Address, error) { - log.Infof("Loop in %v (channel: %v)", + log.Infof("Loop in %v (last hop: %v)", request.Amount, - request.LoopInChannel, + request.LastHop, ) if err := s.waitForInitialized(globalCtx); err != nil { diff --git a/interface.go b/interface.go index e445b66..98850b8 100644 --- a/interface.go +++ b/interface.go @@ -7,6 +7,7 @@ import ( "github.com/lightninglabs/loop/loopdb" "github.com/lightninglabs/loop/swap" "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/routing/route" ) // OutRequest contains the required parameters for a loop out swap. @@ -173,9 +174,9 @@ type LoopInRequest struct { // client htlc tx. HtlcConfTarget int32 - // LoopInChannel optionally specifies the short channel id of the - // channel to loop in. - LoopInChannel *uint64 + // LastHop optionally specifies the last hop to use for the loop in + // payment. + LastHop *route.Vertex // ExternalHtlc specifies whether the htlc is published by an external // source. diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index cd19b05..3b7cbc0 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -10,6 +10,7 @@ import ( "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/queue" + "github.com/lightningnetwork/lnd/routing/route" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/lndclient" @@ -387,8 +388,12 @@ func (s *swapClientServer) LoopIn(ctx context.Context, HtlcConfTarget: defaultConfTarget, ExternalHtlc: in.ExternalHtlc, } - if in.LoopInChannel != 0 { - req.LoopInChannel = &in.LoopInChannel + if in.LastHop != nil { + lastHop, err := route.NewVertexFromBytes(in.LastHop) + if err != nil { + return nil, err + } + req.LastHop = &lastHop } hash, htlc, err := s.impl.LoopIn(ctx, req) if err != nil { diff --git a/loopdb/loopin.go b/loopdb/loopin.go index d971afe..409d679 100644 --- a/loopdb/loopin.go +++ b/loopdb/loopin.go @@ -5,6 +5,8 @@ import ( "encoding/binary" "fmt" "time" + + "github.com/lightningnetwork/lnd/routing/route" ) // LoopInContract contains the data that is serialized to persistent storage for @@ -16,9 +18,8 @@ type LoopInContract struct { // client sweep tx. HtlcConfTarget int32 - // LoopInChannel is the channel to charge. If zero, any channel may - // be used. - LoopInChannel *uint64 + // LastHop is the last hop to use for the loop in swap (optional). + LastHop *route.Vertex // ExternalHtlc specifies whether the htlc is published by an external // source. @@ -96,11 +97,11 @@ func serializeLoopInContract(swap *LoopInContract) ( return nil, err } - var chargeChannel uint64 - if swap.LoopInChannel != nil { - chargeChannel = *swap.LoopInChannel + var lastHop route.Vertex + if swap.LastHop != nil { + lastHop = *swap.LastHop } - if err := binary.Write(&b, byteOrder, chargeChannel); err != nil { + if err := binary.Write(&b, byteOrder, lastHop[:]); err != nil { return nil, err } @@ -167,12 +168,13 @@ func deserializeLoopInContract(value []byte) (*LoopInContract, error) { return nil, err } - var loopInChannel uint64 - if err := binary.Read(r, byteOrder, &loopInChannel); err != nil { + var lastHop route.Vertex + if err := binary.Read(r, byteOrder, lastHop[:]); err != nil { return nil, err } - if loopInChannel != 0 { - contract.LoopInChannel = &loopInChannel + var noLastHop route.Vertex + if lastHop != noLastHop { + contract.LastHop = &lastHop } if err := binary.Read(r, byteOrder, &contract.ExternalHtlc); err != nil { diff --git a/loopdb/meta.go b/loopdb/meta.go index 0d21f47..1d81a06 100644 --- a/loopdb/meta.go +++ b/loopdb/meta.go @@ -35,6 +35,7 @@ var ( migrations = []migration{ migrateCosts, migrateSwapPublicationDeadline, + migrateLastHop, } latestDBVersion = uint32(len(migrations)) diff --git a/loopdb/migration_03_last_hop.go b/loopdb/migration_03_last_hop.go new file mode 100644 index 0000000..f297e66 --- /dev/null +++ b/loopdb/migration_03_last_hop.go @@ -0,0 +1,86 @@ +package loopdb + +import ( + "bytes" + "errors" + "fmt" + + "github.com/btcsuite/btcd/chaincfg" + "github.com/coreos/bbolt" +) + +// migrateLastHop migrates the database to v03, replacing the never used loop in +// channel by a last hop pubkey. +func migrateLastHop(tx *bbolt.Tx, chainParams *chaincfg.Params) error { + rootBucket := tx.Bucket(loopInBucketKey) + if rootBucket == nil { + return errors.New("bucket does not exist") + } + + return rootBucket.ForEach(func(swapHash, v []byte) error { + // Only go into things that we know are sub-bucket + // keys. + if v != nil { + return nil + } + + // From the root bucket, we'll grab the next swap + // bucket for this swap from its swaphash. + swapBucket := rootBucket.Bucket(swapHash) + if swapBucket == nil { + return fmt.Errorf("swap bucket %x not found", + swapHash) + } + + // With the main swap bucket obtained, we'll grab the + // raw swap contract bytes. + contractBytes := swapBucket.Get(contractKey) + if contractBytes == nil { + return errors.New("contract not found") + } + + const ( + // deprecatedLoopInChannelStart is the starting offset + // of the old loop in channel field: 8 (initiation time) + // + 32 (preimage) + 8 (amount requested) + 33 + 33 + // (sender and receiver keys) + 4 (cltv expiry) + 8 + 8 + // (max miner and swap fee) + 4 (initiation height) + 4 + // (conf target) = 142. + deprecatedLoopInChannelStart = 142 + + // expectedTotalLength is the expect total length of the + // serialized contract. It adds 8 (old loop in channel) + // + 1 (external htlc) = 9 bytes to + // deprecatedLoopInChannelStart. + expectedTotalLength = deprecatedLoopInChannelStart + 9 + ) + + // Sanity check to see if the constants above match the contract + // bytes. + if len(contractBytes) != expectedTotalLength { + return errors.New("invalid serialized contract length") + } + + // Copy the unchanged fields into the buffer. + b := &bytes.Buffer{} + _, err := b.Write(contractBytes[:deprecatedLoopInChannelStart]) + if err != nil { + return err + } + + // We now set the new last hop field to all zeroes to indicate + // that there is no restriction. + var noLastHop [33]byte + if _, err := b.Write(noLastHop[:]); err != nil { + return err + } + + // Append the remaining field ExternalHtlc. + _, err = b.Write(contractBytes[deprecatedLoopInChannelStart+8:]) + if err != nil { + return err + } + + return swapBucket.Put(contractKey, b.Bytes()) + }) +} diff --git a/loopdb/store_test.go b/loopdb/store_test.go index 1d9ceaa..26da3a8 100644 --- a/loopdb/store_test.go +++ b/loopdb/store_test.go @@ -13,6 +13,7 @@ import ( "github.com/coreos/bbolt" "github.com/lightninglabs/loop/test" "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/routing/route" ) var ( @@ -197,7 +198,7 @@ func TestLoopInStore(t *testing.T) { // Next, we'll make a new pending swap that we'll insert into the // database shortly. - loopInChannel := uint64(123) + lastHop := route.Vertex{1, 2, 3} pendingSwap := LoopInContract{ SwapContract: SwapContract{ @@ -215,7 +216,7 @@ func TestLoopInStore(t *testing.T) { InitiationTime: time.Unix(0, initiationTime.UnixNano()), }, HtlcConfTarget: 2, - LoopInChannel: &loopInChannel, + LastHop: &lastHop, ExternalHtlc: true, } diff --git a/loopin.go b/loopin.go index f2f9846..aceda47 100644 --- a/loopin.go +++ b/loopin.go @@ -133,7 +133,7 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig, contract := loopdb.LoopInContract{ HtlcConfTarget: request.HtlcConfTarget, - LoopInChannel: request.LoopInChannel, + LastHop: request.LastHop, ExternalHtlc: request.ExternalHtlc, SwapContract: loopdb.SwapContract{ InitiationHeight: currentHeight, diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 4fae095..5574df0 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -285,11 +285,9 @@ type LoopInRequest struct { //max_miner_fee is typically taken from the response of the GetQuote call. MaxMinerFee int64 `protobuf:"varint,3,opt,name=max_miner_fee,json=maxMinerFee,proto3" json:"max_miner_fee,omitempty"` //* - //The channel to loop in. If zero, the channel to loop in is selected based - //on the lowest routing fee for the swap payment from the server. - // - //Note: NOT YET IMPLEMENTED - LoopInChannel uint64 `protobuf:"varint,4,opt,name=loop_in_channel,json=loopInChannel,proto3" json:"loop_in_channel,omitempty"` + //The last hop to use for the loop in swap. If empty, the last hop is selected + //based on the lowest routing fee for the swap payment from the server. + LastHop []byte `protobuf:"bytes,4,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"` //* //If external_htlc is true, we expect the htlc to be published by an external //actor. @@ -345,11 +343,11 @@ func (m *LoopInRequest) GetMaxMinerFee() int64 { return 0 } -func (m *LoopInRequest) GetLoopInChannel() uint64 { +func (m *LoopInRequest) GetLastHop() []byte { if m != nil { - return m.LoopInChannel + return m.LastHop } - return 0 + return nil } func (m *LoopInRequest) GetExternalHtlc() bool { @@ -1166,98 +1164,98 @@ func init() { func init() { proto.RegisterFile("client.proto", fileDescriptor_014de31d7ac8c57c) } var fileDescriptor_014de31d7ac8c57c = []byte{ - // 1446 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4d, 0x6e, 0xdb, 0x46, - 0x18, 0x0d, 0x25, 0xda, 0x92, 0x3e, 0x51, 0x14, 0x3d, 0x4e, 0x6c, 0x59, 0x6d, 0x10, 0x87, 0x6d, - 0x52, 0xc7, 0x8b, 0xa8, 0x71, 0x76, 0x41, 0x51, 0xc0, 0x91, 0x95, 0x58, 0x86, 0x7f, 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0x64, 0x6a, 0xc0, 0x70, 0x1a, 0x18, 0x73, - 0x57, 0xac, 0x38, 0x7f, 0xc5, 0x3e, 0x9f, 0x2a, 0xe6, 0xe7, 0x53, 0xe5, 0x4f, 0x03, 0x6a, 0xba, - 0x48, 0xdd, 0xa4, 0x35, 0x28, 0x67, 0xf9, 0xa1, 0x4a, 0x2d, 0x31, 0x1d, 0x1e, 0x77, 0x01, 0x72, - 0xd1, 0xaa, 0xc2, 0xa5, 0x92, 0x64, 0xb9, 0xfa, 0x15, 0x54, 0xae, 0xe6, 0x4a, 0x39, 0x9a, 0x84, - 0x8a, 0x8c, 0x49, 0x51, 0x24, 0xbe, 0x8c, 0x48, 0xcc, 0x7d, 0xf9, 0x86, 0x98, 0xf2, 0xec, 0xea, - 0xb2, 0x38, 0x85, 0xef, 0x88, 0x46, 0xdd, 0x05, 0x18, 0x8e, 0xf8, 0x7b, 0x3f, 0x20, 0x23, 0x8e, - 0xe5, 0x11, 0x2d, 0x78, 0x15, 0x81, 0xec, 0x08, 0xc0, 0xad, 0x43, 0x6d, 0x40, 0x7f, 0x26, 0x71, - 0x76, 0xd0, 0x3f, 0x80, 0x3d, 0x01, 0xf4, 0x26, 0x36, 0x61, 0x91, 0x4b, 0x44, 0x3b, 0x6b, 0x7a, - 0x17, 0xf7, 0x19, 0xe6, 0x92, 0xec, 0x69, 0x86, 0xfb, 0x77, 0x01, 0x2a, 0x19, 0x2a, 0x3a, 0x7e, - 0x82, 0x19, 0xf1, 0x23, 0x3c, 0xc4, 0x29, 0xa5, 0xb1, 0xf6, 0x97, 0x25, 0xc0, 0x03, 0x8d, 0x89, - 0x8b, 0x32, 0xd9, 0xc7, 0x39, 0x66, 0xe7, 0xb2, 0x15, 0x96, 0x57, 0xd5, 0xd8, 0x2e, 0x66, 0xe7, - 0xe8, 0x11, 0x38, 0x13, 0x4a, 0x92, 0x92, 0x30, 0xc2, 0x67, 0x44, 0x67, 0x5b, 0x5d, 0xe3, 0x3d, - 0x0d, 0x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 0x61, 0x5d, - 0xed, 0xbc, 0x34, 0x1d, 0xf3, 0x16, 0x97, 0x52, 0x7e, 0x26, 0x2d, 0x93, 0x2f, 0x27, 0x9d, 0x8f, - 0xeb, 0x9c, 0xf4, 0x4c, 0x40, 0xba, 0xeb, 0x52, 0xba, 0x89, 0x1a, 0x33, 0xd2, 0xef, 0x04, 0xa7, - 0xf5, 0x11, 0x47, 0xfc, 0x13, 0x7a, 0x03, 0xf6, 0x4b, 0xc2, 0x95, 0x0d, 0xbe, 0xa8, 0xfa, 0x35, - 0xb9, 0xc4, 0x32, 0x5a, 0xca, 0x99, 0x43, 0x17, 0xff, 0x36, 0xa7, 0xfd, 0x45, 0xe5, 0xdf, 0x93, - 0xda, 0x6b, 0x68, 0x35, 0xaf, 0x9d, 0xaf, 0xfe, 0x35, 0xd4, 0xc4, 0x0a, 0x93, 0x44, 0x64, 0x39, - 0x67, 0xcf, 0xc4, 0x6e, 0x73, 0x75, 0x0e, 0x9f, 0xbd, 0x2d, 0xa8, 0x2e, 0x97, 0x60, 0x98, 0xb7, - 0x54, 0xd4, 0x9e, 0x2c, 0xca, 0xff, 0x33, 0x9e, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x04, 0xc2, - 0xbc, 0x71, 0x9e, 0x0c, 0x00, 0x00, + // 1445 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcd, 0x6e, 0xdb, 0xc6, + 0x1a, 0x0d, 0x25, 0xd9, 0xa2, 0x3e, 0x51, 0x14, 0x3d, 0x4e, 0x6c, 0x59, 0xf7, 0x06, 0x71, 0x78, + 0x6f, 0xee, 0x75, 0xbc, 0x88, 0x1a, 0x67, 0x17, 0x14, 0x05, 0x1c, 0x59, 0x89, 0x65, 0xf8, 0xaf, + 0x94, 0x1c, 0x20, 0xd9, 0x30, 0x63, 0x71, 0x6c, 0x13, 0x15, 0x39, 0x0c,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, 0x5f, 0x36, 0x92, 0xca, 0x97, 0x8d, 0xe4, 0x77, 0x03, 0x1a, 0x3a, + 0x48, 0x9d, 0xa4, 0x35, 0x30, 0x33, 0xcb, 0x50, 0xa1, 0x56, 0x99, 0xf6, 0x8b, 0xfb, 0x00, 0x39, + 0x37, 0x55, 0x7e, 0x52, 0x4b, 0x32, 0x2b, 0xfd, 0x17, 0xd4, 0xae, 0x5b, 0x89, 0x19, 0x4d, 0x7d, + 0x44, 0x3a, 0xa3, 0x08, 0x12, 0x5f, 0x45, 0x24, 0xe6, 0xbe, 0xbc, 0x36, 0x94, 0xa1, 0x34, 0x65, + 0x70, 0x0a, 0xdf, 0x11, 0x89, 0xba, 0x0f, 0x30, 0x1a, 0xf3, 0x0f, 0x7e, 0x40, 0xc6, 0x1c, 0xcb, + 0x12, 0x2d, 0x78, 0x35, 0x81, 0xec, 0x08, 0xc0, 0x6d, 0x42, 0x63, 0x48, 0x7f, 0x20, 0x71, 0x56, + 0xe8, 0x6f, 0xc1, 0x9e, 0x02, 0xfa, 0x25, 0x36, 0x61, 0x91, 0x4b, 0x44, 0x77, 0xd6, 0x6c, 0x16, + 0xf7, 0x19, 0xe6, 0x92, 0xec, 0x69, 0x86, 0xfb, 0x47, 0x09, 0x6a, 0x19, 0x2a, 0x32, 0x7e, 0x8a, + 0x19, 0xf1, 0x23, 0x3c, 0xc2, 0x29, 0xa5, 0xb1, 0xee, 0x2f, 0x4b, 0x80, 0x07, 0x1a, 0x13, 0x83, + 0x32, 0x7d, 0x8f, 0x0b, 0xcc, 0x2e, 0x64, 0x2a, 0x2c, 0xaf, 0xae, 0xb1, 0x5d, 0xcc, 0x2e, 0xd0, + 0x63, 0x70, 0xa6, 0x94, 0x24, 0x25, 0x61, 0x84, 0xcf, 0x89, 0xf6, 0xb6, 0xa6, 0xc6, 0x8f, 0x35, + 0x2c, 0x86, 0x5c, 0x75, 0x99, 0x9f, 0xe0, 0x30, 0xf0, 0x23, 0x86, 0xb9, 0xbe, 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94, 0x9f, 0x49, 0x4b, 0xe7, 0xcb, 0x49, 0xe7, 0xed, 0x3a, + 0x27, 0x5d, 0x30, 0x48, 0x77, 0x5d, 0x4a, 0xb7, 0x51, 0xab, 0x20, 0xfd, 0x5e, 0x70, 0x3a, 0x9f, + 0x70, 0xc4, 0x3f, 0xa3, 0xb7, 0x60, 0xbf, 0x22, 0x5c, 0xb5, 0xc1, 0x57, 0x45, 0xbf, 0x26, 0x8f, + 0x58, 0x46, 0x4b, 0xb9, 0xe6, 0xd0, 0xc1, 0xbf, 0xcb, 0x69, 0x7f, 0x55, 0xf8, 0x0f, 0xa4, 0xf6, + 0x1a, 0x5a, 0xcd, 0x6b, 0xe7, 0xa3, 0x7f, 0x03, 0x0d, 0x71, 0xc2, 0xd4, 0x11, 0x59, 0xae, 0xb3, + 0x0b, 0xb6, 0xdb, 0x5e, 0x9d, 0xc3, 0x8b, 0xd3, 0x82, 0x9a, 0xf2, 0x08, 0x86, 0x79, 0x47, 0x59, + 0xed, 0xe9, 0xa2, 0xfc, 0x6b, 0xf1, 0xec, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0x22, 0xfe, + 0xe9, 0x91, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/looprpc/client.pb.gw.go b/looprpc/client.pb.gw.go index a146bda..05bd907 100644 --- a/looprpc/client.pb.gw.go +++ b/looprpc/client.pb.gw.go @@ -13,7 +13,6 @@ import ( "io" "net/http" - "github.com/golang/protobuf/descriptor" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" @@ -23,13 +22,11 @@ import ( "google.golang.org/grpc/status" ) -// Suppress "imported and not used" errors var _ codes.Code var _ io.Reader var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage func request_SwapClient_LoopOut_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq LoopOutRequest @@ -48,23 +45,6 @@ func request_SwapClient_LoopOut_0(ctx context.Context, marshaler runtime.Marshal } -func local_request_SwapClient_LoopOut_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LoopOutRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.LoopOut(ctx, &protoReq) - return msg, metadata, err - -} - func request_SwapClient_LoopIn_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq LoopInRequest var metadata runtime.ServerMetadata @@ -82,23 +62,6 @@ func request_SwapClient_LoopIn_0(ctx context.Context, marshaler runtime.Marshale } -func local_request_SwapClient_LoopIn_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LoopInRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.LoopIn(ctx, &protoReq) - return msg, metadata, err - -} - func request_SwapClient_Monitor_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (SwapClient_MonitorClient, runtime.ServerMetadata, error) { var protoReq MonitorRequest var metadata runtime.ServerMetadata @@ -125,15 +88,6 @@ func request_SwapClient_ListSwaps_0(ctx context.Context, marshaler runtime.Marsh } -func local_request_SwapClient_ListSwaps_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListSwapsRequest - var metadata runtime.ServerMetadata - - msg, err := server.ListSwaps(ctx, &protoReq) - return msg, metadata, err - -} - func request_SwapClient_SwapInfo_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SwapInfoRequest var metadata runtime.ServerMetadata @@ -161,33 +115,6 @@ func request_SwapClient_SwapInfo_0(ctx context.Context, marshaler runtime.Marsha } -func local_request_SwapClient_SwapInfo_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq SwapInfoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Bytes(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := server.SwapInfo(ctx, &protoReq) - return msg, metadata, err - -} - func request_SwapClient_LoopOutTerms_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq TermsRequest var metadata runtime.ServerMetadata @@ -197,15 +124,6 @@ func request_SwapClient_LoopOutTerms_0(ctx context.Context, marshaler runtime.Ma } -func local_request_SwapClient_LoopOutTerms_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TermsRequest - var metadata runtime.ServerMetadata - - msg, err := server.LoopOutTerms(ctx, &protoReq) - return msg, metadata, err - -} - var ( filter_SwapClient_LoopOutQuote_0 = &utilities.DoubleArray{Encoding: map[string]int{"amt": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -232,45 +150,11 @@ 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 := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, 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 - -} - -func local_request_SwapClient_LoopOutQuote_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["amt"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "amt") - } - - protoReq.Amt, err = runtime.Int64(val) - - if err != nil { - 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 := server.LoopOutQuote(ctx, &protoReq) + msg, err := client.LoopOutQuote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -284,15 +168,6 @@ func request_SwapClient_GetLoopInTerms_0(ctx context.Context, marshaler runtime. } -func local_request_SwapClient_GetLoopInTerms_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TermsRequest - var metadata runtime.ServerMetadata - - msg, err := server.GetLoopInTerms(ctx, &protoReq) - return msg, metadata, err - -} - var ( filter_SwapClient_GetLoopInQuote_0 = &utilities.DoubleArray{Encoding: map[string]int{"amt": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -319,45 +194,11 @@ func request_SwapClient_GetLoopInQuote_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "amt", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SwapClient_GetLoopInQuote_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetLoopInQuote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SwapClient_GetLoopInQuote_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["amt"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "amt") - } - - protoReq.Amt, err = runtime.Int64(val) - - if err != nil { - 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_GetLoopInQuote_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetLoopInQuote(ctx, &protoReq) + msg, err := client.GetLoopInQuote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -371,210 +212,6 @@ func request_SwapClient_GetLsatTokens_0(ctx context.Context, marshaler runtime.M } -func local_request_SwapClient_GetLsatTokens_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq TokensRequest - var metadata runtime.ServerMetadata - - msg, err := server.GetLsatTokens(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterSwapClientHandlerServer registers the http handlers for service SwapClient to "mux". -// UnaryRPC :call SwapClientServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SwapClientServer) error { - - mux.Handle("POST", pattern_SwapClient_LoopOut_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_LoopOut_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_LoopOut_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_SwapClient_LoopIn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_LoopIn_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_LoopIn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_Monitor_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") - _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - }) - - mux.Handle("GET", pattern_SwapClient_ListSwaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_ListSwaps_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_ListSwaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_SwapInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_SwapInfo_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_SwapInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_LoopOutTerms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_LoopOutTerms_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_LoopOutTerms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_LoopOutQuote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_LoopOutQuote_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_LoopOutQuote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_GetLoopInTerms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_GetLoopInTerms_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_GetLoopInTerms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_GetLoopInQuote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_GetLoopInQuote_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_GetLoopInQuote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SwapClient_GetLsatTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SwapClient_GetLsatTokens_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SwapClient_GetLsatTokens_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - // RegisterSwapClientHandlerFromEndpoint is same as RegisterSwapClientHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterSwapClientHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -817,25 +454,25 @@ func RegisterSwapClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, } var ( - pattern_SwapClient_LoopOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "out"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_LoopOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "out"}, "")) - pattern_SwapClient_LoopIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "in"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_LoopIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "in"}, "")) - pattern_SwapClient_Monitor_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "monitor"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_Monitor_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "monitor"}, "")) - pattern_SwapClient_ListSwaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "swaps"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_ListSwaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "swaps"}, "")) - pattern_SwapClient_SwapInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "loop", "swap", "id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_SwapInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "loop", "swap", "id"}, "")) - pattern_SwapClient_LoopOutTerms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "loop", "out", "terms"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_LoopOutTerms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "loop", "out", "terms"}, "")) - pattern_SwapClient_LoopOutQuote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "loop", "out", "quote", "amt"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_LoopOutQuote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "loop", "out", "quote", "amt"}, "")) - pattern_SwapClient_GetLoopInTerms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "loop", "in", "terms"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_GetLoopInTerms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "loop", "in", "terms"}, "")) - pattern_SwapClient_GetLoopInQuote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "loop", "in", "quote", "amt"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_GetLoopInQuote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "loop", "in", "quote", "amt"}, "")) - pattern_SwapClient_GetLsatTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lsat", "tokens"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_SwapClient_GetLsatTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lsat", "tokens"}, "")) ) var ( diff --git a/looprpc/client.proto b/looprpc/client.proto index 337253f..71ff8ee 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -213,12 +213,10 @@ message LoopInRequest { int64 max_miner_fee = 3; /** - The channel to loop in. If zero, the channel to loop in is selected based - on the lowest routing fee for the swap payment from the server. - - Note: NOT YET IMPLEMENTED + The last hop to use for the loop in swap. If empty, the last hop is selected + based on the lowest routing fee for the swap payment from the server. */ - uint64 loop_in_channel = 4; + bytes last_hop = 4; /** If external_htlc is true, we expect the htlc to be published by an external diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index b9ab181..54457f9 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -4,6 +4,10 @@ "title": "client.proto", "version": "version not set" }, + "schemes": [ + "http", + "https" + ], "consumes": [ "application/json" ], @@ -114,16 +118,7 @@ "200": { "description": "A successful response.(streaming responses)", "schema": { - "type": "object", - "properties": { - "result": { - "$ref": "#/definitions/looprpcSwapStatus" - }, - "error": { - "$ref": "#/definitions/runtimeStreamError" - } - }, - "title": "Stream result of looprpcSwapStatus" + "$ref": "#/x-stream-definitions/looprpcSwapStatus" } } }, @@ -320,10 +315,10 @@ "format": "int64", "description": "*\nMaximum in on-chain fees that we are willing to spent. If we want to\npublish the on-chain htlc and the fee estimate turns out higher than this\nvalue, we cancel the swap. \n\nmax_miner_fee is typically taken from the response of the GetQuote call." }, - "loop_in_channel": { + "last_hop": { "type": "string", - "format": "uint64", - "description": "*\nThe channel to loop in. If zero, the channel to loop in is selected based\non the lowest routing fee for the swap payment from the server.\n\nNote: NOT YET IMPLEMENTED" + "format": "byte", + "description": "*\nThe last hop to use for the loop in swap. If empty, the last hop is selected\nbased on the lowest routing fee for the swap payment from the server." }, "external_htlc": { "type": "boolean", @@ -620,5 +615,19 @@ } } } + }, + "x-stream-definitions": { + "looprpcSwapStatus": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/looprpcSwapStatus" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of looprpcSwapStatus" + } } } From b69e8cb275814c605706307aa5d1f7b0e2c6316c Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 11 Feb 2020 13:58:55 +0100 Subject: [PATCH 2/2] multi: allow loop in last hop restriction --- cmd/loop/loopin.go | 58 ++++++++++++++++++-------- loopin.go | 2 +- looprpc/server.pb.go | 95 +++++++++++++++++++++++-------------------- looprpc/server.proto | 1 + server_mock_test.go | 3 +- swap_server_client.go | 25 +++++++----- 6 files changed, 111 insertions(+), 73 deletions(-) diff --git a/cmd/loop/loopin.go b/cmd/loop/loopin.go index bf990ca..0cb4812 100644 --- a/cmd/loop/loopin.go +++ b/cmd/loop/loopin.go @@ -7,27 +7,36 @@ import ( "github.com/btcsuite/btcutil" "github.com/lightninglabs/loop/looprpc" "github.com/lightninglabs/loop/swap" + "github.com/lightningnetwork/lnd/routing/route" "github.com/urfave/cli" ) -var loopInCommand = cli.Command{ - Name: "in", - Usage: "perform an on-chain to off-chain swap (loop in)", - ArgsUsage: "amt", - Description: ` +var ( + lastHopFlag = cli.StringFlag{ + Name: "last_hop", + Usage: "the pubkey of the last hop to use for this swap", + } + + 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.`, - Flags: []cli.Flag{ - cli.Uint64Flag{ - Name: "amt", - Usage: "the amount in satoshis to loop in", - }, - cli.BoolFlag{ - Name: "external", - Usage: "expect htlc to be published externally", + Flags: []cli.Flag{ + cli.Uint64Flag{ + Name: "amt", + Usage: "the amount in satoshis to loop in", + }, + cli.BoolFlag{ + Name: "external", + Usage: "expect htlc to be published externally", + }, + lastHopFlag, }, - }, - Action: loopIn, -} + Action: loopIn, + } +) func loopIn(ctx *cli.Context) error { args := ctx.Args() @@ -73,12 +82,25 @@ func loopIn(ctx *cli.Context) error { return err } - resp, err := client.LoopIn(context.Background(), &looprpc.LoopInRequest{ + req := &looprpc.LoopInRequest{ Amt: int64(amt), MaxMinerFee: int64(limits.maxMinerFee), MaxSwapFee: int64(limits.maxSwapFee), ExternalHtlc: external, - }) + } + + if ctx.IsSet(lastHopFlag.Name) { + lastHop, err := route.NewVertexFromStr( + ctx.String(lastHopFlag.Name), + ) + if err != nil { + return err + } + + req.LastHop = lastHop[:] + } + + resp, err := client.LoopIn(context.Background(), req) if err != nil { return err } diff --git a/loopin.go b/loopin.go index aceda47..98a979e 100644 --- a/loopin.go +++ b/loopin.go @@ -114,7 +114,7 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig, // htlc. log.Infof("Initiating swap request at height %v", currentHeight) swapResp, err := cfg.server.NewLoopInSwap(globalCtx, swapHash, - request.Amount, senderKey, swapInvoice, + request.Amount, senderKey, swapInvoice, request.LastHop, ) if err != nil { return nil, fmt.Errorf("cannot initiate swap: %v", err) diff --git a/looprpc/server.pb.go b/looprpc/server.pb.go index 9b1afbf..5d2e6f8 100644 --- a/looprpc/server.pb.go +++ b/looprpc/server.pb.go @@ -374,6 +374,7 @@ type ServerLoopInRequest struct { SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"` SwapInvoice string `protobuf:"bytes,4,opt,name=swap_invoice,json=swapInvoice,proto3" json:"swap_invoice,omitempty"` + LastHop []byte `protobuf:"bytes,5,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -432,6 +433,13 @@ func (m *ServerLoopInRequest) GetSwapInvoice() string { return "" } +func (m *ServerLoopInRequest) GetLastHop() []byte { + if m != nil { + return m.LastHop + } + return nil +} + type ServerLoopInResponse struct { ReceiverKey []byte `protobuf:"bytes,1,opt,name=receiver_key,json=receiverKey,proto3" json:"receiver_key,omitempty"` Expiry int32 `protobuf:"varint,2,opt,name=expiry,proto3" json:"expiry,omitempty"` @@ -689,50 +697,51 @@ func init() { func init() { proto.RegisterFile("server.proto", fileDescriptor_ad098daeda4239f7) } var fileDescriptor_ad098daeda4239f7 = []byte{ - // 677 bytes of a gzipped FileDescriptorProto + // 693 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x4e, 0xdb, 0x4c, - 0x10, 0x95, 0x9d, 0x10, 0xbe, 0x0c, 0x09, 0x7c, 0x6c, 0xff, 0x4c, 0x20, 0x15, 0x58, 0x2a, 0x42, - 0xa8, 0x02, 0xa9, 0xbd, 0xeb, 0x1d, 0x15, 0x42, 0x45, 0x45, 0xa5, 0x18, 0xee, 0xad, 0x25, 0x99, - 0x82, 0xd5, 0x78, 0x77, 0x6b, 0x6f, 0x02, 0x79, 0x81, 0x3e, 0x43, 0x7b, 0xdf, 0x57, 0xea, 0x83, - 0xf4, 0x0d, 0xaa, 0xfd, 0x31, 0xb1, 0x9d, 0x38, 0x80, 0xd4, 0x3b, 0xf6, 0xcc, 0x61, 0xf6, 0xcc, - 0x99, 0xb3, 0x0e, 0xb4, 0x52, 0x4c, 0x46, 0x98, 0xec, 0x89, 0x84, 0x4b, 0x4e, 0x16, 0x07, 0x9c, - 0x8b, 0x44, 0xf4, 0x3a, 0x1b, 0x57, 0x9c, 0x5f, 0x0d, 0x70, 0x9f, 0x8a, 0x68, 0x9f, 0x32, 0xc6, - 0x25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 0xdb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x49, 0xdb, - 0x27, 0xe0, 0x07, 0x00, 0x00, + 0x10, 0x95, 0x9d, 0x90, 0x90, 0x21, 0x81, 0x8f, 0xfd, 0xfa, 0xe3, 0x04, 0x52, 0x81, 0xa5, 0x22, + 0x84, 0x2a, 0x90, 0xda, 0xbb, 0xde, 0x51, 0x21, 0x04, 0x2a, 0x2a, 0xc5, 0x70, 0x6f, 0x2d, 0xc9, + 0x94, 0x58, 0xb5, 0xbd, 0x5b, 0x7b, 0x13, 0xc8, 0x9b, 0xb4, 0x97, 0x95, 0xfa, 0x4a, 0x7d, 0x90, + 0xbe, 0x41, 0xb5, 0x3f, 0x26, 0xb6, 0xf3, 0x03, 0x48, 0xbd, 0x63, 0x67, 0x0e, 0x33, 0x67, 0xce, + 0x9c, 0x89, 0xa1, 0x99, 0x62, 0x32, 0xc2, 0x64, 0x9f, 0x27, 0x4c, 0x30, 0x52, 0x0f, 0x19, 0xe3, + 0x09, 0xef, 0x75, 0x36, 0x6f, 0x18, 0xbb, 0x09, 0xf1, 0x80, 0xf2, 0xe0, 0x80, 0xc6, 0x31, 0x13, + 0x54, 0x04, 0x2c, 0x4e, 0x35, 0xcc, 0xfd, 0x65, 0xc1, 0xb3, 0x4b, 0xf5, 0x7f, 0x67, 0x8c, 0xf1, + 0xf3, 0xa1, 0xf0, 0xf0, 0xdb, 0x10, 0x53, 0x41, 0xb6, 0xa1, 0x99, 0x60, 0x0f, 0x83, 0x11, 0x26, + 0xfe, 0x57, 0x1c, 0x3b, 0xd6, 0x96, 0xb5, 0xdb, 0xf4, 0x56, 0xb2, 0xd8, 0x47, 0x1c, 0x93, 0x0d, + 0x68, 0xa4, 0xb7, 0x94, 0xfb, 0x03, 0x9a, 0x0e, 0x1c, 0x5b, 0xe5, 0x97, 0x65, 0xe0, 0x84, 0xa6, + 0x03, 0xf2, 0x1f, 0x54, 0x68, 0x24, 0x9c, 0xca, 0x96,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, 0xf0, 0xdf, 0xd2, 0xe3, 0xfc, 0x57, 0x2b, 0xfb, 0xaf, 0x53, + 0x54, 0xa1, 0x60, 0xbf, 0x1e, 0xac, 0x4f, 0xe5, 0xfe, 0xb5, 0xfb, 0xde, 0xfe, 0xa9, 0x00, 0xc8, + 0xa7, 0xee, 0x44, 0xce, 0xa1, 0x59, 0x30, 0xbb, 0xbb, 0x6f, 0x3e, 0x08, 0xfb, 0x73, 0xcf, 0xa4, + 0xb3, 0xb1, 0x00, 0x43, 0xce, 0x61, 0xf5, 0x13, 0xde, 0x9a, 0x90, 0x6c, 0x44, 0xba, 0xb3, 0xe1, + 0x59, 0xb5, 0x57, 0xf3, 0xd2, 0x66, 0xd7, 0x13, 0x86, 0xfa, 0x67, 0x6c, 0x0e, 0xc3, 0xbc, 0x9f, + 0xe6, 0x31, 0xd4, 0x05, 0xce, 0x60, 0x25, 0x2f, 0xf0, 0xf6, 0x0c, 0x6c, 0x71, 0x31, 0x9d, 0xce, + 0x7c, 0x08, 0x39, 0x83, 0x96, 0x99, 0xf7, 0x54, 0xad, 0x83, 0x6c, 0xce, 0x04, 0x67, 0xa5, 0xba, + 0x73, 0xb2, 0x66, 0xd8, 0xab, 0x8c, 0x9b, 0xa6, 0x3a, 0x9b, 0x5b, 0x61, 0x54, 0x77, 0x11, 0x44, + 0x57, 0xbd, 0xae, 0xa9, 0x8f, 0xf8, 0xbb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x99, 0x4f, + 0x5f, 0xfb, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/looprpc/server.proto b/looprpc/server.proto index 6ab28f6..920d0b2 100644 --- a/looprpc/server.proto +++ b/looprpc/server.proto @@ -78,6 +78,7 @@ message ServerLoopInRequest { bytes swap_hash = 2; uint64 amt = 3; string swap_invoice = 4; + bytes last_hop = 5; } message ServerLoopInResponse { diff --git a/server_mock_test.go b/server_mock_test.go index b8cbdd7..21dba55 100644 --- a/server_mock_test.go +++ b/server_mock_test.go @@ -11,6 +11,7 @@ import ( "github.com/lightninglabs/loop/test" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwire" + "github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/zpay32" ) @@ -127,7 +128,7 @@ func getInvoice(hash lntypes.Hash, amt btcutil.Amount, memo string) (string, err func (s *serverMock) NewLoopInSwap(ctx context.Context, swapHash lntypes.Hash, amount btcutil.Amount, - senderKey [33]byte, swapInvoice string) ( + senderKey [33]byte, swapInvoice string, lastHop *route.Vertex) ( *newLoopInResponse, error) { _, receiverKey := test.CreateKey(101) diff --git a/swap_server_client.go b/swap_server_client.go index 95c4786..38204a2 100644 --- a/swap_server_client.go +++ b/swap_server_client.go @@ -14,6 +14,7 @@ import ( "github.com/lightninglabs/loop/looprpc" "github.com/lightninglabs/loop/lsat" "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/routing/route" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -40,7 +41,7 @@ type swapServerClient interface { NewLoopInSwap(ctx context.Context, swapHash lntypes.Hash, amount btcutil.Amount, - senderKey [33]byte, swapInvoice string) ( + senderKey [33]byte, swapInvoice string, lastHop *route.Vertex) ( *newLoopInResponse, error) } @@ -203,18 +204,22 @@ func (s *grpcSwapServerClient) NewLoopOutSwap(ctx context.Context, func (s *grpcSwapServerClient) NewLoopInSwap(ctx context.Context, swapHash lntypes.Hash, amount btcutil.Amount, senderKey [33]byte, - swapInvoice string) (*newLoopInResponse, error) { + swapInvoice string, lastHop *route.Vertex) (*newLoopInResponse, error) { rpcCtx, rpcCancel := context.WithTimeout(ctx, globalCallTimeout) defer rpcCancel() - swapResp, err := s.server.NewLoopInSwap(rpcCtx, - &looprpc.ServerLoopInRequest{ - SwapHash: swapHash[:], - Amt: uint64(amount), - SenderKey: senderKey[:], - SwapInvoice: swapInvoice, - }, - ) + + req := &looprpc.ServerLoopInRequest{ + SwapHash: swapHash[:], + Amt: uint64(amount), + SenderKey: senderKey[:], + SwapInvoice: swapInvoice, + } + if lastHop != nil { + req.LastHop = lastHop[:] + } + + swapResp, err := s.server.NewLoopInSwap(rpcCtx, req) if err != nil { return nil, err }