diff --git a/HOWTO.rst b/HOWTO.rst index 0abd542..e9d510a 100644 --- a/HOWTO.rst +++ b/HOWTO.rst @@ -137,10 +137,13 @@ wall-time:: Machine A Machine B DB + Metadata 100,000 2m 30s 0 (unflushed) - 150,000 35m 4m 30s 0.2 GB - 180,000 1h 5m 9m 0.4 GB - 245,800 3h - 290,000 13h 15m 3.3 GB + 150,000 35m 4m 30s 0.2 GiB + 180,000 1h 5m 9m 0.4 GiB + 245,800 3h 1h 30m 2.7 GiB + 290,000 13h 15m 3h 5m 3.3 GiB + 307,000 17h 16m 3h 50m 4.1 GiB + 343,000 6h 54m 6.0 GiB + 386,600 17h 07m 7.0 GiB Machine A: a low-spec 2011 1.6GHz AMD E-350 dual-core fanless CPU, 8GB RAM and a DragonFlyBSD HAMMER fileystem on an SSD. It requests blocks @@ -218,7 +221,6 @@ You can see the logs usefully like so:: Here is typical log output on startup:: - 2016-10-08 14:46:48.088516500 Launching ElectrumX server... 2016-10-08 14:46:49.145281500 INFO:root:ElectrumX server starting 2016-10-08 14:46:49.147215500 INFO:root:switching current directory to /var/nohist/server-test @@ -257,7 +259,7 @@ After flush-to-disk you may see an aiohttp error; this is the daemon timing out the connection while the disk flush was in progress. This is harmless; I intend to fix this soon by yielding whilst flushing. -You may see one or two logs about ambiguous UTXOs or hash160s:: +You may see one or two logs about UTXOs or hash160 key collisions:: 2016-10-08 07:24:34.068609500 INFO:DB:UTXO compressed key collision at height 252943 utxo 115cc1408e5321636675a8fcecd204661a6f27b4b7482b1b7c4402ca4b94b72f / 1 diff --git a/query.py b/query.py new file mode 100644 index 0000000..f445d06 --- /dev/null +++ b/query.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +# See the file "LICENSE" for information about the copyright +# and warranty status of this software. + +import asyncio +import os +import sys + +from server.env import Env +from server.server import Server + + +def main(): + env = Env() + os.chdir(env.db_dir) + loop = asyncio.get_event_loop() + server = Server(env, loop) + db = server.db + coin = db.coin + for addr in sys.argv[1:]: + print('Address: ', addr) + hash160 = coin.address_to_hash160(addr) + for n, (tx_hash, height) in enumerate(db.get_history(hash160)): + print('History #{:d}: hash: {} height: {:d}' + .format(n + 1, bytes(reversed(tx_hash)).hex(), height)) + for n, utxo in enumerate(db.get_utxos(hash160)): + print('UTXOs #{:d}: hash: {} pos: {:d} height: {:d} value: {:d}' + .format(n, bytes(reversed(utxo.tx_hash)).hex(), + utxo.tx_pos, utxo.height, utxo.value)) + +if __name__ == '__main__': + main() diff --git a/server/server.py b/server/server.py index 2618d2b..e6a7bbc 100644 --- a/server/server.py +++ b/server/server.py @@ -201,32 +201,3 @@ class RPC(object): self.logger.info('sleeping 1 second and trying again...') await asyncio.sleep(1) - - # for addr in [ - # # '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp', - # # '1HYBcza9tVquCCvCN1hUZkYT9RcM6GfLot', - # # '1BNwxHGaFbeUBitpjy2AsKpJ29Ybxntqvb', - # # '1ARanTkswPiVM6tUEYvbskyqDsZpweiciu', - # # '1VayNert3x1KzbpzMGt2qdqrAThiRovi8', - # # '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', - # # '1XPTgDRhN8RFnzniWCddobD9iKZatrvH4', - # # '153h6eE6xRhXuN3pE53gWVfXacAtfyBF8g', - # ]: - # print('Address: ', addr) - # hash160 = coin.address_to_hash160(addr) - # utxos = self.db.get_utxos(hash160) - # for n, utxo in enumerate(utxos): - # print('UTXOs #{:d}: hash: {} pos: {:d} height: {:d} value: {:d}' - # .format(n, bytes(reversed(utxo.tx_hash)).hex(), - # utxo.tx_pos, utxo.height, utxo.value)) - - # for addr in [ - # '19k8nToWwMGuF4HkNpzgoVAYk4viBnEs5D', - # '1HaHTfmvoUW6i6nhJf8jJs6tU4cHNmBQHQ', - # '1XPTgDRhN8RFnzniWCddobD9iKZatrvH4', - # ]: - # print('Address: ', addr) - # hash160 = coin.address_to_hash160(addr) - # for n, (tx_hash, height) in enumerate(self.db.get_history(hash160)): - # print('History #{:d}: hash: {} height: {:d}' - # .format(n + 1, bytes(reversed(tx_hash)).hex(), height))