fn create_receive_tx_record<'a, T: ?Sized, C, K>(
	wallet: &mut T,
	keychain_mask: Option<&SecretKey>,
	slate: &Slate,
	tx_name: String,
	output_key_id: &Identifier,
) -> Result<(), Error>
where
	T: WalletBackend<'a, C, K>,
	C: NodeClient + 'a,
	K: Keychain + 'a,
{
	let parent_key_id = wallet.parent_key_id();
	let mut batch = wallet.batch(keychain_mask)?;
	let log_id = batch.next_tx_log_id(&parent_key_id)?;
	let mut t = TxLogEntry::new(parent_key_id.clone(), TxLogEntryType::TxReceived, log_id);

	// Creating trnasaction
	t.tx_slate_id = Some(slate.id.clone());
	t.amount_credited = slate.amount;
	t.address = Some(tx_name);
	t.num_outputs = 1;
	t.output_commits = slate
		.tx
		.body
		.outputs
		.iter()
		.map(|o| o.commit.clone())
		.collect();
	t.messages = None;
	t.ttl_cutoff_height = None;
	// when invoicing, this will be invalid
	assert!(slate.tx.body.kernels.len() == 1);
	t.kernel_excess = Some(slate.tx.body.kernels[0].excess);
	t.kernel_lookup_min_height = Some(slate.height);
	batch.save_tx_log_entry(t, &parent_key_id)?;

	assert!(slate.tx.body.outputs.len() == 1);

	// Creating output for that
	batch.save(OutputData {
		root_key_id: parent_key_id.clone(),
		key_id: output_key_id.clone(),
		mmr_index: None,
		n_child: output_key_id.to_path().last_path_index(),
		commit: Some(to_hex(slate.tx.body.outputs[0].commit.0.to_vec())),
		value: slate.amount,
		status: OutputStatus::Unconfirmed,
		height: slate.height,
		lock_height: slate.lock_height,
		is_coinbase: false,
		tx_log_entry: Some(log_id),
	})?;
	batch.commit()?;
	Ok(())
}
// Creating Transaction and output for expected recieve slate
Creating Transaction and output for expected recieve slate
Creating Transaction and output for expected recieve slate
fn create_receive_tx_record<'a, T: ?Sized, C, K>(
	wallet: &mut T,
	keychain_mask: Option<&SecretKey>,
	slate: &Slate,
	tx_name: String,
	output_key_id: &Identifier,
) -> Result<(), Error>
where
	T: WalletBackend<'a, C, K>,
	C: NodeClient + 'a,
	K: Keychain + 'a,
{
	let parent_key_id = wallet.parent_key_id();
	let mut batch = wallet.batch(keychain_mask)?;
	let log_id = batch.next_tx_log_id(&parent_key_id)?;
	let mut t = TxLogEntry::new(parent_key_id.clone(), TxLogEntryType::TxReceived, log_id);
	// Creating trnasaction
	t.tx_slate_id = Some(slate.id.clone());
	t.amount_credited = slate.amount;
	t.address = Some(tx_name);
	t.num_outputs = 1;
	t.output_commits = slate
		.tx
		.body
		.outputs
		.iter()
		.map(|o| o.commit.clone())
		.collect();
	t.messages = None;
	t.ttl_cutoff_height = None;
	// when invoicing, this will be invalid
	assert!(slate.tx.body.kernels.len() == 1);
	t.kernel_excess = Some(slate.tx.body.kernels[0].excess);
	t.kernel_lookup_min_height = Some(slate.height);
	batch.save_tx_log_entry(t, &parent_key_id)?;
	assert!(slate.tx.body.outputs.len() == 1);
	// Creating output for that
	batch.save(OutputData {
		root_key_id: parent_key_id.clone(),
		key_id: output_key_id.clone(),
		mmr_index: None,
		n_child: output_key_id.to_path().last_path_index(),
		commit: Some(to_hex(slate.tx.body.outputs[0].commit.0.to_vec())),
		value: slate.amount,
		status: OutputStatus::Unconfirmed,
		height: slate.height,
		lock_height: slate.lock_height,
		is_coinbase: false,
		tx_log_entry: Some(log_id),
	})?;
	batch.commit()?;
	Ok(())
}
fn create_receive_tx_record < ' a , T : ? Sized , C , K > ( wallet : & mut T , keychain_mask : Option < & SecretKey > , slate : & Slate , tx_name : String , output_key_id : & Identifier , ) -> Result < ( ) , Error > where T : WalletBackend < ' a , C , K > , C : NodeClient + ' a , K : Keychain + ' a , { let parent_key_id = wallet . parent_key_id ( ) ; let mut batch = wallet . batch ( keychain_mask ) ? ; let log_id = batch . next_tx_log_id ( & parent_key_id ) ? ; let mut t = TxLogEntry :: new ( parent_key_id . clone ( ) , TxLogEntryType :: TxReceived , log_id ) ; // Creating trnasaction t . tx_slate_id = Some ( slate . id . clone ( ) ) ; t . amount_credited = slate . amount ; t . address = Some ( tx_name ) ; t . num_outputs = 1 ; t . output_commits = slate . tx . body . outputs . iter ( ) . map ( | o | o . commit . clone ( ) ) . collect ( ) ; t . messages = None ; t . ttl_cutoff_height = None ; // when invoicing, this will be invalid assert ! ( slate tx body kernels len ( ) 1 ) ; t . kernel_excess = Some ( slate . tx . body . kernels [ 0 ] . excess ) ; t . kernel_lookup_min_height = Some ( slate . height ) ; batch . save_tx_log_entry ( t , & parent_key_id ) ? ; assert ! ( slate tx body outputs len ( ) 1 ) ; // Creating output for that batch . save ( OutputData { root_key_id : parent_key_id . clone ( ) , key_id : output_key_id . clone ( ) , mmr_index : None , n_child : output_key_id . to_path ( ) . last_path_index ( ) , commit : Some ( to_hex ( slate . tx . body . outputs [ 0 ] . commit . 0 . to_vec ( ) ) ) , value : slate . amount , status : OutputStatus :: Unconfirmed , height : slate . height , lock_height : slate . lock_height , is_coinbase : false , tx_log_entry : Some ( log_id ) , } ) ? ; batch . commit ( ) ? ; Ok ( ( ) ) }
Creating Transaction and output for expected recieve slate
Creating Transaction and output for expected recieve slate
wallet
&mut T
keychain_mask
Option<&SecretKey>
slate
&Slate
tx_name
String
output_key_id
&Identifier
wallet
&mut T
keychain_mask
Option<&SecretKey>
slate
&Slate
tx_name
String
output_key_id
&Identifier