Commit Graph

16509 Commits

Author SHA1 Message Date
Carla Kirk-Cohen
9f038c6191
htlcswitch: introduce wrapper type error encrypter to identify blinded
Introduce two wrapper types for our existing SphinxErrorEncrypter
that are used to represent error encrypters where we're a part of a
blinded route. These encrypters are functionally the same as a sphinx
encrypter, and are just used as "markers" so that we know that we
need to handle our error differently due to our different role.

We need to persist this information to account for restart cases where
we've resovled the outgoing HTLC, then restart and need to handle the
error for the incoming link. Specifically, this is relevant for:
- On chain resolution messages received after restart
- Forwarding packages that are re-forwarded after restart

This is also generally helpful, because we can store this information
in one place (the circuit) rather than trying to reconstruct it in
various places when forwarding the failure back over the switch.
2024-04-25 09:47:10 -04:00
Carla Kirk-Cohen
776c889267
multi: return route role from HopPayload
We need to know what role we're playing to be able to handle errors
correctly, but the information that we need for this is held by our
iterator:
- Whether we had a blinding point in update add (blinding kit)
- Whether we had a blinding point in payload

As we're now going to use the route role return value even when our
err!=nil, we rename the error to signal that we're using less
canonical golang here.

An alternative to this approach is to attach a RouteRole to our
ErrInvalidPayload. The downside of that approach is:
- Propagate context through parsing (whether we had updateAddHtlc)
- Clumsy handling for errors that are not of type ErrInvalidPayload
2024-04-25 09:46:31 -04:00
Carla Kirk-Cohen
b81a6f3d2f
htlcswitch: split parsing and validation of TLV payloads
When handling blinded errors, we need to know whether there was a
blinding key in our payload when we successfully parsed our payload
but then found an invalid set of fields. The combination of
parsing and validation in NewPayloadFromReader means that we don't know
whether a blinding point was available to us by the time the error is
returned.

This commit splits parsing and validation into two functions so that
we can take a look at what we actually pulled of the payload in between
parsing and TLV validation.
2024-04-25 09:15:58 -04:00
Carla Kirk-Cohen
4d051b4170
multi: handle all blinding point validation in ValidateParsedPayloadTypes
This commit moves all our validation related to the presence of fields
into ValidateParsedPayloadTypes so that we can handle them in a single
place. We draw the distinction between:
- Validation of the payload (and the context within it's being parsed,
  final hop / blinded hop etc)
- Processing and validation of encrypted data, where we perform
  additional cryptographic operations and validate that the fields
  contained in the blob are valid.

This helps draw the line more clearly between the two validation types,
rather than splitting some payload-releated blinded hop processing
into the encrypted data processing part. The downside of this approach
(vs doing the blinded path payload check _after_ payload validation)
is that we have to pass additional context into payload validation
(ie, whether we got a blinding point in our UpdateAddHtlc - as we
already do for isFinalHop).
2024-04-25 09:15:57 -04:00
Carla Kirk-Cohen
c2c0158c84
htlcswitch: handle malformed HTLC with invalid onion blinding code
This commit adds handling for malformed HTLC errors related to blinded
paths. We expect to receive these errors _within_ a blinded path,
because all non-introduction nodes are instructed to return malformed
errors for failures.

Note that we may actually switch back to a malformed error later on if
we too are a relaying node in the route, but we handle that case the
incoming link.
2024-04-25 09:15:56 -04:00
Oliver Gugger
2089a88f4b
Merge pull request #7765 from ErikEk/retire-io-ioutil-dep
Remove io/ioutil package dependency
2024-04-25 13:17:15 +02:00
erik
0d94131fca doc: release note 2024-04-25 11:56:54 +02:00
erik
df4ddcc573 multi: replace ioutil.TempDir 2024-04-25 11:24:41 +02:00
erik
caf2419ff6 multi: replace ioutil.ReadDir 2024-04-25 11:24:17 +02:00
erik
c7f81d3142 multi: replace ioutil.Discard 2024-04-25 11:23:54 +02:00
erik
789c6bac8c multi: replace ioutil.WriteFile 2024-04-25 11:23:31 +02:00
erik
ab83343c87 multi: repleace ioutil.ReadFile 2024-04-25 11:22:43 +02:00
erik
619c8f4eb8 multi: repleace ioutil.ReadAll 2024-04-25 11:21:18 +02:00
Oliver Gugger
dcd8e16376
Merge pull request #8685 from ziggie1984/fix-bumpfee-immediate
fix lncli bumpfee flag parsing
2024-04-25 10:17:05 +02:00
Oliver Gugger
7f5f8065ca
Merge pull request #8672 from mohamedawnallah/makeDeleteAllPaymentsArgsRequired
rpcserver: Make sure the arguments are provided when calling `DeleteAllPayments` RPC
2024-04-25 10:02:59 +02:00
Oliver Gugger
8ce3622792
Merge pull request #8590 from ffranr/test-node-name-in-tmpdir
lntest: add test node name to tmp directory name
2024-04-24 20:06:04 +02:00
Oliver Gugger
fe26005228
Merge pull request #8592 from zhiqiangxu/master
itest: fix ascii
2024-04-24 11:05:21 -06:00
Oliver Gugger
5cf700d611
Merge pull request #8658 from hidewrong/master
chore: fix struct names
2024-04-24 10:56:20 -06:00
Mohamed Awnallah
b683b385cd
docs: update release-notes-0.18.0.md 2024-04-24 18:49:53 +02:00
Mohamed Awnallah
6e1d9b8d6a
lncli: update AllPayments in deletePayments 2024-04-24 18:49:01 +02:00
Mohamed Awnallah
3364d2f2d6
lntest: delete all payments in DeleteAllPayments 2024-04-24 18:48:59 +02:00
Mohamed Awnallah
5c3015b223
rpcserver: validate DeleteAllPayments options 2024-04-24 18:48:57 +02:00
Mohamed Awnallah
4f48cc69fb
lnrpc: add all_payments opt to DeleteAllPayments 2024-04-24 18:48:52 +02:00
ziggie
0ea45efe28
docs: add release-notes. 2024-04-24 16:56:09 +01:00
ziggie
64601a9bbe
wallet lncli: fix bumpfee parsing bug. 2024-04-24 16:56:09 +01:00
zhiqiangxu
64740e18cb itest: fix ascii 2024-04-24 23:30:03 +08:00
Oliver Gugger
acc595195c
Merge pull request #8545 from ziggie1984/dont-use-sweeper-unconfirmed-utxos
dont use sweeper unconfirmed utxos
2024-04-24 08:29:06 -06:00
ziggie
58e12884dc
docs: add release-notes. 2024-04-24 13:58:20 +01:00
ziggie
351e9a68dd
multi: Add tests to psbt and normal open channel flow.
Itests were added to the normal channel funding flow and the psbt
funding flow using unstable (unconfirmed sweeper inputs).
2024-04-24 13:58:20 +01:00
ziggie
b954ee4c72
rpcserver: allow unconf. inputs for psbt shim.
Allow unconfirmed inputs to be used when funding a channel via
the psbt channel opening flow. We do now check for unstable utxos.
2024-04-24 13:58:20 +01:00
ziggie
ab7634b276
multi: Add utxo restriction for batchchannel openings.
Add utxo restrictions for psbt internal wallet funded lightning
channels. This also includes batchopening channels backed by the
internal wallet.
2024-04-24 13:58:20 +01: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
ziggie
2a88cf8eef
mod: update btcwallet version. 2024-04-24 13:58:19 +01:00
Oliver Gugger
7fb233326e
Merge pull request #8674 from yyforyongyu/sweeper-remove-and-docs
sweep: add docs and remove dead code
2024-04-23 11:12:24 -06:00
yyforyongyu
e855421095
docs: update release notes 2024-04-23 23:19:41 +08:00
yyforyongyu
83024585bb
sweep: add README 2024-04-23 23:17:44 +08:00
Oliver Gugger
2b74a34301
Merge pull request #8678 from hieblmi/add-hieblmi-to-verify-install
Add hieblmi to verify install script
2024-04-23 06:16:43 -06:00
Slyghtning
ffaf4da1da
release: add hieblmi to verify install script 2024-04-23 10:03:23 +02:00
yyforyongyu
9c5124e117
sweep: remove unused param Fee 2024-04-23 04:44:00 +08:00
yyforyongyu
54aaeea491
sweep: remove dead code and dead tests 2024-04-23 04:44:00 +08:00
Olaoluwa Osuntokun
7af195768a
Merge pull request #8667 from lightningnetwork/elle-new-sweeper
Merge new sweeper branch to master
2024-04-22 11:20:49 -07:00
Oliver Gugger
73fd389e9a
Merge pull request #8627 from feelancer21/inbound-fees-reject
lnrpc: rejects positive inbound fees by default
2024-04-22 01:56:02 -06:00
Oliver Gugger
a201d5e365
Merge pull request #8661 from ProofOfKeags/feature/record-producer-axiom
tlv: add axiomatic RecordProducer implementation for Record
2024-04-22 01:42:06 -06:00
feelancer21
a2319e4313 lnrpc: rejects positive inbound fees by default
Positive inbound are now rejected by default. The user can enable positive
inbound fees with the option 'accept-positive-inbound-fees'.
2024-04-20 00:11:36 +02:00
yyforyongyu
4d96f9c4c1
docs: add release notes 2024-04-20 04:41:31 +08:00
yyforyongyu
d854c80aa7
itest+lntest: fix itest re the new sweeping behavior 2024-04-20 04:41:29 +08:00
yyforyongyu
e0f0f5c6a9
sweep: skip wallet inputs in isThirdPartySpent 2024-04-19 21:33:40 +08:00
yyforyongyu
a50cdd64c5
sweep: assign deadline values to inputs in handleNewInput
This commit changes how we transform from a deadline option to a
concrete deadline value - previously this is done when we decide to
cluster inputs, and we now move it to a step earlier - once an input is
received via `SweeperInput`, we will immediately transform its optional
deadline into a real value. For inputs that come with a deadline option,
since the Some will be used, it makes no difference. For inputs with
None as their deadlines, we need this change to make sure the default
deadlines are assigned accurately.
2024-04-19 21:33:39 +08:00
yyforyongyu
96883f307c
itest+sweep: add itest testSweepCommitOutputAndAnchor
This commit adds a test case to check the no deadline sweeping behavior.
The sweeper is updated to make sure it can handle the case for neutrino
backend.
2024-04-19 21:33:39 +08:00
yyforyongyu
f5a321d0d3
contractcourt: remove unused param to please linter 2024-04-19 21:33:39 +08:00