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

rpcdaemon: erigon_getLatestLogs fix retrieving latest block #1996

Merged
merged 1 commit into from
May 2, 2024
Merged
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
12 changes: 6 additions & 6 deletions silkworm/rpc/core/logs_walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ Task<std::pair<uint64_t, uint64_t>> LogsWalker::get_block_numbers(const Filter&
start = end = block_number;
}
} else {
uint64_t last_executed_block_number = std::numeric_limits<uint64_t>::max();
uint64_t last_block_number = std::numeric_limits<uint64_t>::max();
if (filter.from_block.has_value()) {
start = co_await core::get_block_number(filter.from_block.value(), tx_database_);
} else {
last_executed_block_number = co_await core::get_latest_executed_block_number(tx_database_);
start = last_executed_block_number;
last_block_number = co_await core::get_latest_block_number(tx_database_);
start = last_block_number;
}
if (filter.to_block.has_value()) {
end = co_await core::get_block_number(filter.to_block.value(), tx_database_);
} else {
if (last_executed_block_number == std::numeric_limits<uint64_t>::max()) {
last_executed_block_number = co_await core::get_latest_executed_block_number(tx_database_);
if (last_block_number == std::numeric_limits<uint64_t>::max()) {
last_block_number = co_await core::get_latest_block_number(tx_database_);
}
end = last_executed_block_number;
end = last_block_number;
}
}
co_return std::make_pair(start, end);
Expand Down
Loading