pub(crate) fn add_unit(
        &mut self,
        swunit: SignedWireUnit<TestContext>,
    ) -> Result<(), AddUnitError<TestContext>> {
        if let Err(err) = self
            .pre_validate_unit(&swunit)
            .and_then(|()| self.validate_unit(&swunit))
        {
            return Err(swunit.with_error(err));
        }
        assert_eq!(None, swunit.wire_unit().panorama.missing_dependency(self));
        assert_eq!(None, self.needs_endorsements(&swunit));
        self.add_valid_unit(swunit);
        Ok(())
    }
/// Adds the unit to the protocol state, or returns an error if it is invalid.
/// Panics if dependencies are not satisfied.
Adds the unit to the protocol state, or returns an error if it is invalid.
Panics if dependencies are not satisfied.
Adds the unit to the protocol state or returns an error if it is invalid . Panics if dependencies are not satisfied .
pub(crate) fn add_unit(
        &mut self,
        swunit: SignedWireUnit<TestContext>,
    ) -> Result<(), AddUnitError<TestContext>> {
        if let Err(err) = self
            .pre_validate_unit(&swunit)
            .and_then(|()| self.validate_unit(&swunit))
        {
            return Err(swunit.with_error(err));
        }
        assert_eq!(None, swunit.wire_unit().panorama.missing_dependency(self));
        assert_eq!(None, self.needs_endorsements(&swunit));
        self.add_valid_unit(swunit);
        Ok(())
    }
pub ( crate ) fn add_unit ( & mut self , swunit : SignedWireUnit < TestContext > , ) -> Result < ( ) , AddUnitError < TestContext > > { if let Err ( err ) = self . pre_validate_unit ( & swunit ) . and_then ( | ( ) | self . validate_unit ( & swunit ) ) { return Err ( swunit . with_error ( err ) ) ; } assert_eq ! ( None swunit wire_unit ( ) panorama missing_dependency ( self ) ) ; assert_eq ! ( None self needs_endorsements ( swunit ) ) ; self . add_valid_unit ( swunit ) ; Ok ( ( ) ) }
Adds the unit to the protocol state, or returns an error if it is invalid.
Adds the unit to the protocol state or returns an error if it is invalid .
&mut self
swunit
SignedWireUnit<TestContext>
&mut self
swunit
SignedWireUnit<TestContext>