Use 0x7FFFFFFF for the legacy account ID.

This commit is contained in:
Kris Nuttycombe 2021-10-25 10:55:23 -06:00
parent d6984dbf78
commit 5760a639d2
4 changed files with 7 additions and 7 deletions

View File

@ -192,7 +192,7 @@ CAmount AsyncRPCOperation_saplingmigration::chooseAmount(const CAmount& availabl
}
// Unless otherwise specified, the migration destination address is the address
// the legacy Sapling account (0x7FFFFFFE) at the smallest diversifier index
// the legacy Sapling account (0x7FFFFFFF) at the smallest diversifier index
// that produces a valid diversified address.
libzcash::SaplingPaymentAddress AsyncRPCOperation_saplingmigration::getMigrationDestAddress(const HDSeed& seed) {
KeyIO keyIO(Params());

View File

@ -847,8 +847,8 @@ BOOST_AUTO_TEST_CASE(rpc_wallet_z_getnewaddress) {
for (auto saplingObj : sapling_addr_sets.getValues()) {
auto keypath = find_value(saplingObj, "zip32KeyPath").get_str();
saplingSpendAuth0 |= (keypath == "m/32'/133'/2147483646'/0");
saplingSpendAuth1 |= (keypath == "m/32'/133'/2147483646'/1");
saplingSpendAuth0 |= (keypath == "m/32'/133'/2147483647'/0");
saplingSpendAuth1 |= (keypath == "m/32'/133'/2147483647'/1");
auto saplingAddrs = find_value(saplingObj, "addresses").get_array();
saplingCountMismatch &= (saplingAddrs.size() != 1);
}

View File

@ -33,9 +33,9 @@ MnemonicSeed MnemonicSeed::Random(uint32_t bip44CoinType, Language language, siz
MnemonicSeed seed(language, mnemonic);
// Verify that the seed data is valid entropy for unified spending keys at
// account 0 and at both the public & private chain levels for account 0x7FFFFFFE.
// account 0 and at both the public & private chain levels for account 0x7FFFFFFF.
// It is not necessary to check for a valid diversified Sapling address at
// account 0x7FFFFFFE because derivation via the legacy path can simply search
// account 0x7FFFFFFF because derivation via the legacy path can simply search
// for a valid diversifier; unlike in the unified spending key case, diversifier
// indices don't need to line up with anything.
if (libzcash::UnifiedSpendingKey::ForAccount(seed, bip44CoinType, 0).has_value() &&

View File

@ -26,7 +26,7 @@ const size_t ZIP32_XSK_SIZE = 169;
* transparent and Sapling addresses via the legacy
* `getnewaddress` and `z_getnewaddress` code paths,
*/
const uint32_t ZCASH_LEGACY_ACCOUNT = 0x7FFFFFFE;
const uint32_t ZCASH_LEGACY_ACCOUNT = 0x7FFFFFFF;
class CWalletDB;
@ -78,7 +78,7 @@ public:
/**
* Randomly generate a new mnemonic seed. A SLIP-44 coin type is required to make it possible
* to check that the generated seed can produce valid transparent and unified addresses at account
* numbers 0x7FFFFFFE and 0x0 respectively.
* numbers 0x7FFFFFFF and 0x0 respectively.
*/
static MnemonicSeed Random(uint32_t bip44CoinType, Language language = English, size_t entropyLen = 32);