fn import_justification(
		&self,
		hash: Block::Hash,
		number: NumberFor<Block>,
		justification: Justification,
		enacts_change: bool,
	) -> Result<(), ConsensusError> {
		let justification = GrandpaJustification::decode_and_verify(
			justification,
			self.authority_set.set_id(),
			&self.authority_set.current_authorities(),
		);

		let justification = match justification {
			Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()),
			Ok(justification) => justification,
		};

		let result = finalize_block(
			&*self.inner,
			&self.authority_set,
			&self.consensus_changes,
			None,
			hash,
			number,
			justification.into(),
		);

		match result {
			Err(CommandOrError::VoterCommand(command)) => {
				info!(target: "finality", "Imported justification for block #{} that triggers \
					command {}, signaling voter.", number, command);

				if let Err(e) = self.send_voter_commands.unbounded_send(command) {
					return Err(ConsensusErrorKind::ClientImport(e.to_string()).into());
				}
			},
			Err(CommandOrError::Error(e)) => {
				return Err(match e {
					Error::Grandpa(error) => ConsensusErrorKind::ClientImport(error.to_string()),
					Error::Network(error) => ConsensusErrorKind::ClientImport(error),
					Error::Blockchain(error) => ConsensusErrorKind::ClientImport(error),
					Error::Client(error) => ConsensusErrorKind::ClientImport(error.to_string()),
					Error::Safety(error) => ConsensusErrorKind::ClientImport(error),
					Error::Timer(error) => ConsensusErrorKind::ClientImport(error.to_string()),
				}.into());
			},
			Ok(_) => {
				assert!(!enacts_change, "returns Ok when no authority set change should be enacted; qed;");
			},
		}

		Ok(())
	}
/// Import a block justification and finalize the block.
///
/// If `enacts_change` is set to true, then finalizing this block *must*
/// enact an authority set change, the function will panic otherwise.
Import a block justification and finalize the block.
If `enacts_change` is set to true, then finalizing this block *must
enact an authority set change, the function will panic otherwise.
Import a block justification and finalize the block . If ` enacts_change ` is set to true then finalizing this block * must enact an authority set change the function will panic otherwise .
fn import_justification(
		&self,
		hash: Block::Hash,
		number: NumberFor<Block>,
		justification: Justification,
		enacts_change: bool,
	) -> Result<(), ConsensusError> {
		let justification = GrandpaJustification::decode_and_verify(
			justification,
			self.authority_set.set_id(),
			&self.authority_set.current_authorities(),
		);
		let justification = match justification {
			Err(e) => return Err(ConsensusErrorKind::ClientImport(e.to_string()).into()),
			Ok(justification) => justification,
		};
		let result = finalize_block(
			&*self.inner,
			&self.authority_set,
			&self.consensus_changes,
			None,
			hash,
			number,
			justification.into(),
		);
		match result {
			Err(CommandOrError::VoterCommand(command)) => {
				info!(target: "finality", "Imported justification for block #{} that triggers \
					command {}, signaling voter.", number, command);
				if let Err(e) = self.send_voter_commands.unbounded_send(command) {
					return Err(ConsensusErrorKind::ClientImport(e.to_string()).into());
				}
			},
			Err(CommandOrError::Error(e)) => {
				return Err(match e {
					Error::Grandpa(error) => ConsensusErrorKind::ClientImport(error.to_string()),
					Error::Network(error) => ConsensusErrorKind::ClientImport(error),
					Error::Blockchain(error) => ConsensusErrorKind::ClientImport(error),
					Error::Client(error) => ConsensusErrorKind::ClientImport(error.to_string()),
					Error::Safety(error) => ConsensusErrorKind::ClientImport(error),
					Error::Timer(error) => ConsensusErrorKind::ClientImport(error.to_string()),
				}.into());
			},
			Ok(_) => {
				assert!(!enacts_change, "returns Ok when no authority set change should be enacted; qed;");
			},
		}
		Ok(())
	}
fn import_justification ( & self , hash : Block :: Hash , number : NumberFor < Block > , justification : Justification , enacts_change : bool , ) -> Result < ( ) , ConsensusError > { let justification = GrandpaJustification :: decode_and_verify ( justification , self . authority_set . set_id ( ) , & self . authority_set . current_authorities ( ) , ) ; let justification = match justification { Err ( e ) => return Err ( ConsensusErrorKind :: ClientImport ( e . to_string ( ) ) . into ( ) ) , Ok ( justification ) => justification , } ; let result = finalize_block ( & * self . inner , & self . authority_set , & self . consensus_changes , None , hash , number , justification . into ( ) , ) ; match result { Err ( CommandOrError :: VoterCommand ( command ) ) => { info ! ( target " " " \
 " number command ) ; if let Err ( e ) = self . send_voter_commands . unbounded_send ( command ) { return Err ( ConsensusErrorKind :: ClientImport ( e . to_string ( ) ) . into ( ) ) ; } } , Err ( CommandOrError :: Error ( e ) ) => { return Err ( match e { Error :: Grandpa ( error ) => ConsensusErrorKind :: ClientImport ( error . to_string ( ) ) , Error :: Network ( error ) => ConsensusErrorKind :: ClientImport ( error ) , Error :: Blockchain ( error ) => ConsensusErrorKind :: ClientImport ( error ) , Error :: Client ( error ) => ConsensusErrorKind :: ClientImport ( error . to_string ( ) ) , Error :: Safety ( error ) => ConsensusErrorKind :: ClientImport ( error ) , Error :: Timer ( error ) => ConsensusErrorKind :: ClientImport ( error . to_string ( ) ) , } . into ( ) ) ; } , Ok ( _ ) => { assert ! ( enacts_change " " ) ; } , } Ok ( ( ) ) }
Import a block justification and finalize the block.
Import a block justification and finalize the block .
&self
hash
Block::Hash
number
NumberFor<Block>
justification
Justification
enacts_change
bool
&self
hash
Block::Hash
number
NumberFor<Block>
justification
Justification
enacts_change
bool