@@ -20,10 +20,12 @@ import (
20
20
"github.com/ava-labs/avalanchego/vms/avm/block/executor"
21
21
"github.com/ava-labs/avalanchego/vms/avm/fxs"
22
22
"github.com/ava-labs/avalanchego/vms/avm/txs"
23
- "github.com/ava-labs/avalanchego/vms/avm/txs/mempool"
24
23
"github.com/ava-labs/avalanchego/vms/nftfx"
25
24
"github.com/ava-labs/avalanchego/vms/propertyfx"
26
25
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
26
+ "github.com/ava-labs/avalanchego/vms/txs/mempool"
27
+
28
+ xmempool "github.com/ava-labs/avalanchego/vms/avm/txs/mempool"
27
29
)
28
30
29
31
var (
52
54
func TestNetworkIssueTxFromRPC (t * testing.T ) {
53
55
type test struct {
54
56
name string
55
- mempoolFunc func (* gomock.Controller ) mempool .Mempool
57
+ mempoolFunc func (* gomock.Controller ) xmempool .Mempool
56
58
txVerifierFunc func (* gomock.Controller ) TxVerifier
57
59
appSenderFunc func (* gomock.Controller ) common.AppSender
58
60
expectedErr error
@@ -61,17 +63,17 @@ func TestNetworkIssueTxFromRPC(t *testing.T) {
61
63
tests := []test {
62
64
{
63
65
name : "mempool has transaction" ,
64
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
65
- mempool := mempool .NewMockMempool (ctrl )
66
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
67
+ mempool := xmempool .NewMockMempool (ctrl )
66
68
mempool .EXPECT ().Get (gomock .Any ()).Return (nil , true )
67
69
return mempool
68
70
},
69
71
expectedErr : mempool .ErrDuplicateTx ,
70
72
},
71
73
{
72
74
name : "transaction marked as dropped in mempool" ,
73
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
74
- mempool := mempool .NewMockMempool (ctrl )
75
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
76
+ mempool := xmempool .NewMockMempool (ctrl )
75
77
mempool .EXPECT ().Get (gomock .Any ()).Return (nil , false )
76
78
mempool .EXPECT ().GetDropReason (gomock .Any ()).Return (errTest )
77
79
return mempool
@@ -80,8 +82,8 @@ func TestNetworkIssueTxFromRPC(t *testing.T) {
80
82
},
81
83
{
82
84
name : "transaction invalid" ,
83
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
84
- mempool := mempool .NewMockMempool (ctrl )
85
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
86
+ mempool := xmempool .NewMockMempool (ctrl )
85
87
mempool .EXPECT ().Get (gomock .Any ()).Return (nil , false )
86
88
mempool .EXPECT ().GetDropReason (gomock .Any ()).Return (nil )
87
89
mempool .EXPECT ().MarkDropped (gomock .Any (), gomock .Any ())
@@ -96,8 +98,8 @@ func TestNetworkIssueTxFromRPC(t *testing.T) {
96
98
},
97
99
{
98
100
name : "can't add transaction to mempool" ,
99
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
100
- mempool := mempool .NewMockMempool (ctrl )
101
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
102
+ mempool := xmempool .NewMockMempool (ctrl )
101
103
mempool .EXPECT ().Get (gomock .Any ()).Return (nil , false )
102
104
mempool .EXPECT ().GetDropReason (gomock .Any ()).Return (nil )
103
105
mempool .EXPECT ().Add (gomock .Any ()).Return (errTest )
@@ -113,8 +115,8 @@ func TestNetworkIssueTxFromRPC(t *testing.T) {
113
115
},
114
116
{
115
117
name : "happy path" ,
116
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
117
- mempool := mempool .NewMockMempool (ctrl )
118
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
119
+ mempool := xmempool .NewMockMempool (ctrl )
118
120
mempool .EXPECT ().Get (gomock .Any ()).Return (nil , false )
119
121
mempool .EXPECT ().GetDropReason (gomock .Any ()).Return (nil )
120
122
mempool .EXPECT ().Add (gomock .Any ()).Return (nil )
@@ -151,8 +153,8 @@ func TestNetworkIssueTxFromRPC(t *testing.T) {
151
153
)
152
154
require .NoError (err )
153
155
154
- mempoolFunc := func (ctrl * gomock.Controller ) mempool .Mempool {
155
- return mempool .NewMockMempool (ctrl )
156
+ mempoolFunc := func (ctrl * gomock.Controller ) xmempool .Mempool {
157
+ return xmempool .NewMockMempool (ctrl )
156
158
}
157
159
if tt .mempoolFunc != nil {
158
160
mempoolFunc = tt .mempoolFunc
@@ -203,16 +205,16 @@ func TestNetworkIssueTxFromRPC(t *testing.T) {
203
205
func TestNetworkIssueTxFromRPCWithoutVerification (t * testing.T ) {
204
206
type test struct {
205
207
name string
206
- mempoolFunc func (* gomock.Controller ) mempool .Mempool
208
+ mempoolFunc func (* gomock.Controller ) xmempool .Mempool
207
209
appSenderFunc func (* gomock.Controller ) common.AppSender
208
210
expectedErr error
209
211
}
210
212
211
213
tests := []test {
212
214
{
213
215
name : "can't add transaction to mempool" ,
214
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
215
- mempool := mempool .NewMockMempool (ctrl )
216
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
217
+ mempool := xmempool .NewMockMempool (ctrl )
216
218
mempool .EXPECT ().Add (gomock .Any ()).Return (errTest )
217
219
mempool .EXPECT ().MarkDropped (gomock .Any (), gomock .Any ())
218
220
return mempool
@@ -221,8 +223,8 @@ func TestNetworkIssueTxFromRPCWithoutVerification(t *testing.T) {
221
223
},
222
224
{
223
225
name : "happy path" ,
224
- mempoolFunc : func (ctrl * gomock.Controller ) mempool .Mempool {
225
- mempool := mempool .NewMockMempool (ctrl )
226
+ mempoolFunc : func (ctrl * gomock.Controller ) xmempool .Mempool {
227
+ mempool := xmempool .NewMockMempool (ctrl )
226
228
mempool .EXPECT ().Get (gomock .Any ()).Return (nil , true ).Times (2 )
227
229
mempool .EXPECT ().Add (gomock .Any ()).Return (nil )
228
230
mempool .EXPECT ().Len ().Return (0 )
@@ -252,8 +254,8 @@ func TestNetworkIssueTxFromRPCWithoutVerification(t *testing.T) {
252
254
)
253
255
require .NoError (err )
254
256
255
- mempoolFunc := func (ctrl * gomock.Controller ) mempool .Mempool {
256
- return mempool .NewMockMempool (ctrl )
257
+ mempoolFunc := func (ctrl * gomock.Controller ) xmempool .Mempool {
258
+ return xmempool .NewMockMempool (ctrl )
257
259
}
258
260
if tt .mempoolFunc != nil {
259
261
mempoolFunc = tt .mempoolFunc
0 commit comments