diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-18 01:20:49 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-18 01:20:52 +0200 |
commit | c64128df5882e8dc1f76ae7c1e998ed57b8645fe (patch) | |
tree | 0d362c45d95f5cfe40116dac54c30472559cfddb | |
parent | 465a583f9dcc2383eb20bbb98bffa66fe82f2cde (diff) | |
parent | 0d49c82edd4c2c92f8ebe215c057b0173a258d77 (diff) |
Merge #14248: [0.17] Fix crash bug with duplicate inputs within a transactionv0.17.0rc4
0d49c82edd4c2c92f8ebe215c057b0173a258d77 [qa] backport: Test for duplicate inputs within a transaction (Suhas Daftuar)
833180f538c7fa16b097022c7c0d4b4d2f09688b Fix crash bug with duplicate inputs within a transaction (Suhas Daftuar)
Pull request description:
This is a backport of #14247.
Tree-SHA512: 4d3b6244d501a48f56a728c571dac9a346019a671434edac943f4f535ef8f94ec6bfd569a0585ad5e23a6e488ecd7e0079510cbb10a2a22f576eb36d73accb0c
-rw-r--r-- | src/validation.cpp | 2 | ||||
-rwxr-xr-x | test/functional/p2p_invalid_block.py | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index fceb135854..d3908fc1d8 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3130,7 +3130,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P // Check transactions for (const auto& tx : block.vtx) - if (!CheckTransaction(*tx, state, false)) + if (!CheckTransaction(*tx, state, true)) return state.Invalid(false, state.GetRejectCode(), state.GetRejectReason(), strprintf("Transaction check failed (tx hash %s) %s", tx->GetHash().ToString(), state.GetDebugMessage())); diff --git a/test/functional/p2p_invalid_block.py b/test/functional/p2p_invalid_block.py index e910bedd09..1534f362e3 100755 --- a/test/functional/p2p_invalid_block.py +++ b/test/functional/p2p_invalid_block.py @@ -81,6 +81,16 @@ class InvalidBlockRequestTest(BitcoinTestFramework): node.p2p.send_blocks_and_test([block2], node, False, False, 16, b'bad-txns-duplicate') + # Check transactions for duplicate inputs + self.log.info("Test duplicate input block.") + + block2_orig.vtx[2].vin.append(block2_orig.vtx[2].vin[0]) + block2_orig.vtx[2].rehash() + block2_orig.hashMerkleRoot = block2_orig.calc_merkle_root() + block2_orig.rehash() + block2_orig.solve() + node.p2p.send_blocks_and_test([block2_orig], node, success=False, request_block=False, reject_reason=b'bad-txns-inputs-duplicate') + self.log.info("Test very broken block.") block3 = create_block(tip, create_coinbase(height), block_time) |