From 786f876959b4b0f95894e9fc419c99baf9970258 Mon Sep 17 00:00:00 2001 From: healthykim Date: Wed, 26 Nov 2025 16:37:06 +0900 Subject: [PATCH] fix: add logic for the buffer clean up --- eth/protocols/eth/peer.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 723ac8488d..755c1d8290 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -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 }