mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
test: Run invalid_txs.InputMissing test in feature_block
This commit is contained in:
parent
f7e182a973
commit
fac4e731a8
2 changed files with 19 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2012-2018 The Bitcoin Core developers
|
||||
// Copyright (c) 2012-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.
|
||||
|
||||
|
@ -47,7 +47,7 @@ BOOST_FIXTURE_TEST_CASE(scan_for_wallet_transactions, TestChain100Setup)
|
|||
|
||||
auto locked_chain = chain->lock();
|
||||
|
||||
// Verify ScanForWalletTransactions accomodates a null start block.
|
||||
// Verify ScanForWalletTransactions accommodates a null start block.
|
||||
{
|
||||
CWallet wallet(*chain, WalletLocation(), WalletDatabase::CreateDummy());
|
||||
AddKey(wallet, coinbaseKey);
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue