Add testSuperMacaroonOnStartup to verify startup baking logic. The test
restarts the node with the auto-baking config flags and asserts the
macaroon is baked with read-only or read-write permissions accordingly.
Also add validation tests verifying that starting with an invalid path
suffix or in stateless-init mode with baking enabled fails as expected.
Verify permission addition/expansion by starting the node with sub-servers
disabled and then restarting with sub-servers re-enabled. Also verify
the none config choice, asserting that no super macaroon file is
baked/created on startup.
Add integration tests inside itest/litd_accounts_test.go to verify
retrieval of account payments against a running LND node, validating
correct responses for ID/label lookup, offsets, pagination limits,
and counting of total payments.
HarnessNode.Start calls WaitUntilStarted, then immediately reads
LitMacPath off disk via connectLitRPC to set up hn.litConn. But
WaitUntilStarted only polled subservers.LND's Running status, not LiT's
own - and litd only bakes and writes its default macaroons to disk
during its own startInternalSubServers step, strictly after LND is
marked Running but before LiT itself is. That left a window where the
harness read LitMacPath before litd had written it, failing with
"open .../lit.macaroon: no such file or directory"
(TestLightningTerminal/.../terminal_stateless_init_mode, CI run
29407791912).
Wait for subservers.LIT's Running status alongside the existing
per-subserver checks so callers can't observe LiT as "started" before
it has finished baking its macaroons.
The test node variable was reassigned in a later step. This broke the
deferred cleanup closure and leaked the reqlog-on node process.
The leaked process caused random cleanup timeouts under heavy test load.
Fixed by copying the node to a local variable before the defer.
Add a new sub-test case to verify that custom `entity:action`
permissions are correctly handled and enforced for LNC custom
sessions. The test uses the `info:read` permission to
assert that the connection can only query LND's GetInfo endpoint
and is blocked on other endpoints. Tests are added for both
integrated mode and remote mode suites.
Prompt before automatically migrating legacy kvdb state to SQL when
litd starts with a SQL backend and active bbolt data is still present.
Detect prior migrations by checking for the SQL tombstone marker so
already-migrated stores can start without prompting. Add unit coverage
for the prompt flow and wire stdin through the itest harness so the
migration restart path can acknowledge the prompt automatically.
Bumps lnd to v0.21.0-beta, lndclient to v0.21.0-1, and
taproot-assets to v0.8.0 across the root, litrpc, and perms
modules. taprpc uses the proper v1.1.0 tag.
lnd removed the deprecated SendPaymentSync, SendToRouteSync,
SendPayment (streaming), and SendToRoute (streaming) RPCs. The
account interceptor checkers and their tests for these RPCs are
removed since no client can call them anymore. The V2 checkers
already handle account tracking for payments.
The itest harness is updated for lnd v0.21's miner API changes
(SendOutputs -> SendOutput, Miner.Client.Generate -> GenerateBlocks,
waitForNTxsInMempool replaced by Miner.AssertNumTxsInMempool) and
TimeLockDelta bumped from 20 to 40 since lnd v0.21 raised
MinCLTVDelta from 18 to 24.
Expand the kvdb -> SQL migration itest to cover the full post-migration
startup behavior, not just the initial data copy and SQL assertions.
Verify that bbolt startup is blocked once kvdb files are deprecated,
that deleting the SQL database reruns the migration successfully, and
that older litd binaries still fail to start against deprecated kvdb
files.
Also add ordered blocker checks for the deprecated kvdb files so the
test shows startup fails first on accounts.db, then session.db, and
finally rules.db as earlier files are removed.
Close the process exit signal before forwarding litd startup errors from
the wait goroutine. This lets the harness observe that the process has
already exited even when no receiver is currently ready on the error
channel.
Use a non-blocking send for the captured process error so failed startup
paths do not hang the goroutine while holding back log finalization or
process exit handling.
This will be needed for the upcoming commit which adds itest coverage
of deprecated kvdb databases.
This commit implements an itest kvdb -> SQL migration itest. The
intention of the itest is to verify that the kvdb -> SQL migration flow
works for a litd node which has data inserted to the bbolt database.
To verify that, the minimum amount of data required to trigger the full
migration flow is inserted into the bbolt database, which is one object
to each database file. Those objects are:
* One account - accounts.DB file
* One session - session.db file
* One action - rules.db file
As the respective unit tests for each migration extensively tests that
data of all forms for each database file can successfully be migrated,
the itest only focuses on testing that the full migration flow works,
and leaves the responsibility of data variation coverage to the
respective unit test.
The test is executed in different steps, and uses RPCs to seed and
validate migration fixtures:
1. Start a node with a bbolt backend.
2. Insert one account, one session and one action via RPC.
3. Snapshot the inserted objects via RPC.
4. Restart with the configured SQL backend to trigger migration.
5. Query objects again via RPC.
6. Compare the new objects to the pre-migration snapshot.
7. Assert the migrated objects in SQL via direct queries, to verify that
it's actually the SQL database that contains the migrated objects.
Starting in grpc-go v1.67.0, clients and servers reject TLS handshakes when
ALPN is not negotiated. This changed the default value of
GRPC_ENFORCE_ALPN_ENABLED from false to true.
The default flip is in https://github.com/grpc/grpc-go/pull/7535
Our mailbox transport handshake can reach endpoints that currently do not
negotiate ALPN, so LNC session setup started failing and the lnc_auth flow
timed out, with malformed header/content-type errors showing up later on the
stream path.
This adds mailbox-specific TLS transport credentials that allow a missing
negotiated ALPN value for mailbox links. The mailbox server path and the
integration-test mailbox clients now use these credentials, so session
establishment works again.
Custom channels integration tests have been fully migrated to the
taproot-assets repository where they run natively via the tapd-integrated
binary without any lightning-terminal dependency. This removes the
duplicate test suite and all supporting infrastructure from LiT.
The LiT-specific itests are unaffected.
Bump `taproot-assets` to `v0.7.1` & `taprpc` to `v1.0.12`. This tapd
uses a new migrate dependency version, and therefore that is also bumped
in `litd`.
As the `tapd` `/universerpc.Universe/Info` call now requires a macaroon,
we need to add the `taproot-assets.allow-public-uni-proof-courier` to
the node config in order to whitelist the call.
This introduces a new firewall.request-logger.disable config option to
completely disable request logging. When disabled, the request logger
interceptor is not instantiated, avoiding all logging overhead including
database writes and request processing.
This is implemented as a separate disable flag rather than adding a new
log level because the goal is to bypass the logging system entirely for
performance reasons, not just filter events. A log level would still
process and filter each request through the interceptor.
The change also adds validation to ensure autopilot remains enabled only
when request logging is active, since autopilot relies on action logs
for rule enforcement and auditing.
Here we fix a nil pointer panic that is caused by an 'err' var being
deferenced before first checking that it is not nil. This was caused by
an oversite in a refactor commit that was attempting to improve line
length.
The mock oracle uses a self-signed certificate for TLS, but we're not
concerned with having tapd verify it in the itest environment. This
commit adds the 'experimental.rfq.priceoracletlsinsecure' flag added in
lightninglabs/taproot-assets#1775 to the litd args list, instructing
tapd not to verify certificates.
- Replace occurrences of `// nolint:lll` with `// nolint:ll` across
files for consistency.
- Reformat multiline strings, comments, and function parameters to
improve clarity and adhere to style guidelines.
- Add `// nolint:ll` comments where necessary to prevent linter
warnings.
- add tranche splitting/shuffling flags to the itest harness
- add itest-parallel target and scripts to run tranches concurrently
- write per-tranche logs under .logs/trancheN and tail failures for
clarity
With a upgrade to a never version of newer golang.org/x/tools/govet,
a lint check to check for legacy buildtag lines starting with
`// +build` has been added, as they're no longer needed.
In order for the `make lint` check to pass with the newer version, we
remove such buildtag lines.
Since we're now always using no-op HTLCs over all taproot assets
channels that support it, that means that certain liquidity related
assumptions do not hold anymore. In some test cases where we assume that
a satoshi balance was eventually accumulated we instead manually slosh
that balance as sats don't really shift in the channel balance over the
long term.
Changes the itest asset used in the decode payreq itest to instead be a
new variable declared within the scope of the itest. This prevents
mutating the global asset that is re-used by other test cases and would
lead to failures otherwise.
Thanks @jtobin for spotting.
Co-authored-by: Jared Tobin <jared@jtobin.io>
This commit mainly changes the returned type of the payment result for
asset payments. We create a struct TapPaymentResult which contains all
the related information for the outcome of an asset payment.
In preparation for the next commit which bumps golang to a newer
version, we want to make some code changes that would otherwise render
some log-related calls problematic. With go1.24 a new govet rule was
added that disallows non-constant strings (i.e including a tag like
"%s") in calls to printf. See more in the related issue
https://github.com/golang/go/issues/60529.
This commit tests that the routing policy of the correct peer (the
policy pointing toward the recipient of an invoice) is included in an
asset invoice.
Tests an edge case that previously lead to a force close due to the
following error:
unable to sort commitment transaction: output and allocation size mismatch with error
Having a below-dust satoshi balance is only allowed when there is no
asset balance. But since such a dust output isn't materialized on-chain,
tapd needs to filter it out correctly and not create an allocation.
Adds a test case to validate the fix in
lightninglabs/taproot-assets#1583, by adding a test that:
- Creates two asset channels between Alice and Bob
- Creates a BTC channel between Bob and Charlie
- The two asset channels each have a different asset in them
- The balance of the pences channel is decreased (lower bandwidth)
- An RFQ payment is attempted, with pences as the payment asset