mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-13 10:21:37 +00:00
fix: fix test error
This commit is contained in:
parent
c961983210
commit
32de571acd
2 changed files with 5 additions and 29 deletions
|
|
@ -395,7 +395,6 @@ func (p *Peer) requestPartialReceipts(id uint64) error {
|
|||
GetReceiptsRequest: p.receiptBuffer[id].request[lastBlock:],
|
||||
FirstBlockReceiptIndex: uint64(lastReceipt),
|
||||
},
|
||||
continued: true,
|
||||
}
|
||||
|
||||
return p.dispatchRequest(req)
|
||||
|
|
@ -480,7 +479,9 @@ func (p *Peer) validateLastBlockReceipt(receiptLists []*ReceiptList69, id uint64
|
|||
// should be dropped, don't clear the buffer
|
||||
return 0, fmt.Errorf("total number of tx exceeded limit")
|
||||
}
|
||||
|
||||
for _, rc := range lastReceipts.items {
|
||||
log += uint64(len(rc.Logs))
|
||||
}
|
||||
// Verify that the overall downloaded receipt size does not exceed the block gas limit.
|
||||
if previousLog+log > header.GasUsed/params.LogDataGas {
|
||||
return 0, fmt.Errorf("total download receipt size exceeded the limit")
|
||||
|
|
|
|||
|
|
@ -366,32 +366,7 @@ func TestPartialReceiptFailure(t *testing.T) {
|
|||
t.Fatal("Response with the excessive number of receipts should fail the validation")
|
||||
}
|
||||
|
||||
// Case 2 ) The size of each receipt exceeds maximum log size against the max tx size
|
||||
req, err = peer.RequestReceipts(hashes, sink)
|
||||
if err != nil {
|
||||
t.Fatalf("RequestReceipts failed: %v", err)
|
||||
}
|
||||
select {
|
||||
case _ = <-packetCh:
|
||||
case <-time.After(2 * time.Second):
|
||||
t.Fatalf("timeout waiting for request packet")
|
||||
}
|
||||
maxLogSize := params.MaxTxGas / params.LogDataGas
|
||||
delivery = &ReceiptsPacket70{
|
||||
RequestId: req.id,
|
||||
LastBlockIncomplete: true,
|
||||
List: []*ReceiptList69{{
|
||||
items: []Receipt{
|
||||
{Logs: rlp.RawValue(make([]byte, maxLogSize+1))},
|
||||
},
|
||||
}},
|
||||
}
|
||||
err = peer.bufferReceiptsPacket(delivery, backend)
|
||||
if err == nil {
|
||||
t.Fatal("Response with the excessive number of receipts should fail the validation")
|
||||
}
|
||||
|
||||
// Case 3 ) Total receipt size exceeds the block gas limit
|
||||
// Case 2 ) Total receipt size exceeds the block gas limit
|
||||
req, err = peer.RequestReceipts(hashes, sink)
|
||||
if err != nil {
|
||||
t.Fatalf("RequestReceipts failed: %v", err)
|
||||
|
|
@ -413,6 +388,6 @@ func TestPartialReceiptFailure(t *testing.T) {
|
|||
}
|
||||
err = peer.bufferReceiptsPacket(delivery, backend)
|
||||
if err == nil {
|
||||
t.Fatal("Response with the excessive number of receipts should fail the validation")
|
||||
t.Fatal("Response with the large log size should fail the validation")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue