mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 14:33:07 +02:00
routing: delay initial zombie prune by 30 sec
Since zombie pruning can be very slow on some devices (e.g. mobile) it would stall lnd startup. Since it is not essential for pruning to be finished for lnd to be functional, we instead delay the initial prune by 30 seconds. Note that we could also wait for the graphPruneInterval to tick, but since this is by default 2 hours, it is unlikely that a mobile app will ever be open that long.
This commit is contained in:
@@ -1541,6 +1541,9 @@ func TestWakeUpOnStaleBranch(t *testing.T) {
|
||||
Control: makeMockControlTower(),
|
||||
ChannelPruneExpiry: time.Hour * 24,
|
||||
GraphPruneInterval: time.Hour * 2,
|
||||
|
||||
// We'll set the delay to zero to prune immediately.
|
||||
FirstTimePruneDelay: 0,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create router %v", err)
|
||||
@@ -2157,6 +2160,9 @@ func testPruneChannelGraphDoubleDisabled(t *testing.T, assumeValid bool) {
|
||||
if !assumeValid {
|
||||
assertChannelsPruned(t, ctx.graph, testChannels)
|
||||
} else {
|
||||
// Sleep to allow the pruning to finish.
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
prunedChannel := testChannels[len(testChannels)-1].ChannelID
|
||||
assertChannelsPruned(t, ctx.graph, testChannels, prunedChannel)
|
||||
}
|
||||
|
Reference in New Issue
Block a user