@@ -1454,10 +1454,10 @@ forward unendorsed HTLCs that they are not certain about.
1454
1454
HTLC resolution time is assessed relative to a threshold that the node
1455
1455
considers to be a reasonable amount of time for a HTLC to resolve:
1456
1456
- ` resolution_period ` : the amount of time a HTLC is allowed to resolve in that
1457
- is classified as "good" behavior (default: 10 seconds).
1457
+ is classified as "good" behavior, expressed in seconds (default: 10 seconds).
1458
1458
- ` resolution_time ` : the time elapsed between ` update_add_htlc ` and its
1459
1459
resolution (` update_fulfill_hltc ` / ` update_fail_hltc ` /
1460
- ` update_fail_malformed_htlc ` ).
1460
+ ` update_fail_malformed_htlc ` ), expressed in seconds .
1461
1461
1462
1462
Each HTLC's contribution to reputation is expressed by its ` effective_fees `
1463
1463
which capture the fees that it paid and the opportunity cost that holding it
@@ -1473,8 +1473,8 @@ for the slot and liquidity that could have otherwise been paid for by
1473
1473
successful, fast resolving HTLCs during the ` resolution_time ` the HTLC was
1474
1474
locked in the channel.
1475
1475
1476
- For every incoming HLTC a peer has forwarded through a node, its ` effective_fees `
1477
- are calculated as follows:
1476
+ For every resolved incoming HLTC a peer has forwarded through a node, its
1477
+ ` effective_fees ` are calculated as follows:
1478
1478
- if ` endorsed ` = 1 in ` update_add_htlc ` :
1479
1479
- ` effective_fees ` = ` fees ` - ` opportunity_cost `
1480
1480
- otherwise:
@@ -1483,6 +1483,14 @@ are calculated as follows:
1483
1483
- otherwise:
1484
1484
- ` effective_fees ` = 0
1485
1485
1486
+ Incoming in-flight HTLCs have a negative impact on reputation, as their
1487
+ influence is unknown until time of resolution. The ` outstanding_risk ` of each
1488
+ in flight HTLC is calculated as follows:
1489
+ - if ` endorsed ` = 1 in ` update_add_htlc ` :
1490
+ - ` outstanding_risk ` = ` fees ` * ( ` cltv_expiry ` - ` height_added ` * 10 * 60),
1491
+ where ` height_added ` is the block height at which the HLTC was irrevocably
1492
+ committed to by the receiving node.
1493
+
1486
1494
The ` effective_fees ` that a peer has paid our node are compared to our total
1487
1495
routing revenue to classify a peer's reputation as "good" or "neutral". This
1488
1496
relates the fees that must be paid to earn "good" reputation to the damage that
@@ -1497,7 +1505,8 @@ recent routing patterns, and longer windows aggregating trends over time.
1497
1505
assessed (default: 10 minutes * the maximum number of blocks a HTLC may be
1498
1506
held before the node will send ` expiry_too_far ` , as outlined in [ Failure Messages] ( #failure-messages ) ).
1499
1507
- ` routing_revenue ` : the sum of all fees paid to the node to forward HTLCs
1500
- over the interval [ ` now ` - ` routing_window ` ; ` now ` ] .
1508
+ over the interval [ ` now ` - ` routing_window ` ; ` now ` ] less the sum of
1509
+ ` outstanding_risk ` for all incoming, in-flight HLTCs.
1501
1510
1502
1511
The total ` effective_fees ` that an individual peer has generated are assessed
1503
1512
over a longer period of time to relate its reputation classification to the
@@ -1533,6 +1542,13 @@ allows new, unendorsed entrants to slowly build reputation over time. The fee
1533
1542
contribution of unendorsed HTLCs is discounted by 50% to incentivise nodes to
1534
1543
endorse HTLCs.
1535
1544
1545
+ In flight HLTCs are included in reputation scoring to account for sudden changes
1546
+ in a peer's behavior. Even when good reputation is obtained, each HTLC choosing
1547
+ to take advantage of that good reputation is treated as if it will be used to
1548
+ inflict maximum damage. The expiry height of each incoming in flight HLTC is
1549
+ considered so that risk is directly related to the amount of time the HTLC
1550
+ could be held in the channel, and 10 minute blocks are assumed for simplicity.
1551
+
1536
1552
# Test Vector
1537
1553
1538
1554
## Returning Errors
0 commit comments