From b64f947c1a9a1ec27815de099d85b656623de3e4 Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Tue, 7 May 2024 15:57:47 +0200 Subject: [PATCH] fix(pruner/light): Fix light availability window provided (#3370) Thank you @walldiss for finding this. --- pruner/full/window_test.go | 14 ++++++++++++++ pruner/light/window.go | 4 +++- pruner/light/window_test.go | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 pruner/full/window_test.go create mode 100644 pruner/light/window_test.go diff --git a/pruner/full/window_test.go b/pruner/full/window_test.go new file mode 100644 index 0000000000..627c76abe2 --- /dev/null +++ b/pruner/full/window_test.go @@ -0,0 +1,14 @@ +package full + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +// TestFullWindowConst exists to ensure that any changes to the sampling window +// are deliberate. +func TestFullWindowConst(t *testing.T) { + assert.Equal(t, time.Duration(Window), (30*24*time.Hour)+time.Hour) +} diff --git a/pruner/light/window.go b/pruner/light/window.go index 2241ecb063..eeabb0fda7 100644 --- a/pruner/light/window.go +++ b/pruner/light/window.go @@ -1,9 +1,11 @@ package light import ( + "time" + "github.com/celestiaorg/celestia-node/pruner" ) // Window is the availability window for light nodes in the Celestia // network (30 days). -const Window = pruner.AvailabilityWindow(30 * 24 * 60 * 60) +const Window = pruner.AvailabilityWindow(30 * 24 * time.Hour) diff --git a/pruner/light/window_test.go b/pruner/light/window_test.go new file mode 100644 index 0000000000..d74d594f70 --- /dev/null +++ b/pruner/light/window_test.go @@ -0,0 +1,14 @@ +package light + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +// TestLightWindowConst exists to ensure that any changes to the sampling window +// are deliberate. +func TestLightWindowConst(t *testing.T) { + assert.Equal(t, time.Duration(Window), 30*24*time.Hour) +}