Merge PR #4873: Set New EventManager in Context#CacheContext

This commit is contained in:
Alexander Bezobchuk 2019-08-08 12:32:05 -04:00 committed by GitHub
parent 1dfbfc08d7
commit 0bcc7c9b7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1,2 @@
#4868 Context#CacheContext now sets a new EventManager. This prevents unwanted events
from being emitted.

View File

@ -205,10 +205,11 @@ func (c Context) TransientStore(key StoreKey) KVStore {
return gaskv.NewStore(c.MultiStore().GetKVStore(key), c.GasMeter(), stypes.TransientGasConfig())
}
// Cache the multistore and return a new cached context. The cached context is
// written to the context when writeCache is called.
// CacheContext returns a new Context with the multi-store cached and a new
// EventManager. The cached context is written to the context when writeCache
// is called.
func (c Context) CacheContext() (cc Context, writeCache func()) {
cms := c.MultiStore().CacheMultiStore()
cc = c.WithMultiStore(cms)
cc = c.WithMultiStore(cms).WithEventManager(NewEventManager())
return cc, cms.Write
}