Commit graph

16122 commits

Author SHA1 Message Date
Andras Banki-Horvath
29ae17ba71
github: add nativesql itests to the matrix 2024-03-01 10:08:10 +01:00
Andras Banki-Horvath
ba8e7550d5
itest: add the -nativesql flag to run SQL itests with native SQL tables 2024-03-01 10:08:10 +01:00
Andras Banki-Horvath
7a45bbbeab
lnd: call into the correct InvoiceStore from RPC calls 2024-03-01 10:08:10 +01:00
Andras Banki-Horvath
42508d44e5
lnd: update sample-lnd.conf 2024-03-01 10:08:10 +01:00
Andras Banki-Horvath
ce1b57da2d
sqldb: exclude sqlite from the JS and unsupported platform builds 2024-03-01 10:08:09 +01:00
Andras Banki-Horvath
88370de1ab
lnd: use native SQL invoice store if configured 2024-03-01 10:08:09 +01:00
Andras Banki-Horvath
e31879ea0a
lncfg: instantiate the native SQL backend if configured
This commit adds an optional separate "native" SQL backend that will
host all tables supporting native SQL. For now since we don't have many
such tables we'll keep it in one file for SQLite, but it may be split up
if desired.
2024-03-01 10:08:09 +01:00
Andras Banki-Horvath
debfaf41b9
lncfg: use the sqldb config types instead of the kvdb counterparts 2024-03-01 10:08:09 +01:00
Andras Banki-Horvath
aba45018a8
sqldb: merge SQLite and Postgres configs with the kvdb counterparts
This commit is part of a refactor that unifies configuration of the
sqldb and kvdb packages for SQL backends.
In order to unify the SQLite and Postgres configuration under sqldb we
first need to ensure that the final config types are compatible with
the alreay deployed versions.
2024-03-01 10:08:09 +01:00
Andras Banki-Horvath
aee1f7f563
invoices: run InvoiceStore and InvoiceRegistry tests on PostgreSQL too 2024-03-01 10:08:09 +01:00
Andras Banki-Horvath
06730824a2
sqldb: fixup PostgreSQL fixture to allow creating separate DBs per test
This change will enable us to use a single PostgreSQL container instead of
spawning new a one for each (parallel) unit test reducing overall test
runtime.
2024-03-01 10:08:08 +01:00
Andras Banki-Horvath
b10ce17cd4
invoices: run InvoiceStore and InvoiceRegistry tests on SQLite too 2024-03-01 10:08:08 +01:00
Andras Banki-Horvath
734d3a9d66
invoices: small test fixes 2024-03-01 10:08:08 +01:00
Andras Banki-Horvath
39211d25ed
invoices: make test HTLC circuit keys unique 2024-03-01 10:08:08 +01:00
Andras Banki-Horvath
3d56d2f1ee
sqldb: add full SQL InvoiceStore implementation 2024-03-01 10:08:08 +01:00
Andras Banki-Horvath
5cf67c4440
sqldb: add utility functions for SQL NULL types 2024-03-01 10:08:07 +01:00
Andras Banki-Horvath
74e7a50f4a
sqldb: convert primary key violation to ErrSQLUniqueConstraintViolation
Besides the usual unique constraint violation that we already support we
also want to return the same error if the primary key constraint is
violated.
2024-03-01 10:08:07 +01:00
Andras Banki-Horvath
6a360fb2e2
sqldb: simplify and fixup the existing invoice store schema and queries
This commit attempts to fix some issues with the invoice store's schema that we
couldn't foresee before the implementation was finished. This is safe as the
schema has not been instantiated yet outside of unit tests. Furthermore the
commit updates invoice store SQL queries according to fixes in the schema as
well as to prepare the higher level implementation in the upcoming commits.
2024-03-01 10:08:07 +01:00
Andras Banki-Horvath
3e0f98a75a
sqldb: introduce replace for the BIGINT type alias 2024-03-01 10:08:07 +01:00
positiveblue
e7d82fa530
tools: update sqlc version to v1.25.0 2024-03-01 10:08:07 +01:00
Olaoluwa Osuntokun
72764b1473
Merge pull request #8100 from bhandras/updateinvoice-refactor
channeldb: refactor `UpdateInvoice` to make it simpler to create SQL specific implementation
2024-02-27 16:50:02 -08:00
Oliver Gugger
48a3d56335
Merge pull request #8503 from ffranr/fix-err-wrap
Correct `fmt.Errorf` error wrapping instances
2024-02-27 12:20:16 -06:00
ffranr
e0358df39e
doc: update release notes 2024-02-27 17:08:02 +00:00
ffranr
b308895583
lncli: unit test makes use of error wrapping during comparison
This commit modifies a unit test such that it inspects a wrapped error
rather than comparing errors by string.
2024-02-27 17:08:01 +00: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
ffranr
581c16d72f
lint: ensure the linter checks fmt.Errorf error wrapping 2024-02-27 11:12:28 +00:00
Olaoluwa Osuntokun
b234658945
Merge pull request #8501 from Roasbeef/tlv-fn-ergonomics
tlv: add UnwrapOrErrV+UnwrapOrFailV+Zero to OptionalRecord
2024-02-26 17:03:37 -08:00
Olaoluwa Osuntokun
3dd01cdc78
tlv: add Zero() method for OptionalRecordT
Most of the time with wire messages, we'll have the wrapped record, so
this is useful when decoding into a blank instance of the record's
value.
2024-02-26 16:12:55 -08:00
Olaoluwa Osuntokun
afde7162c6
tlv: add UnwrapOrErrV and UnwrapOrFailV
These two methods mirror the recently added `fn.Option` methods but
allow us to unwrap on level deeper into the underlying value of the
Record.
2024-02-26 16:12:49 -08:00
Olaoluwa Osuntokun
d69e1111ba
build: update to fn/v1.0.4 2024-02-26 16:12:47 -08:00
Olaoluwa Osuntokun
6d8f40cb27
Merge pull request #8500 from Roasbeef/fn-option-ergonomics
fn: add UnwrapOrErr and UnwrapOrFail to Option
2024-02-26 16:06:17 -08:00
Olaoluwa Osuntokun
5a960269f2
Merge pull request #8378 from guggero/fundpsbt-coin-select
walletrpc: unify coin selection, allow coin selection for PSBT with pre-defined inputs
2024-02-26 16:05:07 -08:00
Oliver Gugger
c307d1eeda
docs: document fundtemplate sub command, add release notes 2024-02-26 11:06:26 +01:00
Oliver Gugger
6dea39c23a
itest: add new test for FundPsbt with coin selection 2024-02-26 11:06:22 +01:00
Oliver Gugger
f333581d6c
cmd/lncli: add 'wallet psbt fundtemplate' command
This commit adds a new sub command to the wallet that allows using the
new funding option from a template.
Creating a new command is way easier for the user to understand than
adding multiple flags that are only valid in certain combinations.
2024-02-26 11:05:19 +01:00
Oliver Gugger
54fa5805c2
lnwallet+lnrpc: add address index to ListAddresses
For the itest in the next commit we'll need to be able to fetch the
input information for an address over RPC. The only piece missing is the
address' index, which we add in this commit. Everything else should be
derivable from the ListAddresses and ListAccounts calls.
2024-02-26 11:05:19 +01:00
Oliver Gugger
fb20cd598e
lnwallet+lnrpc: add derivation info for P2TR change addrs
In some situations (for example in Taproot Assets), we need to be able
to prove that an address is a bare BIP-0086 address that doesn't commit
to any script. We can do that by providing the BIP-0032 derivation info
and internal key.
2024-02-26 11:05:18 +01:00
Olaoluwa Osuntokun
166b2fdb97 fn: add UnwrapOrErr and UnwrapOrFail to Option
In this commit, we add two new methods that simplify usage of an
handling a value wrapped in an Option. Thes methods allow a caller to
force the nil/None check up front, and either obtain the value, or fail
the current execution or test.

This should replace most usages of `UnsafeFromSome` where ever used
today.
2024-02-24 17:21:37 -08:00
Oliver Gugger
094fdbfa72
walletrpc: implement third PSBT funding option
And now we finally implement the new funding option: Allowing coin
selection with pre-defined inputs and outputs.
2024-02-23 08:58:10 +01:00
Oliver Gugger
0f6c25a773
walletrpc: add PsbtCoinSelect option to FundPsbt 2024-02-23 08:58:10 +01:00
Oliver Gugger
446152e1a5
walletrpc: refactor to prepare for third funding option
In the following commits we'll add a new, third, funding option for
funding PSBTs: It will allow users to specify pre-selected inputs but
still request the wallet to perform coin selection up to the total
output sum amount.
2024-02-23 08:58:10 +01:00
Oliver Gugger
17645cd196
multi: add DecorateInputs to WalletController interface
This commit adds the new DecorateInputs method of the base wallet to the
WalletController interface.
2024-02-23 08:58:10 +01:00
Oliver Gugger
90c2926fdf
input: add AddOutput method to TxWeightEstimator
This commit adds a helper method to estimate the weight of an output by
the given pkScript.
2024-02-23 08:58:10 +01:00
Oliver Gugger
6773d6a6f6
btcwallet: add EstimateInputWeight helper function
This is a helper function that we will need to accurately determine the
weight of inputs specified in a PSBT.
Due to the nature of P2WSH and script-spend P2TR inputs, we can only
accurately estimate their weights if the full witness is already known.
So this helper function rejects inputs that use a script spend path but
don't fully specify the complete witness stack.
2024-02-23 08:58:09 +01:00
Oliver Gugger
7aa3662ea2
chanfunding: export change amount calculation
We want to re-use the logic that determines what change amount is left
over depending on whether we add or don't add a change output to a
transaction, respecting the change output's dust limit.
2024-02-23 08:58:09 +01:00
Oliver Gugger
2619c03d7d
chanfunding: allow using existing change output
We'll want to be able to tell the coin selection algorithm that we
intend to add any change to an existing output instead of assuming that
a change output is always created.
If we add any left over change to an existing output, we can skip the
dust amount check as we assume the selected existing output already has
a non-dust amount requested (responsibility of the caller to assert).
2024-02-23 08:58:09 +01:00
Oliver Gugger
4c82fb6cbb
chanfunding: make coin selection generic
Before this commit the coin selection logic in the chanfunding package
would always assume that there is a P2WSH funding output and potentially
a P2TR change output. But because we want to re-use the coin selection
for things other than just channel funding, we make the logic more
generic by allowing us to specify both the existing weight of the
transaction (the already known, static parts of the TX) as well as the
type of the potential change output we would use.
2024-02-23 08:58:09 +01:00
Oliver Gugger
9bdddbcc56
mod+chanfunding: use coin selection strategy for channel funding
The wallet assembler is now aware of the node config level coin
selection strategy, so we can use it when creating new channels.
2024-02-23 08:58:09 +01:00
Oliver Gugger
f7198c4105
walletrpc+subserver_config: add coin selection strategy
With this commit we also add the config-level coin selection strategy to
the wallet RPC server.
2024-02-23 08:58:09 +01:00
Oliver Gugger
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