Merge pull request #10064 from ellemouton/getChanInfoGrpcErr

rpcserver: return consistent grpc NotFound error for GetChaninfo & LookupInvoice
This commit is contained in:
Elle authored and GitHub committed 2025-07-14 08:34:46 +02:00
commit add81f1388
5 files changed
+128 -2

No files matched your search

+60
View File
@@ -303,6 +303,66 @@ func (h *HarnessRPC) AddInvoiceAssertErr(req *lnrpc.Invoice, errStr string) {
require.ErrorContains(h, err, errStr)
}
// GetChanInfoAssertErr makes an RPC call to GetChanInfo and asserts an error
// has returned with a specific error message.
func (h *HarnessRPC) GetChanInfoAssertErr(req *lnrpc.ChanInfoRequest,
errStr string) {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.LN.GetChanInfo(ctxt, req)
require.ErrorContains(h, err, errStr)
}
// GetNodeInfoAssertErr makes an RPC call to GetNodeInfo and asserts an error
// has returned with a specific error message.
func (h *HarnessRPC) GetNodeInfoAssertErr(req *lnrpc.NodeInfoRequest,
errStr string) {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.LN.GetNodeInfo(ctxt, req)
require.ErrorContains(h, err, errStr)
}
// SendCustomMessageAssertErr makes an RPC call to SendCustomMessage and asserts
// an error has returned with a specific error message.
func (h *HarnessRPC) SendCustomMessageAssertErr(
req *lnrpc.SendCustomMessageRequest, errStr string) {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.LN.SendCustomMessage(ctxt, req)
require.ErrorContains(h, err, errStr)
}
// LookupInvoiceAssertErr makes an RPC call to LookupInvoice and asserts an
// error has returned with a specific error message.
func (h *HarnessRPC) LookupInvoiceAssertErr(req *lnrpc.PaymentHash,
errStr string) {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.LN.LookupInvoice(ctxt, req)
require.ErrorContains(h, err, errStr)
}
// LookupHTLCResolutionAssertErr makes an RPC call to LookupHTLCResolution and
// asserts an error has returned with a specific error message.
func (h *HarnessRPC) LookupHTLCResolutionAssertErr(
req *lnrpc.LookupHtlcResolutionRequest, errStr string) {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
_, err := h.LN.LookupHtlcResolution(ctxt, req)
require.ErrorContains(h, err, errStr)
}
// AbandonChannel makes a RPC call to AbandonChannel and asserts.
func (h *HarnessRPC) AbandonChannel(
req *lnrpc.AbandonChannelRequest) *lnrpc.AbandonChannelResponse {