Commit graph

16774 commits

Author SHA1 Message Date
Oliver Gugger
09af0cc64c
lnwallet: fix local/remote aux leaf, add local resolution blob 2024-06-25 10:52:29 +02:00
Olaoluwa Osuntokun
808e78bf2c
contractcourt: integration aux sweeper to breach arb
Similar to the sweeper, when we're about to make a new breach
transaction, we ask the sweeper for a new change address, if it has one.
Then when we go to publish, we notify broadcast.
2024-06-25 10:52:25 +02:00
Olaoluwa Osuntokun
14d4c90e58
contractcourt: update makeBreachedOutput to accept resolution blob 2024-06-25 10:51:23 +02:00
Olaoluwa Osuntokun
86cbc2a0ad
contractcourt: update GenSweepScript to return internal key
For the upcoming aux sweeper integration, the internal key is needed for
the call backs.
2024-06-25 10:49:15 +02:00
Olaoluwa Osuntokun
c2927d8212
lnwallet: split ResolutionBlob into local vs remote for breach
When we're handling a breach, we'll be sweeping from both the local and
remote outputs, so we'll carve out two blob areas for that.
2024-06-25 10:46:38 +02:00
Olaoluwa Osuntokun
85e288d1fd
contractcourt: split commit blob into settled vs breached
For the breach case, we'll have more than one output to sweep. So we'll
need more than one blob to use.
2024-06-25 10:46:34 +02:00
Olaoluwa Osuntokun
e01e2be459
Merge pull request #8820 from lightningnetwork/custom-channels-poc-force-close
multi: implement+integrate new AuxSweeper sub-system to allow 3rd parties to add extra outputs to sweep transaction
2024-06-22 20:40:55 -07:00
Olaoluwa Osuntokun
c6e4d621d2 contractcourt: fix witness type bug for taproot chans
We checked for OP_DROP, but both of the local+remote scripts end in `N
OP_CSV OP_DROP`.

So for now, we'll check for the maturity delay, with the assumption that
this won't be 1 for regular taproot chans. Either way, everything else
is correct as the witness is the same, but this may lead to display
issues down the line.
2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
739f82e43a lnwallet: pass tap leaf through in NewLocalForceCloseSummary
Before this commit, the leaf wasn't yet passed in on force close. This
is needed to detect the force close outputs properly.
2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
3fbf5d7e63 contractcourt: ensure auxResolver is hooked up to chainWatcher 2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
bf9dab6242 multi: hook up new aux interfaces 2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
0027da8732 lnwallet: propagate API change for AddrWithKey + pass in AuxSweeper 2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
207ff3f611 contractcourt: pause resolution for HTLCs w/ custom records
This is a hold over until the aux resolution is finalized for HTLC
outputs.
2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
210a869817 sweep: update sweeper to use AuxSweeper to add extra change addr
In this commit, we start to use the AuxSweeper (if present) to obtain a
new extra change addr we should add to the sweeping transaction. With
this, we'll take the set of inputs and our change addr, and then maybe
gain a new change addr to add to the sweep transaction.

The extra change addr will be treated as an extra required tx out,
shared across all the relevant inputs. This'll also be used in
NeedWalletInput to make sure that we add an extra input if needed to be
able to pay for the change addr.
2024-06-21 15:20:00 -07:00
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
1b18a607c4 server+sweep: convert GenSweepScript to use new addr type
We convert it to use lnwallet.AddrWithKey, as in the future, knowing the
internal key for an address will be useful.
2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
e7a29acf06 contractcourt: set resolution blob in commitSweepResolver 2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
1f990c6e27 input: add ResolutionBlob method to inputKit
We also update breachedOutput w/ the new API.
2024-06-21 15:20:00 -07:00
Olaoluwa Osuntokun
14fcac6d2d input: refactor all inputs to use MakeBaseInput, add opts
In this commit, we refactor all the other constructors for the input to
use MakeBaseInput. We also add a new set of functional options as well.
This'll be useful later on to ensure that new options are properly
applied to all the input types.
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
808a61739a contractcourt: add CommitBlob to taprootBriefcase
This'll be used to store the extra resolution information for the
commitment outputs.
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
Olaoluwa Osuntokun
79f080da36 contractcourt: convert taprootBriefcase to use new tlv record type
This commit doesn't yet go all the way to modify all the other records
quite yet.
2024-06-21 13:18:16 -07:00
Olaoluwa Osuntokun
ed02d20c04 build: update to fn/v1.1.0 2024-06-21 13:18:16 -07:00
Oliver Gugger
5fc4d4b1ec
Merge pull request #8852 from ffranr/pass-link-bandwidth-into-traffic-shaper
routing: pass link bandwidth to traffic shaper's bandwidth query
2024-06-21 08:23:54 -06:00
ffranr
29a12c28c9
routing: pass link bandwidth to traffic shaper's bandwidth query
This commit updates the traffic shaper's bandwidth query method to
accept the link bandwidth as a parameter. This allows an external
traffic shaper to optionally return the link bandwidth as the payment
bandwidth.
2024-06-20 22:28:58 +01:00
Oliver Gugger
393d6829ca
Merge pull request #8816 from guggero/aux-channel-bugfix
[custom channels]: co-op closing bugfix
2024-06-07 16:10:10 +02:00
Oliver Gugger
77339a83d4
rpcserver: send pending channels to aux data parser
We added the custom data to the pending channels but forgot to also
send the response RPC message to the custom channel parser so it can
turn it into human-readable JSON.
2024-06-07 16:08:12 +02: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
Oliver Gugger
53dbd1ee66
Merge pull request #8782 from lightningnetwork/custom-channels-poc-coop-close
multi: add new AuxChanCloser to allow adding additional outputs to co-op close transaction
2024-06-04 16:58:23 +02:00
Oliver Gugger
dfc2717550
multi: add co-op close custom data to close update
With this commit we populate additional information about the close
outputs (including potential custom channel data) in the close update
RPC message.
This will allow custom channels to find out how the additional close
outputs look like on chain and what data they might commit to.

We also hook up the aux custom data formatter, so it can format the
custom channel data to JSON.
2024-06-04 16:06:04 +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
fed81436d0
server+peer: init peer struct w/ AuxChanCloser if present 2024-06-03 11:33:36 +02:00
Olaoluwa Osuntokun
3262c45266
contractcourt: fix taproot coop close db record bug
In this commit, we fix an issue with co-op closes for taproot channels. Before this commit, we'd think that the remote party broadcasted a state very far in the future, and try to execute DLP. The wallet would properly credit the settled funds, but we'd mark the close in the DB as a force close.

To fix this, we also watch for the RBF sequence number we use in this scenario.
2024-06-03 11:33:36 +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
Olaoluwa Osuntokun
21cb454664
lnwire: add CustomRecords to shutdown message 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
e4e04b6a0d
Merge pull request #8771 from lightningnetwork/custom-channels-integration-invoice
[6/5]: invoice+rpc: add exit hop InvoiceAcceptor sub-systems and RPC calls
2024-05-28 11:49:59 +02:00
ffranr
197b291aae
multi: pass UpdateAddHtlc message custom records to invoice modifier 2024-05-28 08:07:47 +02:00
Olaoluwa Osuntokun
ff85328050
Merge pull request #8774 from yyforyongyu/fix-size-calc
lnwallet+sweep: fix wrong unit used in fee calculation
2024-05-27 18:44:29 -07:00
ffranr
c0d2b53816
itest: add basic invoice HTLC modifier integration test
This commit introduces a basic integration test for the invoice
HTLC modifier. The test covers scenarios where an invoice is settled with a
payment that is less than the invoice amount, facilitated by the invoice
HTLC modifier.
2024-05-27 20:33:52 +02:00
ffranr
08429c63fc
lntest: add HtlcModifier support to node RPC harness
This commit enhances the itest LND node harness to include support for
the new `HtlcModifier` RPC endpoint.
At the same time we move another method to the correct file.
2024-05-27 20:33:52 +02:00
ffranr
2580661acb
invoicesrpc: add HtlcModifier RPC endpoint and modifier RPC server
This commit introduces a singleton invoice HTLC modifier RPC server and
an endpoint to activate it. The server interfaces with the internal
invoice HTLC modifier interpreter, handling the marshalling between RPC
types and internal formats.
2024-05-27 20:33:52 +02:00
ffranr
73f52c8b11
invoicesrpc: add HTLC modifier to invoices RPC server
This commit integrates the HTLC modifier service into the
invoices RPC server.
2024-05-27 20:23:02 +02:00
ffranr
7e8a3b0df7
lnd: initialize invoice settlement interceptor at server startup
This commit initiates the invoice settlement interceptor during the
main server startup, assigning it a handle within the server.
2024-05-27 20:23:02 +02:00