multi: rename LookupHtlc to LookupHtlcResolution for clarity

This commit is contained in:
yyforyongyu committed 2023-03-01 01:47:08 +08:00
1 parent 2bf84fbe41
commit c26917ee1f
11 files changed
+2952 -2939

No files matched your search

+2 -2
View File
@@ -512,7 +512,7 @@ var allTestCases = []*lntest.TestCase{
TestFunc: testBidirectionalAsyncPayments, TestFunc: testBidirectionalAsyncPayments,
}, },
{ {
Name: "lookup htlc", Name: "lookup htlc resolution",
TestFunc: testLookupHTLC, TestFunc: testLookupHtlcResolution,
}, },
} }
+7 -7
View File
@@ -9,9 +9,9 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
// testLookupHTLC checks that `LookupHtlc` returns the correct HTLC // testLookupHtlcResolution checks that `LookupHtlcResolution` returns the
// information. // correct HTLC information.
func testLookupHTLC(ht *lntest.HarnessTest) { func testLookupHtlcResolution(ht *lntest.HarnessTest) {
const chanAmt = btcutil.Amount(1000000) const chanAmt = btcutil.Amount(1000000)
alice := ht.Alice alice := ht.Alice
@@ -54,18 +54,18 @@ func testLookupHTLC(ht *lntest.HarnessTest) {
channel := ht.AssertChannelExists(carol, cp) channel := ht.AssertChannelExists(carol, cp)
// Lookup the HTLC and assert the htlc is settled offchain. // Lookup the HTLC and assert the htlc is settled offchain.
req := &lnrpc.LookupHtlcRequest{ req := &lnrpc.LookupHtlcResolutionRequest{
ChanId: channel.ChanId, ChanId: channel.ChanId,
HtlcIndex: 0, HtlcIndex: 0,
} }
// Check that Alice will get an error from LookupHtlc. // Check that Alice will get an error from LookupHtlcResolution.
err := alice.RPC.LookupHtlcAssertErr(req) err := alice.RPC.LookupHtlcResolutionAssertErr(req)
gErr := status.Convert(err) gErr := status.Convert(err)
require.Equal(ht, codes.Unavailable, gErr.Code()) require.Equal(ht, codes.Unavailable, gErr.Code())
// Check that Carol can get the final htlc info. // Check that Carol can get the final htlc info.
finalHTLC := carol.RPC.LookupHtlc(req) finalHTLC := carol.RPC.LookupHtlcResolution(req)
require.True(ht, finalHTLC.Settled, "htlc should be settled") require.True(ht, finalHTLC.Settled, "htlc should be settled")
require.True(ht, finalHTLC.Offchain, "htlc should be Offchain") require.True(ht, finalHTLC.Offchain, "htlc should be Offchain")
} }
+2868 -2865
View File
File diff suppressed because it is too large. Load diff
+16 -16
View File
@@ -2460,8 +2460,8 @@ func local_request_Lightning_ListAliases_0(ctx context.Context, marshaler runtim
} }
func request_Lightning_LookupHtlc_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Lightning_LookupHtlcResolution_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LookupHtlcRequest var protoReq LookupHtlcResolutionRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
var ( var (
@@ -2491,13 +2491,13 @@ func request_Lightning_LookupHtlc_0(ctx context.Context, marshaler runtime.Marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "htlc_index", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "htlc_index", err)
} }
msg, err := client.LookupHtlc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.LookupHtlcResolution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Lightning_LookupHtlc_0(ctx context.Context, marshaler runtime.Marshaler, server LightningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Lightning_LookupHtlcResolution_0(ctx context.Context, marshaler runtime.Marshaler, server LightningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LookupHtlcRequest var protoReq LookupHtlcResolutionRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
var ( var (
@@ -2527,7 +2527,7 @@ func local_request_Lightning_LookupHtlc_0(ctx context.Context, marshaler runtime
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "htlc_index", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "htlc_index", err)
} }
msg, err := server.LookupHtlc(ctx, &protoReq) msg, err := server.LookupHtlcResolution(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
@@ -3864,18 +3864,18 @@ func RegisterLightningHandlerServer(ctx context.Context, mux *runtime.ServeMux,
}) })
mux.Handle("GET", pattern_Lightning_LookupHtlc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Lightning_LookupHtlcResolution_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/lnrpc.Lightning/LookupHtlc", runtime.WithHTTPPathPattern("/v1/htlc/{chan_id}/{htlc_index}")) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/lnrpc.Lightning/LookupHtlcResolution", runtime.WithHTTPPathPattern("/v1/htlc-resolution/{chan_id}/{htlc_index}"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_Lightning_LookupHtlc_0(rctx, inboundMarshaler, server, req, pathParams) resp, md, err := local_request_Lightning_LookupHtlcResolution_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
@@ -3883,7 +3883,7 @@ func RegisterLightningHandlerServer(ctx context.Context, mux *runtime.ServeMux,
return return
} }
forward_Lightning_LookupHtlc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Lightning_LookupHtlcResolution_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@@ -5248,23 +5248,23 @@ func RegisterLightningHandlerClient(ctx context.Context, mux *runtime.ServeMux,
}) })
mux.Handle("GET", pattern_Lightning_LookupHtlc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Lightning_LookupHtlcResolution_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/lnrpc.Lightning/LookupHtlc", runtime.WithHTTPPathPattern("/v1/htlc/{chan_id}/{htlc_index}")) rctx, err := runtime.AnnotateContext(ctx, mux, req, "/lnrpc.Lightning/LookupHtlcResolution", runtime.WithHTTPPathPattern("/v1/htlc-resolution/{chan_id}/{htlc_index}"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_Lightning_LookupHtlc_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Lightning_LookupHtlcResolution_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Lightning_LookupHtlc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Lightning_LookupHtlcResolution_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@@ -5404,7 +5404,7 @@ var (
pattern_Lightning_ListAliases_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "aliases", "list"}, "")) pattern_Lightning_ListAliases_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "aliases", "list"}, ""))
pattern_Lightning_LookupHtlc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "htlc", "chan_id", "htlc_index"}, "")) pattern_Lightning_LookupHtlcResolution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "htlc-resolution", "chan_id", "htlc_index"}, ""))
) )
var ( var (
@@ -5540,5 +5540,5 @@ var (
forward_Lightning_ListAliases_0 = runtime.ForwardResponseMessage forward_Lightning_ListAliases_0 = runtime.ForwardResponseMessage
forward_Lightning_LookupHtlc_0 = runtime.ForwardResponseMessage forward_Lightning_LookupHtlcResolution_0 = runtime.ForwardResponseMessage
) )
+3 -3
View File
@@ -1724,10 +1724,10 @@ func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context
callback(string(respBytes), nil) callback(string(respBytes), nil)
} }
registry["lnrpc.Lightning.LookupHtlc"] = func(ctx context.Context, registry["lnrpc.Lightning.LookupHtlcResolution"] = func(ctx context.Context,
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
req := &LookupHtlcRequest{} req := &LookupHtlcResolutionRequest{}
err := marshaler.Unmarshal([]byte(reqJSON), req) err := marshaler.Unmarshal([]byte(reqJSON), req)
if err != nil { if err != nil {
callback("", err) callback("", err)
@@ -1735,7 +1735,7 @@ func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context
} }
client := NewLightningClient(conn) client := NewLightningClient(conn)
resp, err := client.LookupHtlc(ctx, req) resp, err := client.LookupHtlcResolution(ctx, req)
if err != nil { if err != nil {
callback("", err) callback("", err)
return return
+7 -5
View File
@@ -583,19 +583,21 @@ service Lightning {
rpc ListAliases (ListAliasesRequest) returns (ListAliasesResponse); rpc ListAliases (ListAliasesRequest) returns (ListAliasesResponse);
/* /*
LookupHtlc retrieves a final htlc resolution from the database. If the htlc LookupHtlcResolution retrieves a final htlc resolution from the database.
has no final resolution yet, a NotFound grpc status code is returned. If the htlc has no final resolution yet, a NotFound grpc status code is
returned.
*/ */
rpc LookupHtlc (LookupHtlcRequest) returns (LookupHtlcResponse); rpc LookupHtlcResolution (LookupHtlcResolutionRequest)
returns (LookupHtlcResolutionResponse);
} }
message LookupHtlcRequest { message LookupHtlcResolutionRequest {
uint64 chan_id = 1; uint64 chan_id = 1;
uint64 htlc_index = 2; uint64 htlc_index = 2;
} }
message LookupHtlcResponse { message LookupHtlcResolutionResponse {
// Settled is true is the htlc was settled. If false, the htlc was failed. // Settled is true is the htlc was settled. If false, the htlc was failed.
bool settled = 1; bool settled = 1;
+5 -5
View File
@@ -1601,15 +1601,15 @@
] ]
} }
}, },
"/v1/htlc/{chan_id}/{htlc_index}": { "/v1/htlc-resolution/{chan_id}/{htlc_index}": {
"get": { "get": {
"summary": "LookupHtlc retrieves a final htlc resolution from the database. If the htlc\nhas no final resolution yet, a NotFound grpc status code is returned.", "summary": "LookupHtlcResolution retrieves a final htlc resolution from the database.\nIf the htlc has no final resolution yet, a NotFound grpc status code is\nreturned.",
"operationId": "Lightning_LookupHtlc", "operationId": "Lightning_LookupHtlcResolution",
"responses": { "responses": {
"200": { "200": {
"description": "A successful response.", "description": "A successful response.",
"schema": { "schema": {
"$ref": "#/definitions/lnrpcLookupHtlcResponse" "$ref": "#/definitions/lnrpcLookupHtlcResolutionResponse"
} }
}, },
"default": { "default": {
@@ -5437,7 +5437,7 @@
} }
} }
}, },
"lnrpcLookupHtlcResponse": { "lnrpcLookupHtlcResolutionResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"settled": { "settled": {
+2 -2
View File
@@ -165,5 +165,5 @@ http:
get: "/v1/custommessage/subscribe" get: "/v1/custommessage/subscribe"
- selector: lnrpc.Lightning.ListAliases - selector: lnrpc.Lightning.ListAliases
get: "/v1/aliases/list" get: "/v1/aliases/list"
- selector: lnrpc.Lightning.LookupHtlc - selector: lnrpc.Lightning.LookupHtlcResolution
get: "/v1/htlc/{chan_id}/{htlc_index}" get: "/v1/htlc-resolution/{chan_id}/{htlc_index}"
+20 -18
View File
@@ -402,9 +402,10 @@ type LightningClient interface {
// their confirmed SCID (if it exists) and/or the base SCID (in the case of // their confirmed SCID (if it exists) and/or the base SCID (in the case of
// zero conf). // zero conf).
ListAliases(ctx context.Context, in *ListAliasesRequest, opts ...grpc.CallOption) (*ListAliasesResponse, error) ListAliases(ctx context.Context, in *ListAliasesRequest, opts ...grpc.CallOption) (*ListAliasesResponse, error)
// LookupHtlc retrieves a final htlc resolution from the database. If the htlc // LookupHtlcResolution retrieves a final htlc resolution from the database.
// has no final resolution yet, a NotFound grpc status code is returned. // If the htlc has no final resolution yet, a NotFound grpc status code is
LookupHtlc(ctx context.Context, in *LookupHtlcRequest, opts ...grpc.CallOption) (*LookupHtlcResponse, error) // returned.
LookupHtlcResolution(ctx context.Context, in *LookupHtlcResolutionRequest, opts ...grpc.CallOption) (*LookupHtlcResolutionResponse, error)
} }
type lightningClient struct { type lightningClient struct {
@@ -1306,9 +1307,9 @@ func (c *lightningClient) ListAliases(ctx context.Context, in *ListAliasesReques
return out, nil return out, nil
} }
func (c *lightningClient) LookupHtlc(ctx context.Context, in *LookupHtlcRequest, opts ...grpc.CallOption) (*LookupHtlcResponse, error) { func (c *lightningClient) LookupHtlcResolution(ctx context.Context, in *LookupHtlcResolutionRequest, opts ...grpc.CallOption) (*LookupHtlcResolutionResponse, error) {
out := new(LookupHtlcResponse) out := new(LookupHtlcResolutionResponse)
err := c.cc.Invoke(ctx, "/lnrpc.Lightning/LookupHtlc", in, out, opts...) err := c.cc.Invoke(ctx, "/lnrpc.Lightning/LookupHtlcResolution", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -1703,9 +1704,10 @@ type LightningServer interface {
// their confirmed SCID (if it exists) and/or the base SCID (in the case of // their confirmed SCID (if it exists) and/or the base SCID (in the case of
// zero conf). // zero conf).
ListAliases(context.Context, *ListAliasesRequest) (*ListAliasesResponse, error) ListAliases(context.Context, *ListAliasesRequest) (*ListAliasesResponse, error)
// LookupHtlc retrieves a final htlc resolution from the database. If the htlc // LookupHtlcResolution retrieves a final htlc resolution from the database.
// has no final resolution yet, a NotFound grpc status code is returned. // If the htlc has no final resolution yet, a NotFound grpc status code is
LookupHtlc(context.Context, *LookupHtlcRequest) (*LookupHtlcResponse, error) // returned.
LookupHtlcResolution(context.Context, *LookupHtlcResolutionRequest) (*LookupHtlcResolutionResponse, error)
mustEmbedUnimplementedLightningServer() mustEmbedUnimplementedLightningServer()
} }
@@ -1911,8 +1913,8 @@ func (UnimplementedLightningServer) SubscribeCustomMessages(*SubscribeCustomMess
func (UnimplementedLightningServer) ListAliases(context.Context, *ListAliasesRequest) (*ListAliasesResponse, error) { func (UnimplementedLightningServer) ListAliases(context.Context, *ListAliasesRequest) (*ListAliasesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListAliases not implemented") return nil, status.Errorf(codes.Unimplemented, "method ListAliases not implemented")
} }
func (UnimplementedLightningServer) LookupHtlc(context.Context, *LookupHtlcRequest) (*LookupHtlcResponse, error) { func (UnimplementedLightningServer) LookupHtlcResolution(context.Context, *LookupHtlcResolutionRequest) (*LookupHtlcResolutionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LookupHtlc not implemented") return nil, status.Errorf(codes.Unimplemented, "method LookupHtlcResolution not implemented")
} }
func (UnimplementedLightningServer) mustEmbedUnimplementedLightningServer() {} func (UnimplementedLightningServer) mustEmbedUnimplementedLightningServer() {}
@@ -3174,20 +3176,20 @@ func _Lightning_ListAliases_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Lightning_LookupHtlc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Lightning_LookupHtlcResolution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LookupHtlcRequest) in := new(LookupHtlcResolutionRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(LightningServer).LookupHtlc(ctx, in) return srv.(LightningServer).LookupHtlcResolution(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/lnrpc.Lightning/LookupHtlc", FullMethod: "/lnrpc.Lightning/LookupHtlcResolution",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LightningServer).LookupHtlc(ctx, req.(*LookupHtlcRequest)) return srv.(LightningServer).LookupHtlcResolution(ctx, req.(*LookupHtlcResolutionRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@@ -3412,8 +3414,8 @@ var Lightning_ServiceDesc = grpc.ServiceDesc{
Handler: _Lightning_ListAliases_Handler, Handler: _Lightning_ListAliases_Handler,
}, },
{ {
MethodName: "LookupHtlc", MethodName: "LookupHtlcResolution",
Handler: _Lightning_LookupHtlc_Handler, Handler: _Lightning_LookupHtlcResolution_Handler,
}, },
}, },
Streams: []grpc.StreamDesc{ Streams: []grpc.StreamDesc{
+14 -10
View File
@@ -697,27 +697,31 @@ func (h *HarnessRPC) GetChanInfo(
return resp return resp
} }
// LookupHtlc makes a RPC call to the node's LookupHtlc and returns the // LookupHtlcResolution makes a RPC call to the node's LookupHtlcResolution and
// response. // returns the response.
func (h *HarnessRPC) LookupHtlc( //
req *lnrpc.LookupHtlcRequest) *lnrpc.LookupHtlcResponse { //nolint:lll
func (h *HarnessRPC) LookupHtlcResolution(
req *lnrpc.LookupHtlcResolutionRequest) *lnrpc.LookupHtlcResolutionResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout) ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel() defer cancel()
resp, err := h.LN.LookupHtlc(ctxt, req) resp, err := h.LN.LookupHtlcResolution(ctxt, req)
h.NoError(err, "LookupHtlc") h.NoError(err, "LookupHtlcResolution")
return resp return resp
} }
// LookupHtlcAssertErr makes a RPC call to the node's LookupHtlc and asserts // LookupHtlcResolutionAssertErr makes a RPC call to the node's
// an RPC error is returned. // LookupHtlcResolution and asserts an RPC error is returned.
func (h *HarnessRPC) LookupHtlcAssertErr(req *lnrpc.LookupHtlcRequest) error { func (h *HarnessRPC) LookupHtlcResolutionAssertErr(
req *lnrpc.LookupHtlcResolutionRequest) error {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout) ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel() defer cancel()
_, err := h.LN.LookupHtlc(ctxt, req) _, err := h.LN.LookupHtlcResolution(ctxt, req)
require.Error(h, err, "expected an error") require.Error(h, err, "expected an error")
return err return err
+8 -6
View File
@@ -577,7 +577,7 @@ func MainRPCServerPermissions() map[string][]bakery.Op {
Entity: "offchain", Entity: "offchain",
Action: "read", Action: "read",
}}, }},
"/lnrpc.Lightning/LookupHtlc": {{ "/lnrpc.Lightning/LookupHtlcResolution": {{
Entity: "offchain", Entity: "offchain",
Action: "read", Action: "read",
}}, }},
@@ -3937,10 +3937,12 @@ func (r *rpcServer) ClosedChannels(ctx context.Context,
return resp, nil return resp, nil
} }
// LookupHtlc retrieves a final htlc resolution from the database. If the htlc // LookupHtlcResolution retrieves a final htlc resolution from the database. If
// has no final resolution yet, a NotFound grpc status code is returned. // the htlc has no final resolution yet, a NotFound grpc status code is
func (r *rpcServer) LookupHtlc(ctx context.Context, // returned.
in *lnrpc.LookupHtlcRequest) (*lnrpc.LookupHtlcResponse, error) { func (r *rpcServer) LookupHtlcResolution(
ctx context.Context, in *lnrpc.LookupHtlcResolutionRequest) (
*lnrpc.LookupHtlcResolutionResponse, error) {
if !r.cfg.StoreFinalHtlcResolutions { if !r.cfg.StoreFinalHtlcResolutions {
return nil, status.Error(codes.Unavailable, "cannot lookup "+ return nil, status.Error(codes.Unavailable, "cannot lookup "+
@@ -3958,7 +3960,7 @@ func (r *rpcServer) LookupHtlc(ctx context.Context,
return nil, err return nil, err
} }
return &lnrpc.LookupHtlcResponse{ return &lnrpc.LookupHtlcResolutionResponse{
Settled: info.Settled, Settled: info.Settled,
Offchain: info.Offchain, Offchain: info.Offchain,
}, nil }, nil