tfix tests: follow-up 154b9cab50e7de41fe878359e92f44fd3b07c484 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1978bba91500022d12db4ad885794a7595cac25f DIR parent cc3da6c75fd2169bed77d706ed473bfdc32986af HTML Author: SomberNight <somber.night@protonmail.com> Date: Wed, 3 Jun 2020 19:00:28 +0200 fix tests: follow-up 154b9cab50e7de41fe878359e92f44fd3b07c484 Diffstat: M electrum/tests/test_coinchooser.py | 2 +- M electrum/tests/test_wallet_vertica… | 62 +++++++++++++++++++++---------- 2 files changed, 43 insertions(+), 21 deletions(-) --- DIR diff --git a/electrum/tests/test_coinchooser.py b/electrum/tests/test_coinchooser.py t@@ -9,7 +9,7 @@ class TestCoinChooser(ElectrumTestCase): def test_bucket_candidates_with_empty_buckets(self): def sufficient_funds(buckets, *, bucket_value_sum): return True - coin_chooser = CoinChooserPrivacy() + coin_chooser = CoinChooserPrivacy(enable_output_value_rounding=False) self.assertEqual([[]], coin_chooser.bucket_candidates_any([], sufficient_funds)) self.assertEqual([[]], coin_chooser.bucket_candidates_prefer_confirmed([], sufficient_funds)) def sufficient_funds(buckets, *, bucket_value_sum): DIR diff --git a/electrum/tests/test_wallet_vertical.py b/electrum/tests/test_wallet_vertical.py t@@ -538,9 +538,11 @@ class TestWalletSending(TestCaseForTestnet): super().setUp() self.config = SimpleConfig({'electrum_path': self.electrum_path}) - def create_standard_wallet_from_seed(self, seed_words): + def create_standard_wallet_from_seed(self, seed_words, *, config=None): + if config is None: + config = self.config ks = keystore.from_seed(seed_words, '', False) - return WalletIntegrityHelper.create_standard_wallet(ks, gap_limit=2, config=self.config) + return WalletIntegrityHelper.create_standard_wallet(ks, gap_limit=2, config=config) @mock.patch.object(wallet.Abstract_Wallet, 'save_db') def test_sending_between_p2wpkh_and_compressed_p2pkh(self, mock_save_db): t@@ -859,22 +861,37 @@ class TestWalletSending(TestCaseForTestnet): @mock.patch.object(wallet.Abstract_Wallet, 'save_db') def test_rbf(self, mock_save_db): self.maxDiff = None + config = SimpleConfig({'electrum_path': self.electrum_path}) + config.set_key('coin_chooser_output_rounding', False) for simulate_moving_txs in (False, True): with self.subTest(msg="_bump_fee_p2pkh_when_there_is_a_change_address", simulate_moving_txs=simulate_moving_txs): - self._bump_fee_p2pkh_when_there_is_a_change_address(simulate_moving_txs=simulate_moving_txs) + self._bump_fee_p2pkh_when_there_is_a_change_address( + simulate_moving_txs=simulate_moving_txs, + config=config) with self.subTest(msg="_bump_fee_p2wpkh_when_there_is_a_change_address", simulate_moving_txs=simulate_moving_txs): - self._bump_fee_p2wpkh_when_there_is_a_change_address(simulate_moving_txs=simulate_moving_txs) + self._bump_fee_p2wpkh_when_there_is_a_change_address( + simulate_moving_txs=simulate_moving_txs, + config=config) with self.subTest(msg="_bump_fee_when_user_sends_max", simulate_moving_txs=simulate_moving_txs): - self._bump_fee_when_user_sends_max(simulate_moving_txs=simulate_moving_txs) + self._bump_fee_when_user_sends_max( + simulate_moving_txs=simulate_moving_txs, + config=config) with self.subTest(msg="_bump_fee_when_new_inputs_need_to_be_added", simulate_moving_txs=simulate_moving_txs): - self._bump_fee_when_new_inputs_need_to_be_added(simulate_moving_txs=simulate_moving_txs) + self._bump_fee_when_new_inputs_need_to_be_added( + simulate_moving_txs=simulate_moving_txs, + config=config) with self.subTest(msg="_bump_fee_p2wpkh_when_there_is_only_a_single_output_and_that_is_a_change_address", simulate_moving_txs=simulate_moving_txs): - self._bump_fee_p2wpkh_when_there_is_only_a_single_output_and_that_is_a_change_address(simulate_moving_txs=simulate_moving_txs) + self._bump_fee_p2wpkh_when_there_is_only_a_single_output_and_that_is_a_change_address( + simulate_moving_txs=simulate_moving_txs, + config=config) with self.subTest(msg="_rbf_batching", simulate_moving_txs=simulate_moving_txs): - self._rbf_batching(simulate_moving_txs=simulate_moving_txs) + self._rbf_batching( + simulate_moving_txs=simulate_moving_txs, + config=config) - def _bump_fee_p2pkh_when_there_is_a_change_address(self, *, simulate_moving_txs): - wallet = self.create_standard_wallet_from_seed('fold object utility erase deputy output stadium feed stereo usage modify bean') + def _bump_fee_p2pkh_when_there_is_a_change_address(self, *, simulate_moving_txs, config): + wallet = self.create_standard_wallet_from_seed('fold object utility erase deputy output stadium feed stereo usage modify bean', + config=config) # bootstrap wallet funding_tx = Transaction('010000000001011f4db0ecd81f4388db316bc16efb4e9daf874cf4950d54ecb4c0fb372433d68500000000171600143d57fd9e88ef0e70cddb0d8b75ef86698cab0d44fdffffff0280969800000000001976a91472e34cebab371967b038ce41d0e8fa1fb983795e88ac86a0ae020000000017a9149188bc82bdcae077060ebb4f02201b73c806edc887024830450221008e0725d531bd7dee4d8d38a0f921d7b1213e5b16c05312a80464ecc2b649598d0220596d309cf66d5f47cb3df558dbb43c5023a7796a80f5a88b023287e45a4db6b9012102c34d61ceafa8c216f01e05707672354f8119334610f7933a3f80dd7fb6290296bd391400') t@@ -969,8 +986,9 @@ class TestWalletSending(TestCaseForTestnet): wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) self.assertEqual((0, funding_output_value - 50000, 0), wallet.get_balance()) - def _bump_fee_p2wpkh_when_there_is_a_change_address(self, *, simulate_moving_txs): - wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage') + def _bump_fee_p2wpkh_when_there_is_a_change_address(self, *, simulate_moving_txs, config): + wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage', + config=config) # bootstrap wallet funding_tx = Transaction('01000000000102acd6459dec7c3c51048eb112630da756f5d4cb4752b8d39aa325407ae0885cba020000001716001455c7f5e0631d8e6f5f05dddb9f676cec48845532fdffffffd146691ef6a207b682b13da5f2388b1f0d2a2022c8cfb8dc27b65434ec9ec8f701000000171600147b3be8a7ceaf15f57d7df2a3d216bc3c259e3225fdffffff02a9875b000000000017a914ea5a99f83e71d1c1dfc5d0370e9755567fe4a141878096980000000000160014d4ca56fcbad98fb4dcafdc573a75d6a6fffb09b702483045022100dde1ba0c9a2862a65791b8d91295a6603207fb79635935a67890506c214dd96d022046c6616642ef5971103c1db07ac014e63fa3b0e15c5729eacdd3e77fcb7d2086012103a72410f185401bb5b10aaa30989c272b554dc6d53bda6da85a76f662723421af024730440220033d0be8f74e782fbcec2b396647c7715d2356076b442423f23552b617062312022063c95cafdc6d52ccf55c8ee0f9ceb0f57afb41ea9076eb74fe633f59c50c6377012103b96a4954d834fbcfb2bbf8cf7de7dc2b28bc3d661c1557d1fd1db1bfc123a94abb391400') t@@ -1032,8 +1050,9 @@ class TestWalletSending(TestCaseForTestnet): wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) self.assertEqual((0, 7490060, 0), wallet.get_balance()) - def _bump_fee_p2wpkh_when_there_is_only_a_single_output_and_that_is_a_change_address(self, *, simulate_moving_txs): - wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage') + def _bump_fee_p2wpkh_when_there_is_only_a_single_output_and_that_is_a_change_address(self, *, simulate_moving_txs, config): + wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage', + config=config) # bootstrap wallet funding_tx = Transaction('01000000000102acd6459dec7c3c51048eb112630da756f5d4cb4752b8d39aa325407ae0885cba020000001716001455c7f5e0631d8e6f5f05dddb9f676cec48845532fdffffffd146691ef6a207b682b13da5f2388b1f0d2a2022c8cfb8dc27b65434ec9ec8f701000000171600147b3be8a7ceaf15f57d7df2a3d216bc3c259e3225fdffffff02a9875b000000000017a914ea5a99f83e71d1c1dfc5d0370e9755567fe4a141878096980000000000160014d4ca56fcbad98fb4dcafdc573a75d6a6fffb09b702483045022100dde1ba0c9a2862a65791b8d91295a6603207fb79635935a67890506c214dd96d022046c6616642ef5971103c1db07ac014e63fa3b0e15c5729eacdd3e77fcb7d2086012103a72410f185401bb5b10aaa30989c272b554dc6d53bda6da85a76f662723421af024730440220033d0be8f74e782fbcec2b396647c7715d2356076b442423f23552b617062312022063c95cafdc6d52ccf55c8ee0f9ceb0f57afb41ea9076eb74fe633f59c50c6377012103b96a4954d834fbcfb2bbf8cf7de7dc2b28bc3d661c1557d1fd1db1bfc123a94abb391400') t@@ -1093,8 +1112,9 @@ class TestWalletSending(TestCaseForTestnet): wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) self.assertEqual((0, 9991750, 0), wallet.get_balance()) - def _bump_fee_when_user_sends_max(self, *, simulate_moving_txs): - wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage') + def _bump_fee_when_user_sends_max(self, *, simulate_moving_txs, config): + wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage', + config=config) # bootstrap wallet funding_tx = Transaction('01000000000102acd6459dec7c3c51048eb112630da756f5d4cb4752b8d39aa325407ae0885cba020000001716001455c7f5e0631d8e6f5f05dddb9f676cec48845532fdffffffd146691ef6a207b682b13da5f2388b1f0d2a2022c8cfb8dc27b65434ec9ec8f701000000171600147b3be8a7ceaf15f57d7df2a3d216bc3c259e3225fdffffff02a9875b000000000017a914ea5a99f83e71d1c1dfc5d0370e9755567fe4a141878096980000000000160014d4ca56fcbad98fb4dcafdc573a75d6a6fffb09b702483045022100dde1ba0c9a2862a65791b8d91295a6603207fb79635935a67890506c214dd96d022046c6616642ef5971103c1db07ac014e63fa3b0e15c5729eacdd3e77fcb7d2086012103a72410f185401bb5b10aaa30989c272b554dc6d53bda6da85a76f662723421af024730440220033d0be8f74e782fbcec2b396647c7715d2356076b442423f23552b617062312022063c95cafdc6d52ccf55c8ee0f9ceb0f57afb41ea9076eb74fe633f59c50c6377012103b96a4954d834fbcfb2bbf8cf7de7dc2b28bc3d661c1557d1fd1db1bfc123a94abb391400') t@@ -1155,8 +1175,9 @@ class TestWalletSending(TestCaseForTestnet): wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) self.assertEqual((0, 0, 0), wallet.get_balance()) - def _bump_fee_when_new_inputs_need_to_be_added(self, *, simulate_moving_txs): - wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage') + def _bump_fee_when_new_inputs_need_to_be_added(self, *, simulate_moving_txs, config): + wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage', + config=config) # bootstrap wallet (incoming funding_tx1) funding_tx1 = Transaction('01000000000102acd6459dec7c3c51048eb112630da756f5d4cb4752b8d39aa325407ae0885cba020000001716001455c7f5e0631d8e6f5f05dddb9f676cec48845532fdffffffd146691ef6a207b682b13da5f2388b1f0d2a2022c8cfb8dc27b65434ec9ec8f701000000171600147b3be8a7ceaf15f57d7df2a3d216bc3c259e3225fdffffff02a9875b000000000017a914ea5a99f83e71d1c1dfc5d0370e9755567fe4a141878096980000000000160014d4ca56fcbad98fb4dcafdc573a75d6a6fffb09b702483045022100dde1ba0c9a2862a65791b8d91295a6603207fb79635935a67890506c214dd96d022046c6616642ef5971103c1db07ac014e63fa3b0e15c5729eacdd3e77fcb7d2086012103a72410f185401bb5b10aaa30989c272b554dc6d53bda6da85a76f662723421af024730440220033d0be8f74e782fbcec2b396647c7715d2356076b442423f23552b617062312022063c95cafdc6d52ccf55c8ee0f9ceb0f57afb41ea9076eb74fe633f59c50c6377012103b96a4954d834fbcfb2bbf8cf7de7dc2b28bc3d661c1557d1fd1db1bfc123a94abb391400') t@@ -1226,8 +1247,9 @@ class TestWalletSending(TestCaseForTestnet): wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) self.assertEqual((0, 4_990_300, 0), wallet.get_balance()) - def _rbf_batching(self, *, simulate_moving_txs): - wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage') + def _rbf_batching(self, *, simulate_moving_txs, config): + wallet = self.create_standard_wallet_from_seed('frost repair depend effort salon ring foam oak cancel receive save usage', + config=config) wallet.config.set_key('batch_rbf', True) # bootstrap wallet (incoming funding_tx1)