Skip to content

Commit 5fc4824

Browse files
committed
02+04: add accountability signal to update_add_hltc and onion
Once we have a signal from the recipient, we need a way to propagate this information throughout the route. Including a signal in the onion provides an uncorruptable way for the sender to propagate this signal. If the sender is dishonest, this will eventually be detected by the final recipient. In the commits that follow we'll add reputation and resource management that will allow nodes to use this signal to protect against jamming attacks.
1 parent 815080b commit 5fc4824

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

02-peer-protocol.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,6 +2233,7 @@ is destined, is described in [BOLT #4](04-onion-routing.md).
22332233
1. type: 0 (`blinded_path`)
22342234
2. data:
22352235
* [`point`:`path_key`]
2236+
1. type: 1 (`accountable`)
22362237

22372238
#### Requirements
22382239

@@ -2271,6 +2272,17 @@ A sending node:
22712272
- MUST increase the value of `id` by 1 for each successive offer.
22722273
- if it is relaying a payment inside a blinded route:
22732274
- MUST set `path_key` (see [Route Blinding](04-onion-routing.md#route-blinding))
2275+
- if it is the original source of the HTLC:
2276+
- SHOULD omit `accountable`.
2277+
- MAY set `accountable` to mimic patterns of HTLCs it has forwarded.
2278+
- otherwise:
2279+
- if `accountable` is present in the incoming `update_add_htlc`:
2280+
- MUST set `accountable`.
2281+
- otherwise:
2282+
- if `upgrade_accountability` is present in the onion:
2283+
- MAY set `accountable`.
2284+
- otherwise:
2285+
- MUST NOT set `accountable`.
22742286

22752287
`id` MUST NOT be reset to 0 after the update is complete (i.e. after `revoke_and_ack` has
22762288
been received). It MUST continue incrementing instead.

04-onion-routing.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ This is formatted according to the Type-Length-Value format defined in [BOLT #1]
214214
1. type: 18 (`total_amount_msat`)
215215
2. data:
216216
* [`tu64`:`total_msat`]
217+
1. type: 19 (`upgrade_accountability`)
217218

218219
`short_channel_id` is the ID of the outgoing channel used to route the
219220
message; the receiving peer should operate the other end of this channel.
@@ -240,6 +241,9 @@ The requirements ensure consistency in responding to an unexpected
240241
`outgoing_cltv_value`, whether it is the final node or not, to avoid
241242
leaking its position in the route.
242243

244+
`upgrade_accountability` is a marker field that indicates that the
245+
forwarding node may set `accountable` in its `update_add_htlc`.
246+
243247
### Requirements
244248

245249
The creator of `encrypted_recipient_data` (usually, the recipient of payment):
@@ -288,6 +292,10 @@ The writer of the TLV `payload`:
288292
- if the recipient provided `payment_metadata`:
289293
- MUST include `payment_metadata` with every HTLC
290294
- MUST not apply any limits to the size of `payment_metadata` except the limits implied by the fixed onion size
295+
- if the recipient provided an invoice with an `accountable` field set:
296+
- MUST include `upgrade_accountability` for every node in the route.
297+
- otherwise:
298+
- MUST NOT include `upgrade_accountability`.
291299

292300
The reader:
293301

@@ -339,6 +347,10 @@ The reader:
339347
- incoming `amount_msat` < `amt_to_forward`.
340348
- incoming `cltv_expiry` < `outgoing_cltv_value`.
341349
- incoming `cltv_expiry` < `current_block_height` + `min_final_cltv_expiry_delta`.
350+
- `accountable` is set in the incoming `update_add_htlc` but `accountable` was not set in the invoice.
351+
- Otherwise:
352+
- MUST return an error if:
353+
- `accountable` is set in the incoming `update_add_htlc` but `upgrade_accountability` was not set in the payload.
342354

343355
Additional requirements are specified [here](#basic-multi-part-payments) for
344356
multi-part payments, and [here](#route-blinding) for blinded payments.
@@ -436,6 +448,11 @@ otherwise meets the amount criterion (eg. some other failure, or
436448
invoice timeout), however if it were to fulfill only some of them,
437449
intermediary nodes could simply claim the remaining ones.
438450

451+
`accountable` may only be set in `update_add_htlc` if the receiving
452+
node provided an `accountable` signal in its invoice. If the
453+
`update_add_htlc` signal is not consistent, a node along the route
454+
has corrupted this value.
455+
439456
## Route Blinding
440457

441458
1. subtype: `blinded_path`

0 commit comments

Comments
 (0)