workspace: add/fix 1.83 lints (#353)

* 1.83 `cargo clippy --fix`

* fix type complexity, add `DbResult`

* clippy fix

* redb fix

* Update consensus/context/src/difficulty.rs

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

---------

Co-authored-by: Boog900 <boog900@tutanota.com>
This commit is contained in:
hinto-janai
2024-11-28 14:53:59 -05:00
committed by GitHub
parent 01150ab84c
commit 38541dbfda
56 changed files with 269 additions and 316 deletions

View File

@@ -328,8 +328,8 @@ fn next_difficulty(
time_span = 1;
}
// TODO: do checked operations here and unwrap so we don't silently overflow?
(windowed_work * u128::from(hf.block_time().as_secs()) + time_span - 1) / time_span
// TODO: do `checked_mul` here and unwrap so we don't silently overflow?
(windowed_work * u128::from(hf.block_time().as_secs())).div_ceil(time_span)
}
/// Get the start and end of the window to calculate difficulty.

View File

@@ -9,7 +9,7 @@ use clap::Parser;
use tower::{Service, ServiceExt};
use cuprate_blockchain::{
config::ConfigBuilder, cuprate_database::RuntimeError, service::BlockchainReadHandle,
config::ConfigBuilder, cuprate_database::DbResult, service::BlockchainReadHandle,
};
use cuprate_types::{
blockchain::{BlockchainReadRequest, BlockchainResponse},
@@ -23,7 +23,7 @@ const BATCH_SIZE: usize = 512;
async fn read_batch(
handle: &mut BlockchainReadHandle,
height_from: usize,
) -> Result<Vec<BlockId>, RuntimeError> {
) -> DbResult<Vec<BlockId>> {
let mut block_ids = Vec::<BlockId>::with_capacity(BATCH_SIZE);
for height in height_from..(height_from + BATCH_SIZE) {