diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2018-04-17 20:05:12 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2018-04-17 20:05:23 +0200 |
commit | 3a8a4dc4a130c6d1eeff3fb8e6d9688dda2f8d25 (patch) | |
tree | 2700e17c932ae8b6daf532bce104cb849ec97e0c /test/functional | |
parent | 6b46288a0853621bc911c26bb87bba22521059e7 (diff) | |
parent | 9e50c337c7126e05dad2f2f5a53ef882ab0b0330 (diff) |
Merge #12791: Expose a transaction's weight via RPC
9e50c337c Note new weight field in release-notes. (Matt Corallo)
d0d9112b7 Test new weight field in p2p_segwit (Matt Corallo)
2874709a9 Expose a transaction's weight via RPC (Matt Corallo)
Pull request description:
This seems like an obvious oversight.
Tree-SHA512: defd047de34fb06a31f589e1a4eef68fcae85095cc67b7c8fb434237bb40300d7f3f97e852d3e7226330e26b96943846b7baf6da0cfc79db8d56e9c1f7848ad9
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/p2p_segwit.py | 5 |
1 files changed, 4 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"]) |