Remove dead code left by the other coins
GENESIS_ACTIVATION and is_unspendable_genesis (always legacy for Palladium), script matching helpers and ScriptPubKey.TO_*_OPS, Deserializer._read_be_uint16, the unused Coin.CHUNK_SIZE and ENCODE_CHECK, the name-index fallback of the local RPC 'query' command, and stale comments about other coins. Block processing and the db format are unchanged: a fresh sync gives the same history as before. STATIC_BLOCK_HEADERS and the dynamic header code in db.py are left, being generic functionality that would need wider changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3d05c37feb
commit
f1e6ad29ab
6 files changed
+13
-63
No files matched your search
@@ -22,7 +22,7 @@ from aiorpcx import run_in_thread, CancelledError, ignore_after
|
||||
import electrumx
|
||||
from electrumx.server.daemon import DaemonError, Daemon
|
||||
from electrumx.lib.hash import hash_to_hex_str, HASHX_LEN
|
||||
from electrumx.lib.script import is_unspendable_legacy, is_unspendable_genesis
|
||||
from electrumx.lib.script import is_unspendable_legacy
|
||||
from electrumx.lib.util import (
|
||||
chunks, class_logger, OldTaskGroup,
|
||||
)
|
||||
@@ -526,9 +526,7 @@ class BlockProcessor:
|
||||
"""This method must be thread-safe. (runs on bp.pool_executor)"""
|
||||
|
||||
tx_num_start = self.db.tx_counts[height - 1] if height > 0 else 0
|
||||
is_unspendable = (
|
||||
is_unspendable_genesis if height >= self.coin.GENESIS_ACTIVATION
|
||||
else is_unspendable_legacy)
|
||||
is_unspendable = is_unspendable_legacy
|
||||
|
||||
# Use local vars for speed in the loops
|
||||
script_hashX = self.coin.hashX_from_script
|
||||
@@ -643,8 +641,6 @@ class BlockProcessor:
|
||||
assert self.state_lock.locked()
|
||||
self.db.assert_flushed(self.flush_data())
|
||||
assert self.height >= len(raw_blocks)
|
||||
genesis_activation = self.coin.GENESIS_ACTIVATION
|
||||
|
||||
coin = self.coin
|
||||
for raw_block in raw_blocks:
|
||||
# Check and update self.tip
|
||||
@@ -656,9 +652,7 @@ class BlockProcessor:
|
||||
f'{hash_to_hex_str(self.tip)} at height {self.height:,d}'
|
||||
)
|
||||
self.tip = coin.header_prevhash_rev(block.header)
|
||||
is_unspendable = (is_unspendable_genesis if self.height >= genesis_activation
|
||||
else is_unspendable_legacy)
|
||||
self.backup_txs(block.transactions, is_unspendable)
|
||||
self.backup_txs(block.transactions, is_unspendable_legacy)
|
||||
self._bhash_to_bheight[header_hash] = self.height
|
||||
self.height -= 1
|
||||
self.db.tx_counts.pop()
|
||||
|
||||
@@ -584,7 +584,7 @@ class SessionManager:
|
||||
async def rpc_add_peer(self, real_name: str) -> str:
|
||||
'''Add a peer.
|
||||
|
||||
real_name: "bch.electrumx.cash t50001 s50002" for example
|
||||
real_name: "electrum.example.com t50001 s50002" for example
|
||||
'''
|
||||
await self.peer_mgr.add_localRPC_peer(real_name)
|
||||
return f"peer '{real_name}' added"
|
||||
@@ -697,7 +697,7 @@ class SessionManager:
|
||||
return self.peer_mgr.rpc_data()
|
||||
|
||||
async def rpc_query(self, items, limit):
|
||||
'''Returns data about a script, address or name.'''
|
||||
'''Returns data about a script or address.'''
|
||||
coin = self.env.coin
|
||||
db = self.db
|
||||
lines = []
|
||||
@@ -717,14 +717,6 @@ class SessionManager:
|
||||
except Base58Error:
|
||||
pass
|
||||
|
||||
try:
|
||||
script = coin.build_name_index_script(arg.encode("ascii"))
|
||||
hashX = coin.name_hashX_from_script(script)
|
||||
lines.append(f'Name: {arg}')
|
||||
return hashX
|
||||
except (AttributeError, UnicodeEncodeError):
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
for arg in items:
|
||||
|
||||
Reference in new issue
Block a user