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}