From f4101ff0d9dd1084e9064e44bcb95d52bb95a790 Mon Sep 17 00:00:00 2001 From: Karim TAAM Date: Fri, 5 May 2023 10:55:20 +0200 Subject: [PATCH] not save log bloom filter Signed-off-by: Karim TAAM --- .../besu/ethereum/core/TransactionReceipt.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/TransactionReceipt.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/TransactionReceipt.java index c9433019de3..d00a68fe0e6 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/TransactionReceipt.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/TransactionReceipt.java @@ -213,7 +213,9 @@ public void writeToForReceiptTrie( rlpOutput.writeLongScalar(status); } rlpOutput.writeLongScalar(cumulativeGasUsed); - rlpOutput.writeBytes(bloomFilter); + if (!isCompressed) { + rlpOutput.writeBytes(bloomFilter); + } rlpOutput.writeList(logs, (log, out) -> log.writeTo(out, isCompressed)); if (withRevertReason && revertReason.isPresent()) { rlpOutput.writeBytes(revertReason.get()); @@ -261,8 +263,16 @@ public static TransactionReceipt readFrom( final long cumulativeGas = input.readLongScalar(); // The logs below will populate the bloom filter upon construction. // TODO consider validating that the logs and bloom filter match. - final LogsBloomFilter bloomFilter = LogsBloomFilter.readFrom(input); + LogsBloomFilter bloomFilter = null; + if (!isCompressed) { + bloomFilter = LogsBloomFilter.readFrom(input); + } final List logs = input.readList(in -> Log.readFrom(in, isCompressed)); + + if (bloomFilter == null) { + bloomFilter = LogsBloomFilter.builder().insertLogs(logs).build(); + } + final Optional revertReason; if (input.isEndOfCurrentList()) { revertReason = Optional.empty();