@@ -53,6 +53,7 @@ A node:
5353 * [ Route Blinding] ( #route-blinding )
5454 * [ Accepting and Forwarding a Payment] ( #accepting-and-forwarding-a-payment )
5555 * [ Non-strict Forwarding] ( #non-strict-forwarding )
56+ * [ Resource Bucketing] ( #resource-bucketing )
5657 * [ Payload for the Last Node] ( #payload-for-the-last-node )
5758 * [ Shared Secret] ( #shared-secret )
5859 * [ Blinding Ephemeral Keys] ( #blinding-ephemeral-keys )
@@ -62,6 +63,7 @@ A node:
6263 * [ Returning Errors] ( #returning-errors )
6364 * [ Failure Messages] ( #failure-messages )
6465 * [ Receiving Failure Codes] ( #receiving-failure-codes )
66+ * [ Recommendations for Reputation] ( #recommendations-for-reputation )
6567 * [ Test Vector] ( #test-vector )
6668 * [ Returning Errors] ( #returning-errors )
6769 * [ References] ( #references )
@@ -635,6 +637,35 @@ Alternatively, implementations may choose to apply non-strict forwarding only to
635637like-policy channels to ensure their expected fee revenue does not deviate by
636638using an alternate channel.
637639
640+ ## Resource Bucketing
641+
642+ When making the decision to forward a payment on its outgoing channel, a node
643+ MAY choose to limit its exposure to HTLCs that put it at risk of a denial of
644+ service attack.
645+ * ` unknown_allocation_slots ` : defines the number of HTLC slots allocated to
646+ unknown traffic (default: 50% of remote peer's ` max_accepted_htlcs ` ).
647+ * ` unknown_allocation_liquidity ` : defines the amount of the channel balance
648+ that is allocated to unknown traffic (default: 50% of remote peer's
649+ ` max_htlc_value_in_flight_msat ` .
650+
651+ A node implementing resource bucketing limits exposure on its outgoing channel:
652+ - MUST choose ` unknown_allocation_slots ` <= the remote channel peer's
653+ ` max_accepted_htlcs ` .
654+ - MUST choose ` unknown_allocation_liquidity ` <= the remote channel peer's
655+ ` max_htlc_value_in_flight_msat ` .
656+ - If ` endorsed ` is set to 1 in the incoming ` update_add_htlc ` AND the HTLC
657+ is from a node that the forwarding node considers to have good local
658+ reputation (see [ Recommendations for Reputation] ( #recommendations-for-reputation ) ):
659+ - SHOULD proceed with forwarding the HTLC.
660+ - SHOULD set ` endorsed ` to 1 in the outgoing ` update_add_htlc ` .
661+ - Otherwise, the HTLC is classified as ` unknown ` :
662+ - If ` unknown_allocation_slots ` HTLC slots are occupied by other ` unknown ` HTLCs:
663+ - SHOULD return ` temporary_channel_failure ` as specified in [ Failure Messages] ( #failure-messages ) .
664+ - If ` unknown_allocation_liquidity ` satoshis of liquidity are locked in
665+ other ` unknown ` HTLCs:
666+ - SHOULD return ` temporary_channel_failure ` as specified in [ Failure Messages] ( #failure-messages ) .
667+ - SHOULD set ` endorsed ` to 0 in the outgoing ` update_add_htlc ` .
668+
638669## Payload for the Last Node
639670
640671When building the route, the origin node MUST use a payload for
@@ -1407,6 +1438,60 @@ The _origin node_:
14071438 - MAY use the data specified in the various failure types for debugging
14081439 purposes.
14091440
1441+ ## Recommendations for Reputation
1442+
1443+ Local reputation is used by forwarding nodes to decide whether to endorse a HTLC
1444+ on their outgoing link. Nodes MAY use any metric of their choosing to classify
1445+ a peer as having "good" reputation, though a poor choice of reputation scoring
1446+ metric will affect their downstream reputation.
1447+
1448+ - ` resolution_time ` : the time elapsed between ` update_add_htlc ` and its
1449+ resolution (` update_fulfill_hltc ` / ` update_fail_hltc ` /
1450+ ` update_fail_malformed_htlc ` ).
1451+ - ` resolution_threshold ` : the resolution time threshold that is considered
1452+ "good" behavior (default: 10 seconds).
1453+ - ` fees ` : the fees paid by a forwarded HTLC (as described in [ BOLT #7 ] ( 07-routing-gossip.md#htlc-fees ) ,
1454+ equal to 0 if the HTLC was failed).
1455+
1456+ For every incoming HLTC a peer has forwarded through a node, its ` effective_fees `
1457+ are calculated as follows:
1458+ - if ` endorsed ` = 1 in ` update_add_htlc ` :
1459+ - if the HTLC was settled with ` update_fulfill_hltc ` :
1460+ - ` effective_fees ` = ` fees ` - ceil( (` resolution_time ` - ` resolution_threshold ` ) / ` resolution_threshold ` ) * ` fees `
1461+ - otherwise:
1462+ - ` effective_fees ` = - ceil( (` resolution_time ` - ` resolution_threshold ` ) / ` resolution_threshold ` ) * ` fees `
1463+ - otherwise:
1464+ - if successfully resolved AND ` resolution_time ` <= ` resolution_threshold `
1465+ - ` effective_fees ` = ` fees `
1466+ - otherwise:
1467+ - ` effective_fees ` = 0
1468+
1469+ The sum of the ` effective_fees ` for each HTLC that a peer has forwarded over
1470+ a sliding window of time is used to assess local reputation.
1471+
1472+ - ` maximum_hold ` : the maximum amount of time that a HTLC can be locked in a
1473+ node's commitment.
1474+ - ` reputation_window ` : the period of time over which we assess revenue
1475+ (recommended default = 10 * ` maximum_hold ` )
1476+ - ` revenue ` : the total routing revenue generated by the node over ` maximum_hold `
1477+ - ` reputation_revenue ` : the total ` effective_fees ` of HTLCs forwarded by the peer
1478+ and resolved within ` reputation_window ` .
1479+
1480+ The local reputation that a peer has earned is compared to total revenue to
1481+ classify reputation as good or neutral.
1482+
1483+ - if ` reputation_revenue ` over ` reputation_window ` >= ` revenue ` over ` maximum_hold `
1484+ - a peer should be considered to have good local reputation.
1485+ - otherwise, the peer should be considered to have neutral local reputation.
1486+
1487+ ### Rationale
1488+ If a HTLC is endorsed by a peer they have signaled that they expect the HTLC
1489+ to resolve honestly, so will be held accountable for the manner in which they
1490+ resolve. By contrast, if a HTLC was not endorsed by the upstream peer, it
1491+ should not have a negative impact on reputation. In the case where one of
1492+ these "unknown" HTLCs succeeds within the reasonable resolution threshold, the
1493+ peer is still credited with fees because the HTLC resolved desirably.
1494+
14101495# Test Vector
14111496
14121497## Returning Errors
0 commit comments