call db.SetSync when necessary

This commit is contained in:
Jae Kwon
2016-12-06 02:52:07 -08:00
parent 1c16ce8cf0
commit 6f88d04ac4
2 changed files with 5 additions and 2 deletions

View File

@@ -172,6 +172,9 @@ func (bs *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, s
// Done!
bs.height = height
// Flush
bs.db.SetSync(nil, nil)
}
func (bs *BlockStore) saveBlockPart(height int, index int, part *types.Part) {
@@ -213,7 +216,7 @@ func (bsj BlockStoreStateJSON) Save(db dbm.DB) {
if err != nil {
PanicSanity(Fmt("Could not marshal state bytes: %v", err))
}
db.Set(blockStoreKey, bytes)
db.SetSync(blockStoreKey, bytes)
}
func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON {

View File

@@ -80,7 +80,7 @@ func (s *State) Copy() *State {
func (s *State) Save() {
s.mtx.Lock()
defer s.mtx.Unlock()
s.db.Set(stateKey, s.Bytes())
s.db.SetSync(stateKey, s.Bytes())
}
func (s *State) Equals(s2 *State) bool {