Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

I strongly recommend to merge this into 0.13 (current master or in 0.13 once we have split off).

Without this PRs CKeyMetadata extension, we will very likely run into problem to later identify which key are HD.
Wallets in Core can always have non-hd keys along with hd-keys (through importwallet, importprivkey).

for _ in range(num_hd_adds):
hd_add = self.nodes[1].getnewaddress()
hd_info = self.nodes[1].validateaddress(hd_add)
assert_equal(hd_info["hdkeypath"], "m/0'/0'/"+str(_+1)+"'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: underscore is usually used for unused loop variables. Mind to change it to a single char?

@maflcko
Copy link
Member

maflcko commented Jul 11, 2016

utACK f708085

// example: 1 | BIP32_HARDENED_KEY_LIMIT == 0x80000001 == 2147483649
externalChainChildKey.Derive(childKey, hdChain.nExternalChainCounter | BIP32_HARDENED_KEY_LIMIT);
metadata.hdKeypath = "m/0'/0'/"+std::to_string(hdChain.nExternalChainCounter)+"'";
metadata.hdMasterKeyID = hdChain.masterKeyID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could imagine this will bloat wallet.dat a bit?

Copy link
Member

@maflcko maflcko Jul 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5% to 10% increase in wallet.dat size, it seems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess its around ~30bytes per pubkey. I think this is acceptable.

@laanwj
Copy link
Member

laanwj commented Jul 11, 2016

Concept ACK

" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
" \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in " + CURRENCY_UNIT + "/kB\n"
" \"masterkeyid\": \"<hash160>\", (string) the Hash160 of the hd master pubkey\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hd -> HD

@paveljanik
Copy link
Contributor

Please use HD and BIPxx always in uppercase.

{
nVersion = CKeyMetadata::CURRENT_VERSION;
nCreateTime = 0;
hdKeypath.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason hdMasterKeyID isn't set null here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks.
Added a commit to address this: 68d7682

@luke-jr
Copy link
Member

luke-jr commented Jul 15, 2016

Am I correct that this does not conflict with #8132?

@jonasschnelli
Copy link
Contributor Author

@luke-jr: I think this is incompatible with Knots implementation of "the key generation type" (similar to #8132). But, using Version 10 for the CKeyMetadata allows Knots to detect the HDness and migrate the data.
I guess Core 0.13 wallets are incompatible with Knows 0.12. But Know 0.13 can be compatible with Core 0.13.

@jonasschnelli
Copy link
Contributor Author

Added two commits to address the nits.

@laanwj
Copy link
Member

laanwj commented Jul 18, 2016

Looks good to me,
utACK 7945088

@laanwj laanwj merged commit 7945088 into bitcoin:master Jul 18, 2016
laanwj added a commit that referenced this pull request Jul 18, 2016
…ateaddress

7945088 [Wallet] comsetic non-code changes for the HD feature (Jonas Schnelli)
68d7682 [Wallet] ensure CKeyMetadata.hdMasterKeyID will be cleared during SetNull() (Jonas Schnelli)
f708085 [QA] extend wallet-hd test to cover HD metadata (Jonas Schnelli)
986c223 [Wallet] print hd masterkeyid in getwalletinfo (Jonas Schnelli)
b1c7b24 [Wallet] report optional HDKeypath/HDMasterKeyId in validateaddress (Jonas Schnelli)
5b95dd2 [Wallet] extend CKeyMetadata with HD keypath (Jonas Schnelli)
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 2, 2018
zkbot added a commit to zcash/zcash that referenced this pull request Sep 19, 2018
Add Sapling support to z_importwallet and z_exportwallet

Includes code adapted from upstream PR bitcoin/bitcoin#8323

Closes #3218.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants