diff --git a/electrumx/lib/coins.py b/electrumx/lib/coins.py index 22f1a8c..077d094 100644 --- a/electrumx/lib/coins.py +++ b/electrumx/lib/coins.py @@ -378,6 +378,20 @@ class BitcoinCash(BitcoinMixin, Coin): ] +class BitcoinCashABC(BitcoinMixin, Coin): + NAME = "BitcoinCashABC" + SHORTNAME = "BCH" + TX_COUNT = 265479628 + TX_COUNT_HEIGHT = 556592 + TX_PER_BLOCK = 400 + PEERS = [ + 'bch.imaginary.cash s t', + 'electroncash.dk s t', + 'wallet.satoshiscoffeehouse.com s t', + ] + BLOCK_PROCESSOR = block_proc.LTORBlockProcessor + + class BitcoinSegwit(BitcoinMixin, Coin): NAME = "BitcoinSegwit" DESERIALIZER = lib_tx.DeserializerSegWit diff --git a/electrumx/server/block_processor.py b/electrumx/server/block_processor.py index 0c8b4a8..7391b72 100644 --- a/electrumx/server/block_processor.py +++ b/electrumx/server/block_processor.py @@ -684,6 +684,7 @@ class DecredBlockProcessor(BlockProcessor): class NamecoinBlockProcessor(BlockProcessor): + def advance_txs(self, txs): result = super().advance_txs(txs) @@ -711,3 +712,98 @@ class NamecoinBlockProcessor(BlockProcessor): self.db.history.add_unflushed(hashXs_by_tx, self.tx_count - len(txs)) return result + + +class LTORBlockProcessor(BlockProcessor): + + def advance_txs(self, txs): + self.tx_hashes.append(b''.join(tx_hash for tx, tx_hash in txs)) + + # Use local vars for speed in the loops + undo_info = [] + tx_num = self.tx_count + script_hashX = self.coin.hashX_from_script + s_pack = pack + put_utxo = self.utxo_cache.__setitem__ + spend_utxo = self.spend_utxo + undo_info_append = undo_info.append + update_touched = self.touched.update + + hashXs_by_tx = [set() for _ in txs] + + # Add the new UTXOs + for (tx, tx_hash), hashXs in zip(txs, hashXs_by_tx): + add_hashXs = hashXs.add + tx_numb = s_pack('