Commit Graph

34 Commits

Author SHA1 Message Date
John L. Jegutanis
885872f0b5 Various improvements (#233)
* Fix formatting

* Refactor daemons

Replaced FujiDaemon with FakeEstimateFeeDaemon that simulates estimate
fee calls and provide the same functionality.
Removed the parameter False for LegacyRPCDaemon's getblock RPC call as
it is not needed.

* Fix Crown coin P2SH_VERBYTES and add REORG_LIMIT
2017-08-26 12:33:20 +09:00
Neil
d9ff685958 Merge pull request #183 from thelazier/dash_mn_methods
Add support for Dash Masternode methods
2017-05-16 19:02:17 +07:00
Neil Booth
08dbbf217a client_version must be a tuple
Fixes #180
2017-05-16 14:55:19 +09:00
TheLazieR Yip
2e87d49e04 Add more comment on DashElectrumX.server_version 2017-05-15 08:10:09 +00:00
TheLazieR Yip
e99400c225 Update DashElectrumX as commented 2017-05-15 04:12:33 +00:00
TheLazieR Yip
4da2278729 Force server string response for Electrum-Dash 2.6.4 client 2017-05-14 17:38:55 +00:00
TheLazieR Yip
f179c67935 Add support for Dash Masternode methods
+ Add DashDaemon class
+ Add DashElectrumX class
+ Update coin configurations for Dash
2017-05-14 16:36:02 +00:00
LaoDC
9e34bf8583 reverted and made the version split isolated within the banner logic only as not to affect other parts of the code. 2017-05-03 17:43:47 +07:00
LaoDC
9dceeb914c Add new variables to BANNER(_TOR)
$SERVER_VER will return the version number (eg: 1.0.10)
$SERVER_SUBVERSION will return the full version string (eg: ElectrumX 1.0.10)

$VERSION is kept for legacy which is the same as $SERVER_SUBVERSION
2017-05-03 17:10:52 +07:00
LaoDC
5e92feb8a6 Add new variables to BANNER(_TOR)
$SERVER_VER will return the version number (eg: 1.0.10)
$SERVER_SUBVERSION will return the full version string (eg: ElectrumX 1.0.10)

$VERSION is kept for legacy which is the same as $SERVER_SUBVERSION
2017-05-03 17:09:52 +07: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
abba36ac6c Relax the get_chunk restriction based on client
Closes #162
2017-04-01 11:17:57 +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
e0fd64d29a Rate-limit add_peer calls randomly
Prepare 1.0.1
2017-03-22 07:59:56 +09:00
Neil Booth
9bc326430d Import JSONRPC 2017-02-27 19:14:56 +09:00
Neil Booth
b3005fbb3e Fix typo 2017-02-26 13:18:06 +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
Neil Booth
04e7dbe99e Only serve chunks in forward direction
This disconnects bad clients that are on the wrong network
for some reason, before they consume enormous bandwidth.

Closes #132
2017-02-26 10:16:09 +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
68a8835db6 Implement script hash subscriptions
Best considered experimental

Closes #124
2017-02-18 23:16:20 +09:00
Neil Booth
140304460d Remove debug line 2017-02-18 16:23:39 +09:00
Neil Booth
f3cdd97ff9 Report unconfirmed parents correctly.
Also, send a notification to the client if the unconfirmed status
of any parent changes.

Fixes #129
2017-02-18 16:10:20 +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
13cf80a326 Re-enable bandwidth throttling 2017-02-06 19:29:20 +09:00
Neil Booth
eff5d3d7e4 Force JSONRPCv2
Temporary backwards compat hack for old Coinomi wallets
2017-01-31 07:48:18 +09:00
Neil Booth
06c8eda161 Preparations for peer discovery
DEFAULT_PORTS is a now a coin property.
Other miscellaneous updates to get things closer
2017-01-29 06:47:43 +09:00
Neil Booth
e56f188816 Implement peer subscriptions
Incremental updates are passed.
Also implement a server.features RPC
2017-01-25 20:28:19 +09:00
Neil Booth
cb0160901f Unify executor and futures logic 2017-01-24 21:25:37 +09:00
Neil Booth
a7462a6ea3 Complete rewrite of JSON RPC infrastructure
Aim to be easier for clients to use, because to do peer
discovery we must act as a client to other servers.

Split out JSON session concept from the asyncio protocol
concept.  This makes the JSON RPC support more easily
testable and usable as a stand-alone library.

In addition, support JSON RPC v1 and v2, and auto-detection
of peer's version.
2017-01-23 23:36:02 +09:00
Neil Booth
ed0646efbf Tidy up request and notification sending 2017-01-20 20:04:56 +09:00
Neil Booth
9a8c598fa8 The session needs to handle the version command. 2017-01-18 19:50:26 +09:00
Neil Booth
4eed43accb Add named-argument handling as per JSON RPC 2.0
This involved a rewrite of the JSON RPC layer.
I took the opportunity to clean up the handling of requests
in general.  It should now be easy to return nice help from
the docstrings.

Closes issue #99
2017-01-12 07:59:21 +09:00
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
2017-01-09 17:14:06 +09:00
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
2017-01-09 16:15:17 +09:00