From 007de07745ddb20338ee35325a8b6a17c4d589a0 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 8 Oct 2020 14:17:57 +0100 Subject: [PATCH] Add logging when we receive an invalid note plaintext (using the "receiveunsafe" log category). Signed-off-by: Daira Hopwood --- src/init.cpp | 2 +- src/zcash/Note.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 0b44993ad..870e25ab6 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -423,7 +423,7 @@ std::string HelpMessage(HelpMessageMode mode) "Use given addresses for block subsidy share paid to the funding stream with id (regtest-only)"); } string debugCategories = "addrman, alert, bench, coindb, db, estimatefee, http, libevent, lock, mempool, net, partitioncheck, pow, proxy, prune, " - "rand, reindex, rpc, selectcoins, tor, zmq, zrpc, zrpcunsafe (implies zrpc)"; // Don't translate these + "rand, receiveunsafe, reindex, rpc, selectcoins, tor, zmq, zrpc, zrpcunsafe (implies zrpc)"; // Don't translate these strUsage += HelpMessageOpt("-debug=", strprintf(_("Output debugging information (default: %u, supplying is optional)"), 0) + ". " + _("If is not supplied or if = 1, output all debugging information.") + " " + _(" can be:") + " " + debugCategories + ". " + _("For multiple specific categories use -debug= multiple times.")); diff --git a/src/zcash/Note.cpp b/src/zcash/Note.cpp index c21523382..b4cdc64f0 100644 --- a/src/zcash/Note.cpp +++ b/src/zcash/Note.cpp @@ -229,6 +229,8 @@ boost::optional SaplingNotePlaintext::decrypt( // Check leadbyte is allowed at block height if (!plaintext_version_is_valid(params, height, plaintext.get_leadbyte())) { + LogPrint("receiveunsafe", "Received note plaintext with invalid lead byte %d at height %d", + plaintext.get_leadbyte(), height); return boost::none; } @@ -328,6 +330,8 @@ boost::optional SaplingNotePlaintext::decrypt( // Check leadbyte is allowed at block height if (!plaintext_version_is_valid(params, height, plaintext.get_leadbyte())) { + LogPrint("receiveunsafe", "Received note plaintext with invalid lead byte %d at height %d", + plaintext.get_leadbyte(), height); return boost::none; }