Skip to content

Commit d9becff

Browse files
committed
scripted-diff: rename CBasicKeyStore to FillableSigningProvider
-BEGIN VERIFY SCRIPT- git grep -l "CBasicKeyStore" | xargs sed -i -e 's/CBasicKeyStore/FillableSigningProvider/g' -END VERIFY SCRIPT-
1 parent a913e3f commit d9becff

23 files changed

+58
-58
lines changed

doc/developer-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ reported in the debug.log file.
375375

376376
Re-architecting the core code so there are better-defined interfaces
377377
between the various components is a goal, with any necessary locking
378-
done by the components (e.g. see the self-contained `CBasicKeyStore` class
378+
done by the components (e.g. see the self-contained `FillableSigningProvider` class
379379
and its `cs_KeyStore` lock for example).
380380

381381
Threads

src/bench/ccoins_caching.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// paid to a TX_PUBKEYHASH.
1818
//
1919
static std::vector<CMutableTransaction>
20-
SetupDummyInputs(CBasicKeyStore& keystoreRet, CCoinsViewCache& coinsRet)
20+
SetupDummyInputs(FillableSigningProvider& keystoreRet, CCoinsViewCache& coinsRet)
2121
{
2222
std::vector<CMutableTransaction> dummyTransactions;
2323
dummyTransactions.resize(2);
@@ -55,7 +55,7 @@ SetupDummyInputs(CBasicKeyStore& keystoreRet, CCoinsViewCache& coinsRet)
5555
// (https://github.com/bitcoin/bitcoin/issues/7883#issuecomment-224807484)
5656
static void CCoinsCaching(benchmark::State& state)
5757
{
58-
CBasicKeyStore keystore;
58+
FillableSigningProvider keystore;
5959
CCoinsView coinsDummy;
6060
CCoinsViewCache coins(&coinsDummy);
6161
std::vector<CMutableTransaction> dummyTransactions = SetupDummyInputs(keystore, coins);

src/bitcoin-tx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
557557

558558
if (!registers.count("privatekeys"))
559559
throw std::runtime_error("privatekeys register variable must be set.");
560-
CBasicKeyStore tempKeystore;
560+
FillableSigningProvider tempKeystore;
561561
UniValue keysObj = registers["privatekeys"];
562562

563563
for (unsigned int kidx = 0; kidx < keysObj.size(); kidx++) {
@@ -631,7 +631,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
631631
}
632632
}
633633

634-
const CBasicKeyStore& keystore = tempKeystore;
634+
const FillableSigningProvider& keystore = tempKeystore;
635635

636636
bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);
637637

src/keystore.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <util/system.h>
99

10-
void CBasicKeyStore::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey)
10+
void FillableSigningProvider::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey)
1111
{
1212
AssertLockHeld(cs_KeyStore);
1313
CKeyID key_id = pubkey.GetID();
@@ -32,7 +32,7 @@ void CBasicKeyStore::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey)
3232
}
3333
}
3434

35-
bool CBasicKeyStore::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
35+
bool FillableSigningProvider::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
3636
{
3737
CKey key;
3838
if (!GetKey(address, key)) {
@@ -48,21 +48,21 @@ bool CBasicKeyStore::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) con
4848
return true;
4949
}
5050

51-
bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
51+
bool FillableSigningProvider::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
5252
{
5353
LOCK(cs_KeyStore);
5454
mapKeys[pubkey.GetID()] = key;
5555
ImplicitlyLearnRelatedKeyScripts(pubkey);
5656
return true;
5757
}
5858

59-
bool CBasicKeyStore::HaveKey(const CKeyID &address) const
59+
bool FillableSigningProvider::HaveKey(const CKeyID &address) const
6060
{
6161
LOCK(cs_KeyStore);
6262
return mapKeys.count(address) > 0;
6363
}
6464

65-
std::set<CKeyID> CBasicKeyStore::GetKeys() const
65+
std::set<CKeyID> FillableSigningProvider::GetKeys() const
6666
{
6767
LOCK(cs_KeyStore);
6868
std::set<CKeyID> set_address;
@@ -72,7 +72,7 @@ std::set<CKeyID> CBasicKeyStore::GetKeys() const
7272
return set_address;
7373
}
7474

75-
bool CBasicKeyStore::GetKey(const CKeyID &address, CKey &keyOut) const
75+
bool FillableSigningProvider::GetKey(const CKeyID &address, CKey &keyOut) const
7676
{
7777
LOCK(cs_KeyStore);
7878
KeyMap::const_iterator mi = mapKeys.find(address);
@@ -83,23 +83,23 @@ bool CBasicKeyStore::GetKey(const CKeyID &address, CKey &keyOut) const
8383
return false;
8484
}
8585

86-
bool CBasicKeyStore::AddCScript(const CScript& redeemScript)
86+
bool FillableSigningProvider::AddCScript(const CScript& redeemScript)
8787
{
8888
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
89-
return error("CBasicKeyStore::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
89+
return error("FillableSigningProvider::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
9090

9191
LOCK(cs_KeyStore);
9292
mapScripts[CScriptID(redeemScript)] = redeemScript;
9393
return true;
9494
}
9595

96-
bool CBasicKeyStore::HaveCScript(const CScriptID& hash) const
96+
bool FillableSigningProvider::HaveCScript(const CScriptID& hash) const
9797
{
9898
LOCK(cs_KeyStore);
9999
return mapScripts.count(hash) > 0;
100100
}
101101

102-
std::set<CScriptID> CBasicKeyStore::GetCScripts() const
102+
std::set<CScriptID> FillableSigningProvider::GetCScripts() const
103103
{
104104
LOCK(cs_KeyStore);
105105
std::set<CScriptID> set_script;
@@ -109,7 +109,7 @@ std::set<CScriptID> CBasicKeyStore::GetCScripts() const
109109
return set_script;
110110
}
111111

112-
bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const
112+
bool FillableSigningProvider::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const
113113
{
114114
LOCK(cs_KeyStore);
115115
ScriptMap::const_iterator mi = mapScripts.find(hash);
@@ -137,7 +137,7 @@ static bool ExtractPubKey(const CScript &dest, CPubKey& pubKeyOut)
137137
return true;
138138
}
139139

140-
bool CBasicKeyStore::AddWatchOnly(const CScript &dest)
140+
bool FillableSigningProvider::AddWatchOnly(const CScript &dest)
141141
{
142142
LOCK(cs_KeyStore);
143143
setWatchOnly.insert(dest);
@@ -149,7 +149,7 @@ bool CBasicKeyStore::AddWatchOnly(const CScript &dest)
149149
return true;
150150
}
151151

152-
bool CBasicKeyStore::RemoveWatchOnly(const CScript &dest)
152+
bool FillableSigningProvider::RemoveWatchOnly(const CScript &dest)
153153
{
154154
LOCK(cs_KeyStore);
155155
setWatchOnly.erase(dest);
@@ -162,19 +162,19 @@ bool CBasicKeyStore::RemoveWatchOnly(const CScript &dest)
162162
return true;
163163
}
164164

165-
bool CBasicKeyStore::HaveWatchOnly(const CScript &dest) const
165+
bool FillableSigningProvider::HaveWatchOnly(const CScript &dest) const
166166
{
167167
LOCK(cs_KeyStore);
168168
return setWatchOnly.count(dest) > 0;
169169
}
170170

171-
bool CBasicKeyStore::HaveWatchOnly() const
171+
bool FillableSigningProvider::HaveWatchOnly() const
172172
{
173173
LOCK(cs_KeyStore);
174174
return (!setWatchOnly.empty());
175175
}
176176

177-
CKeyID GetKeyForDestination(const CBasicKeyStore& store, const CTxDestination& dest)
177+
CKeyID GetKeyForDestination(const FillableSigningProvider& store, const CTxDestination& dest)
178178
{
179179
// Only supports destinations which map to single public keys, i.e. P2PKH,
180180
// P2WPKH, and P2SH-P2WPKH.

src/keystore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <boost/signals2/signal.hpp>
1717

1818
/** Basic key store, that keeps keys in an address->secret map */
19-
class CBasicKeyStore : public SigningProvider
19+
class FillableSigningProvider : public SigningProvider
2020
{
2121
protected:
2222
mutable CCriticalSection cs_KeyStore;
@@ -52,6 +52,6 @@ class CBasicKeyStore : public SigningProvider
5252
};
5353

5454
/** Return the CKeyID of the key involved in a script (if there is a unique one). */
55-
CKeyID GetKeyForDestination(const CBasicKeyStore& store, const CTxDestination& dest);
55+
CKeyID GetKeyForDestination(const FillableSigningProvider& store, const CTxDestination& dest);
5656

5757
#endif // BITCOIN_KEYSTORE_H

src/outputtype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key)
7373
}
7474
}
7575

76-
CTxDestination AddAndGetDestinationForScript(CBasicKeyStore& keystore, const CScript& script, OutputType type)
76+
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType type)
7777
{
7878
// Add script to keystore
7979
keystore.AddCScript(script);

src/outputtype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
4444
* This function will automatically add the script (and any other
4545
* necessary scripts) to the keystore.
4646
*/
47-
CTxDestination AddAndGetDestinationForScript(CBasicKeyStore& keystore, const CScript& script, OutputType);
47+
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore, const CScript& script, OutputType);
4848

4949
#endif // BITCOIN_OUTPUTTYPE_H
5050

src/rpc/misc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static UniValue createmultisig(const JSONRPCRequest& request)
122122
}
123123

124124
// Construct using pay-to-script-hash:
125-
CBasicKeyStore keystore;
125+
FillableSigningProvider keystore;
126126
CScript inner;
127127
const CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, keystore, inner);
128128

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
761761
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
762762
}
763763

764-
CBasicKeyStore keystore;
764+
FillableSigningProvider keystore;
765765
const UniValue& keys = request.params[1].get_array();
766766
for (unsigned int idx = 0; idx < keys.size(); ++idx) {
767767
UniValue k = keys[idx];

src/rpc/rawtransaction_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::
148148
vErrorsRet.push_back(entry);
149149
}
150150

151-
UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival, CBasicKeyStore* keystore, std::map<COutPoint, Coin>& coins, bool is_temp_keystore, const UniValue& hashType)
151+
UniValue SignTransaction(CMutableTransaction& mtx, const UniValue& prevTxsUnival, FillableSigningProvider* keystore, std::map<COutPoint, Coin>& coins, bool is_temp_keystore, const UniValue& hashType)
152152
{
153153
// Add previous txouts given in the RPC call:
154154
if (!prevTxsUnival.isNull()) {

0 commit comments

Comments
 (0)