Commit Graph

1442 Commits

Author SHA1 Message Date
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
positiveblue
c602ac07e7
chainntnfs: move cache implementation to channeldb
This commit moves the `HeightHintCache` implementation to the
`channeldb` package and inverts the dependency relation between
`chainntnfs` and `channeldb`.

Many packages depend on channeldb for type definitions,
interfaces, etc. `chainntnfs` is an example of that. `chainntnfs`
defines the  `SpendHintCache` and `ConfirmHintCache` interfaces but
it also implments them (`HeightHintCache` struct). The implementation
uses logic that should not leak from channeldb (ex: bucket paths).
This makes our code highly coupled + it would not allow us to use any
of these interfaces in a package that is imported by `channeldb`
(circular dependency).
2023-01-16 03:13:17 -08:00
positiveblue
2204cbfd30
rpc: validate closing channel address in open channel requests
Our OpenChannelRPC was accepting invalid values for the closing address
field. If we were able to decode the address we would use it in the
script even if the address is for another bitcoin net.
2023-01-04 04:42:39 -08:00
Olaoluwa Osuntokun
d75c86f3dd
lnwallet: skip dual funding test as not exposed on p2p layer
The internal messages both sides exchange haven't been updated to send
all the information needed to compute a tapscript sighash.
2022-11-22 13:44:54 +01:00
Olaoluwa Osuntokun
7090ff22d7
lnwallet: assert that P2TR addrs are used for change outputs 2022-11-22 13:44:54 +01:00
Olaoluwa Osuntokun
51f131b019
build: update to latest version of btcutil+btcwallet 2022-11-22 13:44:54 +01:00
Oliver Gugger
ad8e25cbc9
multi: don't access loop variables in goroutines
This commit makes sure that no loop variables or other temporary
variables are accessed directly in a goroutine but are instead passed
into the goroutine through a parameter. This makes sure a copy of the
value is put on the stack and is not changed while the outside loop
continues.
2022-11-21 13:54:23 +01:00
Oliver Gugger
5bd3e91750
rpcwallet: pass prev output fetcher into ComputeInputScript
This commit fixes signing of Taproot inputs when some of the other
inputs of the transaction are not known to the wallet (such as a Pool
account for example).
If we want to sign for a Taproot (change) input when depositing into a
Pool account the wallet won't know the Pool account input. So we need to
make sure we pass it along inside the PrevOutputFetcher (which contains
the UTXO information extracted from the PSBT).
2022-11-11 10:20:09 +01:00
Oliver Gugger
ed2e542515
rpcwallet: don't re-use sign desc in loop
This commit fixes an issue with signing for mixed inputs in a remote
signing setup where the re-use of the sign descriptor would lead to the
sign method not being reset correctly if a p2wkh input is following a
p2tr input.
2022-11-11 10:20:09 +01:00
habibitcoin
0b1e881d18
scripted-diff: replace ⛰ emoji with $ [skip ci]
-BEGIN VERIFY SCRIPT-
sed -i 's/⛰/$/g' $(git grep -l '⛰')
-END VERIFY SCRIPT-
2022-10-28 12:06:49 -04:00
Joost Jager
28256b7ea8
htlcswitch: keep final htlc outcome 2022-10-27 16:42:36 +02:00
Oliver Gugger
d2d3cf3408
Merge pull request #6956 from ellemouton/configureChanReserve
multi: configurable remote chan reserve
2022-10-13 15:39:40 +02:00
Eng Zer Jun
c70e39cd21
multi: replace defer cleanup with t.Cleanup
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-10-13 17:46:54 +08:00
Olaoluwa Osuntokun
30eb6770e5
lnwallet/chancloser: fix loop variable shadowing in TestMaxFeeBailOut 2022-10-10 14:50:51 -07:00
Olaoluwa Osuntokun
2482de9cab
lnwallet/chancloser: properly compute initial fee of cop close txn
In this commit, we modify the way we compute the starting ideal fee for
the co-op close transaction. Before thsi commit, channel.CalcFee was
used, which'll compute the fee based on the commitment transaction
itself, rathern than the co-op close transaction. As the co-op close
transaction is potentailly bigger (two P2TR outputs) than the commitment
transaction, this can cause us to under estimate the fee, which can
result in the fee rate being too low to propagate.

To remedy this, we now compute a fee estimate from scratch, based on the
delivery fees of the two parties.

We also add a bug fix in the chancloser unit tests that wasn't caught
due to loop variable shadowing.

The wallet import itest has been updated as well, since we'll now pay
600 extra saothis to close the channel, since we're accounting for the
added weight of the P2TR outputs.

Fixes #6953
2022-10-10 14:50:45 -07:00
Elle Mouton
10f0eddd51
multi: verify channel constraints on funding request
In this commit, the sanity checks in the CommitConstraints method is
moved out into a helper function called VerifyConstraints. This is done
so that the sanity checks can be performed more easily else where in the
code base. The new helper method is then called in the
handleInitFundingMsg method of the funding manager before the
OpenChannelMessage is sent.
2022-10-07 14:57:05 +02:00
Oliver Gugger
0d6e791042
lntest+lnwallet: add ImportTaprootScript to wallet interface 2022-08-25 09:20:23 +02:00
Eng Zer Jun
9acd53a5de
lnwallet: use T.TempDir to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-24 09:03:05 +08:00
yyforyongyu
0735522194
multi: fix make fmt 2022-08-23 22:10:24 +08:00
priyanshiiit
99e4728eb7 lnwallet: adds list addresses method 2022-08-18 07:58:24 +05:30
Slyghtning
b2e624cd52 psbt: Indicate which psbt inputs were signed 2022-08-16 19:31:06 -04:00
Olaoluwa Osuntokun
42549519ca
lnwallet/chanfunding: assumes all change outputs are P2TR 2022-08-11 17:26:23 -07:00
Olaoluwa Osuntokun
322937a67e
lnwallet: use P2TR addresses for change outputs for funding coin select 2022-08-11 17:26:21 -07:00
Olaoluwa Osuntokun
a61b6c25b3
lnwallet/chanclose: update ProcessCloseMsg to check co-op close addrs
We only want to allow p2wkh, p2tr, and p2wsh addresses, so we'll utilize
the newly public wallet function to restrict this.
2022-08-10 18:44:31 -07:00
Olaoluwa Osuntokun
c79ffc07ce
lnwallet: export ValidateUpfrontShutdown and restrict allowed addrs
In this commit, we catch up our logic with the latest version of the
spec that removed support for normal p2kh and p2sh addresses for co-op
closes, in order to make dust calculations more uniform.
2022-08-10 18:44:29 -07:00