Neil Booth
8d58d2a0e7
Clean up shutdown logic and logging
Add RPC "stop" command, and document it.
Fixes the 2nd part of #100
8 years ago
Neil Booth
5784412393
Write out undo info with the UTXO flushes
Cleaner and slightly more efficient.
Closes #101
8 years ago
Neil Booth
2ad64f6243
Add an RPC call to force a reorg at run-time
This required a large rework block processor and prefetcher
interaction, and led to various cleanups
Closes #103
8 years ago
Neil Booth
15051124af
Make flushes and reorgs async
Apart from the flush on shutdown and the flush when caught up,
neither of which matter, this makes flushes asynchronous.
Also, block processing for reorgs is now asynchronous.
This also removes the FORCE_REORG debug envvar; I want to
put that into the RPC interface.
Closes #102
8 years ago
Neil Booth
4d62019b07
Check Genesis hash
Testnet RPC_PORT is 18332
8 years ago
Neil Booth
852753cb94
Implement deserialization of SegWit transactions
tx_hash needs to be that of the prior serialization, so
need to change internal read_block API.
Bitcoin core 0.13.1 broke backwards compat of the RPC interface.
Closes #92
8 years ago
Neil Booth
91ca5fc14a
Split out history into its own DB.
8 years ago
Neil Booth
7f9cb9cd9d
Generic header length
If header lengths change in the future, only one function needs
to change in coins.py.
8 years ago
Neil Booth
2b2909f1c4
Move to hashX
The hashX of a script is the first 11 bytes of its sha256 hash.
Closes #72 .
8 years ago
Neil Booth
0f43ce564a
Fix log message
8 years ago
Neil Booth
533c97a575
Clean up DB open handling
Closes #89
8 years ago
Neil Booth
67908b3541
Slightly cleaner semaphore fix
8 years ago
shsmith
62eded55bb
move sleep outside semaphore (issue 88)
8 years ago
Neil Booth
efe3ebd9ee
Remove None from touched when backing up.
Fixes #84
8 years ago
Neil Booth
e91f49101b
Don't start processing mempool until caught up
Print server manager settings once servers start
8 years ago
Neil Booth
0665e1ac5c
Clear the touched addresses if not caught up
8 years ago
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
8 years ago
Neil Booth
3f64a8dd6e
Log block processing time only if not syncing
Prepare 0.9.10
8 years ago
Neil Booth
1ebebf08d9
Improve logging
8 years ago
Neil Booth
5c80b96d0f
Prioritize mempool processing of sent txs
Closes #73
8 years ago
Neil Booth
ac48695db8
daemon: getting height optionally gets mempool
Improve daemon startup log message
8 years ago
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 .
8 years ago
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.
8 years ago
Neil Booth
1ef6a4d785
Split mempool out into new file.
Rework mempool handling
8 years ago
Neil Booth
7399452294
Temporary hack to fix initial sync slowdown
8 years ago
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.
8 years ago
Neil Booth
6b551973e8
queue -> tasks
8 years ago
Neil Booth
f9cc21807f
Further optimize the inner loop
8 years ago
Neil Booth
5c0b026158
Tasks queue just has null entries for now
8 years ago
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.
8 years ago
Neil Booth
1b95bcd8ac
Open DB differently depending on if syncing
If syncing, use a high max_open_files, otherwise lower it.
8 years ago
Neil Booth
0afddb7bc3
Give backing up its own flush function
Remove some excessive log messages
8 years ago
Neil Booth
f5384ccc98
Remove get_tx_hash
Anything in the DB should be on the disk. Remove misleading
comment.
8 years ago
Neil Booth
3f743e9630
Distinguish undo_info being empty and not existing
Fixes #46
8 years ago
Neil Booth
af3ae6429e
Fix logging bug
8 years ago
Neil Booth
95a2de6dae
Move DB undo code to db.py
8 years ago
Neil Booth
8d253c81d3
Move clean_db() to db.py
8 years ago
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.
8 years ago
Neil Booth
df3cb8535a
Cleaner handling of touched addresses
Moved to local vars rather than an instance variable
8 years ago
TheLazieR Yip
f3ecfe00e2
Remove unused variables
8 years ago
TheLazieR Yip
828727d41a
Remove unneccessary local variables
8 years ago
TheLazieR Yip
b3623f5455
replace header_hashes with header_prevhash , header_hash
8 years ago
Neil Booth
ef2703177e
Fix another assertion error during reorgs
Fixes #44
8 years ago
Neil Booth
9e220820aa
Rework futures and event handling
8 years ago
Neil Booth
bab0d162de
Merge ServerManager and BlockServer
8 years ago
Neil Booth
640360c809
Add feature to simulate reorgs for debugging
8 years ago
Neil Booth
8970205e6c
Remove obsolete debugging feature
8 years ago
Neil Booth
2df5aa746f
Pop one from tx_counts for each block we back up.
Fixes #40
8 years ago
Neil Booth
26221e751e
Remove dead code
8 years ago
Neil Booth
d1ba4b1a76
Reset fs_height when backing up
8 years ago