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

Consensus: fix history sync while processing received BatchSetInfo #3231

Merged
merged 1 commit into from
Jan 10, 2025
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: 9 additions & 3 deletions consensus/src/sync/history/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,15 @@ impl<TNetwork: Network + 'static> SyncCluster<TNetwork> {
let current_epoch_number = blockchain.epoch_number();
let num_known_txs = if epoch_number == current_epoch_number {
let last_macro_block = Policy::last_macro_block(current_block_number);
blockchain
.history_store
.num_epoch_transactions_before(last_macro_block, None) as u64
// Check if the last_macro_block crosses an epoch boundary. This could happen if locally the node is in the first batch of an epoch.
// In this case, the number of known transactions must be 0 to avoid fetching the number of epoch transactions from the previous epoch.
if Policy::is_election_block_at(last_macro_block) {
0
} else {
blockchain
.history_store
.num_epoch_transactions_before(last_macro_block, None) as u64
}
} else {
0
};
Expand Down
Loading