Add Local Bitcoin Address

This commit is contained in:
Taylor Helsper 2020-04-20 20:19:56 -05:00
parent f199348d0d
commit 4349e4ddf6
3 changed files with 25 additions and 0 deletions

View File

@ -12,6 +12,7 @@ mynode_block_height = 566000
bitcoin_blockchain_info = None
bitcoin_recent_blocks = None
bitcoin_peers = []
bitcoin_network_info = None
bitcoin_wallet_info = None
bitcoin_mempool = None
bitcoin_version = None
@ -65,6 +66,7 @@ def update_bitcoin_other_info():
global bitcoin_blockchain_info
global bitcoin_recent_blocks
global bitcoin_peers
global bitcoin_network_info
global bitcoin_mempool
global bitcoin_wallet_info
@ -89,6 +91,9 @@ def update_bitcoin_other_info():
# Get peers
bitcoin_peers = rpc_connection.getpeerinfo()
# Get network info
bitcoin_network_info = rpc_connection.getnetworkinfo()
# Get mempool
bitcoin_mempool = rpc_connection.getmempoolinfo()
@ -123,6 +128,10 @@ def get_bitcoin_peers():
global bitcoin_peers
return copy.deepcopy(bitcoin_peers)
def get_bitcoin_network_info():
global bitcoin_network_info
return copy.deepcopy(bitcoin_network_info)
def get_bitcoin_mempool():
global bitcoin_mempool
return copy.deepcopy(bitcoin_mempool)

View File

@ -117,6 +117,7 @@ def bitcoind_status_page():
info = get_bitcoin_blockchain_info()
blockdata = get_bitcoin_recent_blocks()
peerdata = get_bitcoin_peers()
networkdata = get_bitcoin_network_info()
mempooldata = get_bitcoin_mempool()
walletdata = get_bitcoin_wallet_info()
version = get_bitcoin_version()
@ -167,6 +168,13 @@ def bitcoind_status_page():
peers.append(peer)
# Local address
local_address = "..."
if networkdata != None:
local_address = "not none"
if "localaddresses" in networkdata:
local_address = "{}:{}".format(networkdata["localaddresses"][0]["address"], networkdata["localaddresses"][0]["port"])
# Balance
walletinfo = {}
walletinfo["balance"] = 0.0
@ -190,6 +198,7 @@ def bitcoind_status_page():
"title": "myNode Bitcoin Status",
"blocks": blocks,
"peers": peers,
"local_address": local_address,
"difficulty": "{:.3g}".format(info["difficulty"]),
"block_num": info["blocks"],
"header_num": info["headers"],

View File

@ -90,6 +90,13 @@
</div>
</div>
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">Local Bitcoin Address / Port</div>
<div class="info_tile_contents">{{local_address}}</div>
</div>
</div>
{% if confirmed_balance > 0.0 %}
<br/>
<div class="main_header">Wallet balance</div>