mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-24 23:35:18 +00:00
Fix quality overflow (#75)
This commit is contained in:
parent
0852b2355c
commit
c0f9d5cc31
@ -102,8 +102,15 @@ impl<'a> Miner<'a> {
|
|||||||
|
|
||||||
let quality = self.pora(idx, &sealed_data, pad_seed);
|
let quality = self.pora(idx, &sealed_data, pad_seed);
|
||||||
let quality_scale = self.range.shard_mask.count_zeros();
|
let quality_scale = self.range.shard_mask.count_zeros();
|
||||||
if quality << quality_scale <= *self.target_quality {
|
if quality <= U256::MAX >> quality_scale
|
||||||
debug!("Find a PoRA valid answer, quality: {}", quality);
|
&& quality << quality_scale <= *self.target_quality
|
||||||
|
{
|
||||||
|
debug!(
|
||||||
|
"Find a PoRA valid answer, quality: {}, target_quality {}, scale {}",
|
||||||
|
U256::MAX / quality,
|
||||||
|
U256::MAX / self.target_quality,
|
||||||
|
quality_scale
|
||||||
|
);
|
||||||
// Undo mix data when find a valid solition
|
// Undo mix data when find a valid solition
|
||||||
for (x, y) in sealed_data.iter_mut().zip(scratch_pad.iter()) {
|
for (x, y) in sealed_data.iter_mut().zip(scratch_pad.iter()) {
|
||||||
*x ^= y;
|
*x ^= y;
|
||||||
|
Loading…
Reference in New Issue
Block a user