Commit graph

114 commits

Author SHA1 Message Date
Harm Aarts
e57e55aad8 Remove explicit send calls, part deux (#4408)
* Rename synchronous_get to synchronous_send

This makes it more inline with the method 'send' of which
synchronous_send is the, well, synchronous version.

* Move protocol strings from scripts to network

This is again a small step in the right direction. The network module is
going to accumulate more and more of these simple methods. Once
everything is moved into that module, that module is going to be split.

Note that I've left the scripts which use scripts/util.py alone. I
suspect the same functionality can be reached when using just
lib/network.py and that scripts/util.py is obsolete.

* Remove protocol string from verifier and websocket

Websocket still has some references, that'll take more work to remove. Once the
network module has been split this should be easy.
I took the liberty to rename a variable to better show what it is.

* Remove protocol strings from remainder

The naming scheme I'm following for the newly introduced methods in the network
module is: 'blockchain.<subject>.<action>' -> def <action>_(for|to)_<subject>

* Move explicit protocol calls closer to each other

This makes it easier to keep track of the methods which are due to be
extracted.

* Remove `send` when using `get_transaction`

This is the final step to formalize (the informal) interface of the network
module.
A chance of note is changed interface for async/sync calls. It is no longer
required to use the `synchronous_send` call. Merely NOT passing a callback
makes the call synchronous. I feel this makes the API more intuitive to work
with and easier to replace with a different network module.

* Remove send from get_merkle_for_transaction

The pattern which emerged for calling the lambda yielded an slight refactor.
I'm not happy with the name for the `__invoke` method.

* Remove explict send from websockets

* Remove explicit send from scripts

* Remove explicit send from wallet

* Remove explicit sync_send from commands, scripts

* Remove optional timeout parameter

This parameter doesn't seem to be used a lot and removing it makes the
remaining calls easier. Potentionally a contentious choice!

* Rename `broadcast` to `broadcast_transaction`

Doing so makes the method name consistent with the other ElectrumX protocol
method names.

* Remove synchronous_send

Now every method is intuitive in what it does, no special handling required.
The `broadcast_transaction` method is weird. I've opted not to change the
return type b/c I found it hard to know what the exact consequences are. But
ideally this method should just works as all the other ElectrumX related
messages. On the other hand this shows nicely how you _can_ do something
differnt quite easy.

* Rename the awkwardly name `__invoke` method

The new name reflects what it does.

* Process the result of linter feedback

I've used flake8-diff (and ignored a couple of line length warnings).

* Rename tx_response to on_tx_response

This fell through the cracks when this branch was rebased.

* subscript_to_scripthash should be get_balance

An oversight while refactoring.

* Add missing return statement

Without this statement the transaction would have been broadcasted twice.

* Pass list of tuples to send not single tuple

* Add @staticmethod decorator

* Fix argument to be an array
2018-06-06 15:06:04 +02:00
Neil Booth
b164cc4bba Pass raw=True when subscribing to headers
Remove use of deprecated bitcoin address
2018-06-04 16:52:44 +09:00
ThomasV
61b69f3856 update get_history script 2017-11-29 10:14:39 +01:00
Justin Turner Arthur
857eb4ac1d Remove unused imports. Explicitly import a few deep imports. 2017-11-13 02:28:00 -06:00
ThomasV
cc1b8f4dce fix peers type 2017-09-17 16:46:24 +02:00
ThomasV
8c5b6bdaf3 Read default server list from file. Update list with 1.1 servers. Remove nolnet option. 2017-09-13 11:30:30 +02:00
SomberNight
53c98ec96d migrating print() to python 3 2017-09-12 17:01:55 +02:00
ThomasV
70af22c9e4 update scripts/servers to display server version 2017-09-07 09:41:21 +02:00
ThomasV
ff5074207c scripts: use config in get_peers 2017-09-06 17:35:41 +02:00
ThomasV
557b2c1896 update scripts for python3 2017-09-05 15:27:08 +02:00
ThomasV
2436c4f904 rm authenticator script (replaced by new android app 2016-02-15 16:25:59 +01:00
ThomasV
2be906fde2 remove merchant script; it is now replaced by daemon and jsonrpc 2015-11-30 10:59:39 +01:00
Neil Booth
ae4cfc9f0b Unregister network callbacks from QT gui
Rework the callback system in QT to make this easy, and avoid
leaking window references that prevent the window from being
GC-ed on close
2015-11-13 23:36:29 +09:00
ThomasV
bb7b0884e3 Various fixes for command line. Make 'payto' command require network (fixes #1525) 2015-10-29 11:06:09 +01:00
Neil Booth
6f1367fea6 Unify message IDs between network and interfaces
Previously network.py had its own idea of request IDs,
and each interface had its own which was sent on the wire.
The interface would jump through hoops to translate one
to the other.

This unifies them so that a message ID is passed when
queueing a request, in addition to the method and params.
network.py is now solely responsible for message ID management.

Apart from being simpler and clearer, this also should be faster
as there is much less data structure manipulation and rebuilding
happening.
2015-09-09 21:00:25 +09:00
Neil Booth
cd83b93e98 Return the result not the full dictionary 2015-08-31 18:26:14 +09:00
Neil Booth
be8a87c322 Remove redundant line 2015-08-31 17:48:03 +09:00
Neil Booth
2a1b717a21 Fix scripts/peers
Needed an almost complete rewrite now we use select.
2015-08-31 17:44:50 +09:00
Neil Booth
2d05e7d891 Merge the network and network_proxy 2015-08-31 12:00:38 +09:00
ThomasV
c9b3185724 copy mpk to clipboard 2015-08-18 17:05:02 +02:00
ThomasV
43880d452e dynamic fees 2015-08-05 15:45:28 +02:00
ThomasV
074872afbc fix #1359 2015-07-22 08:23:13 +02:00
ThomasV
ad9f7411d7 peers script: handle missing fields 2015-07-05 23:28:05 +02:00
Neil Booth
01d8f79a75 Clean up pick_random_server() and filter_protocol() and their
call sites.

Remove unused imports and redundant random pick of server
2015-05-24 21:07:35 +09:00
ThomasV
c2a4252065 do not pass config to storage. request height from network_proxy if connected 2015-05-08 10:58:54 +02:00
Neil Booth
79de458101 Preparation for moving the set of verified and unverified txs to the wallet.
The verifier will retain responsibility for verification, but will no longer
hold the transaction sets itself.

Change requires_fee to take a wallet.
Add new function add_unverified_tx()
Move get_confirmations() to the wallet from the verifier.
2015-05-07 09:21:08 +09:00
ThomasV
4bce96526b follow up to c07e956127 2015-05-05 14:59:56 +02:00
Neil Booth
c07e956127 Pass the response_queue to the constructor, not start().
Removes an unnecessary Thread base-class override.  The python
documentation also strongly discourages overriding anything other
than run().
2015-05-05 20:37:25 +09:00
Neil Booth
9cf2eff16b Make is_connected into a member function. No change in logic. 2015-05-05 20:00:10 +09:00
Neil Booth
4d55cb9528 First of several incremental patches tightening up interface.py.
Remove some unneeded imports, a constant and a line of dead code.
Document the current external API interface.py provides.
2015-05-05 14:02:51 +09:00
ThomasV
44d076fbc4 fix #1132 2015-04-09 19:01:22 +02:00
ThomasV
42ed67e8c7 fix #1131 2015-04-05 18:58:32 +02:00
ThomasV
be5731d463 move make_payment_request to lib 2015-04-05 18:57:00 +02:00
ThomasV
8314efdfd5 fix #802 2015-04-02 18:01:31 +02:00
ThomasV
3c77eeba7d fix #1120 2015-04-02 12:43:17 +02:00
ThomasV
fb699e5294 fix #955 2015-04-02 12:35:24 +02:00
Roman Zeyde
c4b306cdbe fix Transaction.deserialize() to Transaction() 2015-03-30 18:28:24 +03:00
ThomasV
acc594e5d1 add android authenticator script 2015-03-01 13:27:18 +01:00
ThomasV
69ee0bd0de new scripts: bip70 and estimate_fee 2015-02-16 14:05:04 +01:00
ThomasV
feebd7c253 add dump and getrequest to merchant script 2014-09-18 12:59:29 +02:00
ThomasV
c3419eb7bb update script 2014-09-15 15:01:09 +02:00
ThomasV
43c8fd43c4 update peers and txradar scripts 2014-09-15 14:52:28 +02:00
ThomasV
1a8425ff5d additional fix for #793 2014-09-03 11:10:02 +02:00
ThomasV
2c36518e46 handle non-answering servers in peers script 2014-08-15 08:09:43 +02:00
ThomasV
a6091780d0 change server in peers script 2014-08-08 14:47:55 +02:00
ThomasV
466f325b88 fix peers script 2014-08-06 04:03:16 +02:00
ThomasV
a4d904bfd3 update peers script 2014-08-05 12:44:43 +02:00
ThomasV
291038a586 update peers script 2014-08-05 12:36:26 +02:00
ThomasV
c81810a7c8 fix #776 2014-08-04 16:02:14 +02:00
ThomasV
f7280e4637 cleanup daemon threads 2014-07-29 10:43:04 +02:00