Commit Graph

72 Commits

Author SHA1 Message Date
Neil Booth
0dc99d7c63 Fix RPCError import
Closes #443
2018-04-10 14:16:49 +09:00
Neil Booth
1a0eea25c3 ElectrumX 1.4.3
Close connections more aggressively on shutdown

We need VERSION in its own file, unfortunately
Fixes #442
2018-04-09 21:34:46 +09:00
Neil Booth
f54c4e6e25 Resolve address locally if proxy and not tor
and report it correctly in peers output

Requires aiorpcX 0.5.5
Closes #301
2018-04-09 14:35:26 +09:00
Neil Booth
4eebf420e8 Cleaner shutdown
Use aiorpcX task functionality

Shut down peer sessions cleanly
2018-04-09 10:14:12 +09:00
Neil Booth
8bf30fba0e Move server/version.py to Controller class 2018-04-09 09:37:07 +09:00
Neil Booth
bc6093a8fe Fully integrate aiorpcX 2018-04-08 10:16:36 +09:00
Neil Booth
e69b1d930f Convert PeerSession to use aiorpcX 2018-04-05 15:28:46 +09:00
Neil Booth
c1ba211d43 Remove code appropriate for future aiorpcX
Closes #428
2018-03-26 21:20:35 +09:00
Neil Booth
81141eb390 Proxy detection improvements
- don't detect in a loop.  Only detect at startup, and later if
  needed and 15 minutes has passed since the last attempt
2018-03-26 17:27:47 +09:00
Neil Booth
c11ad5d189 Bump to aiorpcX version 0.4.4
Update peers.py to not pass local_addr to proxy
2018-03-13 15:32:49 +08:00
Neil Booth
74bc80ffbd Revert "Log from Peer Manager directly"
This reverts commit d2e6f7d75b.
2018-03-12 08:25:03 +08:00
Neil Booth
d2e6f7d75b Log from Peer Manager directly 2018-03-10 13:06:37 +08:00
Neil Booth
80fc334449 Switch to aiorpcX for SOCKS proxying. 2018-03-10 13:06:37 +08:00
Neil Booth
ebc83b4028 Import peers in main_loop
Also only if peer discovery is enabled.  It's less confusing
that way.
2018-03-10 09:48:04 +08:00
Neil Booth
35dd1f6199 Remove IRC support 2017-11-27 15:05:42 +09:00
Neil Booth
72fce87088 Put server_features() on the environment object
Fixes #302
2017-11-16 20:14:49 +00:00
Neil Booth
81947d796b Enhance PEER_DISCOVERY environment variable
It is now tri-state - ON, OFF or SELF.

Fixes #287
2017-10-11 13:54:13 +09:00
Neil Booth
131344715a Minor environment variable improvements
- COIN and NET strip surrounding whitespace
- new environment variable RPC_HOST, similar to HOST, but
  for RPC.  Permits fine-grained control of which addresses
  the RPC server listens on.
- HOST and RPC_HOST strip surrounding whitespace from hostnames
  and IP addresses
- tests and documentation updated to match
2017-09-09 22:00:54 +09:00
Neil Booth
2f69aaa487 Remove dead code 2017-09-09 10:39:13 +09:00
Neil Booth
305fd89740 Stop persisting peers; resdiscover on restart 2017-09-08 17:39:48 +09:00
Neil Booth
40fa79da63 Remove exception for onion peers
Like clearnet peers, they are only returned in server.peers.subscribe
if there was a successful connection.
2017-09-08 17:31:46 +09:00
Neil Booth
794e1d86ff Peerdisc: handle protocol 1.1 server.version replies 2017-09-07 17:03:17 +09:00
Neil Booth
a978ca6df7 Permit HOST to be a comma-separated list.
Update documentation to match.
2017-09-06 20:19:59 +09:00
Neil Booth
f8a838c589 Add "hash_function" member to server.features.
Update documentation
2017-08-26 15:37:59 +09:00
Neil Booth
fab3f5affe Have proxy.create_connection use kwargs
Fixes #227
2017-08-21 23:38:54 +09:00
mmouse-
69c1535d13 Use our listening Host/IP for outgoing connections also (#226)
Explicitely set the local IP for outgoing connections, if we're listening
on only one Hostname or IP (of a multi-IP machine). This makes sure our
peers see our outgoing connections coming from the same IP that we're
listening on when we have a specific HOST= configured.

For machines with more than one IP this avoids source-destination
mismatch errors when advertizing our peer. Resolves kyuupichan/electrumx#225
2017-08-21 05:47:05 +07:00
Neil Booth
75feac5d1e Check prior header hashes to detect forks 2017-07-30 21:32:41 +09:00
Neil Booth
4cc3720589 Disable IRC for bitcoin mainnet
Only require IRC_CHANNEL if IRC_PREFIX is given.
2017-06-07 23:47:17 +09:00
Neil Booth
e9acb685ab Display hosts in diagnostic 2017-04-09 14:32:45 +09:00
Neil Booth
8a2821d542 Reject invalid hostnames in Env 2017-04-09 14:15:10 +09:00
Neil Booth
b6d8b86dd6 Ignore hosts not appearing in their own features 2017-04-09 14:02:32 +09:00
Neil Booth
f3de91180e Add tests for server/env.py 2017-04-06 07:27:48 +09:00
Neil Booth
2c43e89b05 Only set last_good if successfully verified
Rename last_connect to last_good
2017-04-03 21:37:51 +09:00
Neil Booth
7b17d99c5a Put log on one line 2017-04-03 20:10:42 +09:00
Neil Booth
9f27ea875c Fix peer replacement logic
- drop the IP address peer
- update the remaining peer with fresh info
2017-04-03 20:07:46 +09:00
Neil Booth
2656fd78a4 Clarify that we may not have a clearnet peer 2017-04-02 21:25:02 +09:00
Neil Booth
a94d320e5d New feature: force peer discovery via proxy
Set FORCE_PROXY to non-empty to force peer discovery to go
through the proxy.  See docs/ENVIRONMENT.rst

Wait for an attempt at proxy discovery to be made before beginning
peer discovery.
2017-04-02 15:06:29 +09:00
Neil Booth
77a441ad06 Improve proxy handling
Have a background proxy detection loop; removes need to check
specific peers at startup.
Consider proxy down once attempts to use it fail 3 times in a row.
Regularly attempt to rediscover a proxy if it is down.
2017-04-02 14:27:49 +09:00
Neil Booth
81e6577838 Catch address resolution failure exceptions 2017-04-01 22:55:16 +09:00
Neil Booth
8e00affc1a Fix the diagnostic looping in PeerSession
Fixes #160
2017-03-28 11:14:50 +09:00
Neil Booth
23a408c572 More logging 2017-03-27 13:04:59 +09:00
Neil Booth
2650459012 Peer discovery fixes
Change last_connect to mean last connection as its name implies,
not last connection that wasn't bad.
Keep bad peers around for 3 tries.

Improve diagnostic
2017-03-26 11:42:23 +09:00
Neil Booth
79bce5335e Fix missing self 2017-03-25 20:52:26 +09:00
Neil Booth
3236989165 Fix bad peer looping
JWU42 pointed out an issue where peer discovery could get in a
failure loop for bad peers; this fixes the the root cause and
the immediate retries
2017-03-25 20:22:38 +09:00
Neil Booth
f04ff6f5b3 Don't add_peer to ourself 2017-03-25 13:28:42 +09:00
Neil Booth
8236aaf234 Be more strict on form of features dictionary 2017-03-25 13:28:42 +09:00
Neil Booth
be5397a853 Validate hostnames before accepting a new peer
Don't retain non-public addresses

Closes #157
2017-03-25 11:58:54 +09:00
Neil Booth
7a2f29aabe Be stricter accepting add_peer requests
- rate-limit onion add_peer requests
- for clearnet peers only accept if the peer resolves to the
  source address
2017-03-25 11:36:14 +09:00
Neil Booth
060d32211f Check height for all peers
Closes #152
2017-03-25 11:35:54 +09:00
Neil Booth
d198b95798 Reduce new peers per source limit to 2 by default 2017-03-25 11:35:54 +09:00