Pass execution params directly into wallet for initialization

This reduces the amount of parameters that we need to pass in.
This commit is contained in:
Thomas Eizinger 2021-03-17 13:36:43 +11:00
parent 7213907a79
commit bc43ed6ebd
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
13 changed files with 111 additions and 153 deletions

View file

@ -41,7 +41,7 @@ pub async fn run_until(
swap.bitcoin_wallet,
swap.monero_wallet,
swap.swap_id,
swap.execution_params,
swap.exec_params,
swap.receive_monero_address,
)
.await
@ -58,7 +58,7 @@ async fn run_until_internal(
bitcoin_wallet: Arc<bitcoin::Wallet>,
monero_wallet: Arc<monero::Wallet>,
swap_id: Uuid,
execution_params: ExecutionParams,
exec_params: ExecutionParams,
receive_monero_address: monero::Address,
) -> Result<BobState> {
trace!("Current state: {}", state);
@ -74,7 +74,7 @@ async fn run_until_internal(
let state2 = request_price_and_setup(
btc_amount,
&mut event_loop_handle,
execution_params,
exec_params,
bitcoin_refund_address,
)
.await?;
@ -90,7 +90,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -121,7 +121,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -177,7 +177,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -232,7 +232,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -275,7 +275,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -311,7 +311,7 @@ async fn run_until_internal(
bitcoin_wallet.clone(),
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -342,7 +342,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -368,7 +368,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -398,7 +398,7 @@ async fn run_until_internal(
bitcoin_wallet,
monero_wallet,
swap_id,
execution_params,
exec_params,
receive_monero_address,
)
.await
@ -414,7 +414,7 @@ async fn run_until_internal(
pub async fn request_price_and_setup(
btc: bitcoin::Amount,
event_loop_handle: &mut EventLoopHandle,
execution_params: ExecutionParams,
exec_params: ExecutionParams,
bitcoin_refund_address: bitcoin::Address,
) -> Result<bob::state::State2> {
let xmr = event_loop_handle.request_spot_price(btc).await?;
@ -425,10 +425,10 @@ pub async fn request_price_and_setup(
&mut OsRng,
btc,
xmr,
execution_params.bitcoin_cancel_timelock,
execution_params.bitcoin_punish_timelock,
exec_params.bitcoin_cancel_timelock,
exec_params.bitcoin_punish_timelock,
bitcoin_refund_address,
execution_params.monero_finality_confirmations,
exec_params.monero_finality_confirmations,
);
let state2 = event_loop_handle.execution_setup(state0).await?;