Neil Booth
7f9cb9cd9d
Generic header length
...
If header lengths change in the future, only one function needs
to change in coins.py.
2017-01-07 11:51:12 +09:00
Neil Booth
2b2909f1c4
Move to hashX
...
The hashX of a script is the first 11 bytes of its sha256 hash.
Closes #72 .
2017-01-07 11:51:01 +09:00
Neil Booth
0f43ce564a
Fix log message
2017-01-07 11:51:00 +09:00
Neil Booth
533c97a575
Clean up DB open handling
...
Closes #89
2017-01-02 18:11:17 +09:00
Neil Booth
67908b3541
Slightly cleaner semaphore fix
2017-01-02 17:30:32 +09:00
shsmith
62eded55bb
move sleep outside semaphore (issue 88)
2016-12-26 09:15:22 -08:00
Neil Booth
efe3ebd9ee
Remove None from touched when backing up.
...
Fixes #84
2016-12-20 06:50:55 +09:00
Neil Booth
e91f49101b
Don't start processing mempool until caught up
...
Print server manager settings once servers start
2016-12-19 23:25:37 +09:00
Neil Booth
0665e1ac5c
Clear the touched addresses if not caught up
2016-12-18 00:02:16 +09:00
Neil Booth
39af7a7463
Rework main block processor loop
...
It's less awkward and more explicit.
This brings back the efficiency lost in the 0.9.x series.
It also removes the special case hack: both when syncing and
caught up, block processing is done in the executor.
Fixes #58
2016-12-17 21:45:44 +09:00
Neil Booth
3f64a8dd6e
Log block processing time only if not syncing
...
Prepare 0.9.10
2016-12-17 15:31:30 +09:00
Neil Booth
1ebebf08d9
Improve logging
2016-12-17 15:26:17 +09:00
Neil Booth
5c80b96d0f
Prioritize mempool processing of sent txs
...
Closes #73
2016-12-15 17:22:19 +09:00
Neil Booth
ac48695db8
daemon: getting height optionally gets mempool
...
Improve daemon startup log message
2016-12-15 15:38:22 +09:00
Neil Booth
5fe49bb261
Synchronize daemon height and mempool fetching
...
Cleanup and simplify touched handling and its event, which is
now controlled and owned by the mempool.
The daemon object owns the set of current mempool hashes.
Clean up and simplify the mempool main loop.
Fixes #70 .
2016-12-15 12:08:14 +09:00
Neil Booth
e2f4847632
New env var MAX_SESSIONS
...
When the number of sessions reaches MAX_SESSIONS, which defaults
to 1,000, turn off TCP and SSL listening sockets to prevent new
connections. When the session count falls below a low watermark,
currently 90% of MAX_SESSIONS, the listening sockets will be re-opened.
Helps prevent DoS and limit open file usage.
Bug fix: do not start serving paused connections until the buffer
socket is sufficiently drained. Also, loop.
2016-12-13 22:47:03 +09:00
Neil Booth
1ef6a4d785
Split mempool out into new file.
...
Rework mempool handling
2016-12-12 00:05:42 +09:00
Neil Booth
7399452294
Temporary hack to fix initial sync slowdown
2016-12-08 22:47:29 +09:00
Neil Booth
238b9e0285
Process blocks in the executor
...
This should eliminate latency when new blocks come in
and prevent sessions being dropped whilst they are processed.
2016-12-03 23:32:20 +09:00
Neil Booth
6b551973e8
queue -> tasks
2016-11-29 23:21:22 +09:00
Neil Booth
f9cc21807f
Further optimize the inner loop
2016-11-27 14:20:36 +09:00
Neil Booth
5c0b026158
Tasks queue just has null entries for now
2016-11-27 13:35:09 +09:00
Neil Booth
6aef79461f
Don't shut down block processor by cancellation
...
The block processor needs to be able to close cleanly, and not
mid-block. In order to be able to yield whilst processing blocks
we cannot forcefully close its coroutine with a cancellation.
2016-11-27 12:20:16 +09:00
Neil Booth
1b95bcd8ac
Open DB differently depending on if syncing
...
If syncing, use a high max_open_files, otherwise lower it.
2016-11-27 07:25:28 +09:00
Neil Booth
0afddb7bc3
Give backing up its own flush function
...
Remove some excessive log messages
2016-11-26 20:59:59 +09:00
Neil Booth
f5384ccc98
Remove get_tx_hash
...
Anything in the DB should be on the disk. Remove misleading
comment.
2016-11-26 20:09:18 +09:00
Neil Booth
3f743e9630
Distinguish undo_info being empty and not existing
...
Fixes #46
2016-11-26 16:16:17 +09:00
Neil Booth
af3ae6429e
Fix logging bug
2016-11-26 15:35:55 +09:00
Neil Booth
95a2de6dae
Move DB undo code to db.py
2016-11-26 13:18:10 +09:00
Neil Booth
8d253c81d3
Move clean_db() to db.py
2016-11-26 13:15:45 +09:00
Neil Booth
db5d0dd6cb
Merge branch 'serve_disk_only' into develop
2016-11-26 13:12:57 +09:00
Neil Booth
59244cc24e
Move bulk of FS flush code to db.py
...
More logically belongs there.
Have servers use the flushed DB height not the block processor's height.
Get all headers only from disk.
2016-11-26 13:11:59 +09:00
Neil Booth
df3cb8535a
Cleaner handling of touched addresses
...
Moved to local vars rather than an instance variable
2016-11-26 12:46:11 +09:00
TheLazieR Yip
f3ecfe00e2
Remove unused variables
2016-11-25 07:45:45 -05:00
TheLazieR Yip
828727d41a
Remove unneccessary local variables
2016-11-25 07:44:19 -05:00
TheLazieR Yip
b3623f5455
replace header_hashes with header_prevhash , header_hash
2016-11-25 07:25:56 -05:00
Neil Booth
ef2703177e
Fix another assertion error during reorgs
...
Fixes #44
2016-11-25 08:10:11 +09:00
Neil Booth
9e220820aa
Rework futures and event handling
2016-11-23 17:52:09 +09:00
Neil Booth
bab0d162de
Merge ServerManager and BlockServer
2016-11-23 17:52:08 +09:00
Neil Booth
640360c809
Add feature to simulate reorgs for debugging
2016-11-23 09:52:30 +09:00
Neil Booth
8970205e6c
Remove obsolete debugging feature
2016-11-23 09:16:41 +09:00
Neil Booth
2df5aa746f
Pop one from tx_counts for each block we back up.
...
Fixes #40
2016-11-23 09:11:49 +09:00
Neil Booth
26221e751e
Remove dead code
2016-11-23 09:02:01 +09:00
Neil Booth
d1ba4b1a76
Reset fs_height when backing up
2016-11-22 08:09:43 +09:00
Neil Booth
67bb01bf2c
Fix reorgs with unspendable TXOs
2016-11-22 07:50:01 +09:00
Neil Booth
87cdd2709d
Implement daemon failover
...
Daemon URLs can be comma-separated in the DAEMON_URL env var.
Surrounding whitespace is stripped.
http:// is preprended if missing.
The coin's default port is supplied if missing.
A trailing / is supplied if missing.
Closes #33
2016-11-20 20:52:54 +09:00
Neil Booth
98fd178c62
Make mempool truly asynchronous
...
Mempool updates happen in parallel asynchronously to processing of
new blocks once caught up. This means that, e.g., during the initial
slow mempool download incoming blocks can be processed and communicated
to clients without waiting for the downloaded mempool transaction
analysis to complete. From a client's point of view the server won't
be seen as lagging.
2016-11-20 18:17:55 +09:00
Neil Booth
8617c82ec2
Floor disk_count at zero.
2016-11-19 20:56:08 +09:00
Neil Booth
52116539d4
Clean shutdown: wait for transports to close
...
We give 10 seconds for everything to be cleaned up, then close forcibly.
Fixes #30
2016-11-19 17:05:47 +09:00
Neil Booth
3d87e299ea
Move formatted_time to library
2016-11-19 15:42:06 +09:00