]> Git Repo - VerusCoin.git/blame - src/keystore.cpp
Increase IsStandard() scriptSig length
[VerusCoin.git] / src / keystore.cpp
CommitLineData
b2120e22 1// Copyright (c) 2009-2010 Satoshi Nakamoto
db0e8ccd 2// Copyright (c) 2009-2013 The Bitcoin developers
e89b9f6a 3// Distributed under the MIT/X11 software license, see the accompanying
3a25a2b9 4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
e89b9f6a 5
ed6d0b5f 6#include "keystore.h"
51ed9ec9
BD
7
8#include "crypter.h"
9#include "key.h"
2a45a494 10#include "script.h"
e89b9f6a 11
51ed9ec9
BD
12#include <boost/foreach.hpp>
13
10254401 14bool CKeyStore::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
03fbd790
PW
15{
16 CKey key;
2ffba736 17 if (!GetKey(address, key))
03fbd790
PW
18 return false;
19 vchPubKeyOut = key.GetPubKey();
20 return true;
21}
22
dfa23b94
PW
23bool CKeyStore::AddKey(const CKey &key) {
24 return AddKeyPubKey(key, key.GetPubKey());
25}
26
27bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
e89b9f6a 28{
dfa23b94
PW
29 LOCK(cs_KeyStore);
30 mapKeys[pubkey.GetID()] = key;
acd65016
PW
31 return true;
32}
33
922e8e29 34bool CBasicKeyStore::AddCScript(const CScript& redeemScript)
e679ec96 35{
dfa23b94
PW
36 LOCK(cs_KeyStore);
37 mapScripts[redeemScript.GetID()] = redeemScript;
e679ec96
GA
38 return true;
39}
40
10254401 41bool CBasicKeyStore::HaveCScript(const CScriptID& hash) const
e679ec96 42{
dfa23b94
PW
43 LOCK(cs_KeyStore);
44 return mapScripts.count(hash) > 0;
e679ec96
GA
45}
46
10254401 47bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const
e679ec96 48{
dfa23b94
PW
49 LOCK(cs_KeyStore);
50 ScriptMap::const_iterator mi = mapScripts.find(hash);
51 if (mi != mapScripts.end())
e679ec96 52 {
dfa23b94
PW
53 redeemScriptOut = (*mi).second;
54 return true;
e679ec96
GA
55 }
56 return false;
57}
58
This page took 0.117825 seconds and 4 git commands to generate.