diff options
author | Gregory Sanders <gsanders87@gmail.com> | 2019-04-25 17:01:01 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-05-20 12:24:03 -0400 |
commit | 5a58ddb6d558514c2f48543be0760bbf22698189 (patch) | |
tree | 74c27045d1950b8732d5984388c1ef75b7c72607 | |
parent | 206f5ee87576d619ea9d09380cc4d205989c7885 (diff) |
Fix missing input template by making minimal tx
Github-Pull: #15893
Rebased-From: 25b078658139c1aea58393a32ac5a79144d8d140
-rw-r--r-- | test/functional/data/invalid_txs.py | 6 | ||||
-rwxr-xr-x | test/functional/feature_block.py | 14 |
2 files changed, 5 insertions, 15 deletions
diff --git a/test/functional/data/invalid_txs.py b/test/functional/data/invalid_txs.py index 02deae92f3..d262dae5aa 100644 --- a/test/functional/data/invalid_txs.py +++ b/test/functional/data/invalid_txs.py @@ -71,9 +71,13 @@ class InputMissing(BadTxTemplate): reject_reason = "bad-txns-vin-empty" expect_disconnect = False + # We use a blank transaction here to make sure + # it is interpreted as a non-witness transaction. + # Otherwise the transaction will fail the + # "surpufluous witness" check during deserialization + # rather than the input count check. def get_tx(self): tx = CTransaction() - tx.vout.append(CTxOut(0, sc.CScript([sc.OP_TRUE] * 100))) tx.calc_sha256() return tx diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py index 5253ff7aaa..c62fbb8e2b 100755 --- a/test/functional/feature_block.py +++ b/test/functional/feature_block.py @@ -146,20 +146,6 @@ class FullBlockTest(BitcoinTestFramework): badtx = template.get_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( |