Merge AddSpendingKeyPaymentAddress into AddSpendingKey to simplify API

This commit is contained in:
Jack Grigg 2016-08-12 14:24:29 +12:00
parent 7c929cf5bc
commit 0bfdb9628e
2 changed files with 4 additions and 9 deletions

View File

@ -23,10 +23,6 @@ bool CKeyStore::AddKey(const CKey &key) {
return AddKeyPubKey(key, key.GetPubKey()); return AddKeyPubKey(key, key.GetPubKey());
} }
bool CKeyStore::AddSpendingKey(const libzcash::SpendingKey &key) {
return AddSpendingKeyPaymentAddress(key, key.address());
}
bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey) bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
@ -88,9 +84,9 @@ bool CBasicKeyStore::HaveWatchOnly() const
return (!setWatchOnly.empty()); return (!setWatchOnly.empty());
} }
bool CBasicKeyStore::AddSpendingKeyPaymentAddress(const libzcash::SpendingKey& key, const libzcash::PaymentAddress &address) bool CBasicKeyStore::AddSpendingKey(const libzcash::SpendingKey &sk)
{ {
LOCK(cs_KeyStore); LOCK(cs_KeyStore);
mapSpendingKeys[address] = key; mapSpendingKeys[sk.address()] = sk;
return true; return true;
} }

View File

@ -47,8 +47,7 @@ public:
virtual bool HaveWatchOnly() const =0; virtual bool HaveWatchOnly() const =0;
//! Add a spending key to the store. //! Add a spending key to the store.
virtual bool AddSpendingKeyPaymentAddress(const libzcash::SpendingKey &key, const libzcash::PaymentAddress &address) =0; virtual bool AddSpendingKey(const libzcash::SpendingKey &sk) =0;
virtual bool AddSpendingKey(const libzcash::SpendingKey &key);
//! Check whether a spending key corresponding to a given payment address is present in the store. //! Check whether a spending key corresponding to a given payment address is present in the store.
virtual bool HaveSpendingKey(const libzcash::PaymentAddress &address) const =0; virtual bool HaveSpendingKey(const libzcash::PaymentAddress &address) const =0;
@ -116,7 +115,7 @@ public:
virtual bool HaveWatchOnly(const CScript &dest) const; virtual bool HaveWatchOnly(const CScript &dest) const;
virtual bool HaveWatchOnly() const; virtual bool HaveWatchOnly() const;
bool AddSpendingKeyPaymentAddress(const libzcash::SpendingKey &key, const libzcash::PaymentAddress &address); bool AddSpendingKey(const libzcash::SpendingKey &sk);
bool HaveSpendingKey(const libzcash::PaymentAddress &address) const bool HaveSpendingKey(const libzcash::PaymentAddress &address) const
{ {
bool result; bool result;