Commit Graph

1164 Commits

Author SHA1 Message Date
yyforyongyu
2c12c8a77c
multi: refactor testListAddresses 2022-11-17 20:29:51 +08:00
yyforyongyu
4104a72b3a
lntemp+itest: refactor testNodeSignVerify 2022-11-17 20:29:51 +08:00
yyforyongyu
1938e42f4e
itest: refactor testRejectHTLC 2022-11-17 20:29:51 +08:00
yyforyongyu
0c8bce0c1c
itest: refactor testGarbageCollectLinkNodes 2022-11-17 20:29:51 +08:00
yyforyongyu
ba61e9edff
itest+lntemp: refactor testMaxPendingChannels 2022-11-17 20:29:51 +08:00
yyforyongyu
d1ac08b336
itest+lntemp: refactor testListChannels 2022-11-17 20:29:50 +08:00
yyforyongyu
5336c8e5f5
multi: refactor testSphinxReplayPersistence 2022-11-17 20:29:50 +08:00
yyforyongyu
f5ebaa5f35
multi: refactor testDisconnectingTargetPeer 2022-11-17 20:29:50 +08:00
yyforyongyu
d39303f246
itest: wrap assertTxLabel inside wait 2022-11-17 20:29:50 +08:00
yyforyongyu
bbe69f1bd3
multi: refactor testSweepAllCoins 2022-11-17 20:29:50 +08:00
alpeb-btc
0cae501009
lnrpc: provide hop hints when adding an invoice with no amount
With this change we allow adding hop hints when adding an invoice, even
if its amount is zero.

A couple of new unit test case have been added, and the
`testInvoiceRoutingHints` itest was expanded to account for this
scenario.
2022-11-12 05:01:10 -05:00
alpeb-btc
a96483c7d2
itest: refactor testInvoiceRoutingHints' hints check logic
Move code into new closure `checkInvoiceHints` to reuse when checking
other invoices.
2022-11-12 05:01:09 -05:00
Oliver Gugger
b3f6fe315e
itest: add test coverage for Taproot tweak key mutation 2022-11-11 10:20:09 +01:00
Oliver Gugger
e3536dd770
mod+keychain+lntest: bump btcd to version with tweak fix
This commit bumps to the latest version of btcd that fixes a key
mutation issue when signing for Taproot outputs.
2022-11-11 10:20:08 +01:00
yyforyongyu
b7816489a1
itest: add temp fix to bring back btcd build 2022-11-10 13:59:17 +08:00
Joost Jager
511fb00777
htlcswitch: add final htlc event to notifier 2022-10-27 16:42:36 +02:00
Joost Jager
b85cda2a1d
routerrpc: add htlc notifier subscribed event 2022-10-27 16:42:35 +02:00
Slyghtning
8e53996c52 itest: test ForwardingHistory peer lookup opt-in behavior 2022-10-27 07:11:20 -04:00
yyforyongyu
14f45d0722
lntemp+lntest: fix make lint 2022-10-27 01:11:35 +08:00
yyforyongyu
42eab93ba0
lntemp+lntest: use t.Cleanup to register cleanup functions 2022-10-27 01:11:34 +08:00
yyforyongyu
ab62109865
lntemp+lntest: always wait for nodes sync after mining blocks
In this commit, we introduce two mining methods, `MineBlocks` and
`MineBlocksAndAssertNumTxes`, to `HarnessTest`. These methods are
different from the miner's methods as they would 1) mine the blocks
slowly and 2) assert all active nodes have synced. The miner's methods
are kept for future tests such as mining blocks really fast and see the
behavior of `lnd`.
2022-10-27 01:11:34 +08:00
yyforyongyu
f202d27324
itest: break testChannelBackupRestore into smaller tests
This commit breaks the large `testChannelBackupRestore` into smaller
tests to take advantage of our parallel testing framework. A smaller
test also makes the debugging easier, hence better code health.
2022-10-27 01:11:34 +08:00
yyforyongyu
78de9dae05
itest: break testMultiHopHtlcClaims into smaller test cases
This commit breaks the large `testMultiHopHtlcClaims` into independent
test cases to take the advantage of parallel testing. The old setup will
put the stress of creating and syncing new blocks into a single core,
which causes a much longer test time and sometimes times out.
2022-10-27 01:11:34 +08:00
yyforyongyu
3f14ee5870
itest: fix testMultiHopHtlcRemoteChainClaim and linters
This commit makes sure the test `testMultiHopHtlcRemoteChainClaim` takes
account of the one block mined while closing the channel.
2022-10-27 01:11:34 +08:00
yyforyongyu
47279fb9af
itest: fix testMultiHopHtlcLocalChainClaim 2022-10-27 01:11:34 +08:00
yyforyongyu
4668193cfa
itest: fix testMultiHopLocalForceCloseOnChainHtlcTimeout 2022-10-27 01:11:34 +08:00
yyforyongyu
b6cc13417c
itest: move multi hop claim tests into one file 2022-10-27 01:11:33 +08:00
yyforyongyu
c3bc4d403c
itest: reduce blocks mined to save sync time 2022-10-27 01:11:33 +08:00
yyforyongyu
b463147595
itest: refactor testMultiHopHtlcAggregation 2022-10-27 01:11:33 +08:00
yyforyongyu
0115ec8719
itest: refactor testMultiHopHtlcRemoteChainClaim 2022-10-27 01:11:33 +08:00
yyforyongyu
200796b8e2
itest: refactor testMultiHopHtlcLocalChainClaim 2022-10-27 01:11:33 +08:00
yyforyongyu
f65002255c
itest: refactor testMultiHopRemoteForceCloseOnChainHtlcTimeout 2022-10-27 01:11:32 +08:00
yyforyongyu
6b5f4f407c
itest: refactor testMultiHopLocalForceCloseOnChainHtlcTimeout 2022-10-27 01:11:32 +08:00
yyforyongyu
d51f98efc6
itest: refactor testMultiHopReceiverChainClaim 2022-10-27 01:11:32 +08:00
yyforyongyu
5a7c6cea02
lntest+lntemp: refactor testMultiHopHtlcLocalTimeout 2022-10-27 01:11:32 +08:00
yyforyongyu
4a7f45b5d4
itest+lntemp: refactor testMultiHopHtlcClaims 2022-10-27 01:11:32 +08:00
yyforyongyu
e629a3b45a
itest: deprecate createThreeHopNetwork 2022-10-27 01:11:32 +08:00
yyforyongyu
36c84bbd43
itest: refactor testDataLossProtection 2022-10-27 01:11:32 +08:00
yyforyongyu
1fafabe012
itest: move testDataLossProtection to backup test file 2022-10-27 01:11:31 +08:00
yyforyongyu
8cd5a9b6b1
itest: refactor testChannelBackupRestore 2022-10-27 01:11:31 +08:00
yyforyongyu
2966773018
lntemp: add more assertions and supporting methods 2022-10-27 01:11:31 +08:00
yyforyongyu
1b741cb6cc
itest: refactor testExternalFundingChanPoint 2022-10-27 01:11:30 +08:00
yyforyongyu
773cc8e295
itest: refactor testBasicChannelFunding
The test `testExternalFundingChanPoint` is commented out and will be put
back in the following commit.
2022-10-27 01:11:30 +08:00
yyforyongyu
85210b947f
itest: deprecate deriveFundingShim 2022-10-27 01:11:30 +08:00
Slyghtning
85f0ec2954 itest: check peer alias in ForwardingHistory 2022-10-20 09:23:50 -04:00
yyforyongyu
353b744039
lntemp+itest: create interface WebFeeService
This commit adds a new interface, `WebFeeService`, so external projects
can create their own mocked fee services.
2022-10-14 15:45:25 +08:00
yyforyongyu
9d79e76876
itest: timeout while waiting for predicate result
This commit sends the returned value of pred() inside a goroutine such
that when a predicate function never returns during the first run, the
wait package can timeout properly.
2022-10-14 15:45:24 +08:00
yyforyongyu
2ab842c645
itest: refactor test testUpdateChanStatus 2022-10-14 15:45:24 +08:00
yyforyongyu
1350f76627
itest: add a new test entry point to run the temp tests
This commit adds a new function, `TestLightningNetworkDaemonTemp`, to
run the new tests.
2022-10-14 15:45:24 +08:00
yyforyongyu
cd5ab844e2
lntest: export flag logoutput
This commit temporarily exports the flag `logoutput` so it can be used
by `lntemp`.
2022-10-14 07:25:29 +08:00
yyforyongyu
55f8a621ae
lntest+github: add flag temptest to run tests separately
This commit adds a new flag `temptest` so we can run new and old tests
separately. This flag will be removed once the migration from old tests
to new tests is finished.
2022-10-14 07:25:28 +08:00
Olaoluwa Osuntokun
2482de9cab
lnwallet/chancloser: properly compute initial fee of cop close txn
In this commit, we modify the way we compute the starting ideal fee for
the co-op close transaction. Before thsi commit, channel.CalcFee was
used, which'll compute the fee based on the commitment transaction
itself, rathern than the co-op close transaction. As the co-op close
transaction is potentailly bigger (two P2TR outputs) than the commitment
transaction, this can cause us to under estimate the fee, which can
result in the fee rate being too low to propagate.

To remedy this, we now compute a fee estimate from scratch, based on the
delivery fees of the two parties.

We also add a bug fix in the chancloser unit tests that wasn't caught
due to loop variable shadowing.

The wallet import itest has been updated as well, since we'll now pay
600 extra saothis to close the channel, since we're accounting for the
added weight of the P2TR outputs.

Fixes #6953
2022-10-10 14:50:45 -07:00
Slyghtning
41822a8baf itest: openchannel fee scenarios 2022-09-29 08:31:47 -04:00
Olaoluwa Osuntokun
d062a5263e
build: update to latest version of btcwallet w/ taproot estimation fix
Fixes https://github.com/lightningnetwork/lnd/issues/6873
2022-09-27 11:24:39 -07:00
Jesse de Wit
4bc3007668
lntest: add trackpayments itest
Add an itest for the new TrackPayments api.
2022-09-08 10:48:34 +02:00
Oliver Gugger
c45d0f6b07
itest: add integration tests for tapscript import
We add basic integration test coverage for importing Tapscript
addresses. Note that FundPsbt is not supported with those types of
imported keys, so we need to manually fill in all information in the
PSBT to be able to sweep the funds again.
2022-08-25 09:21:52 +02:00
Oliver Gugger
0d6e791042
lntest+lnwallet: add ImportTaprootScript to wallet interface 2022-08-25 09:20:23 +02:00
Oliver Gugger
3a66a09d9d
itest: test BIP-0086 Taproot account+pubkey import 2022-08-25 09:20:23 +02:00
Eng Zer Jun
ca5c695526
lntest/itest: use T.TempDir to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-24 09:03:04 +08:00
yyforyongyu
0735522194
multi: fix make fmt 2022-08-23 22:10:24 +08:00
priyanshiiit
3105d6a2ec lntest: adds test for list addresses 2022-08-18 08:09:16 +05:30
priyanshiiit
99e4728eb7 lnwallet: adds list addresses method 2022-08-18 07:58:24 +05:30
Slyghtning
b2e624cd52 psbt: Indicate which psbt inputs were signed 2022-08-16 19:31:06 -04:00
eugene
48912560e2
lntest: update zero-conf tests to account for zeroconfacceptor 2022-08-12 16:36:17 -04:00
Olaoluwa Osuntokun
3bf2790e21
lntest/itest: add new itest to cover taproot co-op close 2022-08-10 18:44:39 -07:00
Oliver Gugger
17014b592e
Merge pull request #6730 from Roasbeef/notifier-optional-block
chainntfns: add new option for conf notifications to send block
2022-08-10 13:52:49 +02:00
eugene
6ec2826f6c
sweep: account for all script types in craftSweepTx
With this change, transactions created via craftSweepTx will be
standard. Previously, p2wsh/p2pkh scripts passed in via SendCoins would
be weighted as p2wpkh scripts. With a feerate of 1 sat/vbyte,
transactions returned would be non-standard. Luckily, the critical
sweeper subsystem only used p2wpkh scripts so this only affected
callers from the rpcserver.

Also added is an integration test that fails if SendCoins manages
to generate a non-standard transaction. All script types are now
accounted for in getWeightEstimate, which now errors if an unknown
script type is passed in.
2022-08-08 15:33:00 -04:00
Olaoluwa Osuntokun
89dc75cd90
lntest/itest: add test case for conf ntfn w/ block
In this commit, we add a test case to exercise the fact that if we
request a confirmation notification with the raw block, then it includes
one. We add this to the existing test that uses the conf ntfn rpc call
for simplicity.
2022-08-01 19:59:33 -07:00
Olaoluwa Osuntokun
08f1c2e93a
chainntfns: add new option for conf notifications to send block
In this commit, we add a new option for the existing confirmation
notification system that optionally allows the caller to specify that a
block should be included as well.

The only quirk w/ the implementation here is the neutrino backend:
usually we get filtered blocks, we so need to first fetch the block
again so we can deliver the full block to the notifier. On the notifier
end, it'll only be checking for the transactions we care about, to
sending a full block doesn't affect the correctness.

We also extend the `testBatchConfirmationNotification` test to assert
that a block is only included if the caller specifies it.
2022-08-01 19:59:21 -07:00
Olaoluwa Osuntokun
fec8fd9c63
Merge pull request #6754 from ellemouton/ensureRpcRegistrationOrder
multi: synchronous rpc middleware registration
2022-07-26 19:05:30 -05:00
Elle Mouton
25acb51ba3
multi: registration complete MW interceptor msg
In this commit, we change the flow of the rpc middleware registration
a bit. In order to allow a client to add rpc middleware interceptors in
a deterministic order, we now make the server send a "registration
complete" message to the client after compeleting the registration
process so that the client knows when it can go ahead and register the
next client.
2022-07-20 14:58:47 -05:00
Matt Morehouse
7a05f07634
itest: fix sign_psbt failure
Ensure the wallet has synced the blockchain before attempting to spend
funds.

Prior to this fix, I get the following error:
  rpc error: code = Unknown desc = wallet couldn't fund PSBT: error
      creating funding TX: insufficient funds available to construct
      transaction
2022-07-19 12:41:34 -05:00
ErikEk
14453ea7db
itest: cover sign and verify msg 2022-07-14 10:29:29 +02:00
ErikEk
b5af0ce327
signrpc: add schnorr sig to sign and validate msg 2022-07-14 10:29:29 +02:00
Oliver Gugger
9774db614b
itest: add integration test for error interception 2022-07-14 09:36:50 +02:00
Oliver Gugger
e1efb39177
itest: add integration test for request replacement 2022-07-14 09:36:50 +02:00
Oliver Gugger
989648b7ec
itest: fix timeout in sign_psbt test 2022-07-08 16:08:21 +02:00
Oliver Gugger
6980a18ab1
Merge pull request #6712 from Roasbeef/itest-keep-failed-payments
lntest: keep all failed payments by default for HarnessNode
2022-07-08 14:31:37 +02:00
Olaoluwa Osuntokun
2a18263336
lntest: keep all failed payments by default for HarnessNode
In this commit, we fix a detected flake: we go to make a payment, and
then want to assert that 2 attempts we required. The existing logic
assumes that the success and the payment will still be on disk. With a
recent PR, we now delete failed payments by default, but after the fact,
in a non-atomic fashion.

We fix this issue simply by having all the nodes keep around failed
payments for the sake of all the old itests that assumed this
information would always be on disk.

Introduced in: https://github.com/lightningnetwork/lnd/pull/6438.

Fixes https://github.com/lightningnetwork/lnd/issues/6711.
2022-07-07 19:28:30 -07:00
eugene
5e0a2d3f92
itest: zero-conf, scid-alias channel-type integration tests 2022-07-07 17:10:30 -04:00
eugene
49dd4b9e34
multi: add zero-conf, scid-alias channel-types to rpc
This allows the open channel rpcs to use the zero-conf or scid-alias
channel types.
2022-07-07 17:10:30 -04:00
Oliver Gugger
3af42eede9
Merge pull request #6687 from guggero/sign-psbt-np2wkh
walletrpc: Fix SignPsbt for NP2WKH inputs
2022-06-30 12:18:12 +02:00
Oliver Gugger
bb3cec6b12
itest: add test for FundPsbt->SignPsbt|FinalizePsbt flow 2022-06-30 10:27:39 +02:00
Oliver Gugger
9d339f0fe2
Merge pull request #6680 from guggero/compute-input-script
Taproot: Fix p2tr support in `ComputeInputScript`
2022-06-30 10:11:11 +02:00
eugene
a7f5b89cf3
itest: update switch delivery tests with more robust reconnect logic 2022-06-29 13:50:03 -04:00
Oliver Gugger
825ff22eec
itest: add itest for p2tr via ComputeInputScript 2022-06-29 18:29:00 +02:00
Oliver Gugger
6ee4c533f4
itest: fix incorrect naming 2022-06-29 18:29:00 +02:00
Oliver Gugger
21f69192be
itest: rename too specific variables 2022-06-29 18:29:00 +02:00
priyanshiiit
ec9cebea34 lntest: adds check for reserve 2022-06-28 23:31:51 +05:30
priyanshiiit
150c0b5de8 lnwallet: adds RequiredReserve method 2022-06-28 23:31:51 +05:30
priyanshiiit
f6d21d9b1b lntest: adds test for previous outpoints 2022-06-27 16:00:40 +05:30
yyforyongyu
6b34ebbe44
rpcserver: fix wrong unit used in PushAmountSat 2022-05-16 05:49:05 +08:00
Oliver Gugger
70103a1838
multi: return more information in list of leased outputs
With this commit we return the additional information the wallet now
provides about locked/leased outputs.
2022-05-12 10:24:40 +02:00
Oliver Gugger
6c495c1bbe
itest: add Taproot PSBT signing tests 2022-05-11 10:07:51 +02:00
Oliver Gugger
fe30b9e987
itest: refactor PSBT signing itest 2022-05-11 10:07:51 +02:00
Oliver Gugger
d1a151010a
lntest+rpcwallet: support remote p2tr script spend signing 2022-05-11 10:07:51 +02:00
Oliver Gugger
7f4e977073
lntest+rpcwallet: support remote p2tr key spend signing 2022-05-11 10:07:50 +02:00
Olaoluwa Osuntokun
630fc36dcf
multi: introduce and use new TapTweak and SignMethod fields
In this commit, we add a new field `TapTweak` to be used for key path
spends. Before this commit, we'd overload the existing `WitnessScript`
field to pass this information to the signing context. This was
confusing as for tapscript spends, this was the leaf script, which
mirrors the other script based spending types.

With this new filed, users need to set this to the script root for
keypath spends where the output key commits to a real merkle root, and
nothing when bip 86 spending is being used.

To make the signing even more explicit, we also add a new field called
sign_method with an enum type that differentiates between the different
segwit v0 and v1 signing methods.

Fixes https://github.com/lightningnetwork/lnd/issues/6446.
2022-05-11 10:07:49 +02:00
Elle Mouton
e789107e1f
multi: new bitcoind rpcpolling backend for itests 2022-05-11 09:02:13 +02:00
Oliver Gugger
4fd43b4afe
itest: add new funding test with all input types 2022-05-10 20:35:28 +02:00
Oliver Gugger
fd7fe2ae5a
itest: use SendCoinsUnconfirmed in funding test 2022-05-10 18:39:45 +02:00
Oliver Gugger
e27a9fec66
lntest: rename sendCoins to SendCoinsOfType 2022-05-10 18:31:18 +02:00
Oliver Gugger
5d8fba6810
Merge pull request #6502 from bhandras/musig-fix
signer: fix crash in `MuSig2Combine` when the final signature isn't ready
2022-05-06 13:24:27 +02:00
Andras Banki-Horvath
ddf0571031
itest: cover musig2 combine without all signatures ready 2022-05-06 12:29:32 +02:00
Olaoluwa Osuntokun
0ec88b5346
Merge pull request #6347 from yyforyongyu/5388-rm-revc-log
lnwallet+channeldb: store minimal info in revocation log bucket
2022-05-05 15:52:59 -07:00
Oliver Gugger
52e42fc107
lnrpc+itest: implement MuSig2Cleanup RPC 2022-05-04 19:23:58 +02:00
Oliver Gugger
95ff670c0e
multi: add MuSig2Cleanup method to MuSig2 signer 2022-05-04 19:23:58 +02:00
eugene
f7b3da4bb2
htlcswitch+lntest: modify Switch to persist resolution messages
Include unit tests for the Switch, and integration tests that
exercise the persistence logic.
2022-04-29 16:40:19 -04:00
Oliver Gugger
63e93ae572
itest: add taproot SignOutputRaw Bip86 signing test 2022-04-29 11:42:46 +02:00
Oliver Gugger
3ba6421d5c
itest: add MuSig2 end-to-end tests 2022-04-29 11:42:43 +02:00
Oliver Gugger
e31aab5af6
multi: fix inclusion proof size
The inclusion proof field in the TapscriptPartialReveal function was
incorrect. An inclusion proof can be zero or more elements of 32-byte
slices. So an empty inclusion proof can be valid too for a tree that
only consists of a single leaf.
2022-04-29 11:41:09 +02:00
Oliver Gugger
f7275c7fc4
multi: implement MuSig2 RPCs and remote signing 2022-04-29 11:41:09 +02:00
Oliver Gugger
fee2b28d1b
itest: refactor taproot test 2022-04-29 11:41:05 +02:00
Turtle
8d11a90d72 itest: test config option for picking particular peers 2022-04-19 12:37:44 -05:00
yyforyongyu
f42d1f2d62
multi: remove function BalancesAtHeight
This commit deletes the function `BalancesAtHeight` since its only
usague is to find the push amount, which can be achieved by saving the
initial balances.
Another reason to remove it is to pave the way to incooperate our new
revocation log. If we ever need this function again, we can add it back
by visiting all the revocation logs to calculate the balances at a given
height.
2022-04-20 01:18:13 +08:00
Oliver Gugger
1e72d6737d
lnrpc+itest: fix panic with missing UTXO info
Fixes #6396.
This commit fixes a panic that occurred when trying to sign for a
Taproot output without specifying the full UTXO information for each
input. Instead of panicking an error is now returned.
2022-04-12 19:30:12 +02:00
positiveblue
ae2aa5671f
lnrpc/peers: handle feature bit changes in updateNodeAnnouncement 2022-04-02 19:10:25 -07:00
positiveblue
76196db70e
lnrpc/peers: handle net address changes in updateNodeAnnouncement 2022-04-02 19:09:10 -07:00
positiveblue
aacb2565f5
lnrpc/peers: handle color changes in updateNodeAnnouncement 2022-04-01 18:36:26 -07:00
positiveblue
ce4813940d
lnrpc/peers: handle alias changes in updateNodeAnnouncement 2022-04-01 18:36:26 -07:00
positiveblue
e4e0935816
lnrpc/peers: skeleton logic for updateNodeAnnouncement
Basic logic for the endpoint:

- Get the current nodeAnn information
- Calculate modifications
- Apply modifications
- Return changes
2022-04-01 18:36:21 -07:00
Oliver Gugger
3b5585c12b
multi: fix and test v1 output spend ntfns
Because Taproot key spend only spends don't allow us to re-construct the
spent pkScript from the witness alone, we cannot support registering
spend notifications for v1 pkScripts only. We instead require the
outpoint to be specified. This commit makes it possible to only match by
outpoint and also adds an itest for it.
2022-03-24 18:02:40 +01:00
Oliver Gugger
ef98f2df8a
multi: add p2tr tapscript key path signing capabilities 2022-03-24 18:02:39 +01:00
Oliver Gugger
78db46be7e
multi: add p2tr tapscript signing capabilities 2022-03-24 18:02:39 +01:00
Oliver Gugger
5109c55721
itest: assert P2TR on-chain fund recovery 2022-03-24 18:02:38 +01:00
Oliver Gugger
c73cf03a55
multi: add p2tr keyspend wallet support 2022-03-24 18:02:38 +01:00
Oliver Gugger
0dcaa511a2
Merge pull request #6341 from guggero/remote-signer-signoutputraw
remote signer: fix SignOutputRaw RPC for incomplete key info, fix healthcheck connection leak
2022-03-24 14:59:38 +01:00
Oliver Gugger
42b0aa9a8e
rpcwallet+itest: fix incomplete key info problem
Fixes an issue with SignOutputRaw in remote signing mode where we
weren't able to sign on the remote signer if we only provided the public
key or only the family/index (and not both).

Fixes part of an issue detected in lightninglabs/loop#457.
2022-03-24 14:13:05 +01:00
Oliver Gugger
efa36ce8f2
lntest+lnwallet: add AddressInfo to WalletController
We need to be able to query the watch-only wallet about a public key
when trying to sign with a key that we don't know the family or index
of. The easiest way to do that is to leverage the wallet's address index
to query the derivation path for a public key.
To give the RPC wallet access to that functionality, we need to expose
the method on the WalletController interface.
2022-03-24 14:13:05 +01:00
Oliver Gugger
e86a0ba197
itest: add new test for SignOutputRaw RPC 2022-03-24 14:13:04 +01:00
Liviu
57cb9d09da itest: fix node shutdown in interceptor itests 2022-03-23 19:45:45 -07:00
Andras Banki-Horvath
0e4d7cf143
itest: make use of session ttl in failover test 2022-03-22 14:20:40 +01:00
Olaoluwa Osuntokun
e5625878e9
lntest/itest: add new itest for 3rd party anchor spends
In this commit, we add a new integration tests to exercise the fix
introduced in the prior commit. In this test, we reconstruct a scenario
for a 3rd party to sweep an anchor spend after force closing, causing a
prior spend we had to be invalidated. Without the prior commit, this test
fails as the original anchor sweep is still found in the wallet.
2022-03-17 16:36:49 -07:00
Olaoluwa Osuntokun
e1e9de24df
sweep: remove all unconfirmed descendant transactions when a sweep conflicts
Before this commit, we we were trying to sweep an anchor output, and
that output was spent by someone else (not the sweeper), then we would
report this back to the original resolver (allowing it to be cleaned
up), and also remove the set of inputs spent by that transaction from
the set we need to sweep.

However, it's possible that if a user is spending unconfirmed outputs,
then the wallet is holding onto an invalid transaction, as the outputs
that were used as inputs have been double spent elsewhere.

In this commit, we fix this issue by recursively removing all descendant
transactions of our past sweeps that have an intersecting input set as
the spending transaction. In cases where a user spent an unconfirmed
output to funding a channel, and that output was a descendant of the now
swept anchor output, the funds will now properly be marked as available.

Fixes #6241
2022-03-17 16:36:47 -07:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
yyforyongyu
e4d9551a6a
itest: check feeService against nil upon shutdown [skip ci] 2022-02-22 13:16:06 +08:00
Oliver Gugger
13f187046b
multi: fix issues reported by whitespace linter 2022-02-15 16:26:08 +01:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Oliver Gugger
ffee7d1bcf
multi: fix newly detected linter issues 2022-02-10 11:02:02 +01:00
Oliver Gugger
dfdc2bff8b
multi: run gosimports 2022-02-10 11:02:01 +01:00
carla
4ac6f82b5e
itest: fix lack of hop hint coverage in hold invoice test
Update our test to assert that we have hop hints present when we
expect them, and fix the "alice is a private node" issue that was
previously preventing us from adding hop hints. Asserting that we
have hop hints present in this itest ensures that we'll fail our
itests if a change to SelectHopHints results in our no longer
having hints in this secnario.
2022-02-07 09:03:09 +02:00
Oliver Gugger
8d3d8580f9
Merge pull request #6197 from carlaKC/itest-policy-ensureconnected
lntest/test: ensure nodes connected before disconnecting
2022-01-27 13:20:13 +01:00
Oliver Gugger
bc3319a7d2
lntest: set --lnddir instead of --datadir
If we only set the --datadir flag then lnd will create empty directories
(for letsencrypt and watchtower client) in the default user's home .lnd
directory and will also pick up a config file from there if one exists.
To instruct lnd to only act within the temp itest directory, we need to
use the --lnddir flag instead.
Using the --lnddir flag also overwrites the TLS cert/key path and the
log dir, so we don't need to explicitly set those anymore.
But we need to make sure the node's variables point to the correct
default files/directories.
2022-01-26 11:37:10 +01:00
Andras Banki-Horvath
9591e058ea itest: add test for the channel policy fee rate round down bug 2022-01-25 15:58:43 -08:00
carla
5e8f86a9b6
lntest/test: ensure nodes connected before disconnecting [skip ci] 2022-01-25 14:42:11 +02:00
Olaoluwa Osuntokun
234fdc6c9c
Merge pull request #6185 from sangaman/rpc-middleware-custom-caveat
rpcperms: set CustomCaveatCondition on middleware req
2022-01-24 15:45:49 -08:00
Daniel McNally
4a573b18cf
rpcperms: set CustomCaveatCondition on middleware req
This sets the `CustomCaveatCondition` value on rpc middleware requests
if one exists. Previously, this value was always blank even if the
macaroon had a value set for its custom caveat condition.
2022-01-24 11:39:07 -05:00
Oliver Gugger
1482e5e20a
Merge pull request #6156 from rex4539/typos
multi: Fix typos
2022-01-24 13:24:49 +01:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
zdebra
6baf7af79e itest: fix documentation for LookupNodeByPub [skip ci] 2022-01-23 18:00:24 +01:00
naveen
87a0e52464
multi: Removed deprecated interfacer linter
Removed the deprecated interfacer linter from being called for linting.

Also removed the `nolint:interfacer` within the code.

https://github.com/lightningnetwork/lnd/issues/5741
2022-01-11 14:08:18 +01:00
naveen
545e84f4ce
multi: formatting changes 2022-01-11 14:08:17 +01:00
MrManPew
0f167fd03e
config: better error message if config file doesn't exist 2022-01-11 14:08:17 +01:00
Harsha Goli
baf6977948
Revert "lntest: export attributes of type BitcoindBackendConfig"
[skip ci]

This reverts commit eccf20c5b2.
2022-01-10 14:49:29 -05:00
Harsha Goli
69ae56ad5c
lntest: surface bitcoin backend rpc credentials
[skip ci]
2022-01-10 14:49:10 -05:00
Olaoluwa Osuntokun
fd63301dc5
Merge pull request #6006 from guggero/remote-signer-no-chain
Allow remote signer to run without chain backend
2022-01-07 17:37:16 -08:00
Oliver Gugger
afc53d1c52
lnwallet: initialize first 255 accounts
This fixes lightninglabs/loop#437 by adding all accounts that are used
in liquidity products such as Loop or Pool. Since both of these products
use key families below 255, we can get by with that number.
The alternative to creating way too many accounts (which increases the
default wallet size by ~250kB) would be to hard code the exact accounts
used by Loop (99) and Pool (210). But that sounds like a bad idea given
that there could always be more accounts being added to those (or other)
products. By making sure the first 255 accounts exist, we have a lot
more flexibility in those products for choosing key families.
2022-01-06 14:35:26 +01:00
Oliver Gugger
3d353a9879
config_builder+rpcwallet: simplify RPC signing
With the remote signing instance now not needing to know anything about
addresses or current derivation indices, we don't need to forward any
such calls to that instance and can simplify the RPCKeyRing
considerably.
2022-01-06 14:35:24 +01:00
Oliver Gugger
8994d86a1d
walletrpc+itest: add SignPsbt RPC 2022-01-06 14:35:07 +01:00
Oliver Gugger
d135b638f6
btcwallet: add SignPsbt 2022-01-06 13:24:32 +01:00
Oliver Gugger
8c77829c46
lnwallet+lntest+mod: bump btcwallet to export ScriptForOutput 2022-01-06 13:24:30 +01:00
Oliver Gugger
9da8333a6e
multi: fix formatting 2022-01-06 13:24:30 +01:00
Oliver Gugger
5401b12402
lntest: export base node config for re-use 2022-01-06 12:58:27 +01:00
Oliver Gugger
8c3f2eaba0
lntest: export ListenerFormat constant 2022-01-06 12:57:27 +01:00
Oliver Gugger
5afe7852b5
lntest: fix colliding variable name
The variable name "bytes" collides with an imported package name, so we
rename it to avoid shadowing.
2022-01-06 12:57:27 +01:00
Oliver Gugger
10d876ae98
itest: fix RPC middleware itest 2022-01-06 15:01:02 +08:00
yyforyongyu
587273174e
itest: start using harness miner in harness net
This commit replaces the old miner with the new HarnessMiner and cleans
harness_node.go by moving methods into the test_common.go.
2022-01-05 13:10:06 +08:00
yyforyongyu
337aa6670b
itest: introduce harness miner
This commit adds a new component, harness miner, to the itest. This
newly added component is responsible for checking the mempool and blocks
for the itest.
2022-01-05 13:10:06 +08:00
yyforyongyu
61d6f5da11
itest: refactor initClientWhenReady to clean up init node 2022-01-05 13:10:05 +08:00
yyforyongyu
75da5cabc8
itest: add method waitTillServerState in harness node 2022-01-05 13:10:05 +08:00
yyforyongyu
f5f1289dab
itest: use node.rpc namespace inside harness net
This commit adds a new struct RPCClients to better handle rpc clients.
A private field, rpc, is added to HarnessNode to prevent direct access
to its clients. Inside RPCClients, all clients are exported in case a
test case need access to a specific client.
2022-01-05 13:10:05 +08:00
yyforyongyu
f8cf7c8775
itest: shorten functions inside harness node
This commit refactors the long function start() into smaller pieces and
moves commonly used functions into test_common.go.
2022-01-05 13:10:05 +08:00
Martin Habovstiak
2b3b70d40b test: don't enforce reserved value in PSBT midstep
This adds an integration test that makes sure channel can be funded from
empty wallet using PSBT if the funding transaction contains an output
belonging to the wallet, satisfying the reserve.
2021-12-10 00:22:17 +01:00
Oliver Gugger
c75c3bd847
Merge pull request #5756 from yyforyongyu/itest-1-run-ctx
itest: refactor context management inside harness node and net
2021-12-07 13:14:27 +01:00
yyforyongyu
05ac516762
itest: replace fakeLogger with v2 logger with Discard 2021-12-04 14:54:37 +08:00
yyforyongyu
403fdaa716
itest: use run context when making rpc requests 2021-12-04 14:54:37 +08:00
yyforyongyu
bd521dd2f0
itest: rename harness net file and add run context
This commit renames harness.go to harness_net.go. It also adds a run
context which is served as the parent context when creating new
contexts.
2021-12-04 14:54:37 +08:00
yyforyongyu
26ed64fa52
itest: manage context within HarnessNode
This commit removes the context as a param needed when calling methods
of HarnessNode. This change moves the context management inside
HarnessNode, aside from saving us a few lines, it makes the context
creation/timeout less error-prone.
2021-12-04 14:54:36 +08:00
yyforyongyu
6f59f41e86
itest: use ProcessState and runCtx to control process quit 2021-12-04 14:54:36 +08:00
yyforyongyu
f81bcdf4db
itest: add run context to harness node
This commit adds a running context to HarnessNode which replaces all the
background context used and also serves as a way to signal quit when the
test is shutting down.
2021-12-04 14:54:36 +08:00
yyforyongyu
98d7e64dc1
itest: add test_common to hold commonly used methods
A new file, test_common.go, is added to hold commonly used functions
across lntest.
2021-12-04 14:54:36 +08:00
Harsha Goli
eccf20c5b2
lntest: export attributes of type BitcoindBackendConfig
Allows these values to be accessed upstream
2021-12-03 13:03:36 -05:00
Oliver Gugger
54a25146f4
rpcperms: add unique request ID
This commit adds a unique request ID that is the same for each gRPC
request and response intercept message or each request/response message
of a gRPC stream.
2021-11-08 15:01:26 +01:00
Oliver Gugger
9a28a4a9ff
lnrpc+rpcperms+lntest: add unique MW message ID
This commit adds a new unique intercept message ID that is different for
each message sent to an RPC middleware. This will allow us to re-purpose
the existing request ID field into its original intention, which was to
have a unique ID for a full gRPC request/response pair or gRPC stream as
a whole.
2021-11-08 15:00:29 +01:00
Olaoluwa Osuntokun
67e18e6089
rpc: optimize DescribeGraph by caching the response
Unfortunately, we can't use the graph cache directly here as it doesn't
include all the information we need, since it only includes the minimal
amount of information needed for path finding.

Instead, we use a simple mutex guarded cache that evicts itself after a
certain interval. The default is set small enough that most users
shouldn't really notice. We also provide a way to disable the cache, and
also disable the cache in the itests.

Fixes https://github.com/lightningnetwork/lnd/issues/1232
2021-11-04 15:30:31 -07:00
Oliver Gugger
eb2be7c7c0
lntest: count unconfirmed balance as well
It looks like in some cases (apparently mostly on Windows) a previous
sub test sometimes leaves some unconfirmed balance in the wallet. That
balance is confirmed in the next test when new coins are sent to the
wallet.
2021-11-02 20:36:45 +01:00
Oliver Gugger
2a6f128a43
itest: wait for channel to be properly closed
It looks like in some cases a channel is still being closed while we
already try to create a sweep output. In that case the pending closed
channel is still counted as anchor channel and a reserve output is
created. To make sure that doesn't happen, we make sure there are no
pending or open channels of any kind around before we create the sweep
transaction.
2021-11-02 20:36:27 +01:00
Oliver Gugger
2ca3eea3f7
itest: fix REST WebSocket ping/pong itest
This commit fixes a flake in the REST itest that was caused by an
invoice being created before the actual subscription client was
registered.
2021-11-02 20:36:26 +01:00
Olaoluwa Osuntokun
66ca2a994b
Merge pull request #5901 from Roasbeef/dedup-interceptor
Dedup interceptor
2021-10-28 17:44:49 -07:00
Roei Erez
fe44aedb25
itest: dedup interceptor packets
Aded a test for the dedup intercepted packets of htlc interceptor.
2021-10-28 16:16:55 -07:00
Olaoluwa Osuntokun
a5ae7fbf9c
lntest: add new itest for repeated payments to the same AMP invoice 2021-10-28 15:50:35 -07:00
Olaoluwa Osuntokun
0a3bc3ee3d
Merge pull request #5840 from guggero/bolt-pathfinding-fallback
db: allow turning off in-memory graph cache for bbolt
2021-10-25 14:24:10 -07:00
Oliver Gugger
27632daa98
itest: test path finding without cache 2021-10-22 09:32:50 +02:00
Oliver Gugger
423de4d79a
itest: defer close of done channel
The testing framework uses runtime.Goexit() when a test fails which
still allows the defer calls to execute. That's why we should use defer
to close the done channel to allow all goroutines to exit properly.
2021-10-21 11:09:52 +02:00
Wilmer Paulino
e891dd0fd3
itest: test backup restore of script enforced lease channel type 2021-10-19 18:30:53 -07:00
Wilmer Paulino
974fc346cf
itest: update itests to use new script-enforced lease commitment type
We update several of our integration tests that exercise different
scenarios with regards to the broadcast of a channel commitment
transaction with HTLCs in-flight to use the new commitment type for
channel leases. We do this to ensure we have complete coverage of said
channel commitment type. This required changing several assumptions
throughout the tests based on when we should expect sweeps to happen.
2021-10-19 18:30:48 -07:00
Olaoluwa Osuntokun
94b7b71809
Merge pull request #5689 from guggero/remote-signer
Support remote signing over RPC
2021-10-18 18:39:17 -07:00
Oliver Gugger
a6ea019f56
lntest: add itest for remote signing 2021-10-14 16:14:49 +02:00
Oliver Gugger
36dc4b3abf
itest: refactor tests to be re-used 2021-10-14 15:42:59 +02:00
Oliver Gugger
a3addcc927
multi: forward SendCoins call over RPC 2021-10-14 15:42:52 +02:00
Oliver Gugger
6093393e2f
multi: refactor SignMessage to specify hashing 2021-10-14 15:42:44 +02:00
Oliver Gugger
5d7e814ea8
Merge pull request #5674 from torkelrogstad/2021-08-26-http-mux
lntest: avoid global ServeMux
2021-10-13 10:45:57 +02:00
Oliver Gugger
e79d59dd4c
multi: use key locator for lnwallet.MessageSigner
To simplify the message signing API even further, we refactor the
lnwallet.MessageSigner interface to use a key locator instead of the
public key to identify which key should be signed with.
2021-10-08 12:06:52 +02:00
Oliver Gugger
afa03f22cc
multi: use key locator only for signing messages
To simplify the API surface of a remote signer even more, we refactor
the SignMessage and SignMessageCompact calls to only accept a key
locator as we always know what key we're using for signing anyway.
2021-10-08 12:06:52 +02:00
Oliver Gugger
8b7c88537c
multi: refactor SignDigestCompact into SignMessageCompact
To make it possible to use a remote lnrpc server as a signer for our
wallet, we need to change our main interface to sign the message instead
of the message's digest. Otherwise we'd need to alter the
lnrpc.SignMessage RPC to accept a digest instead of only the message
which has security implications.
2021-10-08 12:06:52 +02:00
Oliver Gugger
02757f6735
multi: refactor SignDigest into SignMessage
To make it possible to use a remote signrpc server as a signer for our
wallet, we need to change our main interface to sign the message instead
of the message's digest. Otherwise we'd need to alter the
signrpc.SignMessage RPC to accept a digest instead of only the message
which has security implications.
2021-10-08 12:06:51 +02:00
Oliver Gugger
0fac6c400e
itest: wait for node to fully start up 2021-10-06 16:29:49 +02:00
Oliver Gugger
e9c9ec2e84
itest: exit goroutines on error 2021-10-06 16:29:44 +02:00
Oliver Gugger
c89637a4e2
itest: fix close of closed channel panic 2021-10-05 20:48:48 +02:00
Oliver Gugger
6bc0862fdf
itest: fix commitment_deadline context expired flake 2021-10-05 20:48:48 +02:00
Oliver Gugger
bedba02a2d
itest: enable slow mining by default
We now redirect the mineBlocks function to the mineBlocksSlow function
which waits after each mined block. To reduce the overall time impact of
using that function everywhere, we only wait 20 milliseconds instead of 50ms
after each mined block to give all nodes
some time to process the block. This will still slow down everything by a bit
but reduce flakes that are caused by different sub systems not being
up-to-date.
2021-10-05 20:48:47 +02:00
Oliver Gugger
98061dfd58
mod+lntest: disable stall handler in btcd mining node
The latest version of btcd allows its stall handler to be disabled. We
use that new config option to make sure the mining btcd node and the lnd
chain backend btcd node aren't disconnected if some test takes too long
and no new p2p messages are exchanged.
2021-10-05 20:48:47 +02:00
Elle Mouton
da64a24ad8
server: update persistent peer addrs from announcements
In this commit, a subscription is made to topology updates. For any
NodeAnnouncements received for our peristent peers, we store their newly
advertised addresses. If at the time of receiving these new addresses
there are any existing connection requests, these are updated to reflect
the newly advertised addresses.
2021-10-04 14:57:50 +02:00
Elle Mouton
6b5b53d517
lntest: show reconnection bug
In this commit we demonstrate a bug to show that if an inbound peer
changes their listening address to one not advertised in their original
NodeAnnouncement then we will not be able to reconnect to them. This bug
will be fixed in a follow-up commit.
2021-10-04 14:57:50 +02:00
Elle Mouton
d639a4d73f
server+lntest: use all addrs during reconnect
In this commit, all advertised addresses of a peer are used during
reconnection. This fixes a bug previously demonstrated in an itest.
2021-10-04 14:57:50 +02:00
Elle Mouton
18909e1a8e
lntest: show that multi addresses are not used
This commit adds an itest to demonstrate that if a peer advertises
multiplie external IP addresses, then they will not all be used to
reconnect to the peer during reconnection. This will be fixed in a
follow-up commit.
2021-10-04 14:57:49 +02:00
Elle Mouton
5177ec2f84
lntest: create persistent connection
This commit adds a ConnectNodesPerm function to the itest NetworkHarness
so that persistent connections between nodes can be mocked.
2021-10-04 14:57:49 +02:00
Elle Mouton
9a97577c00
lntest: refactor assertNumConnections
The assertNumConnection function currently takes in an 'expected' number
of connections argument and asserts that both alice and bob only each
only have that number of connections. So this fails to be useful if say
alice is also connected to charlie cause then if we call
assertNumConnections between alice and bob it will fail saying there are
2 connections between them since all it does is count alice's total
  number of connections. This commit replaces this function with 2 new
functions: assertConnected which asserts that at least one connection
exists between two peers and assertNotConnected which asserts that no
connections exists between the two peers.
2021-10-04 14:57:48 +02:00
Oliver Gugger
51d19dad87
Merge pull request #5363 from guggero/psbt-no-final-tx
Allow skipping `PsbtFinalize` step during channel funding to support external broadcast
2021-10-04 12:37:51 +02:00
Oliver Gugger
692ea25295
Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
2021-10-04 11:20:23 +02:00
Oliver Gugger
57253c0c05
itest: add test for fully external PSBT funding 2021-10-04 11:17:08 +02:00
Olaoluwa Osuntokun
32fa48df7d
Merge pull request #5770 from Crypt-iQ/dust_threshold_0619
lnwallet+htlcswitch: make Switch dust-aware
2021-09-30 20:20:19 -07:00
eugene
702b3a3258
multi: introduce config-level DustThreshold for defining threshold 2021-09-30 13:44:35 -04:00
Oliver Gugger
0b4e03f5fc
multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00
Oliver Gugger
7aa9661d42
lntest: use errgroup for node startup
This commit fixes a nil pointer issue when a node fails to start up.
Because require.NoErrorf() doesn't abort a test immediately if run
inside a goroutine, this lead to the test continuing with nil node
references which lead to a panic later on.
2021-09-29 17:31:32 -07:00
Olaoluwa Osuntokun
dd4cf268a0
Merge pull request #5804 from guggero/itest-setup-error
lntest: use errgroup for node startup [skip ci]
2021-09-29 17:31:17 -07:00
eugene
fdcd726f9a
multi: replace DefaultDustLimit with script-specific DustLimitForSize
This commit updates call-sites to use the proper dust limits for
various script types. This also updates the default dust limit used
in the funding flow to be 354 satoshis instead of 573 satoshis.
2021-09-29 13:33:10 -04:00
Oliver Gugger
493262e253
itest: fix flake in update_channel_status itest
This commit fixes a flake in the channel status update itest that
occurred if Carol got a channel edge update for a channel before it
heard of the channel in the first place. To avoid that, we wait for
Carol to sync her graph before sending out channel edge or policy
updates.

As always when we touch itest code, we bring the formatting and use of
the require library up to date.
2021-09-29 17:50:01 +02:00
Oliver Gugger
5aeb728f80
lntest: use errgroup for node startup
This commit fixes a nil pointer issue when a node fails to start up.
Because require.NoErrorf() doesn't abort a test immediately if run
inside a goroutine, this lead to the test continuing with nil node
references which lead to a panic later on.
2021-09-29 11:57:53 +02:00
yyforyongyu
c525c3d34e
itest: test wipe forwarind packages 2021-09-23 13:24:11 +08:00
Joost Jager
daeb96fe0a
postgres: add itest 2021-09-21 10:44:23 +02:00
Olaoluwa Osuntokun
9264185f5b
Merge pull request #5101 from guggero/macaroon-interceptor
Add macaroon based RPC middleware interceptor
2021-09-20 19:15:04 -07:00
Oliver Gugger
4b43e977b2
lntest: add RPC middleware itests 2021-09-20 17:04:39 +02:00
Oliver Gugger
0cc260bfc7
itest: add _test suffix to test file 2021-09-20 17:04:38 +02:00
Oliver Gugger
045765111a
multi: use safe copy for macaroons
Fixes #4383 by adding a new SafeCopyMacaroon function that correctly
clones all caveats and prevents modifications on the copy from affecting
the original.
2021-09-20 13:05:46 +02:00
Oliver Gugger
4b7452a35e
lnrpc+itest: fix write deadline issue with WS ping
Fixes #5680.
To make sure we're always reading from the WebSocket connection, we need
to always have an ongoing (but blocking) conn.ReadMessage() call going
on. To achieve this, we do the read in a separate goroutine and write to
a buffered channel. That way we can always read the next message while
the current one is being forwarded. This allows incoming ping messages
to be received and processed which then leads to the deadlines to be
extended correctly.
2021-09-20 12:21:03 +02:00
yyforyongyu
66dae6ecf7
itest: put node.CloseChannel inside wait 2021-09-17 07:50:44 +08:00
yyforyongyu
7038d0e5c8
itest: fix typo 2021-09-17 07:50:43 +08:00
yyforyongyu
cdec34c5f7
itest: remove the method waitForChannelUpdate
This commit removes the method waitForChannelUpdate, and uses
node.WaitForChannelPolicyUpdate instead.
2021-09-17 07:50:43 +08:00
yyforyongyu
06fa17513c
itest: move tests by their category 2021-09-17 07:50:43 +08:00
yyforyongyu
87c13d31b4
itest: watch channel policy updates in harness node 2021-09-17 07:50:43 +08:00
yyforyongyu
d2277ac915
itest: replace chanOpen bool with chanWatchType 2021-09-17 07:50:42 +08:00
yyforyongyu
a58543d1c7
itest: remove extra graph topology subscription 2021-09-17 07:50:42 +08:00
yyforyongyu
92cd6657c5
lntest: refactor handle close channel update 2021-09-17 07:50:42 +08:00
yyforyongyu
0701834a5d
lntest: refactor handle update open channel 2021-09-17 07:50:42 +08:00
yyforyongyu
a1024163fe
itest: add more verbose log and print node state 2021-09-17 07:50:42 +08:00
Turtle
0120c86687
itest: Test new RPC call for checking macaroon permissions 2021-09-14 16:27:02 -05:00
Turtle
ba17842e34
itest: Test new BakeMacaroonRequest for allowing external permissions 2021-09-14 16:27:02 -05:00
Joost Jager
3827d15ca6 lntest/itest: fix SendPaymentAMP test 2021-09-14 18:53:17 +02:00
yyforyongyu
c4913e6f4a
itest: require server being started when creating node
We now require the lnd to be fully started when creating a new node
using newNode.
2021-09-14 07:34:10 +08:00
Andras Banki-Horvath
9bf04f9870
itest+etcd: save etcd logs along the node logs 2021-09-10 14:40:57 +02:00
Andras Banki-Horvath
6c2d8bb176
etcd: enable optional log file for embedded etcd log output
In this commit we add an extra config for enabling logging to an
external file when using embedded etcd. This can be useful when running
integration tests to see more details about etcd related issues.
2021-09-10 14:40:54 +02:00
Oliver Gugger
7a9ee48cf1
itest: add batch funding test 2021-09-03 18:39:45 +02:00
Wilmer Paulino
523eef5cf4
lntest: use explicit channel commitment negotiation for multi-hop itests 2021-08-30 19:17:42 -07:00
Wilmer Paulino
449f207217
lntest: replace commitType type with rpc alternative 2021-08-30 19:17:39 -07:00
Torkel Rogstad
d6045a0fd5 lntest: avoid global ServeMux
Using the default, global ServeMux prevents the same process from
calling `lntest.NewNetworkHarness` multiple times, because we get a
panic when registering HTTP routes.

Instead, we use the ServeMux beloning to the fee service struct.
2021-08-27 11:30:01 +02:00
Oliver Gugger
23cd231483
Merge pull request #4717 from guggero/xprv-wallet-init
walletunlocker: Allow wallet to be created from extended master root key (xprv)
2021-08-24 13:01:41 +02:00
Oliver Gugger
c74c46147f
Merge pull request #5646 from yyforyongyu/fix-context-leak
itest: properly handle the creation of timeout context
2021-08-24 10:44:36 +02:00
Oliver Gugger
0822573743
itest: test wallet recovery from extended master root key
We add an additional test case to the on-chain fund recovery test that
tries restoring the same wallet from the extended master root key
instead of the seed.
2021-08-24 10:37:34 +02:00
Oliver Gugger
3fd944e7e4
lntest: allow node restore by extended root key
To allow testing restoring a node from an extended master root key, we
add an extra argument to the RestoreNodeWithSeed function.
2021-08-24 10:37:33 +02:00
yyforyongyu
104b7a09db
itest: fix inheritance when creating timeout ctxt
This commit fixes the issue where a wrong context being inherited to
create a timeout context. When a parent context timed out, all its
children contexts also timed out, even the children contexts had a
larger timeout value. This means it only makes sense to inherite from a
parent when its children have smaller timeout value. Given the setup of
the itest, all the timeout contexts need to be created from a context
background(hence no timeout on the parent) unless there's an explicit
timeout bound we want to set.
2021-08-24 12:28:40 +08:00
yyforyongyu
edffd65e92
itest: manage context timeout in utils.go
This commit finishes moving the context management into utils.go.
2021-08-24 12:28:40 +08:00
yyforyongyu
a6c5255e77
itest: manage context timeout inside completePaymentRequests 2021-08-24 12:28:39 +08:00
yyforyongyu
5a94919b7e
itest: manage context timeout inside network harness
This is the last commit to refactor the context management such that all
the timeout are managed inside the network harness.
2021-08-24 12:28:35 +08:00
yyforyongyu
d9e9238b0c
itest: make WaitForTxInMempool a private method 2021-08-24 12:16:46 +08:00
yyforyongyu
16403da91e
itest: manage context in CloseChannel and AssertChannelExists 2021-08-24 12:16:46 +08:00
yyforyongyu
3e26d77f91
itest: manage context inside WaitForChannelOpen and WaitForChannelClose 2021-08-24 12:16:46 +08:00
yyforyongyu
1629858a3d
itest: manage context inside assertions - II
This commit continues moving context management into assertions.
2021-08-24 12:16:40 +08:00
yyforyongyu
02e4c3ad4c
itest: manage context inside assertions - I
This commit changes the methods assertTxLabel, assertReports,
assertSweepFound, and sendAndAssertSuccess to manage their own context
with deadline.
2021-08-24 11:17:20 +08:00
yyforyongyu
74f8fe482d
itest: manage context inside EnsureConnected 2021-08-24 11:06:44 +08:00
yyforyongyu
d10d1e3e24
itest: manage context inside SendCoins 2021-08-24 11:06:44 +08:00
yyforyongyu
8de495b96b
itest: initialize context inside ConnectNodes 2021-08-24 11:06:43 +08:00
yyforyongyu
dca20d80a7
itest: fix context leak in openChannelAndAssert
In this commit, we put the context initialization inside
openChannelAndAssert, thus saving us a few lines and making sure the
context is always properly handled.
2021-08-24 11:06:43 +08:00
ErikEk
ca7192f8fd itest: include compressed btcd backend logs 2021-08-24 02:00:44 +02:00
de6df1re
29157fe02a itest: fix payment test 2021-08-20 10:01:45 -05:00
yyforyongyu
fda66f6a43
itest: add an extra utxo when using neutrino 2021-08-19 19:35:20 +08:00
yyforyongyu
24e654ffc4
contractcourt: more verbose logging for anchor sweeping 2021-08-19 19:33:36 +08:00
Joost Jager
09386213be
htlcswitch: log link message with channel point
In lnd, log messages about channels are generally logged with a
reference to their channel point rather than the short channel id.
Channel point is reorg-resistant and also easier to look up in for
example a block explorer.

In the link however, all log messages are accompanied by short channel
id. This makes it difficult to grep a log for all channel activity. The
PEER message for example which are often crucial to analyse, are logged
with channel points.

This commit modifies the link logging to also use channel points.
2021-08-16 08:24:35 +02:00
Stevie Zollo
00f7534e06
docs: fix inconsistent naming of channel.backup [skip ci] 2021-08-12 00:26:53 +02:00
yyforyongyu
8eddc50beb
itest: remove context creations outside close channel assertion 2021-08-11 12:44:39 +08:00
yyforyongyu
2e4417454b
itest: create context with timeout in closeChannelAndAssertType 2021-08-11 12:41:57 +08:00
Olaoluwa Osuntokun
be341bcd68
Merge pull request #5528 from guggero/keep-channel-backup-local-force-close
backups: Keep channel backup in case of local force close
2021-08-10 19:31:59 -07:00
Oliver Gugger
f7943448b9
itest: fix channel open and close ntfn test
Because we now get one more update per channel when closing it, we need
to update our test that looks at the close notifications sent by the
SubscribeChannelEvent RPC.
2021-08-09 16:06:56 +02:00
Oliver Gugger
bb4c754504
itest: test local force close restore scenario
We want to make sure we can recover funds from a channel that was force
closed by the local node just before the node needed to be restored. We
add a special test case with specific assertions for that scenario.
2021-08-09 13:55:37 +02:00
Oliver Gugger
294fba0bc5
itest: fix channel backup subscription test
With one more notification event being dispatched in the local force
close case we need to update one of the integration tests to account for
the additional message.
2021-08-09 13:55:35 +02:00
Andras Banki-Horvath
0f400b2b16
itests: payments test flake fix 2021-08-06 17:37:37 +02:00
Oliver Gugger
6421fd532c
itest: fix anchor SCB sweep tests
Fixes another flake related to Neutrino and how it handles UTXOs.
2021-08-05 16:11:29 +02:00
Oliver Gugger
f68335d7e4
itest: fix flake in garbage collect test, use require
This commit uses the require library for the link nodes garbage collect
test and fixes a flake that was discovered while hunting for other
flakes. Some times the channel isn't updated fast enough so we can
detech it on first try. So we give it a few more tries to stabilize the
test.
2021-08-05 16:11:29 +02:00
Oliver Gugger
3ae2cdb003
lntest: fix commitment TX not found in mempool error
This commit fixes an old flake in the neutrino anchor output tests. It
turns out that sometimes with Neutrino we don't have enough UTXOs in our
wallet to sweep both the local and remote anchor. This is very likely a
timing issue, we need to give the wallet more time to catch up with the
chain and process all transactions to find unspent outputs.
We address this two-fold: We add an additional UTXO to Alice. And then
we also make sure we detect both UTXOs properly after restarting.
2021-08-05 16:11:28 +02:00
Oliver Gugger
5cabd980b1
lntest: make it clear that profile failure is follow-up error
From the error in the itest output log it is not clear whether scraping
the profile page caused a test to fail or whether it was just a
follow-up error. We make it a bit more clear with an added message.
2021-08-05 16:11:28 +02:00
Oliver Gugger
b149a090df
itest: update error whitelist 2021-08-05 16:11:28 +02:00
Olaoluwa Osuntokun
945c0fa0df
Merge pull request #5521 from Roasbeef/amp-test-flake-chan-open
lntest: fix possible race condition re asserting channel propagation
2021-08-04 19:21:03 -07:00
Oliver Gugger
66ed64da48
lntest: fix timing related flakes 2021-08-04 19:42:13 +02:00
Oliver Gugger
2eb0a4600f
make+itest: add tranche index to test name
To make it easier to see what tranche a failed test was running in, we
add the tranche index to the test name. This corresponds to the number
in the .logs-tranche<index> folder name so the logs can be found much
quicker.
2021-08-04 14:55:57 +02:00
Oliver Gugger
06032b3f75
itest: fix timeout issue in sweep test 2021-08-04 14:55:56 +02:00
xanoni
f5747c20ef lnwallet/wallet.go: clarify anchor chan error str
Improve 'ErrReservedValueInvalidated' error string to explain that the
error is triggered by a transaction that would deplete funds reserved for
potential future anchor channel closings (via CPFP)

Add hint that further details can be found in the debug log

Update strings in 'lntest/itest/log_error_whitelist.txt' correspondingly
2021-08-02 05:38:09 -04:00
Andras Banki-Horvath
f54c127021
itest: fix async payment benchmark timeout flakes 2021-07-27 13:57:09 +02:00
Andras Banki-Horvath
7ce3223919
harness: remove killed nodes from active nodes 2021-07-15 11:26:27 +02:00
Olaoluwa Osuntokun
6cd981420a
lntest: fix possible race condition re asserting channel propagation
In this commit, we attempt to fix a race condition that may occur in the
current AMP and MPP tests.

It appears the following scenario is possible:
  * The `mppTestContext` [is used to create 6 channels back to
    back](https://github.com/lightningnetwork/lnd/blob/master/lntest/itest/lnd_amp_test.go#L43)
  * The method used to create the channel ends up calling
    [`openChannelAndAssert`](edd4152682/lntest/itest/lnd_mpp_test.go (L300))
    which'll open the channel, mine 6 blocks, [then ensure that the
    channel gets
    advertised](edd4152682/lntest/itest/assertions.go (L78))
  * Later on, [we wait for all nodes to hear about all channels on the
    network
    level](https://github.com/lightningnetwork/lnd/blob/master/lntest/itest/lnd_amp_test.go#L62)

I think the issue here is that we'll potentially already have mined 30
or so blocks before getting to the final nodes, and those nodes may have
already heard about the channel already. This may then cause their
[`lightningNetworkWatcher`](edd4152682/lntest/node.go (L1213))
goroutine to not properly dispatch this, since it's assumed that the
channel hasn't been announced (or notified) when the method is called.

One solution here is to just check if the channel is already in the
node's graph or not, when we go to register the notification. If we do
this in the same state machine as the watcher, then we ensure if the
channel is already known, the client is immediately notified. One thing
that can help us debug this more in the future is adding additional
logging in some of these helper goroutines so we can more easily track
the control flow.

This commit implements this solution by checking to ensure that the
channel isn't already known in our channel graph before attempting to
wait for its notification, as we may already have missed the
notification before this registration request came in.
2021-07-14 20:12:00 -07:00
Olaoluwa Osuntokun
ea7ea33e24
lntest/itest: log node name in addition to ID if waitForChannels fails 2021-07-14 20:11:54 -07:00