mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 21:52:38 +01:00
Move various SigningProviders to signingprovider.{cpp,h}
Moves all of the various SigningProviders out of sign.{cpp,h} and
keystore.{cpp,h}. As such, keystore.{cpp,h} is also removed.
Includes and the Makefile are updated to reflect this. Includes were largely
changed using:
git grep -l "keystore.h" | xargs sed -i -e 's;keystore.h;script/signingprovider.h;g'
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <key.h>
|
||||
#include <policy/policy.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
#include <uint256.h>
|
||||
|
||||
@@ -423,22 +424,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<typename M, typename K, typename V>
|
||||
bool LookupHelper(const M& map, const K& key, V& value)
|
||||
{
|
||||
auto it = map.find(key);
|
||||
if (it != map.end()) {
|
||||
value = it->second;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator(32, 32);
|
||||
const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR = DummySignatureCreator(33, 32);
|
||||
const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
|
||||
|
||||
bool IsSolvable(const SigningProvider& provider, const CScript& script)
|
||||
{
|
||||
@@ -459,53 +448,6 @@ bool IsSolvable(const SigningProvider& provider, const CScript& script)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HidingSigningProvider::GetCScript(const CScriptID& scriptid, CScript& script) const
|
||||
{
|
||||
return m_provider->GetCScript(scriptid, script);
|
||||
}
|
||||
|
||||
bool HidingSigningProvider::GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const
|
||||
{
|
||||
return m_provider->GetPubKey(keyid, pubkey);
|
||||
}
|
||||
|
||||
bool HidingSigningProvider::GetKey(const CKeyID& keyid, CKey& key) const
|
||||
{
|
||||
if (m_hide_secret) return false;
|
||||
return m_provider->GetKey(keyid, key);
|
||||
}
|
||||
|
||||
bool HidingSigningProvider::GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const
|
||||
{
|
||||
if (m_hide_origin) return false;
|
||||
return m_provider->GetKeyOrigin(keyid, info);
|
||||
}
|
||||
|
||||
bool FlatSigningProvider::GetCScript(const CScriptID& scriptid, CScript& script) const { return LookupHelper(scripts, scriptid, script); }
|
||||
bool FlatSigningProvider::GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const { return LookupHelper(pubkeys, keyid, pubkey); }
|
||||
bool FlatSigningProvider::GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const
|
||||
{
|
||||
std::pair<CPubKey, KeyOriginInfo> out;
|
||||
bool ret = LookupHelper(origins, keyid, out);
|
||||
if (ret) info = std::move(out.second);
|
||||
return ret;
|
||||
}
|
||||
bool FlatSigningProvider::GetKey(const CKeyID& keyid, CKey& key) const { return LookupHelper(keys, keyid, key); }
|
||||
|
||||
FlatSigningProvider Merge(const FlatSigningProvider& a, const FlatSigningProvider& b)
|
||||
{
|
||||
FlatSigningProvider ret;
|
||||
ret.scripts = a.scripts;
|
||||
ret.scripts.insert(b.scripts.begin(), b.scripts.end());
|
||||
ret.pubkeys = a.pubkeys;
|
||||
ret.pubkeys.insert(b.pubkeys.begin(), b.pubkeys.end());
|
||||
ret.keys = a.keys;
|
||||
ret.keys.insert(b.keys.begin(), b.keys.end());
|
||||
ret.origins = a.origins;
|
||||
ret.origins.insert(b.origins.begin(), b.origins.end());
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IsSegWitOutput(const SigningProvider& provider, const CScript& script)
|
||||
{
|
||||
std::vector<valtype> solutions;
|
||||
|
||||
Reference in New Issue
Block a user