Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.
6 changes: 6 additions & 0 deletions config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ redis_scrypt:
# multiplier - otherwise update at next job flush
#margin_switch: 1.25

# redis host, to override default, if running on docker/docker-compose
# or a remote host
#redis:
# host: 127.0.0.1
# port: 6379

# A list of jobmanagers to switch between
#jobmanagers: REQUIRED. Expects []

Expand Down
22 changes: 18 additions & 4 deletions powerpool/jobmanagers/monitor_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,25 @@ def generate_job(self, push=False, flush=False, new_block=False, network='main')
# extranonces so script length is accurate
extranonce_length = (self.manager.config['extranonce_size'] +
self.manager.config['extranonce_serv_size'])
coinbase_kwargs = {
'addtl_push': [mm_data] if mm_data else [],
'extra_script_sig': b'\0' * extranonce_length,
'desc_string': self.config['coinbase_string']
}
try:
coinbase = Input.coinbase(self._last_gbt['height'],
**coinbase_kwargs)
except TypeError as e:
self.logger.warn('tried to mine a POW '
'block with POS interface'.format(e))
coinbase_kwargs.pop('desc_string')
coinbase = Input.coinbase(self._last_gbt['height'],
**coinbase_kwargs)

coinbase.inputs.append(
Input.coinbase(self._last_gbt['height'],
addtl_push=[mm_data] if mm_data else [],
extra_script_sig=b'\0' * extranonce_length,
desc_string=self.config['coinbase_string']))
coinbase
)


coinbase_value = self._last_gbt['coinbasevalue']

Expand Down
12 changes: 5 additions & 7 deletions powerpool/jobmanagers/switching_jobmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@


class MonitorNetworkMulti(Jobmanager):
defaults = config = dict(jobmanagers=None,
profit_poll_int=1,
redis={},
margin_switch=1.2,
exchange_manager={})

def __init__(self, config):
self._configure(config)

super(Jobmanager, self).__init__()
# Since some MonitorNetwork objs are polling and some aren't....
self.gl_methods = ['update_profit']

Expand Down Expand Up @@ -200,6 +194,10 @@ def update_profitability(self, currency):
return True

def new_job_notif(self, event):
if not hasattr('job', event):
self.logger.info("No blocks mined yet, skipping switch logic")
return

currency = event.job.currency
flush = event.job.type == 0
if currency == self.current_network:
Expand Down
1 change: 1 addition & 0 deletions powerpool/reporters/redis_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class RedisReporter(QueueStatReporter):
one_sec_stats = ['queued']
gl_methods = ['_queue_proc', '_report_one_min']
defaults = QueueStatReporter.defaults.copy()
# monkey patch for docker compose
defaults.update(dict(redis={}, chain=1))

def __init__(self, config):
Expand Down