pub fn finalize_tx<'a, T: ?Sized, C, K>(
	w: &mut T,
	keychain_mask: Option<&SecretKey>,
	slate: &Slate,
	post_automatically: bool,
) -> Result<Slate, Error>
where
	T: WalletBackend<'a, C, K>,
	C: NodeClient + 'a,
	K: Keychain + 'a,
{
	let mut sl = slate.clone();
	let context = w.get_private_context(keychain_mask, sl.id.as_bytes())?;
	let is_invoice = context.is_invoice;
	if is_invoice {
		check_ttl(w, &sl)?;
		if sl.is_compact() {
			let mut temp_ctx = context.clone();
			temp_ctx.sec_key = context.initial_sec_key.clone();
			temp_ctx.sec_nonce = context.initial_sec_nonce.clone();
			selection::repopulate_tx(&mut *w, keychain_mask, &mut sl, &temp_ctx, false)?;
		}
		tx::complete_tx(&mut *w, keychain_mask, &mut sl, &context)?;
		tx::update_stored_tx(&mut *w, keychain_mask, &context, &mut sl, true)?;
		{
			let mut batch = w.batch(keychain_mask)?;
			batch.delete_private_context(sl.id.as_bytes())?;
			batch.commit()?;
		}
		sl.state = SlateState::Invoice3;
		if sl.is_compact() {
			sl.amount = 0;
		}
	} else {
		sl = owner_finalize(w, keychain_mask, slate)?;
	}
	if post_automatically {
		post_tx(w.w2n_client(), sl.tx_or_err()?, true)?;
	}
	Ok(sl)
}
/// Receive a tx that this wallet has issued
Receive a tx that this wallet has issued
Receive a tx that this wallet has issued
pub fn finalize_tx<'a, T: ?Sized, C, K>(
	w: &mut T,
	keychain_mask: Option<&SecretKey>,
	slate: &Slate,
	post_automatically: bool,
) -> Result<Slate, Error>
where
	T: WalletBackend<'a, C, K>,
	C: NodeClient + 'a,
	K: Keychain + 'a,
{
	let mut sl = slate.clone();
	let context = w.get_private_context(keychain_mask, sl.id.as_bytes())?;
	let is_invoice = context.is_invoice;
	if is_invoice {
		check_ttl(w, &sl)?;
		if sl.is_compact() {
			let mut temp_ctx = context.clone();
			temp_ctx.sec_key = context.initial_sec_key.clone();
			temp_ctx.sec_nonce = context.initial_sec_nonce.clone();
			selection::repopulate_tx(&mut *w, keychain_mask, &mut sl, &temp_ctx, false)?;
		}
		tx::complete_tx(&mut *w, keychain_mask, &mut sl, &context)?;
		tx::update_stored_tx(&mut *w, keychain_mask, &context, &mut sl, true)?;
		{
			let mut batch = w.batch(keychain_mask)?;
			batch.delete_private_context(sl.id.as_bytes())?;
			batch.commit()?;
		}
		sl.state = SlateState::Invoice3;
		if sl.is_compact() {
			sl.amount = 0;
		}
	} else {
		sl = owner_finalize(w, keychain_mask, slate)?;
	}
	if post_automatically {
		post_tx(w.w2n_client(), sl.tx_or_err()?, true)?;
	}
	Ok(sl)
}
pub fn finalize_tx < ' a , T : ? Sized , C , K > ( w : & mut T , keychain_mask : Option < & SecretKey > , slate : & Slate , post_automatically : bool , ) -> Result < Slate , Error > where T : WalletBackend < ' a , C , K > , C : NodeClient + ' a , K : Keychain + ' a , { let mut sl = slate . clone ( ) ; let context = w . get_private_context ( keychain_mask , sl . id . as_bytes ( ) ) ? ; let is_invoice = context . is_invoice ; if is_invoice { check_ttl ( w , & sl ) ? ; if sl . is_compact ( ) { let mut temp_ctx = context . clone ( ) ; temp_ctx . sec_key = context . initial_sec_key . clone ( ) ; temp_ctx . sec_nonce = context . initial_sec_nonce . clone ( ) ; selection :: repopulate_tx ( & mut * w , keychain_mask , & mut sl , & temp_ctx , false ) ? ; } tx :: complete_tx ( & mut * w , keychain_mask , & mut sl , & context ) ? ; tx :: update_stored_tx ( & mut * w , keychain_mask , & context , & mut sl , true ) ? ; { let mut batch = w . batch ( keychain_mask ) ? ; batch . delete_private_context ( sl . id . as_bytes ( ) ) ? ; batch . commit ( ) ? ; } sl . state = SlateState :: Invoice3 ; if sl . is_compact ( ) { sl . amount = 0 ; } } else { sl = owner_finalize ( w , keychain_mask , slate ) ? ; } if post_automatically { post_tx ( w . w2n_client ( ) , sl . tx_or_err ( ) ? , true ) ? ; } Ok ( sl ) }
Receive a tx that this wallet has issued
Receive a tx that this wallet has issued
w
&mut T
keychain_mask
Option<&SecretKey>
slate
&Slate
post_automatically
bool
w
&mut T
keychain_mask
Option<&SecretKey>
slate
&Slate
post_automatically
bool