From 66a519f55dc6b3a1c403b865f6675bef37a04d88 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sat, 16 Jun 2018 23:06:15 +1200 Subject: [PATCH] Alter SaplingNote::nullifier() to take a SaplingFullViewingKey This means the API will work if you only have a SaplingExtendedSpendingKey, as will be the case with ZIP 32. --- src/gtest/test_sapling_note.cpp | 2 +- src/zcash/Note.cpp | 3 +-- src/zcash/Note.hpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gtest/test_sapling_note.cpp b/src/gtest/test_sapling_note.cpp index 06f2d6188..3e336ec7e 100644 --- a/src/gtest/test_sapling_note.cpp +++ b/src/gtest/test_sapling_note.cpp @@ -49,7 +49,7 @@ TEST(SaplingNote, TestVectors) // Test nullifier SaplingSpendingKey spendingKey(sk); - ASSERT_EQ(note.nullifier(spendingKey, note_pos), nf); + ASSERT_EQ(note.nullifier(spendingKey.full_viewing_key(), note_pos), nf); } diff --git a/src/zcash/Note.cpp b/src/zcash/Note.cpp index 1108e1db5..c6c72e297 100644 --- a/src/zcash/Note.cpp +++ b/src/zcash/Note.cpp @@ -65,9 +65,8 @@ boost::optional SaplingNote::cm() const { } // Call librustzcash to compute the nullifier -boost::optional SaplingNote::nullifier(const SaplingSpendingKey& sk, const uint64_t position) const +boost::optional SaplingNote::nullifier(const SaplingFullViewingKey& vk, const uint64_t position) const { - auto vk = sk.full_viewing_key(); auto ak = vk.ak; auto nk = vk.nk; diff --git a/src/zcash/Note.hpp b/src/zcash/Note.hpp index 5a3e55dfe..f1b8e4323 100644 --- a/src/zcash/Note.hpp +++ b/src/zcash/Note.hpp @@ -57,7 +57,7 @@ public: virtual ~SaplingNote() {}; boost::optional cm() const; - boost::optional nullifier(const SaplingSpendingKey &sk, const uint64_t position) const; + boost::optional nullifier(const SaplingFullViewingKey &vk, const uint64_t position) const; }; class BaseNotePlaintext {