Skip to content

Commit

Permalink
Test support for running Wallet on Gigahorse fullnode.
Browse files Browse the repository at this point in the history
  • Loading branch information
guydavis committed Aug 10, 2023
1 parent 7380911 commit 19b00ce
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 25 deletions.
6 changes: 0 additions & 6 deletions api/commands/chia_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,13 @@ def restart_farmer(blockchain):
Popen("nohup sh -c '{0}' >/dev/null 2>&1 &".format(cmd), cwd=working_dir, stdout=PIPE, stderr=PIPE, shell=True)

def start_wallet(blockchain):
if blockchain == 'gigahorse':
app.logger.info("Gigahorse doesn't run it's own wallet. Machinaris uses the wallet of the main Chia container instead.")
return
chia_binary = globals.get_blockchain_binary(blockchain)
working_dir = globals.get_blockchain_working_dir(blockchain)
cmd = "{0} start wallet -r".format(chia_binary)
app.logger.info("Executing wallet start: {0}".format(cmd))
Popen("nohup sh -c '{0}' >/dev/null 2>&1 &".format(cmd), cwd=working_dir, stdout=PIPE, stderr=PIPE, shell=True)

def pause_wallet(blockchain):
if blockchain == 'gigahorse':
app.logger.info("Gigahorse doesn't run it's own wallet. Machinaris uses the wallet of the main Chia container instead.")
return
chia_binary = globals.get_blockchain_binary(blockchain)
working_dir = globals.get_blockchain_working_dir(blockchain)
if globals.legacy_blockchain(blockchain): # Old chains will stop fullnode(!) if ask to stop just the wallet...
Expand Down
4 changes: 1 addition & 3 deletions api/schedules/status_wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ def update():
try:
blockchain = globals.enabled_blockchains()[0]
hostname = utils.get_hostname()
if blockchain == 'gigahorse':
return # Gigahorse is Chia blockchain with proprietary plot files, no wallet running
elif blockchain == 'mmx':
if blockchain == 'mmx':
public_wallet = mmx_cli.load_wallet_show(blockchain)
else:
public_wallet = chia_cli.load_wallet_show(blockchain)
Expand Down
8 changes: 6 additions & 2 deletions scripts/forks/gigahorse_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ chmod 755 -R /root/.chia/mainnet/config/ssl/ &> /dev/null

/usr/bin/bash /machinaris/scripts/gpu_drivers_setup.sh

# Start services based on mode selected. Always skip a duplicate Chia wallet launch
# Start services based on mode selected.
if [[ ${mode} =~ ^fullnode.* ]]; then
/chia-gigahorse-farmer/chia.bin start farmer-no-wallet
if [ -f /root/.chia/machinaris/config/wallet_settings.json ]; then
/chia-gigahorse-farmer/chia.bin start farmer-no-wallet
else
/chia-gigahorse-farmer/chia.bin start farmer
fi
elif [[ ${mode} =~ ^farmer.* ]]; then
/chia-gigahorse-farmer/chia.bin start farmer-only
elif [[ ${mode} =~ ^harvester.* ]]; then
Expand Down
2 changes: 0 additions & 2 deletions web/actions/plotman.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ def load_key_pk(type, blockchain):

def load_pool_contract_address(blockchain):
pool_blockchain = blockchain
if blockchain == 'gigahorse': # Use the pool settings for Chia when checking for Gigahorse
pool_blockchain = 'chia'
plotnfts = p.load_plotnfts_by_blockchain(pool_blockchain)
if len(plotnfts.rows) == 1:
m = re.search('Pool contract address .*: (\w+)'.format(type), plotnfts.rows[0]['details'])
Expand Down
2 changes: 0 additions & 2 deletions web/actions/pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ def send_request(fullnode, selected_blockchain, launcher_ids, choices, pool_urls
def get_pool_configs():
configs = {}
for blockchain in po.POOLABLE_BLOCKCHAINS:
if blockchain == 'gigahorse':
continue
plotnfts = db.session.query(pn.Plotnft).filter(pn.Plotnft.blockchain == blockchain).all()
wallets = db.session.query(w.Wallet).filter(w.Wallet.blockchain == blockchain).all()
configs[blockchain] = PoolConfigs(blockchain, plotnfts, wallets)
Expand Down
2 changes: 0 additions & 2 deletions web/models/chia.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def __init__(self, blockchains, farms, wallets, stats):
app.logger.error("No farm summary found for {0}".format(blockchain['blockchain']))
continue
blockhain_for_wallet = blockchain['blockchain']
if blockhain_for_wallet == 'gigahorse':
blockhain_for_wallet = 'chia' # Same wallet
wallet = self.find_wallet(wallets, blockhain_for_wallet)
if not wallet:
app.logger.error("No wallet found for {0}".format(blockhain_for_wallet))
Expand Down
4 changes: 0 additions & 4 deletions web/models/pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ def __init__(self, plotnfts):
self.columns = ['hostname', 'details', 'updated_at']
self.rows = []
for plotnft in plotnfts:
if plotnft.blockchain == 'gigahorse':
continue # Ignore these, use Chia instead.
try:
app.logger.debug("Found worker with hostname '{0}'".format(plotnft.hostname))
displayname = w.get_worker(plotnft.hostname).displayname
Expand Down Expand Up @@ -52,8 +50,6 @@ class Pools:
def __init__(self, pools, plotnfts):
self.blockchains = {}
for pool in pools:
if pool.blockchain == 'gigahorse':
continue # Ignore these, use Chia instead.
try:
app.logger.debug("Found worker with hostname '{0}'".format(pool.hostname))
displayname = w.get_worker(pool.hostname, pool.blockchain).displayname
Expand Down
2 changes: 0 additions & 2 deletions web/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,6 @@ def settings_pools():
fullnodes_by_blockchain = worker.get_fullnodes_by_blockchain()
poolable_blockchains = []
for pb in po.POOLABLE_BLOCKCHAINS:
if pb == 'gigahorse':
continue
if pb in fullnodes_by_blockchain:
poolable_blockchains.append(pb)
return render_template('settings/pools.html', global_config=gc, fullnodes_by_blockchain=fullnodes_by_blockchain,
Expand Down
2 changes: 0 additions & 2 deletions web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ <h6 class="display-6 text-center">{{_('Total Plots Size')}}</h6>
</div>
</div>

{% if blockchain != 'gigahorse' %}
<div class="row align-items-md-stretch">
<div class="col-md-4" style="margin-top:5px; margin-bottom:5px;">
<div class="h-100 p-2 text-white bg-dark rounded-3">
Expand Down Expand Up @@ -131,7 +130,6 @@ <h6 class="display-6 text-center">{{blockchain|capitalize}} - {{_('Wallets')}}</
</div>
</div>
{% endif %}
{% endif %}

{% if farms[blockchain].challenges.labels|length > 0 %}
<div class="col-md-12" style="margin-top:5px; margin-bottom:5px;">
Expand Down

0 comments on commit 19b00ce

Please sign in to comment.