diff options
author | patrick s <patrick.strateman@gmail.com> | 2013-08-28 23:53:26 -0700 |
---|---|---|
committer | patrick s <patrick.strateman@gmail.com> | 2013-08-28 23:53:26 -0700 |
commit | 6e51b3bddf782f53527cf968445b298ebdec9bbc (patch) | |
tree | d7cd486a75648cbcc5e5aec9da4bbf4e21292bb6 /src/walletdb.h | |
parent | ff33a3470dd1d1446549d02609c991c0490e0fdf (diff) |
improve wallet load time by removing duplicated calls to EC_KEY_check_key and adding a hash for vchPubKey/vchPrivKey entries in wallet.dat
backwards compatible with previous wallet.dat format
Diffstat (limited to 'src/walletdb.h')
-rw-r--r-- | src/walletdb.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/walletdb.h b/src/walletdb.h index 09ebebe5ac..2d01a5cf74 100644 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -93,8 +93,14 @@ public: if (!Write(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) return false; - - return Write(std::make_pair(std::string("key"), vchPubKey), vchPrivKey, false); + + // hash pubkey/privkey to accelerate wallet load + std::vector<unsigned char> vchKey; + vchKey.reserve(vchPubKey.size() + vchPrivKey.size()); + vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); + vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end()); + + return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); } bool WriteCryptedKey(const CPubKey& vchPubKey, |