Commit Graph

213 Commits

Author SHA1 Message Date
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
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
yyforyongyu
26960e36ce htlcswitch+lntest: add more debug logs 2025-06-06 19:40:35 +08: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
yyforyongyu
883381d266 lntest+itest: return the tx from FundCoins
This is used is a following test.
2025-03-26 18:24:46 +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
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
ziggie
f458844412 lnd: add max fee rate check to closechannel rpc 2025-02-20 17:43:18 +01:00
yyforyongyu
7ab4081ffd lntest: make sure chain backend is synced to miner
We sometimes see `timeout waiting for UTXOs` error from bitcoind-related
itests due to the chain backend not synced to the miner. We now assert
it's synced before continue.
2024-12-20 19:38:14 +08:00
yyforyongyu
31b66962d8 lntest: properly handle shutdown error
This commit removes the panic used in checking the shutdown log.
Instead, the error is returned and asserted in `shutdownAllNodes` so
it's easier to check which node failed in which test. We also catch all
the errors returned from `StopDaemon` call to properly access the
shutdown behavior.
2024-12-20 19:38:14 +08:00
yyforyongyu
becbdce64c lntest: limit the num of blocks mined in each test 2024-12-20 19:38:13 +08:00
yyforyongyu
5236c05dc6 itest+lntest: add new method FundNumCoins
Most of the time we only need to fund the node with given number of
UTXOs without concerning the amount, so we add the more efficient
funding method as it mines a single block in the end.
2024-12-20 19:38:13 +08:00
yyforyongyu
39104c53d4 lntest: fix flakeness in openChannelsForNodes
We now make sure the channel participants have heard their private
channel when opening channels.
2024-12-20 19:38:09 +08:00
yyforyongyu
010a4f1571 lntest: add human-readble names and check num of nodes 2024-12-20 19:38:06 +08:00
yyforyongyu
00772ae281 itest+lntest: remove standby nodes
This commit removes the standby nodes Alice and Bob.
2024-12-20 19:38:06 +08:00
yyforyongyu
de8f14bed2 itest: remove the use of standby nodes
This commit removes the usage of the standby nodes and uses
`CreateSimpleNetwork` when applicable. Also introduces a helper method
`NewNodeWithCoins` to quickly start a node with funds.
2024-12-20 19:38:05 +08:00
yyforyongyu
a1bd8943db lntest+itest: export DeriveFundingShim 2024-12-20 17:54:12 +08:00
yyforyongyu
b7feeba008 itest+lntest: fix channel force close test
Also flatten the tests to make them easier to be maintained.
2024-12-20 17:54:12 +08:00
yyforyongyu
9ab9cd5f99 lntest+itest: start flattening the multi-hop tests
Starting from this commit, we begin the process of flattening the
multi-hop itests to make them easier to be maintained. The tests are
refactored into their own test cases, with each test focusing on testing
one channel type. This is necessary to save effort for future
development.

These tests are also updated to reflect the new `blockbeat` behavior.
2024-12-20 17:54:09 +08:00
Keagan McClelland
ed2989ae33 multi: update to fn v2 2024-12-04 13:19:00 -07:00
yyforyongyu
653a8ac55e lntest+itest: add new method AssertChannelInGraph
This commit replaces `AssertTopologyChannelOpen` with
`AssertChannelInGraph`, which asserts a given channel edge is found.
`AssertTopologyChannelOpen` only asserts a given edge has been received
via the topology subscription, while we need to make sure the channel is
in the graph before continuing our tests.
2024-11-12 23:55:40 +08:00
yyforyongyu
7dda2960a5 lntest: update the block height of HarnessTest during start 2024-11-12 23:55:40 +08:00
yyforyongyu
2905e7b3df lntest+itest: kill node and wait its process
Fix a flake found in `testRPCMiddlewareInterceptor` when running in
macOS.
2024-11-12 23:55:40 +08:00
yyforyongyu
6ac588e655 lntest: remove an invalid check
`openChannelsForNodes` is called inside `openZeroConfChannelsForNodes`
so this value can be true.
2024-11-12 14:46:30 +08:00
yyforyongyu
35992e1503 lntest+itest: expore method createSimpleNetwork
So it can be used via `ht.CreateSimpleNetwork`.
2024-11-11 20:57:49 +08:00
yyforyongyu
a745d74e7c lntest: make sure standby nodes' edges are cleaned 2024-11-11 20:54:10 +08:00
ziggie
7b2da94750 multi: deprecate dust-treshold config value
Replace ambigious config value "dust-treshold" with a more clear
"channel-max-fee-exposure" exposure value. The old value is
deprecated and will be removed in the near future.
2024-11-06 18:16:06 +01:00
yyforyongyu
21535826ba lntest: remove redundant MineBlocks 2024-10-29 15:31:21 +08:00
Oliver Gugger
5f20fd4d9f lntest: shutdown all nodes at end of test
Fixes an issue where the standby nodes would keep running even after the
test finished (successfully or with a failure).
2024-10-22 18:12:16 +02:00
yyforyongyu
ed3cb26188 itest+lntest: stop using pointer to chainhash.Hash
This commit fixes the methods used in `lntest` so they stop using
pointers to chainhash.
2024-10-17 07:14:51 +08:00
ffranr
0c6a1558d5 lntest: add HtlcModifier support to node RPC harness
This commit enhances the itest LND node harness to include support for
the new `HtlcModifier` RPC endpoint.
At the same time we move another method to the correct file.
2024-09-19 09:21:38 +02:00
yyforyongyu
677f2c390a lntest: re-define CleanupForceClose
To reflect the new sweeping behavior, also makes it easier to be used as
we need to method to quickly cleanup force closes without concerning the
details when we are not testing the force close behavior.
2024-08-07 22:19:23 +08:00
yyforyongyu
941716d60e lntest+itest: add new test testPaymentHTLCTimeout
This commit adds a new test case to validate that when an HTLC has timed
out, the corresponding payment is marked as failed.
2024-08-07 22:17:58 +08:00
yyforyongyu
a1d71afde8 lntest: allow specifying min relay feerate in itest 2024-07-24 20:05:00 +08:00
yyforyongyu
623f816f8e lntest: remove redundant nodes shutdown
The nodes are already shut down in the `Cleanup` in `ht.Subtest` so
there's no need to shutdown them again.
2024-07-23 21:30:08 +08:00
yyforyongyu
f1f341095e lntest+itest: add new method CurrentHeight 2024-07-23 21:30:08 +08:00
yyforyongyu
14e7b134d9 lntest+itest: make Miner a private instance 2024-07-23 21:30:08 +08:00
yyforyongyu
6bd8baea38 lntest+itest: continue removing direct call to Miner 2024-07-23 21:30:07 +08:00
yyforyongyu
976bb37972 lntest+itest: add method AssertNumTxsInMempool and AssertTxInBlock
in harness

Prepare to make `HarnessTest.Miner` a private instance to sync height.
2024-07-23 21:30:07 +08:00
yyforyongyu
e553895ddd lntest+itest: strictly define the behavior of MineBlocks
This commit adds more assertion to `MineBlocks` so the caller won't
misuse it.
2024-07-23 21:30:07 +08:00
yyforyongyu
91b20e661b lntest: move mining methods into one file 2024-07-23 21:30:07 +08:00
yyforyongyu
a881477404 lntest: create new package lntest/miner for itest miner
This commit moves the `HarnessMiner` into a new package to avoid
confusion about incoming changes.
2024-07-23 21:30:07 +08:00
Keagan McClelland
56048133f2 itest+lntest: add itest to reproduce bug #8535 2024-06-05 12:56:04 -07:00
yyforyongyu
55452f64e8 lntest: wait for mempool update after mining txns 2024-06-04 09:07:43 +02:00
yyforyongyu
8da68bb7db multi: apply the new type lntypes.WeightUnit 2024-05-25 13:37:13 +08:00
Olaoluwa Osuntokun
e8031fdccf lnrpc: ensure parsing of the Amp flag for payments is consistent
In this commit, we fix an inconsistent in the API related to AMP
payments. When a payment request isn't specified, we require the `--amp`
flag on the CLI to make an AMP payment. However, for payment requests,
we don't require this flag. To fix this inconsistency, we now require
the `--amp` flag to _also_ be set for payment requests.
2024-04-25 16:16:16 -07:00
ziggie
351e9a68dd multi: Add tests to psbt and normal open channel flow.
Itests were added to the normal channel funding flow and the psbt
funding flow using unstable (unconfirmed sweeper inputs).
2024-04-24 13:58:20 +01:00
yyforyongyu
d854c80aa7 itest+lntest: fix itest re the new sweeping behavior 2024-04-20 04:41:29 +08:00