From c798035402194cba4c0704abfe99602f58207189 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Wed, 20 Oct 2021 17:22:19 +1100 Subject: [PATCH] Don't fail re-broadcasting tx loop --- daemon/src/housekeeping.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/src/housekeeping.rs b/daemon/src/housekeeping.rs index 32056bc..dd5d225 100644 --- a/daemon/src/housekeeping.rs +++ b/daemon/src/housekeeping.rs @@ -1,10 +1,10 @@ use crate::db::{append_cfd_state, load_all_cfds}; use crate::model::cfd::{Cfd, CfdState}; +use crate::try_continue; use crate::wallet::Wallet; use anyhow::Result; use sqlx::pool::PoolConnection; use sqlx::Sqlite; - pub async fn transition_non_continue_cfds_to_setup_failed( conn: &mut PoolConnection, ) -> Result<()> { @@ -29,29 +29,28 @@ pub async fn rebroadcast_transactions( let cfds = load_all_cfds(conn).await?; for dlc in cfds.iter().filter_map(|cfd| Cfd::pending_open_dlc(cfd)) { - let txid = wallet.try_broadcast_transaction(dlc.lock.0.clone()).await?; - + let txid = try_continue!(wallet.try_broadcast_transaction(dlc.lock.0.clone()).await); tracing::info!("Lock transaction published with txid {}", txid); } for cfd in cfds.iter().filter(|cfd| Cfd::is_must_refund(cfd)) { let signed_refund_tx = cfd.refund_tx()?; - let txid = wallet.try_broadcast_transaction(signed_refund_tx).await?; + let txid = try_continue!(wallet.try_broadcast_transaction(signed_refund_tx).await); tracing::info!("Refund transaction published on chain: {}", txid); } for cfd in cfds.iter().filter(|cfd| Cfd::is_pending_commit(cfd)) { let signed_commit_tx = cfd.commit_tx()?; - let txid = wallet.try_broadcast_transaction(signed_commit_tx).await?; + let txid = try_continue!(wallet.try_broadcast_transaction(signed_commit_tx).await); tracing::info!("Commit transaction published on chain: {}", txid); } for cfd in cfds.iter().filter(|cfd| Cfd::is_pending_cet(cfd)) { - // Double question-mark OK because if we are in PendingCet we must have been Ready before + // Double question mark OK because if we are in PendingCet we must have been Ready before let signed_cet = cfd.cet()??; - let txid = wallet.try_broadcast_transaction(signed_cet).await?; + let txid = try_continue!(wallet.try_broadcast_transaction(signed_cet).await); tracing::info!("CET published on chain: {}", txid); }