/// Initiates adding a new service instance to the blockchain. The created service is not active
/// (i.e., does not process transactions or the `after_transactions` hook)
/// until the block built on top of the provided `fork` is committed.
///
/// This method should be called for the exact context passed to the runtime.
Initiates adding a new service instance to the blockchain. The created service is not active

until the block built on top of the provided `fork` is committed.

This method should be called for the exact context passed to the runtime.
Initiates adding a new service instance to the blockchain . The created service is not active until the block built on top of the provided ` fork ` is committed . This method should be called for the exact context passed to the runtime .
pub(crate) fn initiate_adding_service(
        &mut self,
        spec: InstanceSpec,
        constructor: impl BinaryValue,
    ) -> Result<(), ExecutionError> {
        // TODO: revise dispatcher integrity checks [ECR-3743]
        debug_assert!(spec.validate().is_ok(), "{:?}", spec.validate());
        let runtime = self
            .dispatcher
            .runtime_by_id(spec.artifact.runtime_id)
            .ok_or(CoreError::IncorrectRuntime)?;
        let context = self.reborrow(spec.as_descriptor());
        runtime
            .initiate_adding_service(context, &spec.artifact, constructor.into_bytes())
            .map_err(|mut err| {
                self.should_rollback();
                err.set_runtime_id(spec.artifact.runtime_id)
                    .set_call_site(|| CallSite::new(spec.id, CallType::Constructor));
                err
            })?;
        // Add a service instance to the dispatcher schema.
        DispatcherSchema::new(&*self.fork)
            .initiate_adding_service(spec)
            .map_err(From::from)
    }
pub ( crate ) fn initiate_adding_service ( & mut self , spec : InstanceSpec , constructor : impl BinaryValue , ) -> Result < ( ) , ExecutionError > { // TODO: revise dispatcher integrity checks [ECR-3743] debug_assert ! ( spec validate ( ) is_ok ( ) " " spec validate ( ) ) ; let runtime = self . dispatcher . runtime_by_id ( spec . artifact . runtime_id ) . ok_or ( CoreError :: IncorrectRuntime ) ? ; let context = self . reborrow ( spec . as_descriptor ( ) ) ; runtime . initiate_adding_service ( context , & spec . artifact , constructor . into_bytes ( ) ) . map_err ( | mut err | { self . should_rollback ( ) ; err . set_runtime_id ( spec . artifact . runtime_id ) . set_call_site ( | | CallSite :: new ( spec . id , CallType :: Constructor ) ) ; err } ) ? ; // Add a service instance to the dispatcher schema. DispatcherSchema :: new ( & * self . fork ) . initiate_adding_service ( spec ) . map_err ( From :: from ) }
Initiates adding a new service instance to the blockchain.
Initiates adding a new service instance to the blockchain .
&mut self
spec
InstanceSpec
constructor
impl BinaryValue