@@ -33,9 +33,11 @@ import (
3333
3434func TestIsFutureMessage (t * testing.T ) {
3535 c := & core {
36- state : StateAcceptRequest ,
37- sequence : big .NewInt (1 ),
38- round : big .NewInt (0 ),
36+ state : StateAcceptRequest ,
37+ current : newSnapshot (& pbft.View {
38+ Sequence : big .NewInt (1 ),
39+ Round : big .NewInt (0 ),
40+ }, newTestValidatorSet (4 )),
3941 }
4042
4143 // invalid view format
@@ -147,7 +149,7 @@ func TestStoreBacklog(t *testing.T) {
147149 p := validator .New (common .StringToAddress ("12345667890" ))
148150 // push preprepare msg
149151 preprepare := & pbft.Preprepare {
150- View : v ,
152+ View : v ,
151153 Proposal : makeBlock (1 ),
152154 }
153155 prepreparePayload , _ := Encode (preprepare )
@@ -192,14 +194,15 @@ func TestProcessFutureBacklog(t *testing.T) {
192194 events : new (event.TypeMux ),
193195 }
194196 c := & core {
195- logger : log .New ("backend" , "test" , "id" , 0 ),
196- backlogs : make (map [pbft.Validator ]* prque.Prque ),
197- backlogsMu : new (sync.Mutex ),
198- backend : backend ,
199- sequence : big .NewInt (1 ),
200- round : big .NewInt (0 ),
201- state : StateAcceptRequest ,
202- internalMux : new (event.TypeMux ),
197+ logger : log .New ("backend" , "test" , "id" , 0 ),
198+ backlogs : make (map [pbft.Validator ]* prque.Prque ),
199+ backlogsMu : new (sync.Mutex ),
200+ backend : backend ,
201+ current : newSnapshot (& pbft.View {
202+ Sequence : big .NewInt (1 ),
203+ Round : big .NewInt (0 ),
204+ }, newTestValidatorSet (4 )),
205+ state : StateAcceptRequest ,
203206 }
204207 c .subscribeEvents ()
205208 defer c .unsubscribeEvents ()
@@ -225,7 +228,7 @@ func TestProcessFutureBacklog(t *testing.T) {
225228 const timeoutDura = 2 * time .Second
226229 timeout := time .NewTimer (timeoutDura )
227230 select {
228- case <- c .internalEvents .Chan ():
231+ case <- c .events .Chan ():
229232 t .Errorf ("Should not receive any events" )
230233
231234 case <- timeout .C :
@@ -239,7 +242,7 @@ func TestProcessBacklog(t *testing.T) {
239242 Sequence : big .NewInt (1 ),
240243 }
241244 preprepare := & pbft.Preprepare {
242- View : v ,
245+ View : v ,
243246 Proposal : makeBlock (1 ),
244247 }
245248 prepreparePayload , _ := Encode (preprepare )
@@ -276,14 +279,15 @@ func testProcessBacklog(t *testing.T, msg *message) {
276279 peers : vset ,
277280 }
278281 c := & core {
279- logger : log .New ("backend" , "test" , "id" , 0 ),
280- backlogs : make (map [pbft.Validator ]* prque.Prque ),
281- backlogsMu : new (sync.Mutex ),
282- backend : backend ,
283- internalMux : new (event.TypeMux ),
284- state : State (msg .Code ),
285- sequence : big .NewInt (1 ),
286- round : big .NewInt (0 ),
282+ logger : log .New ("backend" , "test" , "id" , 0 ),
283+ backlogs : make (map [pbft.Validator ]* prque.Prque ),
284+ backlogsMu : new (sync.Mutex ),
285+ backend : backend ,
286+ state : State (msg .Code ),
287+ current : newSnapshot (& pbft.View {
288+ Sequence : big .NewInt (1 ),
289+ Round : big .NewInt (0 ),
290+ }, newTestValidatorSet (4 )),
287291 subject : & pbft.Subject {
288292 View : & pbft.View {
289293 Sequence : big .NewInt (1 ),
@@ -300,7 +304,7 @@ func testProcessBacklog(t *testing.T, msg *message) {
300304 const timeoutDura = 2 * time .Second
301305 timeout := time .NewTimer (timeoutDura )
302306 select {
303- case ev := <- c .internalEvents .Chan ():
307+ case ev := <- c .events .Chan ():
304308 e , ok := ev .Data .(backlogEvent )
305309 if ! ok {
306310 t .Fatalf ("Unexpected event comes" )
0 commit comments