Skip to content

Commit 9e60e64

Browse files
lizhefengzjshen14
authored andcommitted
IOTEX-22 Create creator's state first when recovering from fresh state db (#72)
1 parent 6b7e905 commit 9e60e64

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

blockchain/blockchain.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ func (bc *blockchain) Start(ctx context.Context) (err error) {
310310
}
311311
startHeight = factoryHeight + 1
312312
}
313+
// If restarting factory from fresh db, first create creator's state
314+
if startHeight == 0 {
315+
if _, err := bc.sf.LoadOrCreateState(Gen.CreatorAddr, Gen.TotalSupply); err != nil {
316+
return err
317+
}
318+
}
313319
for i := startHeight; i <= bc.tipHeight; i++ {
314320
blk, err := bc.GetBlockByHeight(i)
315321
if err != nil {

0 commit comments

Comments
 (0)