Skip to content

Commit

Permalink
Upgrade internal bitcoind version (#1173)
Browse files Browse the repository at this point in the history
* Update default Bitcoin version to 0.21.1

* Upgrade internal Bitcoin Core option

* Condition package of bitcoind on linux

* Fix

* Fix the cypress tests

Co-authored-by: Stepan Snigirev <[email protected]>
  • Loading branch information
ben-kaufman and stepansnigirev authored May 24, 2021
1 parent e50fcac commit 2d89b54
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 30 deletions.
1 change: 1 addition & 0 deletions cypress/integration/spec_node_configured.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('Node Configured', () => {
// unfortunately this results in weird effects in cypress run
//cy.get('#pdf-wallet-download > img').click()
cy.task("node:mine")
cy.wait(10000)
cy.get('#btn_continue').click()
cy.get('#btn_transactions').click()
cy.get('#fullbalance_amount')
Expand Down
4 changes: 3 additions & 1 deletion cypress/integration/spec_wallet_send.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ describe('Send transactions from wallets', () => {
// Download PDF
// unfortunately this results in weird effects in cypress run
//cy.get('#pdf-wallet-download > img').click()
cy.task("node:mine")
cy.get('#btn_continue').click()
cy.get('#btn_transactions').click()
cy.task("node:mine")
cy.wait(10000)
cy.get('#wallets-loading-done-refresh', { timeout: 10000 }).click()
cy.get('#fullbalance_amount')
.should(($div) => {
Expand Down Expand Up @@ -70,6 +71,7 @@ describe('Send transactions from wallets', () => {
cy.get('#page_overlay_popup_cancel_button').click()
// Send transaction
cy.task("node:mine")
cy.wait(10000)
cy.get('#btn_transactions').click()
cy.get('#wallets-loading-done-refresh', { timeout: 10000 }).click()
cy.reload()
Expand Down
44 changes: 22 additions & 22 deletions pyinstaller/bitcoind/SHA256SUMS.asc
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

43416854330914992bbba2d0e9adf2a6fff4130be9af8ae2ef1186e743d9a3fe bitcoin-0.21.0-aarch64-linux-gnu.tar.gz
f028af308eda45a3c4c90f9332f96b075bf21e3495c945ebce48597151808176 bitcoin-0.21.0-arm-linux-gnueabihf.tar.gz
695fb624fa6423f5da4f443b60763dd1d77488bfe5ef63760904a7b54e91298d bitcoin-0.21.0-osx64.tar.gz
6223fd23d07133a6bfa2aa3d2554a09dc1d790d28ce67b0085d3fdcc1c126e05 bitcoin-0.21.0-osx.dmg
f8b2adfeae021a672effbc7bd40d5c48d6b94e53b2dd660f787340bf1a52e4e9 bitcoin-0.21.0-riscv64-linux-gnu.tar.gz
1a91202c62ee49fb64d57a52b8d6d01cd392fffcbef257b573800f9289655f37 bitcoin-0.21.0.tar.gz
385a67cc4cf45558c05eb85fc500046cf033f816637fe0bff80d30debfca0128 bitcoin-0.21.0-win64-setup-unsigned.exe
1d0052c4ce80227fb6d0bc1c4e673ba21033e219c1f935d25f130ef7f43360d4 bitcoin-0.21.0-win64.zip
da7766775e3f9c98d7a9145429f2be8297c2672fe5b118fd3dc2411fb48e0032 bitcoin-0.21.0-x86_64-linux-gnu.tar.gz
28264751c982d30b9330e6c1475ddb9ed28be6a2601e8a5f33b6ba49a3d9f5f2 bitcoin-0.21.1-aarch64-linux-gnu.tar.gz
3a92e312ffd3ca92579d46ec52e3dcb1b09bbdd11fe7c6a735e8546c7d9975e0 bitcoin-0.21.1-arm-linux-gnueabihf.tar.gz
1ea5cedb64318e9868a66d3ab65de14516f9ada53143e460d50af428b5aec3c7 bitcoin-0.21.1-osx64.tar.gz
2df15131cd18fd1941adc26f014012b437ccaadab39f1f5dc10282a68e8f9923 bitcoin-0.21.1-osx.dmg
259d74f13271dc51eb4db4b733fb1589038ff7819e849d2351e899f67de218c5 bitcoin-0.21.1-riscv64-linux-gnu.tar.gz
caff23449220cf45753f312cefede53a9eac64000bb300797916526236b6a1e0 bitcoin-0.21.1.tar.gz
afdd0f1717a74af01b88631d17a2f29f89d21ca2e3be0fec0678e7a1e20712d5 bitcoin-0.21.1-win64-setup-unsigned.exe
94c80f90184cdc7e7e75988a55b38384de262336abd80b1b30121c6e965dc74e bitcoin-0.21.1-win64.zip
366eb44a7a0aa5bd342deea215ec19a184a11f2ca22220304ebb20b9c8917e2b bitcoin-0.21.1-x86_64-linux-gnu.tar.gz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJgXPg5AAoJEJDIAZ42wulkkl4P/jq29Je7Uqn75jkpvT8ilB8M
5nM60ORBSsCyJHryS5sJeljLx/i8JTYkL10nUTpGDlFA3DOjM5MXgAHMJdYles7c
PFO6TAqjrDWHgpc/HuPUCiF84N47u8xXcyWuoUjcgfLuV0K6l/1unCw6ISXZEdhy
WTDZuqy+9lw9nWQA7VyIP+gfgMzgiH9P6x+ru9cYcXmimCv0TUtKp8iwUnW7QmrT
aDtQJPs9sNWxjIa4WP5l4FKFlRErAyiHA24apQkOhn8YLSrIEATFE2t89HwvmIoV
kv2BmQDrCUceC1OneFzmDP3JXJ0qa8wisw2gbUyO3EoSHfs/dlEG4+4NUQxtIwwX
JQmaB7HII6UI86kIVIBWKA19hNiAxljSKgG7blP7+J2EKC+IDqZhuYHjpYCiJg5V
2NSB3YE0sgKNyLPJN4OSA0h9nsBbEzHWm+BRgnkpPSsi2HSnczKzZwES31p9EGX1
PYi4A1nk/kOFKCZh0uvaBKWR4h3MrLB9ABv3QqmkLeEJamLDfZPDC/35WRs9Z7kQ
CUER5yMoJxq7aGjYSdd0jMxDL4akXRwf5DSN++voil3zWAqWS6XaH+9RtGmqFrZr
uso8UR3RkAwgC5HQwgtEcyewA9xxz4MHx5UN5D+YzaejJvdDJBEa9oLry21EA34U
071d1dTERe21zpnLj1EL
=yP9G
iQIcBAEBCAAGBQJgja0mAAoJEJDIAZ42wulkV+IQAI84JuMhIs5muAqTX6G/sxPV
sJ2RJ5aansLEcnFQrrmUNqXpGRB+yiCwlUg9cXLV6zKQkdmDnSuqhTGbivFDLoO3
WeEcQdvkUEodHOk9NK8AVB8NGRK2lkevij4OK0jUUdSVg31dJsygs09TKQGmfXKJ
QnGR7Oz4h/BExrzYfC6PY3AYVJXOkVR86hb2w4r33xNy9DMkvxqbX+B9v1fvqO/V
arcPriVKd0YiEi5nIV5/4ghkHGPAakXzd49DgxW8BVXXqPILBS/MatjgQ5BWJWpK
p4B6V0FYJ2ZpvaTWNBOllUTNRq7YACcKSAEyW3cD9aNPz4o8mb3O7LMr+qb2z0+4
KZuubmOT3sJD37nsZ7DfmERQ7hFYHdlqvthCEQQyglasEZrsLnuCJQNGOSAT+ixM
8jPf3XFDNWm3QFS5icAmykzOWSV4Z0WcQfDjIRbcoXR09N5PgYavhSiwPqpfQ94/
q2igiMmIPH8rlRySc9fKfpYomkWP4W1vfm/wIeSrNm2oNeedL4/4zcv4v6mmnQhO
+i1Npk1TY9+pMAh5xrjUxw3W1QgpVxttIlRmKw6StpVB2Lxl+bGAXp5N7hA8znWX
3AHSDYcdIVEpjvAWGpNPspsyrDv42zElgR8PqS462d/Go6HHhIqd+wHoRIEJTfXM
m6bC44Ak09Ayxu4IxxBw
=5612
-----END PGP SIGNATURE-----
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 3 additions & 4 deletions pyinstaller/specterd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if platform.system() == 'Windows':
binaries = [("./windll/libusb-1.0.dll", ".")]
packaged_software_datas = [
('./torbrowser/tor-win64-0.4.5.7.zip', 'torbrowser'),
('./bitcoind/bitcoin-0.21.0-win64.zip', 'bitcoind'),
('./bitcoind/bitcoin-0.21.1-win64.zip', 'bitcoind'),
]
elif platform.system() == 'Linux':
if platform.processor() == 'aarch64': #ARM 64 bit
Expand All @@ -33,16 +33,15 @@ elif platform.system() == 'Linux':
break
packaged_software_datas = [
('./torbrowser/tor-browser-linux64-10.0.15_en-US.tar.xz', 'torbrowser'),
('./bitcoind/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz', 'bitcoind'),
('./bitcoind/bitcoin-0.21.0-arm-linux-gnueabihf.tar.gz', 'bitcoind'),
('./bitcoind/bitcoin-0.21.1' + ('-arm-linux-gnueabihf.tar.gz' if "armv" in platform.machine() else '-x86_64-linux-gnu.tar.gz'), 'bitcoind')
]
elif platform.system() == 'Darwin':
find_brew_libusb_proc = subprocess.Popen(['brew', '--prefix', 'libusb'], stdout=subprocess.PIPE)
libusb_path = find_brew_libusb_proc.communicate()[0]
binaries = [(libusb_path.rstrip().decode() + "/lib/libusb-1.0.dylib", ".")]
packaged_software_datas = [
('./torbrowser/TorBrowser-10.0.15-osx64_en-US.dmg', 'torbrowser'),
('./bitcoind/bitcoin-0.21.0-osx64.tar.gz', 'bitcoind'),
('./bitcoind/bitcoin-0.21.1-osx64.tar.gz', 'bitcoind'),
]

a = Analysis(['specterd.py'],
Expand Down
2 changes: 1 addition & 1 deletion src/cryptoadvance/specter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class BaseConfig(object):
SPECTER_SSL_CERT_SERIAL_NUMBER = int(
os.getenv("SPECTER_SSL_CERT_SERIAL_NUMBER", random.randrange(1, 100000))
)
INTERNAL_BITCOIND_VERSION = os.getenv("INTERNAL_BITCOIND_VERSION", "0.21.0")
INTERNAL_BITCOIND_VERSION = os.getenv("INTERNAL_BITCOIND_VERSION", "0.21.1")

# Block explorers URLs
EXPLORERS_LIST = {
Expand Down
19 changes: 19 additions & 0 deletions src/cryptoadvance/specter/managers/node_manager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os
import logging
import secrets
import shutil

from ..rpc import get_default_datadir
from ..specter_error import SpecterError
from ..persistence import write_node, delete_file
from ..helpers import alias, load_jsons
from ..node import Node
from ..internal_node import InternalNode
from ..util.bitcoind_setup_tasks import setup_bitcoind_thread

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -91,6 +93,23 @@ def get_by_alias(self, alias):
return self.nodes[node_name]
raise SpecterError("Node %s does not exist!" % alias)

def update_bitcoind_version(self, specter, version):
stopped_nodes = []
for node in (node for node in self.nodes.values() if not node.external_node):
if node.is_bitcoind_running():
node.stop()
stopped_nodes.append(node.alias)
shutil.rmtree(
os.path.join(specter.data_folder, "bitcoin-binaries"),
ignore_errors=True,
)
setup_bitcoind_thread(specter, version)
for node in (node for node in self.nodes.values() if not node.external_node):
node.version = version
write_node(node, node.fullpath)
for node_alias in stopped_nodes:
self.get_by_alias(node_alias).start(timeout=60)

def add_node(
self,
name,
Expand Down
14 changes: 13 additions & 1 deletion src/cryptoadvance/specter/server_endpoints/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,22 @@ def internal_node_settings(node_alias):
)
except Exception as e:
flash(f"Failed to remove Bitcoin Core, error: {e}", "error")

elif action == "upgrade_bitcoind":
if node.version != app.config["INTERNAL_BITCOIND_VERSION"]:
try:
app.specter.node_manager.update_bitcoind_version(
app.specter, app.config["INTERNAL_BITCOIND_VERSION"]
)
except Exception as e:
flash(
f"Failed to upgrade Bitcoin Core version, error: {e}", "error"
)
else:
flash("Bitcoin Core version is already up to date")
return render_template(
"node/internal_node_settings.jinja",
node=node,
latest_bitcoind=app.config["INTERNAL_BITCOIND_VERSION"],
node_alias=node_alias,
specter=app.specter,
rand=rand,
Expand Down
2 changes: 1 addition & 1 deletion src/cryptoadvance/specter/specter.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def migrate_old_node_format(self):
self,
self.bitcoind_path,
"mainnet",
self.internal_bitcoind_version,
"0.20.1",
)
write_node(
internal_node,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
<div class="card" style="margin: 20px auto 120px; text-align: center;">
<h2>Built in Bitcoin Node Status: {% if node.bitcoind.status %}{{node.bitcoind.status}}{% else %}Down{% endif %}</h2><br>
<span class="note" style="font-size: 1.3em;">Bitcoin Core Version: {{node.version}}</span>
{% if node.version != latest_bitcoind %}
<br><br>
<div class="warning" style="padding: 30px;">
<h1 style="text-align: center; color: #000">New Bitcoin version available!</h1>
<button type="submit" name="action" value="upgrade_bitcoind" class="btn action centered">Upgrade Bitcoin Core version to: v{{ latest_bitcoind }}</button>
</div>
{% endif %}
<br><br>
{% if node.bitcoin_pid %}
<button type="submit" class="btn centered" name="action" value="stopbitcoind">Stop Bitcoin Core</button>
Expand Down

0 comments on commit 2d89b54

Please sign in to comment.