Skip to content

Commit

Permalink
feat: turn off the reward mechanism (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytqaljn authored Jan 24, 2025
1 parent 742e7c7 commit 8152d4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions pallets/sminer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,29 +1299,29 @@ impl<T: Config> MinerControl<<T as frame_system::Config>::AccountId, BlockNumber
}

fn record_snap_shot(miner: &AccountOf<T>, miner_idle_space: u128, miner_service_space: u128) -> DispatchResult {
let now = frame_system::Pallet::<T>::block_number();
let era = T::Staking::current_era();
let power = Self::calculate_power(miner_idle_space, miner_service_space);
// let now = frame_system::Pallet::<T>::block_number();
// let era = T::Staking::current_era();
// let power = Self::calculate_power(miner_idle_space, miner_service_space);

<CompleteMinerSnapShot<T>>::mutate(miner, |miner_info_list| -> DispatchResult {
let snap_shot =
MinerCompleteInfo::<BlockNumberFor<T>> { era_index: era, issued: false, finsh_block: now, power };
// <CompleteMinerSnapShot<T>>::mutate(miner, |miner_info_list| -> DispatchResult {
// let snap_shot =
// MinerCompleteInfo::<BlockNumberFor<T>> { era_index: era, issued: false, finsh_block: now, power };

if miner_info_list.len() == RELEASE_NUMBER as usize {
return Ok(())
}
// if miner_info_list.len() == RELEASE_NUMBER as usize {
// return Ok(())
// }

<CompleteSnapShot<T>>::mutate(&era, |complete_info| -> DispatchResult {
complete_info.miner_count = complete_info.miner_count.checked_add(1).ok_or(Error::<T>::Overflow)?;
complete_info.total_power = complete_info.total_power.checked_add(power).ok_or(Error::<T>::Overflow)?;
// <CompleteSnapShot<T>>::mutate(&era, |complete_info| -> DispatchResult {
// complete_info.miner_count = complete_info.miner_count.checked_add(1).ok_or(Error::<T>::Overflow)?;
// complete_info.total_power = complete_info.total_power.checked_add(power).ok_or(Error::<T>::Overflow)?;

Ok(())
})?;
// Ok(())
// })?;

miner_info_list.try_push(snap_shot).map_err(|_| Error::<T>::Overflow)?;
// miner_info_list.try_push(snap_shot).map_err(|_| Error::<T>::Overflow)?;

Ok(())
})?;
// Ok(())
// })?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion standalone/chain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 126,
spec_version: 127,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit 8152d4c

Please sign in to comment.