diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-06-29 18:18:18 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-28 21:28:55 +0100 |
commit | 20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3 (patch) | |
tree | 1f18f1130c9c553b7b103d035e6d829ec182011e /tests/unit_tests/serialization.cpp | |
parent | Add rct core tests (diff) | |
download | monero-20e50ec7f7f4104b5eb177aa30df4f5d4db9c8c3.tar.xz |
ringct: do not serialize what can be reconstructed
The mixRing (output keys and commitments) and II fields (key images)
can be reconstructed from vin data.
This saves some modest amount of space in the tx.
Diffstat (limited to 'tests/unit_tests/serialization.cpp')
-rw-r--r-- | tests/unit_tests/serialization.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp index 55a33c83f..5223298cd 100644 --- a/tests/unit_tests/serialization.cpp +++ b/tests/unit_tests/serialization.cpp @@ -576,11 +576,10 @@ TEST(Serialization, serializes_ringct_types) ASSERT_TRUE(mg0.ss[n] == mg1.ss[n]); } ASSERT_TRUE(mg0.cc == mg1.cc); - ASSERT_TRUE(mg0.II.size() == mg1.II.size()); - for (size_t n = 0; n < mg0.II.size(); ++n) - { - ASSERT_TRUE(mg0.II[n] == mg1.II[n]); - } + + // mixRing and II are not serialized, they are meant to be reconstructed + ASSERT_TRUE(mg1.II.size() == 1); + ASSERT_TRUE(mg1.II[0] == mg0.II.back()); rg0 = s0.rangeSigs.front(); ASSERT_TRUE(serialization::dump_binary(rg0, blob)); @@ -600,20 +599,13 @@ TEST(Serialization, serializes_ringct_types) ASSERT_TRUE(s0.MG.ss[n] == s1.MG.ss[n]); } ASSERT_TRUE(s0.MG.cc == s1.MG.cc); - ASSERT_TRUE(s0.MG.II.size() == s1.MG.II.size()); - for (size_t n = 0; n < s0.MG.II.size(); ++n) - { - ASSERT_TRUE(s0.MG.II[n] == s1.MG.II[n]); - } - ASSERT_TRUE(s0.mixRing.size() == s1.mixRing.size()); - for (size_t n = 0; n < s0.mixRing.size(); ++n) - { - ASSERT_TRUE(s0.mixRing[n].size() == s1.mixRing[n].size()); - for (size_t i = 0; i < s0.mixRing[n].size(); ++i) - { - ASSERT_TRUE(!memcmp(&s0.mixRing[n][i], &s1.mixRing[n][i], sizeof(s0.mixRing[n][i]))); - } - } + // mixRing and II are not serialized, they are meant to be reconstructed + ASSERT_TRUE(s1.MG.II.size() == 1); + ASSERT_TRUE(s1.MG.II[0] == s0.MG.II.back()); + + // mixRing and II are not serialized, they are meant to be reconstructed + ASSERT_TRUE(s1.mixRing.size() == 0); + ASSERT_TRUE(s0.ecdhInfo.size() == s1.ecdhInfo.size()); for (size_t n = 0; n < s0.ecdhInfo.size(); ++n) { |