aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-01-07 12:58:55 +0100
committerMarcoFalke <falke.marco@gmail.com>2019-01-07 12:59:17 +0100
commit295a1ad5223535d5e685a56246a5a814c04a0e91 (patch)
treebc050ac7e33dcb79a5ad2bc1111197c71507c626 /test
parent9c719987718d9fcc3a689e50f5212acc7ead7606 (diff)
parentfac4e731a8e5f140dc3bbca4c9af6e23fc1cd107 (diff)
downloadbitcoin-295a1ad5223535d5e685a56246a5a814c04a0e91.tar.xz
Merge #15102: test: Run invalid_txs.InputMissing test in feature_block
fac4e731a8 test: Run invalid_txs.InputMissing test in feature_block (MarcoFalke) Pull request description: Tree-SHA512: 24c3f519ba0cf417b66e0df6f5ddc0430e3f419af4705a9c85096da47ff4d8f51487d65b68f3f993800003b3f936d95d8a0bade846e1b45f95b2bdbecc9ebab7
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_block.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py
index 697a0b19ac..244cde044e 100755
--- a/test/functional/feature_block.py
+++ b/test/functional/feature_block.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# Copyright (c) 2015-2018 The Bitcoin Core developers
+# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block processing."""
@@ -137,12 +137,6 @@ class FullBlockTest(BitcoinTestFramework):
for TxTemplate in invalid_txs.iter_all_templates():
template = TxTemplate(spend_tx=attempt_spend_tx)
- # Something about the serialization code for missing inputs creates
- # a different hash in the test client than on bitcoind, resulting
- # in a mismatching merkle root during block validation.
- # Skip until we figure out what's going on.
- if TxTemplate == invalid_txs.InputMissing:
- continue
if template.valid_in_block:
continue
@@ -150,7 +144,22 @@ class FullBlockTest(BitcoinTestFramework):
blockname = "for_invalid.%s" % TxTemplate.__name__
badblock = self.next_block(blockname)
badtx = template.get_tx()
- self.sign_tx(badtx, attempt_spend_tx)
+ if TxTemplate != invalid_txs.InputMissing:
+ self.sign_tx(badtx, attempt_spend_tx)
+ else:
+ # Segwit is active in regtest at this point, so to deserialize a
+ # transaction without any inputs correctly, we set the outputs
+ # to an empty list. This is a hack, as the serialization of an
+ # empty list of outputs is deserialized as flags==0 and thus
+ # deserialization of the outputs is skipped.
+ # A policy check requires "loose" txs to be of a minimum size,
+ # so vtx is not set to be empty in the TxTemplate class and we
+ # only apply the workaround where txs are not "loose", i.e. in
+ # blocks.
+ #
+ # The workaround has the purpose that both sides calculate
+ # the same tx hash in the merkle tree
+ badtx.vout = []
badtx.rehash()
badblock = self.update_block(blockname, [badtx])
self.sync_blocks(