From b798cab1427ba263fd812f6aa0b7ab7a9969bee8 Mon Sep 17 00:00:00 2001 From: Wondertan Date: Fri, 8 Nov 2024 02:12:03 +0100 Subject: [PATCH] fix(core): don't hold on Data --- core/exchange.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/exchange.go b/core/exchange.go index 3f55bbf990..0f90274309 100644 --- a/core/exchange.go +++ b/core/exchange.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "github.com/tendermint/tendermint/types" "time" "golang.org/x/sync/errgroup" @@ -177,7 +178,11 @@ func (ce *Exchange) getExtendedHeaderByHeight(ctx context.Context, height *int64 if err != nil { return nil, fmt.Errorf("extending block data for height %d: %w", b.Header.Height, err) } - // create extended header + + // TODO(@Wondertan): This is a hack to deref Data, allowing GC to pick it up. + // The better footgun-less solution is to change core.ResultSignedBlock fields to be pointers instead of values. + b.Data = types.Data{} + eh, err := ce.construct(&b.Header, &b.Commit, &b.ValidatorSet, eds) if err != nil { panic(fmt.Errorf("constructing extended header for height %d: %w", b.Header.Height, err))