Use hardened derivation for the legacy Sapling key at the address index level.
This commit is contained in:
parent
8bf4ec3b4a
commit
477a166565
|
@ -846,8 +846,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'/2147483647'/0");
|
||||
saplingSpendAuth1 |= (keypath == "m/32'/133'/2147483647'/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);
|
||||
}
|
||||
|
|
|
@ -285,8 +285,8 @@ std::pair<SaplingExtendedSpendingKey, CKeyMetadata> SaplingExtendedSpendingKey::
|
|||
// Derive account key at the legacy account index
|
||||
auto m_32h_cth_l = m_32h_cth.Derive(ZCASH_LEGACY_ACCOUNT | ZIP32_HARDENED_KEY_LIMIT);
|
||||
|
||||
// Derive key at the specified address index (non-hardened)
|
||||
auto xsk = m_32h_cth_l.Derive(addressIndex);
|
||||
// Derive key at the specified address index
|
||||
auto xsk = m_32h_cth_l.Derive(addressIndex | ZIP32_HARDENED_KEY_LIMIT);
|
||||
|
||||
// Create new metadata
|
||||
int64_t nCreationTime = GetTime();
|
||||
|
@ -294,7 +294,7 @@ std::pair<SaplingExtendedSpendingKey, CKeyMetadata> SaplingExtendedSpendingKey::
|
|||
metadata.hdKeypath = "m/32'/"
|
||||
+ std::to_string(bip44CoinType) + "'/"
|
||||
+ std::to_string(ZCASH_LEGACY_ACCOUNT) + "'/"
|
||||
+ std::to_string(addressIndex);
|
||||
+ std::to_string(addressIndex) + "'";
|
||||
metadata.seedFp = seed.Fingerprint();
|
||||
|
||||
return std::make_pair(xsk, metadata);
|
||||
|
|
Loading…
Reference in New Issue