Commit graph

16815 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
ed44aa7455
rpc: fix ordering of feature bit check in rpcCommitmentType
We need to check if it has a tapsript root first, as if it has a
tapscript root, then it's also a taproot channel. By checking if it has
a tapscript root first, we'll now display the proper commitment type for
RPC responses.
2024-08-27 19:08:08 -05:00
Oliver Gugger
1b353b0bfd
Merge pull request #8947 from guggero/reuse-cli-payment-code
cmd/commands: refactor SendPaymentRequest for re-use
2024-07-30 08:32:53 -06:00
Oliver Gugger
e3f5b74f92
cmd/commands: refactor SendPaymentRequest for re-use
We want to re-use the logic of the SendPaymentRequest code, most notably
the logic that prints the payment updates as a nicely formatted table to
the console, in other projects.
2024-07-29 18:04:44 +02:00
Olaoluwa Osuntokun
f09d4042ae
Merge pull request #8926 from lightningnetwork/second-level-aux
lnwallet: store aux sig in custom data within the HTLC
2024-07-22 21:32:04 -07:00
Olaoluwa Osuntokun
6a8da1cd80
lnwallet: store aux sig in custom data within the HTLC
We can use this space as we'll properly encode the blinded paths data
along with our custom fields before we go to write the HTLCs to the
wire.
2024-07-22 19:41:01 -07:00
Olaoluwa Osuntokun
115bad5c5c
build: update to latest TLV version 2024-07-22 19:40:56 -07:00
Olaoluwa Osuntokun
90f997c908
Merge pull request #8908 from lightningnetwork/traffic-shaper-htlc-amount-fix
routing: don't assume HTLC amount for custom channel
2024-07-11 19:50:14 -07:00
Olaoluwa Osuntokun
d80bca8c6f routing: skip amtInRange for custom HTLCs
We might be trying to send an invoice amount that's greater than the size of the channel, but once you factor in the custom channel logic, an actual HTLC can be sent over the channel to pay that larger payment.

As a result, we'll skip over this check if a have a custom HTLC.
2024-07-11 19:48:47 -07:00
Olaoluwa Osuntokun
14a6f73258 routing: only set firstHopBlob if we have custom records 2024-07-11 19:47:34 -07:00
Olaoluwa Osuntokun
e8bf89160d
itest: don't modify HTLC amount in testForwardInterceptorWireRecords
The goal of the test is just to make sure that we can pick up the wire
records. With the prior bug fix, if we also modify the outgoing amount
here, the normal checks to ensure that the fee has been paid will
trigger with this larger amount, which wasn't factored in during initial
route creation.
2024-07-11 16:11:16 -07:00
Oliver Gugger
4f2c75f620
htlcswitch: also set packet amount on modified forward
This fixes an issue where the switch's forwarding logic would think the
bandwidth to forward an HTLC was insufficient for a custom channel HTLC,
because we only overwrote the HTLC's amount and not the packet's (which
is just a short cut struct member anyway).
2024-07-11 21:44:27 +02:00
Oliver Gugger
374b659476
routing: don't assume HTLC amount for custom channel
It seems like the amount given to the getBandwidth is 0 in some cases
(keysend) and non-zero in other cases (invoice payment).
If we use custom channels, then that amount will likely not be the
actual HTLC amount we're going to put on chain. So we have to use a zero
amount for the MayAddOutgoingHtlc check, otherwise we might seem to go
below the local channel reserve even though we'll end up sending a very
small amount only.
And since the check here is just to find out we're not already at the
maximum HTLC capacity for this channel, we can safely use the amount of
0 for the check, which is handled properly in the link logic.
2024-07-11 12:00:20 +02:00
Olaoluwa Osuntokun
7ffadde13e
Merge pull request #8904 from lightningnetwork/global-msg-router-fix
peer: don't stop global msg router
2024-07-09 19:14:40 -07:00
Olaoluwa Osuntokun
0cd11ad847
peer: don't stop global msg router
In this commit, we fix a bug that would cause a global message router to
be stopped anytime a peer disconnected. The global msg router only
allows `Start` to be called once, so afterwards, no messages would
properly be routed.
2024-07-09 14:07:32 -07:00
Olaoluwa Osuntokun
8d83880161
Merge pull request #8885 from lightningnetwork/co-op-close-scid
lnwallet: add short chan ID to AuxShutdownReq
2024-07-02 11:37:19 -07:00
Olaoluwa Osuntokun
c7011a6a5c
lnwallet: add short chan ID to AuxShutdownReq
This allows implementations to obtain information related where the
funding transaction confirmed in the mainchain.
2024-07-02 11:30:19 -07:00
Olaoluwa Osuntokun
9eec9b5045
Merge pull request #8867 from lightningnetwork/custom-chans-feature-bit
multi: add taproot chans overlay feature bit
2024-06-26 19:41:14 -07:00
Olaoluwa Osuntokun
c7487095ce
lnd: signal taproot overlay chans based on config
We also add a sanity check to make sure they can't be signaled without
the aux interfaces.
2024-06-26 18:13:11 -07:00
Olaoluwa Osuntokun
0651488bae
lncfg: add new config option for taproot overlay chans 2024-06-26 18:13:07 -07:00
Olaoluwa Osuntokun
db730d27b5
rpc+funding: add taproot overlay as RPC chan type 2024-06-26 18:13:04 -07:00
Olaoluwa Osuntokun
78394541e7
lnrpc: add SIMPLE_TAPROOT_OVERLAY feature bit 2024-06-26 18:13:02 -07:00
Olaoluwa Osuntokun
5dc5a1a442
funding: add chan type awareness for new taproot chans overlay 2024-06-26 18:13:00 -07:00
Olaoluwa Osuntokun
a222878a0d
lnwallet: add awareness of taproot overlay chan type to reservations 2024-06-26 18:12:58 -07:00
Olaoluwa Osuntokun
5c4dc2e193
feature: add awareness of new taproot chans overlay feature bit
This bit will be false by default in current production deployments.
2024-06-26 18:12:56 -07:00
Olaoluwa Osuntokun
a9761f7330
lnwire: add new taproot chans overlay feature bit 2024-06-26 18:12:53 -07:00
Oliver Gugger
a3a50c3a69
Merge pull request #8873 from lightningnetwork/remove-tlv-feature-bit-check
routing: remove TLV feature bit check
2024-06-26 15:47:09 -06:00
Oliver Gugger
034df60aaa
routing: assume TLV payloads everywhere
This commit removes another check for TLV payload support of the
destination node. We assume TLV payloads as the default everywhere else,
so we just remove two checks that were previously forgotten.
2024-06-26 23:03:28 +02:00
Elle Mouton
a460d683f3
docs: add release notes entry 2024-06-26 22:01:13 +02:00
Elle Mouton
8446ecc22e
routing: assume TLV onion during route construction 2024-06-26 21:59:09 +02:00
Elle Mouton
6ab5ed1b7f
routing: assume TLV onion during path finding 2024-06-26 21:59:09 +02:00
Oliver Gugger
e8fddd3935 v0.18.0-beta.1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEYKH6faW/8Ivcu+eQO71Z6ZsoAwYFAmZeF/kACgkQO71Z6Zso
 AwaO9A//QPFidiC9OkGM282ztYyXgXv7HkwMKkMI9xHmOu3KFVATcUmbkhWyA8xP
 hACuySVnTvHRm/cscu8z3LZoH8f66lCloFGl/uixO9U6sIMHcYfui4QfDcDAMS2n
 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KQx5Cp5ohvUSc7/Rzgp7Pz2s=
 =5oZg
 -----END PGP SIGNATURE-----

Merge tag 'v0.18.0-beta.1' into 0-19-staging

v0.18.0-beta.1
2024-06-26 21:57:59 +02:00
Oliver Gugger
4e968d9b52
Merge pull request #8861 from lightningnetwork/custom-channels-breach
multi: hook up breach arb with new aux sweeper sub-system
2024-06-25 09:42:46 -06:00
Olaoluwa Osuntokun
64cf872846
lnwallet: fix bugs in ResolutionReq for breach handling
In this commit, we fix three existing bugs in the way we make
`ResolutionReq` for breach handling:

  1. We were passing in the commit blob of the *current* channel state,
     instead of the one stored in the revocation log for this breached
     state.

  2. We were using theirDelay for CsvDelay, when we want ourDelay, which
     in this case will be 1 CSV, as this is a non delayed output.

  3. We also need to pass in the delay for the remote party's to_local
     delayed output.
2024-06-25 10:53:23 +02:00
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