Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
viquezclaudio committed Jun 13, 2024
1 parent bf6bab5 commit a7bc0e2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
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

0 comments on commit a7bc0e2

Please sign in to comment.