Commit Graph

1466 Commits

Author SHA1 Message Date
Torakushi
77d3f00c3b
walletrpc+btcwallet: no custom account with various key scopes
Currently, a user can create a custom account with various key scopes.
This is not a desired behaviour.
2023-06-14 09:58:53 +02:00
Torakushi
dd5ed71669
btcwallet: remove LookupAccount because of non-deterministic result
In theory, it should be only one custom account with a given name. However,
users could have created custom accounts with various key scopes. In that case,
'LookupAccount' has a non deterministic behaviour. To fix that, we browse
through all key scopes (deterministically) and return the first account we found.
2023-06-14 09:58:52 +02:00
Torakushi
2ef5ea9742
btcwallet: fix non-deterministic behaviour in ListAccounts
In theory, it should be only one custom account with a given name. However,
due to a lack of check, users could have created custom accounts with various
key scopes. In that case, ListAccounts has to list all these accounts.
2023-06-14 09:58:38 +02:00
Oliver Gugger
56dba2df03
multi: update linter, fix new issues 2023-06-13 11:58:33 +02:00
shaurya947
396a4cb6c4
channeldb: persist channel Memo field and read it when fetching
We add a Memo field to the OpenChannel DB struct. We also persist
it using a tlv record. We then pass the Memo value from the
InitFundingReserveMsg when creating a new reservation for the channel.
Finally, we also read Memo field when fetching channel from DB.
2023-05-18 13:02:30 -04:00
shaurya947
db44924c5a
lnwallet: add Memo to InitFundingReserveMsg
We also pass the value of Memo from funding/manager.go.
2023-05-18 13:02:30 -04:00
Bjarne Magnussen
8c1cf21707 chanfunding: allow to set a reserved amount not used for funding 2023-04-05 23:10:03 +02:00
Slyghtning
5d88693852 lnd+lnwallet: fundmax flag for openchannel 2023-04-05 23:09:11 +02:00
Bjarne Magnussen
0c8aa81ed5 chanfunding: adds ability to fund up to some maximum amount
Allows to define a maximum amount to provision a channel
opening with using a new field `FundUpToMaxAmt` on the
`Request` struct. Also adds a new coin select function
`CoinSelectUpToAmount` to select coins up to a maximum
amount respecting a minimum amount.
2023-04-05 23:05:06 +02:00
ziggie
4da26fb65a
btcwallet+rpcwallet: verify input data for psbt package
Use the new method in the psbt package InputsReadyToSign which
makes sure that each input has either nonWitness Utxo or
witness Utxo data specified.
2023-03-31 08:43:02 +02:00
Oliver Gugger
ec5b95c9a9
Merge pull request #7517 from yyforyongyu/fix-funding-locked
Replace `FundingLocked` with `ChannelReady`
2023-03-30 17:22:17 +02:00
yyforyongyu
00fa2cb34a
lnwallet: add verbose test logs for TestWebAPIFeeEstimator 2023-03-22 23:55:11 +07:00
yyforyongyu
6b9217acfc
multi: replace FundingLocked related docs
This commit replaces `FundingLocked` found in docs using the following
command,
```shell
find . -name "*.go" -exec sed -i '' 's/FundingLocked/ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLock/ChannelReady/g' {} \;
```
2023-03-17 18:21:59 +08:00
Elle Mouton
b607db30f9
lnwallet: add zero-fee-htlc-tx test vectors 2023-03-16 17:27:05 +02:00
Elle Mouton
6774b72913
lnwallet: add same amount and preimage anchors test vector 2023-03-16 17:27:05 +02:00
Elle Mouton
a41f6d5a73
lnwallet: add same amount and preimage legacy test vector 2023-03-16 17:27:04 +02:00
Elle Mouton
4f14193ca9
lnwallet: add new htlc set for test vectors
Add a new test htlc set comprised of htlc 1 from the original set and
two new htlcs, 5 and 6, that use the same preimage and have the same
output value (in sats). This htlc set is used in tests that assert the
ordering of htlcs  that have the same preimage and output value.
2023-03-16 17:27:04 +02:00
Elle Mouton
dbc19b24e5
lnwallet: add funding amount assertion to tests
In this commit, an assertion is added to the bolt 3 commitment tx tests
that ensures that the local and remote balances add up to the expected
funding amount. Adding this assertion uncovered a borked test vector
which is also fixed in this commit.
2023-03-16 17:27:04 +02:00
Elle Mouton
09ff853b9c
lnwallet: lint bolt 3 test vectors func 2023-03-16 17:27:04 +02:00
Elle Mouton
15da50df10
lnwallet: remove dead code 2023-03-16 17:27:04 +02:00
Elle Mouton
b5d281dca8
lnwallet: run commitment tx tests in parallel 2023-03-16 17:27:03 +02:00
positiveblue
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
Olaoluwa Osuntokun
8754547ded
lnwallet: add tests for the new rebroadcaster logic
We needed to copy some mocks from elsewhere in the codebase, as
otherwise we'd run into an import cycle.
2023-03-10 19:07:50 -08:00
Olaoluwa Osuntokun
10929d80cc
lnwallet: add new rebroadcaster interface, use for background tx publish
In this commit, we add a new Rebroadcaster interface to be used for
publishing transactions passively in the background until they've been
confirmed on chain. This is useful if a tx drops out of the mempool, but
then the pool clears down and has more space available to accept the tx
at the current fee level.
2023-03-10 19:07:35 -08:00
yyforyongyu
edba938996
multi: add new build tag integration
This commit adds a new build tag `integration` and removes the old tag
`rpctest` for clarity. Multiple unnecessary usages of `build !rpctest`
is also removed.
2023-02-23 21:56:09 +08:00
Oliver Gugger
d44823f6e8
Merge pull request #7431 from Crypt-iQ/remove_res_ids
lnwallet: remove from reservationIDs
2023-02-21 12:36:10 +01:00
eugene
2c7f118d4e
lnwallet: remove from reservationIDs 2023-02-20 12:47:45 -05:00
Elle Mouton
91a2cd45d8
lnwallet: make spendTx param in NewBreachRetribution optional
In this commit, the NewBreachRetribution function is adjusted so that a
caller can optionally set the spendTx parameter to nil. In this case,
the function will check the revocation log to see if the local and
remote amount fields are available there and use them if they are.
If the fields are not present, which they might not be given a previous
migration that removed the fields, then an error is returned.
2023-02-16 20:47:35 +02:00
Oliver Gugger
f245591e4b
Merge pull request #7386 from guggero/remote-signer-p2tr-inputs
remote signer: fix channel funding with mixed funding input types
2023-02-14 12:34:11 +01:00
Torakushi
cdb015223b
walletrpc+lnwallet: possibility to define an address type for changes in FundPsbt
By default, P2TR addresses are used for changes. However, some users
might encounter some problems with this change. We add the possibility
to define a custom address type in FundPsbt for default/imported accounts
(only P2TR for now). If no address type is specified for these accounts,
we will use P2WKH by default.
2023-02-08 12:35:44 +01:00
Oliver Gugger
df1ea46d9e
rpcwallet: fix p2tr inputs in remote signing
The SendOutputs method isn't used very often in our code so the missing
Taproot sighash type wasn't detected before.
Also, a P2TR input will never have a sigScript, so we can explicitly set
that parameter to nil instead of relying on it being nil anyway.
2023-02-07 22:15:13 +01:00
Oliver Gugger
8bc16b4fb2
rpcwallet: fix np2wkh inputs in remote signing
There is a one byte difference between the sigScript and the
witnessScript in case of a np2wkh input. The remote signer actually
needs the witness script and not the sig script to produce a valid
signature.
2023-02-07 22:15:12 +01:00
Oliver Gugger
a2a96c7712
lnwallet: don't re-use sign descriptor
Fixes an issue where re-using a sign descriptor in a loop carried over
signing information from one call to the next, which caused the remote
signing issue.
2023-02-07 22:15:10 +01:00
Oliver Gugger
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
Oliver Gugger
dcf21e506a
lnwallet: fix linter issues in signer 2023-02-06 10:50:30 +01:00
Oliver Gugger
13252aec1d
lnrpc+rpcwallet: add version to MuSig2 RPC calls 2023-02-06 10:50:29 +01:00
Oliver Gugger
ce5fa2e043
multi: add version to MuSig2 API, bump btcd/btcec to v2.3.2
With this commit we bump the github.com/btcd/btcec/v2 library to v2.3.2
which implements the MuSig2 BIP version v1.0.0rc2. With this the
github.com/btcsuite/btcd/btcec/v2/schnorr/musig2 package becomes
v1.0.0rc2 and the github.com/lightningnetwork/lnd/internal/musig2v040
stays at the old v0.4.0 version.
2023-02-03 18:30:10 +01:00
Oliver Gugger
0e5ce71b33
input+lnwallet: put MuSig2 types behind interface
We put the calls that don't use musig2 package specific types as
parameters or return values behind an interface so we can easily call
those directly in the RPC without needing to know the underlying
implementation version. Some calls can't be used in the interface
because they use the specific package version's types. These calls are
implemented in helper functions in the input package instead that do the
necessary type switches.
2023-02-03 18:30:10 +01:00
Oliver Gugger
13789f5d95
input+lnwallet: move some MuSig2 calls to input pkg
As a preparation for making it possible to version switch calls to the
MuSig2 API, we move some of the calls to the input package where in a
future commit we'll call the corresponding code in the correct package.
2023-02-03 18:30:09 +01:00
Oliver Gugger
4f5ede84c6
lnwallet: fix variable names 2023-02-03 18:30:09 +01:00
Joost Jager
7a785c74c4
channeldb: final htlc resolution storage opt-in 2023-01-26 07:02:17 +01:00
Olaoluwa Osuntokun
843c62b59d
lnwallet: ensure that SignOutputRaw can sign w/ non-default sighash for schnorr sigs
Before this commitment, we'd end up failing in `schnorr.ParseSignature`
if a non-default sighash was used. To fix that, we'll slice the
signature to only pass in the sig w/o the sighash flag.
2023-01-24 19:47:29 -08:00
Joost Jager
b50d59ec2e
lnwallet/test: assert final resolution db storage 2023-01-24 13:34:02 +01:00
ziggie
39b77edca1
btcwallet: fix typo 2023-01-24 09:23:47 +01:00
yyforyongyu
47c5809081
lnwallet: add verbose log for ErrBelowChanReserve 2023-01-18 10:53:53 +08:00
Olaoluwa Osuntokun
ea0eb2ce72
Merge pull request #7215 from positiveblue/invoices-channeldb-dep
Invoices: invert package dependency with `channeldb`
2023-01-17 10:13:22 -08:00
Oliver Gugger
b4febb382a
Merge pull request #6823 from yyforyongyu/4-new-itest
itest: continued itest refactor and fix - III
2023-01-17 09:38:31 +01:00
yyforyongyu
f9ede5af73
funding+lnwallet: add more debug logs 2023-01-17 07:26:57 +08:00
positiveblue
383cb40f8d
multi: create channeldb/models package
Add a new subpackage to `lnd/channeldb` to hold some of the types that
are used in the package itself and in other packages that should not
depend on `channeldb`.
2023-01-16 07:14:55 -08:00
Carsten Otto
7f7a1e041d lnwallet: add log message for edge case
also see discussion in #7108
2023-01-16 12:26:04 +01:00