fix order of fields in GetReceipts/Receipts msg

This commit is contained in:
healthykim 2026-01-20 20:47:50 +09:00
parent cd9483648e
commit afcbce9647
4 changed files with 13 additions and 13 deletions

View file

@ -462,8 +462,8 @@ func (s *Suite) TestGetReceipts(t *utesting.T) {
// Create block bodies request.
req := &eth.GetReceiptsPacket70{
RequestId: 66,
GetReceiptsRequest: (eth.GetReceiptsRequest)(hashes),
FirstBlockReceiptIndex: 0,
GetReceiptsRequest: (eth.GetReceiptsRequest)(hashes),
}
if err := conn.Write(ethProto, eth.GetReceiptsMsg, req); err != nil {
t.Fatalf("could not write to connection: %v", err)
@ -519,8 +519,8 @@ func (s *Suite) TestGetLargeReceipts(t *utesting.T) {
// Create get receipt request.
req := &eth.GetReceiptsPacket70{
RequestId: 66,
GetReceiptsRequest: blocks[lastBlock:],
FirstBlockReceiptIndex: uint64(receipts[lastBlock].Len()),
GetReceiptsRequest: blocks[lastBlock:],
}
if err := conn.Write(ethProto, eth.GetReceiptsMsg, req); err != nil {
t.Fatalf("could not write to connection: %v", err)

View file

@ -615,13 +615,13 @@ func testGetBlockPartialReceipts(t *testing.T, protocol int) {
p2p.Send(peer.app, GetReceiptsMsg, &GetReceiptsPacket70{
RequestId: 123,
GetReceiptsRequest: hashes,
FirstBlockReceiptIndex: 0,
GetReceiptsRequest: hashes,
})
if err := p2p.ExpectMsg(peer.app, ReceiptsMsg, &ReceiptsPacket70{
RequestId: 123,
List: partialReceipt,
LastBlockIncomplete: true,
List: partialReceipt,
}); err != nil {
t.Errorf("receipts mismatch: %v", err)
}
@ -631,14 +631,14 @@ func testGetBlockPartialReceipts(t *testing.T, protocol int) {
p2p.Send(peer.app, GetReceiptsMsg, &GetReceiptsPacket70{
RequestId: 123,
GetReceiptsRequest: []common.Hash{hashes[blockCutoff]},
FirstBlockReceiptIndex: uint64(receiptCutoff),
GetReceiptsRequest: []common.Hash{hashes[blockCutoff]},
})
if err := p2p.ExpectMsg(peer.app, ReceiptsMsg, &ReceiptsPacket70{
RequestId: 123,
List: partialReceipt,
LastBlockIncomplete: false,
List: partialReceipt,
}); err != nil {
t.Errorf("receipts mismatch: %v", err)
}

View file

@ -356,8 +356,8 @@ func (p *Peer) RequestReceipts(hashes []common.Hash, sink chan *Response) (*Requ
want: ReceiptsMsg,
data: &GetReceiptsPacket70{
RequestId: id,
GetReceiptsRequest: hashes,
FirstBlockReceiptIndex: 0,
GetReceiptsRequest: hashes,
},
}
p.receiptBufferLock.Lock()
@ -401,8 +401,8 @@ func (p *Peer) requestPartialReceipts(id uint64) error {
want: ReceiptsMsg,
data: &GetReceiptsPacket70{
RequestId: id,
GetReceiptsRequest: p.receiptBuffer[id].request[lastBlock:],
FirstBlockReceiptIndex: uint64(lastReceipt),
GetReceiptsRequest: p.receiptBuffer[id].request[lastBlock:],
},
}
return p.dispatchRequest(req)

View file

@ -268,9 +268,9 @@ type GetReceiptsPacket69 struct {
// GetReceiptsPacket70 represents a block receipts query with request ID and
// FirstBlockReceiptIndex wrapping.
type GetReceiptsPacket70 struct {
RequestId uint64
GetReceiptsRequest
RequestId uint64
FirstBlockReceiptIndex uint64
GetReceiptsRequest
}
// ReceiptsResponse is the network packet for block receipts distribution.
@ -293,8 +293,8 @@ type ReceiptsPacket[L ReceiptsList] struct {
type ReceiptsPacket70 struct {
RequestId uint64
List []*ReceiptList69
LastBlockIncomplete bool
List []*ReceiptList69
}
// ReceiptsRLPResponse is used for receipts, when we already have it encoded
@ -309,9 +309,9 @@ type ReceiptsRLPPacket69 struct {
// ReceiptsRLPPacket70 is ReceiptsRLPResponse with request ID and
// LastBlockIncomplete wrapping.
type ReceiptsRLPPacket70 struct {
RequestId uint64
ReceiptsRLPResponse
RequestId uint64
LastBlockIncomplete bool
ReceiptsRLPResponse
}
// NewPooledTransactionHashesPacket represents a transaction announcement packet on eth/68 and newer.