lnd: don't allow lookup when StoreFinalHtlcResolutions is false

This commit is contained in:
yyforyongyu 2023-02-27 16:27:10 +08:00
parent 86373645b6
commit 38d0ee9291
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -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)