From 58b2ae875284d7de7ce7c255e9b602c1fc0cac60 Mon Sep 17 00:00:00 2001 From: Vladislav Lapin Date: Fri, 21 Aug 2026 20:02:04 +0400 Subject: [PATCH] test(p2p): provide tail in partial range store --- p2p/server_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/p2p/server_test.go b/p2p/server_test.go index 584336f0..f94c3c31 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -185,7 +185,9 @@ func TestExchangeServer_partialRangeNotExpanded(t *testing.T) { head := headertest.RandDummyHeader(t) head.HeightI = 10_000_000 // simulate a node synced far ahead - store := &partialRangeStore[*headertest.DummyHeader]{head: head} + tail := headertest.RandDummyHeader(t) + tail.HeightI = 1 + store := &partialRangeStore[*headertest.DummyHeader]{head: head, tail: tail} server, err := NewExchangeServer[*headertest.DummyHeader]( peer[0], @@ -207,6 +209,7 @@ func TestExchangeServer_partialRangeNotExpanded(t *testing.T) { type partialRangeStore[H header.Header[H]] struct { header.Store[H] head H + tail H gotTo uint64 } @@ -216,6 +219,10 @@ func (s *partialRangeStore[H]) Head(context.Context, ...header.HeadOption[H]) (H return s.head, nil } +func (s *partialRangeStore[H]) Tail(context.Context) (H, error) { + return s.tail, nil +} + func (s *partialRangeStore[H]) GetRange(_ context.Context, _, to uint64) ([]H, error) { s.gotTo = to return nil, nil