aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-05-27 18:02:37 +0800
committerGitHub <noreply@github.com>2019-05-27 18:02:37 +0800
commitdb0cc211f76a03187a2eb0b4e30ea1d576d1f666 (patch)
tree21c1d924818c65aafe61ce371d7ba2ce6d1c9501
parent611113e9678b8118e5ec624d9e9f0999f1d4a081 (diff)
parent7392f59e7ce15c17a1194ae82cd90de101f0ab40 (diff)
downloadgo-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.tar
go-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.tar.gz
go-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.tar.bz2
go-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.tar.lz
go-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.tar.xz
go-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.tar.zst
go-tangerine-db0cc211f76a03187a2eb0b4e30ea1d576d1f666.zip
Merge pull request #19628 from karalabe/nofreeze-genesis
core/rawdb: keep genesis in key-value store for full sync too
-rw-r--r--core/rawdb/freezer.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go
index 33da53787..741ff9adb 100644
--- a/core/rawdb/freezer.go
+++ b/core/rawdb/freezer.go
@@ -335,8 +335,11 @@ func (f *freezer) freeze(db ethdb.KeyValueStore) {
// Wipe out all data from the active database
batch := db.NewBatch()
for i := 0; i < len(ancients); i++ {
- DeleteBlockWithoutNumber(batch, ancients[i], first+uint64(i))
- DeleteCanonicalHash(batch, first+uint64(i))
+ // Always keep the genesis block in active database
+ if first+uint64(i) != 0 {
+ DeleteBlockWithoutNumber(batch, ancients[i], first+uint64(i))
+ DeleteCanonicalHash(batch, first+uint64(i))
+ }
}
if err := batch.Write(); err != nil {
log.Crit("Failed to delete frozen canonical blocks", "err", err)
@@ -344,8 +347,11 @@ func (f *freezer) freeze(db ethdb.KeyValueStore) {
batch.Reset()
// Wipe out side chain also.
for number := first; number < f.frozen; number++ {
- for _, hash := range ReadAllHashes(db, number) {
- DeleteBlock(batch, hash, number)
+ // Always keep the genesis block in active database
+ if number != 0 {
+ for _, hash := range ReadAllHashes(db, number) {
+ DeleteBlock(batch, hash, number)
+ }
}
}
if err := batch.Write(); err != nil {