Commit Graph

11030 Commits

Author SHA1 Message Date
Johan T. Halseth
f98a3c9dac
Merge pull request #4848 from halseth/htlcswitch-log-infof
[trivial] htlcswitch: log with format
2020-12-08 14:20:25 +01:00
Johan T. Halseth
e13c97d621
Merge pull request #4841 from cfromknecht/send-coins-log-fix
rpcserver: replace sweep_all in log with send_all to match rpc arg
2020-12-08 13:56:41 +01:00
Johan T. Halseth
1a35c0055b
htlcswitch: log with format 2020-12-08 13:54:41 +01:00
Johan T. Halseth
74eb728630
sweep/sweeper_test: add test for reorderd inputs
This add a test for inputs that gets re-ordered because the inputs with
required TxOuts must be added first.

We add a new step to the test that checks that all inputs were signed at
the correct tx input index.

This test would fail without the previous commit.
2020-12-08 10:59:23 +01:00
Johan T. Halseth
84ee6b6b86
sweep/txgenerator: fix input witness ordering
This commit fixes an issue that would arise if inputs without required
TxOuts would be swept together with inputs with required TxOuts. In this
case we would add the required ones first to the transaction, but did
not change the order we signed the inputs, resulting in signing the
wrong input index.
2020-12-08 10:59:23 +01:00
András Bánki-Horváth
669663bfc2
Merge pull request #4822 from bhandras/add_globalfeatures
routing: add missing features to NetworkNodeUpdate (and also depreacte GlobalFeatures)
2020-12-08 10:16:50 +01:00
Yong
582b164c46
kvdb: add timeout options for bbolt (#4787)
* mod: bump btcwallet version to accept db timeout

* btcwallet: add DBTimeOut in config

* kvdb: add database timeout option for bbolt

This commit adds a DBTimeout option in bbolt config. The relevant
functions walletdb.Open/Create are updated to use this config. In
addition, the bolt compacter also applies the new timeout option.

* channeldb: add DBTimeout in db options

This commit adds the DBTimeout option for channeldb. A new unit
test file is created to test the default options. In addition,
the params used in kvdb.Create inside channeldb_test is updated
with a DefaultDBTimeout value.

* contractcourt+routing: use DBTimeout in kvdb

This commit touches multiple test files in contractcourt and routing.
The call of function kvdb.Create and kvdb.Open are now updated with
the new param DBTimeout, using the default value kvdb.DefaultDBTimeout.

* lncfg: add DBTimeout option in db config

The DBTimeout option is added to db config. A new unit test is
added to check the default DB config is created as expected.

* migration: add DBTimeout param in kvdb.Create/kvdb.Open

* keychain: update tests to use DBTimeout param

* htlcswitch+chainreg: add DBTimeout option

* macaroons: support DBTimeout config in creation

This commit adds the DBTimeout during the creation of macaroons.db.
The usage of kvdb.Create and kvdb.Open in its tests are updated with
a timeout value using kvdb.DefaultDBTimeout.

* walletunlocker: add dbTimeout option in UnlockerService

This commit adds a new param, dbTimeout, during the creation of
UnlockerService. This param is then passed to wallet.NewLoader
inside various service calls, specifying a timeout value to be
used when opening the bbolt. In addition, the macaroonService
is also called with this dbTimeout param.

* watchtower/wtdb: add dbTimeout param during creation

This commit adds the dbTimeout param for the creation of both
watchtower.db and wtclient.db.

* multi: add db timeout param for walletdb.Create

This commit adds the db timeout param for the function call
walletdb.Create. It touches only the test files found in chainntnfs,
lnwallet, and routing.

* lnd: pass DBTimeout config to relevant services

This commit enables lnd to pass the DBTimeout config to the following
services/config/functions,
  - chainControlConfig
  - walletunlocker
  - wallet.NewLoader
  - macaroons
  - watchtower
In addition, the usage of wallet.Create is updated too.

* sample-config: add dbtimeout option
2020-12-07 15:31:49 -08:00
Conner Fromknecht
b017ab67c4
rpcserver: replace sweep_all in log with send_all to match rpc arg 2020-12-07 13:45:11 -08:00
Andras Banki-Horvath
98c61be342
routing: add missing GlobalFeatures to NetworkNodeUpdate 2020-12-07 15:47:09 +01:00
Conner Fromknecht
125dbbf0da
Merge pull request #4823 from cfromknecht/fwd-interceptor-fixes
itest: fwd interceptor fixes
2020-12-04 16:36:14 -08:00
yyforyongyu
bf036f2665
htlcswitch: close the updateFeeTimer properly 2020-12-04 23:08:50 +08:00
yyforyongyu
be626df689
peer: use MaxMessagePayload instead of hard coding 2020-12-04 23:08:49 +08:00
yyforyongyu
f46d16ff89
peer: fix typo 2020-12-04 23:07:54 +08:00
yyforyongyu
e06768e4eb
brontide: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu
eb1affd5da
pool: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu
550341c036
lnwire: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu
5c5fc732e5
aezeed: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu
e3a6cd8412
autopilot: fix typo 2020-12-04 23:07:52 +08:00
Conner Fromknecht
26da2b2c9e
Merge pull request #4827 from halseth/link-test-timeouts
[test] Increase link test timeouts
2020-12-04 02:34:34 -08:00
Johan T. Halseth
0a12592b39
htlcswitch/link_test: double timeouts
Double the timeout to allow the htlcswitch tests to finish on slow
systems (darwin...).
2020-12-04 10:50:43 +01:00
Johan T. Halseth
548827fe89
htlcswitch/link_test: use require.Eventually
Intead of sleeping we use require.Eventually in two cases the flake was
flaky.
2020-12-04 10:50:35 +01:00
Conner Fromknecht
123c3a2530
itest: defer shutdown of nodes in main test method
This ensures that the nodes will properly be shutdown even if one fails
to start or any of them fail to connect. Previously the shutdown is
defered only in the event that the setup was successful.
2020-12-03 23:06:32 -08:00
Conner Fromknecht
374725842e
itest: use fresh alice and bob for fwd interceptor tests 2020-12-03 23:06:32 -08:00
Conner Fromknecht
92b820a6d1
itest: move to require in forward_interceptor_test
Certain checks were implemented with Errorf, which only logs the
failure. This results in the test harness panicking further down. We go
further ahead and convert all calls in this file to use require.
2020-12-03 23:06:29 -08:00
Conner Fromknecht
daf7c8a854
Merge pull request #4780 from halseth/chainwatcher-force-close-future-state
chainwatcher: properly derive to_local script for "future" local force closes
2020-12-03 16:21:50 -08:00
Conner Fromknecht
3e1ba20370
Merge pull request #4765 from guggero/itest-miner-fix
Update btcd to master, make itest btcd harness more robust
2020-12-03 16:19:58 -08:00
Oliver Gugger
b42c5e5fad
make+scripts: use pre-compiled btcd in itest
To make sure we build the exact version of btcd that is referenced in
the project's go.mod file and to not overwrite any binary the user might
already have installed on the system, we compile btcd into an explicit
file in the itest directory.
This should also speed up invocations of "make itest-only" because the
test harness doesn't always compile btcd on its own.

We also fix a bug with the version parsing where adding a "replace"
directive in the go.mod would result in the awk commands to extract the
wrong version. Because we no longer use the DEPGET goal to build and
install btcd, using a replace directive now actually works for itests.
2020-12-03 23:23:49 +01:00
Oliver Gugger
8829960b1a
make+Travis: use EXEC_SUFFIX for Windows, remove explicit goal
To remove the need to have an extra make goal for the Windows itests, we
instead add the flag windows=1 that sets the make variable EXEC_SUFFIX
to properly add the ".exe" suffix to all executable names.
2020-12-03 23:23:49 +01:00
Oliver Gugger
b91b7434f6
make: replace ITEST goal with script
To make the Makefile a bit easier to understand, we remove the implicit
ITEST goal/command variable and switch all itest execution over to
explicit goals in the main Makefile.
2020-12-03 23:23:44 +01:00
Oliver Gugger
36756c012d
lntest: use nextAvailablePort for miner and btcd backend
With the new btcd version we can specify our own listen address
generator function for any btcd nodes. This should reduce flakiness as
the previous way of getting a free port was based on just picking a
random number which lead to conflicts.
We also double the default values for connection retries and timeouts,
effectively waiting up to 4 seconds in total now.
2020-12-03 11:30:23 +01:00
Oliver Gugger
2edc3cf98f
multi: update to latest btcd version
With this commit we update btcd to the latest version which allows us to
specify the btcd binary we want to use when spinning up a new node.
2020-12-03 11:30:22 +01:00
Johan T. Halseth
ef426be351
contractcourt/chainwatcher test: add test cases for future force close
This adds the scenario to the local force close test cases where a node
force closes one of its channels, then lose state (or do recovery)
before the commmitment is confirmed. Without the previous commit this
would go undetected.
2020-12-03 08:01:08 +01:00
Johan T. Halseth
2a7a34ae10
contractcourt+lnwallet: use state num instead of commit height when
outdated local state

This commit fixes a bug that would cause us to not sweep our local
output in case we force closed, then lost state or attempted recovery.
The reason being that we would use or local commit height when deriving
our scripts, which would be incorrect. Instead we use the extracted
state number to derive the correct scripts, allowing us to sweep the
output.

Allthough being an unlikely scenario, we would leave money on chain in
this case without any warning (since we would just end up with an empty
delay script) and forget about the spend.
2020-12-03 08:01:08 +01:00
Johan T. Halseth
5bb8996162
contractcourt/chain_watcher: handleUnknownLocalState
Similar to what we did for other states, we extract handling of acting
on a local future state into its own method.
2020-12-03 08:01:08 +01:00
Johan T. Halseth
93d917d82a
contractcourt/chain_watcher: handleUnknownRemoteState
This commit extracts the data loss protect recovery procedure into its
own method.
2020-12-03 08:01:08 +01:00
Johan T. Halseth
743ea7be74
contractcourt/chain_watcher: handleKnownRemoteState
Similar to what we did for the local state handling, we extract handling
all known remote states we can act on (breach, current, pending state)
into its own method.

Since we want to handle the case where we lost state (both in case of
local and remote close) last, we don't rely on the remote state number
to check which commit we are looking at, but match on TXIDs directly.
2020-12-03 08:01:08 +01:00
Johan T. Halseth
acc45934f8
contraccourt/chain_watcher: define handleKnownLocalState
We can only rely on the commit set and height being correct for the
current commit, so check that first.
2020-12-03 08:01:08 +01:00
Johan T. Halseth
450da3d2f4
contractcourt/chain_watcher test: do proper state rollback
The tests didn't really roll back the channel state, so we would only
rely on the state number to determine whether we had lost state. Now we
properly roll back the channel to a previous state, in preparation for
upcoming changes.
2020-12-03 08:00:02 +01:00
Johan T. Halseth
18f79e20d5
lnwallet/test_utils: set up asymmetric commits
The remote and local commits are not symmetric, so we correctly set them
up pointing to the correct commitment tx.
2020-12-03 08:00:01 +01:00
Olaoluwa Osuntokun
c58589db3b
Merge pull request #4815 from cfromknecht/wtclient-key-segregation
wtdb+wtclient: segregate session-key-index reservations by blob-type
2020-12-02 20:33:38 -08:00
Johan T. Halseth
7dd3e18234
Merge pull request #4817 from Roasbeef/remove-codeowners
github: remove CODEOWNERS file
2020-12-02 10:41:26 +01:00
Olaoluwa Osuntokun
44d84852cb
github: remove CODEOWNERS file
Since it was added, we never maintained the file leading to decay in the
set of "actual" code owners. In practice, the current set up ends up
assign most reviews to 2 or so active contributors. I think the idea
itself is sound, but the current implementation leads to certain
reviewers being over-assigned PRs, which at times causes those PRs to
stagnate since pretty much every PR gets assigned to the same set of
people.
2020-12-01 18:48:00 -08:00
Marty Jones
c04773963b
healthcheck: add healthcheck to shutdown if cert is expired (#4792)
In certain container set ups, it's useful to optionally have lnd just shutdown if it detects that its certs are expired, as assuming there's a hypervisor to restart the container/pod, then upon restart, lnd will have fully up to date certs.
2020-12-01 18:34:19 -08:00
Conner Fromknecht
6b4df04950
wtclient_tests: remove expErr param from nextKeyIndex
This command cannot fail (apart from commit errors) so the linter
complained that the argument was always nil.
2020-12-01 16:55:24 -08:00
Conner Fromknecht
e9b5b2d767
Merge pull request #4793 from murtyjones/cosmetic/add-newline-to-log
Cosmetic: Add newline to end of log statement
2020-12-01 16:44:24 -08:00
Conner Fromknecht
9bd73c0a85
wtdb+wtclient: segregate session-key-index reservations by blob-type
This commit introduces a change in the key format used to reserve/lookup
session-key-indexes. Currently the reservations are stored under the
tower id, however this creates issues when multiple clients are using
the same database since only one reservation is permitted per tower.

We fix this by appending the blob type to the session-key-index locator.
This allows multiple clients to reserve keys for the same tower, but
still limits each client to one outstanding reservation. The changes are
made in a way such that we fall back to the legacy format if the a
reservation under the new format is not found, but only if the blob type
matches blob.TypeAltruistCommit, which is so far the only actively
deployed blob type.
2020-12-01 16:24:16 -08:00
Conner Fromknecht
7f330d79c1
Merge pull request #4816 from guggero/anchor-itest-fix
itest: run sub itests correctly for watchtower tests
2020-12-01 15:18:46 -08:00
Oliver Gugger
0a4962a18e
itest: run sub itests correctly
To avoid the "Error outside of test" log and to properly terminate the
test if a sub test fails, we need to correctly invoke them using the
RunTestCase method.
2020-12-01 22:24:03 +01:00
Johan T. Halseth
8ec4697fe3
Merge pull request #4810 from Roasbeef/gossip-throttle-config
multi: add new config option to toggle gossip rate limiting
2020-12-01 13:32:52 +01:00
Johan T. Halseth
42d7fcd2f9
Merge pull request #4806 from guggero/neutrino-tor-fix
Fix Onion v2 support for Neutrino backends
2020-12-01 11:30:39 +01:00