Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ jobs:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
exclude:
# XXX: pypy-3.10 does not exist yet
# XXX: neither pypy-3.10 nor pypy-3.11 exist yet, maybe pypy-3.10 will be out on PyPy v7.3.10
- python-impl: pypy
python-version: '3.10'
- python-impl: pypy
python-version: '3.11'
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
import os
import json
full_matrix = {
'python': ['3.8', '3.9', '3.10'],
'python': ['3.8', '3.9', '3.10', '3.11'],
# available OS's: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
'os': ['ubuntu-22.04', 'macos-12', 'windows-2022'],
'include': [
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ First, you need to have Python >=3.8 installed. If you don't, we recommend you t
brew install pyenv
```

then Python 3.10 (you could check the latest 3.10.x version with `pyenv install --list`):
then Python 3.11 (you could check the latest 3.11.x version with `pyenv install --list`):

```
pyenv install 3.10.6
pyenv local 3.10.6
pyenv install 3.11.0
pyenv local 3.11.0
pip install -U poetry
```

Expand All @@ -75,7 +75,7 @@ First, you need to have Python >=3.8 installed. If you don't, we recommend you t
- on Windows 10 (using [winget](https://github.com/microsoft/winget-cli)):

```
winget install python-3.10
winget install python-3.11
pip install -U poetry
```

Expand Down
2 changes: 1 addition & 1 deletion hathor/merged_mining/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def job_request(self) -> None:
merkle_root=bitcoin_block.merkle_root.hex())

async def estimator_loop(self) -> None:
""" This loop only cares about reducing the current difficulty if the miner takes too long to submit a solution.
""" This loop only cares about reducing the current difficulty if the miner takes too long to submit a solution
"""
from functools import reduce
from math import log2
Expand Down
7 changes: 6 additions & 1 deletion hathor/p2p/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,12 @@ def recv_message(self, cmd: ProtocolMessages, payload: str) -> Optional[Deferred
self.reset_idle_timeout()

if not self.ratelimit.add_hit(self.RateLimitKeys.GLOBAL):
self.state.send_throttle(self.RateLimitKeys.GLOBAL)
# XXX: on Python 3.11 the result of the following expression:
# '{}'.format(HathorProtocol.RateLimitKeys.GLOBAL)
# is not 'global' but 'RateLimitKeys.GLOBAL', even though the enum value *is* a string, but it seems
# that something like `str(value)` is called which results in a different value (usually not the case
# for regular strings, but it is for enum+str), using `enum_variant.value` side-steps this problem
self.state.send_throttle(self.RateLimitKeys.GLOBAL.value)
return None

fn = self.state.cmd_map.get(cmd)
Expand Down
15 changes: 9 additions & 6 deletions hathor/stratum/stratum.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ def __init__(self, jobid: UUID, created: int, miner: UUID, tx: BaseTransaction,

class MinerJob(NamedTuple):
""" Data class used to share job data between mining processes """
data: 'ctypes.Array[ctypes.c_ubyte]' = Array('B', 2048)
data_size: 'ctypes.c_uint' = Value('I')
job_id: 'ctypes.Array[ctypes.c_ubyte]' = Array('B', 16)
nonce_size: 'ctypes.c_uint' = Value('I')
weight: 'ctypes.c_double' = Value('d')
# XXX: these typings are causing too much trouble, since this module hasn't been touched for a while and won't be
# touched for the foreseeable future (and will possibly even removed before any changes) it seems fine to just
# use Any so there aren't any mypy complaints anymore
data: Any = Array('B', 2048)
data_size: Any = Value('I')
job_id: Any = Array('B', 16)
nonce_size: Any = Value('I')
weight: Any = Value('d')

def update_job(self, params: Dict[str, Any]) -> bool:
"""
Expand Down Expand Up @@ -818,7 +821,7 @@ class StratumClient(JSONRPC):
job: Dict
miners: List[Process]
loop: Optional[task.LoopingCall]
signal: 'ctypes.c_ubyte'
signal: Any
job_data: MinerJob

address: Optional[bytes]
Expand Down
4 changes: 3 additions & 1 deletion hathor/wallet/hd_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def _register_pycoin_networks() -> None:


class HDWallet(BaseWallet):
""" Hierarchical Deterministic Wallet based in BIP32 (https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
""" Hierarchical Deterministic Wallet based on BIP32.

See: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
"""

def __init__(self, *, words: Optional[Any] = None, language: str = 'english', passphrase: bytes = b'',
Expand Down
2 changes: 1 addition & 1 deletion hathor/wallet/resources/thin_wallet/send_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _stratum_deferred_resolve(self, context: _Context) -> None:
funds_hash = context.tx.get_funds_hash()
context.tx = self.manager.stratum_factory.mined_txs[funds_hash]
# Delete it to avoid memory leak
del(self.manager.stratum_factory.mined_txs[funds_hash])
del self.manager.stratum_factory.mined_txs[funds_hash]

deferred = threads.deferToThreadPool(reactor, self.manager.pow_thread_pool,
self._stratum_thread_verify, context)
Expand Down
Loading