Commit Graph

11196 Commits

Author SHA1 Message Date
Conner Fromknecht
d870bb5002
Merge pull request #4804 from wpaulino/proper-gossip-query-reply-chunk-splitting
discovery: adhere to proper channel chunk splitting for ReplyChannelRange
2020-12-10 18:10:07 -08:00
Olaoluwa Osuntokun
62a5cdbc60
Merge pull request #4857 from cfromknecht/meta-index-reinit
channeldb+tlv: add channel meta-index
2020-12-10 18:08:43 -08:00
Conner Fromknecht
0d57ff2432
lnwallet/test: execute ifacet tests for each backend in parallel 2020-12-10 17:42:26 -08:00
Conner Fromknecht
87787ce771
lnwallet: move interface_test.go to it's own package 2020-12-10 17:42:26 -08:00
Conner Fromknecht
1483ed119b
make: use low-scrypt to speed up unit-race
This predominately affects the lnwallet unit tests which are the bulk of
the execution time.
2020-12-10 17:42:26 -08:00
eugene
f4593f95f4
channeldb/migration20: TestMigrateOutpointIndex 2020-12-10 17:37:59 -08:00
eugene
204b6c51cf
channeldb: MigrateOutpointIndex, store indexStatus in outpoint index
Adds an outpoint index that stores a tlv stream. Currently the stream
only contains the outpoint's indexStatus. This should cut down on
big bbolt transactions in several places throughout the codebase.
2020-12-10 17:37:59 -08:00
Conner Fromknecht
08ee754a6d
channeldb/db: properly reinit wallet during Wipe
Previously we wouldn't recreate some of the top level buckets that are
now considered expected with our migration logic. This bug was
preexisting, but never surfaced because the other TLB buckets were not
touched by this unit test.
2020-12-10 17:37:58 -08:00
Olaoluwa Osuntokun
415680a1b9
Merge pull request #4854 from Roasbeef/neutrino-addrv2
build: update to addrv2 aware neutrino version
2020-12-10 15:36:43 -08:00
Johan T. Halseth
1627310fb0
itest: add HTLC aggregation test 2020-12-10 14:24:21 +01:00
Johan T. Halseth
42c51b662a
itest/channel_force_close test: handle HTLCs going through sweeper
Now that the HTLC second-level transactions are going through the
sweeper instead of the nursery, there are a few things we must account
for.
1. The sweeper sweeps the CSV locked HTLC output one block earlier than
   the nursery.
2. The sweeper aggregates several HTLC second levels into one
   transaction. This also means it is not enough to check txids of the
   transactions spent by the final sweep, but we must use the actual
   outpoint to distinguish.
2020-12-10 14:24:21 +01:00
Johan T. Halseth
4b9fbe2146
itest/local_chain_claim test: mine one less blocks for anchor sweeps
In case of anchor channel types, we mine one less block before we expect
the second level sweep to appear in the mempool, since the sweeper
sweeps one block earlier than the nursery.
2020-12-10 14:24:21 +01:00
Johan T. Halseth
70eb52643c
rpctest: increase sweeper BatchWindow during itests
Since we are checking HTLC aggregation, we must give the sweeper a bit
more time to aggregate them to avoid flakes.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
bb406c82a9
contractcourt/htlc_timeout_test: expand timeout tests 2020-12-10 14:24:20 +01:00
Johan T. Halseth
4992e41439
contraccourt+input: create resolver for timeout second level
In this commit we make the sweeper handle second level transactions for
HTLC timeout resolvers for anchor channels.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
0c3b64a3cd
contractcourt/timeout_resolver: extract logic into sweepSecondLevelTransaction
This commit moves the logic for sweeping the confirmed second-level
timeout transaction into its own method.

We do a small change to the logic: When setting the spending tx in the
report, we use the detected commitspend instead of the presigned tiemout
tx. This is to prepare for the coming change where the spending
transaction might actually be a re-signed timeout tx, and will therefore
have a different txid.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
2f33425509
contractcourt/timeout_resolver: extract logic into spendHtlcOutput
This commit moves the code doing the initial spend of the HTLC output of
the commit tx into its own method.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
aabba32b34
contractcourt: add TestHtlcSuccessSecondStageResolutionSweeper
Test success resolvers going through the sweeper.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
85ea181d67
contraccourt+input: create HtlcSecondLevelAnchorInput and resolver for
success tx

This commit makes the HTLC resolutions having non-nil SignDetails
(meaning we can re-sign the second-level transactions) go through the
sweeper. They will be offered to the sweeper which will cluster them and
arrange them on its sweep transaction. When that is done we will further
sweep the output on this sweep transaction as any other second-level tx.

In this commit we do this for the HTLC success resolver and the
accompanying HTLC success transaction.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
d02b486195
contractcourt: revamp HTLC success unit test
We add checkpoint assertions and resume the resolver from every
checkpoint to ensure it can handle restarts.
2020-12-10 14:24:20 +01:00
Johan T. Halseth
7142a302c9
contractcourt/success_resolver: remove sweep tx checkpoint
The sweep tx is not actually part of the resolver's encoded data, so the checkpointing was essentially a noop.
2020-12-10 14:24:19 +01:00
Johan T. Halseth
0b84d5f976
contractcourt/success_resolver: extract HTLC success handling into broadcastSuccessTx 2020-12-10 14:24:19 +01:00
Johan T. Halseth
9d33b00082
contractcourt/success_resolver: extract remoteHTLC sweep into resolveRemoteCommitOutput
This move the logic for sweeping the HTLC output on the remote
commitment into its own method.
2020-12-10 14:24:19 +01:00
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
Olaoluwa Osuntokun
50323dcd56
chainreg: require FeeUrl when running neutrino mainnet
Fixes #4770.
2020-12-09 20:59:27 -08:00
Olaoluwa Osuntokun
8d8b13a7d1
build: update to addrv2 aware neutrino version 2020-12-09 20:59:17 -08: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