aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2020-03-10 22:30:07 -0400
committerLee Clagett <code@leeclagett.com>2020-03-10 22:30:07 -0400
commite7197602539b79baa14350bb9e99c935dfbebb72 (patch)
treecc51ec13e167bb9697fa819810b64b50f34529bd /tests/unit_tests
parentMerge pull request #6248 (diff)
downloadmonero-e7197602539b79baa14350bb9e99c935dfbebb72.tar.xz
Fix receive order leakage with tx fluffing
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/levin.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/unit_tests/levin.cpp b/tests/unit_tests/levin.cpp
index 38707f075..720103e5a 100644
--- a/tests/unit_tests/levin.cpp
+++ b/tests/unit_tests/levin.cpp
@@ -462,8 +462,8 @@ TEST_F(levin_notify, fluff_without_padding)
}
std::vector<cryptonote::blobdata> txs(2);
- txs[0].resize(100, 'e');
- txs[1].resize(200, 'f');
+ txs[0].resize(100, 'f');
+ txs[1].resize(200, 'e');
ASSERT_EQ(10u, contexts_.size());
{
@@ -479,6 +479,7 @@ TEST_F(levin_notify, fluff_without_padding)
for (++context; context != contexts_.end(); ++context)
EXPECT_EQ(1u, context->process_send_queue());
+ std::sort(txs.begin(), txs.end());
ASSERT_EQ(9u, receiver_.notified_size());
for (unsigned count = 0; count < 9; ++count)
{
@@ -510,8 +511,8 @@ TEST_F(levin_notify, fluff_with_padding)
}
std::vector<cryptonote::blobdata> txs(2);
- txs[0].resize(100, 'e');
- txs[1].resize(200, 'f');
+ txs[0].resize(100, 'f');
+ txs[1].resize(200, 'e');
ASSERT_EQ(10u, contexts_.size());
{
@@ -527,6 +528,7 @@ TEST_F(levin_notify, fluff_with_padding)
for (++context; context != contexts_.end(); ++context)
EXPECT_EQ(1u, context->process_send_queue());
+ std::sort(txs.begin(), txs.end());
ASSERT_EQ(9u, receiver_.notified_size());
for (unsigned count = 0; count < 9; ++count)
{
@@ -558,8 +560,8 @@ TEST_F(levin_notify, private_fluff_without_padding)
}
std::vector<cryptonote::blobdata> txs(2);
- txs[0].resize(100, 'e');
- txs[1].resize(200, 'f');
+ txs[0].resize(100, 'f');
+ txs[1].resize(200, 'e');
ASSERT_EQ(10u, contexts_.size());
{
@@ -572,6 +574,7 @@ TEST_F(levin_notify, private_fluff_without_padding)
io_service_.reset();
ASSERT_LT(0u, io_service_.poll());
+ std::sort(txs.begin(), txs.end());
EXPECT_EQ(0u, context->process_send_queue());
for (++context; context != contexts_.end(); ++context)
{
@@ -610,8 +613,8 @@ TEST_F(levin_notify, private_fluff_with_padding)
}
std::vector<cryptonote::blobdata> txs(2);
- txs[0].resize(100, 'e');
- txs[1].resize(200, 'f');
+ txs[0].resize(100, 'f');
+ txs[1].resize(200, 'e');
ASSERT_EQ(10u, contexts_.size());
{
@@ -624,6 +627,7 @@ TEST_F(levin_notify, private_fluff_with_padding)
io_service_.reset();
ASSERT_LT(0u, io_service_.poll());
+ std::sort(txs.begin(), txs.end());
EXPECT_EQ(0u, context->process_send_queue());
for (++context; context != contexts_.end(); ++context)
{