Commit Graph

1408 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
9eb1e8721a
lnwallet/chancloser: add tests for the new max fee behavior 2022-07-26 17:23:11 -07:00
Olaoluwa Osuntokun
106912b015
lnwallet/chancloser: remove raw state machine pointer, add channel interface
In this commit, we remove the raw channel state machine pointer from the
chan closer and instead replace that with an interface that captures
*just* the methods we need in order to do the co-op close dance.

This is a preparatory refactoring for some upcoming unit tests.
2022-07-26 17:23:08 -07:00
Olaoluwa Osuntokun
4a997bfdd2
lnwallet: add new AbsoluteThawHeight method
This lets callers get the thaw height without needing to first obtain a
snapshot of the channel state.
2022-07-26 17:23:05 -07:00
Olaoluwa Osuntokun
c140da8f49 lnwallet/chancloser: remove the commit fee clamp, introduce max fee
In this commit, we stop clamping the ideal fee rate to the commitment
fee of the channel. This catches us up to this PR of the spec:
https://github.com/lightning/bolts/pull/847.

We also do away with the old 3x ideal fee "max fee", and replace that
with an explicit max fee. This new max fee will either be the default
multiplier of the ideal fee, or a new user specified max fee value.
2022-07-26 17:20:23 -07:00
Oliver Gugger
e6b25309bd
Merge pull request #6731 from guggero/linter-upgrade
tools: upgrade linter version to v1.46.2
2022-07-15 11:25:25 +02:00
ErikEk
b5af0ce327
signrpc: add schnorr sig to sign and validate msg 2022-07-14 10:29:29 +02:00
Oliver Gugger
850330a34e
multi: fix linter issues
Fix some issues found by the new nonamedreturn rule and rename some
nolint comment to the new rule name.
2022-07-14 09:30:53 +02:00
Oliver Gugger
9fd9234d86
lnwallet: don't create BIP044 key scope by default
With a change in #6379 we made sure that all default scopes are added to
the the wallet. Unfortunately this included the BIP044 key scope that
our wallet doesn't really use. This breaks the remote signing setup
because we don't export the account of the BIP044 scope and therefore
run into an issue on the watch-only side when attempting to create the
wallet.
2022-07-08 14:32:03 +02:00
eugene
21c83b0744
lnwallet: extend Reservation with alias chan-type, feature-bit flags
This extends the Reservation arguments to include whether a pending
channel open has negotiated the zero-conf channel type, the scid-alias
channel type, and/or the scid-alias feature bit. The result of those
negotiates are stored in the OpenChannel's ChanType. The arguments to
NewChannelReservation have also been simplified.
2022-07-07 17:10:27 -04:00
Oliver Gugger
63ec849605
lnwallet: fix bug in SignPsbt with np2wkh addresses
Fixes #6626.
If either of the two fields FinalScriptSig or FinalScriptWitness is set
on an input of a PSBT then that results in most of the fields of that
input not to be serialized in the packet anymore, since the input is
considered to be complete.
But because a signer isn't supposed to set any of the Final* fields,
this was wrong from the beginning. Only the finalizer will set those
fields.
2022-06-30 10:27:39 +02:00
priyanshiiit
150c0b5de8 lnwallet: adds RequiredReserve method 2022-06-28 23:31:51 +05:30
priyanshiiit
fce7fb43ba lnwallet: exports fields related to AnchorChans 2022-06-28 23:31:51 +05:30
priyanshiiit
61493a5f29 lnwallet: add previous_outpoints to ListTransactionDetails 2022-06-27 15:57:57 +05:30
Tommy Volk
9a10c80bcb multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00:00
Oliver Gugger
427702dbe6
rpcwallet: use PSBT prev out fetcher 2022-06-10 22:03:45 +02:00
Oliver Gugger
70103a1838
multi: return more information in list of leased outputs
With this commit we return the additional information the wallet now
provides about locked/leased outputs.
2022-05-12 10:24:40 +02:00
Oliver Gugger
9f4f0e94f5
multi: avoid direct use of dcrec/secp256k1 library
Because the original dcrec secp256k1 library that is used for the
Schnorr signature primitives uses different hash algorithms than the
btcd secp256k1 library. Therefore pulling in the wrong library can lead
to weird and unexpected errors. We try to make it harder to make the
mistake by not using the library directly in lnd in the first place.
Note that it is still indirectly needed by the btcd secp256k1 library,
therefore the module dependency is still expected to be there, just
moved to the indirect section.
2022-05-11 10:07:52 +02:00
Oliver Gugger
d1a151010a
lntest+rpcwallet: support remote p2tr script spend signing 2022-05-11 10:07:51 +02:00
Oliver Gugger
7f4e977073
lntest+rpcwallet: support remote p2tr key spend signing 2022-05-11 10:07:50 +02:00
Oliver Gugger
35dd2d25ea
btcwallet: support taproot script signing in PSBT 2022-05-11 10:07:50 +02:00
Oliver Gugger
0f32a4456d
btcwallet: support taproot key spend signing in PSBT 2022-05-11 10:07:50 +02:00
Oliver Gugger
e4aa32fdf7
btcwallet: prepare for supporting new signing methods 2022-05-11 10:07:49 +02:00
Olaoluwa Osuntokun
630fc36dcf
multi: introduce and use new TapTweak and SignMethod fields
In this commit, we add a new field `TapTweak` to be used for key path
spends. Before this commit, we'd overload the existing `WitnessScript`
field to pass this information to the signing context. This was
confusing as for tapscript spends, this was the leaf script, which
mirrors the other script based spending types.

With this new filed, users need to set this to the script root for
keypath spends where the output key commits to a real merkle root, and
nothing when bip 86 spending is being used.

To make the signing even more explicit, we also add a new field called
sign_method with an enum type that differentiates between the different
segwit v0 and v1 signing methods.

Fixes https://github.com/lightningnetwork/lnd/issues/6446.
2022-05-11 10:07:49 +02:00
Oliver Gugger
5395a0fe6b
rpcwallet: attempt to locate UTXO information in prev output fetcher
Since we might now be given a whole list of UTXOs in the PrevOutputs
field of the SignOutputRaw RPC, the previous output fetcher might
contain the information we require for the remote signing case. So
instead of failing if our wallet doesn't know each input that's being
spent, we fall back to the UTXO information contained in the previous
outputs.
2022-05-11 10:07:48 +02:00
Elle Mouton
f766268e8c
lnwallet/test: test against bitcoind-rpc-polling backend 2022-05-11 09:02:13 +02:00
Elle Mouton
5a08788a05
multi: update btcwallet to v0.15.0
Update go.mod to point to latest btcwallet version.
2022-05-11 08:45:06 +02:00
Oliver Gugger
18cf06ddd1
chanfunding: fix sighash type for p2tr inputs
This commit fixes the default sighash type for p2tr channel funding
transaction inputs.
2022-05-10 18:13:00 +02:00
Oliver Gugger
631b2af818
btcwallet: support p2tr input info type detection 2022-05-10 18:03:29 +02:00
Oliver Gugger
8980471d57
chanfunding: support p2tr input fee calculation
With this commit we support fee calculation in coin selection for p2tr
inputs. We assume that coins in our UTXO selection are only BIP0086
coins. Any other input types with different spend paths won't be
selected by the wallet assembler.
2022-05-10 18:01:14 +02:00
Olaoluwa Osuntokun
0ec88b5346
Merge pull request #6347 from yyforyongyu/5388-rm-revc-log
lnwallet+channeldb: store minimal info in revocation log bucket
2022-05-05 15:52:59 -07:00
Oliver Gugger
bdd1c5c4e1
Merge pull request #6423 from tvolk131/fix_typos
Typo fixes and code cleanup
2022-05-05 09:42:39 +02:00
Oliver Gugger
7e11f64650
rpcwallet: only shut down on RPC error 2022-05-04 19:23:58 +02:00
Oliver Gugger
95ff670c0e
multi: add MuSig2Cleanup method to MuSig2 signer 2022-05-04 19:23:58 +02:00
Tommy Volk
5ae2ce984e multi: typo fixes [skip ci] 2022-05-03 20:55:40 +00:00