Commit Graph

74 Commits

Author SHA1 Message Date
55595954ad config: rename skip-sql-invoice-migration to skip-native-sql-migration
In future releases we will use this flag to make potentially failing kv
to native SQL migrations optional. For this reason it is better to
rename it to avoid confusion.
2025-03-17 16:45:18 +01:00
ea9a5a2a71 macaroons: add ip range checker 2025-03-13 09:57:39 -05:00
444524a762 channeldb+lnd: set invoice bucket tombstone after migration
This commit introduces the functionality to set a tombstone key
in the invoice bucket after the migration to the native SQL
database. The tombstone prevents the user from switching back
to the KV invoice database, ensuring data consistency and
avoiding potential issues like lingering invoices or partial
state in KV tables. The tombstone is checked on startup to
block any manual overrides that attempt to revert the migration.
2025-01-23 15:06:09 +01:00
8d20e2a23b lnd: run invoice migration on startup
This commit runs the invoice migration if the user has a KV SQL backend
configured.
2025-01-23 09:11:01 +01:00
91c3e1496f sqldb: separate migration execution from construction
This commit separates the execution of SQL and in-code migrations
from their construction. This change is necessary because,
currently, the SQL schema is migrated during the construction
phase in the lncfg package. However, migrations are typically
executed when individual stores are constructed within the
configuration builder.
2025-01-23 09:10:59 +01:00
fb429d658b Merge pull request #9330 from ProofOfKeags/update/fn2
multi: update to fn v2
2024-12-09 12:56:23 +01:00
117c6bc781 multi: move routing.TlvTrafficShaper => htlcswitch.AuxTrafficShaper
With this commit we move the traffic shaper definition from the routing
package to the HTLC switch package as a preparation for being able to
use it there as well.
At the same time we rename it to AuxTrafficShaper to be more in line
with the other auxiliary components.
2024-12-05 12:39:33 +01:00
ed2989ae33 multi: update to fn v2 2024-12-04 13:19:00 -07:00
b86980ec40 channeldb: remove graph db from channeldb
Now that the channel.DB no longer uses the ChannelGraph pointer, we can
completely remove it as a member of channeldb.DB.
2024-11-28 13:36:15 +02:00
1859993734 channeldb+graphdb: init graph DB outside of channel db
We also now use the graph DB's own optional functions. An instance of
the graph is currently still passed to the channeldb's
`CreateWithBackend` function. This will be removed in a later commit
once the two have been completely disjoint.
2024-11-28 13:36:15 +02:00
9d0cd3ff4f multi: update more loggers to the v2 type 2024-10-22 17:03:56 +02:00
eaea11e48f sweep: update sweeper to use AuxSweeper to add extra change addr
In this commit, we start to use the AuxSweeper (if present) to obtain a
new extra change addr we should add to the sweeping transaction. With
this, we'll take the set of inputs and our change addr, and then maybe
gain a new change addr to add to the sweep transaction.

The extra change addr will be treated as an extra required tx out,
shared across all the relevant inputs. This'll also be used in
NeedWalletInput to make sure that we add an extra input if needed to be
able to pay for the change addr.
2024-10-02 18:09:58 -07:00
4619cefc8f lnwallet: add new aux resolver interface
This will be used by external callers to modify the way we resolve
contracts on chain. For a given contract, we'll store an extra "blob",
that will later be presented during the sweeping phase.
2024-10-02 18:09:50 -07:00
44ab7e6b10 server+peer: init peer struct w/ AuxChanCloser if present 2024-09-19 10:18:41 +02:00
d49da574e3 lnd: add aux data parser
This commit adds an optional data parser that can inspect and in-place
format custom data of certain RPC messages.
We don't add an implementation of the interface itself, as that will be
provided by external components when packaging up lnd as a bundle with
other software.
2024-09-18 19:07:27 +02:00
83fdbda2fa multi: obtain+verify aux sigs for all second level HTLCs
In this commit, we start to use the new AuxSigner to obtain+verify aux sigs for all second level HTLCs. This is similar to the existing SigPool, but we'll only attempt to do this if the AuxSigner is present (won't be for most channels).
2024-09-18 19:04:53 +02:00
65f54cb075 config+serer: add AuxFundingController as top level cfg option 2024-09-18 10:25:40 +02:00
c39143052e lnd: use impl cfg TlvTrafficShaper 2024-09-05 18:00:52 +02:00
b45d72fe59 multi: thread thru the AuxLeafStore everywhere 2024-08-28 13:26:14 +02:00
b028af1836 multi: make MsgRouter available in the ImplementationCfg
With this commit, we allow the `MsgRouter` to be available in the
`ImplementationCfg`. With this, programs outside of lnd itself are able
to now hook into the message processing flow to direct handle custom
messages, and even normal wire messages.
2024-08-14 19:23:02 -07:00
ddf46f435c multi: update RPC error import path
These errors are now defined in `btcwallet/chain` instead of
`btcd/rpcclient`.
2024-07-06 13:59:28 +08:00
e0a506ab26 multi: use chain.MapRPCErr instead of rpcclient.MapRPCErr 2024-07-06 13:59:25 +08:00
3837c3f12e lnwallet: add configurable cache for web fee estimator
Add fee.min-update-timeout and fee.max-update-timeout config options to
allow configuration of the web fee estimator cache.
2024-05-04 14:41:41 +08:00
ab83343c87 multi: repleace ioutil.ReadFile 2024-04-25 11:22:43 +02:00
648fb22f63 multi: wrap all errors 2024-04-11 15:04:03 +02:00
7f5c8219ef sqldb+invoices: move SQL invoice store impl to invoices package 2024-04-09 20:46:11 +02:00
15c7686830 Merge pull request #8554 from yyforyongyu/use-new-errors
lnwallet: use new errors returned from `rpcclient`
2024-03-21 01:42:57 -06:00
2d3d11487c lnd: ensure that native SQL can only be used with a clean KV invoice DB
This commit adds a check to ensure that we don't start LND with native
SQL invoice DB if we already have any invoices in our KV channeldb. This
is needed as native SQL invoices is an experimental feature and we do
not yet support migration.
2024-03-20 08:46:48 +01:00
837c7f761c lnwallet+lnd: make use of the new errors from btcd/rpcclient
This commit updates `btcd` and `btcwallet` packages and make use of the
new RPC error mappings.
2024-03-20 04:40:38 +08:00
88370de1ab lnd: use native SQL invoice store if configured 2024-03-01 10:08:09 +01:00
debfaf41b9 lncfg: use the sqldb config types instead of the kvdb counterparts 2024-03-01 10:08:09 +01:00
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
cbc11dac8f multi: add coin selection strategy to channel funding
With this commit we prepare for the lnwallet channel funding logic to be
aware of the config-level coin selection strategy by adding it to the
wallet config.
2024-02-23 08:58:07 +01:00
fb8de14798 lnwallet+funding+lnd: trim unused parameters, from lnwallet.Config
chainreg: remove unused GenDefaultBtcConstraints

lnwallet+funding+lnd: remove DefaultDustLimit from lnwallet.Config
2024-02-19 17:06:21 -08:00
c6ecb10865 chainreg+lnd: remove ChannelConstraints from PartialChainControl 2024-02-19 17:06:21 -08:00
031dbd7760 multi: remove ChainRegistry 2023-10-06 16:34:47 -07:00
3912d5a0c6 multi: remove Litecoin config options
This commit removes the `Litecoin`, `LtcMode` and `LitecoindMode`
members from the main LND `Config` struct. Since only the bitcoin
blockchain is now supported, this commit also deprecates the
`cfg.Bitcoin.Active` config option.
2023-10-06 16:34:47 -07:00
521a67c795 lnd: define additional rebroadcaster function.
The MapCustomBroadcastError of the rebroadcaster is defined.
This let's us use the Rebroadcaster of the neutrino package (pushtx)
with other backends and guarantee a consistent behaviour. Prior
to this change the rebroadcaster would stop rebroadcasting
transactions because they did not meet the neutrino specific
broadcastErr type.
2023-07-26 00:18:08 +02:00
16463d4bd4 lnd: generate default macaroons independently
This modifies the `genMacaroons` logic to indepently check for each of
the three default macaroons (admin, readonly, invoice) and generate
whichever are missing. Previously, this was an all or nothing routine.
In other words, either all three didn't exist on disk and all three are
created, or no macaroons are created. Although that works for the first
run of a new node, it can result in inconsistent states if only one or
two of the macaroons is deleted.

See https://github.com/lightningnetwork/lnd/discussions/7566.
2023-04-26 13:30:03 -04:00
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
4a0a15586b multi: make linter happy
Fix all the linter problems for the `v0.16.0-beta.rc3`.
2023-03-11 23:29:41 -08:00
42343184f4 lnd: hook up neutrino's rebroadcaster for full node backends
Neutrino already runs this rebroadcaster in the background, so we don't
need to create it again if we're running in that operating mode.
2023-03-10 19:07:40 -08:00
0730337cc7 multi: add new NoRevLogAmtData config option
In this commit, a new `--db.no-rev-log-amt-data` flag is added. The
config option is passed though to everywhere that it will be used. Note
that it is still a no-op in this commit. An upcoming commit will make
use of the flag.
2023-02-16 20:47:29 +02:00
0cf0a7dd3b Merge pull request #7341 from bottlepay/final-settle-opt-in
channeldb: final htlc resolution storage opt-in
2023-02-06 13:21:40 +01:00
5d22d5eb6c Merge pull request #7252 from ellemouton/sqlite-pt2
multi: add sqlite backend option
2023-01-31 10:14:46 -08:00
21816d9118 lnd+config: Move to FileExists function in lnrpc package 2023-01-26 13:32:12 -06:00
7a785c74c4 channeldb: final htlc resolution storage opt-in 2023-01-26 07:02:17 +01:00
fe5254510e multi: warn user if they try to switch db types
Warn a user if they attempt to initialise a new db type (sqlite or
postgres) if an old bbolt db file is found.
2023-01-25 14:16:56 +02:00
8363c4075c multi: add sqlite backend option
In this diff, we expose the option to use sqlite as a db backend.
2023-01-25 14:16:55 +02:00
824e792dc2 config: expose the InvoiceDB interface in DatabaseInstances
By now the only implementation is still the one in channeldb but other
project can use their custom implementations if needed.
2023-01-16 07:31:13 -08:00