apply requests in progress

This commit is contained in:
mossid
2018-10-07 01:12:01 +09:00
parent 7d49675600
commit 7a68b376bd
21 changed files with 163 additions and 73 deletions
+2 -20
View File
@@ -47,8 +47,6 @@ func NewContext(ms MultiStore, header abci.Header, isCheckTx bool, logger log.Lo
c = c.WithVoteInfos(nil)
c = c.WithGasMeter(NewInfiniteGasMeter())
c = c.WithMinimumFees(Coins{})
c = c.WithKVGasConfig(KVGasConfig())
c = c.WithTransientGasConfig(TransientGasConfig())
return c
}
@@ -74,12 +72,12 @@ func (c Context) Value(key interface{}) interface{} {
// KVStore fetches a KVStore from the MultiStore.
func (c Context) KVStore(key StoreKey) KVStore {
return c.multiStore().GetKVStore(key).Gas(c.GasMeter(), c.KVGasConfig())
return c.multiStore().GetKVStore(key).Gas(c.GasMeter(), cachedKVGasConfig)
}
// TransientStore fetches a TransientStore from the MultiStore.
func (c Context) TransientStore(key StoreKey) KVStore {
return c.multiStore().GetKVStore(key).Gas(c.GasMeter(), c.TransientGasConfig())
return c.multiStore().GetKVStore(key).Gas(c.GasMeter(), cachedTransientGasConfig)
}
//----------------------------------------
@@ -142,8 +140,6 @@ const (
contextKeyVoteInfos
contextKeyGasMeter
contextKeyMinimumFees
contextKeyKVGasConfig
contextKeyTransientGasConfig
)
// NOTE: Do not expose MultiStore.
@@ -179,12 +175,6 @@ func (c Context) MinimumFees() Coins { return c.Value(contextKeyMinimumFees).(Co
func (c Context) WithMultiStore(ms MultiStore) Context { return c.withValue(contextKeyMultiStore, ms) }
func (c Context) KVGasConfig() GasConfig { return c.Value(contextKeyKVGasConfig).(GasConfig) }
func (c Context) TransientGasConfig() GasConfig {
return c.Value(contextKeyTransientGasConfig).(GasConfig)
}
func (c Context) WithBlockHeader(header abci.Header) Context {
var _ proto.Message = &header // for cloning.
return c.withValue(contextKeyBlockHeader, header)
@@ -222,14 +212,6 @@ func (c Context) WithMinimumFees(minFees Coins) Context {
return c.withValue(contextKeyMinimumFees, minFees)
}
func (c Context) WithKVGasConfig(config GasConfig) Context {
return c.withValue(contextKeyKVGasConfig, config)
}
func (c Context) WithTransientGasConfig(config GasConfig) Context {
return c.withValue(contextKeyTransientGasConfig, config)
}
// 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()) {