mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 23:19:34 -05:00
Extract print_status_change
so it is easily testable
This commit is contained in:
parent
2eb7fab0c3
commit
991dbf496e
@ -149,16 +149,7 @@ impl Wallet {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match (last_status, new_status) {
|
last_status = Some(print_status_change(txid, last_status, new_status));
|
||||||
(None, new_status) => {
|
|
||||||
tracing::debug!(%txid, status = %new_status, "Found relevant Bitcoin transaction");
|
|
||||||
},
|
|
||||||
(Some(old_status), new_status) => {
|
|
||||||
tracing::debug!(%txid, %new_status, %old_status, "Bitcoin transaction status changed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
last_status = Some(new_status);
|
|
||||||
|
|
||||||
let all_receivers_gone = sender.send(new_status).is_err();
|
let all_receivers_gone = sender.send(new_status).is_err();
|
||||||
|
|
||||||
@ -182,6 +173,19 @@ impl Wallet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_status_change(txid: Txid, old: Option<ScriptStatus>, new: ScriptStatus) -> ScriptStatus {
|
||||||
|
match (old, new) {
|
||||||
|
(None, new_status) => {
|
||||||
|
tracing::debug!(%txid, status = %new_status, "Found relevant Bitcoin transaction");
|
||||||
|
}
|
||||||
|
(Some(old_status), new_status) => {
|
||||||
|
tracing::debug!(%txid, %new_status, %old_status, "Bitcoin transaction status changed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
}
|
||||||
|
|
||||||
/// Represents a subscription to the status of a given transaction.
|
/// Represents a subscription to the status of a given transaction.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Subscription {
|
pub struct Subscription {
|
||||||
|
Loading…
Reference in New Issue
Block a user