Apply suggestions from code review

Co-authored-by: Jack Grigg <jack@electriccoin.co>
This commit is contained in:
Kris Nuttycombe 2022-04-08 07:52:05 -06:00 committed by Jack Grigg
parent 0da6bcef72
commit 1fb153a333
2 changed files with 2 additions and 2 deletions

View File

@ -525,7 +525,7 @@ std::pair<UnifiedFullViewingKey, libzcash::AccountId> CWallet::GenerateNewUnifie
auto account = hdChain.IncrementAccountCounter();
if (!account.has_value()) {
throw std::runtime_error(
"CWallet::GenerateNewUnifiedSpendingKey(): Account counter overflowed (2^31 - 1).");
"CWallet::GenerateNewUnifiedSpendingKey(): Already generated the maxiumum number of accounts (2^31 - 2) for this wallet's mnemonic phrase. Congratulations, you need to create a new wallet!");
}
if (generated.has_value()) {

View File

@ -108,7 +108,7 @@ public:
* if the increment operation would cause an overflow. */
std::optional<uint32_t> IncrementAccountCounter() {
auto newAccountCounter = accountCounter + 1;
if (newAccountCounter > (HARDENED_KEY_LIMIT - 1)) {
if (newAccountCounter >= libzcash::ZCASH_LEGACY_ACCOUNT) {
return std::nullopt;
} else {
accountCounter = newAccountCounter;