pub fn import(
		&mut self,
		tx: Transaction<Hash, Ex>,
	) -> error::Result<Imported<Hash, Ex>> {
		if self.future.contains(&tx.hash) || self.ready.contains(&tx.hash) {
			bail!(error::ErrorKind::AlreadyImported(Box::new(tx.hash.clone())))
		}

		let tx = WaitingTransaction::new(
			tx,
			self.ready.provided_tags(),
			&self.recently_pruned,
		);
		trace!(target: "txpool", "[{:?}] {:?}", tx.transaction.hash, tx);
		debug!(target: "txpool", "[{:?}] Importing to {}", tx.transaction.hash, if tx.is_ready() { "ready" } else { "future" });

		// If all tags are not satisfied import to future.
		if !tx.is_ready() {
			let hash = tx.transaction.hash.clone();
			self.future.import(tx);
			return Ok(Imported::Future { hash });
		}

		self.import_to_ready(tx)
	}
/// Imports transaction to the pool.
///
/// The pool consists of two parts: Future and Ready.
/// The former contains transactions that require some tags that are not yet provided by
/// other transactions in the pool.
/// The latter contains transactions that have all the requirements satisfied and are
/// ready to be included in the block.
Imports transaction to the pool.
The pool consists of two parts: Future and Ready.
The former contains transactions that require some tags that are not yet provided by
other transactions in the pool.
The latter contains transactions that have all the requirements satisfied and are
ready to be included in the block.
Imports transaction to the pool . The pool consists of two parts : Future and Ready . The former contains transactions that require some tags that are not yet provided by other transactions in the pool . The latter contains transactions that have all the requirements satisfied and are ready to be included in the block .
pub fn import(
		&mut self,
		tx: Transaction<Hash, Ex>,
	) -> error::Result<Imported<Hash, Ex>> {
		if self.future.contains(&tx.hash) || self.ready.contains(&tx.hash) {
			bail!(error::ErrorKind::AlreadyImported(Box::new(tx.hash.clone())))
		}
		let tx = WaitingTransaction::new(
			tx,
			self.ready.provided_tags(),
			&self.recently_pruned,
		);
		trace!(target: "txpool", "[{:?}] {:?}", tx.transaction.hash, tx);
		debug!(target: "txpool", "[{:?}] Importing to {}", tx.transaction.hash, if tx.is_ready() { "ready" } else { "future" });
		// If all tags are not satisfied import to future.
		if !tx.is_ready() {
			let hash = tx.transaction.hash.clone();
			self.future.import(tx);
			return Ok(Imported::Future { hash });
		}
		self.import_to_ready(tx)
	}
pub fn import ( & mut self , tx : Transaction < Hash , Ex > , ) -> error :: Result < Imported < Hash , Ex > > { if self . future . contains ( & tx . hash ) || self . ready . contains ( & tx . hash ) { bail ! ( error ErrorKind AlreadyImported ( Box new ( tx hash clone ( ) ) ) ) } let tx = WaitingTransaction :: new ( tx , self . ready . provided_tags ( ) , & self . recently_pruned , ) ; trace ! ( target " " " " tx transaction hash tx ) ; debug ! ( target " " " " tx transaction hash if tx is_ready ( ) { " " } else { " " } ) ; // If all tags are not satisfied import to future. if ! tx . is_ready ( ) { let hash = tx . transaction . hash . clone ( ) ; self . future . import ( tx ) ; return Ok ( Imported :: Future { hash } ) ; } self . import_to_ready ( tx ) }
Imports transaction to the pool.
Imports transaction to the pool .
&mut self
tx
Transaction<Hash, Ex>
&mut self
tx
Transaction<Hash, Ex>