Skip to content

Commit

Permalink
Fix pruning candidate (#1821)
Browse files Browse the repository at this point in the history
  • Loading branch information
someone235 authored Aug 23, 2021
1 parent 7b5720a commit ba5880f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (ps *pruningStore) PruningPointCandidate(dbContext model.DBReader, stagingA
return ps.pruningPointCandidateCache, nil
}

candidateBytes, err := dbContext.Get(ps.pruningBlockHashKey)
candidateBytes, err := dbContext.Get(ps.candidatePruningPointHashKey)
if err != nil {
return nil, err
}
Expand Down
5 changes: 4 additions & 1 deletion domain/consensus/processes/pruningmanager/pruning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pruningmanager_test

import (
"encoding/json"
"github.com/kaspanet/kaspad/infrastructure/db/database"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -107,7 +108,9 @@ func TestPruning(t *testing.T) {
blockHashToID[*blockHash] = dagBlock.ID

pruningPointCandidate, err := tc.PruningStore().PruningPointCandidate(tc.DatabaseContext(), stagingArea)
if err != nil {
if database.IsNotFoundError(err) {
pruningPointCandidate = consensusConfig.GenesisHash
} else if err != nil {
return err
}

Expand Down

0 comments on commit ba5880f

Please sign in to comment.