mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-18 21:01:38 +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 {
|
if len(packet.List) == 0 {
|
||||||
|
delete(p.receiptBuffer, requestId)
|
||||||
|
delete(p.requestedReceipts, requestId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -444,13 +446,14 @@ func (p *Peer) BufferReceiptsPacket(packet *ReceiptsPacket70, backend Backend) e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the request is completed, append previously collected receipts
|
// Request completed
|
||||||
// to the packet and remove the buffered receipts.
|
|
||||||
if buffer, ok := p.receiptBuffer[requestId]; ok {
|
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...)
|
packet.List = append(buffer.list, packet.List...)
|
||||||
delete(p.receiptBuffer, requestId)
|
delete(p.receiptBuffer, requestId)
|
||||||
delete(p.requestedReceipts, requestId)
|
|
||||||
}
|
}
|
||||||
|
delete(p.requestedReceipts, requestId)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue