Dynamically chose fee for TxCancel.

Bob chooses the fee for TxCancel because he is the one that cares.
This commit is contained in:
Philipp Hoenisch 2021-04-29 10:59:40 +10:00
parent 1012e39527
commit 38540b4de5
No known key found for this signature in database
GPG key ID: E5F8E74C672BC666
8 changed files with 121 additions and 36 deletions

View file

@ -67,6 +67,7 @@ async fn next_state(
BobState::Started { btc_amount } => {
let bitcoin_refund_address = bitcoin_wallet.new_address().await?;
let tx_refund_fee = bitcoin_wallet.estimate_fee(bitcoin::ESTIMATED_WEIGHT_TX_REDEEM);
let tx_cancel_fee = bitcoin_wallet.estimate_fee(bitcoin::ESTIMATED_WEIGHT_TX_CANCEL);
let state2 = request_price_and_setup(
swap_id,
@ -75,6 +76,7 @@ async fn next_state(
env_config,
bitcoin_refund_address,
tx_refund_fee,
tx_cancel_fee,
)
.await?;
@ -271,6 +273,7 @@ pub async fn request_price_and_setup(
env_config: &Config,
bitcoin_refund_address: bitcoin::Address,
tx_refund_fee: bitcoin::Amount,
tx_cancel_fee: bitcoin::Amount,
) -> Result<bob::state::State2> {
let xmr = event_loop_handle.request_spot_price(btc).await?;
@ -286,6 +289,7 @@ pub async fn request_price_and_setup(
bitcoin_refund_address,
env_config.monero_finality_confirmations,
tx_refund_fee,
tx_cancel_fee,
);
let state2 = event_loop_handle.execution_setup(state0).await?;