lightninglabs / lightninglabs/taproot-assets
itest: `TestCustomChannels/list_invoices_and_payments` flake
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 525
- Forks
- 150
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
(Fable's summary follows.)
## Observed failure
CI run (PR #2266, unrelated branch):
https://github.com/lightninglabs/taproot-assets/actions/runs/33506792003/job/99854037126
```
list_asset_rpcs_test.go:340:
Error: Should NOT be empty, but was []
Test: TestCustomChannels/list_invoices_and_payments
```
The assertion is:
```go
require.NotEmpty(t.t, canceledInv.Invoice.Htlcs)
```
i.e. the canceled hodl invoice on Bob has no HTLC records.
## Analysis
The test pays an asset hodl invoice expecting `Payment_IN_FLIGHT`, then
immediately cancels it (`list_asset_rpcs_test.go:235-246`):
```go
payInvoiceWithAssets(
t.t, alice, bob, canceledInvoice.payReq, assetID,
withFailure(lnrpc.Payment_IN_FLIGHT, failureNone),
)
...
_, err = bob.InvoicesClient.CancelInvoice(...)
```
`payInvoiceWithAssets` returns on Alice's first in-flight payment
update, which fires before the HTLC is locked in. Nothing waits for
Bob's invoice registry to accept the HTLC, so the cancel can win the
race. In that case the invoice is already CANCELED when the HTLC
arrives; lnd fails it at the link without recording it on the invoice,
leaving `Invoice.Htlcs` empty.
The rest of the log is consistent with this: the retry loop before the
failing line passes (invoice listed as CANCELED, no asset amounts) and
Alice's payment reports FAILED.
The settled-hodl sibling case can't race the same way: a premature
`SettleInvoice` would fail loudly at the RPC call.
## Suggested fix
Before calling `CancelInvoice`, subscribe to the invoice with
`SubscribeSingleInvoice` and wait for `Invoice_ACCEPTED` using the
existing `assertLNDInvoiceState` helper (as done in
`strict_forwarding_test.go`).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in list_asset_rpcs_test.go around the canceled-invoice flow at lines 235-246, then read assertLNDInvoiceState and the SubscribeSingleInvoice usage in strict_forwarding_test.go. Run TestCustomChannels/list_invoices_and_payments; done means the test waits for Invoice_ACCEPTED before CancelInvoice and no longer flakes with an empty Invoice.Htlcs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100