Improvements to code comments

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
str4d 2023-03-15 23:52:09 +00:00 committed by GitHub
parent d154cd760c
commit 207c88474f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View File

@ -4361,12 +4361,12 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp)
auto op = res->second;
auto wtxPrev = pwalletMain->mapWallet.at(op.hash);
// We don't need to constrain the plaintext leadbyte to
// satisfy the ZIP 212 grace window: if wtx exists in
// We don't need to constrain the note plaintext lead byte
// to satisfy the ZIP 212 grace window: if wtx exists in
// the wallet, it must have been successfully decrypted. This
// means the plaintext leadbyte was valid at the block height
// where the note was received.
// https://zips.z.cash/zip-0212#changes-to-the-process-of-receiving-sapling-notes
// means the note plaintext lead byte was valid at the block
// height where the note was received.
// https://zips.z.cash/zip-0212#changes-to-the-process-of-receiving-sapling-or-orchard-notes
auto decrypted = wtxPrev.DecryptSaplingNote(Params(), op).value();
auto notePt = decrypted.first;
auto pa = decrypted.second;
@ -4408,12 +4408,12 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp)
SaplingPaymentAddress pa;
bool isOutgoing;
// We don't need to constrain the plaintext leadbyte to
// satisfy the ZIP 212 grace window: if wtx exists in
// We don't need to constrain the note plaintext lead byte
// to satisfy the ZIP 212 grace window: if wtx exists in
// the wallet, it must have been successfully decrypted. This
// means the plaintext leadbyte was valid at the block height
// where the note was received.
// https://zips.z.cash/zip-0212#changes-to-the-process-of-receiving-sapling-notes
// means the note plaintext lead byte was valid at the block
// height where the note was received.
// https://zips.z.cash/zip-0212#changes-to-the-process-of-receiving-sapling-or-orchard-notes
auto decrypted = wtx.DecryptSaplingNote(Params(), op);
if (decrypted) {
notePt = decrypted->first;

View File

@ -4317,7 +4317,8 @@ std::optional<std::pair<
try {
auto decrypted = wallet::try_sapling_note_decryption(
*params.RustNetwork(),
// Canopy activation is inside the ZIP 212 grace period.
// Canopy activation is inside the ZIP 212 grace period,
// and so this allows both v1 and v2 note plaintexts.
params.GetConsensus().vUpgrades[Consensus::UPGRADE_CANOPY].nActivationHeight,
nd.ivk.GetRawBytes(),
{
@ -4344,7 +4345,8 @@ std::optional<std::pair<
try {
auto decrypted = wallet::try_sapling_output_recovery(
*params.RustNetwork(),
// Canopy activation is inside the ZIP 212 grace period.
// Canopy activation is inside the ZIP 212 grace period,
// and so this allows both v1 and v2 note plaintexts.
params.GetConsensus().vUpgrades[Consensus::UPGRADE_CANOPY].nActivationHeight,
ovk.GetRawBytes(),
{

View File

@ -682,7 +682,7 @@ public:
*
* Decryption is always performed as if the ZIP 212 grace window is active
* (accepting both v1 and v2 note plaintexts), because the v2 plaintext
* format protects against an attack against the recipient, not the sender.
* format protects against an attack on the recipient, not the sender.
*/
std::optional<std::pair<
libzcash::SaplingNotePlaintext,