mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
Refactor keymetadata writing to a separate method
This commit is contained in:
parent
9b1df4ba0b
commit
c45415f73a
2 changed files with 8 additions and 2 deletions
|
@ -57,9 +57,14 @@ bool WalletBatch::EraseTx(uint256 hash)
|
||||||
return EraseIC(std::make_pair(std::string("tx"), hash));
|
return EraseIC(std::make_pair(std::string("tx"), hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WalletBatch::WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey, const bool overwrite)
|
||||||
|
{
|
||||||
|
return WriteIC(std::make_pair(std::string("keymeta"), pubkey), meta, overwrite);
|
||||||
|
}
|
||||||
|
|
||||||
bool WalletBatch::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta)
|
bool WalletBatch::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta)
|
||||||
{
|
{
|
||||||
if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta, false)) {
|
if (!WriteKeyMetadata(keyMeta, vchPubKey, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +81,7 @@ bool WalletBatch::WriteCryptedKey(const CPubKey& vchPubKey,
|
||||||
const std::vector<unsigned char>& vchCryptedSecret,
|
const std::vector<unsigned char>& vchCryptedSecret,
|
||||||
const CKeyMetadata &keyMeta)
|
const CKeyMetadata &keyMeta)
|
||||||
{
|
{
|
||||||
if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) {
|
if (!WriteKeyMetadata(keyMeta, vchPubKey, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ public:
|
||||||
bool WriteTx(const CWalletTx& wtx);
|
bool WriteTx(const CWalletTx& wtx);
|
||||||
bool EraseTx(uint256 hash);
|
bool EraseTx(uint256 hash);
|
||||||
|
|
||||||
|
bool WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey, const bool overwrite);
|
||||||
bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata &keyMeta);
|
bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata &keyMeta);
|
||||||
bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, const CKeyMetadata &keyMeta);
|
bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, const CKeyMetadata &keyMeta);
|
||||||
bool WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey);
|
bool WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey);
|
||||||
|
|
Loading…
Add table
Reference in a new issue