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:
parent
16f8096e91
commit
37a79a4fcc
26 changed files with 194 additions and 184 deletions
|
@ -143,7 +143,6 @@ BITCOIN_CORE_H = \
|
|||
interfaces/wallet.h \
|
||||
key.h \
|
||||
key_io.h \
|
||||
keystore.h \
|
||||
dbwrapper.h \
|
||||
limitedmap.h \
|
||||
logging.h \
|
||||
|
@ -184,6 +183,7 @@ BITCOIN_CORE_H = \
|
|||
script/keyorigin.h \
|
||||
script/sigcache.h \
|
||||
script/sign.h \
|
||||
script/signingprovider.h \
|
||||
script/standard.h \
|
||||
shutdown.h \
|
||||
streams.h \
|
||||
|
@ -447,7 +447,6 @@ libbitcoin_common_a_SOURCES = \
|
|||
core_write.cpp \
|
||||
key.cpp \
|
||||
key_io.cpp \
|
||||
keystore.cpp \
|
||||
merkleblock.cpp \
|
||||
netaddress.cpp \
|
||||
netbase.cpp \
|
||||
|
@ -461,6 +460,7 @@ libbitcoin_common_a_SOURCES = \
|
|||
scheduler.cpp \
|
||||
script/descriptor.cpp \
|
||||
script/sign.cpp \
|
||||
script/signingprovider.cpp \
|
||||
script/standard.cpp \
|
||||
versionbitsinfo.cpp \
|
||||
warnings.cpp \
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <bench/bench.h>
|
||||
#include <coins.h>
|
||||
#include <policy/policy.h>
|
||||
#include <wallet/crypter.h>
|
||||
#include <script/signingprovider.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
#include <consensus/consensus.h>
|
||||
#include <core_io.h>
|
||||
#include <key_io.h>
|
||||
#include <keystore.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/rbf.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <univalue.h>
|
||||
#include <util/rbf.h>
|
||||
#include <util/system.h>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_KEYSTORE_H
|
||||
#define BITCOIN_KEYSTORE_H
|
||||
|
||||
#include <key.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/standard.h>
|
||||
#include <sync.h>
|
||||
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
/** Basic key store, that keeps keys in an address->secret map */
|
||||
class FillableSigningProvider : public SigningProvider
|
||||
{
|
||||
protected:
|
||||
mutable CCriticalSection cs_KeyStore;
|
||||
|
||||
using KeyMap = std::map<CKeyID, CKey>;
|
||||
using WatchKeyMap = std::map<CKeyID, CPubKey>;
|
||||
using ScriptMap = std::map<CScriptID, CScript>;
|
||||
using WatchOnlySet = std::set<CScript>;
|
||||
|
||||
KeyMap mapKeys GUARDED_BY(cs_KeyStore);
|
||||
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore);
|
||||
ScriptMap mapScripts GUARDED_BY(cs_KeyStore);
|
||||
WatchOnlySet setWatchOnly GUARDED_BY(cs_KeyStore);
|
||||
|
||||
void ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
|
||||
|
||||
public:
|
||||
virtual bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
|
||||
virtual bool AddKey(const CKey &key) { return AddKeyPubKey(key, key.GetPubKey()); }
|
||||
virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override;
|
||||
virtual bool HaveKey(const CKeyID &address) const override;
|
||||
virtual std::set<CKeyID> GetKeys() const;
|
||||
virtual bool GetKey(const CKeyID &address, CKey &keyOut) const override;
|
||||
virtual bool AddCScript(const CScript& redeemScript);
|
||||
virtual bool HaveCScript(const CScriptID &hash) const override;
|
||||
virtual std::set<CScriptID> GetCScripts() const;
|
||||
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override;
|
||||
|
||||
virtual bool AddWatchOnly(const CScript &dest);
|
||||
virtual bool RemoveWatchOnly(const CScript &dest);
|
||||
virtual bool HaveWatchOnly(const CScript &dest) const;
|
||||
virtual bool HaveWatchOnly() const;
|
||||
};
|
||||
|
||||
/** Return the CKeyID of the key involved in a script (if there is a unique one). */
|
||||
CKeyID GetKeyForDestination(const FillableSigningProvider& store, const CTxDestination& dest);
|
||||
|
||||
#endif // BITCOIN_KEYSTORE_H
|
|
@ -5,9 +5,10 @@
|
|||
|
||||
#include <outputtype.h>
|
||||
|
||||
#include <keystore.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -98,4 +99,3 @@ CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore,
|
|||
default: assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define BITCOIN_OUTPUTTYPE_H
|
||||
|
||||
#include <attributes.h>
|
||||
#include <keystore.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <primitives/transaction.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
|
||||
// Magic bytes
|
||||
static constexpr uint8_t PSBT_MAGIC_BYTES[5] = {'p', 's', 'b', 't', 0xff};
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <core_io.h>
|
||||
#include <index/txindex.h>
|
||||
#include <key_io.h>
|
||||
#include <keystore.h>
|
||||
#include <merkleblock.h>
|
||||
#include <node/coin.h>
|
||||
#include <node/psbt.h>
|
||||
|
@ -24,6 +23,7 @@
|
|||
#include <script/script.h>
|
||||
#include <script/script_error.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
#include <uint256.h>
|
||||
#include <util/moneystr.h>
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
#include <coins.h>
|
||||
#include <core_io.h>
|
||||
#include <key_io.h>
|
||||
#include <keystore.h>
|
||||
#include <policy/policy.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <rpc/protocol.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <tinyformat.h>
|
||||
#include <univalue.h>
|
||||
#include <util/rbf.h>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <key_io.h>
|
||||
#include <keystore.h>
|
||||
#include <outputtype.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <tinyformat.h>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -18,54 +18,10 @@ class CKeyID;
|
|||
class CScript;
|
||||
class CScriptID;
|
||||
class CTransaction;
|
||||
class SigningProvider;
|
||||
|
||||
struct CMutableTransaction;
|
||||
|
||||
/** An interface to be implemented by keystores that support signing. */
|
||||
class SigningProvider
|
||||
{
|
||||
public:
|
||||
virtual ~SigningProvider() {}
|
||||
virtual bool GetCScript(const CScriptID &scriptid, CScript& script) const { return false; }
|
||||
virtual bool HaveCScript(const CScriptID &scriptid) const { return false; }
|
||||
virtual bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const { return false; }
|
||||
virtual bool GetKey(const CKeyID &address, CKey& key) const { return false; }
|
||||
virtual bool HaveKey(const CKeyID &address) const { return false; }
|
||||
virtual bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const { return false; }
|
||||
};
|
||||
|
||||
extern const SigningProvider& DUMMY_SIGNING_PROVIDER;
|
||||
|
||||
class HidingSigningProvider : public SigningProvider
|
||||
{
|
||||
private:
|
||||
const bool m_hide_secret;
|
||||
const bool m_hide_origin;
|
||||
const SigningProvider* m_provider;
|
||||
|
||||
public:
|
||||
HidingSigningProvider(const SigningProvider* provider, bool hide_secret, bool hide_origin) : m_hide_secret(hide_secret), m_hide_origin(hide_origin), m_provider(provider) {}
|
||||
bool GetCScript(const CScriptID& scriptid, CScript& script) const override;
|
||||
bool GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const override;
|
||||
bool GetKey(const CKeyID& keyid, CKey& key) const override;
|
||||
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
||||
};
|
||||
|
||||
struct FlatSigningProvider final : public SigningProvider
|
||||
{
|
||||
std::map<CScriptID, CScript> scripts;
|
||||
std::map<CKeyID, CPubKey> pubkeys;
|
||||
std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> origins;
|
||||
std::map<CKeyID, CKey> keys;
|
||||
|
||||
bool GetCScript(const CScriptID& scriptid, CScript& script) const override;
|
||||
bool GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const override;
|
||||
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
||||
bool GetKey(const CKeyID& keyid, CKey& key) const override;
|
||||
};
|
||||
|
||||
FlatSigningProvider Merge(const FlatSigningProvider& a, const FlatSigningProvider& b);
|
||||
|
||||
/** Interface for signature creators. */
|
||||
class BaseSignatureCreator {
|
||||
public:
|
||||
|
|
|
@ -1,12 +1,74 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <keystore.h>
|
||||
#include <script/keyorigin.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
|
||||
#include <util/system.h>
|
||||
|
||||
const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void FillableSigningProvider::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey)
|
||||
{
|
||||
AssertLockHeld(cs_KeyStore);
|
||||
|
@ -174,7 +236,7 @@ bool FillableSigningProvider::HaveWatchOnly() const
|
|||
return (!setWatchOnly.empty());
|
||||
}
|
||||
|
||||
CKeyID GetKeyForDestination(const FillableSigningProvider& store, const CTxDestination& dest)
|
||||
CKeyID GetKeyForDestination(const SigningProvider& store, const CTxDestination& dest)
|
||||
{
|
||||
// Only supports destinations which map to single public keys, i.e. P2PKH,
|
||||
// P2WPKH, and P2SH-P2WPKH.
|
101
src/script/signingprovider.h
Normal file
101
src/script/signingprovider.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_SCRIPT_SIGNINGPROVIDER_H
|
||||
#define BITCOIN_SCRIPT_SIGNINGPROVIDER_H
|
||||
|
||||
#include <key.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/script.h>
|
||||
#include <script/standard.h>
|
||||
#include <sync.h>
|
||||
|
||||
struct KeyOriginInfo;
|
||||
|
||||
/** An interface to be implemented by keystores that support signing. */
|
||||
class SigningProvider
|
||||
{
|
||||
public:
|
||||
virtual ~SigningProvider() {}
|
||||
virtual bool GetCScript(const CScriptID &scriptid, CScript& script) const { return false; }
|
||||
virtual bool HaveCScript(const CScriptID &scriptid) const { return false; }
|
||||
virtual bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const { return false; }
|
||||
virtual bool GetKey(const CKeyID &address, CKey& key) const { return false; }
|
||||
virtual bool HaveKey(const CKeyID &address) const { return false; }
|
||||
virtual bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const { return false; }
|
||||
};
|
||||
|
||||
extern const SigningProvider& DUMMY_SIGNING_PROVIDER;
|
||||
|
||||
class HidingSigningProvider : public SigningProvider
|
||||
{
|
||||
private:
|
||||
const bool m_hide_secret;
|
||||
const bool m_hide_origin;
|
||||
const SigningProvider* m_provider;
|
||||
|
||||
public:
|
||||
HidingSigningProvider(const SigningProvider* provider, bool hide_secret, bool hide_origin) : m_hide_secret(hide_secret), m_hide_origin(hide_origin), m_provider(provider) {}
|
||||
bool GetCScript(const CScriptID& scriptid, CScript& script) const override;
|
||||
bool GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const override;
|
||||
bool GetKey(const CKeyID& keyid, CKey& key) const override;
|
||||
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
||||
};
|
||||
|
||||
struct FlatSigningProvider final : public SigningProvider
|
||||
{
|
||||
std::map<CScriptID, CScript> scripts;
|
||||
std::map<CKeyID, CPubKey> pubkeys;
|
||||
std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> origins;
|
||||
std::map<CKeyID, CKey> keys;
|
||||
|
||||
bool GetCScript(const CScriptID& scriptid, CScript& script) const override;
|
||||
bool GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const override;
|
||||
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
||||
bool GetKey(const CKeyID& keyid, CKey& key) const override;
|
||||
};
|
||||
|
||||
FlatSigningProvider Merge(const FlatSigningProvider& a, const FlatSigningProvider& b);
|
||||
|
||||
/** Fillable signing provider that keeps keys in an address->secret map */
|
||||
class FillableSigningProvider : public SigningProvider
|
||||
{
|
||||
protected:
|
||||
mutable CCriticalSection cs_KeyStore;
|
||||
|
||||
using KeyMap = std::map<CKeyID, CKey>;
|
||||
using WatchKeyMap = std::map<CKeyID, CPubKey>;
|
||||
using ScriptMap = std::map<CScriptID, CScript>;
|
||||
using WatchOnlySet = std::set<CScript>;
|
||||
|
||||
KeyMap mapKeys GUARDED_BY(cs_KeyStore);
|
||||
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore);
|
||||
ScriptMap mapScripts GUARDED_BY(cs_KeyStore);
|
||||
WatchOnlySet setWatchOnly GUARDED_BY(cs_KeyStore);
|
||||
|
||||
void ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
|
||||
|
||||
public:
|
||||
virtual bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
|
||||
virtual bool AddKey(const CKey &key) { return AddKeyPubKey(key, key.GetPubKey()); }
|
||||
virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override;
|
||||
virtual bool HaveKey(const CKeyID &address) const override;
|
||||
virtual std::set<CKeyID> GetKeys() const;
|
||||
virtual bool GetKey(const CKeyID &address, CKey &keyOut) const override;
|
||||
virtual bool AddCScript(const CScript& redeemScript);
|
||||
virtual bool HaveCScript(const CScriptID &hash) const override;
|
||||
virtual std::set<CScriptID> GetCScripts() const;
|
||||
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override;
|
||||
|
||||
virtual bool AddWatchOnly(const CScript &dest);
|
||||
virtual bool RemoveWatchOnly(const CScript &dest);
|
||||
virtual bool HaveWatchOnly(const CScript &dest) const;
|
||||
virtual bool HaveWatchOnly() const;
|
||||
};
|
||||
|
||||
/** Return the CKeyID of the key involved in a script (if there is a unique one). */
|
||||
CKeyID GetKeyForDestination(const SigningProvider& store, const CTxDestination& dest);
|
||||
|
||||
#endif // BITCOIN_SCRIPT_SIGNINGPROVIDER_H
|
|
@ -9,7 +9,6 @@
|
|||
#include <pubkey.h>
|
||||
#include <script/script.h>
|
||||
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
bool fAcceptDatacarrier = DEFAULT_ACCEPT_DATACARRIER;
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
|
||||
#include <banman.h>
|
||||
#include <chainparams.h>
|
||||
#include <keystore.h>
|
||||
#include <net.h>
|
||||
#include <net_processing.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
#include <serialize.h>
|
||||
#include <util/memory.h>
|
||||
#include <util/system.h>
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <policy/policy.h>
|
||||
#include <script/script.h>
|
||||
#include <script/script_error.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
#include <test/setup_common.h>
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
#include <consensus/tx_verify.h>
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <validation.h>
|
||||
#include <policy/policy.h>
|
||||
#include <script/script.h>
|
||||
#include <script/script_error.h>
|
||||
#include <policy/settings.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <test/setup_common.h>
|
||||
|
||||
#include <vector>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <script/script.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/standard.h>
|
||||
#include <test/setup_common.h>
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#include <core_io.h>
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <script/script.h>
|
||||
#include <script/script_error.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <util/system.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <test/setup_common.h>
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
#include <consensus/validation.h>
|
||||
#include <core_io.h>
|
||||
#include <key.h>
|
||||
#include <keystore.h>
|
||||
#include <validation.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/settings.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/script_error.h>
|
||||
#include <script/standard.h>
|
||||
#include <streams.h>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <txmempool.h>
|
||||
#include <script/standard.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <test/setup_common.h>
|
||||
#include <keystore.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
#ifndef BITCOIN_WALLET_CRYPTER_H
|
||||
#define BITCOIN_WALLET_CRYPTER_H
|
||||
|
||||
#include <keystore.h>
|
||||
#include <serialize.h>
|
||||
#include <support/allocators/secure.h>
|
||||
#include <script/signingprovider.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
const unsigned int WALLET_CRYPTO_KEY_SIZE = 32;
|
||||
const unsigned int WALLET_CRYPTO_SALT_SIZE = 8;
|
||||
const unsigned int WALLET_CRYPTO_IV_SIZE = 16;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <key.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
#include <interfaces/wallet.h>
|
||||
#include <key.h>
|
||||
#include <key_io.h>
|
||||
#include <keystore.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/policy.h>
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <script/script.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <util/bip32.h>
|
||||
#include <util/error.h>
|
||||
#include <util/fees.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue