eth/protocols/eth: inline writeReceiptForHash into Derivable

This commit is contained in:
Felix Lange 2026-02-28 00:54:45 +01:00
parent b47dda08a9
commit c3919a85c0

View file

@ -194,18 +194,12 @@ func (rl *ReceiptList) EncodeForStorage() (rlp.RawValue, error) {
// Derivable returns a DerivableList, which can be used to decode
func (rl *ReceiptList) Derivable() types.DerivableList {
var bloomBuf [6]byte
write := writeReceiptForHash(&bloomBuf)
return newDerivableRawList(&rl.items, write)
}
// writeReceiptForHash returns a write function that encodes receipts for hash derivation.
func writeReceiptForHash(bloomBuf *[6]byte) func([]byte, *bytes.Buffer) {
return func(data []byte, outbuf *bytes.Buffer) {
return newDerivableRawList(&rl.items, func(data []byte, outbuf *bytes.Buffer) {
var r Receipt
if r.decode(data) == nil {
r.encodeForHash(bloomBuf, outbuf)
r.encodeForHash(&bloomBuf, outbuf)
}
}
})
}
// blockReceiptsToNetwork takes a slice of rlp-encoded receipts, and transactions,