fn try_handle_settle(info: &SettleInfo, now: u64) -> DispatchResult {
			if let Some(account) = WorkerBindings::<T>::get(&info.pubkey) {
				let mut miner_info = Self::miners(&account).ok_or(Error::<T>::MinerNotFound)?;
				debug_assert!(miner_info.state.can_settle(), "Miner cannot settle now");
				miner_info.v = info.v; // in bits
				miner_info.v_updated_at = now;
				miner_info.stats.on_reward(info.payout);
				Miners::<T>::insert(&account, &miner_info);
				// Handle treasury deposit
				let treasury_deposit = FixedPointConvert::from_bits(info.treasury);
				let imbalance = Self::withdraw_imbalance_from_subsidy_pool(treasury_deposit)?;
				T::OnTreasurySettled::on_unbalanced(imbalance);
				Self::deposit_event(Event::<T>::MinerSettled(account, info.v, info.payout));
			}
			Ok(())
		}
/// Tries to handle settlement of a miner.
///
/// We really don't want to crash the interrupt the message processing. So when there's an
/// error we return it, and let the caller to handle it gracefully.
Tries to handle settlement of a miner.
We really don't want to crash the interrupt the message processing. So when there's an
error we return it, and let the caller to handle it gracefully.
Tries to handle settlement of a miner . We really don ' t want to crash the interrupt the message processing . So when there ' s an error we return it and let the caller to handle it gracefully .
fn try_handle_settle(info: &SettleInfo, now: u64) -> DispatchResult {
			if let Some(account) = WorkerBindings::<T>::get(&info.pubkey) {
				let mut miner_info = Self::miners(&account).ok_or(Error::<T>::MinerNotFound)?;
				debug_assert!(miner_info.state.can_settle(), "Miner cannot settle now");
				miner_info.v = info.v; // in bits
				miner_info.v_updated_at = now;
				miner_info.stats.on_reward(info.payout);
				Miners::<T>::insert(&account, &miner_info);
				// Handle treasury deposit
				let treasury_deposit = FixedPointConvert::from_bits(info.treasury);
				let imbalance = Self::withdraw_imbalance_from_subsidy_pool(treasury_deposit)?;
				T::OnTreasurySettled::on_unbalanced(imbalance);
				Self::deposit_event(Event::<T>::MinerSettled(account, info.v, info.payout));
			}
			Ok(())
		}
fn try_handle_settle ( info : & SettleInfo , now : u64 ) -> DispatchResult { if let Some ( account ) = WorkerBindings :: < T > :: get ( & info . pubkey ) { let mut miner_info = Self :: miners ( & account ) . ok_or ( Error :: < T > :: MinerNotFound ) ? ; debug_assert ! ( miner_info state can_settle ( ) " " ) ; miner_info . v = info . v ; // in bits miner_info . v_updated_at = now ; miner_info . stats . on_reward ( info . payout ) ; Miners :: < T > :: insert ( & account , & miner_info ) ; // Handle treasury deposit let treasury_deposit = FixedPointConvert :: from_bits ( info . treasury ) ; let imbalance = Self :: withdraw_imbalance_from_subsidy_pool ( treasury_deposit ) ? ; T :: OnTreasurySettled :: on_unbalanced ( imbalance ) ; Self :: deposit_event ( Event :: < T > :: MinerSettled ( account , info . v , info . payout ) ) ; } Ok ( ( ) ) }
Tries to handle settlement of a miner.
Tries to handle settlement of a miner .
info
&SettleInfo
now
u64
info
&SettleInfo
now
u64