Commit graph

1694 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
1c92c79f15 sweep: add new AuxSweeper interface
In this commit, we add a new AuxSweeper interface. This'll take a set of
inputs, and a change addr for the sweep transaction, then optionally
return a new sweep output to be added to the sweep transaction.

We also add a new NotifyBroadcast method.  This'll be used to notify
that we're _about_ to broadcast a sweeping transaction. The set of
inputs is passed in, which allows the caller to prepare for the ultimate
broadcast of the sweeping transaction.

We also add ExtraTxOut to BumpRequest pass fees to NotifyBroadcast. This
allows the callee to know the total fee of the sweeping transaction.
2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
70d53a83c0 lnwallet+peer: move internalKeyForAddr to lnwallet package
This way we can re-use it. We also make it slightly more generalized.
2024-06-21 13:18:16 -07:00
Olaoluwa Osuntokun
5a5669d63a lnwallet: add new aux resolver interface
This will be used by external callers to modify the way we resolve
contracts on chain. For a given contract, we'll store an extra "blob",
that will later be presented during the sweeping phase.
2024-06-21 13:18:16 -07:00
Oliver Gugger
d6e1d19fa1
chancloser: always set close output
We always need to set the close output in order for us to be able
to calculate the closing keys. Especially if there is only a dust
balance in BTC terms but perhaps a valuable amount in custom channel
funds.
2024-06-07 16:07:55 +02:00
Olaoluwa Osuntokun
daa9226dae
peer: decorate delivery addr w/ internal key
In this commit, we move to add the internal key to the delivery addr. This way, we give the aux chan closer the extra information it may need to properly augment the normal co-op close process.
2024-06-04 16:06:04 +02:00
Olaoluwa Osuntokun
e7747442d3
lnwallet: modify CoopCloseBalance to not depend on chan commit 2024-06-03 11:33:36 +02:00
Olaoluwa Osuntokun
c76376594b
lnwallet/chancloser: add aux chan closer, use in coop flow 2024-06-03 11:33:36 +02:00
Olaoluwa Osuntokun
db373c5da9
lnwallet/chancloser: add new AuxChanCloser interface 2024-06-03 11:33:35 +02:00
Olaoluwa Osuntokun
a7c8595d2b
lnwallet: add ability to do custom sort for coop close txn 2024-06-03 11:33:35 +02:00
Olaoluwa Osuntokun
7ee24fcb13
lnwallet: add ability to add extra co-op close outputs 2024-06-03 11:33:35 +02:00
Olaoluwa Osuntokun
73407be75d
lnwallet: add FundingBlob method to LightningChannel 2024-06-03 11:33:35 +02:00
Oliver Gugger
1f86f38f36
Merge remote-tracking branch 'origin/master' into 0-19-staging 2024-05-28 13:55:23 +02:00
Oliver Gugger
d2d50649ce
lnwallet: add HTLC index to commitment sorting function
To avoid sorting issues with identical HTLCs (equal size, equal payment
hash, equal CLTV), we need to also use the HTLC index to be able to
distinguish between them.
2024-05-27 18:19:47 +02:00
Oliver Gugger
a62600799e
htlcswitch+channeldb+lnwallet: fix CustomRecord decoding
It doesn't make sense to do multiple encode/decode round trips on the
custom data of an HTLC. So we just use the same custom record type
everywhere, which also simplifies some of the code again.
2024-05-27 18:19:47 +02:00
Oliver Gugger
f59c0c12cf
channeldb: add NextHeight, fix formatting 2024-05-27 18:19:45 +02:00
Oliver Gugger
c25b04fbea
lnwallet: add Tree() method, fix formatting 2024-05-27 15:53:10 +02:00
Oliver Gugger
1552a67f3f
lnwallet: export GenTaprootHtlcScript 2024-05-27 15:53:10 +02:00
Oliver Gugger
74ba9e9e4d
lnwallet: export AnchorSize 2024-05-27 15:53:10 +02:00
Oliver Gugger
1f3f954a02
lnwallet: add AddHeight and RemoveHeight funcs 2024-05-27 15:53:10 +02:00
Olaoluwa Osuntokun
ebf9856fac
lnwallet: 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-05-27 13:02:16 +02:00
Olaoluwa Osuntokun
9b869f95bf
lnwallet: add WithAuxSigner option to channel 2024-05-27 13:02:16 +02:00
Olaoluwa Osuntokun
d908e8c2f7
lnwallet: add new AuxSigner interface to mirror SigPool
In this commit, we add a new aux signer interface that's meant to mirror the SigPool. If present, this'll be used to (maybe) obtain signatures for second level HTLCs for certain classes of custom channels.
2024-05-27 13:02:16 +02:00
Olaoluwa Osuntokun
bf307d30d1
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-05-27 12:58:29 +02:00
Olaoluwa Osuntokun
26ab75852b
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-05-27 12:58:29 +02:00
Olaoluwa Osuntokun
28cb4884ca
lnwallet: for PsbtIntent return the internal key in the POutput
We also add a new assertion to the itests to ensure the field is being properly set.
2024-05-27 12:58:28 +02:00
Olaoluwa Osuntokun
a841a9be30
lnwallet: add TaprootInternalKey method to ShimIntent
If this is a taproot channel, then we'll return the internal key which'll be useful to callers.
2024-05-27 12:58:28 +02:00
yyforyongyu
17a089c899
input+lnwallet: apply the new type lntypes.VByte 2024-05-25 13:37:16 +08:00
yyforyongyu
8da68bb7db
multi: apply the new type lntypes.WeightUnit 2024-05-25 13:37:13 +08:00
yyforyongyu
634967c5c8
chainfee: add FeeForVByte on SatPerKWeight 2024-05-24 22:49:20 +08:00
Olaoluwa Osuntokun
54bbc25d9a
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-05-22 18:24:52 +02:00
Olaoluwa Osuntokun
f2c2a82744
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-05-22 18:24:52 +02:00
George Tsagkarelis
3c6d49775e
lnwallet: expose commitment blob from channel 2024-05-22 17:28:21 +02:00
George Tsagkarelis
25b4066b17
multi: use wire records on payment and intercept flows 2024-05-22 14:44:18 +02:00
Tom Kirkpatrick
3837c3f12e
lnwallet: add configurable cache for web fee estimator
Add fee.min-update-timeout and fee.max-update-timeout config options to
allow configuration of the web fee estimator cache.
2024-05-04 14:41:41 +08:00
Oliver Gugger
72f7b80c28
lnwallet: thread thru input.AuxTapleaf to all relevant areas
In this commit, we start to thread thru the new aux tap leaf structures to all relevant areas. This includes: commitment outputs, resolution creation, breach handling, and also HTLC scripts.
2024-05-01 11:19:55 +02:00
Oliver Gugger
33f2db1c25
multi: thread thru the AuxLeafStore everywhere 2024-05-01 11:19:55 +02:00
Olaoluwa Osuntokun
2ac360a1b6
lnwallet: add TLV blob to PaymentDescriptor + htlc add
In this commit, we add a TLV blob to the PaymentDescriptor struct. We also now thread through this value from the UpdateAddHTLC message to the PaymentDescriptor mapping, and the other way around.
2024-05-01 11:19:55 +02:00
Olaoluwa Osuntokun
d5f595e641
channeldb: add custom blobs to RevocationLog+HTLCEntry
This'll be useful for custom channel types that want to store extra information that'll be useful to help handle channel revocation cases.
2024-05-01 11:19:20 +02:00
Olaoluwa Osuntokun
0bf20500a7
channeldb: convert RevocationLog to use RecordT 2024-05-01 11:19:19 +02:00
Olaoluwa Osuntokun
f3655da070
channeldb: convert HTLCEntry to use tlv.RecordT 2024-05-01 11:19:15 +02:00
Olaoluwa Osuntokun
258dd5c96e
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-05-01 10:13:10 +02:00
Olaoluwa Osuntokun
12acbac16a
lnwallet: add custom tlv blob to internal commitment struct
In this commit, we also add the custom TLV blob to the internal commitment struct that we use within the in-memory commitment linked list.

This'll be useful to ensure that we're tracking the current blob for our in memory commitment for when we need to write it to disk.
2024-05-01 10:13:10 +02:00
Olaoluwa Osuntokun
5733bbb55c
lnwallet: export the HtlcView struct
We'll need this later on to ensure we can always interact with the new aux blobs at all stages of commitment transaction construction.
2024-05-01 10:13:09 +02:00
Olaoluwa Osuntokun
6cf449168c
input+lnwallet: update taproot scripts to accept optional aux leaf
In this commit, we update all the taproot scripts to also accept an
optional aux leaf. This aux leaf can be used to add more redemption
paths for advanced channels, or just as an extra commitment space.
2024-05-01 10:13:09 +02:00
Olaoluwa Osuntokun
26ce8ee729
lnwallet: add initial unit tests for musig2+tapscript root chans 2024-04-30 16:39:21 +02:00
Olaoluwa Osuntokun
66fa0a20c1
lnwallet+peer: add tapscript root awareness to musig2 sessions
With this commit, the channel is now aware of if it's a musig2 channel, that also has a tapscript root. We'll need to always pass in the tapscript root each time we: make the funding output, sign a new state, and also verify a new state.
2024-04-30 16:39:21 +02:00
Olaoluwa Osuntokun
9466224805
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-04-30 16:39:20 +02:00
Olaoluwa Osuntokun
a4a7d11e88
multi: update GenTaprootFundingScript to pass tapscript root
In most cases, we won't yet be passing a root. The option usage helps us keep the control flow mostly unchanged.
2024-04-30 16:39:20 +02:00
Olaoluwa Osuntokun
8a0c25b5d6
lnwallet/chanfunding: add optional tapscript root 2024-04-30 16:39:20 +02:00
Olaoluwa Osuntokun
bb0fb862f5
lnwallet/chanfunding: rename assembler.go to interface.go
In this commit, we rename the files as assembler.go houses the primary
interfaces/abstractions of the package. In the rest of the codebase,
this file is near uniformly called interface.go, so we rename the file
to make the repo more digestible at a scan.
2024-04-29 21:36:31 +02:00