mirror of
https://github.com/Revertron/Alfis
synced 2024-11-11 01:10:36 +00:00
Fixed unavailability to mine domains after some errors.
This commit is contained in:
parent
cd65a0e020
commit
5a089b5cd0
@ -362,10 +362,12 @@ fn action_create_domain(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>,
|
|||||||
let context = context.lock().unwrap();
|
let context = context.lock().unwrap();
|
||||||
if context.get_keystore().is_none() {
|
if context.get_keystore().is_none() {
|
||||||
show_warning(web_view, "You don't have keys loaded!<br>Load or mine the keys and try again.");
|
show_warning(web_view, "You don't have keys loaded!<br>Load or mine the keys and try again.");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if context.chain.is_waiting_signers() {
|
if context.chain.is_waiting_signers() {
|
||||||
show_warning(web_view, "Waiting for last full block to be signed. Try again later.");
|
show_warning(web_view, "Waiting for last full block to be signed. Try again later.");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
info!("Waiting for last full block to be signed. Try again later.");
|
info!("Waiting for last full block to be signed. Try again later.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -375,6 +377,7 @@ fn action_create_domain(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>,
|
|||||||
Ok(data) => { data }
|
Ok(data) => { data }
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
show_warning(web_view, "Something wrong with domain data. I cannot mine it.");
|
show_warning(web_view, "Something wrong with domain data. I cannot mine it.");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
warn!("Error parsing data: {}", e);
|
warn!("Error parsing data: {}", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -387,6 +390,7 @@ fn action_create_domain(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>,
|
|||||||
for record in &data.records {
|
for record in &data.records {
|
||||||
if !is_yggdrasil_record(record) {
|
if !is_yggdrasil_record(record) {
|
||||||
show_warning(web_view, &format!("Zone {} is Yggdrasil only, you cannot use IPs from clearnet!", &data.zone));
|
show_warning(web_view, &format!("Zone {} is Yggdrasil only, you cannot use IPs from clearnet!", &data.zone));
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,14 +406,30 @@ fn action_create_domain(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>,
|
|||||||
let _ = web_view.eval("domainMiningStarted();");
|
let _ = web_view.eval("domainMiningStarted();");
|
||||||
event_info(web_view, &format!("Mining of domain \\'{}\\' has started", &name));
|
event_info(web_view, &format!("Mining of domain \\'{}\\' has started", &name));
|
||||||
}
|
}
|
||||||
MineResult::WrongName => { show_warning(web_view, "You can't mine this domain!"); }
|
MineResult::WrongName => {
|
||||||
MineResult::WrongData => { show_warning(web_view, "You have an error in records!"); }
|
show_warning(web_view, "You can't mine this domain!");
|
||||||
MineResult::WrongKey => { show_warning(web_view, "You can't mine with current key!"); }
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
MineResult::WrongZone => { show_warning(web_view, "You can't mine domain in this zone!"); }
|
}
|
||||||
MineResult::NotOwned => { show_warning(web_view, "This domain is already taken, and it is not yours!"); }
|
MineResult::WrongData => {
|
||||||
|
show_warning(web_view, "You have an error in records!");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
|
}
|
||||||
|
MineResult::WrongKey => {
|
||||||
|
show_warning(web_view, "You can't mine with current key!");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
|
}
|
||||||
|
MineResult::WrongZone => {
|
||||||
|
show_warning(web_view, "You can't mine domain in this zone!");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
|
}
|
||||||
|
MineResult::NotOwned => {
|
||||||
|
show_warning(web_view, "This domain is already taken, and it is not yours!");
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
|
}
|
||||||
MineResult::Cooldown { time } => {
|
MineResult::Cooldown { time } => {
|
||||||
event_info(web_view, &format!("You have cooldown, just {} more minutes!", time / 60));
|
event_info(web_view, &format!("You have cooldown, just {} more minutes!", time / 60));
|
||||||
show_warning(web_view, &format!("You have cooldown, just {} more minutes!", time / 60));
|
show_warning(web_view, &format!("You have cooldown, just {} more minutes!", time / 60));
|
||||||
|
let _ = web_view.eval("domainMiningUnavailable();");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,18 @@ function domainMiningStarted() {
|
|||||||
document.getElementById("new_key_button").disabled = true;
|
document.getElementById("new_key_button").disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function domainMiningUnavailable() {
|
||||||
|
//recordsBuffer = [];
|
||||||
|
//refreshRecordsList();
|
||||||
|
document.getElementById("new_domain_dialog").className = "modal";
|
||||||
|
document.getElementById("tab_domains").disabled = true;
|
||||||
|
document.getElementById("domain_records").disabled = true;
|
||||||
|
document.getElementById("add_record_button").disabled = true;
|
||||||
|
document.getElementById("new_domain_button").disabled = true;
|
||||||
|
document.getElementById("new_zone_button").disabled = true;
|
||||||
|
document.getElementById("new_key_button").disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
function createZone() {
|
function createZone() {
|
||||||
var new_zone = document.getElementById("new_zone").value;
|
var new_zone = document.getElementById("new_zone").value;
|
||||||
var difficulty = document.getElementById("new_zone_difficulty").value;
|
var difficulty = document.getElementById("new_zone_difficulty").value;
|
||||||
|
Loading…
Reference in New Issue
Block a user