Commit Graph

1331 Commits

Author SHA1 Message Date
yyforyongyu
6c56f33a70 lntest: fix error msg in ReceiveChannelEvent 2025-09-18 22:24:43 +08:00
Boris Nagaev
c86826ac5b lntest: fix error check in shutdownAllNodes
Previously the test failed only if the last node failed to shutdown. The code
was updated to fail if any node failed to shutdown.
2025-08-30 14:13:44 -03:00
Boris Nagaev
dee8ad3754 multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings.

This change was produced by:
 - running golangci-lint run --fix
 - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go`
 - manually fixing broken tests
 - itest, lntest: use ht.Context() where ht or hn is available
 - in HarnessNode.Stop() we keep using context.Background(), because it is
   called from a cleanup handler in which t.Context() is canceled already.
2025-08-30 14:13:44 -03:00
MPins
c00939d0a6 lntest: add functions for DeleteCanceledInvoice itest 2025-07-25 21:21:58 -03:00
Elle
add81f1388 Merge pull request #10064 from ellemouton/getChanInfoGrpcErr
rpcserver: return consistent grpc NotFound error for GetChaninfo & LookupInvoice
2025-07-14 08:34:46 +02:00
Oliver Gugger
63609b0801 Merge pull request #10061 from yyforyongyu/fix-listsweep-itest
itest+lntest: fix flake in `testListSweeps`
2025-07-11 00:25:48 -06:00
Torkel Rogstad
c8b04d03f5 itest+lntest: add grpc NotFound error code test 2025-07-10 11:36:20 +02:00
yyforyongyu
52d963bae0 itest+lntest: fix flake in testListSweeps
We now make sure we assert the `ListSweeps` results in a wait closure.
2025-07-09 20:52:02 +03:00
yyforyongyu
56fd8eeb43 lntest: add RPC SubscribePeerEvents
And a few assertion helpers.
2025-07-04 04:19:59 +08:00
yyforyongyu
624dc6c26a lntest: assert CustomRecords fields on channel policy
Make sure the `CustomRecords` field is asserted.
2025-07-01 19:59:50 +08:00
Elle Mouton
8cf567b948 multi: use the "errors" package everywhere
Replace all usages of the "github.com/go-errors/errors" and
"github.com/pkg/errors" packages with the standard lib's "errors"
package. This ensures that error wrapping and `errors.Is` checks will
work as expected.
2025-06-30 09:46:55 +02:00
Oliver Gugger
a9b530ce4a Merge pull request #9984 from starius/lntest-feeservice-mutex
lntest: do not do IO under mutex in fee_service
2025-06-24 14:09:10 +02:00
Elle Mouton
63fbd5fbcb lntest: make nobootstrap configurable
This will allow us to test bootstrapping in an itest.
2025-06-24 12:48:01 +02:00
Boris Nagaev
61b3670113 lntest: do not do IO under mutex in fee_service
If HTTP response is consumed slowly, this might block other HTTP requests to
the fee service, because the mutex is held.
2025-06-24 00:44:45 -03:00
yyforyongyu
343ae963b0 lntest: add a new basedir flag to keep test data 2025-06-23 17:29:26 +08:00
yyforyongyu
0d20e96e96 lntest: create GenBaseDir to generate the base dir 2025-06-23 17:28:48 +08:00
Boris Nagaev
9100be5ba5 lntest: add method P2PAddr to backend
It is useful if we want to keep bitcoind main itest mode, but connect one node
using neutrino.
2025-06-22 11:06:54 -03:00
Boris Nagaev
07217f2dd8 lntest: fix p2p port binding
Use an additional -bind flag instead of -port to specify the default p2p port.

Flag -port sets the default port number that will be used for any -bind or
-whitebind that does not explicitly specify a port. So if we have the p2p
port set in -port and the tor p2p port set in a single -bind, bitcoind binds
only one port - the tor p2p port. And the default p2p port remained not bound!
2025-06-22 11:06:54 -03:00
Boris Nagaev
3d0031435c lntest: serve compact filters for neutrino
Enable this in bitcoind mode as well to be able to let a subset of LND nodes
to use neutrino with bitcoind backend.
2025-06-22 11:06:49 -03:00
yyforyongyu
9caa5f220d itest+lntest: add more itest for accessman 2025-06-19 16:05:59 +08:00
yyforyongyu
26960e36ce htlcswitch+lntest: add more debug logs 2025-06-06 19:40:35 +08:00
Oliver Gugger
fc906f2a65 Merge pull request #9127 from MPins/issue-8993
Add the option on path creator to specify the incoming channel on blinded path
2025-06-05 08:47:05 +02:00
yyforyongyu
f97f60d3d4 lntest+itest: add testBumpFeeExternalInput 2025-05-26 19:41:24 +08:00
MPins
b95d48971d lntest: add the function RPC call to asserts errors on AddInvoice 2025-05-13 17:02:44 -03:00
yyforyongyu
8f936aa9eb itest: update num of sweeps in AssertNumPendingSweeps
Since we now return all sweeps, we need to update the call to include
immature sweeps.
2025-04-29 14:15:31 +08:00
András Bánki-Horváth
579f6f0f68 Merge pull request #9724 from bhandras/fundpsbt-custom-input-lock
walletrpc: allow custom lock ID and duration in `FundPsbt`
2025-04-17 17:31:48 +02:00
Andras Banki-Horvath
fbe645f96a itests: add FundPsbt custom lock ID and duration test 2025-04-17 15:25:12 +02:00
yyforyongyu
0daadb05bf lntest: add SendAllCoins and remove standby nodes context
Standby nodes are no longer used so we update `AssertNumUTXOs` to remove
the confusing check.
2025-04-17 09:32:28 +08:00
Oliver Gugger
6d648ad90a Merge pull request #9684 from ziggie1984/master
multi: update new walletdb version in main go.mod and kvdb go.mod
2025-04-14 15:56:16 +02:00
ffranr
24ba098798 lntest: assert shutdown via logs only if log handle is present
Ensure shutdown assertions through log inspection are only performed
when the harness node has an active log file handle. This avoids
errors during shutdown when log file output is disabled.
2025-04-11 15:30:13 +01:00
ziggie
490347b056 multi: update walletdb package 2025-04-09 18:47:53 +02:00
Olaoluwa Osuntokun
1fc2c64770 itest: test all combos of rbf close and taproot chans
In this commit, we test all the combinations of rbf close and taproot
chans. This ensures that the downgrade logic works properly.

Along the way we refactor the tests slightly, and also split them up, as
running all the combos back to back mines more than 50 blocks in a test,
which triggers an error in the itest sanity checks.
2025-04-03 16:23:36 -07:00
yyforyongyu
64f7a7f3d0 lntest+itest: update block height in MineBlockWithTx
Make sure we update the harness's current height and assert nodes have
been synced. Also fixes some typo found.
2025-03-26 18:24:47 +08:00
yyforyongyu
883381d266 lntest+itest: return the tx from FundCoins
This is used is a following test.
2025-03-26 18:24:46 +08:00
Oliver Gugger
0aea482b51 multi: add testnet4 support 2025-03-24 11:53:23 -05:00
yyforyongyu
652d39dcc7 itest: fix flakeSkipPendingSweepsCheckDarwin
Now that we have the new RPC to assert the HTLC state, this flake should
be fixed.
2025-03-21 03:25:24 +08:00
Yong
09b6745086 Merge pull request #9600 from lightningnetwork/yy-more-flakes
lntest+itest: document and fix more flakes
2025-03-21 03:23:02 +08:00
Olaoluwa Osuntokun
3681ba6d8b peer: for RBF state machine block req if RBF iterating is outstanding
This fixes an issue in the itests in the restart case. We'd see an error
like:
```
2025-03-12 23:41:10.754 [ERR] PFSM state_machine.go:661: FSM(rbf_chan_closer(2f20725d9004f7fda7ef280f77dd8d419fd6669bda1a5231dd58d6f6597066e0:0)): Unable to apply event err="invalid state transition: received *chancloser.SendOfferEvent while in ClosingNegotiation(local=LocalOfferSent(proposed_fee=0.00000193 BTC), remote=ClosePending(txid=07229915459cb439bdb8ad4f5bf112dc6f42fca0192ea16a7d6dd05e607b92ae, party=Remote, fee_rate=1 sat/vb))"
```

We resolve this by waiting to send in the new request unil the old one
has been completed.
2025-03-18 11:44:59 -05:00
Olaoluwa Osuntokun
971ac5a14d itest: add new RBF coop close itest
The itest has both sides try to close multiple times, each time with
increasing fee rates. We also test the reconnection case, bad RBF
updates, and instances where the local party can't actually pay for
fees.
2025-03-18 11:44:57 -05:00
Olaoluwa Osuntokun
fbc67f7610 lntest+itest: extend CloseChannelAssertPending
In this commit, we extend `CloseChannelAssertPending` with new args that
returns the raw close status update (as we have more things we'd like to
assert), and also allows us to pass in a custom fee rate.
2025-03-18 11:44:21 -05:00
Olaoluwa Osuntokun
2899a757c4 lntest: fix error message in WaitForChannelCloseEvent
Resp is always nil, so we actually need to log event.Update here.
2025-03-18 11:44:21 -05:00
yyforyongyu
d122a2ecc6 itest+lntest: add flakePaymentStreamReturnEarly
Fix the flake found in the `testRelayingBlindedError` and documents the
flake found in other tests in one place.
2025-03-18 20:24:34 +08:00
yyforyongyu
e0296083ca itest+lntest: fix flake in coopCloseWithHTLCsWithRestart
Previously we'd restart Alice and then restart Bob, which means once
Alice is shut down and started again before we shut down Bob, Bob will
attempt to connect Alice since the connection is permanent, which could
put the node in a weird state. We now make sure both nodes are shut down
first, then bring them back online to avoid the above case. We may,
however, create another test in the future to check the above case if needed.
2025-03-18 20:24:34 +08:00
Oliver Gugger
25c83104b7 lntest: make mining block limit configurable
Nudging test authors towards not mining too many blocks makes sense,
especially in lnd where we have a lot of integration tests.
But the lntest package is also used in other projects where this
restriction might lead to large refactors.
To be able to stage those refactors we also want to allow this limit to
be configurable if lntest is used as a library.
2025-03-07 09:22:51 +01:00
Elle Mouton
57c6c236d8 lntest: wait for ChanUpdate req to be fully processed before sending another
Before this commit, it was possible for a request to be sent on the
`chanWatchRequests` channel in `WaitForChannelPolicyUpdate` and then for
the `ticker.C` case to select _before_ the `eventChan` select gets
triggered when the `topologyWatcher` closes the `eventChan` in its call
to `handlePolicyUpdateWatchRequest`. This could lead to a "close of a
closed channel" panic.

To fix this, this commit ensures that we only move on to the next
iteration of the select statement in `WaitForChannelPolicyUpdate` once
the request sent on `chanWatchRequests` has been fully handled.
2025-03-03 17:53:15 +02:00
yyforyongyu
2d5a2ce78a lntest+itest: change the method signature of AssertPaymentStatus
So this can be used in other tests when we only care about the payment
hash.
2025-02-28 19:07:38 +08:00
yyforyongyu
4bfcfea2ee lntest+chainntnfs: make sure bitcoind node is synced
This commit makes sure the bitcoind node is synced to the miner when
initialized and returned from `NewBitcoindBackend`.
2025-02-26 19:51:52 +08:00
yyforyongyu
99d49dec6a multi: change NewBitcoindBackend to take a miner as its param
Prepares for the following commit where we assert the chain backend is
synced to the miner.
2025-02-26 19:51:52 +08:00
yyforyongyu
1618d2c789 chainntnfs+lntest: fix sync to miner block flake
In this commit we document an unexpected behavior found when connecting
a bitcoind node to a btcd node. We mitigate this in our test by
reconnecting the nodes when the connection is broken. We also limit the
connection made from `bitcoind` to be v1 only.
2025-02-26 19:51:52 +08:00
yyforyongyu
175301628f lntest/unittest: make sure miner is connected to bitcoind
We change how the `bitcoind` node connects to the miner by creating a
temp RPC client and use it to connect to the miner. In addition we also
assert the connection is made.
2025-02-25 21:11:26 +08:00