mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
eth/protocols/eth: inline writeReceiptForHash into Derivable
This commit is contained in:
parent
b47dda08a9
commit
c3919a85c0
1 changed files with 3 additions and 9 deletions
|
|
@ -194,18 +194,12 @@ func (rl *ReceiptList) EncodeForStorage() (rlp.RawValue, error) {
|
||||||
// Derivable returns a DerivableList, which can be used to decode
|
// Derivable returns a DerivableList, which can be used to decode
|
||||||
func (rl *ReceiptList) Derivable() types.DerivableList {
|
func (rl *ReceiptList) Derivable() types.DerivableList {
|
||||||
var bloomBuf [6]byte
|
var bloomBuf [6]byte
|
||||||
write := writeReceiptForHash(&bloomBuf)
|
return newDerivableRawList(&rl.items, func(data []byte, outbuf *bytes.Buffer) {
|
||||||
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) {
|
|
||||||
var r Receipt
|
var r Receipt
|
||||||
if r.decode(data) == nil {
|
if r.decode(data) == nil {
|
||||||
r.encodeForHash(bloomBuf, outbuf)
|
r.encodeForHash(&bloomBuf, outbuf)
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// blockReceiptsToNetwork takes a slice of rlp-encoded receipts, and transactions,
|
// blockReceiptsToNetwork takes a slice of rlp-encoded receipts, and transactions,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue