@@ -254,17 +254,17 @@ func testGetBlockHeaders(t *testing.T, protocol uint) {
254254 headers = append (headers , backend .chain .GetBlockByHash (hash ).Header ())
255255 }
256256 // 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 {
259259 t .Errorf ("test %d: headers mismatch: %v" , i , err )
260260 }
261261 // If the test used number origins, repeat with hashes as the too
262262 if tt .query .Origin .Hash == (common.Hash {}) {
263263 if origin := backend .chain .GetBlockByNumber (tt .query .Origin .Number ); origin != nil {
264264 tt .query .Origin .Hash , tt .query .Origin .Number = origin .Hash (), 0
265265
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 {
268268 t .Errorf ("test %d: headers mismatch: %v" , i , err )
269269 }
270270 }
@@ -343,8 +343,8 @@ func testGetBlockBodies(t *testing.T, protocol uint) {
343343 }
344344 }
345345 // 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 {
348348 t .Errorf ("test %d: bodies mismatch: %v" , i , err )
349349 }
350350 }
@@ -410,13 +410,13 @@ func testGetNodeData(t *testing.T, protocol uint) {
410410 }
411411 it .Release ()
412412
413- p2p .Send (peer .app , 0x0d , hashes )
413+ p2p .Send (peer .app , GetNodeDataMsg , hashes )
414414 msg , err := peer .app .ReadMsg ()
415415 if err != nil {
416416 t .Fatalf ("failed to read node data response: %v" , err )
417417 }
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 )
420420 }
421421 var data [][]byte
422422 if err := msg .Decode (& data ); err != nil {
@@ -512,8 +512,8 @@ func testGetBlockReceipts(t *testing.T, protocol uint) {
512512 receipts = append (receipts , backend .chain .GetReceiptsByHash (block .Hash ()))
513513 }
514514 // 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 {
517517 t .Errorf ("receipts mismatch: %v" , err )
518518 }
519519}
0 commit comments