Commit Graph

112 Commits

Author SHA1 Message Date
Neil Booth
46adf543fc Enforce pycodestyle in server/ 2018-06-10 18:39:12 +09:00
elmora-do
7baf6cf68d Add $PAC (#474)
* Add $PAC

* Refactor and improve masternode notifications
* Update DASH/$PAC RPC documentation

These RPC commands were documented:

masternode.announce.broadcast
masternode.subscribe
masternode.list
masternode.info
2018-06-06 09:15:36 +09:00
Neil Booth
2559751ead Display aiorpcX version on startup 2018-06-05 00:10:11 +09:00
Neil Booth
52658cfc9c Set the shutdown event via call_soon
Fixes #480

Require aiorpcx 0.5.6, handle ConnectionError appropriately;
this ensures the same bug would give a better error message
2018-06-04 13:22:30 +09:00
Neil Booth
7d9ffbbed0 Minimum supported protocol version is 1.1 2018-05-29 13:31:40 +08:00
Neil Booth
77051f83a4 Make HASHX_LEN a global, not a coin property 2018-05-22 11:44:27 +08:00
John L. Jegutanis
c813918b8b Add version to the getinfo result (#471) 2018-05-19 01:16:02 +08:00
Neil Booth
ec2565679a Force close stale sessions that aren't closing 2018-04-12 21:43:25 +08: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
142aa48dbb Release 1.4.2
Requires aiorpcX 0.5.5
2018-04-09 14:41:50 +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
fec2ee1d8f Set PROTOCOL_MIN to 1.0
Earlier protocol versions are used by 2.9.x clients of Electrum and
Electron Cash.  They all have the local daemon vulnerability, so
it seems a good time to phase out support for those clients.
2018-04-09 09:37:07 +09:00
Neil Booth
8bf30fba0e Move server/version.py to Controller class 2018-04-09 09:37:07 +09:00
Neil Booth
837bea217a Remove controller.groups 2018-04-08 17:51:00 +09:00
Neil Booth
415552989b Fix group consolidation logic 2018-04-08 10:16:36 +09:00
Neil Booth
bc6093a8fe Fully integrate aiorpcX 2018-04-08 10:16:36 +09:00
John L. Jegutanis
90f28314d2 Add DROP_CLIENT env variable (#432)
This will disconnect any client based on their version string,
using a regular expression.
Useful for dropping buggy/unsupported clients.
2018-04-05 06:49:56 +09:00
Neil Booth
47f65ffda2 Add raw header subscriptions. 2018-03-08 16:14:03 +08: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
Neil Booth
5109990ea4 Add blockchain.block.headers RPC call 2018-03-03 18:39:24 +08:00
Neil Booth
49ee008346 Relax the constraints on read_headers
They were really for fs_block_hashes; that still enforces
the full constraint.  Simplifies get_chunk.
2018-03-03 18:39:24 +08:00
Neil Booth
76f4969a98 listunspent methods consider mempool receipts
- Update docs.  Height is 0 for mempool receipts
- Implement mempool.get_utxos() and use it
- Rename mempool.spends to mempool.potential_spends

Closes #365
2018-02-11 23:21:30 +08:00
ThomasV
2d7403f2ef New protocol: (#330)
- add method mempool.get_fee_histogram
- bump protocol version to 1.2
2018-01-20 08:51:38 -04:00
Neil Booth
7126864052 Wait for mempool to sync before starting external servers
Closes #335
2018-01-12 15:26:12 +08:00
Neil Booth
e5b4f5f316 Change read_tx interface of deserializer
Most callers didn't want the hash, so create a separate call
that does both.  Add a new call that returns the TX and its vsize.
2018-01-11 15:45:10 +08:00
Neil Booth
ddf65fa9c2 Don't send notifications to LocalRPC sessions
Fixes #320
2017-11-28 18:51:49 +09:00
Neil Booth
cb33dd115f Clean up client notifications
- mempool informed of new block; it notifies controller synchronously
- controller notifies sessions synchronously
- sessions are notified of new height synchronously.  Any address touch
notifications are returned to the controller and scheduled
asynchronously.

Also, remove a redundant notification of height on initial header
subscriptions - the subscription response gives the current height;
we also used to send a notification as we didn't update our idea
of notified height.
2017-11-27 18:22:32 +09:00
Neil Booth
cf99f733d9 Remove the get_proof RPC.
The client will get an unknown method error message instead.
2017-10-15 16:27:10 +09:00
Neil Booth
74cb4c2f45 Require Python 3.6 2017-10-14 11:51:11 +09:00
Neil Booth
9bf220dec6 Widen min and max columns 2017-10-12 14:19:28 +09:00
Neil Booth
346385680e Fix listunspent methods to remove mempool spends
Fixes #277
2017-10-12 13:56:46 +09:00
Neil Booth
366c556c5f Split out lib/server_base.py 2017-09-28 08:56:12 +08:00
Luke Childs
0e6b59eb92 Add ALLOW_ROOT option (#268)
* Add ALLOW_ROOT option

* Document ALLOW_ROOT option

* Update controller.py

* Update ENVIRONMENT.rst
2017-09-20 08:14:06 +08: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
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
2a955a922a Improved handler handling
- move server.donation_address to the session from controller
- session controls handler map, no longer lives partly on controller
2017-09-07 13:13:34 +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
37c15f7018 Show protocol version in sessions RPC call 2017-09-06 18:14:52 +09:00
Neil Booth
e7601a23cd Implement other address methods for scripthash 2017-09-06 16:41:14 +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
137236712f Add EVENT_LOOP_POLICY environment variable
Based on #215 by JustinTArthur.

- Accept EVENT_LOOP_POLICY of uvloop
- Move initilisation from electrumx_server to controller
- SocksProxy now requires a loop
- Update tests
2017-08-26 14:03:02 +09: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
Neil Booth
4d2456e4b4 Explicitly bind to both IPv4 and IPv6. 2017-08-21 20:07:08 +09:00
Neil Booth
92ba67037f Use None instead of localhost
See #211.  Some don't have localhost mapped, and
we should also bind to IPv6 interfaces.

Thanks to gaoyaxing24 for testing.
2017-08-02 16:54:58 +09:00
TheLazieR Yip
b0e23e903d Allow custom ElectrumX class 2017-05-14 16:26:17 +00:00
John L. Jegutanis
a4e4f80ad7 Allow custom Daemon and BlockProcessor classes 2017-05-07 14:22:23 +02: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
8236aaf234 Be more strict on form of features dictionary 2017-03-25 13:28:42 +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