mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-02 11:36:09 -04:00
Derive bitcoin private key from seed
This commit is contained in:
parent
a51194b9fa
commit
4768c79070
5 changed files with 64 additions and 15 deletions
|
@ -346,6 +346,9 @@ where
|
|||
.get_host_port(testutils::electrs::HTTP_PORT)
|
||||
.expect("Could not map electrs http port");
|
||||
|
||||
let alice_seed = Seed::random().unwrap();
|
||||
let bob_seed = Seed::random().unwrap();
|
||||
|
||||
let (alice_bitcoin_wallet, alice_monero_wallet) = init_test_wallets(
|
||||
"alice",
|
||||
containers.bitcoind_url.clone(),
|
||||
|
@ -354,6 +357,7 @@ where
|
|||
tempdir().unwrap().path(),
|
||||
electrs_rpc_port,
|
||||
electrs_http_port,
|
||||
alice_seed,
|
||||
)
|
||||
.await;
|
||||
|
||||
|
@ -375,6 +379,7 @@ where
|
|||
tempdir().unwrap().path(),
|
||||
electrs_rpc_port,
|
||||
electrs_http_port,
|
||||
bob_seed,
|
||||
)
|
||||
.await;
|
||||
|
||||
|
@ -570,6 +575,7 @@ async fn init_monero_container(
|
|||
(monero, monerods)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn init_test_wallets(
|
||||
name: &str,
|
||||
bitcoind_url: Url,
|
||||
|
@ -578,6 +584,7 @@ async fn init_test_wallets(
|
|||
datadir: &Path,
|
||||
electrum_rpc_port: u16,
|
||||
electrum_http_port: u16,
|
||||
seed: Seed,
|
||||
) -> (Arc<bitcoin::Wallet>, Arc<monero::Wallet>) {
|
||||
monero
|
||||
.init(vec![(name, starting_balances.xmr.as_piconero())])
|
||||
|
@ -603,6 +610,9 @@ async fn init_test_wallets(
|
|||
electrum_http_url,
|
||||
bitcoin::Network::Regtest,
|
||||
datadir,
|
||||
seed.extended_private_key(bitcoin::Network::Regtest)
|
||||
.expect("Could not create extended private key from seed")
|
||||
.private_key,
|
||||
)
|
||||
.await
|
||||
.expect("could not init btc wallet");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue