From cc3cfd2a184ec8c202520d4ae0f0f1cff329e019 Mon Sep 17 00:00:00 2001 From: Jin Date: Wed, 18 Oct 2023 22:46:33 +0800 Subject: [PATCH] BUG:legacychain database upgrade --- database/legacychaindb/legacychaindb_upgrade.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/database/legacychaindb/legacychaindb_upgrade.go b/database/legacychaindb/legacychaindb_upgrade.go index de9a1707..9791c8cc 100644 --- a/database/legacychaindb/legacychaindb_upgrade.go +++ b/database/legacychaindb/legacychaindb_upgrade.go @@ -67,8 +67,12 @@ func (cdb *LegacyChainDB) TryUpgrade(di *common.DatabaseInfo, interrupt <-chan s if system.InterruptRequested(interrupt) { return fmt.Errorf("interrupt upgrade database") } + blockid, err = cdb.GetBlockIdByOrder(uint(i)) + if err != nil { + return err + } err = cdb.db.View(func(dbTx legacydb.Tx) error { - blockhash, err = dbFetchBlockHashByIID(dbTx, i) + blockhash, err = dbFetchBlockHashByIID(dbTx, uint32(blockid)) return err }) if err != nil { @@ -78,10 +82,6 @@ func (cdb *LegacyChainDB) TryUpgrade(di *common.DatabaseInfo, interrupt <-chan s if err != nil { return err } - blockid, err = cdb.GetDAGBlockIdByHash(blockhash) - if err != nil { - return err - } dblock := &meerdag.Block{} dblock.SetID(blockid) ib := &meerdag.PhantomBlock{Block: dblock}