Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wallet] Ensure <0.13 clients can't open HD wallets #8343

Closed

Conversation

jonasschnelli
Copy link
Contributor

In current master, you could run a 0.13 HD wallet in a non HD compatible 0.12 client, resulting in a mix of HD and non HD key. You could even refill the wallets keypool running a 0.12 client and use it on 0.13 which would lead to a getnewaddress call in 0.13 responding a non HD address.

This PR ensures that HD wallets will at least require version 0.12.99.

This only affects newly created wallets and only if the user had not passed -usehd=0 (old <0.13 created wallets will still run on <0.13 clients once they where opened in 0.13).

@jonasschnelli jonasschnelli added this to the 0.13.0 milestone Jul 15, 2016
@maflcko
Copy link
Member

maflcko commented Jul 15, 2016

Concept ACK

@maflcko
Copy link
Member

maflcko commented Jul 16, 2016

quickly tested ACK 51a4ee8

@@ -78,7 +78,8 @@ enum WalletFeature
FEATURE_WALLETCRYPT = 40000, // wallet encryption
FEATURE_COMPRPUBKEY = 60000, // compressed public keys

FEATURE_LATEST = 60000
FEATURE_HD = 129900, // Hierarchical key derivation after BIP32 (HD Wallet)
Copy link
Member

Choose a reason for hiding this comment

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

Strictly speaking not all 12.99's support HD, so we may want to adjust to 130000 after the branch off.

Copy link
Member

@laanwj laanwj Jul 18, 2016

Choose a reason for hiding this comment

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

This isn't derived from the actual version, is it? It's just a marker constant, the exact value doesn't matter as long as it is higher than all other FEATURE_*. So if you want it 130000, just make it 130000 already.
Bah, it is checked against the CLIENT_VERSION, I was wrong.
Ok, let's do this after the release branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We can try to merge this once we split of the masterbranch and had increase the version.

Copy link
Member

Choose a reason for hiding this comment

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

Yes using the client version here is not very nice, if we had a dedicated wallet version constant this problem could have been avoided, as it could have been bumped at the moment HD support was introduced instead of arbitrary delineation based on release-process constraints.

But for now that's the best solution.

Copy link
Member

Choose a reason for hiding this comment

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

@jonasschnelli Could you already bump this so we don't lose time later? (In case you are not around when the branch off happens)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarcoFalke
If I bump this to 130000 now, HD would no longer work on current master IMO.

For <0.13 incompatibility, we need to stick to the current check based on CLIENT_VERSION.
https://github.com/bitcoin/bitcoin/blob/master/src/wallet/walletdb.cpp#L637

Once we change the wallet database format, we could introduce a set of strings about the features the wallet database requires/supports.

Copy link
Member

@maflcko maflcko Jul 18, 2016

Choose a reason for hiding this comment

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

If I bump this to 130000 now, HD would no longer work on current master IMO.

True, but I think the plan was to merge this after the bump to 13.99 into master?

No strong opinion, though.

Copy link
Member

Choose a reason for hiding this comment

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

Version have been bumped, you can update this now

@laanwj laanwj modified the milestone: 0.13.0 Jul 18, 2016
Fill in the header, and move items to the appropriate part of the
release notes structure.
@jtimon
Copy link
Contributor

jtimon commented Jul 18, 2016

ut ACK 51a4ee8

@@ -197,6 +197,8 @@ You can't disable HD key generation once you have created a HD wallet.

There is no distinction between internal (change) and external keys.

HD wallets are incompatible with older versions of Bitcoin Core.
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to open a separate pull against .13 now that the release notes were moved.

@jonasschnelli
Copy link
Contributor Author

Sorry. Have to close and reopen (new PR) this because use this local branch for #8366.

@jtimon
Copy link
Contributor

jtimon commented Jul 20, 2016

Was a replacement PR opened?

@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.

None yet

4 participants