Merge pull request #2490 from micaelmalta/1.14.5-dev-key-derivation-path
Change key derivation path to be correct for Dogecoin
This commit is contained in:
commit
523d346857
|
@ -38,7 +38,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||||
non_hd_add = self.nodes[0].getnewaddress()
|
non_hd_add = self.nodes[0].getnewaddress()
|
||||||
self.nodes[1].importprivkey(self.nodes[0].dumpprivkey(non_hd_add))
|
self.nodes[1].importprivkey(self.nodes[0].dumpprivkey(non_hd_add))
|
||||||
|
|
||||||
# This should be enough to keep the master key and the non-HD key
|
# This should be enough to keep the master key and the non-HD key
|
||||||
self.nodes[1].backupwallet(tmpdir + "/hd.bak")
|
self.nodes[1].backupwallet(tmpdir + "/hd.bak")
|
||||||
#self.nodes[1].dumpwallet(tmpdir + "/hd.dump")
|
#self.nodes[1].dumpwallet(tmpdir + "/hd.dump")
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||||
for i in range(num_hd_adds):
|
for i in range(num_hd_adds):
|
||||||
hd_add = self.nodes[1].getnewaddress()
|
hd_add = self.nodes[1].getnewaddress()
|
||||||
hd_info = self.nodes[1].validateaddress(hd_add)
|
hd_info = self.nodes[1].validateaddress(hd_add)
|
||||||
assert_equal(hd_info["hdkeypath"], "m/0'/0'/"+str(i+1)+"'")
|
assert_equal(hd_info["hdkeypath"], "m/0'/3'/"+str(i+1)+"'")
|
||||||
assert_equal(hd_info["hdmasterkeyid"], masterkeyid)
|
assert_equal(hd_info["hdmasterkeyid"], masterkeyid)
|
||||||
self.nodes[0].sendtoaddress(hd_add, 1)
|
self.nodes[0].sendtoaddress(hd_add, 1)
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
|
@ -72,7 +72,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||||
for _ in range(num_hd_adds):
|
for _ in range(num_hd_adds):
|
||||||
hd_add_2 = self.nodes[1].getnewaddress()
|
hd_add_2 = self.nodes[1].getnewaddress()
|
||||||
hd_info_2 = self.nodes[1].validateaddress(hd_add_2)
|
hd_info_2 = self.nodes[1].validateaddress(hd_add_2)
|
||||||
assert_equal(hd_info_2["hdkeypath"], "m/0'/0'/"+str(_+1)+"'")
|
assert_equal(hd_info_2["hdkeypath"], "m/0'/3'/"+str(_+1)+"'")
|
||||||
assert_equal(hd_info_2["hdmasterkeyid"], masterkeyid)
|
assert_equal(hd_info_2["hdmasterkeyid"], masterkeyid)
|
||||||
assert_equal(hd_add, hd_add_2)
|
assert_equal(hd_add, hd_add_2)
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ void CWallet::DeriveNewChildKey(CKeyMetadata& metadata, CKey& secret)
|
||||||
// childIndex | BIP32_HARDENED_KEY_LIMIT = derive childIndex in hardened child-index-range
|
// childIndex | BIP32_HARDENED_KEY_LIMIT = derive childIndex in hardened child-index-range
|
||||||
// example: 1 | BIP32_HARDENED_KEY_LIMIT == 0x80000001 == 2147483649
|
// example: 1 | BIP32_HARDENED_KEY_LIMIT == 0x80000001 == 2147483649
|
||||||
externalChainChildKey.Derive(childKey, hdChain.nExternalChainCounter | BIP32_HARDENED_KEY_LIMIT);
|
externalChainChildKey.Derive(childKey, hdChain.nExternalChainCounter | BIP32_HARDENED_KEY_LIMIT);
|
||||||
metadata.hdKeypath = "m/0'/0'/" + std::to_string(hdChain.nExternalChainCounter) + "'";
|
metadata.hdKeypath = "m/0'/3'/" + std::to_string(hdChain.nExternalChainCounter) + "'";
|
||||||
metadata.hdMasterKeyID = hdChain.masterKeyID;
|
metadata.hdMasterKeyID = hdChain.masterKeyID;
|
||||||
// increment childkey index
|
// increment childkey index
|
||||||
hdChain.nExternalChainCounter++;
|
hdChain.nExternalChainCounter++;
|
||||||
|
|
Loading…
Reference in a new issue