mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-26 16:25:18 +00:00
Fix clippy.
This commit is contained in:
parent
0350ea7be5
commit
769b696915
@ -4,6 +4,7 @@ use ethereum_types::Address;
|
|||||||
use ethers::prelude::{Http, Provider};
|
use ethers::prelude::{Http, Provider};
|
||||||
use miner::MinerMessage;
|
use miner::MinerMessage;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -162,19 +163,19 @@ impl Pruner {
|
|||||||
&mut self,
|
&mut self,
|
||||||
new_first_rewardable: u64,
|
new_first_rewardable: u64,
|
||||||
) -> Result<Option<Box<dyn Send + Iterator<Item = u64>>>> {
|
) -> Result<Option<Box<dyn Send + Iterator<Item = u64>>>> {
|
||||||
if self.first_rewardable_chunk == new_first_rewardable {
|
match self.first_rewardable_chunk.cmp(&new_first_rewardable) {
|
||||||
Ok(None)
|
Ordering::Less => Ok(Some(Box::new(
|
||||||
} else if self.first_rewardable_chunk > new_first_rewardable {
|
|
||||||
bail!(
|
|
||||||
"Unexpected first_rewardable_chunk revert: old={} new={}",
|
|
||||||
self.first_rewardable_chunk,
|
|
||||||
new_first_rewardable
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
Ok(Some(Box::new(
|
|
||||||
self.first_rewardable_chunk * CHUNKS_PER_PRICING
|
self.first_rewardable_chunk * CHUNKS_PER_PRICING
|
||||||
..new_first_rewardable * CHUNKS_PER_PRICING,
|
..new_first_rewardable * CHUNKS_PER_PRICING,
|
||||||
)))
|
))),
|
||||||
|
Ordering::Equal => Ok(None),
|
||||||
|
Ordering::Greater => {
|
||||||
|
bail!(
|
||||||
|
"Unexpected first_rewardable_chunk revert: old={} new={}",
|
||||||
|
self.first_rewardable_chunk,
|
||||||
|
new_first_rewardable
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user