Improve Bitcoin progress and error reporting UX
This commit is contained in:
parent
d6ea571eee
commit
aeae07e9c1
|
@ -67,7 +67,9 @@ def update_bitcoin_main_info():
|
||||||
if "difficulty" in info:
|
if "difficulty" in info:
|
||||||
info["difficulty"] = "{:.3g}".format(info["difficulty"])
|
info["difficulty"] = "{:.3g}".format(info["difficulty"])
|
||||||
if "verificationprogress" in info:
|
if "verificationprogress" in info:
|
||||||
info["verificationprogress"] = "{:.3g}".format(info["verificationprogress"])
|
info["verificationprogress"] = "{:.2f}%".format(100 * info["verificationprogress"])
|
||||||
|
else:
|
||||||
|
info["verificationprogress"] = "???"
|
||||||
|
|
||||||
bitcoin_blockchain_info = info
|
bitcoin_blockchain_info = info
|
||||||
|
|
||||||
|
@ -219,6 +221,14 @@ def get_mynode_block_height():
|
||||||
global mynode_block_height
|
global mynode_block_height
|
||||||
return mynode_block_height
|
return mynode_block_height
|
||||||
|
|
||||||
|
def get_bitcoin_sync_progress():
|
||||||
|
info = get_bitcoin_blockchain_info()
|
||||||
|
progress = "???"
|
||||||
|
if info:
|
||||||
|
if "verificationprogress" in info:
|
||||||
|
return info["verificationprogress"]
|
||||||
|
return progress
|
||||||
|
|
||||||
def get_bitcoin_recent_blocks():
|
def get_bitcoin_recent_blocks():
|
||||||
global bitcoin_recent_blocks
|
global bitcoin_recent_blocks
|
||||||
return copy.deepcopy(bitcoin_recent_blocks)
|
return copy.deepcopy(bitcoin_recent_blocks)
|
||||||
|
|
|
@ -32,6 +32,7 @@ def api_get_bitcoin_info():
|
||||||
data = {}
|
data = {}
|
||||||
data["current_block"] = get_mynode_block_height()
|
data["current_block"] = get_mynode_block_height()
|
||||||
data["block_height"] = get_bitcoin_block_height()
|
data["block_height"] = get_bitcoin_block_height()
|
||||||
|
data["progress"] = get_bitcoin_sync_progress()
|
||||||
data["peer_count"] = get_bitcoin_peer_count()
|
data["peer_count"] = get_bitcoin_peer_count()
|
||||||
#data["difficulty"] = get_bitcoin_difficulty() # Dont send difficulty, it causes errors in jsonify
|
#data["difficulty"] = get_bitcoin_difficulty() # Dont send difficulty, it causes errors in jsonify
|
||||||
data["mempool_size"] = get_bitcoin_mempool_info()["display_bytes"]
|
data["mempool_size"] = get_bitcoin_mempool_info()["display_bytes"]
|
||||||
|
|
|
@ -210,6 +210,7 @@ def index():
|
||||||
elif status == STATE_DRIVE_CONFIRM_FORMAT:
|
elif status == STATE_DRIVE_CONFIRM_FORMAT:
|
||||||
if request.args.get('format'):
|
if request.args.get('format'):
|
||||||
touch("/tmp/format_ok")
|
touch("/tmp/format_ok")
|
||||||
|
os.system("rm -f /home/bitcoin/.mynode/force_format_prompt")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
@ -450,7 +451,7 @@ def index():
|
||||||
"title": "myNode Status",
|
"title": "myNode Status",
|
||||||
"header_text": "Starting...",
|
"header_text": "Starting...",
|
||||||
"subheader_text": Markup("Launching myNode Services{}".format(message)),
|
"subheader_text": Markup("Launching myNode Services{}".format(message)),
|
||||||
"error_message": error_message,
|
"error_message": Markup(error_message + "<br/><br/>"),
|
||||||
"ui_settings": read_ui_settings()
|
"ui_settings": read_ui_settings()
|
||||||
}
|
}
|
||||||
return render_template('state.html', **templateData)
|
return render_template('state.html', **templateData)
|
||||||
|
@ -477,6 +478,7 @@ def index():
|
||||||
"header_text": "Bitcoin Blockchain",
|
"header_text": "Bitcoin Blockchain",
|
||||||
"bitcoin_block_height": bitcoin_block_height,
|
"bitcoin_block_height": bitcoin_block_height,
|
||||||
"mynode_block_height": mynode_block_height,
|
"mynode_block_height": mynode_block_height,
|
||||||
|
"progress": get_bitcoin_sync_progress(),
|
||||||
"message": get_message(include_funny=True),
|
"message": get_message(include_funny=True),
|
||||||
"ui_settings": read_ui_settings()
|
"ui_settings": read_ui_settings()
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,15 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
current_block = {{mynode_block_height}};
|
current_block = {{mynode_block_height}};
|
||||||
block_height = {{bitcoin_block_height}};
|
block_height = {{bitcoin_block_height}};
|
||||||
|
progress = "{{progress}}";
|
||||||
|
|
||||||
function update_counts() {
|
function update_counts() {
|
||||||
// Update Bitcoin Info
|
// Update Bitcoin Info
|
||||||
$.getJSON("/api/get_bitcoin_info", function( data ) {
|
$.getJSON("/api/get_bitcoin_info", function( data ) {
|
||||||
//console.log("Bitcoin Data: " + JSON.stringify(data))
|
//console.log("Bitcoin Data: " + JSON.stringify(data));
|
||||||
if ("current_block" in data && data["current_block"] != null &&
|
if ("current_block" in data && data["current_block"] != null &&
|
||||||
"block_height" in data && data["block_height"] != null) {
|
"block_height" in data && data["block_height"] != null &&
|
||||||
|
"progress" in data && data["progress"] != null) {
|
||||||
if (current_block != parseInt(data["current_block"])) {
|
if (current_block != parseInt(data["current_block"])) {
|
||||||
$("#current_block").fadeOut(250, function() {
|
$("#current_block").fadeOut(250, function() {
|
||||||
$(this).text(data["current_block"]);
|
$(this).text(data["current_block"]);
|
||||||
|
@ -26,6 +28,12 @@
|
||||||
}).fadeIn(250);
|
}).fadeIn(250);
|
||||||
block_height = parseInt(data["block_height"]);
|
block_height = parseInt(data["block_height"]);
|
||||||
}
|
}
|
||||||
|
if (progress != data['progress']) {
|
||||||
|
$("#progress").fadeOut(250, function() {
|
||||||
|
$(this).text(data["progress"]);
|
||||||
|
}).fadeIn(250);
|
||||||
|
progress = data["progress"];
|
||||||
|
}
|
||||||
|
|
||||||
// We're close, so do a full refresh to get to home page faster
|
// We're close, so do a full refresh to get to home page faster
|
||||||
if (current_block > (block_height - 5)) {
|
if (current_block > (block_height - 5)) {
|
||||||
|
@ -65,8 +73,14 @@
|
||||||
|
|
||||||
<div class="state_subheader">
|
<div class="state_subheader">
|
||||||
Syncing... <br/>
|
Syncing... <br/>
|
||||||
<span id="current_block">{{mynode_block_height}}</span> of <span id="block_height">{{bitcoin_block_height}}</span>
|
|
||||||
|
|
||||||
|
<div style="margin-top: 20px;">
|
||||||
|
<span id="current_block">{{mynode_block_height}}</span> of <span id="block_height">{{bitcoin_block_height}}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="progress" style='margin-top: 10px; font-size: 14px;'>{{progress}}</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
<div id="message" class='small_message'>{{ message }}</div>
|
<div id="message" class='small_message'>{{ message }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user