From 92787dd52cd4ddc378cf1bcb7e92a649916a0f42 Mon Sep 17 00:00:00 2001 From: ismaelsadeeq Date: Tue, 1 Oct 2024 23:21:29 +0100 Subject: [PATCH] test: raise an error when target_vsize is below tx virtual size --- test/functional/test_framework/wallet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py index 32045e2332b..0a8c08474fe 100644 --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -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()