Golang implemented sidechain for Bytom
Revision | 8fe5d2e785d82500a9b0ab6f481ff7adfb32a173 (tree) |
---|---|
Zeit | 2020-04-01 20:59:17 |
Autor | shenao78 <shenao.78@163....> |
Commiter | shenao78 |
prevent duplicate init chain status
@@ -17,6 +17,7 @@ import ( | ||
17 | 17 | ) |
18 | 18 | |
19 | 19 | var ( |
20 | + errChainStatusHasAlreadyInit = errors.New("mov chain status has already initialized") | |
20 | 21 | errInvalidTradePairs = errors.New("The trade pairs in the tx input is invalid") |
21 | 22 | errStatusFailMustFalse = errors.New("status fail of transaction does not allow to be true") |
22 | 23 | errInputProgramMustP2WMCScript = errors.New("input program of trade tx must p2wmc script") |
@@ -127,6 +128,10 @@ func (m *Core) DetachBlock(block *types.Block) error { | ||
127 | 128 | |
128 | 129 | // InitChainStatus used to init the start block height and start block hash to store |
129 | 130 | func (m *Core) InitChainStatus(startHash *bc.Hash) error { |
131 | + if _, err := m.movStore.GetMovDatabaseState(); err == nil { | |
132 | + return errChainStatusHasAlreadyInit | |
133 | + } | |
134 | + | |
130 | 135 | return m.movStore.InitDBState(m.startBlockHeight, startHash) |
131 | 136 | } |
132 | 137 |