pub fn update_swap_status_action<'a, L, C, K>(
	wallet_inst: Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>,
	keychain_mask: Option<&SecretKey>,
	swap_id: &str,
) -> Result<
	(
		StateId,
		Action,
		Option<i64>,
		Vec<StateEtaInfo>,
		Vec<SwapJournalRecord>,
	),
	Error,
>
where
	L: WalletLCProvider<'a, C, K>,
	C: NodeClient + 'a,
	K: Keychain + 'a,
{
	wallet_lock!(wallet_inst, w);
	let node_client = w.w2n_client().clone();
	let keychain = w.keychain(keychain_mask)?;
	let skey = get_swap_storage_key(&keychain)?;
	let swap_lock = trades::get_swap_lock(&swap_id.to_string());
	let _l = swap_lock.lock();

	let (context, mut swap) = trades::get_swap_trade(swap_id, &skey, &*swap_lock)?;

	match update_swap_status_action_impl(&mut swap, &context, node_client, &keychain) {
		Ok((next_state_id, action, time_limit, eta)) => {
			trades::store_swap_trade(&context, &swap, &skey, &*swap_lock)?;
			Ok((next_state_id, action, time_limit, eta, swap.journal))
		}
		Err(e) => {
			swap.add_journal_message(format!("Processing error: {}", e));
			trades::store_swap_trade(&context, &swap, &skey, &*swap_lock)?;
			Err(e)
		}
	}
}
/// Refresh and get a status and current expected action for the swap.
/// return: <state>, <Action>, <time limit>
/// time limit shows when this action will be expired
Refresh and get a status and current expected action for the swap.
return: , , 
time limit shows when this action will be expired
Refresh and get a status and current expected action for the swap . return : time limit shows when this action will be expired
pub fn update_swap_status_action<'a, L, C, K>(
	wallet_inst: Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>,
	keychain_mask: Option<&SecretKey>,
	swap_id: &str,
) -> Result<
	(
		StateId,
		Action,
		Option<i64>,
		Vec<StateEtaInfo>,
		Vec<SwapJournalRecord>,
	),
	Error,
>
where
	L: WalletLCProvider<'a, C, K>,
	C: NodeClient + 'a,
	K: Keychain + 'a,
{
	wallet_lock!(wallet_inst, w);
	let node_client = w.w2n_client().clone();
	let keychain = w.keychain(keychain_mask)?;
	let skey = get_swap_storage_key(&keychain)?;
	let swap_lock = trades::get_swap_lock(&swap_id.to_string());
	let _l = swap_lock.lock();
	let (context, mut swap) = trades::get_swap_trade(swap_id, &skey, &*swap_lock)?;
	match update_swap_status_action_impl(&mut swap, &context, node_client, &keychain) {
		Ok((next_state_id, action, time_limit, eta)) => {
			trades::store_swap_trade(&context, &swap, &skey, &*swap_lock)?;
			Ok((next_state_id, action, time_limit, eta, swap.journal))
		}
		Err(e) => {
			swap.add_journal_message(format!("Processing error: {}", e));
			trades::store_swap_trade(&context, &swap, &skey, &*swap_lock)?;
			Err(e)
		}
	}
}
pub fn update_swap_status_action < ' a , L , C , K > ( wallet_inst : Arc < Mutex < Box < dyn WalletInst < ' a , L , C , K > > > > , keychain_mask : Option < & SecretKey > , swap_id : & str , ) -> Result < ( StateId , Action , Option < i64 > , Vec < StateEtaInfo > , Vec < SwapJournalRecord > , ) , Error , > where L : WalletLCProvider < ' a , C , K > , C : NodeClient + ' a , K : Keychain + ' a , { wallet_lock ! ( wallet_inst w ) ; let node_client = w . w2n_client ( ) . clone ( ) ; let keychain = w . keychain ( keychain_mask ) ? ; let skey = get_swap_storage_key ( & keychain ) ? ; let swap_lock = trades :: get_swap_lock ( & swap_id . to_string ( ) ) ; let _l = swap_lock . lock ( ) ; let ( context , mut swap ) = trades :: get_swap_trade ( swap_id , & skey , & * swap_lock ) ? ; match update_swap_status_action_impl ( & mut swap , & context , node_client , & keychain ) { Ok ( ( next_state_id , action , time_limit , eta ) ) => { trades :: store_swap_trade ( & context , & swap , & skey , & * swap_lock ) ? ; Ok ( ( next_state_id , action , time_limit , eta , swap . journal ) ) } Err ( e ) => { swap . add_journal_message ( format ! ( " " e ) ) ; trades :: store_swap_trade ( & context , & swap , & skey , & * swap_lock ) ? ; Err ( e ) } } }
Refresh and get a status and current expected action for the swap.
Refresh and get a status and current expected action for the swap .
wallet_inst
Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>
keychain_mask
Option<&SecretKey>
swap_id
&str
wallet_inst
Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>
keychain_mask
Option<&SecretKey>
swap_id
&str