From 0bfdb9628e2329886943e5cb28c46f47419fbf8a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 12 Aug 2016 14:24:29 +1200 Subject: [PATCH] Merge AddSpendingKeyPaymentAddress into AddSpendingKey to simplify API --- src/keystore.cpp | 8 ++------ src/keystore.h | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/keystore.cpp b/src/keystore.cpp index 376654e7f..ef1878a9b 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -23,10 +23,6 @@ bool CKeyStore::AddKey(const CKey &key) { 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) { LOCK(cs_KeyStore); @@ -88,9 +84,9 @@ bool CBasicKeyStore::HaveWatchOnly() const return (!setWatchOnly.empty()); } -bool CBasicKeyStore::AddSpendingKeyPaymentAddress(const libzcash::SpendingKey& key, const libzcash::PaymentAddress &address) +bool CBasicKeyStore::AddSpendingKey(const libzcash::SpendingKey &sk) { LOCK(cs_KeyStore); - mapSpendingKeys[address] = key; + mapSpendingKeys[sk.address()] = sk; return true; } diff --git a/src/keystore.h b/src/keystore.h index bbd04f235..4beba84fe 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -47,8 +47,7 @@ public: virtual bool HaveWatchOnly() const =0; //! 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 &key); + virtual bool AddSpendingKey(const libzcash::SpendingKey &sk) =0; //! 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; @@ -116,7 +115,7 @@ public: virtual bool HaveWatchOnly(const CScript &dest) 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 result;