Auto merge of #4380 - oxarbitrage:issue3446, r=ebfull
Change cm to cmu in sapling Part of https://github.com/zcash/zcash/issues/3446 For each of the 2 commits, suggested change was made, then fixed build errors until compile. Finally ran bitcoin and gtests, both of them passing.
This commit is contained in:
commit
95e446bf69
|
@ -134,7 +134,7 @@ static void SaplingOutput(benchmark::State& state)
|
||||||
librustzcash_sapling_check_output(
|
librustzcash_sapling_check_output(
|
||||||
ctx,
|
ctx,
|
||||||
output.cv.begin(),
|
output.cv.begin(),
|
||||||
output.cm.begin(),
|
output.cmu.begin(),
|
||||||
output.ephemeralKey.begin(),
|
output.ephemeralKey.begin(),
|
||||||
output.zkproof.begin());
|
output.zkproof.begin());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ TEST(noteencryption, NotePlaintext)
|
||||||
}
|
}
|
||||||
|
|
||||||
SaplingNote note(addr, 39393);
|
SaplingNote note(addr, 39393);
|
||||||
auto cmu_opt = note.cm();
|
auto cmu_opt = note.cmu();
|
||||||
if (!cmu_opt) {
|
if (!cmu_opt) {
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ TEST(noteencryption, NotePlaintext)
|
||||||
ASSERT_TRUE(note.d == new_note.d);
|
ASSERT_TRUE(note.d == new_note.d);
|
||||||
ASSERT_TRUE(note.pk_d == new_note.pk_d);
|
ASSERT_TRUE(note.pk_d == new_note.pk_d);
|
||||||
ASSERT_TRUE(note.r == new_note.r);
|
ASSERT_TRUE(note.r == new_note.r);
|
||||||
ASSERT_TRUE(note.cm() == new_note.cm());
|
ASSERT_TRUE(note.cmu() == new_note.cmu());
|
||||||
|
|
||||||
SaplingOutgoingPlaintext out_pt;
|
SaplingOutgoingPlaintext out_pt;
|
||||||
out_pt.pk_d = note.pk_d;
|
out_pt.pk_d = note.pk_d;
|
||||||
|
|
|
@ -45,7 +45,7 @@ TEST(SaplingNote, TestVectors)
|
||||||
|
|
||||||
// Test commitment
|
// Test commitment
|
||||||
SaplingNote note = SaplingNote(diversifier, pk_d, v, r);
|
SaplingNote note = SaplingNote(diversifier, pk_d, v, r);
|
||||||
ASSERT_EQ(note.cm().get(), cm);
|
ASSERT_EQ(note.cmu().get(), cm);
|
||||||
|
|
||||||
// Test nullifier
|
// Test nullifier
|
||||||
SaplingSpendingKey spendingKey(sk);
|
SaplingSpendingKey spendingKey(sk);
|
||||||
|
|
|
@ -952,7 +952,7 @@ bool ContextualCheckTransaction(
|
||||||
if (!librustzcash_sapling_check_output(
|
if (!librustzcash_sapling_check_output(
|
||||||
ctx,
|
ctx,
|
||||||
output.cv.begin(),
|
output.cv.begin(),
|
||||||
output.cm.begin(),
|
output.cmu.begin(),
|
||||||
output.ephemeralKey.begin(),
|
output.ephemeralKey.begin(),
|
||||||
output.zkproof.begin()
|
output.zkproof.begin()
|
||||||
))
|
))
|
||||||
|
@ -2731,7 +2731,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const OutputDescription &outputDescription, tx.vShieldedOutput) {
|
BOOST_FOREACH(const OutputDescription &outputDescription, tx.vShieldedOutput) {
|
||||||
sapling_tree.append(outputDescription.cm);
|
sapling_tree.append(outputDescription.cmu);
|
||||||
}
|
}
|
||||||
|
|
||||||
vPos.push_back(std::make_pair(tx.GetHash(), pos));
|
vPos.push_back(std::make_pair(tx.GetHash(), pos));
|
||||||
|
|
|
@ -362,7 +362,7 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s
|
||||||
UpdateCoins(tx, view, nHeight);
|
UpdateCoins(tx, view, nHeight);
|
||||||
|
|
||||||
BOOST_FOREACH(const OutputDescription &outDescription, tx.vShieldedOutput) {
|
BOOST_FOREACH(const OutputDescription &outDescription, tx.vShieldedOutput) {
|
||||||
sapling_tree.append(outDescription.cm);
|
sapling_tree.append(outDescription.cmu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added
|
// Added
|
||||||
|
|
|
@ -99,7 +99,7 @@ class OutputDescription
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint256 cv; //!< A value commitment to the value of the output note.
|
uint256 cv; //!< A value commitment to the value of the output note.
|
||||||
uint256 cm; //!< The note commitment for the output note.
|
uint256 cmu; //!< The u-coordinate of the note commitment for the output note.
|
||||||
uint256 ephemeralKey; //!< A Jubjub public key.
|
uint256 ephemeralKey; //!< A Jubjub public key.
|
||||||
libzcash::SaplingEncCiphertext encCiphertext; //!< A ciphertext component for the encrypted output note.
|
libzcash::SaplingEncCiphertext encCiphertext; //!< A ciphertext component for the encrypted output note.
|
||||||
libzcash::SaplingOutCiphertext outCiphertext; //!< A ciphertext component for the encrypted output note.
|
libzcash::SaplingOutCiphertext outCiphertext; //!< A ciphertext component for the encrypted output note.
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
template <typename Stream, typename Operation>
|
template <typename Stream, typename Operation>
|
||||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||||
READWRITE(cv);
|
READWRITE(cv);
|
||||||
READWRITE(cm);
|
READWRITE(cmu);
|
||||||
READWRITE(ephemeralKey);
|
READWRITE(ephemeralKey);
|
||||||
READWRITE(encCiphertext);
|
READWRITE(encCiphertext);
|
||||||
READWRITE(outCiphertext);
|
READWRITE(outCiphertext);
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
a.cv == b.cv &&
|
a.cv == b.cv &&
|
||||||
a.cm == b.cm &&
|
a.cmu == b.cmu &&
|
||||||
a.ephemeralKey == b.ephemeralKey &&
|
a.ephemeralKey == b.ephemeralKey &&
|
||||||
a.encCiphertext == b.encCiphertext &&
|
a.encCiphertext == b.encCiphertext &&
|
||||||
a.outCiphertext == b.outCiphertext &&
|
a.outCiphertext == b.outCiphertext &&
|
||||||
|
|
|
@ -138,7 +138,7 @@ UniValue TxShieldedOutputsToJSON(const CTransaction& tx) {
|
||||||
for (const OutputDescription& outputDesc : tx.vShieldedOutput) {
|
for (const OutputDescription& outputDesc : tx.vShieldedOutput) {
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.push_back(Pair("cv", outputDesc.cv.GetHex()));
|
obj.push_back(Pair("cv", outputDesc.cv.GetHex()));
|
||||||
obj.push_back(Pair("cmu", outputDesc.cm.GetHex()));
|
obj.push_back(Pair("cmu", outputDesc.cmu.GetHex()));
|
||||||
obj.push_back(Pair("ephemeralKey", outputDesc.ephemeralKey.GetHex()));
|
obj.push_back(Pair("ephemeralKey", outputDesc.ephemeralKey.GetHex()));
|
||||||
obj.push_back(Pair("encCiphertext", HexStr(outputDesc.encCiphertext.begin(), outputDesc.encCiphertext.end())));
|
obj.push_back(Pair("encCiphertext", HexStr(outputDesc.encCiphertext.begin(), outputDesc.encCiphertext.end())));
|
||||||
obj.push_back(Pair("outCiphertext", HexStr(outputDesc.outCiphertext.begin(), outputDesc.outCiphertext.end())));
|
obj.push_back(Pair("outCiphertext", HexStr(outputDesc.outCiphertext.begin(), outputDesc.outCiphertext.end())));
|
||||||
|
|
|
@ -159,7 +159,7 @@ void static RandomTransaction(CMutableTransaction &tx, bool fSingle, uint32_t co
|
||||||
for (int out = 0; out < shielded_outs; out++) {
|
for (int out = 0; out < shielded_outs; out++) {
|
||||||
OutputDescription odesc;
|
OutputDescription odesc;
|
||||||
odesc.cv = GetRandHash();
|
odesc.cv = GetRandHash();
|
||||||
odesc.cm = GetRandHash();
|
odesc.cmu = GetRandHash();
|
||||||
odesc.ephemeralKey = GetRandHash();
|
odesc.ephemeralKey = GetRandHash();
|
||||||
randombytes_buf(odesc.encCiphertext.begin(), odesc.encCiphertext.size());
|
randombytes_buf(odesc.encCiphertext.begin(), odesc.encCiphertext.size());
|
||||||
randombytes_buf(odesc.outCiphertext.begin(), odesc.outCiphertext.size());
|
randombytes_buf(odesc.outCiphertext.begin(), odesc.outCiphertext.size());
|
||||||
|
|
|
@ -265,7 +265,7 @@ TransactionBuilderResult TransactionBuilder::Build()
|
||||||
|
|
||||||
// Create Sapling SpendDescriptions
|
// Create Sapling SpendDescriptions
|
||||||
for (auto spend : spends) {
|
for (auto spend : spends) {
|
||||||
auto cm = spend.note.cm();
|
auto cm = spend.note.cmu();
|
||||||
auto nf = spend.note.nullifier(
|
auto nf = spend.note.nullifier(
|
||||||
spend.expsk.full_viewing_key(), spend.witness.position());
|
spend.expsk.full_viewing_key(), spend.witness.position());
|
||||||
if (!cm || !nf) {
|
if (!cm || !nf) {
|
||||||
|
@ -302,8 +302,8 @@ TransactionBuilderResult TransactionBuilder::Build()
|
||||||
|
|
||||||
// Create Sapling OutputDescriptions
|
// Create Sapling OutputDescriptions
|
||||||
for (auto output : outputs) {
|
for (auto output : outputs) {
|
||||||
auto cm = output.note.cm();
|
auto cmu = output.note.cmu();
|
||||||
if (!cm) {
|
if (!cmu) {
|
||||||
librustzcash_sapling_proving_ctx_free(ctx);
|
librustzcash_sapling_proving_ctx_free(ctx);
|
||||||
return TransactionBuilderResult("Output is invalid");
|
return TransactionBuilderResult("Output is invalid");
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ TransactionBuilderResult TransactionBuilder::Build()
|
||||||
return TransactionBuilderResult("Output proof failed");
|
return TransactionBuilderResult("Output proof failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
odesc.cm = *cm;
|
odesc.cmu = *cmu;
|
||||||
odesc.ephemeralKey = encryptor.get_epk();
|
odesc.ephemeralKey = encryptor.get_epk();
|
||||||
odesc.encCiphertext = enc.first;
|
odesc.encCiphertext = enc.first;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ TransactionBuilderResult TransactionBuilder::Build()
|
||||||
odesc.outCiphertext = outPlaintext.encrypt(
|
odesc.outCiphertext = outPlaintext.encrypt(
|
||||||
output.ovk,
|
output.ovk,
|
||||||
odesc.cv,
|
odesc.cv,
|
||||||
odesc.cm,
|
odesc.cmu,
|
||||||
encryptor);
|
encryptor);
|
||||||
mtx.vShieldedOutput.push_back(odesc);
|
mtx.vShieldedOutput.push_back(odesc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ CKey AddTestCKeyToKeyStore(CBasicKeyStore& keyStore) {
|
||||||
TestSaplingNote GetTestSaplingNote(const libzcash::SaplingPaymentAddress& pa, CAmount value) {
|
TestSaplingNote GetTestSaplingNote(const libzcash::SaplingPaymentAddress& pa, CAmount value) {
|
||||||
// Generate dummy Sapling note
|
// Generate dummy Sapling note
|
||||||
libzcash::SaplingNote note(pa, value);
|
libzcash::SaplingNote note(pa, value);
|
||||||
uint256 cm = note.cm().get();
|
uint256 cm = note.cmu().get();
|
||||||
SaplingMerkleTree tree;
|
SaplingMerkleTree tree;
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
return { note, tree };
|
return { note, tree };
|
||||||
|
|
|
@ -388,7 +388,7 @@ TEST(WalletTests, SetSaplingNoteAddrsInCWalletTx) {
|
||||||
auto pk = sk.DefaultAddress();
|
auto pk = sk.DefaultAddress();
|
||||||
|
|
||||||
libzcash::SaplingNote note(pk, 50000);
|
libzcash::SaplingNote note(pk, 50000);
|
||||||
auto cm = note.cm().get();
|
auto cm = note.cmu().get();
|
||||||
SaplingMerkleTree tree;
|
SaplingMerkleTree tree;
|
||||||
tree.append(cm);
|
tree.append(cm);
|
||||||
auto anchor = tree.root();
|
auto anchor = tree.root();
|
||||||
|
@ -657,7 +657,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) {
|
||||||
|
|
||||||
// Generate note A
|
// Generate note A
|
||||||
libzcash::SaplingNote note(pk, 50000);
|
libzcash::SaplingNote note(pk, 50000);
|
||||||
auto cm = note.cm().get();
|
auto cm = note.cmu().get();
|
||||||
SaplingMerkleTree saplingTree;
|
SaplingMerkleTree saplingTree;
|
||||||
saplingTree.append(cm);
|
saplingTree.append(cm);
|
||||||
auto anchor = saplingTree.root();
|
auto anchor = saplingTree.root();
|
||||||
|
@ -703,7 +703,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) {
|
||||||
wtx.vShieldedOutput[0].encCiphertext,
|
wtx.vShieldedOutput[0].encCiphertext,
|
||||||
ivk,
|
ivk,
|
||||||
wtx.vShieldedOutput[0].ephemeralKey,
|
wtx.vShieldedOutput[0].ephemeralKey,
|
||||||
wtx.vShieldedOutput[0].cm);
|
wtx.vShieldedOutput[0].cmu);
|
||||||
ASSERT_EQ(static_cast<bool>(maybe_pt), true);
|
ASSERT_EQ(static_cast<bool>(maybe_pt), true);
|
||||||
auto maybe_note = maybe_pt.get().note(ivk);
|
auto maybe_note = maybe_pt.get().note(ivk);
|
||||||
ASSERT_EQ(static_cast<bool>(maybe_note), true);
|
ASSERT_EQ(static_cast<bool>(maybe_note), true);
|
||||||
|
@ -1021,7 +1021,7 @@ TEST(WalletTests, SpentSaplingNoteIsFromMe) {
|
||||||
|
|
||||||
// Generate Sapling note A
|
// Generate Sapling note A
|
||||||
libzcash::SaplingNote note(pk, 50000);
|
libzcash::SaplingNote note(pk, 50000);
|
||||||
auto cm = note.cm().get();
|
auto cm = note.cmu().get();
|
||||||
SaplingMerkleTree saplingTree;
|
SaplingMerkleTree saplingTree;
|
||||||
saplingTree.append(cm);
|
saplingTree.append(cm);
|
||||||
auto anchor = saplingTree.root();
|
auto anchor = saplingTree.root();
|
||||||
|
@ -1080,7 +1080,7 @@ TEST(WalletTests, SpentSaplingNoteIsFromMe) {
|
||||||
wtx.vShieldedOutput[0].encCiphertext,
|
wtx.vShieldedOutput[0].encCiphertext,
|
||||||
ivk,
|
ivk,
|
||||||
wtx.vShieldedOutput[0].ephemeralKey,
|
wtx.vShieldedOutput[0].ephemeralKey,
|
||||||
wtx.vShieldedOutput[0].cm);
|
wtx.vShieldedOutput[0].cmu);
|
||||||
ASSERT_EQ(static_cast<bool>(maybe_pt), true);
|
ASSERT_EQ(static_cast<bool>(maybe_pt), true);
|
||||||
auto maybe_note = maybe_pt.get().note(ivk);
|
auto maybe_note = maybe_pt.get().note(ivk);
|
||||||
ASSERT_EQ(static_cast<bool>(maybe_note), true);
|
ASSERT_EQ(static_cast<bool>(maybe_note), true);
|
||||||
|
@ -2000,7 +2000,7 @@ TEST(WalletTests, MarkAffectedSaplingTransactionsDirty) {
|
||||||
|
|
||||||
// Prepare to spend the note that was just created
|
// Prepare to spend the note that was just created
|
||||||
auto maybe_pt = libzcash::SaplingNotePlaintext::decrypt(
|
auto maybe_pt = libzcash::SaplingNotePlaintext::decrypt(
|
||||||
tx1.vShieldedOutput[0].encCiphertext, ivk, tx1.vShieldedOutput[0].ephemeralKey, tx1.vShieldedOutput[0].cm);
|
tx1.vShieldedOutput[0].encCiphertext, ivk, tx1.vShieldedOutput[0].ephemeralKey, tx1.vShieldedOutput[0].cmu);
|
||||||
ASSERT_EQ(static_cast<bool>(maybe_pt), true);
|
ASSERT_EQ(static_cast<bool>(maybe_pt), true);
|
||||||
auto maybe_note = maybe_pt.get().note(ivk);
|
auto maybe_note = maybe_pt.get().note(ivk);
|
||||||
ASSERT_EQ(static_cast<bool>(maybe_note), true);
|
ASSERT_EQ(static_cast<bool>(maybe_note), true);
|
||||||
|
|
|
@ -1389,7 +1389,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_taddr_to_sapling)
|
||||||
tx.vShieldedOutput[0].outCiphertext,
|
tx.vShieldedOutput[0].outCiphertext,
|
||||||
uint256(),
|
uint256(),
|
||||||
tx.vShieldedOutput[0].cv,
|
tx.vShieldedOutput[0].cv,
|
||||||
tx.vShieldedOutput[0].cm,
|
tx.vShieldedOutput[0].cmu,
|
||||||
tx.vShieldedOutput[0].ephemeralKey));
|
tx.vShieldedOutput[0].ephemeralKey));
|
||||||
|
|
||||||
// We should be able to decrypt the outCiphertext with the ovk
|
// We should be able to decrypt the outCiphertext with the ovk
|
||||||
|
@ -1400,7 +1400,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_taddr_to_sapling)
|
||||||
tx.vShieldedOutput[0].outCiphertext,
|
tx.vShieldedOutput[0].outCiphertext,
|
||||||
ovkForShieldingFromTaddr(seed),
|
ovkForShieldingFromTaddr(seed),
|
||||||
tx.vShieldedOutput[0].cv,
|
tx.vShieldedOutput[0].cv,
|
||||||
tx.vShieldedOutput[0].cm,
|
tx.vShieldedOutput[0].cmu,
|
||||||
tx.vShieldedOutput[0].ephemeralKey));
|
tx.vShieldedOutput[0].ephemeralKey));
|
||||||
|
|
||||||
// Tear down
|
// Tear down
|
||||||
|
|
|
@ -1174,7 +1174,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex,
|
||||||
}
|
}
|
||||||
// Sapling
|
// Sapling
|
||||||
for (uint32_t i = 0; i < tx.vShieldedOutput.size(); i++) {
|
for (uint32_t i = 0; i < tx.vShieldedOutput.size(); i++) {
|
||||||
const uint256& note_commitment = tx.vShieldedOutput[i].cm;
|
const uint256& note_commitment = tx.vShieldedOutput[i].cmu;
|
||||||
saplingTree.append(note_commitment);
|
saplingTree.append(note_commitment);
|
||||||
|
|
||||||
// Increment existing witnesses
|
// Increment existing witnesses
|
||||||
|
@ -1476,7 +1476,7 @@ void CWallet::UpdateSaplingNullifierNoteMapWithTx(CWalletTx& wtx) {
|
||||||
uint64_t position = nd.witnesses.front().position();
|
uint64_t position = nd.witnesses.front().position();
|
||||||
auto extfvk = mapSaplingFullViewingKeys.at(nd.ivk);
|
auto extfvk = mapSaplingFullViewingKeys.at(nd.ivk);
|
||||||
OutputDescription output = wtx.vShieldedOutput[op.n];
|
OutputDescription output = wtx.vShieldedOutput[op.n];
|
||||||
auto optPlaintext = SaplingNotePlaintext::decrypt(output.encCiphertext, nd.ivk, output.ephemeralKey, output.cm);
|
auto optPlaintext = SaplingNotePlaintext::decrypt(output.encCiphertext, nd.ivk, output.ephemeralKey, output.cmu);
|
||||||
if (!optPlaintext) {
|
if (!optPlaintext) {
|
||||||
// An item in mapSaplingNoteData must have already been successfully decrypted,
|
// An item in mapSaplingNoteData must have already been successfully decrypted,
|
||||||
// otherwise the item would not exist in the first place.
|
// otherwise the item would not exist in the first place.
|
||||||
|
@ -1882,7 +1882,7 @@ std::pair<mapSaplingNoteData_t, SaplingIncomingViewingKeyMap> CWallet::FindMySap
|
||||||
const OutputDescription output = tx.vShieldedOutput[i];
|
const OutputDescription output = tx.vShieldedOutput[i];
|
||||||
for (auto it = mapSaplingFullViewingKeys.begin(); it != mapSaplingFullViewingKeys.end(); ++it) {
|
for (auto it = mapSaplingFullViewingKeys.begin(); it != mapSaplingFullViewingKeys.end(); ++it) {
|
||||||
SaplingIncomingViewingKey ivk = it->first;
|
SaplingIncomingViewingKey ivk = it->first;
|
||||||
auto result = SaplingNotePlaintext::decrypt(output.encCiphertext, ivk, output.ephemeralKey, output.cm);
|
auto result = SaplingNotePlaintext::decrypt(output.encCiphertext, ivk, output.ephemeralKey, output.cmu);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2295,7 +2295,7 @@ boost::optional<std::pair<
|
||||||
output.encCiphertext,
|
output.encCiphertext,
|
||||||
nd.ivk,
|
nd.ivk,
|
||||||
output.ephemeralKey,
|
output.ephemeralKey,
|
||||||
output.cm);
|
output.cmu);
|
||||||
assert(static_cast<bool>(maybe_pt));
|
assert(static_cast<bool>(maybe_pt));
|
||||||
auto notePt = maybe_pt.get();
|
auto notePt = maybe_pt.get();
|
||||||
|
|
||||||
|
@ -2318,7 +2318,7 @@ boost::optional<std::pair<
|
||||||
output.outCiphertext,
|
output.outCiphertext,
|
||||||
ovk,
|
ovk,
|
||||||
output.cv,
|
output.cv,
|
||||||
output.cm,
|
output.cmu,
|
||||||
output.ephemeralKey);
|
output.ephemeralKey);
|
||||||
if (!outPt) {
|
if (!outPt) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -2329,7 +2329,7 @@ boost::optional<std::pair<
|
||||||
output.ephemeralKey,
|
output.ephemeralKey,
|
||||||
outPt->esk,
|
outPt->esk,
|
||||||
outPt->pk_d,
|
outPt->pk_d,
|
||||||
output.cm);
|
output.cmu);
|
||||||
assert(static_cast<bool>(maybe_pt));
|
assert(static_cast<bool>(maybe_pt));
|
||||||
auto notePt = maybe_pt.get();
|
auto notePt = maybe_pt.get();
|
||||||
|
|
||||||
|
@ -4956,7 +4956,7 @@ void CWallet::GetFilteredNotes(
|
||||||
wtx.vShieldedOutput[op.n].encCiphertext,
|
wtx.vShieldedOutput[op.n].encCiphertext,
|
||||||
nd.ivk,
|
nd.ivk,
|
||||||
wtx.vShieldedOutput[op.n].ephemeralKey,
|
wtx.vShieldedOutput[op.n].ephemeralKey,
|
||||||
wtx.vShieldedOutput[op.n].cm);
|
wtx.vShieldedOutput[op.n].cmu);
|
||||||
assert(static_cast<bool>(maybe_pt));
|
assert(static_cast<bool>(maybe_pt));
|
||||||
auto notePt = maybe_pt.get();
|
auto notePt = maybe_pt.get();
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ SaplingNote::SaplingNote(const SaplingPaymentAddress& address, const uint64_t va
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call librustzcash to compute the commitment
|
// Call librustzcash to compute the commitment
|
||||||
boost::optional<uint256> SaplingNote::cm() const {
|
boost::optional<uint256> SaplingNote::cmu() const {
|
||||||
uint256 result;
|
uint256 result;
|
||||||
if (!librustzcash_sapling_compute_cm(
|
if (!librustzcash_sapling_compute_cm(
|
||||||
d.data(),
|
d.data(),
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
|
|
||||||
virtual ~SaplingNote() {};
|
virtual ~SaplingNote() {};
|
||||||
|
|
||||||
boost::optional<uint256> cm() const;
|
boost::optional<uint256> cmu() const;
|
||||||
boost::optional<uint256> nullifier(const SaplingFullViewingKey &vk, const uint64_t position) const;
|
boost::optional<uint256> nullifier(const SaplingFullViewingKey &vk, const uint64_t position) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -596,12 +596,12 @@ double benchmark_create_sapling_spend()
|
||||||
auto address = sk.default_address();
|
auto address = sk.default_address();
|
||||||
SaplingNote note(address, GetRand(MAX_MONEY));
|
SaplingNote note(address, GetRand(MAX_MONEY));
|
||||||
SaplingMerkleTree tree;
|
SaplingMerkleTree tree;
|
||||||
auto maybe_cm = note.cm();
|
auto maybe_cmu = note.cmu();
|
||||||
tree.append(maybe_cm.get());
|
tree.append(maybe_cmu.get());
|
||||||
auto anchor = tree.root();
|
auto anchor = tree.root();
|
||||||
auto witness = tree.witness();
|
auto witness = tree.witness();
|
||||||
auto maybe_nf = note.nullifier(expsk.full_viewing_key(), witness.position());
|
auto maybe_nf = note.nullifier(expsk.full_viewing_key(), witness.position());
|
||||||
if (!(maybe_cm && maybe_nf)) {
|
if (!(maybe_cmu && maybe_nf)) {
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not create note commitment and nullifier");
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Could not create note commitment and nullifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ double benchmark_verify_sapling_output()
|
||||||
bool result = librustzcash_sapling_check_output(
|
bool result = librustzcash_sapling_check_output(
|
||||||
ctx,
|
ctx,
|
||||||
output.cv.begin(),
|
output.cv.begin(),
|
||||||
output.cm.begin(),
|
output.cmu.begin(),
|
||||||
output.ephemeralKey.begin(),
|
output.ephemeralKey.begin(),
|
||||||
output.zkproof.begin()
|
output.zkproof.begin()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue