-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
itest: Extend custom channel liquidity itest for RFQ HTLC tracking #906
base: update-to-lnd-18-4
Are you sure you want to change the base?
itest: Extend custom channel liquidity itest for RFQ HTLC tracking #906
Conversation
6b56147
to
f055328
Compare
7cb58a5
to
d82cb9d
Compare
@GeorgeTsagk do I only need to review the last three commits? |
f055328
to
e52a8c5
Compare
@ffranr this was just rebased, it's just one commit now (if you skip the temp one) |
// We set the waiting period for the slosh payment to occur. This is set | ||
// to half of the default payment timeout, as we want it to occur half | ||
// way through the in-flight payment. | ||
sloshWait := PaymentTimeout / 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be /2
?
// To avoid goroutine uncertainty, we wait as much as the above routine | ||
// minus a small delta. This is enough for us to be sure that the | ||
// payment will complete due to the slosh. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to make this more events based driven? Instead of timing can we detect the arrival of HTLCs and respond when appropriate?
go func() { | ||
// Now Charlie pays the invoice with assets. What happens on the | ||
// Charlie-Dave channel doesn't matter. This payment will block | ||
// until the previous slosh payment completes. That slosh will | ||
// allow for the rest of the HTLCs to be forwarded. | ||
payInvoiceWithAssets( | ||
t.t, charlie, dave, invoiceResp.PaymentRequest, assetID, | ||
true, defaultPaymentStatusOpt, | ||
) | ||
|
||
done <- true | ||
}() | ||
|
||
select { | ||
case <-done: | ||
// If the payment completes before the slosh payment occurs then | ||
// something went wrong, this is not the expected test case | ||
// behavior. | ||
t.Fatalf("payment completed before expected block period") | ||
case <-timeoutChan: | ||
// The expected time delay for the payment to complete has been | ||
// passed, so now we wait for the payment to complete. | ||
<-done | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have BeforeTimeout
as a helper function. Would be good to have AfterTimestamp
perhaps. But I think this sort of timing analysis strategy should be events driven instead.
|
||
//nolint:lll | ||
go func() { | ||
// payInvoiceWithSatoshi(t.t, erin, iResp, lnrpc.Payment_FAILED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be removed?
stream, err := erin.RouterClient.SendPaymentV2(ctxc, sendReq) | ||
if err == nil { | ||
_, _ = getPaymentResult(stream) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should use this patter here:
stream, err := erin.RouterClient.SendPaymentV2(ctxc, sendReq)
require.NoError(t.t, err)
_, _ = getPaymentResult(stream)
Need error check on getPaymentResult
result?
Descriptions
Adds an extra edge case to the custom channels itest which verifieds that the rfq htlc tracking mechanism works as expected.
Related tapd PR: lightninglabs/taproot-assets#1186