blindedpath: smarter dummy hop policy selection
This commit introduces more sophisticated code for selecting dummy hop policy values for dummy hops in blinded paths. For the case where the path does contain real hops, the dummy hop policy values are derived by taking the average of those hop polices. For the case where there are no real hops (in other words, we are the introduction node), we use the default policy values used for normal ChannelUpdates but then for the MaxHTLC value, we take the average of all our open channel capacities.
This commit is contained in:
4 files changed
+196
-45
No files matched your search
@@ -802,7 +802,7 @@ func TestBuildBlindedPathWithDummyHops(t *testing.T) {
|
||||
// hops to be added to the real route.
|
||||
MinNumHops: 4,
|
||||
|
||||
DummyHopPolicy: &BlindedHopPolicy{
|
||||
DefaultDummyHopPolicy: &BlindedHopPolicy{
|
||||
CLTVExpiryDelta: 50,
|
||||
FeeRate: 100,
|
||||
BaseFee: 100,
|
||||
@@ -817,8 +817,8 @@ func TestBuildBlindedPathWithDummyHops(t *testing.T) {
|
||||
|
||||
// Check that all the accumulated policy values are correct.
|
||||
require.EqualValues(t, 403, path.FeeBaseMsat)
|
||||
require.EqualValues(t, 1203, path.FeeRate)
|
||||
require.EqualValues(t, 400, path.CltvExpiryDelta)
|
||||
require.EqualValues(t, 2003, path.FeeRate)
|
||||
require.EqualValues(t, 588, path.CltvExpiryDelta)
|
||||
require.EqualValues(t, 1000, path.HTLCMinMsat)
|
||||
require.EqualValues(t, lnwire.MaxMilliSatoshi, path.HTLCMaxMsat)
|
||||
|
||||
@@ -861,7 +861,7 @@ func TestBuildBlindedPathWithDummyHops(t *testing.T) {
|
||||
}, data.RelayInfo.UnwrapOrFail(t).Val)
|
||||
|
||||
require.Equal(t, record.PaymentConstraints{
|
||||
MaxCltvExpiry: 1600,
|
||||
MaxCltvExpiry: 1788,
|
||||
HtlcMinimumMsat: 1000,
|
||||
}, data.Constraints.UnwrapOrFail(t).Val)
|
||||
|
||||
@@ -883,7 +883,7 @@ func TestBuildBlindedPathWithDummyHops(t *testing.T) {
|
||||
}, data.RelayInfo.UnwrapOrFail(t).Val)
|
||||
|
||||
require.Equal(t, record.PaymentConstraints{
|
||||
MaxCltvExpiry: 1456,
|
||||
MaxCltvExpiry: 1644,
|
||||
HtlcMinimumMsat: 1000,
|
||||
}, data.Constraints.UnwrapOrFail(t).Val)
|
||||
|
||||
|
||||
Reference in new issue
Block a user