zero output test; limitations update
This commit is contained in:
parent
83d82cb162
commit
c37ebd3f1a
@ -48,6 +48,7 @@
|
||||
- bitcoin limits transactions to 100k, but there could be large input transactions
|
||||
inside the PSBT. Reduce this by using segwit signatures and provide only the
|
||||
individual UTXO ("out points").
|
||||
- every transaction needs to have at least one output (otherwise Invalid PSBT)
|
||||
|
||||
|
||||
# P2SH / Multisig
|
||||
|
||||
@ -1162,7 +1162,7 @@ class psbtObject(psbtProxy):
|
||||
if self.xpubs:
|
||||
await self.handle_xpubs()
|
||||
|
||||
assert self.num_outputs >= 1, 'need outs'
|
||||
assert self.num_outputs >= 1, 'need outputs'
|
||||
|
||||
if DEBUG:
|
||||
our_keys = sum(1 for i in self.inputs if i.num_our_keys)
|
||||
|
||||
@ -1941,4 +1941,30 @@ def test_sighash_all(addr_fmt, num_outs, microsd_path, need_keypress, goto_home,
|
||||
# tx with 6 inputs representing all possible sighashes
|
||||
_test_single_sig_sighash(addr_fmt, tuple(SIGHASH_MAP.keys()), num_inputs=6, num_outputs=num_outs)
|
||||
|
||||
|
||||
def test_no_outputs_tx(fake_txn, microsd_path, goto_home, need_keypress, pick_menu_item, cap_story):
|
||||
goto_home()
|
||||
psbt = fake_txn(3, 0) # no outputs
|
||||
fname = "zero_outputs.psbt"
|
||||
fpath = microsd_path(fname)
|
||||
|
||||
with open(fpath, "wb") as f:
|
||||
f.write(psbt)
|
||||
|
||||
pick_menu_item("Ready To Sign")
|
||||
time.sleep(0.1)
|
||||
title, story = cap_story()
|
||||
if "Choose PSBT file to be signed" in story:
|
||||
need_keypress("y")
|
||||
pick_menu_item(fname)
|
||||
time.sleep(0.1)
|
||||
title, story = cap_story()
|
||||
|
||||
assert title == "Failure"
|
||||
assert "Invalid PSBT" in story
|
||||
assert "need outputs" in story
|
||||
|
||||
try: os.remove(fpath)
|
||||
except: pass
|
||||
|
||||
# EOF
|
||||
|
||||
Loading…
Reference in New Issue
Block a user