• 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/chainnotifier.pb.gw.go
1
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
2
// source: chainrpc/chainnotifier.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
func request_ChainNotifier_RegisterConfirmationsNtfn_0(ctx context.Context, marshaler runtime.Marshaler, client ChainNotifierClient, req *http.Request, pathParams map[string]string) (ChainNotifier_RegisterConfirmationsNtfnClient, runtime.ServerMetadata, error) {
×
35
        var protoReq ConfRequest
×
36
        var metadata runtime.ServerMetadata
×
37

×
38
        newReader, berr := utilities.IOReaderFactory(req.Body)
×
39
        if berr != nil {
×
40
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
×
41
        }
×
42
        if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
×
43
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
44
        }
×
45

46
        stream, err := client.RegisterConfirmationsNtfn(ctx, &protoReq)
×
47
        if err != nil {
×
48
                return nil, metadata, err
×
49
        }
×
50
        header, err := stream.Header()
×
51
        if err != nil {
×
52
                return nil, metadata, err
×
53
        }
×
54
        metadata.HeaderMD = header
×
55
        return stream, metadata, nil
×
56

57
}
58

59
func request_ChainNotifier_RegisterSpendNtfn_0(ctx context.Context, marshaler runtime.Marshaler, client ChainNotifierClient, req *http.Request, pathParams map[string]string) (ChainNotifier_RegisterSpendNtfnClient, runtime.ServerMetadata, error) {
×
60
        var protoReq SpendRequest
×
61
        var metadata runtime.ServerMetadata
×
62

×
63
        newReader, berr := utilities.IOReaderFactory(req.Body)
×
64
        if berr != nil {
×
65
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
×
66
        }
×
67
        if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
×
68
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
69
        }
×
70

71
        stream, err := client.RegisterSpendNtfn(ctx, &protoReq)
×
72
        if err != nil {
×
73
                return nil, metadata, err
×
74
        }
×
75
        header, err := stream.Header()
×
76
        if err != nil {
×
77
                return nil, metadata, err
×
78
        }
×
79
        metadata.HeaderMD = header
×
80
        return stream, metadata, nil
×
81

82
}
83

84
func request_ChainNotifier_RegisterBlockEpochNtfn_0(ctx context.Context, marshaler runtime.Marshaler, client ChainNotifierClient, req *http.Request, pathParams map[string]string) (ChainNotifier_RegisterBlockEpochNtfnClient, runtime.ServerMetadata, error) {
×
85
        var protoReq BlockEpoch
×
86
        var metadata runtime.ServerMetadata
×
87

×
88
        newReader, berr := utilities.IOReaderFactory(req.Body)
×
89
        if berr != nil {
×
90
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
×
91
        }
×
92
        if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
×
93
                return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
×
94
        }
×
95

96
        stream, err := client.RegisterBlockEpochNtfn(ctx, &protoReq)
×
97
        if err != nil {
×
98
                return nil, metadata, err
×
99
        }
×
100
        header, err := stream.Header()
×
101
        if err != nil {
×
102
                return nil, metadata, err
×
103
        }
×
104
        metadata.HeaderMD = header
×
105
        return stream, metadata, nil
×
106

107
}
108

109
// RegisterChainNotifierHandlerServer registers the http handlers for service ChainNotifier to "mux".
110
// UnaryRPC     :call ChainNotifierServer directly.
111
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
112
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterChainNotifierHandlerFromEndpoint instead.
113
func RegisterChainNotifierHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChainNotifierServer) error {
×
114

×
115
        mux.Handle("POST", pattern_ChainNotifier_RegisterConfirmationsNtfn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
116
                err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")
×
117
                _, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
118
                runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
119
                return
×
120
        })
×
121

122
        mux.Handle("POST", pattern_ChainNotifier_RegisterSpendNtfn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
123
                err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")
×
124
                _, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
125
                runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
126
                return
×
127
        })
×
128

129
        mux.Handle("POST", pattern_ChainNotifier_RegisterBlockEpochNtfn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
130
                err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")
×
131
                _, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
132
                runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
133
                return
×
134
        })
×
135

136
        return nil
×
137
}
138

139
// RegisterChainNotifierHandlerFromEndpoint is same as RegisterChainNotifierHandler but
140
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
141
func RegisterChainNotifierHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
×
142
        conn, err := grpc.Dial(endpoint, opts...)
×
143
        if err != nil {
×
144
                return err
×
145
        }
×
146
        defer func() {
×
147
                if err != nil {
×
148
                        if cerr := conn.Close(); cerr != nil {
×
149
                                grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
×
150
                        }
×
151
                        return
×
152
                }
153
                go func() {
×
154
                        <-ctx.Done()
×
155
                        if cerr := conn.Close(); cerr != nil {
×
156
                                grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
×
157
                        }
×
158
                }()
159
        }()
160

161
        return RegisterChainNotifierHandler(ctx, mux, conn)
×
162
}
163

164
// RegisterChainNotifierHandler registers the http handlers for service ChainNotifier to "mux".
165
// The handlers forward requests to the grpc endpoint over "conn".
166
func RegisterChainNotifierHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
×
167
        return RegisterChainNotifierHandlerClient(ctx, mux, NewChainNotifierClient(conn))
×
168
}
×
169

170
// RegisterChainNotifierHandlerClient registers the http handlers for service ChainNotifier
171
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChainNotifierClient".
172
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChainNotifierClient"
173
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
174
// "ChainNotifierClient" to call the correct interceptors.
175
func RegisterChainNotifierHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChainNotifierClient) error {
×
176

×
177
        mux.Handle("POST", pattern_ChainNotifier_RegisterConfirmationsNtfn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
178
                ctx, cancel := context.WithCancel(req.Context())
×
179
                defer cancel()
×
180
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
181
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainNotifier/RegisterConfirmationsNtfn", runtime.WithHTTPPathPattern("/v2/chainnotifier/register/confirmations"))
×
182
                if err != nil {
×
183
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
184
                        return
×
185
                }
×
186
                resp, md, err := request_ChainNotifier_RegisterConfirmationsNtfn_0(rctx, inboundMarshaler, client, req, pathParams)
×
187
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
188
                if err != nil {
×
189
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
190
                        return
×
191
                }
×
192

193
                forward_ChainNotifier_RegisterConfirmationsNtfn_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
×
194

195
        })
196

197
        mux.Handle("POST", pattern_ChainNotifier_RegisterSpendNtfn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
198
                ctx, cancel := context.WithCancel(req.Context())
×
199
                defer cancel()
×
200
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
201
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainNotifier/RegisterSpendNtfn", runtime.WithHTTPPathPattern("/v2/chainnotifier/register/spends"))
×
202
                if err != nil {
×
203
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
204
                        return
×
205
                }
×
206
                resp, md, err := request_ChainNotifier_RegisterSpendNtfn_0(rctx, inboundMarshaler, client, req, pathParams)
×
207
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
208
                if err != nil {
×
209
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
210
                        return
×
211
                }
×
212

213
                forward_ChainNotifier_RegisterSpendNtfn_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
×
214

215
        })
216

217
        mux.Handle("POST", pattern_ChainNotifier_RegisterBlockEpochNtfn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
×
218
                ctx, cancel := context.WithCancel(req.Context())
×
219
                defer cancel()
×
220
                inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
×
221
                rctx, err := runtime.AnnotateContext(ctx, mux, req, "/chainrpc.ChainNotifier/RegisterBlockEpochNtfn", runtime.WithHTTPPathPattern("/v2/chainnotifier/register/blocks"))
×
222
                if err != nil {
×
223
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
224
                        return
×
225
                }
×
226
                resp, md, err := request_ChainNotifier_RegisterBlockEpochNtfn_0(rctx, inboundMarshaler, client, req, pathParams)
×
227
                ctx = runtime.NewServerMetadataContext(ctx, md)
×
228
                if err != nil {
×
229
                        runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
×
230
                        return
×
231
                }
×
232

233
                forward_ChainNotifier_RegisterBlockEpochNtfn_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
×
234

235
        })
236

237
        return nil
×
238
}
239

240
var (
241
        pattern_ChainNotifier_RegisterConfirmationsNtfn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "chainnotifier", "register", "confirmations"}, ""))
242

243
        pattern_ChainNotifier_RegisterSpendNtfn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "chainnotifier", "register", "spends"}, ""))
244

245
        pattern_ChainNotifier_RegisterBlockEpochNtfn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v2", "chainnotifier", "register", "blocks"}, ""))
246
)
247

248
var (
249
        forward_ChainNotifier_RegisterConfirmationsNtfn_0 = runtime.ForwardResponseStream
250

251
        forward_ChainNotifier_RegisterSpendNtfn_0 = runtime.ForwardResponseStream
252

253
        forward_ChainNotifier_RegisterBlockEpochNtfn_0 = runtime.ForwardResponseStream
254
)
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