-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathmempool.go
312 lines (245 loc) · 7.03 KB
/
mempool.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
abcitypes "github.com/tendermint/tendermint/abci/types"
mempool "github.com/tendermint/tendermint/internal/mempool"
mock "github.com/stretchr/testify/mock"
types "github.com/tendermint/tendermint/types"
)
// Mempool is an autogenerated mock type for the Mempool type
type Mempool struct {
mock.Mock
}
// CheckTx provides a mock function with given fields: ctx, tx, callback, txInfo
func (_m *Mempool) CheckTx(ctx context.Context, tx types.Tx, callback func(*abcitypes.ResponseCheckTx), txInfo mempool.TxInfo) error {
ret := _m.Called(ctx, tx, callback, txInfo)
if len(ret) == 0 {
panic("no return value specified for CheckTx")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, types.Tx, func(*abcitypes.ResponseCheckTx), mempool.TxInfo) error); ok {
r0 = rf(ctx, tx, callback, txInfo)
} else {
r0 = ret.Error(0)
}
return r0
}
// EnableTxsAvailable provides a mock function with no fields
func (_m *Mempool) EnableTxsAvailable() {
_m.Called()
}
// Flush provides a mock function with no fields
func (_m *Mempool) Flush() {
_m.Called()
}
// FlushAppConn provides a mock function with given fields: _a0
func (_m *Mempool) FlushAppConn(_a0 context.Context) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for FlushAppConn")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GetTxsForKeys provides a mock function with given fields: txKeys
func (_m *Mempool) GetTxsForKeys(txKeys []types.TxKey) types.Txs {
ret := _m.Called(txKeys)
if len(ret) == 0 {
panic("no return value specified for GetTxsForKeys")
}
var r0 types.Txs
if rf, ok := ret.Get(0).(func([]types.TxKey) types.Txs); ok {
r0 = rf(txKeys)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.Txs)
}
}
return r0
}
// HasTx provides a mock function with given fields: txKey
func (_m *Mempool) HasTx(txKey types.TxKey) bool {
ret := _m.Called(txKey)
if len(ret) == 0 {
panic("no return value specified for HasTx")
}
var r0 bool
if rf, ok := ret.Get(0).(func(types.TxKey) bool); ok {
r0 = rf(txKey)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Lock provides a mock function with no fields
func (_m *Mempool) Lock() {
_m.Called()
}
// ReapMaxBytesMaxGas provides a mock function with given fields: maxBytes, maxGas, maxGasEstimated, minTxsInBlock
func (_m *Mempool) ReapMaxBytesMaxGas(maxBytes int64, maxGas int64, maxGasEstimated int64, minTxsInBlock int64) types.Txs {
ret := _m.Called(maxBytes, maxGas, maxGasEstimated, minTxsInBlock)
if len(ret) == 0 {
panic("no return value specified for ReapMaxBytesMaxGas")
}
var r0 types.Txs
if rf, ok := ret.Get(0).(func(int64, int64, int64, int64) types.Txs); ok {
r0 = rf(maxBytes, maxGas, maxGasEstimated, minTxsInBlock)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.Txs)
}
}
return r0
}
// ReapMaxTxs provides a mock function with given fields: max
func (_m *Mempool) ReapMaxTxs(max int) types.Txs {
ret := _m.Called(max)
if len(ret) == 0 {
panic("no return value specified for ReapMaxTxs")
}
var r0 types.Txs
if rf, ok := ret.Get(0).(func(int) types.Txs); ok {
r0 = rf(max)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.Txs)
}
}
return r0
}
// RemoveTxByKey provides a mock function with given fields: txKey
func (_m *Mempool) RemoveTxByKey(txKey types.TxKey) error {
ret := _m.Called(txKey)
if len(ret) == 0 {
panic("no return value specified for RemoveTxByKey")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.TxKey) error); ok {
r0 = rf(txKey)
} else {
r0 = ret.Error(0)
}
return r0
}
// SafeGetTxsForKeys provides a mock function with given fields: txKeys
func (_m *Mempool) SafeGetTxsForKeys(txKeys []types.TxKey) (types.Txs, []types.TxKey) {
ret := _m.Called(txKeys)
if len(ret) == 0 {
panic("no return value specified for SafeGetTxsForKeys")
}
var r0 types.Txs
var r1 []types.TxKey
if rf, ok := ret.Get(0).(func([]types.TxKey) (types.Txs, []types.TxKey)); ok {
return rf(txKeys)
}
if rf, ok := ret.Get(0).(func([]types.TxKey) types.Txs); ok {
r0 = rf(txKeys)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.Txs)
}
}
if rf, ok := ret.Get(1).(func([]types.TxKey) []types.TxKey); ok {
r1 = rf(txKeys)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).([]types.TxKey)
}
}
return r0, r1
}
// Size provides a mock function with no fields
func (_m *Mempool) Size() int {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Size")
}
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// SizeBytes provides a mock function with no fields
func (_m *Mempool) SizeBytes() int64 {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SizeBytes")
}
var r0 int64
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
return r0
}
// TxStore provides a mock function with no fields
func (_m *Mempool) TxStore() *mempool.TxStore {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for TxStore")
}
var r0 *mempool.TxStore
if rf, ok := ret.Get(0).(func() *mempool.TxStore); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*mempool.TxStore)
}
}
return r0
}
// TxsAvailable provides a mock function with no fields
func (_m *Mempool) TxsAvailable() <-chan struct{} {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for TxsAvailable")
}
var r0 <-chan struct{}
if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan struct{})
}
}
return r0
}
// Unlock provides a mock function with no fields
func (_m *Mempool) Unlock() {
_m.Called()
}
// Update provides a mock function with given fields: ctx, blockHeight, blockTxs, txResults, newPreFn, newPostFn, recheck
func (_m *Mempool) Update(ctx context.Context, blockHeight int64, blockTxs types.Txs, txResults []*abcitypes.ExecTxResult, newPreFn mempool.PreCheckFunc, newPostFn mempool.PostCheckFunc, recheck bool) error {
ret := _m.Called(ctx, blockHeight, blockTxs, txResults, newPreFn, newPostFn, recheck)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, types.Txs, []*abcitypes.ExecTxResult, mempool.PreCheckFunc, mempool.PostCheckFunc, bool) error); ok {
r0 = rf(ctx, blockHeight, blockTxs, txResults, newPreFn, newPostFn, recheck)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewMempool creates a new instance of Mempool. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMempool(t interface {
mock.TestingT
Cleanup(func())
}) *Mempool {
mock := &Mempool{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}