mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-10-22 06:28:44 +02:00
Myriadcoin 0.11 port
This commit is contained in:
+32
-5
@@ -1,13 +1,12 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// Copyright (c) 2009-2014 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 "crypter.h"
|
||||
#include "key.h"
|
||||
#include "script.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
@@ -33,8 +32,11 @@ bool CBasicKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey)
|
||||
|
||||
bool CBasicKeyStore::AddCScript(const CScript& redeemScript)
|
||||
{
|
||||
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||
return error("CBasicKeyStore::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
|
||||
|
||||
LOCK(cs_KeyStore);
|
||||
mapScripts[redeemScript.GetID()] = redeemScript;
|
||||
mapScripts[CScriptID(redeemScript)] = redeemScript;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -56,3 +58,28 @@ bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CBasicKeyStore::AddWatchOnly(const CScript &dest)
|
||||
{
|
||||
LOCK(cs_KeyStore);
|
||||
setWatchOnly.insert(dest);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBasicKeyStore::RemoveWatchOnly(const CScript &dest)
|
||||
{
|
||||
LOCK(cs_KeyStore);
|
||||
setWatchOnly.erase(dest);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBasicKeyStore::HaveWatchOnly(const CScript &dest) const
|
||||
{
|
||||
LOCK(cs_KeyStore);
|
||||
return setWatchOnly.count(dest) > 0;
|
||||
}
|
||||
|
||||
bool CBasicKeyStore::HaveWatchOnly() const
|
||||
{
|
||||
LOCK(cs_KeyStore);
|
||||
return (!setWatchOnly.empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user