From b6c7ff8183694241416fb1fdd69b2e89aa97c691 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 30 Oct 2019 10:53:21 +0100 Subject: [PATCH] lnrpc: generate protos with new gateway version --- lnrpc/rpc.pb.gw.go | 621 ++++++++++------------------------------- lnrpc/rpc.swagger.json | 327 ++++++++++++++++++---- 2 files changed, 427 insertions(+), 521 deletions(-) diff --git a/lnrpc/rpc.pb.gw.go b/lnrpc/rpc.pb.gw.go index e4b925c1..53400f4e 100644 --- a/lnrpc/rpc.pb.gw.go +++ b/lnrpc/rpc.pb.gw.go @@ -9,13 +9,13 @@ It translates gRPC into RESTful JSON APIs. package lnrpc import ( + "context" "io" "net/http" "github.com/golang/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/grpc-ecosystem/grpc-gateway/utilities" - "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" @@ -49,7 +49,11 @@ func request_WalletUnlocker_InitWallet_0(ctx context.Context, marshaler runtime. var protoReq InitWalletRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -62,7 +66,11 @@ func request_WalletUnlocker_UnlockWallet_0(ctx context.Context, marshaler runtim var protoReq UnlockWalletRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -75,7 +83,11 @@ func request_WalletUnlocker_ChangePassword_0(ctx context.Context, marshaler runt var protoReq ChangePasswordRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -132,7 +144,11 @@ func request_Lightning_SendCoins_0(ctx context.Context, marshaler runtime.Marsha var protoReq SendCoinsRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -179,7 +195,11 @@ func request_Lightning_SignMessage_0(ctx context.Context, marshaler runtime.Mars var protoReq SignMessageRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -192,7 +212,11 @@ func request_Lightning_VerifyMessage_0(ctx context.Context, marshaler runtime.Ma var protoReq VerifyMessageRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -205,7 +229,11 @@ func request_Lightning_ConnectPeer_0(ctx context.Context, marshaler runtime.Mars var protoReq ConnectPeerRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -306,7 +334,11 @@ func request_Lightning_OpenChannelSync_0(ctx context.Context, marshaler runtime. var protoReq OpenChannelRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -419,7 +451,11 @@ func request_Lightning_SendPaymentSync_0(ctx context.Context, marshaler runtime. var protoReq SendRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -432,7 +468,11 @@ func request_Lightning_SendToRouteSync_0(ctx context.Context, marshaler runtime. var protoReq SendToRouteRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -445,7 +485,11 @@ func request_Lightning_AddInvoice_0(ctx context.Context, marshaler runtime.Marsh var protoReq Invoice var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -731,7 +775,11 @@ func request_Lightning_UpdateChannelPolicy_0(ctx context.Context, marshaler runt var protoReq PolicyUpdateRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -744,7 +792,11 @@ func request_Lightning_ForwardingHistory_0(ctx context.Context, marshaler runtim var protoReq ForwardingHistoryRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -812,7 +864,11 @@ func request_Lightning_VerifyChanBackup_0(ctx context.Context, marshaler runtime var protoReq ChanBackupSnapshot var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -825,7 +881,11 @@ func request_Lightning_RestoreChannelBackups_0(ctx context.Context, marshaler ru var protoReq RestoreChanBackupRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -838,7 +898,11 @@ func request_Lightning_BakeMacaroon_0(ctx context.Context, marshaler runtime.Mar var protoReq BakeMacaroonRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + 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) } @@ -857,14 +921,14 @@ func RegisterWalletUnlockerHandlerFromEndpoint(ctx context.Context, mux *runtime defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -875,20 +939,19 @@ func RegisterWalletUnlockerHandlerFromEndpoint(ctx context.Context, mux *runtime // RegisterWalletUnlockerHandler registers the http handlers for service WalletUnlocker to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - client := NewWalletUnlockerClient(conn) + return RegisterWalletUnlockerHandlerClient(ctx, mux, NewWalletUnlockerClient(conn)) +} + +// RegisterWalletUnlockerHandlerClient registers the http handlers for service WalletUnlocker +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WalletUnlockerClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WalletUnlockerClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "WalletUnlockerClient" to call the correct interceptors. +func RegisterWalletUnlockerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WalletUnlockerClient) error { mux.Handle("GET", pattern_WalletUnlocker_GenSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -907,17 +970,8 @@ func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, c }) mux.Handle("POST", pattern_WalletUnlocker_InitWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -936,17 +990,8 @@ func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, c }) mux.Handle("POST", pattern_WalletUnlocker_UnlockWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -965,17 +1010,8 @@ func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, c }) mux.Handle("POST", pattern_WalletUnlocker_ChangePassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1026,14 +1062,14 @@ func RegisterLightningHandlerFromEndpoint(ctx context.Context, mux *runtime.Serv defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -1044,20 +1080,19 @@ func RegisterLightningHandlerFromEndpoint(ctx context.Context, mux *runtime.Serv // RegisterLightningHandler registers the http handlers for service Lightning to "mux". // The handlers forward requests to the grpc endpoint over "conn". func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - client := NewLightningClient(conn) + return RegisterLightningHandlerClient(ctx, mux, NewLightningClient(conn)) +} + +// RegisterLightningHandlerClient registers the http handlers for service Lightning +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LightningClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LightningClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "LightningClient" to call the correct interceptors. +func RegisterLightningHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LightningClient) error { mux.Handle("GET", pattern_Lightning_WalletBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1076,17 +1111,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ChannelBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1105,17 +1131,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_GetTransactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1134,17 +1151,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_EstimateFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1163,17 +1171,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_SendCoins_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1192,17 +1191,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ListUnspent_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1221,17 +1211,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_NewAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1250,17 +1231,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_SignMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1279,17 +1251,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_VerifyMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1308,17 +1271,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_ConnectPeer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1337,17 +1291,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("DELETE", pattern_Lightning_DisconnectPeer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1366,17 +1311,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ListPeers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1395,17 +1331,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1424,17 +1351,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_PendingChannels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1453,17 +1371,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ListChannels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1482,17 +1391,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ClosedChannels_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1511,17 +1411,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_OpenChannelSync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1540,17 +1431,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("DELETE", pattern_Lightning_CloseChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1569,17 +1451,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("DELETE", pattern_Lightning_AbandonChannel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1598,17 +1471,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_SendPaymentSync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1627,17 +1491,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_SendToRouteSync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1656,17 +1511,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_AddInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1685,17 +1531,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ListInvoices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1714,17 +1551,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_LookupInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1743,17 +1571,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_SubscribeInvoices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1772,17 +1591,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_DecodePayReq_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1801,17 +1611,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ListPayments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1830,17 +1631,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("DELETE", pattern_Lightning_DeleteAllPayments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1859,17 +1651,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_DescribeGraph_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1888,17 +1671,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_GetChanInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1917,17 +1691,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_GetNodeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1946,17 +1711,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_QueryRoutes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -1975,17 +1731,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_GetNetworkInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2004,17 +1751,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_FeeReport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2033,17 +1771,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_UpdateChannelPolicy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2062,17 +1791,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_ForwardingHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2091,17 +1811,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ExportChannelBackup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2120,17 +1831,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("GET", pattern_Lightning_ExportAllChannelBackups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2149,17 +1851,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_VerifyChanBackup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2178,17 +1871,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_RestoreChannelBackups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { @@ -2207,17 +1891,8 @@ func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn * }) mux.Handle("POST", pattern_Lightning_BakeMacaroon_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := context.WithCancel(req.Context()) defer cancel() - if cn, ok := w.(http.CloseNotifier); ok { - go func(done <-chan struct{}, closed <-chan bool) { - select { - case <-done: - case <-closed: - cancel() - } - }(ctx.Done(), cn.CloseNotify()) - } inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateContext(ctx, mux, req) if err != nil { diff --git a/lnrpc/rpc.swagger.json b/lnrpc/rpc.swagger.json index b7d49f3c..90254a17 100644 --- a/lnrpc/rpc.swagger.json +++ b/lnrpc/rpc.swagger.json @@ -21,7 +21,7 @@ "operationId": "WalletBalance", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcWalletBalanceResponse" } @@ -38,7 +38,7 @@ "operationId": "ChannelBalance", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChannelBalanceResponse" } @@ -55,7 +55,7 @@ "operationId": "ChangePassword", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChangePasswordResponse" } @@ -82,7 +82,7 @@ "operationId": "ListChannels", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcListChannelsResponse" } @@ -127,7 +127,7 @@ "operationId": "OpenChannelSync", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChannelPoint" } @@ -154,7 +154,7 @@ "operationId": "AbandonChannel", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcAbandonChannelResponse" } @@ -163,16 +163,26 @@ "parameters": [ { "name": "channel_point.funding_txid_str", + "description": "/ Hex-encoded string representing the funding transaction", "in": "path", "required": true, "type": "string" }, { "name": "channel_point.output_index", + "description": "/ The index of the output of the funding transaction", "in": "path", "required": true, "type": "integer", "format": "int64" + }, + { + "name": "channel_point.funding_txid_bytes", + "description": "/ Txid of the funding transaction.", + "in": "query", + "required": false, + "type": "string", + "format": "byte" } ], "tags": [ @@ -186,7 +196,7 @@ "operationId": "ExportAllChannelBackups", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChanBackupSnapshot" } @@ -203,7 +213,7 @@ "operationId": "RestoreChannelBackups", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcRestoreBackupResponse" } @@ -230,7 +240,7 @@ "operationId": "VerifyChanBackup", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcVerifyChanBackupResponse" } @@ -257,7 +267,7 @@ "operationId": "ExportChannelBackup", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChannelBackup" } @@ -266,12 +276,14 @@ "parameters": [ { "name": "chan_point.funding_txid_str", + "description": "/ Hex-encoded string representing the funding transaction", "in": "path", "required": true, "type": "string" }, { "name": "chan_point.output_index", + "description": "/ The index of the output of the funding transaction", "in": "path", "required": true, "type": "integer", @@ -297,7 +309,7 @@ "operationId": "ClosedChannels", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcClosedChannelsResponse" } @@ -358,7 +370,7 @@ "operationId": "PendingChannels", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcPendingChannelsResponse" } @@ -375,7 +387,7 @@ "operationId": "SendPaymentSync", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcSendResponse" } @@ -402,7 +414,7 @@ "operationId": "SendToRouteSync", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcSendResponse" } @@ -429,25 +441,59 @@ "operationId": "CloseChannel", "responses": { "200": { - "description": "(streaming responses)", + "description": "A successful response.(streaming responses)", "schema": { - "$ref": "#/definitions/lnrpcCloseStatusUpdate" + "$ref": "#/x-stream-definitions/lnrpcCloseStatusUpdate" } } }, "parameters": [ { "name": "channel_point.funding_txid_str", + "description": "/ Hex-encoded string representing the funding transaction", "in": "path", "required": true, "type": "string" }, { "name": "channel_point.output_index", + "description": "/ The index of the output of the funding transaction", "in": "path", "required": true, "type": "integer", "format": "int64" + }, + { + "name": "channel_point.funding_txid_bytes", + "description": "/ Txid of the funding transaction.", + "in": "query", + "required": false, + "type": "string", + "format": "byte" + }, + { + "name": "force", + "description": "/ If true, then the channel will be closed forcibly. This means the current commitment transaction will be signed and broadcast.", + "in": "query", + "required": false, + "type": "boolean", + "format": "boolean" + }, + { + "name": "target_conf", + "description": "/ The target number of blocks that the closure transaction should be confirmed by.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "sat_per_byte", + "description": "/ A manual fee rate set in sat/byte that should be used when crafting the closure transaction.", + "in": "query", + "required": false, + "type": "string", + "format": "int64" } ], "tags": [ @@ -461,7 +507,7 @@ "operationId": "UpdateChannelPolicy", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcPolicyUpdateResponse" } @@ -488,7 +534,7 @@ "operationId": "FeeReport", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcFeeReportResponse" } @@ -506,7 +552,7 @@ "operationId": "GenSeed", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcGenSeedResponse" } @@ -541,7 +587,7 @@ "operationId": "GetInfo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcGetInfoResponse" } @@ -558,7 +604,7 @@ "operationId": "DescribeGraph", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChannelGraph" } @@ -585,7 +631,7 @@ "operationId": "GetChanInfo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcChannelEdge" } @@ -594,6 +640,7 @@ "parameters": [ { "name": "chan_id", + "description": "*\nThe unique channel ID for the channel. The first 3 bytes are the block\nheight, the next 3 the index within the block, and the last 2 bytes are the\noutput index for the channel.", "in": "path", "required": true, "type": "string", @@ -611,7 +658,7 @@ "operationId": "GetNetworkInfo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcNetworkInfo" } @@ -628,7 +675,7 @@ "operationId": "GetNodeInfo", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcNodeInfo" } @@ -637,6 +684,7 @@ "parameters": [ { "name": "pub_key", + "description": "/ The 33-byte hex-encoded compressed public of the target node", "in": "path", "required": true, "type": "string" @@ -661,7 +709,7 @@ "operationId": "QueryRoutes", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcQueryRoutesResponse" } @@ -670,12 +718,14 @@ "parameters": [ { "name": "pub_key", + "description": "/ The 33-byte hex-encoded public key for the payment destination", "in": "path", "required": true, "type": "string" }, { "name": "amt", + "description": "/ The amount to send expressed in satoshis", "in": "path", "required": true, "type": "string", @@ -714,7 +764,8 @@ "items": { "type": "string", "format": "byte" - } + }, + "collectionFormat": "multi" }, { "name": "source_pub_key", @@ -752,7 +803,7 @@ "operationId": "InitWallet", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcInitWalletResponse" } @@ -779,7 +830,7 @@ "operationId": "LookupInvoice", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcInvoice" } @@ -788,6 +839,7 @@ "parameters": [ { "name": "r_hash_str", + "description": "*\nThe hex-encoded payment hash of the invoice to be looked up. The passed\npayment hash must be exactly 32 bytes, otherwise an error is returned.", "in": "path", "required": true, "type": "string" @@ -812,7 +864,7 @@ "operationId": "ListInvoices", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcListInvoiceResponse" } @@ -861,7 +913,7 @@ "operationId": "AddInvoice", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcAddInvoiceResponse" } @@ -888,9 +940,9 @@ "operationId": "SubscribeInvoices", "responses": { "200": { - "description": "(streaming responses)", + "description": "A successful response.(streaming responses)", "schema": { - "$ref": "#/definitions/lnrpcInvoice" + "$ref": "#/x-stream-definitions/lnrpcInvoice" } } }, @@ -923,7 +975,7 @@ "operationId": "BakeMacaroon", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcBakeMacaroonResponse" } @@ -950,7 +1002,7 @@ "operationId": "NewAddress", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcNewAddressResponse" } @@ -983,7 +1035,7 @@ "operationId": "ListPayments", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcListPaymentsResponse" } @@ -1008,7 +1060,7 @@ "operationId": "DeleteAllPayments", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcDeleteAllPaymentsResponse" } @@ -1025,7 +1077,7 @@ "operationId": "DecodePayReq", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcPayReq" } @@ -1034,6 +1086,7 @@ "parameters": [ { "name": "pay_req", + "description": "/ The payment request string to be decoded", "in": "path", "required": true, "type": "string" @@ -1050,7 +1103,7 @@ "operationId": "ListPeers", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcListPeersResponse" } @@ -1065,7 +1118,7 @@ "operationId": "ConnectPeer", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcConnectPeerResponse" } @@ -1092,7 +1145,7 @@ "operationId": "DisconnectPeer", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcDisconnectPeerResponse" } @@ -1101,6 +1154,7 @@ "parameters": [ { "name": "pub_key", + "description": "/ The pubkey of the node to disconnect from", "in": "path", "required": true, "type": "string" @@ -1117,7 +1171,7 @@ "operationId": "SignMessage", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcSignMessageResponse" } @@ -1145,7 +1199,7 @@ "operationId": "ForwardingHistory", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcForwardingHistoryResponse" } @@ -1172,7 +1226,7 @@ "operationId": "GetTransactions", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcTransactionDetails" } @@ -1187,7 +1241,7 @@ "operationId": "SendCoins", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcSendCoinsResponse" } @@ -1214,7 +1268,7 @@ "operationId": "EstimateFee", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcEstimateFeeResponse" } @@ -1241,7 +1295,7 @@ "operationId": "UnlockWallet", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcUnlockWalletResponse" } @@ -1268,7 +1322,7 @@ "operationId": "ListUnspent", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcListUnspentResponse" } @@ -1303,7 +1357,7 @@ "operationId": "VerifyMessage", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { "$ref": "#/definitions/lnrpcVerifyMessageResponse" } @@ -2127,6 +2181,21 @@ "lnrpcDisconnectPeerResponse": { "type": "object" }, + "lnrpcEdgeLocator": { + "type": "object", + "properties": { + "channel_id": { + "type": "string", + "format": "uint64", + "description": "/ The short channel id of this edge." + }, + "direction_reverse": { + "type": "boolean", + "format": "boolean", + "description": "*\nThe direction of this edge. If direction_reverse is false, the direction\nof this edge is from the channel endpoint with the lexicographically smaller\npub key to the endpoint with the larger pub key. If direction_reverse is\nis true, the edge goes the other way." + } + } + }, "lnrpcEstimateFeeResponse": { "type": "object", "properties": { @@ -2930,6 +2999,21 @@ } } }, + "lnrpcNodePair": { + "type": "object", + "properties": { + "from": { + "type": "string", + "format": "byte", + "description": "/ The sending node of the pair." + }, + "to": { + "type": "string", + "format": "byte", + "description": "/ The receiving node of the pair." + } + } + }, "lnrpcNodeUpdate": { "type": "object", "properties": { @@ -3761,6 +3845,153 @@ "title": "/ The unconfirmed balance of a wallet(with 0 confirmations)" } } + }, + "protobufAny": { + "type": "object", + "properties": { + "type_url": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "runtimeStreamError": { + "type": "object", + "properties": { + "grpc_code": { + "type": "integer", + "format": "int32" + }, + "http_code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "http_status": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "x-stream-definitions": { + "lnrpcChanBackupSnapshot": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcChanBackupSnapshot" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcChanBackupSnapshot" + }, + "lnrpcChannelAcceptRequest": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcChannelAcceptRequest" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcChannelAcceptRequest" + }, + "lnrpcChannelEventUpdate": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcChannelEventUpdate" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcChannelEventUpdate" + }, + "lnrpcCloseStatusUpdate": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcCloseStatusUpdate" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcCloseStatusUpdate" + }, + "lnrpcGraphTopologyUpdate": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcGraphTopologyUpdate" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcGraphTopologyUpdate" + }, + "lnrpcInvoice": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcInvoice" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcInvoice" + }, + "lnrpcOpenStatusUpdate": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcOpenStatusUpdate" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcOpenStatusUpdate" + }, + "lnrpcSendResponse": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcSendResponse" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcSendResponse" + }, + "lnrpcTransaction": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/lnrpcTransaction" + }, + "error": { + "$ref": "#/definitions/runtimeStreamError" + } + }, + "title": "Stream result of lnrpcTransaction" } } }