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

Fix some clippy warnings #2613

Merged
merged 1 commit into from
Jun 14, 2024
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
13 changes: 2 additions & 11 deletions blockchain/src/history/history_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,17 +1272,8 @@ impl HistoryInterface for HistoryStore {

let mut cursor = txn.cursor(&self.last_leaf_table);

let first = if let Some((key, _)) = cursor.first::<u32, u32>() {
key
} else {
0
};

let last = if let Some((key, _)) = cursor.last::<u32, u32>() {
key
} else {
0
};
let first = cursor.first::<u32, u32>().unwrap_or_default().0;
let last = cursor.last::<u32, u32>().unwrap_or_default().0;

(first, last)
}
Expand Down
12 changes: 2 additions & 10 deletions blockchain/src/history/validity_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,15 @@ impl ValidityStore {
// Initialize the cursor for the database.
let mut cursor = db_tx.cursor(&self.block_txns);

if let Some((key, _)) = cursor.first::<u32, Blake2bHash>() {
key
} else {
0
}
cursor.first::<u32, Blake2bHash>().unwrap_or_default().0
}

/// Obtains the last block number stored in the validity store.
pub(crate) fn last_bn(&self, db_tx: &TransactionProxy) -> u32 {
// Initialize the cursor for the database.
let mut cursor = db_tx.cursor(&self.block_txns);

if let Some((key, _)) = cursor.last::<u32, Blake2bHash>() {
key
} else {
0
}
cursor.last::<u32, Blake2bHash>().unwrap_or_default().0
}

/// Adds a transaction hash to the validity store
Expand Down
2 changes: 0 additions & 2 deletions consensus/src/sync/light/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ pub struct ValidityChunkRequest {
pub root_hash: Blake2bHash,
/// The chunk index that was requested.
pub chunk_index: u32,
/// Validity start block number that we are syncing with this peer
pub validity_start: u32,
/// Flag to indicate if there is an election block within the validity window
pub election_in_window: bool,
/// Number of items in the previous requested chunk (for cases where we adopt a new macro head)
Expand Down
1 change: 0 additions & 1 deletion consensus/src/sync/light/validity_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ impl<TNetwork: Network> LightMacroSync<TNetwork> {
verifier_block_number,
root_hash,
chunk_index,
validity_start: validity_window_start,
election_in_window,
last_chunk_items,
});
Expand Down
Loading