pub fn update_stored_tx<T: ?Sized, C, K>(
	wallet: &mut T,
	slate: &Slate,
	is_invoiced: bool,
) -> Result<(), Error>
where
	T: WalletBackend<C, K>,
	C: NodeClient,
	K: Keychain,
{
	// finalize command
	let tx_vec = updater::retrieve_txs(wallet, None, Some(slate.id), None, false)?;
	let mut tx = None;
	// don't want to assume this is the right tx, in case of self-sending
	for t in tx_vec {
		if t.tx_type == TxLogEntryType::TxSent && !is_invoiced {
			tx = Some(t.clone());
			break;
		}
		if t.tx_type == TxLogEntryType::TxReceived && is_invoiced {
			tx = Some(t.clone());
			break;
		}
	}
	let tx = match tx {
		Some(t) => t,
		None => return Err(ErrorKind::TransactionDoesntExist(slate.id.to_string()))?,
	};
	wallet.store_tx(&format!("{}", tx.tx_slate_id.unwrap()), &slate.tx)?;
	Ok(())
}
/// Update the stored transaction (this update needs to happen when the TX is finalised)
Update the stored transaction (this update needs to happen when the TX is finalised)
Update the stored transaction ( this update needs to happen when the TX is finalised )
pub fn update_stored_tx<T: ?Sized, C, K>(
	wallet: &mut T,
	slate: &Slate,
	is_invoiced: bool,
) -> Result<(), Error>
where
	T: WalletBackend<C, K>,
	C: NodeClient,
	K: Keychain,
{
	// finalize command
	let tx_vec = updater::retrieve_txs(wallet, None, Some(slate.id), None, false)?;
	let mut tx = None;
	// don't want to assume this is the right tx, in case of self-sending
	for t in tx_vec {
		if t.tx_type == TxLogEntryType::TxSent && !is_invoiced {
			tx = Some(t.clone());
			break;
		}
		if t.tx_type == TxLogEntryType::TxReceived && is_invoiced {
			tx = Some(t.clone());
			break;
		}
	}
	let tx = match tx {
		Some(t) => t,
		None => return Err(ErrorKind::TransactionDoesntExist(slate.id.to_string()))?,
	};
	wallet.store_tx(&format!("{}", tx.tx_slate_id.unwrap()), &slate.tx)?;
	Ok(())
}
pub fn update_stored_tx < T : ? Sized , C , K > ( wallet : & mut T , slate : & Slate , is_invoiced : bool , ) -> Result < ( ) , Error > where T : WalletBackend < C , K > , C : NodeClient , K : Keychain , { // finalize command let tx_vec = updater :: retrieve_txs ( wallet , None , Some ( slate . id ) , None , false ) ? ; let mut tx = None ; // don't want to assume this is the right tx, in case of self-sending for t in tx_vec { if t . tx_type == TxLogEntryType :: TxSent && ! is_invoiced { tx = Some ( t . clone ( ) ) ; break ; } if t . tx_type == TxLogEntryType :: TxReceived && is_invoiced { tx = Some ( t . clone ( ) ) ; break ; } } let tx = match tx { Some ( t ) => t , None => return Err ( ErrorKind :: TransactionDoesntExist ( slate . id . to_string ( ) ) ) ? , } ; wallet . store_tx ( & format ! ( " " tx tx_slate_id unwrap ( ) ) , & slate . tx ) ? ; Ok ( ( ) ) }
Update the stored transaction (this update needs to happen when the TX is finalised)
Update the stored transaction ( this update needs to happen when the TX is finalised )
wallet
&mut T
slate
&Slate
is_invoiced
bool