HomePhabricator

Refactor keytime/metadata and wallet encryption bugfix
4addb2c066e1Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Refactor keytime/metadata and wallet encryption bugfix

Refactor keytime:

  • Key metadata is kept in a CWallet::mapKeyMetadata (std::map<CKeyId,CKeyMetadata>).
  • When generating a new key, time is put in that map, and new key is written.
  • AddKeyPubKey and AddCryptedKey do not take a creation time argument, but instead pull it from that map, if it exists there.

Bugfix:

  • AddKeyPubKey and AddCryptedKey in CWallet didn't override the CKeyStore definition anymore. This is fixed, as they no longed need the nCreationTime argument now.

Also a few related other changes:

  • Metadata can be overwritten.
  • Only GenerateNewKey calls GetTime(), as it's the only place where we know for sure a key was not constructed earlier.
  • When the nTimeFirstKey is known to be inaccurate, it is set to the value 1 (instead of 0, which would mean unknown).
  • Use CPubKey instead of std::vector<unsigned char> where possible.

Details

Provenance
Pieter Wuille <pieter.wuille@gmail.com>Authored on Jun 19 2013, 23:13
deadalnixPushed on May 14 2017, 22:04
Parents
rABC25dbb928600b: Merge pull request #2760 from cozz/cozz2
Branches
Unknown
Tags
Unknown

Event Timeline

Pieter Wuille <pieter.wuille@gmail.com> committed rABC4addb2c066e1: Refactor keytime/metadata and wallet encryption bugfix (authored by Pieter Wuille <pieter.wuille@gmail.com>).Jun 19 2013, 23:31