Commit Graph

15789 Commits

Author SHA1 Message Date
ziggie
a1678fa9b7
itest: multi part payments test fix.
Because we need to account for an addtional fee buffer we need to
increase channel capacities for the multi payment tests.
2024-01-08 16:47:47 +01:00
ziggie
51c56d2825
lnwallet: add underflow check when computing balance. 2024-01-06 20:52:46 +01:00
ziggie
0b63989f3a
lnwallet+htlcswitch: Introduce a fee buffer.
We take into account a fee buffer of twice the current fee rate
of the commitment transaction plus an additional htlc output
when we are the opener of the channel hence pay when publishing the
commitment transaction. This buffer is not consensus critical
because we only consider it when we are in control of adding a
new htlc to the state. The goal is to prevent situations
where we push our local balance below our channel reserve due to
parallel adding of htlcs to the state. Its not a panacea for these
situations but until we have __option_simplified_update__ deployed
widely on the network its a good precaution to protect against
fee spikes and parallel adding of htlcs to the update log.

Moreover the way the available balance for a channel changed.
We now need to account for a fee buffer when we are the channel
opener. Therefore all the tests had to be adopted.
2024-01-06 20:52:46 +01:00
Olaoluwa Osuntokun
2f04ce7c6e
Merge pull request #8334 from lightningnetwork/tlv-record-enchancements
tlv: various enhancements to the new RecordT type
2024-01-05 13:57:55 -08:00
Elle
695bfc8414
Merge pull request #7736 from ellemouton/towerInterfaces
watchtower+refactor: CommitmentType and JusticeKit interface
2024-01-04 16:04:11 +02:00
Elle Mouton
4daa0f309c
docs: add release note for 7736 2024-01-04 14:37:42 +02:00
Elle Mouton
154e9fafec
watchtower: convert JusticeKit to interface
In this commit, we convert the `JusticeKit` struct to an interface.
Then, we add two implementations of that interface:
1) The `legacyJusticeKit` which implements all the methods of
   `JusticeKit`
2) The `anchorJusticKit` which wraps the `legacyJusticeKit` and just
   re-implements the `ToRemoteOutputSpendInfo` method since.
2024-01-04 14:37:42 +02:00
Elle Mouton
048dc54110
watchtower/blob: move code to justice_kit_packet.go
In preparation for the next commit which will introduce the `JusticeKit`
interface, here we just move the code related to building the actual
justice kit packet into a separate file.
2024-01-04 14:37:42 +02:00
Elle Mouton
204ca6cb0f
watchtower: introduce CommitmentType
In this commit a new enum, CommitmentType, is introduced and initially
there are 3 CommitmentTypes: Legacy, LegacyTweakless and Anchor.

Then, various methods are added to `CommitmentType`. This allows us to
remove a bunch of "if-else" chains from the `wtclient` and `lookout`
code. This will also make things easier to extend when a new commitment
type (like Taproot) is added.
2024-01-04 14:37:42 +02:00
Oliver Gugger
708bd05df3
Merge pull request #8342 from guggero/js-doc-fix
docs: update Node.JS example
2024-01-04 10:57:39 +01:00
Oliver Gugger
0bf857d8e1
Merge pull request #8341 from threewebcode/patch-3
fix: remove duplicate words [skip ci]
2024-01-04 10:37:47 +01:00
Oliver Gugger
3a7e564582
docs: update Node.JS example
Fixes #8333 by not using the outdated `bytebuffer` library anymore.
2024-01-04 09:13:59 +01:00
Oliver Gugger
319a5dab5c
Merge pull request #8325 from Thabokani/master
chore: fix typos [skip ci]
2024-01-04 09:01:58 +01: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
Olaoluwa Osuntokun
cedbdd8999
Merge pull request #8142 from carlaKC/8137-validateblindedpayload
routing: Add Validation for Decoding Blinded Paths
2024-01-03 12:33:11 -08:00
Olaoluwa Osuntokun
ffd330ac43
Merge pull request #8095 from carlaKC/7882-mcblinding
missioncontrol: add invalid onion blinding handling for blinded paths
2024-01-03 12:29:43 -08:00
Oliver Gugger
82e2b4010b
Merge pull request #8320 from threewebcode/patch-2
fix: correct the typo [skip ci]
2024-01-03 14:07:41 +01:00
Thabokani
b8d2fc3816
kvdb+cmd: fix typos 2024-01-03 12:06:32 +08:00
Olaoluwa Osuntokun
85046997c9
tlv: add utility funcs/methods to make tlv.OptionalRecord easier to use
We add a WhenSome that'll pass in the actual underlying value, and not
just the record.

We also add `SomeRecord` to make it easier to create TLV records w/
`Some` set.
2024-01-02 18:51:41 -08:00
Olaoluwa Osuntokun
aec2f9bf08
tlv: add TlvType method to RecordT
This will be useful when decoding optional TLV records, as we can use
this to look up in the `typeMap` for a given field to see if we decoded
it or not.
2024-01-02 18:51:35 -08:00
Olaoluwa Osuntokun
09afc92215
tlv: make TlvType method for TlvType interface public
With this change, callers can now examine a struct instance of the
`TlvType` instance to figure out programmatically which integer type is
maps to. This'll be useful when decoding optional TLV types into a wire
struct (knowing when to set it to Some vs None).
2024-01-02 18:51:33 -08:00
Olaoluwa Osuntokun
66cf4396a2
tlv: modify RecordT type to ensure type param takes precedence
In this commit, we modify the RecordT type to allow callers to re-use
the Record definition of a different type, but use the new type param to
override the integer type used on the wire.

This will let use do things like encode a signature using the same
RecordProducer instance, but with a diff type in another context.

The upcoming use for this is allowing our `lnwire.Sig` type to be
encoded in the same message using distinct TLV integer types (new co-op
close protocol).
2024-01-02 18:51:30 -08:00
Olaoluwa Osuntokun
7f8b185f40
Merge pull request #8307 from ziggie1984/channel-reestablishment-logging
lnwallet: fix logging.
2024-01-02 12:28:01 -08:00
Thabokani
55072bfd5e
sweep+lntest: fix typos 2024-01-02 19:23:30 +08:00
Yong
ab8fb2c9c3
Merge pull request #8308 from ziggie1984/new_min_cltv_default
zpay32: Change min_final_cltv_expiry_delta.
2024-01-02 17:19:52 +08:00
ziggie
160713eade
docs: add release-notes. 2023-12-29 22:35:12 +01:00
Afanti
fff785c909
fix: correct the typo 2023-12-29 21:27:13 +08:00
ziggie
ec02ffa383
zpay32: Change min_final_cltv_expiry_delta.
We adhere to BOLT 02 and use 18 instead of 9.
2023-12-22 18:16:07 +01:00
ziggie
45a3bf333b
lnwallet: fix logging. 2023-12-22 17:36:41 +01:00
Oliver Gugger
4d8fa349ca
Merge pull request #8303 from AtomicInnovation321/master
docs: fix typos
2023-12-21 17:31:59 +01:00
bitcoin-lightning
b72fc9529e docs: fix typos 2023-12-21 15:21:35 +00:00
Oliver Gugger
30348baedc
Merge pull request #8296 from threewebcode/patch-1
fix: rectify the typos in the docs
2023-12-20 09:47:14 +01:00
Afanti
c0ef879b8c
fix: rectify the typos in the docs 2023-12-20 08:21:57 +08:00
Carla Kirk-Cohen
b31bab3529
docs: add release notes 2023-12-18 12:08:05 -05:00
Carla Kirk-Cohen
4071db77b5
routing: add handling for blinded errors from final node
We do not expect blinding errors from the final node:
1. If the introduction is the recipient, they should use regular errors.
2. Otherwise, nodes have no business sending this error when they are
   not part of a blinded route.
2023-12-18 12:07:56 -05:00
Carla Kirk-Cohen
7ce3a152a1
routing/refactor: add failNode helper to final outcome processing
Note: this refactor updates the inequality used from >= 2 to > 1 to
align with the rest of this file so that we express this concept
consistently throughout the code.
2023-12-18 12:07:47 -05:00
Carla Kirk-Cohen
b82478a7e7
routing: add result interpretation for intermediate invalid blinding
This commit adds handling for route blinding errors that are reported
by the introduction node in a multi-hop blinded route. As the
introduction node is always responsible for handling blinded errors,
it is not penalized - only the final hop is penalized to discourage the
blinded route without filling up mission control with ephemeral
results.

If this error code is reported by a node that is not an introduction
node, we penalize the node because it is returning an error code that
it should not be using.
2023-12-18 12:07:46 -05:00
Carla Kirk-Cohen
f91589bef9
routing: handle introduction node failure to convert error
This commit adds handling for errors that originate after the
introduction node when making payment to a blinded route. This
indicates that the introduction node is not obeying the spec, so
it is punished for the violation.
2023-12-18 12:07:36 -05:00
Carla Kirk-Cohen
31d4242b6d
docs: add release notes for 0.18 2023-12-18 11:27:57 -05:00
Carla Kirk-Cohen
af4fdcc1fd
htlcswitch/test: allow missing field errors in payload decode 2023-12-18 11:27:56 -05:00
Carla Kirk-Cohen
69d5496e7c
multi: update payload validation to account for blinded routes 2023-12-18 11:27:55 -05:00
Carla Kirk-Cohen
343a6ed831
hltcswitch/hop: add next hop to intermediate hop with custom records
Fix our existing test to have a valid intermediate hop that will pass
stricter validation. Previously, we did not specify a next channel for
an intermediate hop (which violates bolt4).
2023-12-18 11:27:53 -05:00
Carla Kirk-Cohen
7db072e020
routing: add additional validation to hop payload creation 2023-12-18 11:27:52 -05:00
Carla Kirk-Cohen
585f28c5f5
multi: explicitly signal final hop in pack hop payload
Previously, we'd use the value of nextChanID to infer whether a payload
was for the final hop in a route. This commit updates our packing logic
to explicitly signal to account for blinded routes, which allow zero
value nextChanID in intermediate hops. This is a preparatory commit
that allows us to more thoroughly validate payloads.
2023-12-18 11:27:52 -05:00
Carla Kirk-Cohen
b5afd905d1
htlcswitch/hop: explicitly signal final hop from sphinx packet
Previously, we were using nextChanID to determine whether a hop
payload is for the final recipient. This is no longer suitable in a
route-blinding world where intermediate hops are allowed to have zero
nextChanID TLVs (as this information is provided to forwarding nodes
in their encrypted data). This commit updates payload reading to use
the signal provided by sphinx that we are on the last packet, rather
than implying it from the contents of a hop.
2023-12-18 11:27:51 -05:00
Carla Kirk-Cohen
2f8587341a
htlcswitch/test: do not set amount and cltv for blinded test cases 2023-12-18 11:27:50 -05:00
Carla Kirk-Cohen
a75bc13230
routing/test: set outgoing timelock on non-legacy test cases
Provide valid hop payloads for tests cases that use TLV onion format.
2023-12-18 11:27:49 -05:00
Carla Kirk-Cohen
fa78d21975
htlcswitch/test: add sphinx action to decoding test
Update test to include the sphinx action to more closely represent
reality. This will be required when we add more validation to the
presence of a nextChanID field. A MoreHops action is chose because
we're testing the case with a payload that contains forwarding info.
2023-12-18 11:27:48 -05:00
Oliver Gugger
0df507eca0
Merge pull request #8261 from markettes/lncli-multiple-outgoing-channels
Enable multiple outgoing channel ids in payments
2023-12-18 11:38:46 +01:00
Marcos
ea9a780203
docs: release notes update for 0.18.0 2023-12-18 10:27:19 +01:00