pub fn submit_at<T>(&self, at: &BlockId<B::Block>, xts: T) -> Result<Vec<Result<ExHash<B>, B::Error>>, B::Error> where
		T: IntoIterator<Item=ExtrinsicFor<B>>
	{
		let block_number = self.api.block_id_to_number(at)?
			.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?;

		let results = xts
			.into_iter()
			.map(|xt| -> Result<_, B::Error> {
				let (hash, bytes) = self.api.hash_and_length(&xt);
				if self.rotator.is_banned(&hash) {
					bail!(error::Error::from(error::ErrorKind::TemporarilyBanned))
				}

				match self.api.validate_transaction(at, xt.clone())? {
					TransactionValidity::Valid { priority, requires, provides, longevity } => {
						Ok(base::Transaction {
							data: xt,
							bytes,
							hash,
							priority,
							requires,
							provides,
							valid_till: block_number.as_().saturating_add(longevity),
						})
					},
					TransactionValidity::Invalid(e) => {
						bail!(error::Error::from(error::ErrorKind::InvalidTransaction(e)))
					},
					TransactionValidity::Unknown(e) => {
						self.listener.write().invalid(&hash);
						bail!(error::Error::from(error::ErrorKind::UnknownTransactionValidity(e)))
					},
				}
			})
			.map(|tx| {
				let imported = self.pool.write().import(tx?)?;

				if let base::Imported::Ready { .. } = imported {
					self.import_notification_sinks.lock().retain(|sink| sink.unbounded_send(()).is_ok());
				}

				let mut listener = self.listener.write();
				fire_events(&mut *listener, &imported);
				Ok(imported.hash().clone())
			})
			.collect::<Vec<_>>();

		let removed = self.enforce_limits();

		Ok(results.into_iter().map(|res| match res {
			Ok(ref hash) if removed.contains(hash) => Err(error::Error::from(error::ErrorKind::ImmediatelyDropped).into()),
			other => other,
		}).collect())
	}
/// Imports a bunch of unverified extrinsics to the pool
Imports a bunch of unverified extrinsics to the pool
Imports a bunch of unverified extrinsics to the pool
pub fn submit_at<T>(&self, at: &BlockId<B::Block>, xts: T) -> Result<Vec<Result<ExHash<B>, B::Error>>, B::Error> where
		T: IntoIterator<Item=ExtrinsicFor<B>>
	{
		let block_number = self.api.block_id_to_number(at)?
			.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?;
		let results = xts
			.into_iter()
			.map(|xt| -> Result<_, B::Error> {
				let (hash, bytes) = self.api.hash_and_length(&xt);
				if self.rotator.is_banned(&hash) {
					bail!(error::Error::from(error::ErrorKind::TemporarilyBanned))
				}
				match self.api.validate_transaction(at, xt.clone())? {
					TransactionValidity::Valid { priority, requires, provides, longevity } => {
						Ok(base::Transaction {
							data: xt,
							bytes,
							hash,
							priority,
							requires,
							provides,
							valid_till: block_number.as_().saturating_add(longevity),
						})
					},
					TransactionValidity::Invalid(e) => {
						bail!(error::Error::from(error::ErrorKind::InvalidTransaction(e)))
					},
					TransactionValidity::Unknown(e) => {
						self.listener.write().invalid(&hash);
						bail!(error::Error::from(error::ErrorKind::UnknownTransactionValidity(e)))
					},
				}
			})
			.map(|tx| {
				let imported = self.pool.write().import(tx?)?;
				if let base::Imported::Ready { .. } = imported {
					self.import_notification_sinks.lock().retain(|sink| sink.unbounded_send(()).is_ok());
				}
				let mut listener = self.listener.write();
				fire_events(&mut *listener, &imported);
				Ok(imported.hash().clone())
			})
			.collect::<Vec<_>>();
		let removed = self.enforce_limits();
		Ok(results.into_iter().map(|res| match res {
			Ok(ref hash) if removed.contains(hash) => Err(error::Error::from(error::ErrorKind::ImmediatelyDropped).into()),
			other => other,
		}).collect())
	}
pub fn submit_at < T > ( & self , at : & BlockId < B :: Block > , xts : T ) -> Result < Vec < Result < ExHash < B > , B :: Error > > , B :: Error > where T : IntoIterator < Item = ExtrinsicFor < B > > { let block_number = self . api . block_id_to_number ( at ) ? . ok_or_else ( | | error :: ErrorKind :: Msg ( format ! ( " " at ) ) . into ( ) ) ? ; let results = xts . into_iter ( ) . map ( | xt | -> Result < _ , B :: Error > { let ( hash , bytes ) = self . api . hash_and_length ( & xt ) ; if self . rotator . is_banned ( & hash ) { bail ! ( error Error from ( error ErrorKind TemporarilyBanned ) ) } match self . api . validate_transaction ( at , xt . clone ( ) ) ? { TransactionValidity :: Valid { priority , requires , provides , longevity } => { Ok ( base :: Transaction { data : xt , bytes , hash , priority , requires , provides , valid_till : block_number . as_ ( ) . saturating_add ( longevity ) , } ) } , TransactionValidity :: Invalid ( e ) => { bail ! ( error Error from ( error ErrorKind InvalidTransaction ( e ) ) ) } , TransactionValidity :: Unknown ( e ) => { self . listener . write ( ) . invalid ( & hash ) ; bail ! ( error Error from ( error ErrorKind UnknownTransactionValidity ( e ) ) ) } , } } ) . map ( | tx | { let imported = self . pool . write ( ) . import ( tx ? ) ? ; if let base :: Imported :: Ready { .. } = imported { self . import_notification_sinks . lock ( ) . retain ( | sink | sink . unbounded_send ( ( ) ) . is_ok ( ) ) ; } let mut listener = self . listener . write ( ) ; fire_events ( & mut * listener , & imported ) ; Ok ( imported . hash ( ) . clone ( ) ) } ) . collect :: < Vec < _ > > ( ) ; let removed = self . enforce_limits ( ) ; Ok ( results . into_iter ( ) . map ( | res | match res { Ok ( ref hash ) if removed . contains ( hash ) => Err ( error :: Error :: from ( error :: ErrorKind :: ImmediatelyDropped ) . into ( ) ) , other => other , } ) . collect ( ) ) }
Imports a bunch of unverified extrinsics to the pool
Imports a bunch of unverified extrinsics to the pool
&self
at
&BlockId<B::Block>
xts
T
&self
at
&BlockId<B::Block>
xts
T