Commit graph

39 commits

Author SHA1 Message Date
Janus
097ac144d9 file reorganization with top-level module 2018-07-13 14:01:37 +02:00
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
SomberNight
0fbc0accb9 fix-up stdio gui 2018-01-12 15:05:27 +01:00
SomberNight
4435a6c9c7 use tx.txid() instead of tx.hash() 2018-01-12 14:18:50 +01:00
Justin Turner Arthur
857eb4ac1d Remove unused imports. Explicitly import a few deep imports. 2017-11-13 02:28:00 -06:00
Justin Turner Arthur
9a0aa9b478 Remove Python 2 support imports. 2017-11-13 02:26:48 -06:00
ThomasV
b9da5afa9d replace bitcoin.is_valid 2017-08-31 10:06:13 +02:00
ThomasV
c3388d9677 misc python3 updates:
- use jsonrpclib-pelix
 - update the kivy gui
 - update plugins
2017-08-26 08:28:24 +02:00
Dmitry Sorokin
5be78950ca py3 2017-08-26 08:27:47 +02:00
ThomasV
dcffea150e store contacts and invoices in wallet file. fix #1482 2017-03-06 17:12:27 +01:00
ThomasV
411832c4ce cleanup storage and fix tracvis test 2017-03-06 08:33:35 +01:00
ThomasV
fcc92c1ebd Wallet file encryption:
- a keypair is derived from the wallet password
 - only the public key is retained in memory
 - wallets must opened and closed explicitly with the daemon
2017-03-01 13:58:04 +01:00
ThomasV
46c3fe4efa fix get_addresses in stdio gui 2016-12-04 08:45:02 +01:00
twopir
87b95c51d8 correct other reference to network object 2016-05-08 21:01:15 -07:00
twopir
9036d9e8f7 Store the daemon's network on the stdio GUI object 2016-05-03 19:20:07 -07:00
ThomasV
96f144eb03 make sure the broadcast tx thread always times out 2016-02-25 08:55:06 +01:00
ThomasV
f1822a9603 pending->unconfirmed 2016-02-15 19:50:44 +01:00
Neil Booth
58d5215e2e No need to pass daemon and network together
The daemon has the network
2016-01-29 22:25:59 +09:00
ThomasV
0d52911561 define constants for tx output types 2016-01-14 17:15:50 +01:00
ThomasV
d57af0db33 Revert "Fix 'need more than 2 values to unpack' error."
This reverts commit 812399f51d.
2016-01-14 16:32:09 +01:00
ThomasV
62868ab29a Register loaded wallets in daemon, to prevent a wallet from being opened twice.
Simplify the wizard logic.
2016-01-06 00:58:43 +01:00
ThomasV
9d3162b1a1 simplify get_label 2015-12-15 12:52:30 +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
Neil Booth
afb5013272 Remove non-existent callbacks and handlers 2015-11-12 15:32:24 +09:00
Juraj Variny
812399f51d Fix 'need more than 2 values to unpack' error. 2015-11-04 19:07:50 +01:00
Neil Booth
49797c3094 Create a Plugins class
Encapsulates plugin logic and removes global variable ugliness.
2015-09-03 12:02:03 +09:00
ThomasV
92e0744470 Refactoring of daemon:
* gui and daemon are in the same process
 * commands that require network are sent to the daemon
 * open only one gui window per wallet
2015-08-30 11:31:51 +02:00
ThomasV
43880d452e dynamic fees 2015-08-05 15:45:28 +02:00
Neil Booth
03e53a5e01 Create a constant for 100000000 and use it
Use same name as is in bitcoind.
Note that one of the constants in text.py had the wrong number
of zeroes previously...
2015-06-01 14:53:36 +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
ThomasV
687cc7783f show unmatured coins in status bar. fixes #1163 2015-05-05 20:52:14 +02:00
ThomasV
782522fb71 update guis for new contacts 2015-04-23 12:46:52 +02:00
ThomasV
9e5cf68e93 updates for stdio gui 2015-04-02 15:19:00 +02:00
ThomasV
4da10d9a00 convert tab to spaces 2014-09-05 17:34:50 +02:00
ThomasV
2c51b0aa14 update mnemonic imports 2014-08-29 12:27:10 +02:00
ortutay
4edfc6d82e Coinbase BuyBack plugin 2014-01-05 00:19:23 -08:00
Bryan Stitt
6cd4ed486a fix more bare excepts 2013-11-10 12:30:57 -08:00
Bryan Stitt
f0eb0eccde replace BaseException with Exception 2013-11-09 20:21:02 -08:00
rofl0r
a27ad97132 re-add stdio guy
removed in 2c0814f0d3
probably by mistake.
2013-09-26 05:23:17 +02:00