Commit Graph

36 Commits

Author SHA1 Message Date
Neil Booth
bc6093a8fe Fully integrate aiorpcX 2018-04-08 10:16:36 +09:00
Neil Booth
c9b9e920f6 Compplete tests for lib/util.py 2017-10-15 18:02:18 +09:00
Justin Turner Arthur
0c2e5c6368 Minor optimizations to Bitcoin tx processing (#214)
* Construct unpacking functions for byte format up front to save time
wasted on parsing format string every iteration.

* Store length ahead of time as the overhead adds up.

* Reduce object attribute lookups in hash functions.

* Clean up lib pkg API changes. Unit test new "public" API members.
Underscore prefix for internal hash module funcs. Make bytes.fromhex a
public function.

* Document recent performance findings.
2017-09-09 11:06:46 +07:00
Neil Booth
f4cc1e2926 Fix protocol version reported in server.peers.subscribe
- new library function protocol_version_string() with tests
- remove ad-hoc class functions

Fixes #251
2017-09-08 10:54:56 +09:00
Neil Booth
9c25685eb9 Handle client protocol range requests.
Add more tests.
2017-09-06 17:11:18 +09:00
Neil Booth
135ab68f74 Simple protocol negotiation and setting of handlers
It turns out clients pass 0.10 instead of 1.0 as the protocol version.
Distinguish some handlers for 1.0 and 1.1 protocols.
Log protocol version request
Add tests of new library function
2017-09-06 16:24:56 +09:00
Neil Booth
3612b88e2e Permit underscores in hostnames.
Add tests.
2017-07-16 13:58:02 +09:00
John L. Jegutanis
1e9a65dccb Handle legacy daemon RPCs
Add support for daemons that don't have the new 'getblock' RPC call that
returns the block in hex, the workaround is to manually recreate the block
bytes. The recreated block bytes may not be the exact ones as in the
underlying blockchain but it is good enough for our indexing purposes.
2017-06-11 01:37:45 +03:00
Neil Booth
8a2821d542 Reject invalid hostnames in Env 2017-04-09 14:15:10 +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
3f35bc0298 More PEP8 stuff 2017-02-18 13:05:26 +09:00
Neil Booth
33cdfa4fc8 Merge branch 'nmarley-pep8' into develop 2017-02-18 12:54:01 +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
Nathan Marley
a03665696c recommendations from pycodestyle (pep8 style) 2017-02-07 20:12:50 -08:00
Neil Booth
a019fde853 Show uptime in RPC getinfo result 2017-02-04 10:35:36 +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
766da5ed79 Don't maintain a sub_count in controller
Just do a tally occasionally.
It's too tricky to keep it accurate as it double-counts resubscribing to
the same address, for example
2017-01-20 08:09:33 +09:00
Neil Booth
5f9e337457 Improve RocksDB iterator 2017-01-17 07:43:06 +09:00
Neil Booth
c8c4199503 New VirtualFile abstraction
Use for headers, tx counts and tx hashes.
2017-01-07 11:51:11 +09:00
Neil Booth
50f02747de Throttle abusive logging 2016-12-21 19:47:25 +09:00
Neil Booth
f600d3bd87 Fix a couple of issues with 0.9.0
Fixes #69
2016-12-12 07:24:00 +09:00
Neil Booth
1ef6a4d785 Split mempool out into new file.
Rework mempool handling
2016-12-12 00:05:42 +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
3d87e299ea Move formatted_time to library 2016-11-19 15:42:06 +09:00
Neil Booth
8e6e8329ac Remove dead code.
Also use native python3 functions to speed up 2 lib functions
2016-11-08 19:14:52 +09:00
Neil Booth
9acd91615c Merge remote-tracking branch 'github/master' into release-0.2.1
Include's bauerj's storage.py improvements.
2016-11-07 23:11:34 +09:00
Johann Bauer
f6f674577f Fix RocksDB and LMDB 2016-11-06 18:16:43 +01:00
Neil Booth
3ab07c1fb6 Speed up script parsing for ~3% faster throughput
Also improves the coin abstraction
2016-11-06 14:32:27 +09:00
Neil Booth
c0568daec3 Rework the DB API a bit 2016-11-03 19:09:21 +09:00
Neil Booth
d2ebb80fac Extend copyright notice; improve comments 2016-11-03 16:45:06 +09:00
Neil Booth
334ffdaa4f Begin work on proper server 2016-10-17 20:02:42 +09:00
Neil Booth
965b15023e Update notes / comments 2016-10-15 14:45:32 +09:00
Neil Booth
d8e9eb7796 Accurate cache accounting 2016-10-11 17:38:03 +09:00
Neil Booth
6644102441 Use hash168 to distinguish address types in DB 2016-10-10 11:42:33 +09:00
Neil Booth
64b7554b73 Fix some typos 2016-10-08 17:34:12 +09:00
Neil Booth
a3dbc68614 Initial revision 2016-10-08 17:17:43 +09:00