diff --git a/blockchain/store.go b/blockchain/store.go index 3b4226429..06b3c4275 100644 --- a/blockchain/store.go +++ b/blockchain/store.go @@ -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 { diff --git a/state/state.go b/state/state.go index f8b5dfc2a..af2f69cae 100644 --- a/state/state.go +++ b/state/state.go @@ -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 {