pub fn receive_tx(
		&mut self,
		slate: &mut Slate,
		dest_acct_name: Option<&str>,
		message: Option<String>,
	) -> Result<(), Error> {
		let mut w = self.wallet.lock();
		w.open_with_credentials()?;
		let parent_key_id = match dest_acct_name {
			Some(d) => {
				let pm = w.get_acct_path(d.to_owned())?;
				match pm {
					Some(p) => p.path,
					None => w.parent_key_id(),
				}
			}
			None => w.parent_key_id(),
		};
		// Don't do this multiple times
		let tx = updater::retrieve_txs(&mut *w, None, Some(slate.id), Some(&parent_key_id))?;
		for t in &tx {
			if t.tx_type == TxLogEntryType::TxReceived {
				return Err(ErrorKind::TransactionAlreadyReceived(slate.id.to_string()).into());
			}
		}
		let res = tx::receive_tx(&mut *w, slate, &parent_key_id, message);
		w.close()?;

		if let Err(e) = res {
			error!("api: receive_tx: failed with error: {}", e);
			Err(e)
		} else {
			debug!(
				"api: receive_tx: successfully received tx: {}",
				slate.tx.hash()
			);
			Ok(())
		}
	}
/// Receive a transaction from a sender
Receive a transaction from a sender
Receive a transaction from a sender
pub fn receive_tx(
		&mut self,
		slate: &mut Slate,
		dest_acct_name: Option<&str>,
		message: Option<String>,
	) -> Result<(), Error> {
		let mut w = self.wallet.lock();
		w.open_with_credentials()?;
		let parent_key_id = match dest_acct_name {
			Some(d) => {
				let pm = w.get_acct_path(d.to_owned())?;
				match pm {
					Some(p) => p.path,
					None => w.parent_key_id(),
				}
			}
			None => w.parent_key_id(),
		};
		// Don't do this multiple times
		let tx = updater::retrieve_txs(&mut *w, None, Some(slate.id), Some(&parent_key_id))?;
		for t in &tx {
			if t.tx_type == TxLogEntryType::TxReceived {
				return Err(ErrorKind::TransactionAlreadyReceived(slate.id.to_string()).into());
			}
		}
		let res = tx::receive_tx(&mut *w, slate, &parent_key_id, message);
		w.close()?;
		if let Err(e) = res {
			error!("api: receive_tx: failed with error: {}", e);
			Err(e)
		} else {
			debug!(
				"api: receive_tx: successfully received tx: {}",
				slate.tx.hash()
			);
			Ok(())
		}
	}
pub fn receive_tx ( & mut self , slate : & mut Slate , dest_acct_name : Option < & str > , message : Option < String > , ) -> Result < ( ) , Error > { let mut w = self . wallet . lock ( ) ; w . open_with_credentials ( ) ? ; let parent_key_id = match dest_acct_name { Some ( d ) => { let pm = w . get_acct_path ( d . to_owned ( ) ) ? ; match pm { Some ( p ) => p . path , None => w . parent_key_id ( ) , } } None => w . parent_key_id ( ) , } ; // Don't do this multiple times let tx = updater :: retrieve_txs ( & mut * w , None , Some ( slate . id ) , Some ( & parent_key_id ) ) ? ; for t in & tx { if t . tx_type == TxLogEntryType :: TxReceived { return Err ( ErrorKind :: TransactionAlreadyReceived ( slate . id . to_string ( ) ) . into ( ) ) ; } } let res = tx :: receive_tx ( & mut * w , slate , & parent_key_id , message ) ; w . close ( ) ? ; if let Err ( e ) = res { error ! ( " " e ) ; Err ( e ) } else { debug ! ( " " slate tx hash ( ) ) ; Ok ( ( ) ) } }
Receive a transaction from a sender
Receive a transaction from a sender
&mut self
slate
&mut Slate
dest_acct_name
Option<&str>
message
Option<String>