test: raise an error when target_vsize is below tx virtual size

This commit is contained in:
ismaelsadeeq committed 2025-01-08 09:35:02 -05:00
1 parent a8780c937f
commit 92787dd52c
1 file changed
+3
+3
View File
@@ -121,6 +121,9 @@ class MiniWallet:
"""Pad a transaction with extra outputs until it reaches a target vsize.
returns the tx
"""
if target_vsize < tx.get_vsize():
raise RuntimeError(f"target_vsize {target_vsize} is less than transaction virtual size {tx.get_vsize()}")
tx.vout.append(CTxOut(nValue=0, scriptPubKey=CScript([OP_RETURN])))
# determine number of needed padding bytes
dummy_vbytes = target_vsize - tx.get_vsize()