Neil Booth
fcf696d3f3
Don't require 2 params for version requests
2016-12-04 10:54:22 +09:00
Neil Booth
656f749c70
Add LRU cache for history
2016-12-03 20:20:28 +09:00
Neil Booth
04369dd228
Forcefully drop stale sessions or if shutting down
...
Don't wait for the socket
2016-12-03 18:33:23 +09:00
Neil Booth
aaf0592f52
Fix typo
2016-12-03 15:10:57 +09:00
Neil Booth
c4e7878407
Add session ID for each session
...
Show it in the logs with each session-specific message.
Show the sessions ID in the sessions list with an L suffix if logging.
Add RPC commands to toggle logging of, and disconnect, a session.
Closes #55
2016-12-03 14:32:09 +09:00
Neil Booth
3d2824218b
Close stale sessions
...
New envvar SESSION_TIMEOUT
A session with no activity is cut off after this time
Fixes #56
2016-12-03 13:06:20 +09:00
Neil Booth
c16792fb89
Only wait 30 secsonds on shutdown
2016-12-03 11:03:27 +09:00
Neil Booth
62a531b1d0
Revert "Fix ref leak in mempool updates"
...
This reverts commit 6c95644ae0 .
2016-12-02 18:43:15 +09:00
Neil Booth
6c95644ae0
Fix ref leak in mempool updates
2016-12-02 07:22:30 +09:00
Neil Booth
0892b12036
Replace $DAEMON_VERSION and $DAEMON_SUBVERSION
...
in banner file.
2016-11-29 23:03:05 +09:00
Neil Booth
b65bcda504
Add per-session bandwidth limits
2016-11-29 22:19:12 +09:00
Neil Booth
c9a10be5ba
Introduce incoming buffer size limit
...
- incoming buffered network requests limited to 150,000 bytes
which I believe is ample for a genuine client
- if exceeded, the connection is dropped
- raise outgoing data limit for RPC connections to 5 MB - expect
sessions calls can be long and connection is implicitly trusted
- similarly raise incoming buffered data limit to 5 MB for RPC
connections
2016-11-29 20:24:58 +09:00
Neil Booth
c08ade5861
Add session logging facility
...
Move session logging code to protocol.py from electrum_rpc.py
Use it for periodic logging controlled by envvar LOG_SESSIONS
For each session, track sent transaction stats and show that
per-session instead of errors
2016-11-29 08:00:54 +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
9eb701f220
Replace $VERSION in the banner file
...
with the ElectrumX version string
2016-11-26 18:19:53 +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
9544170c55
Prepare release-0.7.10
2016-11-26 09:53:47 +09:00
Neil Booth
292073f2c7
Log large requests and reject them
2016-11-26 09:32:29 +09:00
Neil Booth
42c00d32d2
Rewrite lib/jsonrpc.py to be a useful client too
...
Use for an improved electrumx_rpc.py, so it now handles responses spread
over several packets. Also added a timeout of 5 seconds.
Fixes #43
2016-11-25 21:19:43 +09:00
Neil Booth
de4930b96d
Introduce MAX_HIST environment variable.
2016-11-24 23:30:40 +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
fa30c5529b
Fix missing qualifier
2016-11-20 22:01:44 +09:00
Neil Booth
dd0cd0156f
Remove debug log
2016-11-20 20:56:12 +09:00
Neil Booth
11558fd9d2
Add debug log
2016-11-20 20:52:54 +09:00
Neil Booth
1dc43b3020
Show connection total in connection log
...
Fix typo resulting in no mempool notifications
2016-11-20 19:29:58 +09:00
Neil Booth
5eb92007ae
Remove redundant log; IRC will emit one
2016-11-20 18:18:30 +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
dd5a31d0f4
Take a little more care cleaning up connections
2016-11-19 20:56:08 +09:00
Neil Booth
ccf24fdc71
Wait 20 secs for sockets to close
...
10 seems a little low
2016-11-19 20:00:38 +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
0b52376f23
Add subscription limits
2016-11-19 10:51:16 +09:00
Neil Booth
913d156786
Convert DaemonError to RPCError
...
To cleanly return errors to clients
getrawtransaction has the ugly API and still does its own thing
Fixes #32
2016-11-19 08:12:13 +09:00
Neil Booth
942d5d6b00
Fix import
2016-11-19 08:07:37 +09:00
Neil Booth
063a5469cc
Move mempool to be with BlockServer
...
BlockProcessor doesn't really need a mempool; mempools are
only useful for servers.
Set first_sync before flushing, so it goes into DB state.
Start servers immediately on catchup; mempool fills asynchronously.
Fixes #31
2016-11-19 08:02:13 +09:00
Neil Booth
3abddf4a51
Simplify sessions call
2016-11-19 00:02:56 +09:00
Neil Booth
88185b0daa
Bump log threshold up; tweak log
2016-11-18 22:20:48 +09:00
Neil Booth
beeb60f324
Implement blockchain.address.get_mempool
...
Fixes #26
2016-11-18 21:41:27 +09:00
Neil Booth
7f3551e435
tx_merkle: catch bad hashes and report properly
...
Fixes #27
2016-11-18 20:56:53 +09:00
Neil Booth
4c7f72fe68
RPCError is not a global variable
2016-11-17 22:07:37 +09:00
Neil Booth
c5c7b6f438
Have all expensive requests yield.
2016-11-17 06:50:46 +09:00
Neil Booth
f17ad2ddf4
Put notifications on the session queue
...
This keeps the network in-order and means slow clients get slow
notifications, which seems fairer.
Add some simple logging
2016-11-17 06:04:08 +09:00
Neil Booth
a1eb446af4
Tweak notify handling
2016-11-17 05:37:37 +09:00
Neil Booth
db187540d5
Have task coros handle cancelled exceptions
2016-11-15 20:09:38 +09:00
Neil Booth
a2280bbc93
Clean up futures handling
2016-11-15 20:09:38 +09:00
Neil Booth
8c55f41305
Accept more SSL protocols
2016-11-14 23:13:34 +09:00
Neil Booth
1830cae3de
Remove a redundant message
2016-11-14 21:52:25 +09:00
Neil Booth
83674b1b7b
Clarify peername() logic
2016-11-14 21:28:42 +09:00
Neil Booth
be45a9e228
Minor improvements to client handling
...
Don't create a task until ready to execute it
Log expensive tasks
Assume peers are for logging unless explicitly not stated
2016-11-14 21:15:09 +09:00
Neil Booth
14d3d85bd9
Need an array to take its len
2016-11-14 19:52:18 +09:00
Neil Booth
dc74c869a1
Await task after cancelling it.
2016-11-14 19:24:17 +09:00
Neil Booth
984a482590
Merge branch 'master' into develop
2016-11-14 08:11:40 +09:00
Neil Booth
12ed9f7069
Have session_count return a dictionary
2016-11-14 08:01:00 +09:00
Neil Booth
1b8881800d
Move the RPC handlers to the manager
2016-11-14 07:56:48 +09:00
Johann Bauer
d45321927e
Add optional option to anonymise logs (remove IP addresses)
2016-11-13 23:56:16 +01:00
Neil Booth
57dd4ece9c
Avoid annoying exception on shutdown
2016-11-13 17:52:08 +09:00
Neil Booth
831225492e
Better RPC sessions stats
2016-11-13 15:28:34 +09:00
Neil Booth
7523735f99
Split out server and session management
2016-11-13 14:43:13 +09:00
Neil Booth
3b6ab77e47
Break out JSONRPC into own file
...
- improved handling of JSON 2.0 RPC protocol
- permits batched requests (not yet supported by Electrum client)
2016-11-13 13:39:37 +09:00
Neil Booth
14d8ece7c6
Return a version the Electrum client expects
...
If you don't do this you don't appear in the network dialog box
2016-11-12 23:20:20 +09:00
Neil Booth
751bb2d970
Remove debug code
2016-11-12 21:52:50 +09:00
Neil Booth
c93f6cb920
Final cleanup
2016-11-12 21:48:34 +09:00
Neil Booth
cb7b7dd1fe
Move pretty printing of sessions to client
...
Tweak logging
2016-11-12 21:36:49 +09:00
Neil Booth
501807bf1a
Implement IRC support and related queries from clients
2016-11-12 21:06:51 +09:00
Neil Booth
d8bb174f2b
Use correct daemon API
2016-11-12 09:42:35 +09:00
Neil Booth
244a0f2fab
Update release notes.
2016-11-11 21:18:51 +09:00
Neil Booth
8188f7e909
Catch exceptions when trying to listen
...
Fixes #11
2016-11-10 22:49:20 +09:00
Johann Bauer
1405057096
Fix getting the number of watched addresses
...
Resolves #13
2016-11-09 18:07:25 +01:00
Neil Booth
5c5e90d574
Move BlockServer to more appropriate location
2016-11-08 19:20:13 +09:00
Neil Booth
f05a5414c1
Make jobs truly asynchronous.
...
However we need to rate-limit the daemon...
2016-11-07 22:22:47 +09:00
Neil Booth
7f03b0fa73
Move job handling out of the controller
...
Controller on its last legs...
2016-11-07 19:57:23 +09:00
Neil Booth
00e9c5a31d
Add daemon debugging caught-up facility
2016-11-05 21:37:02 +09:00
Neil Booth
9fbbc8bfdb
Clean up daemon interface.
2016-11-05 15:59:42 +09:00
Neil Booth
b5d1f401fd
Fix bugs
2016-11-05 12:58:23 +09:00
Neil Booth
48b8b9332e
Initial attempt at mempool
2016-11-05 12:27:37 +09:00
Neil Booth
fb43712869
Controller clean up
2016-11-03 19:09:33 +09:00
Neil Booth
892e9524e5
Fix bugs handling client UTXO requests
...
Allow strings for ints - Electrum command line doesn't convert
Don't blow away hash168s from the DB
2016-11-03 19:09:05 +09:00
Neil Booth
be2475f617
Handle utxo.get_address
2016-11-03 19:08:25 +09:00
Neil Booth
ceecdc54ac
Server work
...
Avoid touching the block preprocessor hot loop for now
2016-11-03 17:26:50 +09:00
Neil Booth
3d11afbda2
Enable servers
2016-11-03 16:48:10 +09:00
Neil Booth
d2ebb80fac
Extend copyright notice; improve comments
2016-11-03 16:45:06 +09:00
Neil Booth
6957b59b19
Start work on handling block reorgs
...
Unfinished
2016-10-28 06:02:18 +09:00
Neil Booth
2001d5c4f4
Merge the DB and BlockProcessor classes
2016-10-27 07:59:46 +09:00
Neil Booth
8452d0c016
Split out daemon handler into separate file.
2016-10-27 07:43:48 +09:00
Neil Booth
6ad8c16c47
Handle a couple more requests.
2016-10-27 07:25:34 +09:00
Neil Booth
334ffdaa4f
Begin work on proper server
2016-10-17 20:02:42 +09:00