@@ -20,12 +20,8 @@ import (
20
20
"github.com/tendermint/tendermint/libs/log"
21
21
"github.com/tendermint/tendermint/libs/service"
22
22
cmtsync "github.com/tendermint/tendermint/libs/sync"
23
- mempl "github.com/tendermint/tendermint/mempool"
24
23
25
- cfg "github.com/tendermint/tendermint/config"
26
- mempoolv2 "github.com/tendermint/tendermint/mempool/cat"
27
- mempoolv0 "github.com/tendermint/tendermint/mempool/v0"
28
- mempoolv1 "github.com/tendermint/tendermint/mempool/v1"
24
+ "github.com/tendermint/tendermint/mempool/cat"
29
25
"github.com/tendermint/tendermint/p2p"
30
26
cmtcons "github.com/tendermint/tendermint/proto/tendermint/consensus"
31
27
cmtproto "github.com/tendermint/tendermint/proto/tendermint/types"
@@ -48,6 +44,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
48
44
49
45
genDoc , privVals := randGenesisDoc (nValidators , false , 30 )
50
46
css := make ([]* State , nValidators )
47
+ catReactors := make ([]* cat.Reactor , nValidators )
51
48
52
49
for i := 0 ; i < nValidators ; i ++ {
53
50
logger := consensusLogger ().With ("test" , "byzantine" , "validator" , i )
@@ -72,33 +69,21 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
72
69
proxyAppConnConMem := abcicli .NewLocalClient (mtx , app )
73
70
74
71
// Make Mempool
75
- var mempool mempl.Mempool
76
-
77
- switch thisConfig .Mempool .Version {
78
- case cfg .MempoolV0 :
79
- mempool = mempoolv0 .NewCListMempool (config .Mempool ,
80
- proxyAppConnConMem ,
81
- state .LastBlockHeight ,
82
- mempoolv0 .WithPreCheck (sm .TxPreCheck (state )),
83
- mempoolv0 .WithPostCheck (sm .TxPostCheck (state )))
84
- case cfg .MempoolV1 :
85
- mempool = mempoolv1 .NewTxMempool (logger ,
86
- config .Mempool ,
87
- proxyAppConnConMem ,
88
- state .LastBlockHeight ,
89
- mempoolv1 .WithPreCheck (sm .TxPreCheck (state )),
90
- mempoolv1 .WithPostCheck (sm .TxPostCheck (state )),
91
- )
92
- case cfg .MempoolV2 :
93
- mempool = mempoolv2 .NewTxPool (
94
- logger ,
95
- config .Mempool ,
96
- proxyAppConnConMem ,
97
- state .LastBlockHeight ,
98
- mempoolv2 .WithPreCheck (sm .TxPreCheck (state )),
99
- mempoolv2 .WithPostCheck (sm .TxPostCheck (state )),
100
- )
101
- }
72
+ mempool := cat .NewTxPool (
73
+ logger ,
74
+ config .Mempool ,
75
+ proxyAppConnConMem ,
76
+ state .LastBlockHeight ,
77
+ cat .WithPreCheck (sm .TxPreCheck (state )),
78
+ cat .WithPostCheck (sm .TxPostCheck (state )),
79
+ )
80
+ var err error
81
+ catReactors [i ], err = cat .NewReactor (mempool , & cat.ReactorOptions {
82
+ ListenOnly : ! config .Mempool .Broadcast ,
83
+ MaxTxSize : config .Mempool .MaxTxBytes ,
84
+ MaxGossipDelay : config .Mempool .MaxGossipDelay ,
85
+ })
86
+ require .NoError (t , err )
102
87
103
88
if thisConfig .Consensus .WaitForTxs () {
104
89
mempool .EnableTxsAvailable ()
@@ -112,7 +97,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
112
97
113
98
// Make State
114
99
blockExec := sm .NewBlockExecutor (stateStore , log .TestingLogger (), proxyAppConnCon , mempool , evpool )
115
- cs := NewState (thisConfig .Consensus , state , blockExec , blockStore , mempool , evpool )
100
+ cs := NewState (thisConfig .Consensus , state , blockExec , blockStore , mempool , catReactors [ i ], evpool )
116
101
cs .SetLogger (cs .Logger )
117
102
// set private validator
118
103
pv := privVals [i ]
@@ -154,6 +139,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
154
139
// make connected switches and start all reactors
155
140
p2p .MakeConnectedSwitches (config .P2P , nValidators , func (i int , s * p2p.Switch ) * p2p.Switch {
156
141
s .AddReactor ("CONSENSUS" , reactors [i ])
142
+ s .AddReactor ("MEMPOOL" , catReactors [i ])
157
143
s .SetLogger (reactors [i ].conS .Logger .With ("module" , "p2p" ))
158
144
return s
159
145
}, p2p .Connect2Switches )
@@ -230,9 +216,10 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
230
216
}
231
217
proposerAddr := lazyProposer .privValidatorPubKey .Address ()
232
218
233
- block , blockParts := lazyProposer .blockExec .CreateProposalBlock (
219
+ block := lazyProposer .blockExec .CreateProposalBlock (
234
220
lazyProposer .Height , lazyProposer .state , commit , proposerAddr ,
235
221
)
222
+ blockParts := block .MakePartSet (types .BlockPartSizeBytes )
236
223
237
224
// Flush the WAL. Otherwise, we may not recompute the same proposal to sign,
238
225
// and the privValidator will refuse to sign anything.
@@ -480,7 +467,8 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St
480
467
// Avoid sending on internalMsgQueue and running consensus state.
481
468
482
469
// Create a new proposal block from state/txs from the mempool.
483
- block1 , blockParts1 := cs .createProposalBlock ()
470
+ block1 := cs .createProposalBlock ()
471
+ blockParts1 := block1 .MakePartSet (types .BlockPartSizeBytes )
484
472
polRound := cs .TwoThirdPrevoteRound
485
473
propBlockID := types.BlockID {Hash : block1 .Hash (), PartSetHeader : blockParts1 .Header ()}
486
474
proposal1 := types .NewProposal (height , round , polRound , propBlockID )
@@ -495,7 +483,8 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St
495
483
deliverTxsRange (cs , 0 , 1 )
496
484
497
485
// Create a new proposal block from state/txs from the mempool.
498
- block2 , blockParts2 := cs .createProposalBlock ()
486
+ block2 := cs .createProposalBlock ()
487
+ blockParts2 := block2 .MakePartSet (types .BlockPartSizeBytes )
499
488
polRound = cs .TwoThirdPrevoteRound
500
489
propBlockID = types.BlockID {Hash : block2 .Hash (), PartSetHeader : blockParts2 .Header ()}
501
490
proposal2 := types .NewProposal (height , round , polRound , propBlockID )
0 commit comments