Work in review comments

This commit is contained in:
Daniel Karzel 2021-05-07 14:28:06 +10:00
parent daa572e5bf
commit 23d9637a4b
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E
3 changed files with 8 additions and 11 deletions

View File

@ -7,10 +7,10 @@ use uuid::Uuid;
#[derive(Debug, thiserror::Error)]
pub enum Error {
// Errors indicating the the swap can *currently* not be refunded 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.")]
// Errors indicating the swap can *currently* not be punished but might be later
#[error("Swap is not in a cancelled state Make sure to cancel the swap before trying to punish or use --force.")]
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,
// Errors indicating that the swap cannot be refunded because it is in a abort/final state

View File

@ -9,7 +9,7 @@ use uuid::Uuid;
#[derive(Debug, thiserror::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.")]
SwapNotCancelled,
#[error(
@ -19,7 +19,7 @@ pub enum Error {
// Errors indicating that the swap cannot be refunded because because it is in a abort/final
// 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),
#[error("Swap is in state {0} which is not refundable")]
SwapNotRefundable(AliceState),

View File

@ -513,13 +513,10 @@ impl State3 {
pub async fn punish_btc(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result<Txid> {
let signed_tx_punish = self.signed_punish_transaction()?;
async {
let (txid, subscription) = bitcoin_wallet.broadcast(signed_tx_punish, "punish").await?;
subscription.wait_until_final().await?;
Result::<_, anyhow::Error>::Ok(txid)
}
.await
Ok(txid)
}
pub fn signed_redeem_transaction(