Generate addresses as late as possible

This commit is contained in:
Lucas Soriano del Pino 2020-10-28 10:22:09 +11:00
parent 3f43581da7
commit 9e30bd5151
3 changed files with 11 additions and 35 deletions

View file

@ -47,8 +47,6 @@ pub async fn swap(
monero_wallet: Arc<monero::Wallet>,
listen: Multiaddr,
local_port: Option<u16>,
redeem_address: ::bitcoin::Address,
punish_address: ::bitcoin::Address,
) -> Result<()> {
struct Network {
swarm: Arc<Mutex<Swarm>>,
@ -131,6 +129,9 @@ pub async fn swap(
None => unreachable!("should have amounts by here"),
};
let redeem_address = bitcoin_wallet.as_ref().new_address().await?;
let punish_address = redeem_address.clone();
// TODO: Pass this in using <R: RngCore + CryptoRng>
let rng = &mut OsRng;
let state0 = State0::new(