diff options
Diffstat (limited to 'test')
25 files changed, 28 insertions, 1 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 10c8475d01..f8afe22eaf 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -10,6 +10,7 @@ from test_framework.util import * from test_framework.script import * from test_framework.blocktools import create_block, create_coinbase, add_witness_commitment, get_witness_script, WITNESS_COMMITMENT_HEADER from test_framework.key import CECKey, CPubKey +import math import time import random from binascii import hexlify @@ -930,8 +931,10 @@ class SegWitTest(BitcoinTestFramework): raw_tx = self.nodes[0].getrawtransaction(tx3.hash, 1) assert_equal(int(raw_tx["hash"], 16), tx3.calc_sha256(True)) assert_equal(raw_tx["size"], len(tx3.serialize_with_witness())) - vsize = (len(tx3.serialize_with_witness()) + 3*len(tx3.serialize_without_witness()) + 3) / 4 + weight = len(tx3.serialize_with_witness()) + 3*len(tx3.serialize_without_witness()) + vsize = math.ceil(weight / 4) assert_equal(raw_tx["vsize"], vsize) + assert_equal(raw_tx["weight"], weight) assert_equal(len(raw_tx["vin"][0]["txinwitness"]), 1) assert_equal(raw_tx["vin"][0]["txinwitness"][0], hexlify(witness_program).decode('ascii')) assert(vsize != raw_tx["size"]) diff --git a/test/util/data/blanktxv1.json b/test/util/data/blanktxv1.json index 9fe2de649b..3d5a1cccae 100644 --- a/test/util/data/blanktxv1.json +++ b/test/util/data/blanktxv1.json @@ -4,6 +4,7 @@ "version": 1, "size": 10, "vsize": 10, + "weight": 40, "locktime": 0, "vin": [ ], diff --git a/test/util/data/blanktxv2.json b/test/util/data/blanktxv2.json index e97626e421..8374a34adc 100644 --- a/test/util/data/blanktxv2.json +++ b/test/util/data/blanktxv2.json @@ -4,6 +4,7 @@ "version": 2, "size": 10, "vsize": 10, + "weight": 40, "locktime": 0, "vin": [ ], diff --git a/test/util/data/tt-delin1-out.json b/test/util/data/tt-delin1-out.json index de647f98b6..9fc2ddc376 100644 --- a/test/util/data/tt-delin1-out.json +++ b/test/util/data/tt-delin1-out.json @@ -4,6 +4,7 @@ "version": 1, "size": 3040, "vsize": 3040, + "weight": 12160, "locktime": 0, "vin": [ { diff --git a/test/util/data/tt-delout1-out.json b/test/util/data/tt-delout1-out.json index 067ffe74e7..922d048900 100644 --- a/test/util/data/tt-delout1-out.json +++ b/test/util/data/tt-delout1-out.json @@ -4,6 +4,7 @@ "version": 1, "size": 3155, "vsize": 3155, + "weight": 12620, "locktime": 0, "vin": [ { diff --git a/test/util/data/tt-locktime317000-out.json b/test/util/data/tt-locktime317000-out.json index af7903d1dd..c97206f1ea 100644 --- a/test/util/data/tt-locktime317000-out.json +++ b/test/util/data/tt-locktime317000-out.json @@ -4,6 +4,7 @@ "version": 1, "size": 3189, "vsize": 3189, + "weight": 12756, "locktime": 317000, "vin": [ { diff --git a/test/util/data/txcreate1.json b/test/util/data/txcreate1.json index 83a86649e0..ca9eacd546 100644 --- a/test/util/data/txcreate1.json +++ b/test/util/data/txcreate1.json @@ -4,6 +4,7 @@ "version": 2, "size": 201, "vsize": 201, + "weight": 804, "locktime": 0, "vin": [ { diff --git a/test/util/data/txcreate2.json b/test/util/data/txcreate2.json index cca00f752b..ee9b9c3c17 100644 --- a/test/util/data/txcreate2.json +++ b/test/util/data/txcreate2.json @@ -4,6 +4,7 @@ "version": 2, "size": 19, "vsize": 19, + "weight": 76, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatedata1.json b/test/util/data/txcreatedata1.json index 15a4246ae5..39909c2e3f 100644 --- a/test/util/data/txcreatedata1.json +++ b/test/util/data/txcreatedata1.json @@ -4,6 +4,7 @@ "version": 1, "size": 176, "vsize": 176, + "weight": 704, "locktime": 0, "vin": [ { diff --git a/test/util/data/txcreatedata2.json b/test/util/data/txcreatedata2.json index cb93c27971..2958006e58 100644 --- a/test/util/data/txcreatedata2.json +++ b/test/util/data/txcreatedata2.json @@ -4,6 +4,7 @@ "version": 2, "size": 176, "vsize": 176, + "weight": 704, "locktime": 0, "vin": [ { diff --git a/test/util/data/txcreatedata_seq0.json b/test/util/data/txcreatedata_seq0.json index 4b5a7cab4a..a6656b5ad5 100644 --- a/test/util/data/txcreatedata_seq0.json +++ b/test/util/data/txcreatedata_seq0.json @@ -4,6 +4,7 @@ "version": 2, "size": 85, "vsize": 85, + "weight": 340, "locktime": 0, "vin": [ { diff --git a/test/util/data/txcreatedata_seq1.json b/test/util/data/txcreatedata_seq1.json index dea48ba373..e5980427b1 100644 --- a/test/util/data/txcreatedata_seq1.json +++ b/test/util/data/txcreatedata_seq1.json @@ -4,6 +4,7 @@ "version": 1, "size": 126, "vsize": 126, + "weight": 504, "locktime": 0, "vin": [ { diff --git a/test/util/data/txcreatemultisig1.json b/test/util/data/txcreatemultisig1.json index 72e20c8691..c32e755db1 100644 --- a/test/util/data/txcreatemultisig1.json +++ b/test/util/data/txcreatemultisig1.json @@ -4,6 +4,7 @@ "version": 1, "size": 124, "vsize": 124, + "weight": 496, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatemultisig2.json b/test/util/data/txcreatemultisig2.json index 7d94ce7396..f97d265894 100644 --- a/test/util/data/txcreatemultisig2.json +++ b/test/util/data/txcreatemultisig2.json @@ -4,6 +4,7 @@ "version": 1, "size": 42, "vsize": 42, + "weight": 168, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatemultisig3.json b/test/util/data/txcreatemultisig3.json index 6c5b49d876..b355d7b191 100644 --- a/test/util/data/txcreatemultisig3.json +++ b/test/util/data/txcreatemultisig3.json @@ -4,6 +4,7 @@ "version": 1, "size": 53, "vsize": 53, + "weight": 212, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatemultisig4.json b/test/util/data/txcreatemultisig4.json index 9a5d2f4a06..a00dbe3f5d 100644 --- a/test/util/data/txcreatemultisig4.json +++ b/test/util/data/txcreatemultisig4.json @@ -4,6 +4,7 @@ "version": 1, "size": 42, "vsize": 42, + "weight": 168, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatemultisig5.json b/test/util/data/txcreatemultisig5.json index 20e9bb077b..ea07822ddd 100644 --- a/test/util/data/txcreatemultisig5.json +++ b/test/util/data/txcreatemultisig5.json @@ -4,6 +4,7 @@ "version": 2, "size": 42, "vsize": 42, + "weight": 168, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreateoutpubkey1.json b/test/util/data/txcreateoutpubkey1.json index 2704ed7673..32097b3ebe 100644 --- a/test/util/data/txcreateoutpubkey1.json +++ b/test/util/data/txcreateoutpubkey1.json @@ -4,6 +4,7 @@ "version": 1, "size": 54, "vsize": 54, + "weight": 216, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreateoutpubkey2.json b/test/util/data/txcreateoutpubkey2.json index 4ba5dcb282..c0ee181ede 100644 --- a/test/util/data/txcreateoutpubkey2.json +++ b/test/util/data/txcreateoutpubkey2.json @@ -4,6 +4,7 @@ "version": 1, "size": 41, "vsize": 41, + "weight": 164, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreateoutpubkey3.json b/test/util/data/txcreateoutpubkey3.json index 0a5d489e15..4d904df3c8 100644 --- a/test/util/data/txcreateoutpubkey3.json +++ b/test/util/data/txcreateoutpubkey3.json @@ -4,6 +4,7 @@ "version": 1, "size": 42, "vsize": 42, + "weight": 168, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatescript1.json b/test/util/data/txcreatescript1.json index 5072452fed..af1c4c35e2 100644 --- a/test/util/data/txcreatescript1.json +++ b/test/util/data/txcreatescript1.json @@ -4,6 +4,7 @@ "version": 1, "size": 20, "vsize": 20, + "weight": 80, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatescript2.json b/test/util/data/txcreatescript2.json index 94b669ffb6..32dd644579 100644 --- a/test/util/data/txcreatescript2.json +++ b/test/util/data/txcreatescript2.json @@ -4,6 +4,7 @@ "version": 1, "size": 42, "vsize": 42, + "weight": 168, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatescript3.json b/test/util/data/txcreatescript3.json index 31b6459214..b9192d9a82 100644 --- a/test/util/data/txcreatescript3.json +++ b/test/util/data/txcreatescript3.json @@ -4,6 +4,7 @@ "version": 1, "size": 53, "vsize": 53, + "weight": 212, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatescript4.json b/test/util/data/txcreatescript4.json index eecdf858b7..2271ecfa0a 100644 --- a/test/util/data/txcreatescript4.json +++ b/test/util/data/txcreatescript4.json @@ -4,6 +4,7 @@ "version": 1, "size": 42, "vsize": 42, + "weight": 168, "locktime": 0, "vin": [ ], diff --git a/test/util/data/txcreatesignv1.json b/test/util/data/txcreatesignv1.json index 92a3f76a07..64e5137f4b 100644 --- a/test/util/data/txcreatesignv1.json +++ b/test/util/data/txcreatesignv1.json @@ -4,6 +4,7 @@ "version": 1, "size": 224, "vsize": 224, + "weight": 896, "locktime": 0, "vin": [ { |