diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-06-30 23:40:39 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-07-01 02:32:25 +0200 |
commit | a084ebe1330bcec15715e08b0f65319142927ad1 (patch) | |
tree | 6d5e8b0add4924c36d47ad1736a43f159d2683b2 /test/functional/p2p_segwit.py | |
parent | 3fc20abab03d71a982d6fe9c47155834b256ab17 (diff) | |
download | bitcoin-a084ebe1330bcec15715e08b0f65319142927ad1.tar.xz |
test: introduce `get_weight()` helper for CTransaction
Diffstat (limited to 'test/functional/p2p_segwit.py')
-rwxr-xr-x | test/functional/p2p_segwit.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 95c7aec318..f34908e134 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -4,7 +4,6 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test segwit transactions and blocks on P2P network.""" from decimal import Decimal -import math import random import struct import time @@ -1367,10 +1366,9 @@ 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())) - weight = len(tx3.serialize_with_witness()) + 3 * len(tx3.serialize_without_witness()) - vsize = math.ceil(weight / 4) + vsize = tx3.get_vsize() assert_equal(raw_tx["vsize"], vsize) - assert_equal(raw_tx["weight"], weight) + assert_equal(raw_tx["weight"], tx3.get_weight()) assert_equal(len(raw_tx["vin"][0]["txinwitness"]), 1) assert_equal(raw_tx["vin"][0]["txinwitness"][0], witness_program.hex()) assert vsize != raw_tx["size"] |