mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Shorten function name
The variable will always be at least called `wallet`, hence we can omit the `_wallet` postfix from the function name.
This commit is contained in:
parent
4f66269887
commit
37f97ac471
@ -141,7 +141,7 @@ async fn init_wallets(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
bitcoin_wallet.sync_wallet().await?;
|
bitcoin_wallet.sync().await?;
|
||||||
|
|
||||||
let bitcoin_balance = bitcoin_wallet.balance().await?;
|
let bitcoin_balance = bitcoin_wallet.balance().await?;
|
||||||
info!(
|
info!(
|
||||||
|
@ -113,7 +113,7 @@ async fn main() -> Result<()> {
|
|||||||
bitcoin_wallet.new_address(),
|
bitcoin_wallet.new_address(),
|
||||||
async {
|
async {
|
||||||
while bitcoin_wallet.balance().await? == Amount::ZERO {
|
while bitcoin_wallet.balance().await? == Amount::ZERO {
|
||||||
bitcoin_wallet.sync_wallet().await?;
|
bitcoin_wallet.sync().await?;
|
||||||
|
|
||||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ async fn init_bitcoin_wallet(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
wallet.sync_wallet().await?;
|
wallet.sync().await?;
|
||||||
|
|
||||||
Ok(wallet)
|
Ok(wallet)
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ impl Wallet {
|
|||||||
Ok(Amount::from_sat(fees))
|
Ok(Amount::from_sat(fees))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn sync_wallet(&self) -> Result<()> {
|
pub async fn sync(&self) -> Result<()> {
|
||||||
self.inner
|
self.inner
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
|
@ -151,7 +151,7 @@ impl TestContext {
|
|||||||
|
|
||||||
assert!(matches!(state, AliceState::BtcRedeemed));
|
assert!(matches!(state, AliceState::BtcRedeemed));
|
||||||
|
|
||||||
self.alice_bitcoin_wallet.sync_wallet().await.unwrap();
|
self.alice_bitcoin_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let btc_balance_after_swap = self.alice_bitcoin_wallet.as_ref().balance().await.unwrap();
|
let btc_balance_after_swap = self.alice_bitcoin_wallet.as_ref().balance().await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -181,7 +181,7 @@ impl TestContext {
|
|||||||
|
|
||||||
assert!(matches!(state, AliceState::XmrRefunded));
|
assert!(matches!(state, AliceState::XmrRefunded));
|
||||||
|
|
||||||
self.alice_bitcoin_wallet.sync_wallet().await.unwrap();
|
self.alice_bitcoin_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let btc_balance_after_swap = self.alice_bitcoin_wallet.as_ref().balance().await.unwrap();
|
let btc_balance_after_swap = self.alice_bitcoin_wallet.as_ref().balance().await.unwrap();
|
||||||
assert_eq!(btc_balance_after_swap, self.alice_starting_balances.btc);
|
assert_eq!(btc_balance_after_swap, self.alice_starting_balances.btc);
|
||||||
@ -200,7 +200,7 @@ impl TestContext {
|
|||||||
pub async fn assert_alice_punished(&self, state: AliceState) {
|
pub async fn assert_alice_punished(&self, state: AliceState) {
|
||||||
assert!(matches!(state, AliceState::BtcPunished));
|
assert!(matches!(state, AliceState::BtcPunished));
|
||||||
|
|
||||||
self.alice_bitcoin_wallet.sync_wallet().await.unwrap();
|
self.alice_bitcoin_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let btc_balance_after_swap = self.alice_bitcoin_wallet.as_ref().balance().await.unwrap();
|
let btc_balance_after_swap = self.alice_bitcoin_wallet.as_ref().balance().await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -219,7 +219,7 @@ impl TestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn assert_bob_redeemed(&self, state: BobState) {
|
pub async fn assert_bob_redeemed(&self, state: BobState) {
|
||||||
self.bob_bitcoin_wallet.sync_wallet().await.unwrap();
|
self.bob_bitcoin_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let lock_tx_id = if let BobState::XmrRedeemed { tx_lock_id } = state {
|
let lock_tx_id = if let BobState::XmrRedeemed { tx_lock_id } = state {
|
||||||
tx_lock_id
|
tx_lock_id
|
||||||
@ -251,7 +251,7 @@ impl TestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn assert_bob_refunded(&self, state: BobState) {
|
pub async fn assert_bob_refunded(&self, state: BobState) {
|
||||||
self.bob_bitcoin_wallet.sync_wallet().await.unwrap();
|
self.bob_bitcoin_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let lock_tx_id = if let BobState::BtcRefunded(state4) = state {
|
let lock_tx_id = if let BobState::BtcRefunded(state4) = state {
|
||||||
state4.tx_lock_id()
|
state4.tx_lock_id()
|
||||||
@ -285,7 +285,7 @@ impl TestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn assert_bob_punished(&self, state: BobState) {
|
pub async fn assert_bob_punished(&self, state: BobState) {
|
||||||
self.bob_bitcoin_wallet.sync_wallet().await.unwrap();
|
self.bob_bitcoin_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let lock_tx_id = if let BobState::BtcPunished { tx_lock_id } = state {
|
let lock_tx_id = if let BobState::BtcPunished { tx_lock_id } = state {
|
||||||
tx_lock_id
|
tx_lock_id
|
||||||
@ -636,7 +636,7 @@ async fn init_test_wallets(
|
|||||||
let max_retries = 30u8;
|
let max_retries = 30u8;
|
||||||
loop {
|
loop {
|
||||||
retries += 1;
|
retries += 1;
|
||||||
btc_wallet.sync_wallet().await.unwrap();
|
btc_wallet.sync().await.unwrap();
|
||||||
|
|
||||||
let btc_balance = btc_wallet.balance().await.unwrap();
|
let btc_balance = btc_wallet.balance().await.unwrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user