Commit Graph

57 Commits

Author SHA1 Message Date
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
Neil Booth
30bb832ef8 Prepare 1.0 2017-03-05 13:22:09 +09:00
Neil Booth
27f94cfb04 Take up to 2 peers randomly from each bucket
Bumped up from 1.
Restore STALE_SECS to 1 day
2017-03-01 20:20:30 +09:00
Neil Booth
39bcdb1b6a Require Python 3.5.3
3.5.2 has various socket and API issues affecting peer discovery

Closes #135
2017-03-01 07:23:11 +09:00
Neil Booth
be9d063457 Rename function 2017-03-01 06:44:38 +09:00
Neil Booth
31b978f21e Remove debug logging and peers semaphore.
Increase STALE_SECS to 4 hrs.  Will revert to 1 day soon.
2017-02-28 07:27:36 +09:00
Neil Booth
ddbc13653f Merge branch 'develop' 2017-02-27 19:20:04 +09:00
Neil Booth
2c1481859f More verbose peer logging
Force more reconnects.  Restrict semaphore to 2.
2017-02-27 19:15:07 +09:00
Neil Booth
e2d640dcb3 Don't announce self if not public
Show all hosts add_peer gives
2017-02-26 15:26:11 +09:00
Neil Booth
0145098165 Add debug output
Idea is to help understand #135
2017-02-26 10:42:32 +09:00
Neil Booth
d36d222489 Maintain more than one self-identity
Rather than just retaining our clearnet identity from the environment,
maintain any tor one as well.  This is a little cleaner and avoids
confusion over port assignment when converting to real names.

Fixes #136
2017-02-26 10:22:22 +09:00
fr3aker
4c8b5a6439 fix tor coin peers always scheduled for check (#139)
fixes #138
2017-02-26 10:16:08 +09:00
Neil Booth
5bcbdea16a Only set last_connect if the connection was good 2017-02-20 05:37:53 +09:00
Neil Booth
5662f1fa88 Add facility to disable peer discovery
and/or self announcement.
2017-02-19 19:02:01 +09:00
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
0149f2785f A few peer handling improvements
based on suggestions from hsmiths
Set transport to None if a connection is lost
Only subscribe to peers if the peer is verified on same network
2017-02-19 10:21:17 +09:00