fn process_one(account_id: AccountIdFor<T>) -> bool {
		let schedule = Self::current_schedule();

		let (message, code) = match ActorInfoOf::<T>::mutate(&account_id, |actor| {
			actor.code_hash.clone().and_then(|code_hash| {
				actor.messages.pop().map(|message| {
					(message,
					 exec::load_code::<T>(
						 &code_hash,
						 &schedule
					 ).expect("Code is deployed"))
				})
			})
		}) {
			Some(val) => val,
			None => return false,
		};

		let (imbalance, less) = T::Currency::slash_reserved(&message.source, message.value);
		if less > Zero::zero() {
			panic!("Runtime error: reserved fund is less than expected");
		}
		T::Currency::resolve_creating(&account_id, imbalance);

		let mut context = exec::Context::<T>::new(&schedule, account_id, message.clone());
		match exec::execute(
			&code,
			"process",
			message.encode(),
			&mut context,
			&schedule,
			T::ProcessGasLimit::get()
		) {
			Ok(()) => (),
			Err(()) => return false, // TODO: maybe also distinguish no message and execution failed.
		}

		context.apply();
		true
	}
/// Process one message from the target account, returns true if a message is processed, false
/// otherwise.
Process one message from the target account, returns true if a message is processed, false
otherwise.
Process one message from the target account returns true if a message is processed false otherwise .
fn process_one(account_id: AccountIdFor<T>) -> bool {
		let schedule = Self::current_schedule();
		let (message, code) = match ActorInfoOf::<T>::mutate(&account_id, |actor| {
			actor.code_hash.clone().and_then(|code_hash| {
				actor.messages.pop().map(|message| {
					(message,
					 exec::load_code::<T>(
						 &code_hash,
						 &schedule
					 ).expect("Code is deployed"))
				})
			})
		}) {
			Some(val) => val,
			None => return false,
		};
		let (imbalance, less) = T::Currency::slash_reserved(&message.source, message.value);
		if less > Zero::zero() {
			panic!("Runtime error: reserved fund is less than expected");
		}
		T::Currency::resolve_creating(&account_id, imbalance);
		let mut context = exec::Context::<T>::new(&schedule, account_id, message.clone());
		match exec::execute(
			&code,
			"process",
			message.encode(),
			&mut context,
			&schedule,
			T::ProcessGasLimit::get()
		) {
			Ok(()) => (),
			Err(()) => return false, // TODO: maybe also distinguish no message and execution failed.
		}
		context.apply();
		true
	}
fn process_one ( account_id : AccountIdFor < T > ) -> bool { let schedule = Self :: current_schedule ( ) ; let ( message , code ) = match ActorInfoOf :: < T > :: mutate ( & account_id , | actor | { actor . code_hash . clone ( ) . and_then ( | code_hash | { actor . messages . pop ( ) . map ( | message | { ( message , exec :: load_code :: < T > ( & code_hash , & schedule ) . expect ( " " ) ) } ) } ) } ) { Some ( val ) => val , None => return false , } ; let ( imbalance , less ) = T :: Currency :: slash_reserved ( & message . source , message . value ) ; if less > Zero :: zero ( ) { panic ! ( " " ) ; } T :: Currency :: resolve_creating ( & account_id , imbalance ) ; let mut context = exec :: Context :: < T > :: new ( & schedule , account_id , message . clone ( ) ) ; match exec :: execute ( & code , " " , message . encode ( ) , & mut context , & schedule , T :: ProcessGasLimit :: get ( ) ) { Ok ( ( ) ) => ( ) , Err ( ( ) ) => return false , // TODO: maybe also distinguish no message and execution failed. } context . apply ( ) ; true }
Process one message from the target account, returns true if a message is processed, false
otherwise.
Process one message from the target account returns true if a message is processed false otherwise .
account_id
AccountIdFor<T>
account_id
AccountIdFor<T>