Commit Graph

830 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
4a3c4e4ba7
Merge pull request #8497 from ziggie1984/shutdown-bugfix
routing: shutdown chanrouter correctly.
2024-08-01 16:48:50 -07:00
Andras Banki-Horvath
8e0534f756
multi: add leader check to the healthcheck monitor
This commit extends our healtcheck with an optional leader check. This
is to ensure that given network partition or other cluster wide failure
we act as soon as possible to avoid a split-brain situation where a new
leader is elected but we still hold onto our etcd client.
2024-08-01 19:04:10 +02:00
ziggie
02c1264c53
multi: prevent nil panics in stop methods.
With this PR we might call the stop method even when the start
method of a subsystem did not successfully finish therefore we
need to make sure we guard the stop methods for potential panics
if some variables are not initialized in the contructors of the
subsystems.
2024-07-31 14:43:34 +02:00
ziggie
598d6e23bc
lnd: change startup order of authGossiper. 2024-07-31 13:12:19 +02:00
ziggie
653e2f3667
multi: Allow interrupt of server startup.
This commit does two things. It starts up the server in a way that
it can be interrupted and shutdown gracefully.
Moreover it makes sure that subsystems clean themselves up when
they fail to start. This makes sure that depending subsytems can
shutdown gracefully as well and the shutdown process is not stuck.
2024-07-31 13:12:19 +02:00
Oliver Gugger
ac4ef28926
Merge pull request #8824 from Crypt-iQ/precise_dust_limit
multi: include commitment fees in dust calculation
2024-07-31 03:13:31 -06:00
Olaoluwa Osuntokun
9decf80a68
Merge pull request #8735 from ellemouton/rb-receives
[2/4] Route Blinding Receives: Receive and send to a single blinded path in an invoice.
2024-07-29 19:00:06 -07:00
Eugene Siegel
d6001d033b
htlcswitch+lnwallet: calculate fee exposure as commit fees + dust
This commit expands the definition of the dust limit to take into
account commitment fees as well as dust HTLCs. The dust limit is now
known as a fee exposure threshold. Dust HTLCs are fees anyways so it
makes sense to account for commitment fees as well. The link has
been modified slightly to calculate dust. In the future, the switch
dust calculations can be removed.
2024-07-29 14:13:21 -04:00
ziggie
bf38aed87f
lnd: unify the default setting behaviour.
Setting default values for the channel opening fee rate is already
done elsewhere therefore we remove on of those checks and return
an error if no fee rate is specified.
2024-07-26 10:48:00 +02:00
Elle Mouton
4f5dd20f7e
go.mod: update lightning-onion dep 2024-07-26 09:53:48 +02:00
Elle Mouton
fe34d62eb1
graph+routing: address linter errors
This is done in a separate commit so as to keep the original code-move
commit mostly a pure code move.
2024-07-15 15:56:33 +02:00
Elle Mouton
9327a83cd2
discovery: rename Gossiper graph dep 2024-07-15 15:56:33 +02:00
Elle Mouton
7f1be39d45
refactor: move various duties from ChannelRouter to graph.Builder
This commit is a large refactor that moves over various responsibilities
from the ChannelRouter to the graph.Builder. These include all graph
related tasks such as:
- graph pruning
- validation of new network updates & persisting new updates
- notifying topology update clients of any changes.

This is a large commit but:
- many of the files are purely moved from `routing` to `graph`
- the business logic put in the graph Builder is copied exactly as is
  from the ChannelRouter with one exception:
- The ChannelRouter just needs to be able to call the Builder's
  `ApplyChannelUpdate` method. So this is now exported and provided to
the ChannelRouter as a config option.
- The trickiest part was just moving over the test code since quite a
  bit had to be duplicated.
2024-07-15 15:56:33 +02:00
Elle Mouton
0b7364f54b
graph+server: add template for new graph Builder sub-system
This is preparation for an upcoming commit that will move over various
responsibilities from the ChannelRouter to the graph Builder. So that
that commit can be a pure code-move commit, the template for the new
sub-system is added up front here.
2024-07-15 15:56:33 +02:00
Elle Mouton
e9c89ae0ec
multi+refactor: create ForEachNodeChannel with no tx param
In prep for a clean Graph DB interface, we add a version of
ForEachNodeChannel that does not take in an existing db transaction.
2024-07-15 15:13:58 +02:00
Elle Mouton
c20d759d41
refactor: create FetchLightningNode with no tx param
In preparation for adding a clean Graph DB interface, we create a
version of FetchLightningNode that doesnt allow a caller to provide in a
transaction.
2024-07-15 15:13:57 +02:00
Elle Mouton
cf3de72503
routing: let SelfNode be passed via config
Instead of querying it from the graph since this will be removed in a
future commit.
2024-07-15 15:13:57 +02:00
Elle Mouton
8c0df98439
multi: add abstraction for Router and SessionSource graph access
In this commit, we completely remove the Router's dependence on a Graph
source that requires a `kvdb.RTx`. In so doing, we are more prepared for
a future where the Graph source is backed by different DB structure such
as pure SQL.

The two areas affected here are: the ChannelRouter's graph access that
it uses for pathfinding. And the SessionSource's graph access that it
uses for payments.

The ChannelRouter gets given a Graph and the SessionSource is given a
GraphSessionFactory which it can use to create a new session. Behind the
scenes, this will acquire a kvdb.RTx that will be used for calls to the
Graph's `ForEachNodeChannel` method.
2024-07-15 15:13:57 +02:00
yyforyongyu
e61cba8d22
multi: return verbose errors when fetching edges 2024-06-10 08:40:18 +08:00
Orbital
e8196c6feb
cfg: move experimental options to main protocol cfg 2024-05-16 17:16:50 -05:00
Oliver Gugger
3d56ffd0e4
Merge pull request #8662 from fuyangpengqi/master
chore: fix function names in comment
2024-04-29 15:10:20 +02:00
fuyangpengqi
5f22d97b51 chore: fix function names in comment
Signed-off-by: fuyangpengqi <995764973@qq.com>
2024-04-27 00:04:09 +08:00
Carla Kirk-Cohen
eaa85920ea
multi: enable optional route blinding feature 2024-04-26 11:35:17 -04:00
ziggie
62a52b4d7c
multi: Utxo restriction single funding case.
Restrict the utxo selection when opening a single internal wallet
funded backed channel.
2024-04-24 13:58:19 +01:00
yyforyongyu
07466c4f8c
multi: query circuit map inside contractcourt
This commit adds a new config method `QueryIncomingCircuit` that can be
used to query the payment's incoming circuit for giving its outgoing
circuit key.
2024-04-19 21:33:35 +08:00
yyforyongyu
9c1e6941c3
contractcourt: specify deadline and budget for nursery 2024-04-19 21:33:34 +08:00
yyforyongyu
33abbe1942
contractcourt+lnd: make IncubateOutputs take fn.Option
`IncubateOutputs` never takes more than one HTLC, so we change the
params to be optional, which helps with the following commit where we
pass the deadline height when incubating outgoing HTLCs.
2024-04-19 21:33:34 +08:00
yyforyongyu
0a611aae00
multi: add new config option BudgetConfig and NoDeadlineConfTarget
This commit adds a new group config `BudgetConfig` to allow users
specifying their own preference when sweeping outputs. And a new config
option `NoDeadlineConfTarget` is added in case the user wants to use a
different "lazy" conf target.
2024-04-19 21:33:33 +08:00
yyforyongyu
c44b8a4b45
lnd: start using BudgetAggregator 2024-04-19 21:33:33 +08:00
yyforyongyu
370e4ce98d
lnd+sweep: remove unused config MaxSweepAttempts 2024-04-19 21:33:31 +08:00
yyforyongyu
23feef7e6c
lnd: init publisher when creating new server 2024-04-19 21:33:29 +08:00
yyforyongyu
465332f409
multi: deprecate batchwindowduration config option 2024-04-19 21:33:26 +08:00
yyforyongyu
b536e9bd3f
sweep: deepen the interface Aggregator
This commit makes the `ClusterInputs` directly returning the `InputSet`
so the sweeper doesn't know about the existence of `Cluster` interface.
This way we can have a deeper interface as the sweeper only needs to
interact with `Aggregator` only to get the final input sets, leaving the
implementation details being managed by `SimpleAggregator` and future
aggregators.
2024-04-19 21:33:25 +08:00
yyforyongyu
b5e4384e24
lnd+sweep: remove unused NextAttemptDeltaFunc 2024-04-19 21:33:23 +08:00
yyforyongyu
47478718d4
multi: query mempool spend when a new input is received
This commit changes how a new input sweep request is handled - now we
will query the mempool and see if it's already been spent. If so, we'll
update its state as we may need to RBF this input.
2024-04-19 21:33:22 +08:00
yyforyongyu
1870caf39c
sweep+lnd: introduce UtxoAggregator to handle clustering inputs
This commit refactors the grouping logic into a new interface
`UtxoAggregator`, which makes it easier to write tests and opens
possibility for future customized clustering strategies.

The old clustering logic is kept as and moved into `SimpleAggregator`.
2024-04-19 21:33:21 +08:00
yyforyongyu
18b06b7303
sweep: replace feeRateForPreference with Estimate
This commit refactors the sweeper so the method `feeRateForPreference`
is now moved to `FeePreference`, which makes our following refactor
easier to handle.
2024-04-19 21:33:20 +08:00
Carla Kirk-Cohen
040fcb0f92
multi: add option to disable route blinding, rejecting at link
Add an option to disable route blinding, failing back any HTLC with
a blinding point set when we haven't got the feature enabled.

Note that this commit only handles the case where we're chosen as the
relaying node (where the blinding point is in update_add_htlc), we'll
add handling for the introduction node case once we get to handling of
blinded payloads).
2024-04-03 08:35:41 -04:00
Oliver Gugger
0bc3d29413
Merge pull request #8496 from aakselrod/locks-to-leases
multi: replace `LockOutpoint` with `LeaseOutput`
2024-03-18 03:34:56 -06:00
Alex Akselrod
4d2ab7423f
multi: move 3 vars from walletrpc+lncfg to chanfunding
This commit moves the constants LndInternalLockID and
DefaultLockDuration from the walletrpc package to the chanfunding
package, moves DefaultReservationTimeout from lncfg to chanfunding,
and also updates the lncli package with the new location.
2024-03-13 09:50:16 -07:00
Keagan McClelland
db39a905cb multi: make NewChanIDFromOutpoint accept value instead of pointer 2024-03-08 15:47:55 -08:00
Andras Banki-Horvath
7a45bbbeab
lnd: call into the correct InvoiceStore from RPC calls 2024-03-01 10:08:10 +01:00
ffranr
cd566eb097
multi: fix fmt.Errorf error wrapping
Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
2024-02-27 11:13:40 +00:00
Keagan McClelland
bc3feba267 contractcourt+lnrpc+lnd: s/BreachArbiter/BreachArbitrator
Since we have two other examples of XArbitrator, we rename
BreachArbiter to BreachArbitrator to keep things consistent.
The aim is to reduce the amount of lore you need to know to
intuit where things are or what they do.
2024-02-06 13:32:47 -07:00
ziggie
ccac5c349c
multi: Add itest for a failed funding flow.
This adds an itest for a failed funding flow by our peer.
2024-01-22 16:45:38 +00:00
Elle Mouton
f12cc12da5
server: register a taproot tower client 2024-01-19 15:33:07 +02:00
Elle Mouton
e12321cfd6
multi: extract and pass through IsZombieChannel method 2023-12-11 09:12:05 +02:00
Elle Mouton
a439cc970f
multi: start asking for update timestamps in QueryChannelRange
This commit also adds a new `protocol.no-timestamp-query-option` option
to disable the new behaviour.
2023-12-11 09:12:04 +02:00
Elle Mouton
e800aacff4
wtclient+server: unexport and rename TowerClient
Rename and unexport the `TowerClient` struct to `client` and rename the
`TowerClientManager` interface to `ClientManager`.
2023-11-28 11:01:51 +02:00
Elle Mouton
fcfdf699e3
multi: move BackupState and RegisterChannel to Manager
This commit moves over the last two methods, `RegisterChannel` and
`BackupState` from the `Client` to the `Manager` interface. With this
change, we no longer need to pass around the individual clients around
and now only need to pass the manager around.

To do this change, all the goroutines that handle channel closes,
closable sessions needed to be moved to the Manager and so a large part
of this commit is just moving this code from the TowerClient to the
Manager.
2023-11-28 10:59:40 +02:00