Test how a very large transaction is handled
This commit is contained in:
parent
c69c0ee920
commit
1a2b67d1f3
@ -404,6 +404,35 @@ class TestSignTx(DeviceTestCase):
|
||||
else:
|
||||
self._test_signtx("all", self.type in supports_multisig)
|
||||
|
||||
# Make a huge transaction which might cause some problems with different interfaces
|
||||
def test_big_tx(self):
|
||||
# make a huge transaction that is unrelated to the hardware wallet
|
||||
outputs = []
|
||||
num_inputs = 60
|
||||
for i in range(0, num_inputs):
|
||||
outputs.append({self.wpk_rpc.getnewaddress('', 'legacy'): 0.001})
|
||||
psbt = self.wpk_rpc.walletcreatefundedpsbt([], outputs, 0, {}, True)['psbt']
|
||||
psbt = self.wpk_rpc.walletprocesspsbt(psbt)['psbt']
|
||||
tx = self.wpk_rpc.finalizepsbt(psbt)['hex']
|
||||
txid = self.wpk_rpc.sendrawtransaction(tx)
|
||||
inputs = []
|
||||
for i in range(0, num_inputs):
|
||||
inputs.append({'txid': txid, 'vout': i})
|
||||
psbt = self.wpk_rpc.walletcreatefundedpsbt(inputs, [{self.wpk_rpc.getnewaddress('', 'legacy'): 0.001 * num_inputs}], 0, {'subtractFeeFromOutputs': [0]}, True)['psbt']
|
||||
# For cli, this should throw an exception
|
||||
try:
|
||||
result = self.do_command(self.dev_args + ['signtx', psbt])
|
||||
if self.interface == 'cli':
|
||||
self.fail('Big tx did not cause CLI to error')
|
||||
if self.type == 'coldcard':
|
||||
self.assertEqual(result['code'], -7)
|
||||
else:
|
||||
self.assertNotIn('code', result)
|
||||
self.assertNotIn('error', result)
|
||||
except OSError as e:
|
||||
if self.interface == 'cli':
|
||||
pass
|
||||
|
||||
class TestDisplayAddress(DeviceTestCase):
|
||||
def setUp(self):
|
||||
self.emulator.start()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user