From 38d0ee929193893d2f2371ee1a61deb854936226 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Mon, 27 Feb 2023 16:27:10 +0800 Subject: [PATCH] lnd: don't allow lookup when `StoreFinalHtlcResolutions` is false --- rpcserver.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpcserver.go b/rpcserver.go index 5eef75837..55932e51e 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3942,6 +3942,11 @@ func (r *rpcServer) ClosedChannels(ctx context.Context, func (r *rpcServer) LookupHtlc(ctx context.Context, in *lnrpc.LookupHtlcRequest) (*lnrpc.LookupHtlcResponse, error) { + if !r.cfg.StoreFinalHtlcResolutions { + return nil, status.Error(codes.Unavailable, "cannot lookup "+ + "with flag --store-final-htlc-resolutions=false") + } + chanID := lnwire.NewShortChanIDFromInt(in.ChanId) info, err := r.server.chanStateDB.LookupFinalHtlc(chanID, in.HtlcIndex)