Use macro-based JSON-RPC client

This commit is contained in:
Thomas Eizinger 2021-04-15 18:39:59 +10:00
parent b46dbd738d
commit 6d06db3259
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
15 changed files with 435 additions and 846 deletions

View file

@ -197,21 +197,24 @@ async fn next_state(
BobState::BtcRedeemed(state) => {
let (spend_key, view_key) = state.xmr_keys();
let generated_wallet_file_name = &swap_id.to_string();
if monero_wallet
let generated_wallet_file_name = swap_id.to_string();
if let Err(e) = monero_wallet
.create_from_and_load(
generated_wallet_file_name,
generated_wallet_file_name.clone(),
spend_key,
view_key,
state.monero_wallet_restore_blockheight,
)
.await
.is_err()
{
// In case we failed to refresh/sweep, when resuming the wallet might already
// exist! This is a very unlikely scenario, but if we don't take care of it we
// might not be able to ever transfer the Monero.
tracing::warn!("Failed to generate monero wallet from keys, falling back to trying to open the the wallet if it already exists: {}", swap_id);
tracing::warn!("Failed to generate monero wallet from keys: {:#}", e);
tracing::info!(
"Falling back to trying to open the the wallet if it already exists: {}",
swap_id
);
monero_wallet.open(generated_wallet_file_name).await?;
}