Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/validate_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ bool validate_block::is_distinct_tx_set(const transaction_list& txs)

std::vector<hash_digest> hashes(txs.size());
std::transform(txs.begin(), txs.end(), hashes.begin(), hasher);
std::sort(hashes.begin(), hashes.end());
auto distinct_end = std::unique(hashes.begin(), hashes.end());
return distinct_end == hashes.end();
}
Expand Down
8 changes: 8 additions & 0 deletions test/validate_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ BOOST_AUTO_TEST_CASE(validate_block__is_distinct_tx_set__partialy_distinct_by_ve
BOOST_REQUIRE(!validate_block_fixture::is_distinct_tx_set({ tx1, tx2, tx3 }));
}

BOOST_AUTO_TEST_CASE(validate_block__is_distinct_tx_set__partialy_distinct_not_adjacent_by_version__false)
{
const transaction_type tx1{ 1, 0 };
const transaction_type tx2{ 2, 0 };
const transaction_type tx3{ 1, 0 };
BOOST_REQUIRE(!validate_block_fixture::is_distinct_tx_set({ tx1, tx2, tx3 }));
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END()