Skip to content

Commit e44fff7

Browse files
committed
refactor: update filtering of logs
1 parent 7ea29fa commit e44fff7

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

scripts/tests/api_compare/filter-list

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@
1414
# TODO: https://github.com/ChainSafe/forest/issues/4701
1515
!Filecoin.EthGetTransactionByBlockHashAndIndex
1616
!Filecoin.EthGetTransactionByBlockNumberAndIndex
17-
# TODO: https://github.com/ChainSafe/forest/issues/5006
18-
!Filecoin.EthGetBlockReceipts

scripts/tests/api_compare/filter-list-offline

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,3 @@
4444
# TODO: https://github.com/ChainSafe/forest/issues/4701
4545
!Filecoin.EthGetTransactionByBlockHashAndIndex
4646
!Filecoin.EthGetTransactionByBlockNumberAndIndex
47-
# TODO: https://github.com/ChainSafe/forest/issues/5006
48-
!Filecoin.EthGetBlockReceipts

src/rpc/methods/eth.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,17 @@ async fn new_eth_tx_receipt<DB: Blockstore + Send + Sync + 'static>(
11541154

11551155
let mut events = vec![];
11561156
EthEventHandler::collect_events(ctx, &parent_ts, None, &mut events).await?;
1157+
1158+
let current_block_hash = receipt.block_hash.clone();
1159+
events.retain(|event| {
1160+
if let Ok(block_hash) = event.tipset_key.cid() {
1161+
let event_block_hash: EthHash = block_hash.into();
1162+
event_block_hash == current_block_hash
1163+
} else {
1164+
false
1165+
}
1166+
});
1167+
11571168
receipt.logs = eth_filter_logs_from_events(ctx, &events)?;
11581169

11591170
Ok(receipt)

0 commit comments

Comments
 (0)