-
Notifications
You must be signed in to change notification settings - Fork 180
/
baseapp_mode_deliverInAsync.go
58 lines (50 loc) · 1.6 KB
/
baseapp_mode_deliverInAsync.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package baseapp
import (
sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
)
func (m *modeHandlerDeliverInAsync) handleDeferRefund(info *runTxInfo) {
app := m.app
if app.GasRefundHandler == nil {
return
}
if info.msCacheAnte == nil {
return
}
var gasRefundCtx sdk.Context
gasRefundCtx = info.runMsgCtx
if info.msCache == nil || !info.runMsgFinished { // case: panic when runMsg
info.msCache = app.parallelTxManage.chainMultiStores.GetStoreWithParent(info.msCacheAnte)
gasRefundCtx = info.ctx
gasRefundCtx.SetMultiStore(info.msCache)
}
gasRefundCtx.SetOutOfGas(info.outOfGas)
refundGas, err := app.GasRefundHandler(gasRefundCtx, info.tx)
if err != nil {
panic(err)
}
info.msCache.Write()
info.ctx.ParaMsg().RefundFee = refundGas
}
func (m *modeHandlerDeliverInAsync) handleDeferGasConsumed(info *runTxInfo) {
}
func (m *modeHandlerDeliverInAsync) handleRunMsg(info *runTxInfo) (err error) {
app := m.app
mode := m.mode
info.msCache = app.parallelTxManage.chainMultiStores.GetStoreWithParent(info.msCacheAnte)
info.runMsgCtx = info.ctx
info.runMsgCtx.SetMultiStore(info.msCache)
info.result, err = app.runMsgs(info.runMsgCtx, info.tx.GetMsgs(), mode)
info.runMsgFinished = true
if err == nil {
info.msCache.Write()
}
err = m.checkHigherThanMercury(err, info)
return
}
// ====================================================
// 2. handleGasConsumed
func (m *modeHandlerDeliverInAsync) handleGasConsumed(info *runTxInfo) (err error) {
m.app.parallelTxManage.blockGasMeterMu.Lock()
defer m.app.parallelTxManage.blockGasMeterMu.Unlock()
return m.modeHandlerBase.handleGasConsumed(info)
}