mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-06-06 22:29:05 -04:00
Pass relevant execution params into wallet instead of via functions
The execution params don't change throughout the lifetime of the program. They can be set in the wallet at the very beginning. This simplifies the interface of the wallet functions.
This commit is contained in:
parent
84ea092a1b
commit
a0830f099f
11 changed files with 46 additions and 47 deletions
|
@ -2,7 +2,6 @@ use crate::bitcoin::{
|
|||
self, current_epoch, CancelTimelock, ExpiredTimelocks, PunishTimelock, Transaction, TxCancel,
|
||||
TxLock, Txid,
|
||||
};
|
||||
use crate::execution_params::ExecutionParams;
|
||||
use crate::monero;
|
||||
use crate::monero::{monero_private_key, InsufficientFunds, TransferProof};
|
||||
use crate::monero_ext::ScalarExt;
|
||||
|
@ -531,11 +530,7 @@ impl State4 {
|
|||
))
|
||||
}
|
||||
|
||||
pub async fn refund_btc(
|
||||
&self,
|
||||
bitcoin_wallet: &bitcoin::Wallet,
|
||||
execution_params: ExecutionParams,
|
||||
) -> Result<()> {
|
||||
pub async fn refund_btc(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result<()> {
|
||||
let tx_cancel =
|
||||
bitcoin::TxCancel::new(&self.tx_lock, self.cancel_timelock, self.A, self.b.public());
|
||||
let tx_refund = bitcoin::TxRefund::new(&tx_cancel, &self.refund_address);
|
||||
|
@ -552,11 +547,7 @@ impl State4 {
|
|||
let txid = bitcoin_wallet.broadcast(signed_tx_refund, "refund").await?;
|
||||
|
||||
bitcoin_wallet
|
||||
.wait_for_transaction_finality(
|
||||
txid,
|
||||
self.refund_address.script_pubkey(),
|
||||
execution_params,
|
||||
)
|
||||
.wait_for_transaction_finality(txid, self.refund_address.script_pubkey())
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue