diff options
author | Shen Noether <Shen.Noether@gmx.com> | 2016-06-12 21:53:01 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-28 21:28:23 +0100 |
commit | f8c04ad94fff9df079b59f197a49e19478385725 (patch) | |
tree | ca3c8079b2c56f9ad3e5815d1469e970c3d6dfdd /tests/unit_tests | |
parent | ringct: new {gen,decode}Rct APIs for convenience (diff) | |
download | monero-f8c04ad94fff9df079b59f197a49e19478385725.tar.xz |
ringct: txn fee stuff
Diffstat (limited to 'tests/unit_tests')
-rw-r--r-- | tests/unit_tests/ringct.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp index 13dc313dd..ba9d3ecc4 100644 --- a/tests/unit_tests/ringct.cpp +++ b/tests/unit_tests/ringct.cpp @@ -213,6 +213,67 @@ TEST(ringct, range_proofs) ASSERT_TRUE(decodeRct(s, Sk, 1)); } +TEST(ringct, range_proofs_with_fee) +{ + //Ring CT Stuff + //ct range proofs + ctkeyV sc, pc; + ctkey sctmp, pctmp; + //add fake input 5000 + tie(sctmp, pctmp) = ctskpkGen(6001); + sc.push_back(sctmp); + pc.push_back(pctmp); + + + tie(sctmp, pctmp) = ctskpkGen(7000); + sc.push_back(sctmp); + pc.push_back(pctmp); + vector<xmr_amount >amounts; + + + //add output 500 + amounts.push_back(500); + keyV destinations; + key Sk, Pk; + skpkGen(Sk, Pk); + destinations.push_back(Pk); + + //add txn fee for 1 + //has no corresponding destination.. + amounts.push_back(1); + + //add output for 12500 + amounts.push_back(12500); + skpkGen(Sk, Pk); + destinations.push_back(Pk); + + //compute rct data with mixin 500 + rctSig s = genRct(sc, pc, destinations, amounts, 3); + + //verify rct data + ASSERT_TRUE(verRct(s)); + + //decode received amount + ASSERT_TRUE(decodeRct(s, Sk, 1)); + + // Ring CT with failing MG sig part should not verify! + // Since sum of inputs != outputs + + amounts[1] = 12501; + skpkGen(Sk, Pk); + destinations[1] = Pk; + + + //compute rct data with mixin 500 + s = genRct(sc, pc, destinations, amounts, 3); + + //verify rct data + ASSERT_FALSE(verRct(s)); + + //decode received amount + ASSERT_TRUE(decodeRct(s, Sk, 1)); +} + static bool range_proof_test(bool expected_valid, int n_inputs, const uint64_t input_amounts[], int n_outputs, const uint64_t output_amounts[]) { |