Commit Graph

52 Commits

Author SHA1 Message Date
Neil Booth
bc6093a8fe Fully integrate aiorpcX 2018-04-08 10:16:36 +09:00
dax
cf49b737d3 Enable verbose mode in blockchain.transaction.get (#397)
getrawtransaction: optional verbose mode

Update PROTOCOL.rst docs
2018-03-07 08:59:06 +08:00
SomberNight
e2b15d7fe1 fix: estimatesmartfee when there is no feerate from daemon (#306) 2017-11-04 00:21:46 +07:00
SomberNight
8293da1e10 use estimatesmartfee for fee estimation (#300)
* use estimatesmartfee for fee estimation, in case of BitcoinSegwit

* use estimatesmartfee in daemon if available

* daemon._is_rpc_available() now catches DaemonError instead of using HTTP error code
2017-11-01 15:30:27 +07: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
1f3e942cbc Some further cleanup 2017-08-26 12:47:47 +09:00
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
FujiCoin
b4ac4b6a05 Add Fujicoin (#218)
* Add Fujicoin

* Add explanation of FujiDaemon
2017-08-18 15:05:54 +07:00
Neil Booth
2ade5fce9c Revert "More logical mempool hash handling"
This reverts commit 87d24f38dc.
2017-07-23 14:55:03 +09:00
Neil Booth
87d24f38dc More logical mempool hash handling
Fixes the issue whereby notifications weren't sent as long as new blocks
kept coming in.  Now a new height notification, with an appropriate mempool
update, is sent after each batch of blocks is processed.
2017-07-19 23:50:44 +09:00
Neil Booth
4665ba6315 Improve daemon JSON RPC compatibility
- give an ID to each request
- allow client session to be customized by derived classes

Based on changes suggested by erasmospunk
2017-07-13 10:51:54 +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
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
Neil Booth
55cedfea9c Have Daemon work with aiohttp 1 and 2
Fixes #163
2017-04-01 10:43:34 +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
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