diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-18 01:19:45 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-18 01:20:01 +0200 |
commit | d926a87fde80b64024b2d94260c53aab20ccb259 (patch) | |
tree | 7634ed372ef8856bba89d47b864fc981d30ea793 | |
parent | 4901c00792c1dabae4bb01e6373c9b1ed9ef3008 (diff) | |
parent | 9b4a36effcf642f3844c6696b757266686ece11a (diff) |
Merge #14247: Fix crash bug with duplicate inputs within a transaction
9b4a36effcf642f3844c6696b757266686ece11a [qa] Test for duplicate inputs within a transaction (Suhas Daftuar)
b8f801964f59586508ea8da6cf3decd76bc0e571 Fix crash bug with duplicate inputs within a transaction (Suhas Daftuar)
Pull request description:
Tree-SHA512: 8c7ea34c7fa44188d86c04a690a7cbf8e9deda71ab1f7ca6d11de1f2abb3dd7222627071f86d0d39689a8b302ba9af142f0202466a67e30cd54aed3a08d4eb14
-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 947192be0e..59c3fb425f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3122,7 +3122,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 7be7c9b3ee..0678b1a651 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, success=False, request_block=False, reject_reason='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='bad-txns-inputs-duplicate') + self.log.info("Test very broken block.") block3 = create_block(tip, create_coinbase(height), block_time) |