Skip to content

Commit

Permalink
Merge incorrect_payment_amount and unknown_payment_hash errors
Browse files Browse the repository at this point in the history
Because the errors are separate, if an intermediate node sees a
payment hash for relay and has several guesses as to the
destination of the payment, they can check their guesses by sending
HTLCs with the same payment hashes first and seeing the error sent
back.

By adding the htlc_msat that the final node received to
unknown_or_incorrect_payment_details, origin nodes can still
identify bad value-relaying peers.
  • Loading branch information
TheBlueMatt committed Dec 3, 2018
1 parent 20524d4 commit 226cb8b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions 04-onion-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -802,13 +802,20 @@ requirement:
The CLTV expiry is too close to the current block height for safe
handling by the processing node.

1. type: PERM|15 (`unknown_payment_hash`)
1. type: PERM|15 (`incorrect_or_unknown_payment_details`)
2. data:
* [`8`:`htlc_msat`]

The `payment_hash` is unknown to the final node.
The `payment_hash` is unknown to the final node or the amount for that
`payment_hash` is incorrect.

1. type: PERM|16 (`incorrect_payment_amount`)

The amount for that `payment_hash` is incorrect.
Originally used to differentiate incorrect final amount from unknown payment
hash. Sadly, sending this response allows for probing attacks whereby a node
which receives an HTLC for forwarding can check guesses as to its final
destination by sending payments with the same hash but much lower values to
potential destinations and check the response.

1. type: 17 (`final_expiry_too_soon`)

Expand Down Expand Up @@ -905,10 +912,10 @@ An _intermediate hop_ MUST NOT, but the _final node_:
- MAY succeed in accepting the HTLC.
- if the amount paid is less than the amount expected:
- MUST fail the HTLC.
- MUST return an `incorrect_payment_amount` error.
- MUST return an `incorrect_or_unknown_payment_details` error.
- if the payment hash is unknown:
- MUST fail the HTLC.
- MUST return an `unknown_payment_hash` error.
- MUST return an `incorrect_or_unknown_payment_details` error.
- if the amount paid is more than twice the amount expected:
- SHOULD fail the HTLC.
- SHOULD return an `incorrect_payment_amount` error.
Expand Down

0 comments on commit 226cb8b

Please sign in to comment.