mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-27 06:54:00 +00:00
Add download link for wallet.dat and wallet info if funds have been stored in bitcoin core
This commit is contained in:
parent
d0e9ac9cf7
commit
822487d3db
|
@ -12,6 +12,7 @@ mynode_block_height = 566000
|
|||
bitcoin_blockchain_info = None
|
||||
bitcoin_recent_blocks = None
|
||||
bitcoin_peers = []
|
||||
bitcoin_wallet_info = None
|
||||
bitcoin_mempool = None
|
||||
bitcoin_version = None
|
||||
|
||||
|
@ -65,6 +66,7 @@ def update_bitcoin_other_info():
|
|||
global bitcoin_recent_blocks
|
||||
global bitcoin_peers
|
||||
global bitcoin_mempool
|
||||
global bitcoin_wallet_info
|
||||
|
||||
if bitcoin_blockchain_info == None:
|
||||
# We still havent gotten the important info... wait 1 minute and return
|
||||
|
@ -89,6 +91,9 @@ def update_bitcoin_other_info():
|
|||
|
||||
# Get mempool
|
||||
bitcoin_mempool = rpc_connection.getmempoolinfo()
|
||||
|
||||
# Get wallet info
|
||||
bitcoin_wallet_info = rpc_connection.getwalletinfo()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -122,6 +127,10 @@ def get_bitcoin_mempool():
|
|||
global bitcoin_mempool
|
||||
return copy.deepcopy(bitcoin_mempool)
|
||||
|
||||
def get_bitcoin_wallet_info():
|
||||
global bitcoin_wallet_info
|
||||
return copy.deepcopy(bitcoin_wallet_info)
|
||||
|
||||
def get_default_bitcoin_config():
|
||||
try:
|
||||
with open("/usr/share/mynode/bitcoin.conf") as f:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from flask import Blueprint, render_template, session, abort, Markup, request, redirect, flash
|
||||
from flask import Blueprint, render_template, session, send_from_directory, abort, Markup, request, redirect, flash
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from pprint import pprint, pformat
|
||||
from bitcoin_info import *
|
||||
|
@ -109,6 +109,7 @@ def bitcoind_status_page():
|
|||
blockdata = get_bitcoin_recent_blocks()
|
||||
peerdata = get_bitcoin_peers()
|
||||
mempooldata = get_bitcoin_mempool()
|
||||
walletdata = get_bitcoin_wallet_info()
|
||||
version = get_bitcoin_version()
|
||||
rpc_password = get_bitcoin_rpc_password()
|
||||
|
||||
|
@ -157,6 +158,16 @@ def bitcoind_status_page():
|
|||
|
||||
peers.append(peer)
|
||||
|
||||
# Balance
|
||||
walletinfo = {}
|
||||
walletinfo["balance"] = 0.0
|
||||
walletinfo["unconfirmed_balance"] = 0.0
|
||||
if walletdata != None:
|
||||
if "balance" in walletdata:
|
||||
walletinfo["balance"] = walletdata["balance"]
|
||||
if "unconfirmed_balance" in walletdata:
|
||||
walletinfo["unconfirmed_balance"] = walletdata["unconfirmed_balance"]
|
||||
|
||||
except Exception as e:
|
||||
templateData = {
|
||||
"title": "myNode Bitcoin Error",
|
||||
|
@ -177,11 +188,18 @@ def bitcoind_status_page():
|
|||
"disk_size": (int(info["size_on_disk"]) / 1000 / 1000 / 1000),
|
||||
"mempool_tx": mempool["size"],
|
||||
"mempool_size": "{:.3} MB".format(float(mempool["bytes"]) / 1000 / 1000),
|
||||
"confirmed_balance": walletinfo["balance"],
|
||||
"unconfirmed_balance": walletinfo["unconfirmed_balance"],
|
||||
"version": version,
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('bitcoind_status.html', **templateData)
|
||||
|
||||
@mynode_bitcoind.route("/bitcoind/wallet.dat")
|
||||
def lnd_tls_cert():
|
||||
check_logged_in()
|
||||
return send_from_directory(directory="/mnt/hdd/mynode/bitcoin/", filename="wallet.dat")
|
||||
|
||||
@mynode_bitcoind.route("/bitcoind/reset_config")
|
||||
def bitcoin_reset_config_page():
|
||||
check_logged_in()
|
||||
|
|
|
@ -57,6 +57,14 @@
|
|||
<div class="info_tile_header">Mempool Size</div>
|
||||
<div class="info_tile_contents">{{mempool_size}}</div>
|
||||
</div>
|
||||
{% if confirmed_balance > 0.0 or unconfirmed_balance > 0.0 %}
|
||||
<div class="info_tile">
|
||||
<div class="info_tile_header">Wallet Backup</div>
|
||||
<div class="info_tile_contents">
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/bitcoind/wallet.dat">download</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="info_tile">
|
||||
<div class="info_tile_header">RPC Password</div>
|
||||
<div class="info_tile_contents">
|
||||
|
@ -72,6 +80,23 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% if confirmed_balance > 0.0 %}
|
||||
<br/>
|
||||
<div class="main_header">Wallet balance</div>
|
||||
<table class="bitcoind_table">
|
||||
<thead class="bitcoind_table_header">
|
||||
<td>Confirmed Balance</td>
|
||||
<td>Unconfirmed Balance</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ "%.8f"|format(confirmed_balance) }}</td>
|
||||
<td>{{ "%.8f"|format(unconfirmed_balance) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
<br/>
|
||||
<div class="main_header">Recent Blocks</div>
|
||||
<table class="bitcoind_table">
|
||||
|
|
Loading…
Reference in New Issue
Block a user