Skip to content

Commit 16236e0

Browse files
committed
Move bloom optimization to only RPC return
1 parent ca0e7d8 commit 16236e0

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

core/headerchain.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ func (hc *HeaderChain) GetBloom(hash common.Hash) (*types.Bloom, error) {
266266
return nil, ErrBloomNotFound
267267
}
268268

269-
if bloom.CheckAllZeros() {
270-
return nil, nil
271-
}
272-
273269
return &bloom, nil
274270
}
275271

internal/quaiapi/api.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,10 +1301,15 @@ func (s *PublicBlockChainAPI) GetTransactionReceipt(ctx context.Context, hash co
13011301
"cumulativeGasUsed": hexutil.Uint64(receipt.CumulativeGasUsed),
13021302
"contractAddress": nil,
13031303
"logs": receipt.Logs,
1304-
"logsBloom": receipt.Bloom.ToLegacyBloom(),
13051304
"type": hexutil.Uint(tx.Type()),
13061305
}
13071306

1307+
if receipt.Bloom.CheckAllZeros() {
1308+
fields["logsBloom"] = nil
1309+
} else {
1310+
fields["logsBloom"] = receipt.Bloom.ToLegacyBloom()
1311+
}
1312+
13081313
if tx.Type() == types.QuaiTxType {
13091314
if to := tx.To(); to != nil {
13101315
fields["to"] = to.Hex()

internal/quaiapi/quai_api.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,10 +1457,15 @@ func (s *PublicBlockChainQuaiAPI) GetTransactionReceipt(ctx context.Context, has
14571457
"cumulativeGasUsed": hexutil.Uint64(receipt.CumulativeGasUsed),
14581458
"contractAddress": nil,
14591459
"logs": receipt.Logs,
1460-
"logsBloom": receipt.Bloom,
14611460
"type": hexutil.Uint(tx.Type()),
14621461
}
14631462

1463+
if receipt.Bloom.CheckAllZeros() {
1464+
fields["logsBloom"] = nil
1465+
} else {
1466+
fields["logsBloom"] = receipt.Bloom
1467+
}
1468+
14641469
if tx.Type() == types.QuaiTxType {
14651470
if to := tx.To(); to != nil {
14661471
fields["to"] = to.Hex()

0 commit comments

Comments
 (0)