Work in review comments

pull/452/head
Daniel Karzel 3 years ago
parent daa572e5bf
commit 23d9637a4b
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E

@ -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…
Cancel
Save