Fix electrum query failing (CloseNotify bug) and use a more stable mainnet electrum server.

This commit is contained in:
devbordecraft 2021-12-11 16:56:33 +01:00
parent 8849fa3726
commit 250d25ada6
4 changed files with 20 additions and 11 deletions

View File

@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The ASB to no longer work as a rendezvous server.
The ASB can still register with rendezvous server as usual.
### Fixed
- Mitigate CloseNotify bug #797 by retrying getting ScriptStatus if it fail and using a more stable public mainnet electrum server.
## [0.9.0] - 2021-10-07
### Changed

View File

@ -58,7 +58,7 @@ impl GetDefaults for Mainnet {
data_dir: default_asb_data_dir()?.join("mainnet"),
listen_address_tcp: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9939")?,
listen_address_ws: Multiaddr::from_str("/ip4/0.0.0.0/tcp/9940/ws")?,
electrum_rpc_url: Url::parse("ssl://electrum.blockstream.info:50002")?,
electrum_rpc_url: Url::parse("ssl://blockstream.info:700")?,
monero_wallet_rpc_url: Url::parse("http://127.0.0.1:18083/json_rpc")?,
price_ticker_ws_url: Url::parse("wss://ws.kraken.com")?,
bitcoin_confirmation_target: 3,

View File

@ -149,18 +149,21 @@ impl Wallet {
Ok(new_status) => new_status,
Err(error) => {
tracing::warn!(%txid, "Failed to get status of script: {:#}", error);
return;
ScriptStatus::Retrying
}
};
if new_status != ScriptStatus::Retrying
{
last_status = Some(print_status_change(txid, last_status, new_status));
last_status = Some(print_status_change(txid, last_status, new_status));
let all_receivers_gone = sender.send(new_status).is_err();
if all_receivers_gone {
tracing::debug!(%txid, "All receivers gone, removing subscription");
client.lock().await.subscriptions.remove(&(txid, script));
return;
let all_receivers_gone = sender.send(new_status).is_err();
if all_receivers_gone {
tracing::debug!(%txid, "All receivers gone, removing subscription");
client.lock().await.subscriptions.remove(&(txid, script));
return;
}
}
}
});
@ -823,6 +826,7 @@ pub enum ScriptStatus {
Unseen,
InMempool,
Confirmed(Confirmed),
Retrying,
}
impl ScriptStatus {
@ -898,6 +902,7 @@ impl fmt::Display for ScriptStatus {
match self {
ScriptStatus::Unseen => write!(f, "unseen"),
ScriptStatus::InMempool => write!(f, "in mempool"),
ScriptStatus::Retrying => write!(f, "retrying"),
ScriptStatus::Confirmed(inner) => {
write!(f, "confirmed with {} blocks", inner.confirmations())
}

View File

@ -19,7 +19,7 @@ pub const DEFAULT_MONERO_DAEMON_ADDRESS: &str = "node.melo.tools:18081";
pub const DEFAULT_MONERO_DAEMON_ADDRESS_STAGENET: &str = "stagenet.melo.tools:38081";
// See: https://1209k.com/bitcoin-eye/ele.php?chain=btc
const DEFAULT_ELECTRUM_RPC_URL: &str = "ssl://electrum.blockstream.info:50002";
const DEFAULT_ELECTRUM_RPC_URL: &str = "ssl://blockstream.info:700";
// See: https://1209k.com/bitcoin-eye/ele.php?chain=tbtc
pub const DEFAULT_ELECTRUM_RPC_URL_TESTNET: &str = "ssl://electrum.blockstream.info:60002";