mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
keystore GetKeys(): return result instead of writing to reference
Issue: #10905 By returning the result, a few useless lines can be removed. Return-value-optimization means there should be no copy.
This commit is contained in:
@@ -30,7 +30,7 @@ public:
|
||||
//! Check whether a key corresponding to a given address is present in the store.
|
||||
virtual bool HaveKey(const CKeyID &address) const =0;
|
||||
virtual bool GetKey(const CKeyID &address, CKey& keyOut) const =0;
|
||||
virtual void GetKeys(std::set<CKeyID> &setAddress) const =0;
|
||||
virtual std::set<CKeyID> GetKeys() const =0;
|
||||
virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const =0;
|
||||
|
||||
//! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
|
||||
@@ -71,18 +71,14 @@ public:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void GetKeys(std::set<CKeyID> &setAddress) const override
|
||||
std::set<CKeyID> GetKeys() const override
|
||||
{
|
||||
setAddress.clear();
|
||||
{
|
||||
LOCK(cs_KeyStore);
|
||||
KeyMap::const_iterator mi = mapKeys.begin();
|
||||
while (mi != mapKeys.end())
|
||||
{
|
||||
setAddress.insert((*mi).first);
|
||||
mi++;
|
||||
}
|
||||
LOCK(cs_KeyStore);
|
||||
std::set<CKeyID> set_address;
|
||||
for (const auto& mi : mapKeys) {
|
||||
set_address.insert(mi.first);
|
||||
}
|
||||
return set_address;
|
||||
}
|
||||
bool GetKey(const CKeyID &address, CKey &keyOut) const override
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user