|
|
@ -10,6 +10,7 @@ from electrum import SimpleConfig |
|
|
|
from electrum.address_synchronizer import TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT |
|
|
|
from electrum.wallet import sweep, Multisig_Wallet, Standard_Wallet, Imported_Wallet |
|
|
|
from electrum.util import bfh, bh2u |
|
|
|
from electrum.transaction import TxOutput |
|
|
|
|
|
|
|
from electrum.plugins.trustedcoin import trustedcoin |
|
|
|
|
|
|
@ -532,7 +533,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet1.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet1 -> wallet2 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet2.get_receiving_address(), 250000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet2.get_receiving_address(), 250000)] |
|
|
|
tx = wallet1.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -552,7 +553,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet2.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet2 -> wallet1 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet1.get_receiving_address(), 100000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet1.get_receiving_address(), 100000)] |
|
|
|
tx = wallet2.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -605,7 +606,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet1a.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet1 -> wallet2 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet2.get_receiving_address(), 370000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet2.get_receiving_address(), 370000)] |
|
|
|
tx = wallet1a.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx = Transaction(tx.serialize()) # simulates moving partial txn between cosigners |
|
|
|
self.assertFalse(tx.is_complete()) |
|
|
@ -628,7 +629,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet2.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet2 -> wallet1 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet1a.get_receiving_address(), 100000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet1a.get_receiving_address(), 100000)] |
|
|
|
tx = wallet2.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -696,7 +697,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet1a.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet1 -> wallet2 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet2a.get_receiving_address(), 165000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet2a.get_receiving_address(), 165000)] |
|
|
|
tx = wallet1a.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
txid = tx.txid() |
|
|
|
tx = Transaction(tx.serialize()) # simulates moving partial txn between cosigners |
|
|
@ -722,7 +723,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet2a.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet2 -> wallet1 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet1a.get_receiving_address(), 100000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet1a.get_receiving_address(), 100000)] |
|
|
|
tx = wallet2a.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
txid = tx.txid() |
|
|
|
tx = Transaction(tx.serialize()) # simulates moving partial txn between cosigners |
|
|
@ -776,7 +777,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet1a.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet1 -> wallet2 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet2.get_receiving_address(), 1000000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet2.get_receiving_address(), 1000000)] |
|
|
|
tx = wallet1a.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -796,7 +797,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet2.receive_tx_callback(tx.txid(), tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# wallet2 -> wallet1 |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, wallet1a.get_receiving_address(), 300000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, wallet1a.get_receiving_address(), 300000)] |
|
|
|
tx = wallet2.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
|
|
|
|
self.assertTrue(tx.is_complete()) |
|
|
@ -832,7 +833,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, '2N1VTMMFb91SH9SNRAkT7z8otP5eZEct4KL', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, '2N1VTMMFb91SH9SNRAkT7z8otP5eZEct4KL', 2500000)] |
|
|
|
coins = wallet.get_spendable_coins(domain=None, config=self.config) |
|
|
|
tx = wallet.make_unsigned_transaction(coins, outputs, config=self.config, fixed_fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
@ -918,7 +919,7 @@ class TestWalletSending(TestCaseForTestnet): |
|
|
|
wallet.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, '2N1VTMMFb91SH9SNRAkT7z8otP5eZEct4KL', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, '2N1VTMMFb91SH9SNRAkT7z8otP5eZEct4KL', 2500000)] |
|
|
|
coins = wallet.get_spendable_coins(domain=None, config=self.config) |
|
|
|
tx = wallet.make_unsigned_transaction(coins, outputs, config=self.config, fixed_fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
@ -1048,7 +1049,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1qp0mv2sxsyxxfj5gl0332f9uyez93su9cf26757', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1qp0mv2sxsyxxfj5gl0332f9uyez93su9cf26757', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1088,7 +1089,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1qp0mv2sxsyxxfj5gl0332f9uyez93su9cf26757', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1qp0mv2sxsyxxfj5gl0332f9uyez93su9cf26757', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325341 |
|
|
@ -1129,7 +1130,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1qp0mv2sxsyxxfj5gl0332f9uyez93su9cf26757', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1qp0mv2sxsyxxfj5gl0332f9uyez93su9cf26757', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325341 |
|
|
@ -1165,7 +1166,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1199,7 +1200,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1233,7 +1234,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1270,7 +1271,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1307,7 +1308,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1344,7 +1345,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, 'tb1quk7ahlhr3qmjndy0uvu9y9hxfesrtahtta9ghm', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325340 |
|
|
@ -1393,7 +1394,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, '2MuCQQHJNnrXzQzuqfUCfAwAjPqpyEHbgue', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, '2MuCQQHJNnrXzQzuqfUCfAwAjPqpyEHbgue', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325503 |
|
|
@ -1450,7 +1451,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, '2N8CtJRwxb2GCaiWWdSHLZHHLoZy53CCyxf', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, '2N8CtJRwxb2GCaiWWdSHLZHHLoZy53CCyxf', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325504 |
|
|
@ -1509,7 +1510,7 @@ class TestWalletOfflineSigning(TestCaseForTestnet): |
|
|
|
wallet_online.receive_tx_callback(funding_txid, funding_tx, TX_HEIGHT_UNCONFIRMED) |
|
|
|
|
|
|
|
# create unsigned tx |
|
|
|
outputs = [(bitcoin.TYPE_ADDRESS, '2MyoZVy8T1t94yLmyKu8DP1SmbWvnxbkwRA', 2500000)] |
|
|
|
outputs = [TxOutput(bitcoin.TYPE_ADDRESS, '2MyoZVy8T1t94yLmyKu8DP1SmbWvnxbkwRA', 2500000)] |
|
|
|
tx = wallet_online.mktx(outputs=outputs, password=None, config=self.config, fee=5000) |
|
|
|
tx.set_rbf(True) |
|
|
|
tx.locktime = 1325505 |
|
|
|