Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a data source to create another in the same block it was created #1185

Merged
merged 6 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions core/src/subgraph/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,21 @@ where
)
}

fn process_trigger_in_runtime_hosts<I>(
fn process_trigger_in_runtime_hosts(
logger: &Logger,
hosts: I,
hosts: impl Iterator<Item = Arc<T::Host>>,
block: Arc<EthereumBlock>,
trigger: EthereumTrigger,
state: BlockState,
) -> Box<dyn Future<Item = BlockState, Error = Error> + Send>
where
I: IntoIterator<Item = Arc<T::Host>>,
{
) -> Box<dyn Future<Item = BlockState, Error = Error> + Send> {
let logger = logger.to_owned();
match trigger {
EthereumTrigger::Log(log) => {
let transaction = block
.transaction_for_log(&log)
.map(Arc::new)
.ok_or_else(|| format_err!("Found no transaction for event"));
let matching_hosts: Vec<_> = hosts
.into_iter()
.filter(|host| host.matches_log(&log))
.collect();
let matching_hosts: Vec<_> = hosts.filter(|host| host.matches_log(&log)).collect();
let log = Arc::new(log);

// Process the log in each host in the same order the corresponding data
Expand Down
Loading