itest+lntest: assert payment is failed once the htlc times out

This commit is contained in:
yyforyongyu committed 2025-02-10 11:31:51 +08:00
1 parent faa3110127
commit ca10707b26
2 files changed
+37 -7

No files matched your search

+11 -3
View File
@@ -1600,8 +1600,11 @@ func (h *HarnessTest) AssertPaymentStatus(hn *node.HarnessNode,
// AssertPaymentFailureReason asserts that the given node lists a payment with
// the given preimage which has the expected failure reason.
func (h *HarnessTest) AssertPaymentFailureReason(hn *node.HarnessNode,
preimage lntypes.Preimage, reason lnrpc.PaymentFailureReason) {
func (h *HarnessTest) AssertPaymentFailureReason(
hn *node.HarnessNode, preimage lntypes.Preimage,
reason lnrpc.PaymentFailureReason) *lnrpc.Payment {
var payment *lnrpc.Payment
payHash := preimage.Hash()
err := wait.NoError(func() error {
@@ -1610,14 +1613,19 @@ func (h *HarnessTest) AssertPaymentFailureReason(hn *node.HarnessNode,
return err
}
payment = p
if reason == p.FailureReason {
return nil
}
return fmt.Errorf("payment: %v failure reason not match, "+
"want %s got %s", payHash, reason, p.Status)
"want %s(%d) got %s(%d)", payHash, reason, reason,
p.FailureReason, p.FailureReason)
}, DefaultTimeout)
require.NoError(h, err, "timeout checking payment failure reason")
return payment
}
// AssertActiveNodesSynced asserts all active nodes have synced to the chain.