Commit Graph

282 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
0ee9b02094
lnwallet: add awareness of taproot overlay chan type to reservations 2024-10-02 18:10:06 -07:00
Olaoluwa Osuntokun
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
Olaoluwa Osuntokun
bcb66585d4
funding+lnwallet: finish hook up new aux funding flow
For the initiator, once we get the signal that the PSBT has been
finalized, we'll call into the aux funder to get the funding desc. For
the responder, once we receive the funding_created message, we'll do the
same.

We now also have local+remote aux leaves for the commitment transaction.

Some old TODO comments that in retrospect aren't required anymore are
removed as well.
2024-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
7ec48a5054
funding+lnwallet: only blind tapscript root early in funding flow
In this commit, we modify the aux funding work flow slightly. We won't
be able to generate the full AuxFundingDesc until both sides has
sent+received funding params. So we'll now only attempt to bind the
tapscript root as soon as we send+recv the open_channel message.

We'll now also make sure that we pass the tapscript root all the way
down into the musig2 session creation.
2024-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
72beb7955d
lnwallet: use AuxFundingDesc to populate all custom chan info
With this commit, we'll now populate all the custom channel information within the OpenChannel and ChannelCommitment structs.
2024-09-18 10:25:40 +02:00
Olaoluwa Osuntokun
116a6430f0
lnwallet: add new AuxFundingDesc struct
This struct will house all the information we'll need to do a class of custom channels that relies primarily on adding additional items to the tapscript root of the HTLC/commitment/funding outputs.
2024-09-18 10:25:40 +02:00
Oliver Gugger
b45d72fe59
multi: thread thru the AuxLeafStore everywhere 2024-08-28 13:26:14 +02:00
Olaoluwa Osuntokun
d95c1f93f3
lnwallet+channeldb: add new AuxLeafStore for dynamic aux leaves
In this commit, we add a new AuxLeafStore which can be used to dynamically fetch the latest aux leaves for a given state. This is useful for custom channel types that will store some extra information in the form of a custom blob, then will use that information to derive the new leaf tapscript leaves that may be attached to reach state.
2024-08-28 13:21:08 +02:00
Olaoluwa Osuntokun
c8b7987a39
lnwallet: update internal funding flow w/ tapscript root
This isn't hooked up yet to the funding manager, but with this commit, we can now start to write internal unit tests that handle musig2 channels with a tapscript root.
2024-08-28 11:52:31 +02:00
Olaoluwa Osuntokun
2c56b3120a
multi: add new tapscript root option to GenTaprootFundingScript
This'll allow us to create a funding output that uses musig2, but uses a tapscript tweak rather than a normal BIP 86 tweak.
2024-08-28 11:52:31 +02:00
yyforyongyu
aba8507b2a
lnrpc+lnwallet: replace FetchInputInfo with new methods
This commit replaces the usage of `FetchInputInfo` with
`FetchOutpointInfo` and `FetchDerivationInfo` to remove unncessary
fetching of the derivation path.
2024-08-09 21:51:18 +08:00
Keagan McClelland
e3a9d0acbe
multi: break ChannelConstraints into two sub-structures
This commit breaks the ChannelConstraints structure into two
sub-structures that reflect the fundamental differences in how
these parameters are used. On its face it may not seem necessary,
however the distinction introduced here is relevant for how we
will be implementing the Dynamic Commitments proposal.
2024-08-01 12:00:32 -07:00
Keagan McClelland
0996e4f163
multi: refactor lnwallet/channel.go to use ChannelParty in select places
We also include changes to contractcourt, htlcswitch and peer to stitch the
boundaries together.
2024-07-31 14:50:26 -07:00
zoupingshi
30047feb35 chore: fix some comments
Signed-off-by: zoupingshi <hellocatty@tom.com>
2024-05-31 15:16:33 +08:00
ziggie
62a52b4d7c
multi: Utxo restriction single funding case.
Restrict the utxo selection when opening a single internal wallet
funded backed channel.
2024-04-24 13:58:19 +01:00
Alex Akselrod
cefbb77b1e
lnwallet: use ReleaseOutput instead of UnlockOutpoint 2024-03-13 09:50:17 -07:00
Alex Akselrod
6ad86a800c
chanfunding: use {Lease|Release}Output not {Lock|Unlock}Outpoint 2024-03-13 09:50:16 -07: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
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
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
Keagan McClelland
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
Afanti
452b2d5a80
fix: remove duplicate words [skip ci]
There are some unnecessary duplicate words in the source file. Use this change to remove them. The CI can be skipped.
2024-01-04 04:47:03 +08:00
Yong
ec2377db79
funding: remove dead code and sanity check pending chan ID (#7887)
* funding: remove unused field `newChanBarriers`

This commit removes the occurance of `newChanBarriers` as it's not used
anywhere.

* funding: rename method names to clear the funding flow

Slightly refactored the names so it's easier to see which side is
processing what messages.

* lnwallet: sanity check empty pending channel ID

This commit adds a sanity check to make sure an empty pending channel ID
will not be accepted.
2023-10-09 10:58:18 +02:00
Olaoluwa Osuntokun
aaba144804
multi: fix linter warnings 2023-08-22 16:32:00 -07:00
Olaoluwa Osuntokun
c9fc508083
lnwallet/chanvalidate: update ValidateChannel to recognize taproot chans 2023-08-22 16:31:36 -07:00
Olaoluwa Osuntokun
67ecefaac3
lnwallet: integrate new taproot channels into internal funding flow
In this commit, we build on all the prior commits and integrate the new
taproot channels into the existing internal funding flow. Along the way,
we do some refactoring to unify things like signing and verifying
incoming commitment transaction signatures.

For our local nonce, we use the existing functional option type to
derive the nonce based on the initial shachain pre-image we'll use as
our revocation.
2023-08-22 16:31:07 -07:00
Olaoluwa Osuntokun
9e8b00241f
lnwallet: set new musig2 bool for chanfunding.Request in handleFundingReserveRequest 2023-08-22 16:31:05 -07:00
ziggie
2708626d62
lnwallet: add CancelRebroadcast method.
Adding the ability to stop rebroadcasting a transaction. This is
useful when we want to abandon a channel and grantee that this
transaction will not confirm accidentally.
2023-08-08 09:31:16 +02:00
Slyghtning
d327c92188
lnwallet: adds selected Outpoints for funding 2023-07-24 12:10:54 +02: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
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
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
eugene
2c7f118d4e
lnwallet: remove from reservationIDs 2023-02-20 12:47:45 -05:00
yyforyongyu
f9ede5af73
funding+lnwallet: add more debug logs 2023-01-17 07:26:57 +08: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
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
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
priyanshiiit
fce7fb43ba lnwallet: exports fields related to AnchorChans 2022-06-28 23:31:51 +05:30
Oliver Gugger
f130eddb92
multi: use prev output fetcher where possible 2022-03-24 18:02:37 +01:00
Oliver Gugger
72c9582b85
multi: bump btcd to taproot aware version 2022-03-24 15:00:25 +01:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
yyforyongyu
46050fc631
multi: enhance logging for debugging peer connection 2021-12-23 15:14:37 +08:00
Martin Habovstiak
ec24767b9b lnwallet: don't enforce new reserved value in PSBT midstep
This change avoids enforcing new reserved value when PSBT funding is not
finished yet as new inputs and outputs may still be added that could
change the outcome of the check.

This originally failed in the scenario when funding a channel from
external wallet *and depositing to on-chain wallet* was done
simultaneously in a single transaction. If such transaction confirms
then reserved UTXO is guaranteed to be available but the check didn't
take it into account.

The enforcement still occurs in the final step of PSBT funding flow, so
it is safe. It also occurs in case of non-PSBT funding.
2021-12-10 00:22:17 +01:00
Wilmer Paulino
8cfb53f64a
lnwallet: support transactions and scripts for new commitment type
This commit modifies the channel state machine to be able to derive the
proper commitment and second-level HTLC output scripts required by the
new script-enforced leased channel commitment type.
2021-10-19 18:30:32 -07:00
Wilmer Paulino
564ec0fd9b
funding+lnwallet: support funding new script enforced leased channels 2021-10-19 18:30:22 -07:00
Oliver Gugger
1608faf199
multi: allow skipping the PSBT finalize step
The FundingPsbtFinalize step is a safety measure that assures the final
signed funding transaction has the same TXID as was registered during
the funding flow and was used for the commitment transactions.
This step is cumbersome to use if the whole funding process is completed
external to lnd. We allow the finalize step to be skipped for such
cases. The API user/script will need to make sure things are verified
(and possibly cleaned up) properly.
2021-10-04 11:17:08 +02:00