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

Use internal HD chain for change outputs (hd split) #9294

Merged
merged 23 commits into from Mar 29, 2017
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
02592f4
[Wallet] split the keypool in an internal and external part
jonasschnelli Jan 10, 2017
d59531d
Immediately return setKeyPool's size if HD or HD_SPLIT is disabled or…
jonasschnelli Jan 16, 2017
01de822
Removed redundant IsLocked() check in NewKeyPool()
jonasschnelli Jan 16, 2017
05a9b49
Fix wrong keypool internal size in RPC getwalletinfo help
jonasschnelli Jan 16, 2017
469a47b
Make sure ReserveKeyFromKeyPool only hands out internal keys if HD_SP…
jonasschnelli Jan 16, 2017
9af8f00
Make sure we hand out keypool keys if HD_SPLIT is not enabled
jonasschnelli Jan 16, 2017
d0a627a
Fix issue where CDataStream->nVersion was taken a CKeyPool record ver…
jonasschnelli Jan 16, 2017
bcafca1
Make sure we always generate one keypool key at minimum
jonasschnelli Jan 16, 2017
79df9df
Switch to 100% for the HD internal keypool size
jonasschnelli Jan 17, 2017
dd526c2
Don't switch to HD-chain-split during wallet encryption of non HD-cha…
jonasschnelli Jan 17, 2017
add38d9
GetOldestKeyPoolTime: if HD & HD Chain Split is enabled, response max…
jonasschnelli Jan 17, 2017
e138876
Only show keypoolsize_hd_internal if HD split is enabled
jonasschnelli Jan 17, 2017
58e1483
CKeyPool avoid "catch (...)" in SerializationOp
jonasschnelli Jan 17, 2017
1090502
Fix superfluous cast and code style nits in RPC wallet-hd.py test
jonasschnelli Jan 26, 2017
d9638e5
Overhaul the internal/external key derive switch
jonasschnelli Jan 26, 2017
003e197
Remove FEATURE_HD_SPLIT bump TODO
jonasschnelli Jan 26, 2017
1b3b5c6
Slightly modify fundrawtransaction.py test (change getnewaddress() in…
jonasschnelli Feb 1, 2017
771a304
Make sure we set the wallets min version to FEATURE_HD_SPLIT at the v…
jonasschnelli Mar 24, 2017
ed79e4f
Optimize GetOldestKeyPoolTime(), return as soon as we have both oldes…
jonasschnelli Mar 24, 2017
cd468d0
Define CWallet::DeriveNewChildKey() as private
jonasschnelli Mar 24, 2017
1df08d1
Add assertion for CanSupportFeature(FEATURE_HD_SPLIT)
jonasschnelli Mar 24, 2017
9382f04
Do not break backward compatibility during wallet encryption
jonasschnelli Mar 27, 2017
4115af7
Fix rebase issue where pwalletMain was used instead of pwallet
jonasschnelli Mar 28, 2017
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+9 −3
Diff settings

Always

Just for now

Optimize GetOldestKeyPoolTime(), return as soon as we have both oldes…

…t keys
  • Loading branch information...
jonasschnelli committed Mar 24, 2017
commit ed79e4f497a9a7747b006a5cb04d4173a6bbc1c5
Copy path View file
@@ -3069,12 +3069,18 @@ int64_t CWallet::GetOldestKeyPoolTime()

for(const int64_t& id : setKeyPool)
{
if (!walletdb.ReadPool(id, keypool))
if (!walletdb.ReadPool(id, keypool)) {
throw std::runtime_error(std::string(__func__) + ": read failed");

This comment has been minimized.

Copy link
@TheBlueMatt

TheBlueMatt Mar 27, 2017

Contributor

nit: the old version does an assert(keypool.vchPubKey.IsValid()); which is nice to have...not necessary to add, but would be cool.

This comment has been minimized.

Copy link
@jonasschnelli
if (keypool.fInternal && keypool.nTime < oldest_internal)
}
if (keypool.fInternal && keypool.nTime < oldest_internal) {
oldest_internal = keypool.nTime;
else if (!keypool.fInternal && keypool.nTime < oldest_external)
}
else if (!keypool.fInternal && keypool.nTime < oldest_external) {
oldest_external = keypool.nTime;

This comment has been minimized.

Copy link
@TheBlueMatt

TheBlueMatt Mar 20, 2017

Contributor

Maybe add an additional if (oldest_internal != now && oldest_external != now) break; ?

This comment has been minimized.

Copy link
@jonasschnelli

jonasschnelli Mar 24, 2017

Author Member

Ah. Right. It's guaranteed that the setKeyPool iterates always from the oldest to the newest.
Will add.

}
if (oldest_internal != now && oldest_external != now) {
break;
}
}
return std::max(oldest_internal, oldest_external);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.