mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
blockchain: reject unsorted ins and outs from v7
This ensures no information is leaked by the ordering
This commit is contained in:
parent
16afab900d
commit
6137a0b94d
3 changed files with 76 additions and 1 deletions
|
@ -43,3 +43,32 @@ TEST(apply_permutation, reorder)
|
|||
tools::apply_permutation({3, 5, 6, 1, 2, 4, 0}, v);
|
||||
ASSERT_EQ(v, std::vector<int>({1, 2, 4, 4, 6, 7, 8}));
|
||||
}
|
||||
|
||||
TEST(apply_permutation, bad_size)
|
||||
{
|
||||
std::vector<int> v_large = {8, 4, 6, 1, 7, 2, 4, 9};
|
||||
std::vector<int> v_small = {8, 4, 6, 1, 7, 2};
|
||||
try
|
||||
{
|
||||
tools::apply_permutation({3, 5, 6, 1, 2, 4, 0}, v_large);
|
||||
ASSERT_FALSE(true);
|
||||
}
|
||||
catch (const std::exception &e) {}
|
||||
try
|
||||
{
|
||||
tools::apply_permutation({3, 5, 6, 1, 2, 4, 0}, v_small);
|
||||
ASSERT_FALSE(true);
|
||||
}
|
||||
catch (const std::exception &e) {}
|
||||
}
|
||||
|
||||
TEST(apply_permutation, bad_permutation)
|
||||
{
|
||||
std::vector<int> v = {8, 4, 6, 1, 7, 2, 4};
|
||||
try
|
||||
{
|
||||
tools::apply_permutation({3, 5, 6, 1, 2, 4, 1}, v);
|
||||
ASSERT_FALSE(true);
|
||||
}
|
||||
catch (const std::exception &e) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue