mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-18 12:51:39 +00:00
fix order of fields in GetReceipts/Receipts msg
This commit is contained in:
parent
cd9483648e
commit
afcbce9647
4 changed files with 13 additions and 13 deletions
|
|
@ -462,8 +462,8 @@ func (s *Suite) TestGetReceipts(t *utesting.T) {
|
||||||
// Create block bodies request.
|
// Create block bodies request.
|
||||||
req := ð.GetReceiptsPacket70{
|
req := ð.GetReceiptsPacket70{
|
||||||
RequestId: 66,
|
RequestId: 66,
|
||||||
GetReceiptsRequest: (eth.GetReceiptsRequest)(hashes),
|
|
||||||
FirstBlockReceiptIndex: 0,
|
FirstBlockReceiptIndex: 0,
|
||||||
|
GetReceiptsRequest: (eth.GetReceiptsRequest)(hashes),
|
||||||
}
|
}
|
||||||
if err := conn.Write(ethProto, eth.GetReceiptsMsg, req); err != nil {
|
if err := conn.Write(ethProto, eth.GetReceiptsMsg, req); err != nil {
|
||||||
t.Fatalf("could not write to connection: %v", err)
|
t.Fatalf("could not write to connection: %v", err)
|
||||||
|
|
@ -519,8 +519,8 @@ func (s *Suite) TestGetLargeReceipts(t *utesting.T) {
|
||||||
// Create get receipt request.
|
// Create get receipt request.
|
||||||
req := ð.GetReceiptsPacket70{
|
req := ð.GetReceiptsPacket70{
|
||||||
RequestId: 66,
|
RequestId: 66,
|
||||||
GetReceiptsRequest: blocks[lastBlock:],
|
|
||||||
FirstBlockReceiptIndex: uint64(receipts[lastBlock].Len()),
|
FirstBlockReceiptIndex: uint64(receipts[lastBlock].Len()),
|
||||||
|
GetReceiptsRequest: blocks[lastBlock:],
|
||||||
}
|
}
|
||||||
if err := conn.Write(ethProto, eth.GetReceiptsMsg, req); err != nil {
|
if err := conn.Write(ethProto, eth.GetReceiptsMsg, req); err != nil {
|
||||||
t.Fatalf("could not write to connection: %v", err)
|
t.Fatalf("could not write to connection: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -615,13 +615,13 @@ func testGetBlockPartialReceipts(t *testing.T, protocol int) {
|
||||||
|
|
||||||
p2p.Send(peer.app, GetReceiptsMsg, &GetReceiptsPacket70{
|
p2p.Send(peer.app, GetReceiptsMsg, &GetReceiptsPacket70{
|
||||||
RequestId: 123,
|
RequestId: 123,
|
||||||
GetReceiptsRequest: hashes,
|
|
||||||
FirstBlockReceiptIndex: 0,
|
FirstBlockReceiptIndex: 0,
|
||||||
|
GetReceiptsRequest: hashes,
|
||||||
})
|
})
|
||||||
if err := p2p.ExpectMsg(peer.app, ReceiptsMsg, &ReceiptsPacket70{
|
if err := p2p.ExpectMsg(peer.app, ReceiptsMsg, &ReceiptsPacket70{
|
||||||
RequestId: 123,
|
RequestId: 123,
|
||||||
List: partialReceipt,
|
|
||||||
LastBlockIncomplete: true,
|
LastBlockIncomplete: true,
|
||||||
|
List: partialReceipt,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
t.Errorf("receipts mismatch: %v", err)
|
t.Errorf("receipts mismatch: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -631,14 +631,14 @@ func testGetBlockPartialReceipts(t *testing.T, protocol int) {
|
||||||
|
|
||||||
p2p.Send(peer.app, GetReceiptsMsg, &GetReceiptsPacket70{
|
p2p.Send(peer.app, GetReceiptsMsg, &GetReceiptsPacket70{
|
||||||
RequestId: 123,
|
RequestId: 123,
|
||||||
GetReceiptsRequest: []common.Hash{hashes[blockCutoff]},
|
|
||||||
FirstBlockReceiptIndex: uint64(receiptCutoff),
|
FirstBlockReceiptIndex: uint64(receiptCutoff),
|
||||||
|
GetReceiptsRequest: []common.Hash{hashes[blockCutoff]},
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := p2p.ExpectMsg(peer.app, ReceiptsMsg, &ReceiptsPacket70{
|
if err := p2p.ExpectMsg(peer.app, ReceiptsMsg, &ReceiptsPacket70{
|
||||||
RequestId: 123,
|
RequestId: 123,
|
||||||
List: partialReceipt,
|
|
||||||
LastBlockIncomplete: false,
|
LastBlockIncomplete: false,
|
||||||
|
List: partialReceipt,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
t.Errorf("receipts mismatch: %v", err)
|
t.Errorf("receipts mismatch: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -356,8 +356,8 @@ func (p *Peer) RequestReceipts(hashes []common.Hash, sink chan *Response) (*Requ
|
||||||
want: ReceiptsMsg,
|
want: ReceiptsMsg,
|
||||||
data: &GetReceiptsPacket70{
|
data: &GetReceiptsPacket70{
|
||||||
RequestId: id,
|
RequestId: id,
|
||||||
GetReceiptsRequest: hashes,
|
|
||||||
FirstBlockReceiptIndex: 0,
|
FirstBlockReceiptIndex: 0,
|
||||||
|
GetReceiptsRequest: hashes,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
p.receiptBufferLock.Lock()
|
p.receiptBufferLock.Lock()
|
||||||
|
|
@ -401,8 +401,8 @@ func (p *Peer) requestPartialReceipts(id uint64) error {
|
||||||
want: ReceiptsMsg,
|
want: ReceiptsMsg,
|
||||||
data: &GetReceiptsPacket70{
|
data: &GetReceiptsPacket70{
|
||||||
RequestId: id,
|
RequestId: id,
|
||||||
GetReceiptsRequest: p.receiptBuffer[id].request[lastBlock:],
|
|
||||||
FirstBlockReceiptIndex: uint64(lastReceipt),
|
FirstBlockReceiptIndex: uint64(lastReceipt),
|
||||||
|
GetReceiptsRequest: p.receiptBuffer[id].request[lastBlock:],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return p.dispatchRequest(req)
|
return p.dispatchRequest(req)
|
||||||
|
|
|
||||||
|
|
@ -268,9 +268,9 @@ type GetReceiptsPacket69 struct {
|
||||||
// GetReceiptsPacket70 represents a block receipts query with request ID and
|
// GetReceiptsPacket70 represents a block receipts query with request ID and
|
||||||
// FirstBlockReceiptIndex wrapping.
|
// FirstBlockReceiptIndex wrapping.
|
||||||
type GetReceiptsPacket70 struct {
|
type GetReceiptsPacket70 struct {
|
||||||
RequestId uint64
|
RequestId uint64
|
||||||
GetReceiptsRequest
|
|
||||||
FirstBlockReceiptIndex uint64
|
FirstBlockReceiptIndex uint64
|
||||||
|
GetReceiptsRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReceiptsResponse is the network packet for block receipts distribution.
|
// ReceiptsResponse is the network packet for block receipts distribution.
|
||||||
|
|
@ -293,8 +293,8 @@ type ReceiptsPacket[L ReceiptsList] struct {
|
||||||
|
|
||||||
type ReceiptsPacket70 struct {
|
type ReceiptsPacket70 struct {
|
||||||
RequestId uint64
|
RequestId uint64
|
||||||
List []*ReceiptList69
|
|
||||||
LastBlockIncomplete bool
|
LastBlockIncomplete bool
|
||||||
|
List []*ReceiptList69
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReceiptsRLPResponse is used for receipts, when we already have it encoded
|
// 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
|
// ReceiptsRLPPacket70 is ReceiptsRLPResponse with request ID and
|
||||||
// LastBlockIncomplete wrapping.
|
// LastBlockIncomplete wrapping.
|
||||||
type ReceiptsRLPPacket70 struct {
|
type ReceiptsRLPPacket70 struct {
|
||||||
RequestId uint64
|
RequestId uint64
|
||||||
ReceiptsRLPResponse
|
|
||||||
LastBlockIncomplete bool
|
LastBlockIncomplete bool
|
||||||
|
ReceiptsRLPResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPooledTransactionHashesPacket represents a transaction announcement packet on eth/68 and newer.
|
// NewPooledTransactionHashesPacket represents a transaction announcement packet on eth/68 and newer.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue