mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-26 22:17:51 +01:00
server+routing: pass isAlias to router
This allows the router to determine what is and isn't an alias from lnd's definition of an alias. Any ChannelAnnouncement that has an alias ShortChannelID field is not verified on-chain. To prevent a DoS vector from existing, the gossiper ensures that only the local lnd node can send its ChannelAnnouncements to the router with an alias ShortChannelID.
This commit is contained in:
@@ -82,6 +82,9 @@ func (c *testCtx) RestartRouter(t *testing.T) {
|
||||
Control: makeMockControlTower(),
|
||||
ChannelPruneExpiry: time.Hour * 24,
|
||||
GraphPruneInterval: time.Hour * 2,
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "unable to create router")
|
||||
require.NoError(t, router.Start(), "unable to start router")
|
||||
@@ -165,6 +168,9 @@ func createTestCtxFromGraphInstanceAssumeValid(t *testing.T,
|
||||
Clock: clock.NewTestClock(time.Unix(1, 0)),
|
||||
AssumeChannelValid: assumeValid,
|
||||
StrictZombiePruning: strictPruning,
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "unable to create router")
|
||||
require.NoError(t, router.Start(), "unable to start router")
|
||||
@@ -1738,6 +1744,10 @@ func TestWakeUpOnStaleBranch(t *testing.T) {
|
||||
|
||||
// We'll set the delay to zero to prune immediately.
|
||||
FirstTimePruneDelay: 0,
|
||||
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create router %v", err)
|
||||
@@ -3485,6 +3495,10 @@ func TestSendMPPaymentSucceed(t *testing.T) {
|
||||
next := atomic.AddUint64(&uniquePaymentID, 1)
|
||||
return next, nil
|
||||
},
|
||||
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "failed to create router")
|
||||
|
||||
@@ -3648,6 +3662,10 @@ func TestSendMPPaymentSucceedOnExtraShards(t *testing.T) {
|
||||
next := atomic.AddUint64(&uniquePaymentID, 1)
|
||||
return next, nil
|
||||
},
|
||||
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "failed to create router")
|
||||
|
||||
@@ -3856,6 +3874,10 @@ func TestSendMPPaymentFailed(t *testing.T) {
|
||||
next := atomic.AddUint64(&uniquePaymentID, 1)
|
||||
return next, nil
|
||||
},
|
||||
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "failed to create router")
|
||||
|
||||
@@ -4056,6 +4078,10 @@ func TestSendMPPaymentFailedWithShardsInFlight(t *testing.T) {
|
||||
next := atomic.AddUint64(&uniquePaymentID, 1)
|
||||
return next, nil
|
||||
},
|
||||
|
||||
IsAlias: func(scid lnwire.ShortChannelID) bool {
|
||||
return false
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "failed to create router")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user