Skip to content

Commit 9f25ae7

Browse files
committed
minitramp: don't hide payment_metadata.
It doesn't seem anyone actually uses this, so specify it more simply. Signed-off-by: Rusty Russell <[email protected]>
1 parent ab5ebd7 commit 9f25ae7

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

04-onion-routing.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ If the final destination does not support `encrypted_trampinfo` it will ignore t
673673
1. type: 8 (`incoming_payment_secret`)
674674
2. data:
675675
* [`32*byte`:`payment_secret`]
676-
1. type: 10 (`incoming_payment_metadata`)
676+
1. type: 10 (`payment_metadata`)
677677
2. data:
678678
* [`...*byte`:`payment_metadata`]
679679
1. type: 12 (`incoming_amount_msat`)
@@ -685,9 +685,6 @@ If the final destination does not support `encrypted_trampinfo` it will ignore t
685685
1. type: 16 (`outgoing_payment_secret`)
686686
2. data:
687687
* [`32*byte`:`payment_secret`]
688-
1. type: 18 (`outgoing_payment_metadata`)
689-
2. data:
690-
* [`...*byte`:`payment_metadata`]
691688
1. type: 20 (`blinded_paths`)
692689
2. data:
693690
* [`...*blinded_path`:`paths`]
@@ -697,21 +694,20 @@ If the final destination does not support `encrypted_trampinfo` it will ignore t
697694

698695
## Requirements
699696

700-
The initial sender of a "minitramp" payment builds it backwards from final destination:
697+
The initial sender of a "minitramp" payment builds it *backwards* from final destination:
701698
- MUST create a `trampinfo` (#1) for the payment destination:
702699
- MUST NOT set `amount_to_send`, `next_cltv_value`, `next_node`, `blinded_paths`, `blinded_payinfo` or `minitramp`.
703-
- MUST set `outgoing_payment_secret`, `outgoing_payment_metadata`, `total_amount_msat` to the values which would normally set in the final `payload`.
700+
- MUST set `outgoing_payment_secret`, `payment_metadata`, `total_amount_msat` to the values which would normally set in the final `payload`.
704701
- If the payment destination is known to support `option_minitrampoline`:
705702
- SHOULD set `incoming_payment_secret` to the SHA256 hash of `outgoing_payment_secret`.
706-
- SHOULD set `incoming_payment_metadata` to random data (16 bytes in the case of `incoming_payment_metadata`).
707703
- Otherwise:
708-
- MUST set `incoming_payment_secret` and `incoming_payment_metadata` to `outgoing_payment_secret` and `outgoing_payment_metadata`.
704+
- MUST set `incoming_payment_secret` to `outgoing_payment_secret`.
709705
- MAY use `padding` to disguise that this is the final destination.
710706
- MUST create a `trampinfo` (#2) for the previous trampoline:
711707
- MUST set `minitramp`.`trampkey` to the public key of a random secret.
712708
- MUST set `minitramp`.`encrypted_trampinfo` to the encrypted `trampinfo` created for the payment destination.
713709
- MUST set `outgoing_payment_secret` to `incoming_payment_secret` in `trampinfo` #1.
714-
- MUST set `outgoing_payment_metadata` to `incoming_payment_metadata` in `trampinfo` #1.
710+
- MAY set `payment_metadata` to a random value.
715711
- MUST set `amount_to_send` and `next_cltv_value` to the values expected by the payment destination.
716712
- MUST set `blinded_paths` and `blinded_payinfo` as supplied by the invoice.
717713
- If it sets `blinded_paths`:
@@ -721,19 +717,19 @@ The initial sender of a "minitramp" payment builds it backwards from final desti
721717
- MUST set `incoming_amount_msat` and `incoming_ctlv` to the values expected at this destination.
722718
- MUST set `total_amount_msat` to the `incoming_amount_msat` of `trampinfo` #1
723719
- MUST set `next_cltv_value` to the `incoming_ctlv` of `trampinfo` #1
724-
- SHOULD set `incoming_payment_secret` and `incoming_payment_metadata` to random data (16 bytes in the case of `incoming_payment_metadata`).
720+
- SHOULD set `incoming_payment_secret` and to random data.
725721
- If it creates another `trampinfo` (#3 onwards);
726722
- MUST set `minitramp`.`trampkey` to the public key of a random secret.
727723
- MUST set `minitramp`.`encrypted_trampinfo` to the encrypted previous `trampinfo`
728724
- MUST set `outgoing_payment_secret` to `incoming_payment_secret` in the previous `trampinfo`.
729-
- MUST set `outgoing_payment_metadata` to `incoming_payment_metadata` in the previous `trampinfo`.
730-
- SHOULD set `incoming_payment_secret` and `incoming_payment_metadata` to random data (16 bytes in the case of `incoming_payment_metadata`).
725+
- MAY set `payment_metadata` to a random value.
726+
- SHOULD set `incoming_payment_secret` to random data.
731727
- MUST set `total_amount_msat` to the `incoming_amount_msat` of the previous `trampinfo`
732728
- MUST set `next_cltv_value` to the `incoming_ctlv` of the previous `trampinfo`
733729
- MUST set `next_node` to the node id of the next trampoline
734730
- MUST create a payment to the first trampoline node:
735731
- MUST put the last-produced `minitramp` into the final `payload` for each payment part.
736-
- MUST set `payment_secret` and `payment_metadata` to the `incoming_payment_secret` and `incoming_payment_metadata` of the last-produced `trampinfo`.
732+
- MUST set `payment_secret` to the `incoming_payment_secret` of the last-produced `trampinfo`.
737733

738734
The recipient:
739735
- MUST process all parts of the payment as normal.
@@ -742,14 +738,13 @@ The recipient:
742738
- If `encrypted_trampinfo` does not decrypt into a valid `trampinfo`:
743739
- Fail all HTLCs with `incorrect_or_unknown_payment_details`.
744740
- Check for trampoline misbehaviour (below)
745-
- If `trampinfo`.`incoming_amount_msat` or `trampinfo`.`incoming_ctlv` are not equal to the incoming HTLC
741+
- If `trampinfo`.`incoming_amount_msat` or `trampinfo`.`incoming_ctlv` are less than the incoming HTLC
746742
- Fail all HTLCs with `incorrect_or_unknown_payment_details`.
747743
- If neither `node_id` nor `blinded_paths` are present (we are the final destination):
748744
- If `payment_secret` in `payload` is not equal to `trampinfo`.`incoming_payment_secret`:
749745
- Reject payment
750746
- Check for trampoline misbehaviour (below)
751-
- If `payment_metadata` in `payload` is not equal to `trampinfo`.`incoming_payment_metadata`:
752-
- Reject payment
747+
- SHOULD process the payment as if the `payload` contained the `minitramp` `payment_secret` and `payment_metadata`.
753748
- Otherwise: (forwarding):
754749
- If both `next_node` and `blinded_paths` are present:
755750
- Reject payment

0 commit comments

Comments
 (0)