mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-04-20 07:56:05 -04:00
fix error
This commit is contained in:
parent
af5dad585a
commit
075db8164e
@ -83,6 +83,7 @@ pub async fn cancel(
|
||||
tracing::info!("General error trying to submit cancel transaction");
|
||||
}
|
||||
let state = BobState::BtcCancelled(state6);
|
||||
let txid = state6.construct_tx_cancel().txid();
|
||||
db.insert_latest_state(swap_id, state.clone().into())
|
||||
.await?;
|
||||
Ok((txid, state))
|
||||
|
@ -646,18 +646,20 @@ impl State6 {
|
||||
tx_cancel_status,
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn check_for_tx_cancel(
|
||||
&self,
|
||||
bitcoin_wallet: &bitcoin::Wallet,
|
||||
) -> Result<Transaction> {
|
||||
let tx_cancel = bitcoin::TxCancel::new(
|
||||
pub async fn construct_tx_cancel(&self) -> Result<bitcoin::TxCancel> {
|
||||
bitcoin::TxCancel::new(
|
||||
&self.tx_lock,
|
||||
self.cancel_timelock,
|
||||
self.A,
|
||||
self.b.public(),
|
||||
self.tx_cancel_fee,
|
||||
)?;
|
||||
}
|
||||
pub async fn check_for_tx_cancel(
|
||||
&self,
|
||||
bitcoin_wallet: &bitcoin::Wallet,
|
||||
) -> Result<Transaction> {
|
||||
let tx_cancel = self.construct_tx_cancel()?;
|
||||
|
||||
let tx = bitcoin_wallet.get_raw_transaction(tx_cancel.txid()).await?;
|
||||
|
||||
@ -668,13 +670,7 @@ impl State6 {
|
||||
&self,
|
||||
bitcoin_wallet: &bitcoin::Wallet,
|
||||
) -> Result<(Txid, Subscription)> {
|
||||
let transaction = bitcoin::TxCancel::new(
|
||||
&self.tx_lock,
|
||||
self.cancel_timelock,
|
||||
self.A,
|
||||
self.b.public(),
|
||||
self.tx_cancel_fee,
|
||||
)?
|
||||
let transaction = self.construct_tx_cancel()?
|
||||
.complete_as_bob(self.A, self.b.clone(), self.tx_cancel_sig_a.clone())
|
||||
.context("Failed to complete Bitcoin cancel transaction")?;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user