Skip to content

Commit

Permalink
Patch release: 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored May 13, 2024
2 parents 47fd473 + cf23374 commit b75f5fe
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 578 deletions.
12 changes: 10 additions & 2 deletions electrumx/lib/coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ def bucket_estimatefee_block_target(cls, n: int) -> int:
return n


class AtomicalsCoinMixin:
ATOMICALS_ACTIVATION_HEIGHT: int
ATOMICALS_ACTIVATION_HEIGHT_DMINT: int
ATOMICALS_ACTIVATION_HEIGHT_COMMITZ: int
ATOMICALS_ACTIVATION_HEIGHT_DENSITY: int
ATOMICALS_ACTIVATION_HEIGHT_DFT_BITWORK_ROLLOVER: int


class AuxPowMixin:
STATIC_BLOCK_HEADERS = False
DESERIALIZER = lib_tx.DeserializerAuxPow
Expand Down Expand Up @@ -629,7 +637,7 @@ def warn_old_client_on_tx_broadcast(cls, client_ver):
return False


class Bitcoin(BitcoinMixin, Coin):
class Bitcoin(BitcoinMixin, AtomicalsCoinMixin, Coin):
NAME = "Bitcoin"
DESERIALIZER = lib_tx.DeserializerSegWit
MEMPOOL_HISTOGRAM_REFRESH_SECS = 120
Expand Down Expand Up @@ -913,7 +921,7 @@ class BitcoinSVRegtest(BitcoinSVTestnet):
GENESIS_ACTIVATION = 10_000


class BitcoinTestnet(BitcoinTestnetMixin, Coin):
class BitcoinTestnet(BitcoinTestnetMixin, AtomicalsCoinMixin, Coin):
'''Bitcoin Testnet for Core bitcoind >= 0.13.1.'''
NAME = "Bitcoin"
DESERIALIZER = lib_tx.DeserializerSegWit
Expand Down
210 changes: 128 additions & 82 deletions electrumx/server/block_processor.py

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions electrumx/server/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import time
from calendar import timegm
from struct import pack
from typing import TYPE_CHECKING, Type
from typing import TYPE_CHECKING, Type, Union

import aiohttp
from aiorpcx import JSONRPC
Expand All @@ -25,7 +25,7 @@
unpack_le_uint16_from)

if TYPE_CHECKING:
from electrumx.lib.coins import Coin
from electrumx.lib.coins import Coin, AtomicalsCoinMixin


class DaemonError(Exception):
Expand All @@ -48,7 +48,7 @@ class Daemon:

def __init__(
self,
coin: Type['Coin'],
coin: Type[Union['Coin', 'AtomicalsCoinMixin']],
url,
*,
max_workqueue=10,
Expand Down Expand Up @@ -307,12 +307,14 @@ async def height(self):
'''Query the daemon for its current height.'''
self._height = await self._send_single('getblockcount')
return self._height
# return self.coin.ATOMICALS_ACTIVATION_HEIGHT - 1

def cached_height(self):
'''Return the cached daemon height.
If the daemon has not been queried yet this returns None.'''
return self._height
# return self.coin.ATOMICALS_ACTIVATION_HEIGHT - 1


class DashDaemon(Daemon):
Expand Down
2 changes: 1 addition & 1 deletion electrumx/server/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ def get_op_by_tx_num(self, tx_num):
op_key = b'op' + pack_le_uint64(tx_num)
op_data = self.utxo_db.get(op_key)
if not op_data:
tx_hash, tx_height = self.fs_tx_hash(tx_num)
# tx_hash, tx_height = self.fs_tx_hash(tx_num)
# self.logger.error(f'get_op {hash_to_hex_str(tx_hash)} tx_num not found')
return None
op_res = []
Expand Down
6 changes: 3 additions & 3 deletions electrumx/server/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

import re
from ipaddress import IPv4Address, IPv6Address
from typing import Type
from typing import Type, Union

from aiorpcx import Service, ServicePart
from electrumx.lib.coins import Coin
from electrumx.lib.coins import Coin, AtomicalsCoinMixin
from electrumx.lib.env_base import EnvBase


Expand All @@ -32,7 +32,7 @@ class Env(EnvBase):
SSL_PROTOCOLS = {'ssl', 'wss'}
KNOWN_PROTOCOLS = {'ssl', 'tcp', 'ws', 'wss', 'rpc', 'http'}

coin: Type[Coin]
coin: Type[Union['Coin', 'AtomicalsCoinMixin']]

def __init__(self, coin=None):
super().__init__()
Expand Down
255 changes: 5 additions & 250 deletions electrumx/server/http_session.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions electrumx/server/mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from abc import ABC, abstractmethod
from asyncio import Lock
from collections import defaultdict
from typing import Sequence, Tuple, TYPE_CHECKING, Type, Dict
from typing import Sequence, Tuple, TYPE_CHECKING, Type, Dict, Union
import math

import attr
Expand All @@ -27,7 +27,7 @@
from electrumx.lib.hash import hash_to_hex_str, HASHX_LEN, double_sha256

if TYPE_CHECKING:
from electrumx.lib.coins import Coin
from electrumx.lib.coins import Coin, AtomicalsCoinMixin


@attr.s(slots=True)
Expand Down Expand Up @@ -112,7 +112,7 @@ class MemPool:

def __init__(
self,
coin: Type['Coin'],
coin: Type[Union['Coin', 'AtomicalsCoinMixin']],
api: MemPoolAPI,
*,
refresh_secs=5.0,
Expand Down
Loading

0 comments on commit b75f5fe

Please sign in to comment.