From c00939d0a6f63df19fbd2135775aba58f713052c Mon Sep 17 00:00:00 2001 From: MPins Date: Tue, 22 Jul 2025 23:35:55 -0300 Subject: [PATCH] lntest: add functions for DeleteCanceledInvoice itest --- lntest/rpc/lnd.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lntest/rpc/lnd.go b/lntest/rpc/lnd.go index e8f359be6..265aab91a 100644 --- a/lntest/rpc/lnd.go +++ b/lntest/rpc/lnd.go @@ -831,3 +831,29 @@ func (h *HarnessRPC) SubscribePeerEvents( return resp } + +// DeleteCanceledInvoice makes a RPC call to the node's DeleteCanceledInvoice +// and asserts. +func (h *HarnessRPC) DeleteCanceledInvoice( + req *lnrpc.DelCanceledInvoiceReq) *lnrpc.DelCanceledInvoiceResp { + + ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout) + defer cancel() + + resp, err := h.LN.DeleteCanceledInvoice(ctxt, req) + h.NoError(err, "DeleteCanceledInvoice") + + return resp +} + +// DeleteCanceledInvoiceAssertErr makes a RPC call to the node's +// DeleteCanceledInvoice and asserts if an RPC error is returned. +func (h *HarnessRPC) DeleteCanceledInvoiceAssertErr( + req *lnrpc.DelCanceledInvoiceReq, errStr string) { + + ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout) + defer cancel() + + _, err := h.LN.DeleteCanceledInvoice(ctxt, req) + require.ErrorContains(h, err, errStr) +}