Commit Graph

14729 Commits

Author SHA1 Message Date
Elle Mouton
fe2304efad
channeldb: add a FetchChannelByID method
Add a FetchChannelByID method that allows a caller to fetch an
OpenChannel using an lnwire.ChannelID.
2023-04-24 13:15:40 +02:00
Elle Mouton
63442cbe51
channeldb: factor out generic FetchChannel logic
This commit introduces a new `channelSelector` method and moves all
generic logic from `FetchChannel` to it. This refactor will make it
easier to add new methods that require the same open-channel db
traversal with slightly different channel selection logic.
2023-04-24 13:15:39 +02:00
Elle Mouton
908cb6060b
channeldb: optimise FetchChannel method
This commit adds a small optimisation to the FetchChannel method.
Instead of iterating over each channel bucket, an identifiable error is
thrown once the wanted channel is found so that the iteration can stop
early.
2023-04-24 13:10:13 +02:00
Elle Mouton
aebdd2375c
channeldb: lint FetchChannel method
A few lint fixes of the FetchChannel method.
2023-04-24 13:10:12 +02:00
Elle Mouton
cab0560d5e
wtclient: cleanup the test file
This commit just does some linting of the client_test.go file so that
future commits are easier to parse.
2023-04-24 13:10:12 +02:00
Olaoluwa Osuntokun
588a7eb9ca
Merge pull request #7599 from Roasbeef/sweeper-rebroadcaster-interaction
sweep: remove conflicted sweep txns from the rebroadcaster
2023-04-21 13:58:50 -07:00
Olaoluwa Osuntokun
3d2daeefd8
sweep: remove conflicted sweep txns from the rebroadcaster
In this commit, we an existing gap in our rebroadcast handling logic. As
is, if we're trying to sweep a transaction and a conflicting transaction
is mined (timeout lands on chain, anchor swept), then we'll continue to
try to rebroadcast the tx in the background.

To resolve this, we give the sweeper a new closure function that it can
use to mark conflicted transactions as no longer requiring rebroadcast.
2023-04-21 11:53:08 -07:00
Oliver Gugger
aff6d4c958
Merge pull request #7614 from yyforyongyu/fix-pprof-err
lntest+lnd: gracefully shutdown pprof server
2023-04-21 14:23:51 +02:00
yyforyongyu
e547118de0
lntest: increase channel close timeout 2023-04-20 18:52:46 +08:00
yyforyongyu
24c028ff52
lntest: make sure error from shutdown is caught 2023-04-20 18:52:46 +08:00
yyforyongyu
4243c5b95f
lnd: properly shutdown the optional pprof server
This commit makes sure when lnd is shutting down, the optional pprof
server is also gracefully shutting down.
2023-04-20 18:52:46 +08:00
Olaoluwa Osuntokun
f56c9e9c8a
Merge pull request #7609 from Roasbeef/80-block-cltv
chainreg: increase default CLTV value to 80 blocks (~13 hrs)
2023-04-19 11:42:27 -07:00
Olaoluwa Osuntokun
7e1628d89d
chainreg: increase default CLTV value to 80 blocks (~13 hrs)
In this commit, we increase the default CTLV value to 80 blocks.
Initially this was set to 144 blocks in the early days, but then was
lowered to 40 blocks as the lnd implementation matured. By setting this
to a higher value, we increase the safety window (MTTR) when it comes to
node downtime, and also add some buffer room around time locks which may
become more stressed in the future assuming the current mempool load
remains persistent.
2023-04-19 11:39:37 -07:00
Olaoluwa Osuntokun
d908becf73
Merge pull request #7613 from ellemouton/fndMgrDefaultPolicyValuesFix
funding: use default forwarding policy if persisted values not found
2023-04-19 11:29:23 -07:00
Elle Mouton
784dc8d530
funding: use default fwding policy if persisted values not found
In this commit, a bug is fixed in the funding manager that could result
in the funding process erroring out if the persisted initial forwarding
policy is not found. This could occur if a node restarts after opening a
channel that is not yet fully confirmed and also upgrades their node
from a pre-0.16 version to 0.16 since the values are only expected to be
persisted after 0.16.
2023-04-19 11:51:32 +02:00
Oliver Gugger
d9396741fa
Merge pull request #7607 from yyforyongyu/itest-fix-close-chan
lntest: add temporary wait when closing channels
2023-04-19 10:48:43 +02:00
Oliver Gugger
68dc01977c
Merge pull request #7608 from morehouse/docker_autoclean
make: clean up container after linting
2023-04-19 10:39:09 +02:00
Olaoluwa Osuntokun
ec3cb6939a
Merge pull request #7564 from yyforyongyu/mempool-watch
contractcourt: add mempool watcher to notify mempool events
2023-04-18 14:22:23 -07:00
Matt Morehouse
526075be57
make: clean up container after linting
Currently `make lint` creates a new container each time it runs. We can
automatically delete these containers once linting is done by using the
--rm flag.
2023-04-18 15:20:14 -05:00
yyforyongyu
66d1392f7f
chainreg: update bitcoind polling config 2023-04-19 01:24:04 +08:00
yyforyongyu
d5db1950cd
mod: update btcwallet version 2023-04-19 01:18:20 +08:00
yyforyongyu
f72d6dfaf5
docs: update release notes for mempool watch 2023-04-19 01:18:20 +08:00
yyforyongyu
e715b8ed1f
itest+lntest: add itest for mempool preimage watch 2023-04-19 01:18:19 +08:00
yyforyongyu
774db0dfe1
lntest: add more methods to assert mempool state 2023-04-19 01:18:19 +08:00
yyforyongyu
dccf9c77ca
lnd+contractcourt: add more debug logs
This commit adds more debug logs for witness beacon and channel
arbitrator.
2023-04-19 01:18:19 +08:00
yyforyongyu
e9c10bf0a1
chainntnfs: remove subscriptions when the relevant tx is confirmed
This commit removes the subscribed inputs from mempool notifier when the
relevant transaction is confirmed.
2023-04-19 01:18:19 +08:00
yyforyongyu
556c38fefd
contractcourt+lnd: watch for preimage reveal in mempool
This commit extends the current htlc timeout resolver to also watch for
preimage spend in mempool for a full node backend.

If mempool enabled, the resolver will watch the spend of the htlc output
in mempool and blocks **concurrently**, as if they are independent.

Ideally, a transaction will first appear in mempool then in a block.
However, there's no guarantee it will appear in **our** mempool since
there's no global mempool, thus we need to watch the spend in two places
in case it doesn't go through our mempool.

The current design favors the spend event found in blocks, that is, when
the tx is confirmed, we'd abort the monitoring and conitnue since the
outpoint cannot be double spent and re-appear in mempool again. This is
not true in the rare case of reorg, and we will handle reorg seperately.
2023-04-19 01:18:19 +08:00
yyforyongyu
7ef8072724
contractcourt: refactor spendHtlcOutput for clarity
Also fixes the docs and rename `isSuccessSpend` to `isPreimageSpend`.
2023-04-19 01:18:19 +08:00
yyforyongyu
e81d62fc70
chainntnfs+chainreg: add interface MempoolWatcher
This commit adds the interface `MempoolWatcher` and uses it in the chain
registry.
2023-04-19 01:18:19 +08:00
yyforyongyu
ad5e798392
chainntnfs+chainreg: add mempool watcher to BtcdNotifier
This commit adds the mempool watcher to btcd notifier to allow the
notifier managing the starting and stopping of the watcher.
2023-04-19 01:18:18 +08:00
yyforyongyu
454e76cbb6
chainntnfs+chainreg: add mempool watcher to BitcoindNotifier
This commit adds the mempool watcher to bitcoind notifier to allow the
notifier managing the starting and stopping of the watcher.
2023-04-19 01:18:18 +08:00
yyforyongyu
8b42151edc
chainntnfs: patch unit tests for mempool notifier 2023-04-19 01:18:18 +08:00
yyforyongyu
3b77e9c51f
chainntnfs: add method UnsubscribeEvent to cancel a subscription
This commit adds the method `UnsubscribeEvent` to cancel a single
subscription.
2023-04-19 01:18:18 +08:00
yyforyongyu
5743dd9601
chainntnfs: allow multiple subscriber to the same input
This commit changes the `subscribedInputs` to store a map of subscribers
so multiple subscribers are allowed to receive events from the same
outpoint.
2023-04-19 01:18:18 +08:00
yyforyongyu
81ee3b9fbe
chainntnfs: introduce mempool notifier
This commit adds a mempool notifier which notifies the subscriber the
spending event found in the mempool for a given input.
2023-04-19 01:18:18 +08:00
yyforyongyu
6aaca568c1
lntest: add temporary wait when closing channels
A temporary solution to avoid the `link failed to shutdown` error.
2023-04-19 01:07:04 +08:00
Oliver Gugger
517f8ed842
Merge pull request #7597 from guggero/persistent-fee-params
Update `channelLink` policy correctly when opening channel with custom fee parameters
2023-04-18 13:36:24 +02:00
Oliver Gugger
d54bc8974a
docs: add release notes 2023-04-18 11:48:49 +02:00
Oliver Gugger
5fbaed6b06
peer: add TODO about initial forwarding policy
The right way to solve the problem of the link not being up to date with
custom user set forwarding policies once the channel is announced would
be to pass in those custom values when the link is created initially.
This requires a bit more of a refactor and is not addressed in this bug
fix.
2023-04-18 11:47:03 +02:00
Oliver Gugger
7eafdd0e08
Merge pull request #7604 from ziggie1984/fmt-fix
Log Output Fix (Missing Value)
2023-04-18 11:04:54 +02:00
Oliver Gugger
1eebbe3f42
itest: update channel open test to send payment
This commit enhances the custom fee policy channel open test by adding a
second channel and testing forwarding payments through the channel with
the custom forwarding policies.
This was able to reproduce the bug reported in #5796 which was fixed in
a previous commit of this PR.
2023-04-18 09:52:14 +02:00
ziggie
461e5f4ac2
docs: update release notes 2023-04-18 09:46:00 +02:00
ziggie
58aae0757e
netann: fix logging output 2023-04-18 09:44:37 +02:00
Oliver Gugger
ebf11bc2f1
itest: move lnd_custom_{message => message_test}.go
This recently added file didn't follow the golang naming convention for
tests.
2023-04-18 09:40:18 +02:00
Oliver Gugger
af70af2710
funding+server: update switch after sending channel update
With this commit we give the funding manager the ability to inform the
switch about custom channel policies, right after we've announced the
channel to the network.
This change is necessary because before #6753 a channel could only be
opened with the default forwarding policies, so the switch automatically
had the "correct" default values. Since #6753 added the ability to
specify forwarding policies at channel open time, we announced those
policies to the network but never updated the switch to inform it about
the changed policies (previously changing the policies was only possible
through the UpdateChannelPolicy RPC which did call the switch).
2023-04-18 09:40:18 +02:00
Oliver Gugger
68881f5c20
funding: refactor manager test 2023-04-18 09:40:17 +02:00
Olaoluwa Osuntokun
37911e2413
Merge pull request #7603 from Torakushi/batch_open_channel_p2tr
funding: use p2tr by default for batch_open_channel
2023-04-17 11:42:34 -07:00
Torakushi
894fc9f2ea
update release-notes-0.16.1 2023-04-17 17:37:56 +02:00
Torakushi
0445fef7ad
funding: use p2tr by default for batch_open_channel
In LND v0.15.1, batch_open_channel used p2tr by default
for change output. However, in a later version, a breaking
change has been fixed in FundPSBT to make the change type
configurable (default to p2wkh). As batch_open_channel
uses FundPsbt, we need to put back p2tr as default for
change output
2023-04-17 17:37:51 +02:00
Olaoluwa Osuntokun
66a85bf9db
Merge pull request #7473 from emilioziniades/realign-witness-types
input+lnrpc: realign witness types
2023-04-13 16:09:01 -07:00