Browse Source

call db.SetSync when necessary

pull/317/merge
Jae Kwon 8 years ago
parent
commit
6f88d04ac4
2 changed files with 5 additions and 2 deletions
  1. +4
    -1
      blockchain/store.go
  2. +1
    -1
      state/state.go

+ 4
- 1
blockchain/store.go 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 {


+ 1
- 1
state/state.go 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 {


Loading…
Cancel
Save