|
|
@ -860,7 +860,20 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
|
|
|
|
@needs_test_with_all_ecc_implementations |
|
|
|
@mock.patch.object(storage.WalletStorage, '_write') |
|
|
|
def test_bump_fee_p2pkh_when_there_is_a_change_address(self, mock_write): |
|
|
|
def test_rbf(self, mock_write): |
|
|
|
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) |
|
|
|
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) |
|
|
|
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) |
|
|
|
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) |
|
|
|
with self.subTest(msg="_rbf_batching", simulate_moving_txs=simulate_moving_txs): |
|
|
|
self._rbf_batching(simulate_moving_txs=simulate_moving_txs) |
|
|
|
|
|
|
|
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') |
|
|
|
|
|
|
|
# bootstrap wallet |
|
|
@ -877,6 +890,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325501 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -899,6 +914,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx = wallet.bump_fee(tx=Transaction(tx.serialize()), new_fee_rate=70.0, config=self.config) |
|
|
|
tx.locktime = 1325501 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
self.assertFalse(tx.is_complete()) |
|
|
|
|
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
@ -947,9 +964,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
self.assertEqual((0, funding_output_value - 50000, 0), wallet.get_balance()) |
|
|
|
|
|
|
|
@needs_test_with_all_ecc_implementations |
|
|
|
@mock.patch.object(storage.WalletStorage, '_write') |
|
|
|
def test_bump_fee_p2wpkh_when_there_is_a_change_address(self, mock_write): |
|
|
|
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') |
|
|
|
|
|
|
|
# bootstrap wallet |
|
|
@ -966,6 +981,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325499 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -988,6 +1005,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx = wallet.bump_fee(tx=Transaction(tx.serialize()), new_fee_rate=70.0, config=self.config) |
|
|
|
tx.locktime = 1325500 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
self.assertFalse(tx.is_complete()) |
|
|
|
|
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
@ -1002,9 +1021,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
self.assertEqual((0, 7490060, 0), wallet.get_balance()) |
|
|
|
|
|
|
|
@needs_test_with_all_ecc_implementations |
|
|
|
@mock.patch.object(storage.WalletStorage, '_write') |
|
|
|
def test_bump_fee_when_user_sends_max(self, mock_write): |
|
|
|
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') |
|
|
|
|
|
|
|
# bootstrap wallet |
|
|
@ -1020,6 +1037,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325499 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -1042,6 +1061,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx = wallet.bump_fee(tx=Transaction(tx.serialize()), new_fee_rate=70.0, config=self.config) |
|
|
|
tx.locktime = 1325500 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
self.assertFalse(tx.is_complete()) |
|
|
|
|
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
@ -1056,9 +1077,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
self.assertEqual((0, 0, 0), wallet.get_balance()) |
|
|
|
|
|
|
|
@needs_test_with_all_ecc_implementations |
|
|
|
@mock.patch.object(storage.WalletStorage, '_write') |
|
|
|
def test_bump_fee_when_new_inputs_need_to_be_added(self, mock_write): |
|
|
|
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') |
|
|
|
|
|
|
|
# bootstrap wallet (incoming funding_tx1) |
|
|
@ -1075,6 +1094,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325499 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -1105,6 +1126,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx = wallet.bump_fee(tx=Transaction(tx.serialize()), new_fee_rate=70.0, config=self.config) |
|
|
|
tx.locktime = 1325500 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
self.assertFalse(tx.is_complete()) |
|
|
|
|
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
@ -1119,9 +1142,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
self.assertEqual((0, 4_990_300, 0), wallet.get_balance()) |
|
|
|
|
|
|
|
@needs_test_with_all_ecc_implementations |
|
|
|
@mock.patch.object(storage.WalletStorage, '_write') |
|
|
|
def test_rbf_batching(self, mock_write): |
|
|
|
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') |
|
|
|
config = SimpleConfig({'electrum_path': self.electrum_path, 'batch_rbf': True}) |
|
|
|
|
|
|
@ -1139,6 +1160,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325499 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -1173,6 +1196,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325499 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -1199,6 +1224,8 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325499 |
|
|
|
tx.version = 1 |
|
|
|
if simulate_moving_txs: |
|
|
|
tx = Transaction(str(tx)) |
|
|
|
wallet.sign_transaction(tx, password=None) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
|