mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-23 16:19:47 -05:00
Work in review comments
This commit is contained in:
parent
daa572e5bf
commit
23d9637a4b
@ -7,10 +7,10 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
// Errors indicating the the swap can *currently* not be refunded but might be later
|
// Errors indicating the swap can *currently* not be punished but might be later
|
||||||
#[error("Cannot punish because swap is not in a cancelled state. Make sure to cancel the swap before trying to punish or use --force.")]
|
#[error("Swap is not in a cancelled state Make sure to cancel the swap before trying to punish or use --force.")]
|
||||||
SwapNotCancelled,
|
SwapNotCancelled,
|
||||||
#[error("The punish timelock has not expired yet because the timelock has not expired. Please try again later")]
|
#[error("The punish transaction cannot be published because the punish timelock has not expired yet. Please try again later")]
|
||||||
PunishTimelockNotExpiredYet,
|
PunishTimelockNotExpiredYet,
|
||||||
|
|
||||||
// Errors indicating that the swap cannot be refunded because it is in a abort/final state
|
// Errors indicating that the swap cannot be refunded because it is in a abort/final state
|
||||||
|
@ -9,7 +9,7 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
// Errors indicating the the swap can *currently* not be refunded but might be later
|
// Errors indicating the swap can *currently* not be refunded but might be later
|
||||||
#[error("Swap is not in a cancelled state. Make sure to cancel the swap before trying to refund or use --force.")]
|
#[error("Swap is not in a cancelled state. Make sure to cancel the swap before trying to refund or use --force.")]
|
||||||
SwapNotCancelled,
|
SwapNotCancelled,
|
||||||
#[error(
|
#[error(
|
||||||
@ -19,7 +19,7 @@ pub enum Error {
|
|||||||
|
|
||||||
// Errors indicating that the swap cannot be refunded because because it is in a abort/final
|
// Errors indicating that the swap cannot be refunded because because it is in a abort/final
|
||||||
// state
|
// state
|
||||||
#[error("Swa is in state {0} where no XMR was locked. Try aborting instead.")]
|
#[error("Swap is in state {0} where no XMR was locked. Try aborting instead.")]
|
||||||
NoXmrLocked(AliceState),
|
NoXmrLocked(AliceState),
|
||||||
#[error("Swap is in state {0} which is not refundable")]
|
#[error("Swap is in state {0} which is not refundable")]
|
||||||
SwapNotRefundable(AliceState),
|
SwapNotRefundable(AliceState),
|
||||||
|
@ -513,13 +513,10 @@ impl State3 {
|
|||||||
pub async fn punish_btc(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result<Txid> {
|
pub async fn punish_btc(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result<Txid> {
|
||||||
let signed_tx_punish = self.signed_punish_transaction()?;
|
let signed_tx_punish = self.signed_punish_transaction()?;
|
||||||
|
|
||||||
async {
|
|
||||||
let (txid, subscription) = bitcoin_wallet.broadcast(signed_tx_punish, "punish").await?;
|
let (txid, subscription) = bitcoin_wallet.broadcast(signed_tx_punish, "punish").await?;
|
||||||
subscription.wait_until_final().await?;
|
subscription.wait_until_final().await?;
|
||||||
|
|
||||||
Result::<_, anyhow::Error>::Ok(txid)
|
Ok(txid)
|
||||||
}
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn signed_redeem_transaction(
|
pub fn signed_redeem_transaction(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user