dao: add KeepOnlyLatestState
setting to dao.Version
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
f7e2d3d717
commit
f1767f361d
5 changed files with 22 additions and 34 deletions
|
@ -306,10 +306,11 @@ func (bc *Blockchain) init() error {
|
|||
if err != nil {
|
||||
bc.log.Info("no storage version found! creating genesis block")
|
||||
ver = dao.Version{
|
||||
StoragePrefix: storage.STStorage,
|
||||
StateRootInHeader: bc.config.StateRootInHeader,
|
||||
P2PSigExtensions: bc.config.P2PSigExtensions,
|
||||
Value: version,
|
||||
StoragePrefix: storage.STStorage,
|
||||
StateRootInHeader: bc.config.StateRootInHeader,
|
||||
P2PSigExtensions: bc.config.P2PSigExtensions,
|
||||
KeepOnlyLatestState: bc.config.KeepOnlyLatestState,
|
||||
Value: version,
|
||||
}
|
||||
if err = bc.dao.PutVersion(ver); err != nil {
|
||||
return err
|
||||
|
@ -341,6 +342,10 @@ func (bc *Blockchain) init() error {
|
|||
return fmt.Errorf("P2PSigExtensions setting mismatch (old=%t, new=%t",
|
||||
ver.P2PSigExtensions, bc.config.P2PSigExtensions)
|
||||
}
|
||||
if ver.KeepOnlyLatestState != bc.config.KeepOnlyLatestState {
|
||||
return fmt.Errorf("KeepOnlyLatestState setting mismatch: old=%v, new=%v",
|
||||
ver.KeepOnlyLatestState, bc.config.KeepOnlyLatestState)
|
||||
}
|
||||
bc.dao.Version = ver
|
||||
bc.persistent.Version = ver
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue