Skip to content

Support addresses with different versionBytes #36

@luislhl

Description

@luislhl

While testing running a private network with versionBytes different from the testnet/mainnet, I got an error in tx-mining-service, which was not accepting those addresses.

The error occurred when I tried to run a cpuminer configured with the address and pointing to tx-mining-service:

txstratum.utils - ERROR - 2021-11-04 21:52.31 [error    ] Fatal error: protocol.data_received() call failed. protocol=<txstratum.protocol.StratumProtocol object at 0x7f8eb243e9a0> transport=<_SelectorSocketTransport fd=9 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 870, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/txstratum/utils.py", line 114, in data_received
    self.line_received(line)
  File "/txstratum/utils.py", line 155, in line_received
    self.json_received(data)
  File "/txstratum/utils.py", line 159, in json_received
    if self.try_as_request(data):
  File "/txstratum/utils.py", line 175, in try_as_request
    self.handle_request(method, params, msgid)
  File "/txstratum/utils.py", line 208, in handle_request
    fn(params, msgid)
  File "/txstratum/protocol.py", line 164, in method_subscribe
    self.start_if_ready()
  File "/txstratum/protocol.py", line 329, in start_if_ready
    self.manager.mark_connection_as_ready(self)
  File "/txstratum/manager.py", line 105, in mark_connection_as_ready
    self.update_miner_job(protocol)
  File "/txstratum/manager.py", line 117, in update_miner_job
    protocol.update_job(job, clean=clean)
  File "/txstratum/protocol.py", line 350, in update_job
    job.set_mining_address(self.miner_address)
  File "/txstratum/jobs.py", line 275, in set_mining_address
    self._block.outputs[0].script = create_output_script(address)
  File "/usr/local/lib/python3.9/site-packages/hathorlib/scripts.py", line 483, in create_output_script
    raise ScriptError('The address is not valid')
hathorlib.exceptions.ScriptError: The address is not valid

To reproduce it, you should follow the privatenet guide in our RFCs, but using different versionBytes for the network (some adaptations will be needed in the steps)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions