LBRY-Vault/lib
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
..
tests Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
wordlist Add Chinese Simplified wordlist 2015-08-20 23:18:47 +09:00
__init__.py Extend Wallet Import Format with txin type. Extend class Imported_Wallet. 2017-09-29 15:32:55 +02:00
base_wizard.py storage upgrade as part of the wizard. fix storage upgrade on kivy. 2018-05-31 19:43:50 +02:00
bitcoin.py use libsecp256k1 if available. abstract away ecc stuff. move symmetric crypto and hash functions to crypto.py 2018-05-25 15:43:06 +02:00
blockchain.py fix #4401 2018-06-03 17:17:56 +02:00
checkpoints.json Replace initial headers download with hardcoded checkpoints 2017-12-12 10:20:44 +01:00
checkpoints_testnet.json Add checkpoints file for testnet. Check that received headers are after max_checkpoint 2017-12-13 14:22:46 +01:00
coinchooser.py Fix typos 2018-04-15 20:34:40 +02:00
commands.py Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
constants.py add regtest support (#4242) 2018-04-11 19:10:14 +02:00
contacts.py fix openalias py3 2018-03-06 16:08:49 +01:00
crypto.py use libsecp256k1 if available. abstract away ecc stuff. move symmetric crypto and hash functions to crypto.py 2018-05-25 15:43:06 +02:00
currencies.json added therocktrading exchange rate (#4272) 2018-04-24 09:28:38 +02:00
daemon.py storage upgrade as part of the wizard. fix storage upgrade on kivy. 2018-05-31 19:43:50 +02:00
dnssec.py do not raise BaseException 2018-04-07 17:10:30 +02:00
ecc.py ecc: (minor) use ECPubkey.from_point 2018-05-27 03:55:10 +02:00
ecc_fast.py rename dylib for libsecp 2018-05-30 22:50:03 +02:00
exchange_rate.py util.make_dir: 0o700 permissions on folders (#4357) 2018-05-28 14:22:54 +02:00
i18n.py Add missing languages to settings dialog 2018-05-23 22:15:14 +02:00
interface.py First message on an interface is server.version (#4407) 2018-06-05 12:41:41 +02:00
jsonrpc.py Password-protect the JSON RPC interface 2018-01-07 19:30:23 +01:00
keystore.py tests: bip32 extended version bytes 2018-05-28 20:27:08 +02:00
mnemonic.py Fix typos 2018-04-15 20:34:40 +02:00
msqr.py Remove Python 2 support imports. 2017-11-13 02:26:48 -06:00
network.py Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
old_mnemonic.py Remove Python 2 support imports. 2017-11-13 02:26:48 -06:00
paymentrequest.proto Update paymentrequests.proto 2017-08-23 03:15:14 +02:00
paymentrequest.py use libsecp256k1 if available. abstract away ecc stuff. move symmetric crypto and hash functions to crypto.py 2018-05-25 15:43:06 +02:00
paymentrequest_pb2.py paymentrequest upd 2017-08-26 08:28:24 +02:00
pem.py fix #3411 2018-01-04 03:40:35 +01:00
plot.py follow-up prev 2018-03-10 00:37:16 +01:00
plugins.py do not raise BaseException 2018-04-07 17:10:30 +02:00
qrscanner.py this probably fixes #4072 2018-03-08 10:14:32 +01:00
ripemd.py update ripemd module for python3 2017-08-26 08:28:25 +02:00
rsakey.py minor 2017-11-29 18:14:39 -06:00
segwit_addr.py add segwit bech32 module 2017-08-31 09:59:54 +02:00
servers.json Remove server from default list: cryptohead.de (#4320) 2018-05-03 20:30:42 +02:00
servers_regtest.json add regtest support (#4242) 2018-04-11 19:10:14 +02:00
servers_testnet.json update default server list 2018-03-05 06:00:24 +01:00
simple_config.py util.make_dir: 0o700 permissions on folders (#4357) 2018-05-28 14:22:54 +02:00
storage.py follow-up #4396: new 2fa wallets could not be created 2018-06-01 22:19:00 +02:00
synchronizer.py Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
transaction.py use libsecp256k1 if available. abstract away ecc stuff. move symmetric crypto and hash functions to crypto.py 2018-05-25 15:43:06 +02:00
util.py util.make_dir: 0o700 permissions on folders (#4357) 2018-05-28 14:22:54 +02:00
verifier.py Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
version.py prepare release 3.1.3 2018-04-16 18:43:02 +02:00
wallet.py Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
websockets.py Remove explicit send calls, part deux (#4408) 2018-06-06 15:06:04 +02:00
x509.py use explicit utf-8 encoding when opening files in text mode 2018-03-23 21:47:51 +01:00