B2: network profile for mainnet and regtest, explicit confirmation for mainnet (ADR-58, ELC-30)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3ee60a23da
commit
9c832fd3d2
16 files changed
+261
-36
No files matched your search
@@ -158,11 +158,14 @@ class ElectrumClient:
|
||||
notification queues nobody will ever fill again.
|
||||
"""
|
||||
|
||||
def __init__(self, host: str, port: int, use_ssl: bool = True, pin: str | None = None):
|
||||
def __init__(
|
||||
self, host: str, port: int, use_ssl: bool = True, pin: str | None = None, genesis_hash: str = GENESIS_HASH
|
||||
):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.use_ssl = use_ssl
|
||||
self.pin = pin.lower() if pin else None
|
||||
self.genesis_hash = genesis_hash # the profile's (ADR-58, ELC-30)
|
||||
self._reader: asyncio.StreamReader | None = None
|
||||
self._writer: asyncio.StreamWriter | None = None
|
||||
self._id_counter = itertools.count(1)
|
||||
@@ -206,7 +209,7 @@ class ElectrumClient:
|
||||
Bitcoin's genesis and powLimit, so only `server.features` tells them apart (B-99, ELC-30)."""
|
||||
features = await self.request("server.features")
|
||||
genesis = features.get("genesis_hash") if isinstance(features, dict) else None
|
||||
if genesis != GENESIS_HASH:
|
||||
if genesis != self.genesis_hash:
|
||||
raise ElectrumError(f"{self.host}:{self.port} is not on the PLM chain (genesis {genesis!r})")
|
||||
|
||||
def _check_pin(self) -> None:
|
||||
|
||||
Reference in new issue
Block a user