Fix build after merge

This commit is contained in:
Tobin C. Harding 2020-10-22 14:42:36 +11:00
parent f8adf6d7e0
commit 97363cb05c
3 changed files with 15 additions and 26 deletions

View File

@ -4,12 +4,9 @@ use backoff::{future::FutureOperation as _, ExponentialBackoff};
use bitcoin::{util::psbt::PartiallySignedTransaction, Address, Transaction}; use bitcoin::{util::psbt::PartiallySignedTransaction, Address, Transaction};
use bitcoin_harness::bitcoind_rpc::PsbtBase64; use bitcoin_harness::bitcoind_rpc::PsbtBase64;
use reqwest::Url; use reqwest::Url;
use xmr_btc::{ use xmr_btc::bitcoin::{
bitcoin::{ Amount, BroadcastSignedTransaction, BuildTxLockPsbt, SignTxLock, TxLock, Txid,
Amount, BroadcastSignedTransaction, BuildTxLockPsbt, SignTxLock, TxLock, Txid, WatchForRawTransaction,
WatchForRawTransaction,
},
MedianTime,
}; };
// This is cut'n'paste from xmr_btc/tests/harness/wallet/bitcoin.rs // This is cut'n'paste from xmr_btc/tests/harness/wallet/bitcoin.rs
@ -100,16 +97,3 @@ impl WatchForRawTransaction for Wallet {
.expect("transient errors to be retried") .expect("transient errors to be retried")
} }
} }
#[async_trait]
impl MedianTime for Wallet {
async fn median_time(&self) -> u32 {
(|| async { Ok(self.0.median_time().await?) })
.retry(ExponentialBackoff {
max_elapsed_time: None,
..Default::default()
})
.await
.expect("transient errors to be retried")
}
}

View File

@ -8,8 +8,11 @@ mod tests {
use crate::{ use crate::{
harness, harness,
harness::node::{run_alice_until, run_bob_until}, harness::{
init_bitcoind, init_test, ALICE_TEST_DB_FOLDER, BOB_TEST_DB_FOLDER, init_bitcoind, init_test,
node::{run_alice_until, run_bob_until},
ALICE_TEST_DB_FOLDER, BOB_TEST_DB_FOLDER,
},
}; };
use futures::future; use futures::future;
use monero_harness::Monero; use monero_harness::Monero;
@ -258,7 +261,7 @@ mod tests {
mut bob_node, mut bob_node,
initial_balances, initial_balances,
swap_amounts, swap_amounts,
) = init_test(&monero, &bitcoind).await; ) = init_test(&monero, &bitcoind, None, None).await;
{ {
let (alice_state, bob_state) = future::try_join( let (alice_state, bob_state) = future::try_join(
@ -341,13 +344,13 @@ mod tests {
assert_eq!( assert_eq!(
alice_final_xmr_balance, alice_final_xmr_balance,
initial_balances.alice_xmr initial_balances.alice_xmr.as_piconero()
- u64::from(swap_amounts.xmr) - swap_amounts.xmr.as_piconero()
- u64::from(alice_state6.lock_xmr_fee()) - alice_state6.lock_xmr_fee().as_piconero()
); );
assert_eq!( assert_eq!(
bob_final_xmr_balance, bob_final_xmr_balance,
initial_balances.bob_xmr + u64::from(swap_amounts.xmr) initial_balances.bob_xmr.as_piconero() + swap_amounts.xmr.as_piconero()
); );
} }
} }

View File

@ -59,6 +59,8 @@ use xmr_btc::{bitcoin, monero};
const TEN_XMR: u64 = 10_000_000_000_000; const TEN_XMR: u64 = 10_000_000_000_000;
const RELATIVE_REFUND_TIMELOCK: u32 = 1; const RELATIVE_REFUND_TIMELOCK: u32 = 1;
const RELATIVE_PUNISH_TIMELOCK: u32 = 1; const RELATIVE_PUNISH_TIMELOCK: u32 = 1;
pub const ALICE_TEST_DB_FOLDER: &str = "../target/e2e-test-alice-recover";
pub const BOB_TEST_DB_FOLDER: &str = "../target/e2e-test-bob-recover";
pub async fn init_bitcoind(tc_client: &Cli) -> Bitcoind<'_> { pub async fn init_bitcoind(tc_client: &Cli) -> Bitcoind<'_> {
let bitcoind = Bitcoind::new(tc_client, "0.19.1").expect("failed to create bitcoind"); let bitcoind = Bitcoind::new(tc_client, "0.19.1").expect("failed to create bitcoind");