Update mempool size display

This commit is contained in:
Taylor Helsper 2022-03-11 21:21:51 -06:00
parent cd7711e699
commit 30110f1994
4 changed files with 9 additions and 10 deletions

View File

@ -241,22 +241,21 @@ def get_bitcoin_mempool_info():
mempool = {}
mempool["size"] = "???"
mempool["count"] = "???"
mempool["bytes"] = "0"
mempool["display_bytes"] = "???"
if mempooldata != None:
mempool["display_size"] = "unknown"
if "size" in mempooldata:
mempool["size"] = mempooldata["size"]
mempool["count"] = mempooldata["size"]
if "bytes" in mempooldata:
mempool["bytes"] = mempooldata["bytes"]
mempool["display_bytes"] = "{:.1} MB".format( float(mempooldata["bytes"])/1000/1000 )
mb = round(float(mempool["bytes"] / 1000 / 1000), 2)
mempool["display_bytes"] = "{0:.10} MB".format( mb )
return copy.deepcopy(mempool)
def get_bitcoin_mempool_size():
info = get_bitcoin_mempool_info()
size = float(info["bytes"]) / 1000 / 1000
return "{:.1} MB".format(size)
def get_bitcoin_disk_usage():
info = get_bitcoin_blockchain_info()
if "size_on_disk" in info:

View File

@ -34,7 +34,7 @@ def api_get_bitcoin_info():
data["block_height"] = get_bitcoin_block_height()
data["peer_count"] = get_bitcoin_peer_count()
#data["difficulty"] = get_bitcoin_difficulty() # Dont send difficulty, it causes errors in jsonify
data["mempool_size"] = get_bitcoin_mempool_size()
data["mempool_size"] = get_bitcoin_mempool_info()["display_bytes"]
data["recommended_fees"] = get_bitcoin_recommended_fees()
# Add blocks

View File

@ -90,8 +90,8 @@ def bitcoin_status_page():
"header_num": info["headers"],
"rpc_password": rpc_password,
"disk_usage": get_bitcoin_disk_usage(),
"mempool_tx": mempool["size"],
"mempool_size": "{:.2} MB".format(float(mempool["bytes"]) / 1000 / 1000),
"mempool_tx": mempool["count"],
"mempool_size": mempool["display_bytes"],
"is_testnet_enabled": is_testnet_enabled(),
"wallets": walletdata,
"bitcoin_whitepaper_exists": bitcoin_whitepaper_exists,

View File

@ -528,7 +528,7 @@ def index():
"current_block": current_block,
"bitcoin_peer_count": get_bitcoin_peer_count(),
"bitcoin_difficulty": get_bitcoin_difficulty(),
"bitcoin_mempool_size": get_bitcoin_mempool_size(),
"bitcoin_mempool_size": get_bitcoin_mempool_info()["display_bytes"],
"bitcoin_version": get_bitcoin_version(),
"lnd_status_color": lnd_status_color,
"lnd_status": Markup(lnd_status),