Skip to content

Commit 08f23a7

Browse files
toadlyBroodlerustyrussell
authored andcommitted
BOLT 4: add packet forwarding requirements section
1 parent 298489b commit 08f23a7

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

04-onion-routing.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -407,23 +407,10 @@ specifies a version number that it doesn't support.
407407
For packets with supported version numbers, the processing node first parses the
408408
packet into its individual fields.
409409

410-
The processing node:
411-
- if the ephemeral public key is NOT on the `secp256k1` curve:
412-
- MUST abort processing the packet.
413-
- MUST report a route failure to the origin node.
414-
415410
Next, the processing node computes the shared secret using the private key
416411
corresponding to its own public key and the ephemeral key from the packet, as
417412
described in [Shared Secret](#shared-secret).
418413

419-
The processing node:
420-
- if the packet has previously been forwarded or locally redeemed, i.e. the
421-
packet contains duplicate routing information to a previously received packet:
422-
- if preimage is known:
423-
- MAY immediately redeem the HTLC using the preimage.
424-
- otherwise:
425-
- MUST abort processing and report a route failure.
426-
427414
The above requirements prevent any hop along the route from retrying a payment
428415
multiple times, in an attempt to track a payment's progress via traffic
429416
analysis. Note that disabling such probing could be accomplished using a log of
@@ -437,11 +424,6 @@ Next, the processing node uses the shared secret to compute a _mu_-key, which it
437424
in turn uses to compute the HMAC of the `hops_data`. The resulting HMAC is then
438425
compared against the packet's HMAC.
439426

440-
The processing node:
441-
- if the computed HMAC and the packet's HMAC differ:
442-
- MUST abort processing.
443-
- MUST report a route failure.
444-
445427
Comparison of the computed HMAC and the packet's HMAC MUST be
446428
time-constant to avoid information leaks.
447429

@@ -456,11 +438,6 @@ The first 65 bytes of the resulting routing information become the `per_hop`
456438
field used for the next hop. The next 1300 bytes are the `hops_data` for the
457439
outgoing packet.
458440

459-
The processing node:
460-
- if the `realm` is unknown:
461-
- MUST drop the packet.
462-
- MUST signal a route failure.
463-
464441
A special `per_hop` `HMAC` value of 32 `0x00`-bytes indicates that the currently
465442
processing hop is the intended recipient and that the packet should not be forwarded.
466443

@@ -470,14 +447,28 @@ by blinding the ephemeral key with the processing node's public key along with t
470447
shared secret and by serializing the `hops_data`.
471448
The resulting packet is then forwarded to the addressed peer.
472449

450+
## Requirements
451+
473452
The processing node:
453+
- if the ephemeral public key is NOT on the `secp256k1` curve:
454+
- MUST abort processing the packet.
455+
- MUST report a route failure to the origin node.
456+
- if the packet has previously been forwarded or locally redeemed, i.e. the
457+
packet contains duplicate routing information to a previously received packet:
458+
- if preimage is known:
459+
- MAY immediately redeem the HTLC using the preimage.
460+
- otherwise:
461+
- MUST abort processing and report a route failure.
462+
- if the computed HMAC and the packet's HMAC differ:
463+
- MUST abort processing.
464+
- MUST report a route failure.
465+
- if the `realm` is unknown:
466+
- MUST drop the packet.
467+
- MUST signal a route failure.
474468
- MUST address the packet to another peer that is its direct neighbor.
475469
- if the processing node does not have a peer with the matching address:
476470
- MUST drop the packet.
477471
- MUST signal a route failure.
478-
479-
[TODO: separate processing node requirements into `Requirements` section]
480-
481472
# Shared Secret
482473

483474
The origin node performs ECDH with each hop of the route, in order to establish a secret.

0 commit comments

Comments
 (0)