Skip to content

Commit

Permalink
Merge pull request BTCGPU#351 from h4x3rotab/cve-2018-17144
Browse files Browse the repository at this point in the history
  • Loading branch information
h4x3rotab authored Sep 19, 2018
2 parents 1fe6ed7 + 374e5a3 commit f8db148
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2868,7 +2868,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()));

Expand Down
11 changes: 11 additions & 0 deletions test/functional/invalidblockrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ def get_tests(self):
yield TestInstance([[block2, RejectResult(16, b'bad-txns-duplicate')], [block2_orig, True]])
height += 1


# 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()
yield TestInstance([[block2_orig, RejectResult(16, b'bad-txns-inputs-duplicate')]])

'''
Make sure that a totally screwed up block is not valid.
'''
Expand Down

0 comments on commit f8db148

Please sign in to comment.