diff --git a/CHANGELOG.md b/CHANGELOG.md index 79cb396c6e..2801c932b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ BREAKING CHANGES * Remove go-wire, use go-amino * [store] Add `SubspaceIterator` and `ReverseSubspaceIterator` to `KVStore` interface +FEATURES: + +* Add CacheContext + ## 0.14.1 (April 9, 2018) BUG FIXES diff --git a/types/context.go b/types/context.go index 1ec81ca0ec..8c91175bc6 100644 --- a/types/context.go +++ b/types/context.go @@ -22,7 +22,6 @@ next decorator or handler. For example, ... } */ - type Context struct { context.Context pst *thePast @@ -172,9 +171,11 @@ func (c Context) WithTxBytes(txBytes []byte) Context { return c.withValue(contextKeyTxBytes, txBytes) } -func (c Context) CacheContext() (Context, func()) { +// Cache the multistore and return a new cached context. 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) return cc, cms.Write }