itest: add interceptor and first hop data tests

This commit is contained in:
George Tsagkarelis authored and Oliver Gugger committed 2024-09-05 18:00:53 +02:00
1 parent 81c8331f82
commit 427d41dc1e
3 files changed
+301 -5

No files matched your search

+10 -2
View File
@@ -1600,13 +1600,16 @@ func (h *HarnessTest) findPayment(hn *node.HarnessNode,
return nil
}
// PaymentCheck is a function that checks a payment for a specific condition.
type PaymentCheck func(*lnrpc.Payment) error
// AssertPaymentStatus asserts that the given node list a payment with the
// given preimage has the expected status. It also checks that the payment has
// the expected preimage, which is empty when it's not settled and matches the
// given preimage when it's succeeded.
func (h *HarnessTest) AssertPaymentStatus(hn *node.HarnessNode,
preimage lntypes.Preimage,
status lnrpc.Payment_PaymentStatus) *lnrpc.Payment {
preimage lntypes.Preimage, status lnrpc.Payment_PaymentStatus,
checks ...PaymentCheck) *lnrpc.Payment {
var target *lnrpc.Payment
payHash := preimage.Hash()
@@ -1636,6 +1639,11 @@ func (h *HarnessTest) AssertPaymentStatus(hn *node.HarnessNode,
target.PaymentPreimage, "expected zero preimage")
}
// Perform any additional checks on the payment.
for _, check := range checks {
require.NoError(h, check(target))
}
return target
}