Skip to content

Commit 4a96bb8

Browse files
committed
ethereum: Remove option around block calls
1 parent 495ba45 commit 4a96bb8

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

chain/ethereum/src/block_stream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ where
494494
let block_with_calls = if !self.include_calls_in_blocks {
495495
Box::new(future::ok(EthereumBlockWithCalls {
496496
ethereum_block: head_ancestor,
497-
calls: None,
497+
calls: vec![],
498498
}))
499499
as Box<dyn Future<Item = _, Error = _> + Send>
500500
} else {
@@ -508,7 +508,7 @@ where
508508
)
509509
.map(move |calls| EthereumBlockWithCalls {
510510
ethereum_block: head_ancestor,
511-
calls: Some(calls),
511+
calls,
512512
}),
513513
)
514514
};

graph/src/components/ethereum/adapter.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -788,13 +788,12 @@ fn parse_call_triggers(
788788
call_filter: EthereumCallFilter,
789789
block: &EthereumBlockWithCalls,
790790
) -> Vec<EthereumTrigger> {
791-
block.calls.as_ref().map_or(vec![], |calls| {
792-
calls
793-
.iter()
794-
.filter(move |call| call_filter.matches(call))
795-
.map(move |call| EthereumTrigger::Call(call.clone()))
796-
.collect()
797-
})
791+
block
792+
.calls
793+
.iter()
794+
.filter(move |call| call_filter.matches(call))
795+
.map(move |call| EthereumTrigger::Call(call.clone()))
796+
.collect()
798797
}
799798

800799
fn parse_block_triggers(
@@ -804,15 +803,14 @@ fn parse_block_triggers(
804803
let block_ptr = EthereumBlockPointer::from(&block.ethereum_block);
805804
let trigger_every_block = block_filter.trigger_every_block;
806805
let call_filter = EthereumCallFilter::from(block_filter);
807-
let mut triggers = block.calls.as_ref().map_or(vec![], |calls| {
808-
calls
809-
.iter()
810-
.filter(move |call| call_filter.matches(call))
811-
.map(move |call| {
812-
EthereumTrigger::Block(block_ptr, EthereumBlockTriggerType::WithCallTo(call.to))
813-
})
814-
.collect::<Vec<EthereumTrigger>>()
815-
});
806+
let mut triggers = block
807+
.calls
808+
.iter()
809+
.filter(move |call| call_filter.matches(call))
810+
.map(move |call| {
811+
EthereumTrigger::Block(block_ptr, EthereumBlockTriggerType::WithCallTo(call.to))
812+
})
813+
.collect::<Vec<EthereumTrigger>>();
816814
if trigger_every_block {
817815
triggers.push(EthereumTrigger::Block(
818816
block_ptr,

graph/src/components/ethereum/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl EthereumBlockWithTriggers {
105105
#[derive(Clone, Debug)]
106106
pub struct EthereumBlockWithCalls {
107107
pub ethereum_block: EthereumBlock,
108-
pub calls: Option<Vec<EthereumCall>>,
108+
pub calls: Vec<EthereumCall>,
109109
}
110110

111111
#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]

0 commit comments

Comments
 (0)