Fix pruning candidate (#1821)

This commit is contained in:
Ori Newman 2021-08-23 07:26:43 +03:00 committed by GitHub
parent 7b5720a155
commit ba5880fab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -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
}

View File

@ -2,6 +2,7 @@ package pruningmanager_test
import (
"encoding/json"
"github.com/kaspanet/kaspad/infrastructure/db/database"
"os"
"path/filepath"
"testing"
@ -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
}