Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG:upgradde database #430

Merged
merged 2 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/relaynode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ func (node *Node) getChainState() *pb.ChainState {
GraphState: gs,
UserAgent: []byte(p2p.BuildUserAgent("Qitmeer-relay")),
DisableRelayTx: true,
StateRoot: &pb.Hash{Hash: hash.ZeroHash.Bytes()},
}
}

Expand Down
20 changes: 12 additions & 8 deletions meerdag/upgradedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ func (bd *MeerDAG) UpgradeDB(db database.DB, mainTip *hash.Hash, total uint64, g
bs.Valid()
}
// evm
if i == 0 ||
forks.IsBeforeMeerEVMForkHeight(int64(ib.GetHeight())) {
if i == 0 {
curEVM = evmGenesis
bs.SetEVM(curEVM)
} else {
Expand All @@ -94,14 +93,19 @@ func (bd *MeerDAG) UpgradeDB(db database.DB, mainTip *hash.Hash, total uint64, g
})
}
//
number := getBlockNumber(edb, block.Hash())
if number != 0 {
header := evmbc.GetHeaderByNumber(number)
if header == nil {
return fmt.Errorf("No block in number:%d", number)
if forks.IsBeforeMeerEVMForkHeight(int64(ib.GetHeight())) {
curEVM = evmGenesis
} else {
number := getBlockNumber(edb, block.Hash())
if number != 0 {
header := evmbc.GetHeaderByNumber(number)
if header == nil {
return fmt.Errorf("No block in number:%d", number)
}
curEVM = header
}
curEVM = header
}

bs.Update(block, prev, curEVM)
}

Expand Down