mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-13 10:21:37 +00:00
fix: add logic for the buffer clean up
This commit is contained in:
parent
22ab6697ac
commit
786f876959
1 changed files with 6 additions and 3 deletions
|
|
@ -413,6 +413,8 @@ func (p *Peer) BufferReceiptsPacket(packet *ReceiptsPacket70, backend Backend) e
|
|||
}
|
||||
|
||||
if len(packet.List) == 0 {
|
||||
delete(p.receiptBuffer, requestId)
|
||||
delete(p.requestedReceipts, requestId)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -444,13 +446,14 @@ func (p *Peer) BufferReceiptsPacket(packet *ReceiptsPacket70, backend Backend) e
|
|||
return nil
|
||||
}
|
||||
|
||||
// If the request is completed, append previously collected receipts
|
||||
// to the packet and remove the buffered receipts.
|
||||
// Request completed
|
||||
if buffer, ok := p.receiptBuffer[requestId]; ok {
|
||||
// If the request is completed, append previously collected receipts
|
||||
// to the packet and remove the buffered receipts.
|
||||
packet.List = append(buffer.list, packet.List...)
|
||||
delete(p.receiptBuffer, requestId)
|
||||
delete(p.requestedReceipts, requestId)
|
||||
}
|
||||
delete(p.requestedReceipts, requestId)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue