@@ -112,7 +112,7 @@ func (s *Suite) TestGetBlockHeaders(t *utesting.T) {
112
112
}
113
113
// write request
114
114
req := & GetBlockHeaders {
115
- GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
115
+ GetBlockHeadersRequest : & eth.GetBlockHeadersRequest {
116
116
Origin : eth.HashOrNumber {Hash : s .chain .blocks [1 ].Hash ()},
117
117
Amount : 2 ,
118
118
Skip : 1 ,
@@ -150,7 +150,7 @@ func (s *Suite) TestSimultaneousRequests(t *utesting.T) {
150
150
// create two requests
151
151
req1 := & GetBlockHeaders {
152
152
RequestId : uint64 (111 ),
153
- GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
153
+ GetBlockHeadersRequest : & eth.GetBlockHeadersRequest {
154
154
Origin : eth.HashOrNumber {
155
155
Hash : s .chain .blocks [1 ].Hash (),
156
156
},
@@ -161,7 +161,7 @@ func (s *Suite) TestSimultaneousRequests(t *utesting.T) {
161
161
}
162
162
req2 := & GetBlockHeaders {
163
163
RequestId : uint64 (222 ),
164
- GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
164
+ GetBlockHeadersRequest : & eth.GetBlockHeadersRequest {
165
165
Origin : eth.HashOrNumber {
166
166
Hash : s .chain .blocks [1 ].Hash (),
167
167
},
@@ -201,10 +201,10 @@ func (s *Suite) TestSimultaneousRequests(t *utesting.T) {
201
201
if err != nil {
202
202
t .Fatalf ("failed to get expected headers for request 2: %v" , err )
203
203
}
204
- if ! headersMatch (expected1 , headers1 .BlockHeadersPacket ) {
204
+ if ! headersMatch (expected1 , headers1 .BlockHeadersRequest ) {
205
205
t .Fatalf ("header mismatch: \n expected %v \n got %v" , expected1 , headers1 )
206
206
}
207
- if ! headersMatch (expected2 , headers2 .BlockHeadersPacket ) {
207
+ if ! headersMatch (expected2 , headers2 .BlockHeadersRequest ) {
208
208
t .Fatalf ("header mismatch: \n expected %v \n got %v" , expected2 , headers2 )
209
209
}
210
210
}
@@ -224,7 +224,7 @@ func (s *Suite) TestSameRequestID(t *utesting.T) {
224
224
reqID := uint64 (1234 )
225
225
request1 := & GetBlockHeaders {
226
226
RequestId : reqID ,
227
- GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
227
+ GetBlockHeadersRequest : & eth.GetBlockHeadersRequest {
228
228
Origin : eth.HashOrNumber {
229
229
Number : 1 ,
230
230
},
@@ -233,7 +233,7 @@ func (s *Suite) TestSameRequestID(t *utesting.T) {
233
233
}
234
234
request2 := & GetBlockHeaders {
235
235
RequestId : reqID ,
236
- GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
236
+ GetBlockHeadersRequest : & eth.GetBlockHeadersRequest {
237
237
Origin : eth.HashOrNumber {
238
238
Number : 33 ,
239
239
},
@@ -270,10 +270,10 @@ func (s *Suite) TestSameRequestID(t *utesting.T) {
270
270
if err != nil {
271
271
t .Fatalf ("failed to get expected block headers: %v" , err )
272
272
}
273
- if ! headersMatch (expected1 , headers1 .BlockHeadersPacket ) {
273
+ if ! headersMatch (expected1 , headers1 .BlockHeadersRequest ) {
274
274
t .Fatalf ("header mismatch: \n expected %v \n got %v" , expected1 , headers1 )
275
275
}
276
- if ! headersMatch (expected2 , headers2 .BlockHeadersPacket ) {
276
+ if ! headersMatch (expected2 , headers2 .BlockHeadersRequest ) {
277
277
t .Fatalf ("header mismatch: \n expected %v \n got %v" , expected2 , headers2 )
278
278
}
279
279
}
@@ -290,7 +290,7 @@ func (s *Suite) TestZeroRequestID(t *utesting.T) {
290
290
t .Fatalf ("peering failed: %v" , err )
291
291
}
292
292
req := & GetBlockHeaders {
293
- GetBlockHeadersPacket : & eth.GetBlockHeadersPacket {
293
+ GetBlockHeadersRequest : & eth.GetBlockHeadersRequest {
294
294
Origin : eth.HashOrNumber {Number : 0 },
295
295
Amount : 2 ,
296
296
},
@@ -322,7 +322,7 @@ func (s *Suite) TestGetBlockBodies(t *utesting.T) {
322
322
// create block bodies request
323
323
req := & GetBlockBodies {
324
324
RequestId : uint64 (55 ),
325
- GetBlockBodiesPacket : eth.GetBlockBodiesPacket {
325
+ GetBlockBodiesRequest : eth.GetBlockBodiesRequest {
326
326
s .chain .blocks [54 ].Hash (),
327
327
s .chain .blocks [75 ].Hash (),
328
328
},
@@ -336,11 +336,11 @@ func (s *Suite) TestGetBlockBodies(t *utesting.T) {
336
336
if ! ok {
337
337
t .Fatalf ("unexpected: %s" , pretty .Sdump (msg ))
338
338
}
339
- bodies := resp .BlockBodiesPacket
339
+ bodies := resp .BlockBodiesResponse
340
340
t .Logf ("received %d block bodies" , len (bodies ))
341
- if len (bodies ) != len (req .GetBlockBodiesPacket ) {
341
+ if len (bodies ) != len (req .GetBlockBodiesRequest ) {
342
342
t .Fatalf ("wrong bodies in response: expected %d bodies, " +
343
- "got %d" , len (req .GetBlockBodiesPacket ), len (bodies ))
343
+ "got %d" , len (req .GetBlockBodiesRequest ), len (bodies ))
344
344
}
345
345
}
346
346
@@ -481,16 +481,16 @@ func (s *Suite) TestLargeTxRequest(t *utesting.T) {
481
481
hashes = append (hashes , hash )
482
482
}
483
483
getTxReq := & GetPooledTransactions {
484
- RequestId : 1234 ,
485
- GetPooledTransactionsPacket : hashes ,
484
+ RequestId : 1234 ,
485
+ GetPooledTransactionsRequest : hashes ,
486
486
}
487
487
if err = conn .Write (getTxReq ); err != nil {
488
488
t .Fatalf ("could not write to conn: %v" , err )
489
489
}
490
490
// check that all received transactions match those that were sent to node
491
491
switch msg := conn .waitForResponse (s .chain , timeout , getTxReq .RequestId ).(type ) {
492
492
case * PooledTransactions :
493
- for _ , gotTx := range msg .PooledTransactionsPacket {
493
+ for _ , gotTx := range msg .PooledTransactionsResponse {
494
494
if _ , exists := hashMap [gotTx .Hash ()]; ! exists {
495
495
t .Fatalf ("unexpected tx received: %v" , gotTx .Hash ())
496
496
}
@@ -547,8 +547,8 @@ func (s *Suite) TestNewPooledTxs(t *utesting.T) {
547
547
msg := conn .readAndServe (s .chain , timeout )
548
548
switch msg := msg .(type ) {
549
549
case * GetPooledTransactions :
550
- if len (msg .GetPooledTransactionsPacket ) != len (hashes ) {
551
- t .Fatalf ("unexpected number of txs requested: wanted %d, got %d" , len (hashes ), len (msg .GetPooledTransactionsPacket ))
550
+ if len (msg .GetPooledTransactionsRequest ) != len (hashes ) {
551
+ t .Fatalf ("unexpected number of txs requested: wanted %d, got %d" , len (hashes ), len (msg .GetPooledTransactionsRequest ))
552
552
}
553
553
return
554
554
0 commit comments