Commit Graph

38 Commits

Author SHA1 Message Date
Neil Booth
86f6a148b9 Separate async item processor per session
Improve daemon wait logic

Fixes #100
2017-02-19 19:01:41 +09:00
Neil Booth
151da40d5b Implement peer discovery protocol
Closes #104

DEFAULT_PORTS now a coin property
A Peer object maintains peer information
Revamp LocalRPC "peers" call to show a lot more information
Have lib/jsonrpc.py take care of handling request timeouts
Save and restore peers to a file
Loosen JSON RPC rules so we work with electrum-server and beancurd which don't follow the spec.
Handle incoming server.add_peer requests
Send server.add_peer registrations if peer doesn't have us or correct ports
Verify peers at regular intervals, forget stale peers, verify new peers or those with updated ports
If connecting via one port fails, try the other
Add socks.py for SOCKS4 and SOCKS5 proxying, so Tor servers can now be reached by TCP and SSL
Put full licence boilerplate in lib/ files
Disable IRC advertising on testnet
Serve a Tor banner file if it seems like a connection came from your tor proxy (see ENVIONMENT.rst)
Retry tor proxy hourly, and peers that are about to turn stale
Report more onion peers to a connection that seems to be combing from your tor proxy
Only report good peers to server.peers.subscribe; always report self if valid
Handle peers on the wrong network robustly
Default to 127.0.0.1 rather than localhost for Python <= 3.5.2 compatibility
Put peer name in logs of connections to it
Update docs
2017-02-18 12:43:45 +09:00
Neil Booth
184fc615bd Improve clarity about current daemon URL 2017-02-04 10:35:35 +09:00
Neil Booth
616bcf6bfd Add daemon_url RPC call and document it.
Closes #111
2017-01-31 08:13:25 +09:00
Neil Booth
5abe4faa8d JSON results are returned with HTTP status 500 2017-01-17 07:23:58 +09:00
Neil Booth
ffb4d4f158 Don't print response; might have auth info 2017-01-16 21:27:30 +09:00
Neil Booth
65f927122b daemon: properly check for HTTP status codes 2017-01-16 21:22:41 +09:00
Neil Booth
b01933913f Add traceback for daemon errors 2017-01-16 19:32:22 +09:00
Neil Booth
89209632ae Clean up daemon.py 2017-01-08 18:48:32 +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
0892b12036 Replace $DAEMON_VERSION and $DAEMON_SUBVERSION
in banner file.
2016-11-29 23:03:05 +09:00
Neil Booth
8970205e6c Remove obsolete debugging feature 2016-11-23 09:16:41 +09:00
Neil Booth
aa9f106865 Add missing self; use max_secs where intended. 2016-11-20 23:11:35 +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
cb7b7dd1fe Move pretty printing of sessions to client
Tweak logging
2016-11-12 21:36:49 +09:00
Neil Booth
d8bb174f2b Use correct daemon API 2016-11-12 09:42:35 +09:00
Neil Booth
59b2b2cb04 Better log formatting 2016-11-12 09:26:40 +09:00
Neil Booth
7496b511b8 Fix silly thinko 2016-11-12 09:25:34 +09:00
Neil Booth
312708e2e7 Fix daemon warming up 2016-11-12 09:20:46 +09:00
Neil Booth
409ea2c784 Daemon's send takes a processor
Simplest way to process the result and still be able to raise exceptions
in the daemon request loop.  In particular, we can pass missing txs through
as None in getrawtransactions.

Fixes #9
2016-11-12 09:09:31 +09:00
Neil Booth
f05e51df2a Skip logging transient errors just once 2016-11-12 08:12:41 +09:00
Neil Booth
56274fb9ea Prefix internal methods with an underscore 2016-11-12 07:43:24 +09:00
Neil Booth
c6b5c577ab More robust daemon error handling
Fixes #6
2016-11-10 23:26:11 +09:00
Neil Booth
c6a57daf6a Tweak daemon messages 2016-11-09 06:32:26 +09:00
Neil Booth
782268cd3e Limit concurrent daemon requests
Fixes #7
2016-11-07 22:47:38 +09:00
Neil Booth
6deb05ab6f It was a mistake to use tuples 2016-11-06 14:42:12 +09:00
Neil Booth
48f0d5456c Release preparation 2016-11-06 08:48:38 +09:00
Neil Booth
db29121d58 Improved daemon logging 2016-11-06 08:41:16 +09:00
Neil Booth
18efa67f1d Various daemon improvements 2016-11-06 08:24:18 +09:00
Neil Booth
00e9c5a31d Add daemon debugging caught-up facility 2016-11-05 21:37:02 +09:00
Neil Booth
26dc1021f6 Catch TimeoutError 2016-11-05 18:37:40 +09:00
Neil Booth
9fbbc8bfdb Clean up daemon interface. 2016-11-05 15:59:42 +09:00
Neil Booth
48b8b9332e Initial attempt at mempool 2016-11-05 12:27:37 +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
d2ebb80fac Extend copyright notice; improve comments 2016-11-03 16:45:06 +09:00
Neil Booth
897e68d20c Move some daemon logic to daemon.py 2016-10-27 07:45:10 +09:00
Neil Booth
8452d0c016 Split out daemon handler into separate file. 2016-10-27 07:43:48 +09:00