Commit Graph

10717 Commits

Author SHA1 Message Date
Johan T. Halseth
9b08ef6d4e
contractcourt/[incoming|outgoing]_contest_resolver: make inner resolver pointer
To make the linter happy, make a pointer to the inner resolver.
Otherwise the linter would complain with

copylocks: literal copies lock value

since we'll add a mutex to the resolver in following commits.
2020-12-10 14:24:19 +01:00
Johan T. Halseth
4da2b290f9
contractcourt/succes+timeout resolver: extract waitForSpend logic 2020-12-10 14:24:19 +01:00
Johan T. Halseth
5f613147ad
contractcourt: decouple waitForHeight from commit sweep resolver
To make it usable from other resolvers.
2020-12-10 14:24:19 +01:00
Johan T. Halseth
65e50f6952
input/witnessgen: define witness type for HTLC 2nd level inputs
These will only be used for size upper bound estimations by the sweeper.
2020-12-10 14:24:19 +01:00
Johan T. Halseth
8eb6d7cf87
input/size: define witness constants needed
We define the witness constanst we need for fee estimation for this
HTLC second level type.
2020-12-10 14:24:19 +01:00
Johan T. Halseth
241e21a0d1
itest: use hex encoded hash in error message 2020-12-10 14:24:18 +01:00
Johan T. Halseth
09f2307d14
itest: increase htlc amt for local force close tests
Since the tests set a quite high fee rate before the node goes to chain,
the HTLCs wouldn't be economical to sweep at this fee rate.

Pre sweeper handling of the second-level transactions this was not a
problem, since the fees were set when the second-levels were created,
before the fee estimate was increased.
2020-12-10 14:24:18 +01:00
Johan T. Halseth
83f9aaec98
sweeper/tx_input_set: add logging for input set construction 2020-12-10 14:24:18 +01:00
Johan T. Halseth
6150995b46
sweep/txgenerator: log in case of no change output 2020-12-10 14:24:18 +01:00
Johan T. Halseth
1e68cdc8cf
input+lnwallet+contractcourt: define SignDetails for HTLC resolutions 2020-12-10 14:24:18 +01:00
Johan T. Halseth
eb8d22e194
lnwallet/channel: properly set SignDesc.Output
Only value was populated for some, which would cause code to rely on the
PkScript being there to fail.
2020-12-10 14:24:18 +01:00
Johan T. Halseth
08bb8abaa3
Merge pull request #4851 from halseth/sweeper-cnct-deadlock
sweeper: avoid deadlock on shutdown
2020-12-10 14:23:36 +01:00
Johan T. Halseth
f6f3ab5b0b
Merge pull request #4829 from yyforyongyu/typo-fix
multi: Typo fix
2020-12-10 13:55:35 +01:00
Johan T. Halseth
77daa3dbe4
sweeper: avoid deadlock on shutdown
We risked deadlocking on shutdown if a client (in our case a contract
resolver) attempted to schedule a sweep of an input after the
ChainNotifier had been shut down. This would cause the `collector`
goroutine to exit, and not handle incoming requests, causing a deadlock
(since the ChainArbitrator is being stopped before the Sweeper in the
server).

To fix this we could change the order these subsystems are stopped, but
this doesn't ensure there aren't other clients that could end up in the
same deadlock scenario. So instead we keep handling the incoming
requests even after the collector has exited (immediatly returning an
error), until the sweeper is signalled to shutdown.
2020-12-10 13:19:59 +01:00
Johan T. Halseth
de66d35a5b
Merge pull request #4847 from carlaKC/4800-peerfeaturedowngrade
peer: do not require static remote for peers with legacy channels
2020-12-10 12:14:07 +01:00
Conner Fromknecht
6152d013b9
Merge pull request #4842 from cfromknecht/update-btcwallet-dep
mod: update to btcwallet master
2020-12-09 15:45:02 -08:00
Conner Fromknecht
745ea9b70e
Merge pull request #4843 from cfromknecht/check-each-commit
build: check compilation of each commit
2020-12-09 13:52:49 -08:00
Conner Fromknecht
96118c7852
dep: update to btcwallet master 2020-12-09 13:30:18 -08:00
Oliver Gugger
304a25691f
Merge pull request #4849 from guggero/etcd-port-fix
etcd: increment port for embedded etcd server
2020-12-09 16:28:55 +01:00
carla
7d1282af70
peer/test: add test for static key downgrade for legacy channels 2020-12-09 16:31:02 +02:00
Johan T. Halseth
0532c21e33
peer: remove static remote required for peers with legacy channels
This commit unsets option static remote key required for peers that
we have existing legacy channels with. This ensures that we can still
connect to peers that do not recognize this feature bit that we have
existing channels with.
2020-12-09 16:18:09 +02:00
Oliver Gugger
b3c1f29560
Merge pull request #4828 from guggero/fix-log-check
itest: fix error whitelist script
2020-12-09 11:08:19 +01:00
Oliver Gugger
c9ab713f59
etcd: increment port for embedded etcd server
Instead of letting the OS pick a random port for us in a way that wasn't
concurrency safe, we use an atomically incremented port to avoid
collisions.
2020-12-09 09:54:23 +01:00
Oliver Gugger
a08d6c469f
itest: update and sort error whitelist 2020-12-09 09:06:14 +01:00
Oliver Gugger
af0f39f4a6
itest: fix log whitelist check
Because a previous PR changed the location of the itest log files, we
also need to update the script that looks for non-whitelisted errors.
2020-12-09 08:06:16 +01:00
Olaoluwa Osuntokun
c95c423703
Merge pull request #4838 from halseth/sweeper-input-script-ordering
sweep/txgenerator: fix input witness ordering
2020-12-08 20:03:05 -08:00
Olaoluwa Osuntokun
fe2b40d7ad
Merge pull request #4850 from cfromknecht/increase-recovery-htlc-amt
itest: increase recovery payment amount so htlc isn't dust
2020-12-08 19:18:32 -08:00
Conner Fromknecht
dce4d2abcd
build: check compilation of each commit
Inspired by Rust Lightning's GH action :)
2020-12-08 16:19:26 -08:00
Conner Fromknecht
2f38a7ce9c
itest: increase recovery payment amount so htlc isn't dust 2020-12-08 14:55:40 -08:00
Conner Fromknecht
592a0c5699
Merge pull request #4825 from guggero/itest-suspicion
itest: adjust parallelization, poll intervals and timeouts to not starve goroutines
2020-12-08 13:28:45 -08:00
Oliver Gugger
9de659ea4f
itest: use require.Eventually where tick speed matters
To not waste a lot of time with the adjusted longer tick interval, we
use a short interval with require.Eventually where we can save some
time.
2020-12-08 21:40:37 +01:00
Oliver Gugger
a436618e43
lntest: fix linter errors for changed code 2020-12-08 21:40:36 +01:00
Oliver Gugger
809d238364
itest: wait for server to start when restoring
To avoid running into the "server is still starting" error when trying
to close a channel, we first wait for the error to disappear before we
try closing the actual channel.
2020-12-08 21:40:31 +01:00
Oliver Gugger
cdcbc0376d
lntest: replace hard coded timeouts
This commit replaces most of the hard coded 10, 15, 20 and 30 second
timeouts with the default timeout. This should allow darwin users to
successfully run the parallel itests locally as well.
2020-12-08 21:37:12 +01:00
Oliver Gugger
dfb131f82f
make: reduce itest parallelism from 6 to 4
It seems that our itests don't perform correctly in a high CPU usage
scenario such as running 6 tests in parallel. Some goroutines don't get
enough execution time and causes check to time out.
By reducing the total number of parallel tests, we hope to give all
goroutines some more breathing room.
2020-12-08 21:37:12 +01:00
Oliver Gugger
3823315820
lntest: go easy on goroutines when polling
In high CPU usage scenarios such as our parallel itests, it seems that
some goroutines just don't get any CPU time before our test timeouts
expire. By polling 10 times less frequently, we hope to reduce the
overall number of goroutines that are spawned because of the RPC
requests within the polling code.
2020-12-08 21:37:11 +01:00
Oliver Gugger
4d2a12e552
itest: fix incorrect error message 2020-12-08 21:37:10 +01:00
Conner Fromknecht
ebb83bc0a0
Merge pull request #4830 from yyforyongyu/small-code-fix
multi: small code fix
2020-12-08 12:28:29 -08:00
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