Skip to content

Commit

Permalink
IOTEX-22 Create creator's state first when recovering from fresh stat…
Browse files Browse the repository at this point in the history
…e db (#72)
  • Loading branch information
lizhefeng authored and zjshen14 committed Sep 9, 2018
1 parent 6b7e905 commit 9e60e64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ func (bc *blockchain) Start(ctx context.Context) (err error) {
}
startHeight = factoryHeight + 1
}
// If restarting factory from fresh db, first create creator's state
if startHeight == 0 {
if _, err := bc.sf.LoadOrCreateState(Gen.CreatorAddr, Gen.TotalSupply); err != nil {
return err
}
}
for i := startHeight; i <= bc.tipHeight; i++ {
blk, err := bc.GetBlockByHeight(i)
if err != nil {
Expand Down

0 comments on commit 9e60e64

Please sign in to comment.