aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/messages.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/test_framework/messages.py')
-rwxr-xr-xtest/functional/test_framework/messages.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index 504c8c70d4..8d0bd9f69a 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -590,12 +590,15 @@ class CTransaction:
return False
return True
- # Calculate the virtual transaction size using witness and non-witness
+ # Calculate the transaction weight using witness and non-witness
# serialization size (does NOT use sigops).
- def get_vsize(self):
+ def get_weight(self):
with_witness_size = len(self.serialize_with_witness())
without_witness_size = len(self.serialize_without_witness())
- return math.ceil(((WITNESS_SCALE_FACTOR - 1) * without_witness_size + with_witness_size) / WITNESS_SCALE_FACTOR)
+ return (WITNESS_SCALE_FACTOR - 1) * without_witness_size + with_witness_size
+
+ def get_vsize(self):
+ return math.ceil(self.get_weight() / WITNESS_SCALE_FACTOR)
def __repr__(self):
return "CTransaction(nVersion=%i vin=%s vout=%s wit=%s nLockTime=%i)" \