Commit graph

244 commits

Author SHA1 Message Date
SomberNight
5d7157451f
tests: TestWalletOfflineSigning 2018-06-13 19:27:07 +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
141994ed1b
tests: TestWalletSending - also test raw_tx and wtxid 2018-06-01 18:05:49 +02:00
SomberNight
deb945d810
tests: TestWalletHistory_EvilGapLimit 2018-05-29 20:51:04 +02:00
SomberNight
7218bf1d14
tests: bip32 extended version bytes 2018-05-28 20:27:08 +02:00
SomberNight
dbec3af810
tests: introduce FAST_TESTS flag for faster local testing 2018-05-28 14:02:07 +02:00
SomberNight
d03da4d1a2
tests: test with all AES implementations 2018-05-25 22:06:45 +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
756cc323e7
tests: dnssec 2018-05-24 22:20:58 +02:00
SomberNight
c113232e8b
tests: TestWalletHistory
check if wallet logic calculates correct balance regardless of the order in which we receive transactions from the server
2018-05-18 15:43:02 +02:00
SomberNight
7c7aa5828b
tests: added p2wpkh-p2sh wallet to TestWalletSending 2018-05-14 18:33:14 +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
fad25af204
fix tests for travis. follow-up 68d8919416 2018-04-27 21:55:50 +02:00
SomberNight
68d8919416
tests: sends between wallets 2018-04-27 21:43:46 +02:00
SomberNight
e13183ea7a
bitcoin.py: SCRIPT-related clean-up. transaction.py: construct_witness 2018-04-27 16:16:27 +02:00
SomberNight
b3110b3b46
bitcoin.py: implement add_number_to_script. 2018-04-27 16:15:44 +02:00
SomberNight
4b89b1e270
implement script_num_to_hex 2018-04-27 16:15:43 +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
44bb1e9993
bitcoin.py: fix op_push
8cbc5c4be4/src/script/script.h (L464)
fdc2bc867b/txscript/scriptbuilder.go (L151)
2018-04-14 16:13:51 +02:00
ghost43
cf88e239d7
fix parsing values in setconfig (#4225) 2018-04-06 18:53:13 +02:00
SomberNight
58273fc841
tests: xpub version bytes 2018-04-01 16:56:17 +02:00
SomberNight
ff57c198b4
fix prev 2018-04-01 16:52:24 +02:00
fivepiece
192288c025 change testnet p2wsh-p2sh prefix to 0x024289ef to reflect Upub (#4210)
* change testnet p2wsh-p2sh prefix to 0x024289ef to reflect Upub

* add testnet p2sh-p2wsh 2of2 multisig test
2018-04-01 16:48:54 +02:00
SomberNight
9de4d19c5a
tests: refactoring in test_wallet_vertical.py 2018-04-01 16:44:59 +02:00
SomberNight
1eae16aa3e
tests: class TestCaseForTestnet 2018-04-01 15:50:24 +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
SomberNight
81b6d65764 refactor network constants 2018-03-04 22:10:59 +01:00
SomberNight
a32d27b9d7 make 2fa wallets work on testnet 2018-02-26 18:21:36 +01:00
SomberNight
7a4338ea21 fix tests 2018-02-19 21:16:12 +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
0d1ea09ed1 fix tests 2018-01-16 10:52:41 +01:00
ThomasV
359882d0b1
Merge pull request #3630 from SomberNight/bip84
bip84 for sw seeds
2018-01-11 16:43:34 +01:00
SomberNight
6d88eab005 tests: added 2fa seed case to test_wallet_vertical.py 2018-01-04 22:21:05 +01:00
SomberNight
e3164286d0 implement bip84: bip43 purpose/der path for p2wpkh scripts 2017-12-31 02:20:58 +01:00
SomberNight
9f908c32e3 tests: add missing info in vertical wallet tests 2017-12-13 19:54:39 +01:00
SomberNight
2a3c41b24f coinchooser: "privacy" policy now prefers confirmed coins. removed "priority" policy. 2017-12-11 14:49:53 +01:00
SomberNight
33bb5fee73 tests: testnet addresses 2017-11-22 02:01:47 +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
3b26beac9e fix: wallet storage upgrade 13b had incorrect assumptions 2017-11-02 09:49:11 +01:00
SomberNight
c05549c8cd follow-up prev commit: revert "strict checks" for old seeds 2017-10-29 20:04:31 +01:00
SomberNight
d45e13553a old seeds: normalize, and stricter is_old_seed() 2017-10-29 17:34:45 +01:00
SomberNight
aad83a71c8 tests: have bip39 multisig wallet unit test mirror hw wallet behaviour 2017-10-27 19:57:43 +02:00