File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ package pruner
1616
1717import (
1818 "context"
19+ "errors"
1920 "time"
2021
2122 "github.com/NethermindEth/juno/core"
@@ -162,6 +163,10 @@ func (p *Pruner) Run(ctx context.Context) error {
162163func (p * Pruner ) onNewBlock (ctx context.Context , block * core.Block ) error {
163164 l1Head , err := core .GetL1Head (p .database )
164165 if err != nil {
166+ if errors .Is (err , db .ErrKeyNotFound ) {
167+ // No L1 head yet — can't anchor the retention floor.
168+ return nil
169+ }
165170 return err
166171 }
167172
@@ -183,6 +188,10 @@ func (p *Pruner) onNewBlock(ctx context.Context, block *core.Block) error {
183188func (p * Pruner ) onNewL1Head (ctx context.Context , l1Head * core.L1Head ) error {
184189 chainHeight , err := core .GetChainHeight (p .database )
185190 if err != nil {
191+ if errors .Is (err , db .ErrKeyNotFound ) {
192+ // No chain height yet — nothing to prune against.
193+ return nil
194+ }
186195 return err
187196 }
188197
You can’t perform that action at this time.
0 commit comments