Merge pull request #1143 from tendermint/1091-race-condition

call FlushSync before calling CommitSync
This commit is contained in:
Ethan Buchman
2018-01-24 14:22:43 -05:00
committed by GitHub
3 changed files with 16 additions and 3 deletions

View File

@ -127,6 +127,14 @@ func (blockExec *BlockExecutor) Commit(block *types.Block) ([]byte, error) {
blockExec.mempool.Lock()
defer blockExec.mempool.Unlock()
// while mempool is Locked, flush to ensure all async requests have completed
// in the ABCI app before Commit.
err := blockExec.mempool.FlushAppConn()
if err != nil {
blockExec.logger.Error("Client error during mempool.FlushAppConn", "err", err)
return nil, err
}
// Commit block, get hash back
res, err := blockExec.proxyApp.CommitSync()
if err != nil {