@@ -254,17 +254,17 @@ func testGetBlockHeaders(t *testing.T, protocol uint) {
254
254
headers = append (headers , backend .chain .GetBlockByHash (hash ).Header ())
255
255
}
256
256
// Send the hash request and verify the response
257
- p2p .Send (peer .app , 0x03 , tt .query )
258
- if err := p2p .ExpectMsg (peer .app , 0x04 , headers ); err != nil {
257
+ p2p .Send (peer .app , GetBlockHeadersMsg , tt .query )
258
+ if err := p2p .ExpectMsg (peer .app , BlockHeadersMsg , headers ); err != nil {
259
259
t .Errorf ("test %d: headers mismatch: %v" , i , err )
260
260
}
261
261
// If the test used number origins, repeat with hashes as the too
262
262
if tt .query .Origin .Hash == (common.Hash {}) {
263
263
if origin := backend .chain .GetBlockByNumber (tt .query .Origin .Number ); origin != nil {
264
264
tt .query .Origin .Hash , tt .query .Origin .Number = origin .Hash (), 0
265
265
266
- p2p .Send (peer .app , 0x03 , tt .query )
267
- if err := p2p .ExpectMsg (peer .app , 0x04 , headers ); err != nil {
266
+ p2p .Send (peer .app , GetBlockHeadersMsg , tt .query )
267
+ if err := p2p .ExpectMsg (peer .app , BlockHeadersMsg , headers ); err != nil {
268
268
t .Errorf ("test %d: headers mismatch: %v" , i , err )
269
269
}
270
270
}
@@ -343,8 +343,8 @@ func testGetBlockBodies(t *testing.T, protocol uint) {
343
343
}
344
344
}
345
345
// Send the hash request and verify the response
346
- p2p .Send (peer .app , 0x05 , hashes )
347
- if err := p2p .ExpectMsg (peer .app , 0x06 , bodies ); err != nil {
346
+ p2p .Send (peer .app , GetBlockBodiesMsg , hashes )
347
+ if err := p2p .ExpectMsg (peer .app , BlockBodiesMsg , bodies ); err != nil {
348
348
t .Errorf ("test %d: bodies mismatch: %v" , i , err )
349
349
}
350
350
}
@@ -410,13 +410,13 @@ func testGetNodeData(t *testing.T, protocol uint) {
410
410
}
411
411
it .Release ()
412
412
413
- p2p .Send (peer .app , 0x0d , hashes )
413
+ p2p .Send (peer .app , GetNodeDataMsg , hashes )
414
414
msg , err := peer .app .ReadMsg ()
415
415
if err != nil {
416
416
t .Fatalf ("failed to read node data response: %v" , err )
417
417
}
418
- if msg .Code != 0x0e {
419
- t .Fatalf ("response packet code mismatch: have %x, want %x" , msg .Code , 0x0c )
418
+ if msg .Code != NodeDataMsg {
419
+ t .Fatalf ("response packet code mismatch: have %x, want %x" , msg .Code , NodeDataMsg )
420
420
}
421
421
var data [][]byte
422
422
if err := msg .Decode (& data ); err != nil {
@@ -512,8 +512,8 @@ func testGetBlockReceipts(t *testing.T, protocol uint) {
512
512
receipts = append (receipts , backend .chain .GetReceiptsByHash (block .Hash ()))
513
513
}
514
514
// Send the hash request and verify the response
515
- p2p .Send (peer .app , 0x0f , hashes )
516
- if err := p2p .ExpectMsg (peer .app , 0x10 , receipts ); err != nil {
515
+ p2p .Send (peer .app , GetReceiptsMsg , hashes )
516
+ if err := p2p .ExpectMsg (peer .app , ReceiptsMsg , receipts ); err != nil {
517
517
t .Errorf ("receipts mismatch: %v" , err )
518
518
}
519
519
}
0 commit comments