• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 13412100018

19 Feb 2025 12:05PM UTC coverage: 44.914% (-13.9%) from 58.794%
13412100018

Pull #9521

github

web-flow
Merge 861d6970e into 0e8786348
Pull Request #9521: unit: remove GOACC, use Go 1.20 native coverage functionality

101023 of 224923 relevant lines covered (44.91%)

19479.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lnrpc/chainrpc/chainkit.pb.gw.go
1
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
2
// source: chainrpc/chainkit.proto
3

4
/*
5
Package chainrpc is a reverse proxy.
6

7
It translates gRPC into RESTful JSON APIs.
8
*/
9
package chainrpc
10

11
import (
12
        "context"
13
        "io"
14
        "net/http"
15

16
        "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
17
        "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
18
        "google.golang.org/grpc"
19
        "google.golang.org/grpc/codes"
20
        "google.golang.org/grpc/grpclog"
21
        "google.golang.org/grpc/metadata"
22
        "google.golang.org/grpc/status"
23
        "google.golang.org/protobuf/proto"
24
)
25

26
// Suppress "imported and not used" errors
27
var _ codes.Code
28
var _ io.Reader
29
var _ status.Status
30
var _ = runtime.String
31
var _ = utilities.NewDoubleArray
32
var _ = metadata.Join
33

34
var (
35
        filter_ChainKit_GetBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
36
)
37

38
func request_ChainKit_GetBlock_0(ctx context.Context, marshaler runtime.Marshaler, client ChainKitClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
39
        var protoReq GetBlockRequest
×
40
        var metadata runtime.ServerMetadata
×
41

×
42
        if err := req.ParseForm(); err != nil {
×
43
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
44
        }
×
45
        if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ChainKit_GetBlock_0); err != nil {
×
46
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
47
        }
×
48

49
        msg, err := client.GetBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
×
50
        return msg, metadata, err
×
51

52
}
53

54
func local_request_ChainKit_GetBlock_0(ctx context.Context, marshaler runtime.Marshaler, server ChainKitServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
55
        var protoReq GetBlockRequest
×
56
        var metadata runtime.ServerMetadata
×
57

×
58
        if err := req.ParseForm(); err != nil {
×
59
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
60
        }
×
61
        if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ChainKit_GetBlock_0); err != nil {
×
62
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
63
        }
×
64

65
        msg, err := server.GetBlock(ctx, &protoReq)
×
66
        return msg, metadata, err
×
67

68
}
69

70
var (
71
        filter_ChainKit_GetBlockHeader_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
72
)
73

74
func request_ChainKit_GetBlockHeader_0(ctx context.Context, marshaler runtime.Marshaler, client ChainKitClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
75
        var protoReq GetBlockHeaderRequest
×
76
        var metadata runtime.ServerMetadata
×
77

×
78
        if err := req.ParseForm(); err != nil {
×
79
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
80
        }
×
81
        if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ChainKit_GetBlockHeader_0); err != nil {
×
82
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
83
        }
×
84

85
        msg, err := client.GetBlockHeader(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
×
86
        return msg, metadata, err
×
87

88
}
89

90
func local_request_ChainKit_GetBlockHeader_0(ctx context.Context, marshaler runtime.Marshaler, server ChainKitServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
91
        var protoReq GetBlockHeaderRequest
×
92
        var metadata runtime.ServerMetadata
×
93

×
94
        if err := req.ParseForm(); err != nil {
×
95
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
96
        }
×
97
        if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ChainKit_GetBlockHeader_0); err != nil {
×
98
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
99
        }
×
100

101
        msg, err := server.GetBlockHeader(ctx, &protoReq)
×
102
        return msg, metadata, err
×
103

104
}
105

106
func request_ChainKit_GetBestBlock_0(ctx context.Context, marshaler runtime.Marshaler, client ChainKitClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
107
        var protoReq GetBestBlockRequest
×
108
        var metadata runtime.ServerMetadata
×
109

×
110
        msg, err := client.GetBestBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
×
111
        return msg, metadata, err
×
112

×
113
}
×
114

115
func local_request_ChainKit_GetBestBlock_0(ctx context.Context, marshaler runtime.Marshaler, server ChainKitServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
116
        var protoReq GetBestBlockRequest
×
117
        var metadata runtime.ServerMetadata
×
118

×
119
        msg, err := server.GetBestBlock(ctx, &protoReq)
×
120
        return msg, metadata, err
×
121

×
122
}
×
123

124
var (
125
        filter_ChainKit_GetBlockHash_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
126
)
127

128
func request_ChainKit_GetBlockHash_0(ctx context.Context, marshaler runtime.Marshaler, client ChainKitClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
129
        var protoReq GetBlockHashRequest
×
130
        var metadata runtime.ServerMetadata
×
131

×
132
        if err := req.ParseForm(); err != nil {
×
133
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
134
        }
×
135
        if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ChainKit_GetBlockHash_0); err != nil {
×
136
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
137
        }
×
138

139
        msg, err := client.GetBlockHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
×
140
        return msg, metadata, err
×
141

142
}
143

144
func local_request_ChainKit_GetBlockHash_0(ctx context.Context, marshaler runtime.Marshaler, server ChainKitServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
×
145
        var protoReq GetBlockHashRequest
×
146
        var metadata runtime.ServerMetadata
×
147

×
148
        if err := req.ParseForm(); err != nil {
×
149
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
150
        }
×
151
        if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ChainKit_GetBlockHash_0); err != nil {
×
152
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
153
        }
×
154

155
        msg, err := server.GetBlockHash(ctx, &protoReq)
×
156
        return msg, metadata, err
×
157

158
}
159

160
// RegisterChainKitHandlerServer registers the http handlers for service ChainKit to "mux".
161
// UnaryRPC     :call ChainKitServer directly.
162
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
163
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterChainKitHandlerFromEndpoint instead.
164
func RegisterChainKitHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChainKitServer) error {
×
165

×
166
        mux.Handle("GET", pattern_ChainKit_GetBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
167
                ctx, cancel := context.WithCancel(req.Context())
×
168
                defer cancel()
×
169
                var stream runtime.ServerTransportStream
×
170
                ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
×
171
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
172
                rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/chainrpc.ChainKit/GetBlock", runtime.WithHTTPPathPattern("/v2/chainkit/block"))
×
173
                if err != nil {
×
174
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
175
                        return
×
176
                }
×
177
                resp, md, err := local_request_ChainKit_GetBlock_0(rctx, inboundMarshaler, server, req, pathParams)
×
178
                md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
×
179
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
180
                if err != nil {
×
181
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
182
                        return
×
183
                }
×
184

185
                forward_ChainKit_GetBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
186

187
        })
188

189
        mux.Handle("GET", pattern_ChainKit_GetBlockHeader_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
190
                ctx, cancel := context.WithCancel(req.Context())
×
191
                defer cancel()
×
192
                var stream runtime.ServerTransportStream
×
193
                ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
×
194
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
195
                rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/chainrpc.ChainKit/GetBlockHeader", runtime.WithHTTPPathPattern("/v2/chainkit/blockheader"))
×
196
                if err != nil {
×
197
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
198
                        return
×
199
                }
×
200
                resp, md, err := local_request_ChainKit_GetBlockHeader_0(rctx, inboundMarshaler, server, req, pathParams)
×
201
                md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
×
202
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
203
                if err != nil {
×
204
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
205
                        return
×
206
                }
×
207

208
                forward_ChainKit_GetBlockHeader_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
209

210
        })
211

212
        mux.Handle("GET", pattern_ChainKit_GetBestBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
213
                ctx, cancel := context.WithCancel(req.Context())
×
214
                defer cancel()
×
215
                var stream runtime.ServerTransportStream
×
216
                ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
×
217
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
218
                rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/chainrpc.ChainKit/GetBestBlock", runtime.WithHTTPPathPattern("/v2/chainkit/bestblock"))
×
219
                if err != nil {
×
220
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
221
                        return
×
222
                }
×
223
                resp, md, err := local_request_ChainKit_GetBestBlock_0(rctx, inboundMarshaler, server, req, pathParams)
×
224
                md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
×
225
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
226
                if err != nil {
×
227
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
228
                        return
×
229
                }
×
230

231
                forward_ChainKit_GetBestBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
232

233
        })
234

235
        mux.Handle("GET", pattern_ChainKit_GetBlockHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
236
                ctx, cancel := context.WithCancel(req.Context())
×
237
                defer cancel()
×
238
                var stream runtime.ServerTransportStream
×
239
                ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
×
240
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
241
                rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/chainrpc.ChainKit/GetBlockHash", runtime.WithHTTPPathPattern("/v2/chainkit/blockhash"))
×
242
                if err != nil {
×
243
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
244
                        return
×
245
                }
×
246
                resp, md, err := local_request_ChainKit_GetBlockHash_0(rctx, inboundMarshaler, server, req, pathParams)
×
247
                md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
×
248
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
249
                if err != nil {
×
250
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
251
                        return
×
252
                }
×
253

254
                forward_ChainKit_GetBlockHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
255

256
        })
257

258
        return nil
×
259
}
260

261
// RegisterChainKitHandlerFromEndpoint is same as RegisterChainKitHandler but
262
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
263
func RegisterChainKitHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
×
264
        conn, err := grpc.Dial(endpoint, opts...)
×
265
        if err != nil {
×
266
                return err
×
267
        }
×
268
        defer func() {
×
269
                if err != nil {
×
270
                        if cerr := conn.Close(); cerr != nil {
×
271
                                grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
×
272
                        }
×
273
                        return
×
274
                }
275
                go func() {
×
276
                        <-ctx.Done()
×
277
                        if cerr := conn.Close(); cerr != nil {
×
278
                                grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
×
279
                        }
×
280
                }()
281
        }()
282

283
        return RegisterChainKitHandler(ctx, mux, conn)
×
284
}
285

286
// RegisterChainKitHandler registers the http handlers for service ChainKit to "mux".
287
// The handlers forward requests to the grpc endpoint over "conn".
288
func RegisterChainKitHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
×
289
        return RegisterChainKitHandlerClient(ctx, mux, NewChainKitClient(conn))
×
290
}
×
291

292
// RegisterChainKitHandlerClient registers the http handlers for service ChainKit
293
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChainKitClient".
294
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChainKitClient"
295
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
296
// "ChainKitClient" to call the correct interceptors.
297
func RegisterChainKitHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChainKitClient) error {
×
298

×
299
        mux.Handle("GET", pattern_ChainKit_GetBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
300
                ctx, cancel := context.WithCancel(req.Context())
×
301
                defer cancel()
×
302
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
303
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainKit/GetBlock", runtime.WithHTTPPathPattern("/v2/chainkit/block"))
×
304
                if err != nil {
×
305
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
306
                        return
×
307
                }
×
308
                resp, md, err := request_ChainKit_GetBlock_0(rctx, inboundMarshaler, client, req, pathParams)
×
309
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
310
                if err != nil {
×
311
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
312
                        return
×
313
                }
×
314

315
                forward_ChainKit_GetBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
316

317
        })
318

319
        mux.Handle("GET", pattern_ChainKit_GetBlockHeader_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
320
                ctx, cancel := context.WithCancel(req.Context())
×
321
                defer cancel()
×
322
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
323
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainKit/GetBlockHeader", runtime.WithHTTPPathPattern("/v2/chainkit/blockheader"))
×
324
                if err != nil {
×
325
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
326
                        return
×
327
                }
×
328
                resp, md, err := request_ChainKit_GetBlockHeader_0(rctx, inboundMarshaler, client, req, pathParams)
×
329
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
330
                if err != nil {
×
331
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
332
                        return
×
333
                }
×
334

335
                forward_ChainKit_GetBlockHeader_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
336

337
        })
338

339
        mux.Handle("GET", pattern_ChainKit_GetBestBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
340
                ctx, cancel := context.WithCancel(req.Context())
×
341
                defer cancel()
×
342
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
343
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainKit/GetBestBlock", runtime.WithHTTPPathPattern("/v2/chainkit/bestblock"))
×
344
                if err != nil {
×
345
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
346
                        return
×
347
                }
×
348
                resp, md, err := request_ChainKit_GetBestBlock_0(rctx, inboundMarshaler, client, req, pathParams)
×
349
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
350
                if err != nil {
×
351
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
352
                        return
×
353
                }
×
354

355
                forward_ChainKit_GetBestBlock_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
356

357
        })
358

359
        mux.Handle("GET", pattern_ChainKit_GetBlockHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
360
                ctx, cancel := context.WithCancel(req.Context())
×
361
                defer cancel()
×
362
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
363
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainKit/GetBlockHash", runtime.WithHTTPPathPattern("/v2/chainkit/blockhash"))
×
364
                if err != nil {
×
365
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
366
                        return
×
367
                }
×
368
                resp, md, err := request_ChainKit_GetBlockHash_0(rctx, inboundMarshaler, client, req, pathParams)
×
369
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
370
                if err != nil {
×
371
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
372
                        return
×
373
                }
×
374

375
                forward_ChainKit_GetBlockHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
×
376

377
        })
378

379
        return nil
×
380
}
381

382
var (
383
        pattern_ChainKit_GetBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "chainkit", "block"}, ""))
384

385
        pattern_ChainKit_GetBlockHeader_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "chainkit", "blockheader"}, ""))
386

387
        pattern_ChainKit_GetBestBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "chainkit", "bestblock"}, ""))
388

389
        pattern_ChainKit_GetBlockHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "chainkit", "blockhash"}, ""))
390
)
391

392
var (
393
        forward_ChainKit_GetBlock_0 = runtime.ForwardResponseMessage
394

395
        forward_ChainKit_GetBlockHeader_0 = runtime.ForwardResponseMessage
396

397
        forward_ChainKit_GetBestBlock_0 = runtime.ForwardResponseMessage
398

399
        forward_ChainKit_GetBlockHash_0 = runtime.ForwardResponseMessage
400
)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc