From 7cca94943c41bb68cf43a4b9e9b0863602af9f34 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Fri, 26 Jul 2024 18:18:09 +0100 Subject: [PATCH] Let spaghetti calculate cost for blocks instead of setting it --- database/tbcd/level/level.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/tbcd/level/level.go b/database/tbcd/level/level.go index 323e6263..9768349c 100644 --- a/database/tbcd/level/level.go +++ b/database/tbcd/level/level.go @@ -653,7 +653,7 @@ func (l *ldb) BlockInsert(ctx context.Context, b *btcutil.Block) (int64, error) if err = bDB.Put(b.Hash()[:], rawBlock, nil); err != nil { return -1, fmt.Errorf("blocks insert put: %w", err) } - l.blockCache.Set(string(b.Hash()[:]), b, int64(32+len(rawBlock))) + l.blockCache.Set(string(b.Hash()[:]), b, 0) // let cache calculate cost } // Remove block identifier from blocks missing @@ -698,7 +698,7 @@ func (l *ldb) BlockByHash(ctx context.Context, hash *chainhash.Hash) (*btcutil.B return nil, fmt.Errorf("block decode: %w", err) } b.SetHeight(int32(bh.Height)) - l.blockCache.Set(string(hash[:]), b, int64(32+len(eb))) + l.blockCache.Set(string(hash[:]), b, 0) // let cache calculate cost return b, nil }