Commit graph

1138 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
SomberNight
1e06b1921e
wallet.py: access unverified_tx with self.lock
Only actually needed due to Imported_Wallet.delete_address, but it takes some time to see this.
The verifier and the synchronizer both access unverified_tx but they are both run in the Network thread.
In any case, there does not seem to be a measurable performance hit when using the lock.
2018-05-30 19:01:47 +02:00
SomberNight
060404e17c
wallet/verifier: persist wallet.verified_tx when verifier finishes
Previously verified_tx was only persisted in wallet.stop_threads(), hence only on clean shutdowns.
2018-05-30 18:21:29 +02:00
SomberNight
ee9861f0d5
wallet.py: access verified_tx with lock 2018-05-30 13:24:58 +02:00
SomberNight
6bb7558f75
InvalidPassword undefined in wallet.py 2018-05-30 13:14:01 +02:00
SomberNight
16e4827e8c
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
SomberNight
b88f0434c5
wallet.py: check_history depends on load_local_history and build_spent_outpoints
if it tries to call add_transaction
2018-05-16 11:31:20 +02:00
Ben Woosley
53320470f5 Format the transaction window fee rate with 1 decimal place (#4286)
* Fix format_satoshi to properly handle non-integer values

Handling the integer and fraction parts together via string formatting
simplifies the initial composition because the default behavior manages
the - sign, and the incorporation of the fractional part.

* Limit fee rate output to one decimal place

Via a new precision arg

* Introduce format_fee_satoshis and use it for all fee display
2018-04-24 18:54:14 +02:00
SomberNight
0be73ed546
wallet.py: small optimisation for get_wallet_delta 2018-04-24 15:26:56 +02:00
ThomasV
7cee37dfb8 show bitcoin price info in history summary 2018-04-19 14:05:19 +02:00
Dimitris Apostolou
989c9c2b55 Fix typos 2018-04-15 20:34:40 +02:00
SomberNight
8bdf863fca
fix: android HistoryScreen was not displaying fiat value of unconfirmed txns 2018-04-12 16:49:25 +02:00
SomberNight
1935d7d165
wallet.py: remove local transactions that we don't have
fixes #4232
closes #4234
2018-04-11 19:53:33 +02:00
SomberNight
7dcefd999f
wallet.py: remove_transaction - make sure we pop from both txi and txo 2018-04-11 19:51:35 +02:00
SomberNight
4fed27610a
wallet.py: load unverified_tx in __init__ 2018-04-11 19:45:13 +02:00
SomberNight
86b1273ec0
wallet.py: minor reordering in __init__ 2018-04-11 19:45:12 +02:00
SomberNight
ebcc983566
wallet.py: build local history from txi and txo, not transactions 2018-04-11 19:45:12 +02:00
SomberNight
b68f5645cb
fix #4254 2018-04-11 18:31:35 +02:00
SomberNight
7b50790584
do not raise BaseException 2018-04-07 17:10:30 +02:00
SomberNight
92c45ac29a
fix prev: txns might be added in any order 2018-04-04 01:22:49 +02:00
SomberNight
17512f7f47
wallet: speed up get_address_history 2018-04-03 22:16:29 +02:00
SomberNight
ffe69cb328
fix #4220 2018-04-03 19:18:10 +02:00
SomberNight
5a508f7b8d
fix #4218 2018-04-03 01:50:37 +02:00
SomberNight
9b7536e75c use explicit utf-8 encoding when opening files in text mode 2018-03-23 21:47:51 +01:00
ThomasV
800c783580
Merge pull request #4115 from SomberNight/disallow_adding_requests_w_invalid_addresses
disallow adding receive requests without valid is_mine addresses
2018-03-22 15:34:05 +01:00
ThomasV
f8f00188ed
Merge pull request #4148 from SomberNight/hw_wallet_output_ismine_der
trezor/keepkey/dbb: provide derivation info for all is_mine txn outputs
2018-03-22 12:18:59 +01:00
SomberNight
a00439b6f8 fix #4158 2018-03-22 07:27:18 +01:00
SomberNight
7d11812f55 trezor/keepkey/dbb: provide info for all is_mine txn outputs 2018-03-20 02:04:41 +01:00
SomberNight
61a45edee0 Catch wallet file related exceptions in Qt wizard. 2018-03-17 22:56:20 +01:00
SomberNight
8e79d09511 disallow adding receive requests without valid is_mine addresses 2018-03-12 21:50:56 +01:00
ThomasV
c3e26a1e2b fix #4098 2018-03-12 12:19:45 +01:00
ThomasV
152ec1447c fix #4100: spent_outpoints does not track everything 2018-03-12 11:56:00 +01:00
ThomasV
cf866adfe3 fix #4109 2018-03-12 10:30:56 +01:00
SomberNight
a048a00594 close #4102
close #3337
2018-03-12 04:00:27 +01:00
SomberNight
2c6cf7f80c careful with exceptions.. 2018-03-10 08:00:41 +01:00
SomberNight
c13e057701 fix #4080 2018-03-09 03:18:53 +01:00
SomberNight
6f0a7ff420 fix #4077 2018-03-09 01:38:35 +01:00
SomberNight
e0cda39ae5 only cache expensive case 2018-03-06 17:15:14 +01:00
SomberNight
db0e3cd209 speed-up wallet.get_full_history: cache coin_price 2018-03-06 16:56:51 +01:00
SomberNight
d002549176 wallet.get_full_history: only do fiat calc, if enabled 2018-03-06 16:37:17 +01:00
ThomasV
ade7cce144 fix #4034 2018-03-06 07:13:35 +01:00
SomberNight
81666bf9ac fix #4026 2018-03-05 11:44:03 +01:00
SomberNight
0df6d1ec97 trezor: segwit offline signing 2018-03-03 02:39:49 +01:00
ThomasV
4b7cf297f5 fix #3998 2018-03-02 18:00:05 +01:00
SomberNight
02f2e5c599 wallet.add_transaction: adding to spent_outpoints, out of order case 2018-03-02 07:56:17 +01:00
ThomasV
968862076f fix sign 2018-03-01 19:09:24 +01:00
ThomasV
4236adc552 fix date filtering 2018-02-28 09:50:28 +01:00
ThomasV
a3554dc2b7 fix #3963 2018-02-27 16:00:56 +01:00
ThomasV
51630416fc fix expenditures sign 2018-02-27 15:26:39 +01:00
ThomasV
31edc419fa improve get_tx_status 2018-02-27 15:13:44 +01:00