Commit graph

38 commits

Author SHA1 Message Date
Janus
097ac144d9 file reorganization with top-level module 2018-07-13 14:01:37 +02:00
SomberNight
2cc15fca57
tests: add missing txid test from #3316 2018-06-15 15:39:09 +02:00
SomberNight
0438bbc2c2
transaction.py: change update_signatures API. fix trezor segwit signing.
Traceback (most recent call last):
  File "...\electrum\lib\transaction.py", line 498, in parse_witness
    if txin['witness_version'] != 0:
KeyError: 'witness_version'
2018-06-14 20:13:04 +02:00
SomberNight
e8b5bcf31e
fix incorrect txid for partial segwit txns
follow-up #4405
2018-06-13 15:54:45 +02:00
SomberNight
a0ba5a7962
change partial txn format: add header. only parse inputs and witness for partial txns. 2018-06-11 17:57:29 +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
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
ghost43
3337af0734
transaction.py: (txin guess) fix some false positive matches of p2sh-segwit (#4336) 2018-05-09 19:16:01 +02:00
SomberNight
22061b4555 transaction.get_address_from_output_script now handles witness version > 0 2018-03-18 06:18:48 +01:00
SomberNight
a6841cbd5f fix #4099: serialisation of txns with negative version number 2018-03-13 01:02:03 +01:00
SomberNight
e5cba92564 transaction serialization: fix segwit coinbase case.
adjust unit tests so that they would have caught it.
2018-03-06 10:34:52 +01:00
ThomasV
344b5e0a23
Merge pull request #3901 from SomberNight/fix_3899
fix #3899; and more aggressively catch exceptions in tx.deserialize()
2018-02-15 09:31:20 +01:00
SomberNight
89b43ee0cb tests: copied valid transactions from bitcoin core unit tests. try to deserialize all. 2018-02-14 15:58:58 +01:00
SomberNight
4b6a3e2e5d fix #3899; and more aggressively catch exceptions in tx.deserialize() 2018-02-14 01:20:38 +01:00
SomberNight
70aa1f1db9 fix #3788 2018-01-29 02:00:43 +01:00
SomberNight
2a3c41b24f coinchooser: "privacy" policy now prefers confirmed coins. removed "priority" policy. 2017-12-11 14:49:53 +01:00
Justin Turner Arthur
857eb4ac1d Remove unused imports. Explicitly import a few deep imports. 2017-11-13 02:28:00 -06:00
SomberNight
0ee18f9837 fix tests 2017-11-06 12:44:36 +01:00
SomberNight
fb47dbb75a tests: transaction.txid() 2017-10-26 00:35:18 +02:00
ThomasV
5665b42999 remove six 2017-10-24 14:04:16 +02:00
ThomasV
8d307ce1e8 rm failing test 2017-10-14 16:08:03 +02:00
ThomasV
c186dc18d4 fix tests 2017-09-22 09:55:30 +02:00
SomberNight
2fbc70d860 Moving to virtual tx size instead of total tx size. 2017-09-22 09:49:05 +02:00
SomberNight
6e0c2cffd8 replace deprecated assertEquals 2017-09-21 06:07:52 +02:00
Dmitry Sorokin
5be78950ca py3 2017-08-26 08:27:47 +02:00
Johann Bauer
534eaa9bd1 Parse transaction version field
Closes: #2462
2017-05-30 19:28:27 +02:00
Roman Zeyde
de956b7dc1 tests: fix TestTransaction.test_tx_signed testcase 2017-05-08 21:39:57 +03:00
ThomasV
f7212a4732 fix input_script and remove unused method inputs_without_script 2017-03-21 14:33:42 +01:00
ThomasV
c2142ebf26 fix test broken by previous commit 2017-03-21 09:59:48 +01:00
ThomasV
9e1931587d fix tests 2017-02-01 10:07:01 +01:00
Jonathan Cross
b503243d0e
Fixing / commenting out tests in test_transaction.py 2016-10-16 13:08:27 +02:00
Thomas König
c49202ceaa
fix test_simple_config and test_transaction 2016-08-04 17:21:25 +02:00
ThomasV
abdb7f8470 fix tests 2016-01-15 18:14:06 +01:00
ThomasV
f77f63e158 remove failing tests, due to high S in signatures 2015-10-20 13:15:13 +02:00
Roman Zeyde
a097c47b0b test_transaction: fix test_sweep case 2015-08-31 17:03:59 +03:00
Roman Zeyde
eb66289314 test_transaction: add BCDataStream test case 2015-08-25 15:51:22 +03:00
Roman Zeyde
33b78551a3 test_transaction: add Transaction.sweep() test case 2015-08-25 15:21:44 +03:00
Roman Zeyde
6a7e145053 test_transaction: add test suite for lib.transaction module 2015-08-25 12:05:49 +03:00