Skip to content

Commit

Permalink
Merge pull request #562 from lochjin/main
Browse files Browse the repository at this point in the history
BUG:legacychain database upgrade
  • Loading branch information
dindinw authored Oct 19, 2023
2 parents bde9231 + cc3cfd2 commit 9247d9b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions database/legacychaindb/legacychaindb_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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}
Expand Down

0 comments on commit 9247d9b

Please sign in to comment.