# Run on the test network instead of the real novacoin network.
#testnet=1
-# Connect via a socks4 proxy
+# Connect via a socks5 proxy
#proxy=127.0.0.1:9050
# Use as many addnode= settings as you like to connect to specific peers
Enable or disable run on the test network instead of the real *novacoin* network.
.TP
\fBproxy=\fR\fI'127.0.0.1:9050'\fR
-Connect via a socks4 proxy.
+Connect via a socks5 proxy.
.TP
\fBaddnode=\fR\fI'10.0.0.2:8333'\fR
Use as many *addnode=* settings as you like to connect to specific peers.
Specify data directory
.TP
\fB\-proxy=\fR<ip:port>
-Connect through socks4 proxy
+Connect through socks5 proxy
.TP
\fB\-addnode=\fR<ip>
Add a node to connect to
" -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n" +
" -dblogsize=<n> " + _("Set database disk log size in megabytes (default: 100)") + "\n" +
" -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n" +
- " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n" +
- " -socks=<n> " + _("Select the version of socks proxy to use (4-5, default: 5)") + "\n" +
+ " -proxy=<ip:port> " + _("Connect through socks5 proxy") + "\n" +
" -tor=<ip:port> " + _("Use proxy to reach tor hidden services (default: same as -proxy)") + "\n"
" -torname=<host.onion> " + _("Send the specified hidden service name when connecting to Tor nodes (default: none)") + "\n"
" -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + "\n" +
// ********************************************************* Step 6: network initialization
- int nSocksVersion = GetArgInt("-socks", 5);
-
- if (nSocksVersion != 4 && nSocksVersion != 5)
- return InitError(strprintf(_("Unknown -socks proxy version requested: %i"), nSocksVersion));
-
if (mapArgs.count("-onlynet")) {
std::set<enum Network> nets;
for(std::string snet : mapMultiArgs["-onlynet"]) {
return InitError(strprintf(_("Invalid -proxy address: '%s'"), mapArgs["-proxy"].c_str()));
if (!IsLimited(NET_IPV4))
- SetProxy(NET_IPV4, addrProxy, nSocksVersion);
- if (nSocksVersion > 4) {
+ SetProxy(NET_IPV4, addrProxy);
#ifdef USE_IPV6
if (!IsLimited(NET_IPV6))
- SetProxy(NET_IPV6, addrProxy, nSocksVersion);
+ SetProxy(NET_IPV6, addrProxy);
#endif
- SetNameProxy(addrProxy, nSocksVersion);
- }
+ SetNameProxy(addrProxy);
fProxy = true;
}
addrOnion = CService(mapArgs["-tor"], nSocksDefault);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -tor address: '%s'"), mapArgs["-tor"].c_str()));
- SetProxy(NET_TOR, addrOnion, 5);
+ SetProxy(NET_TOR, addrOnion);
SetReachable(NET_TOR);
}
#ifndef PPCOIN_KERNEL_H
#define PPCOIN_KERNEL_H
+#include <algorithm>
+
#include "uint256.h"
class CBlock;
#include "kernelrecord.h"
+#include "kernel.h"
#include "wallet.h"
#include "base58.h"
const unsigned char *vchZero = NULL;
+CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end()))
+{
+}
+
void CKey::SetCompressedPubKey(bool fCompressed)
{
EC_KEY_set_conv_form(pkey, fCompressed ? POINT_CONVERSION_COMPRESSED : POINT_CONVERSION_UNCOMPRESSED);
{
public:
CScriptID() : uint160(0) { }
+ CScriptID(const CScript& in);
CScriptID(const uint160 &in) : uint160(in) { }
};
return true;
}
+bool CKeyStore::GetSecret(const CKeyID &address, CSecret& vchSecret, bool &fCompressed) const
+{
+ CKey key;
+ if (!GetKey(address, key))
+ return false;
+ vchSecret = key.GetSecret(fCompressed);
+ return true;
+}
+
bool CBasicKeyStore::AddKey(const CKey& key)
{
bool fCompressed = false;
return true;
}
+bool CBasicKeyStore::GetMalleableKey(const CMalleableKeyView &keyView, CMalleableKey &mKey) const
+{
+ {
+ LOCK(cs_KeyStore);
+ MalleableKeyMap::const_iterator mi = mapMalleableKeys.find(keyView);
+ if (mi != mapMalleableKeys.end())
+ {
+ mKey = mi->first.GetMalleableKey(mi->second);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool CBasicKeyStore::HaveKey(const CKeyID &address) const
+{
+ bool result;
+ {
+ LOCK(cs_KeyStore);
+ result = (mapKeys.count(address) > 0);
+ }
+ return result;
+}
+
+void CBasicKeyStore::GetKeys(std::set<CKeyID> &setAddress) const
+{
+ setAddress.clear();
+ {
+ LOCK(cs_KeyStore);
+ KeyMap::const_iterator mi;
+ for (mi = mapKeys.begin(); mi != mapKeys.end(); ++mi) setAddress.insert((*mi).first);
+ }
+}
+
+bool CBasicKeyStore::GetKey(const CKeyID &address, CKey &keyOut) const
+{
+ {
+ LOCK(cs_KeyStore);
+ KeyMap::const_iterator mi = mapKeys.find(address);
+ if (mi != mapKeys.end())
+ {
+ keyOut.SetSecret((*mi).second.first, (*mi).second.second);
+ return true;
+ }
+ }
+ return false;
+}
+
bool CBasicKeyStore::AddCScript(const CScript& redeemScript)
{
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
{
LOCK(cs_KeyStore);
- mapScripts[redeemScript.GetID()] = redeemScript;
+ mapScripts[CScriptID(redeemScript)] = redeemScript;
}
return true;
}
return (!setWatchOnly.empty());
}
+bool CBasicKeyStore::CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const
+{
+ {
+ LOCK(cs_KeyStore);
+ for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
+ {
+ if (mi->first.CheckKeyVariant(R, pubKeyVariant))
+ return true;
+ }
+ }
+ return false;
+}
+
+bool CBasicKeyStore::CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const
+{
+ {
+ LOCK(cs_KeyStore);
+ for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
+ {
+ if (mi->first.CheckKeyVariant(R, pubKeyVariant))
+ {
+ view = mi->first;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool CBasicKeyStore::CreatePrivKey(const CPubKey &pubKeyVariant, const CPubKey &R, CKey &privKey) const
+{
+ {
+ LOCK(cs_KeyStore);
+ for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
+ {
+ if (mi->first.CheckKeyVariant(R, pubKeyVariant))
+ {
+ CMalleableKey mKey = mi->first.GetMalleableKey(mi->second);
+ return mKey.CheckKeyVariant(R, pubKeyVariant, privKey);
+ }
+ }
+ }
+ return false;
+}
+
+void CBasicKeyStore::ListMalleableViews(std::list<CMalleableKeyView> &malleableViewList) const
+{
+ malleableViewList.clear();
+ {
+ LOCK(cs_KeyStore);
+ for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
+ malleableViewList.push_back(CMalleableKeyView(mi->first));
+ }
+}
+
+bool CBasicKeyStore::GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view)
+{
+ const CKeyID &mpkID = mpk.GetID();
+ {
+ LOCK(cs_KeyStore);
+ for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
+ if (mi->first.GetID() == mpkID)
+ {
+ view = CMalleableKeyView(mi->first);
+ return true;
+ }
+ }
+ return false;
+}
+
+
bool CCryptoKeyStore::SetCrypted()
{
{
return true;
}
+CCryptoKeyStore::CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false)
+{
+}
+
+bool CCryptoKeyStore::IsCrypted() const
+{
+ return fUseCrypto;
+}
+
+bool CCryptoKeyStore::IsLocked() const
+{
+ if (!IsCrypted())
+ return false;
+ bool result;
+ {
+ LOCK(cs_KeyStore);
+ result = vMasterKey.empty();
+ }
+ return result;
+}
+
bool CCryptoKeyStore::Lock()
{
if (!SetCrypted())
return true;
}
+bool CCryptoKeyStore::HaveKey(const CKeyID &address) const
+{
+ {
+ LOCK(cs_KeyStore);
+ if (!IsCrypted())
+ return CBasicKeyStore::HaveKey(address);
+ return mapCryptedKeys.count(address) > 0;
+ }
+}
+
bool CCryptoKeyStore::AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret)
{
{
return false;
}
+void CCryptoKeyStore::GetKeys(std::set<CKeyID> &setAddress) const
+{
+ if (!IsCrypted())
+ {
+ CBasicKeyStore::GetKeys(setAddress);
+ return;
+ }
+ setAddress.clear();
+ CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
+ while (mi != mapCryptedKeys.end())
+ {
+ setAddress.insert((*mi).first);
+ mi++;
+ }
+}
+
+bool CCryptoKeyStore::CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const
+{
+ {
+ LOCK(cs_KeyStore);
+ if (!IsCrypted())
+ return CBasicKeyStore::CheckOwnership(pubKeyVariant, R);
+ for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
+ {
+ if (mi->first.CheckKeyVariant(R, pubKeyVariant))
+ return true;
+ }
+ }
+ return false;
+}
+
+bool CCryptoKeyStore::CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const
+{
+ {
+ LOCK(cs_KeyStore);
+ if (!IsCrypted())
+ return CBasicKeyStore::CheckOwnership(pubKeyVariant, R, view);
+ for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
+ {
+ if (mi->first.CheckKeyVariant(R, pubKeyVariant))
+ {
+ view = mi->first;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool CCryptoKeyStore::CheckOwnership(const CMalleablePubKey &mpk)
+{
+ CMalleableKeyView view;
+ return GetMalleableView(mpk, view);
+}
+
+void CCryptoKeyStore::ListMalleableViews(std::list<CMalleableKeyView> &malleableViewList) const
+{
+ malleableViewList.clear();
+ {
+ LOCK(cs_KeyStore);
+ if (!IsCrypted())
+ return CBasicKeyStore::ListMalleableViews(malleableViewList);
+ for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
+ malleableViewList.push_back(CMalleableKeyView(mi->first));
+ }
+}
+
+bool CCryptoKeyStore::GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view)
+{
+ const CKeyID &mpkID = mpk.GetID();
+ {
+ LOCK(cs_KeyStore);
+ if (!IsCrypted())
+ return CBasicKeyStore::GetMalleableView(mpk, view);
+ for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
+ if (mi->first.GetID() == mpkID)
+ {
+ view = CMalleableKeyView(mi->first);
+ return true;
+ }
+ }
+ return false;
+}
+
bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
{
{
virtual bool HaveWatchOnly(const CScript &dest) const =0;
virtual bool HaveWatchOnly() const =0;
- virtual bool GetSecret(const CKeyID &address, CSecret& vchSecret, bool &fCompressed) const
- {
- CKey key;
- if (!GetKey(address, key))
- return false;
- vchSecret = key.GetSecret(fCompressed);
- return true;
- }
+ virtual bool GetSecret(const CKeyID &address, CSecret& vchSecret, bool &fCompressed) const;
virtual bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const =0;
virtual bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const =0;
public:
bool AddKey(const CKey& key);
bool AddMalleableKey(const CMalleableKeyView& keyView, const CSecret &vchSecretH);
- bool GetMalleableKey(const CMalleableKeyView &keyView, CMalleableKey &mKey) const
- {
- {
- LOCK(cs_KeyStore);
- MalleableKeyMap::const_iterator mi = mapMalleableKeys.find(keyView);
- if (mi != mapMalleableKeys.end())
- {
- mKey = mi->first.GetMalleableKey(mi->second);
- return true;
- }
- }
- return false;
- }
-
- bool HaveKey(const CKeyID &address) const
- {
- bool result;
- {
- LOCK(cs_KeyStore);
- result = (mapKeys.count(address) > 0);
- }
- return result;
- }
- void GetKeys(std::set<CKeyID> &setAddress) const
- {
- setAddress.clear();
- {
- LOCK(cs_KeyStore);
- KeyMap::const_iterator mi;
- for (mi = mapKeys.begin(); mi != mapKeys.end(); ++mi) setAddress.insert((*mi).first);
- }
- }
- bool GetKey(const CKeyID &address, CKey &keyOut) const
- {
- {
- LOCK(cs_KeyStore);
- KeyMap::const_iterator mi = mapKeys.find(address);
- if (mi != mapKeys.end())
- {
- keyOut.SetSecret((*mi).second.first, (*mi).second.second);
- return true;
- }
- }
- return false;
- }
+ bool GetMalleableKey(const CMalleableKeyView &keyView, CMalleableKey &mKey) const;
+ bool HaveKey(const CKeyID &address) const;
+ void GetKeys(std::set<CKeyID> &setAddress) const;
+ bool GetKey(const CKeyID &address, CKey &keyOut) const;
virtual bool AddCScript(const CScript& redeemScript);
virtual bool HaveCScript(const CScriptID &hash) const;
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const;
virtual bool HaveWatchOnly(const CScript &dest) const;
virtual bool HaveWatchOnly() const;
- bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const
- {
- {
- LOCK(cs_KeyStore);
- for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
- {
- if (mi->first.CheckKeyVariant(R, pubKeyVariant))
- return true;
- }
- }
- return false;
- }
-
- bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const
- {
- {
- LOCK(cs_KeyStore);
- for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
- {
- if (mi->first.CheckKeyVariant(R, pubKeyVariant))
- {
- view = mi->first;
- return true;
- }
- }
- }
- return false;
- }
-
- bool CreatePrivKey(const CPubKey &pubKeyVariant, const CPubKey &R, CKey &privKey) const
- {
- {
- LOCK(cs_KeyStore);
- for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
- {
- if (mi->first.CheckKeyVariant(R, pubKeyVariant))
- {
- CMalleableKey mKey = mi->first.GetMalleableKey(mi->second);
- return mKey.CheckKeyVariant(R, pubKeyVariant, privKey);
- }
- }
- }
- return false;
- }
-
- void ListMalleableViews(std::list<CMalleableKeyView> &malleableViewList) const
- {
- malleableViewList.clear();
- {
- LOCK(cs_KeyStore);
- for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
- malleableViewList.push_back(CMalleableKeyView(mi->first));
- }
- }
-
- bool GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view)
- {
- const CKeyID &mpkID = mpk.GetID();
- {
- LOCK(cs_KeyStore);
- for (MalleableKeyMap::const_iterator mi = mapMalleableKeys.begin(); mi != mapMalleableKeys.end(); mi++)
- if (mi->first.GetID() == mpkID)
- {
- view = CMalleableKeyView(mi->first);
- return true;
- }
- }
-
- return false;
- }
+ bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const;
+ bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const;
+ bool CreatePrivKey(const CPubKey &pubKeyVariant, const CPubKey &R, CKey &privKey) const;
+ void ListMalleableViews(std::list<CMalleableKeyView> &malleableViewList) const;
+ bool GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view);
};
typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > CryptedKeyMap;
bool Unlock(const CKeyingMaterial& vMasterKeyIn);
public:
- CCryptoKeyStore() : fUseCrypto(false), fDecryptionThoroughlyChecked(false) { }
-
- bool IsCrypted() const
- {
- return fUseCrypto;
- }
-
- bool IsLocked() const
- {
- if (!IsCrypted())
- return false;
- bool result;
- {
- LOCK(cs_KeyStore);
- result = vMasterKey.empty();
- }
- return result;
- }
+ CCryptoKeyStore();
+ bool IsCrypted() const;
+ bool IsLocked() const;
bool Lock();
virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
bool AddKey(const CKey& key);
bool AddMalleableKey(const CMalleableKeyView& keyView, const CSecret &vchSecretH);
- bool HaveKey(const CKeyID &address) const
- {
- {
- LOCK(cs_KeyStore);
- if (!IsCrypted())
- return CBasicKeyStore::HaveKey(address);
- return mapCryptedKeys.count(address) > 0;
- }
- }
+ bool HaveKey(const CKeyID &address) const;
bool GetKey(const CKeyID &address, CKey& keyOut) const;
bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
- void GetKeys(std::set<CKeyID> &setAddress) const
- {
- if (!IsCrypted())
- {
- CBasicKeyStore::GetKeys(setAddress);
- return;
- }
- setAddress.clear();
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
- while (mi != mapCryptedKeys.end())
- {
- setAddress.insert((*mi).first);
- mi++;
- }
- }
-
+ void GetKeys(std::set<CKeyID> &setAddress) const;
bool GetMalleableKey(const CMalleableKeyView &keyView, CMalleableKey &mKey) const;
-
- bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const
- {
- {
- LOCK(cs_KeyStore);
- if (!IsCrypted())
- return CBasicKeyStore::CheckOwnership(pubKeyVariant, R);
- for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
- {
- if (mi->first.CheckKeyVariant(R, pubKeyVariant))
- return true;
- }
- }
- return false;
- }
-
- bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const
- {
- {
- LOCK(cs_KeyStore);
- if (!IsCrypted())
- return CBasicKeyStore::CheckOwnership(pubKeyVariant, R, view);
- for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
- {
- if (mi->first.CheckKeyVariant(R, pubKeyVariant))
- {
- view = mi->first;
- return true;
- }
- }
- }
- return false;
- }
-
- bool CheckOwnership(const CMalleablePubKey &mpk)
- {
- CMalleableKeyView view;
- return GetMalleableView(mpk, view);
- }
-
+ bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R) const;
+ bool CheckOwnership(const CPubKey &pubKeyVariant, const CPubKey &R, CMalleableKeyView &view) const;
+ bool CheckOwnership(const CMalleablePubKey &mpk);
bool CreatePrivKey(const CPubKey &pubKeyVariant, const CPubKey &R, CKey &privKey) const;
-
- void ListMalleableViews(std::list<CMalleableKeyView> &malleableViewList) const
- {
- malleableViewList.clear();
- {
- LOCK(cs_KeyStore);
- if (!IsCrypted())
- return CBasicKeyStore::ListMalleableViews(malleableViewList);
- for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
- malleableViewList.push_back(CMalleableKeyView(mi->first));
- }
- }
-
- bool GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view)
- {
- const CKeyID &mpkID = mpk.GetID();
- {
- LOCK(cs_KeyStore);
- if (!IsCrypted())
- return CBasicKeyStore::GetMalleableView(mpk, view);
- for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
- if (mi->first.GetID() == mpkID)
- {
- view = CMalleableKeyView(mi->first);
- return true;
- }
- }
-
- return false;
- }
-
+ void ListMalleableViews(std::list<CMalleableKeyView> &malleableViewList) const;
+ bool GetMalleableView(const CMalleablePubKey &mpk, CMalleableKeyView &view);
/* Wallet status (encrypted, locked) changed.
* Note: Called without locks held.
*/
inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
inline bool MoneyRange(CBigNum nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
-// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
-static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
// Maximum number of script-checking threads allowed
static const int MAX_SCRIPTCHECK_THREADS = 16;
}
#undef X
-void Release(CNode* node) {
- node->Release();
-}
-
-
-
-
void ThreadSocketHandler(void* parg)
{
}
{
LOCK(cs_vNodes);
- for_each(vNodesCopy.begin(), vNodesCopy.end(), Release);
+ for(CNode* pnode : vNodesCopy)
+ pnode->Release();
}
Sleep(10);
{
LOCK(cs_vNodes);
- for_each(vNodesCopy.begin(), vNodesCopy.end(), Release);
+ for(CNode* pnode : vNodesCopy)
+ pnode->Release();
}
// Wait and allow messages to bunch up.
// Settings
static proxyType proxyInfo[NET_MAX];
-static proxyType nameproxyInfo;
+static CService nameProxy;
static CCriticalSection cs_proxyInfos;
int nConnectTimeout = 5000;
bool fNameLookup = false;
return Lookup(pszName, addr, portDefault, false);
}
-bool static Socks4(const CService &addrDest, SOCKET& hSocket)
-{
- printf("SOCKS4 connecting %s\n", addrDest.ToString().c_str());
- if (!addrDest.IsIPv4())
- {
- CloseSocket(hSocket);
- return error("Proxy destination is not IPv4");
- }
- char pszSocks4IP[] = "\4\1\0\0\0\0\0\0user";
- struct sockaddr_in addr;
- socklen_t len = sizeof(addr);
- if (!addrDest.GetSockAddr((struct sockaddr*)&addr, &len) || addr.sin_family != AF_INET)
- {
- CloseSocket(hSocket);
- return error("Cannot get proxy destination address");
- }
- memcpy(pszSocks4IP + 2, &addr.sin_port, 2);
- memcpy(pszSocks4IP + 4, &addr.sin_addr, 4);
- char* pszSocks4 = pszSocks4IP;
- int nSize = sizeof(pszSocks4IP);
-
- int ret = send(hSocket, pszSocks4, nSize, MSG_NOSIGNAL);
- if (ret != nSize)
- {
- CloseSocket(hSocket);
- return error("Error sending to proxy");
- }
- char pchRet[8];
- if (recv(hSocket, pchRet, 8, 0) != 8)
- {
- CloseSocket(hSocket);
- return error("Error reading proxy response");
- }
- if (pchRet[1] != 0x5a)
- {
- CloseSocket(hSocket);
- if (pchRet[1] != 0x5b)
- printf("ERROR: Proxy returned error %d\n", pchRet[1]);
- return false;
- }
- printf("SOCKS4 connected %s\n", addrDest.ToString().c_str());
- return true;
-}
-
bool static Socks5(string strDest, uint16_t port, SOCKET& hSocket)
{
printf("SOCKS5 connecting %s\n", strDest.c_str());
return true;
}
-bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion) {
+bool SetProxy(enum Network net, CService addrProxy) {
assert(net >= 0 && net < NET_MAX);
- if (nSocksVersion != 0 && nSocksVersion != 4 && nSocksVersion != 5)
- return false;
- if (nSocksVersion != 0 && !addrProxy.IsValid())
+ if (!addrProxy.IsValid())
return false;
LOCK(cs_proxyInfos);
- proxyInfo[net] = std::make_pair(addrProxy, nSocksVersion);
+ proxyInfo[net] = addrProxy;
return true;
}
bool GetProxy(enum Network net, proxyType &proxyInfoOut) {
assert(net >= 0 && net < NET_MAX);
LOCK(cs_proxyInfos);
- if (!proxyInfo[net].second)
+ if (!proxyInfo[net].IsValid())
return false;
proxyInfoOut = proxyInfo[net];
return true;
}
-bool SetNameProxy(CService addrProxy, int nSocksVersion) {
- if (nSocksVersion != 0 && nSocksVersion != 5)
- return false;
- if (nSocksVersion != 0 && !addrProxy.IsValid())
+bool SetNameProxy(CService addrProxy) {
+ if (!addrProxy.IsValid())
return false;
LOCK(cs_proxyInfos);
- nameproxyInfo = std::make_pair(addrProxy, nSocksVersion);
+ nameProxy = addrProxy;
return true;
}
-bool GetNameProxy(proxyType &nameproxyInfoOut) {
+bool GetNameProxy(CService &nameProxyOut) {
LOCK(cs_proxyInfos);
- if (!nameproxyInfo.second)
+ if (!nameProxy.IsValid())
return false;
- nameproxyInfoOut = nameproxyInfo;
+ nameProxyOut = nameProxy;
return true;
}
bool HaveNameProxy() {
LOCK(cs_proxyInfos);
- return nameproxyInfo.second != 0;
+ return nameProxy.IsValid();
}
bool IsProxy(const CNetAddr &addr) {
LOCK(cs_proxyInfos);
for (int i = 0; i < NET_MAX; i++) {
- if (proxyInfo[i].second && (addr == (CNetAddr)proxyInfo[i].first))
+ if (addr == (CNetAddr)proxyInfo[i])
return true;
}
return false;
SOCKET hSocket = INVALID_SOCKET;
// first connect to proxy server
- if (!ConnectSocketDirectly(proxy.first, hSocket, nTimeout))
+ if (!ConnectSocketDirectly(proxy, hSocket, nTimeout))
return false;
// do socks negotiation
- switch (proxy.second) {
- case 4:
- if (!Socks4(addrDest, hSocket))
- return false;
- break;
- case 5:
- if (!Socks5(addrDest.ToStringIP(), addrDest.GetPort(), hSocket))
- return false;
- break;
- default:
- CloseSocket(hSocket);
+ if (!Socks5(addrDest.ToStringIP(), addrDest.GetPort(), hSocket))
return false;
- }
hSocketRet = hSocket;
return true;
SOCKET hSocket = INVALID_SOCKET;
- proxyType nameproxy;
- GetNameProxy(nameproxy);
+ CService nameProxy;
+ GetNameProxy(nameProxy);
- CService addrResolved(CNetAddr(strDest, fNameLookup && !nameproxy.second), port);
+ CService addrResolved(CNetAddr(strDest, fNameLookup && !HaveNameProxy()), port);
if (addrResolved.IsValid()) {
addr = addrResolved;
return ConnectSocket(addr, hSocketRet, nTimeout);
}
addr = CService("0.0.0.0:0");
- if (!nameproxy.second)
+ if (!HaveNameProxy)
return false;
- if (!ConnectSocketDirectly(nameproxy.first, hSocket, nTimeout))
+ // first connect to name proxy server
+ if (!ConnectSocketDirectly(nameProxy, hSocket, nTimeout))
+ return false;
+ // do socks negotiation
+ if (!Socks5(strDest, port, hSocket))
return false;
-
- switch(nameproxy.second) {
- default:
- case 4:
- CloseSocket(hSocket);
- return false;
- case 5:
- if (!Socks5(strDest, port, hSocket))
- return false;
- break;
- }
hSocketRet = hSocket;
return true;
)
};
-typedef std::pair<CService, int> proxyType;
+typedef CService proxyType;
enum Network ParseNetwork(std::string net);
void SplitHostPort(std::string in, uint16_t &portOut, std::string &hostOut);
-bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion = 5);
+bool SetProxy(enum Network net, CService addrProxy);
bool GetProxy(enum Network net, proxyType &proxyInfoOut);
bool IsProxy(const CNetAddr &addr);
-bool SetNameProxy(CService addrProxy, int nSocksVersion = 5);
+bool SetNameProxy(CService addrProxy);
bool HaveNameProxy();
bool LookupHost(const std::string& strName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0, bool fAllowLookup = true);
bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0, bool fAllowLookup = true);
}
}
+#ifdef USE_QRCODE
void AddressBookPage::on_showQRCode_clicked()
{
- #ifdef USE_QRCODE
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
-#endif
}
+#endif
void AddressBookPage::contextualMenu(const QPoint &point)
{
void on_signMessage_clicked();
void on_verifyMessage_clicked();
void selectionChanged();
+#ifdef USE_QRCODE
void on_showQRCode_clicked();
+#endif
/** Spawn contextual menu (right mouse menu) for address book entry */
void contextualMenu(const QPoint &point);
</widget>
</item>
<item>
- <widget class="QLabel" name="socksVersionLabel">
- <property name="text">
- <string>SOCKS &Version:</string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
- </property>
- <property name="buddy">
- <cstring>socksVersion</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QValueComboBox" name="socksVersion">
- <property name="toolTip">
- <string>SOCKS version of the proxy (e.g. 5)</string>
- </property>
- </widget>
- </item>
- <item>
<spacer name="horizontalSpacer_Network">
<property name="orientation">
<enum>Qt::Horizontal</enum>
QMessageBox::warning(this, tr("Error"), tr("Redeem script exceeds size limit: %1 > %2\nReduce the number of addresses involved in the address creation.").arg(script.size()).arg(MAX_SCRIPT_ELEMENT_SIZE), QMessageBox::Ok);
return;
}
- CScriptID scriptID = script.GetID();
+ CScriptID scriptID(script);
CBitcoinAddress address(scriptID);
ui->multisigAddress->setText(address.ToString().c_str());
std::string redeemScript = ui->redeemScript->text().toStdString();
std::vector<unsigned char> scriptData(ParseHex(redeemScript));
CScript script(scriptData.begin(), scriptData.end());
- CScriptID scriptID = script.GetID();
+ CScriptID scriptID(script);
LOCK(wallet->cs_wallet);
if(!wallet->HaveCScript(scriptID))
std::vector<unsigned char> scriptData(ParseHex(redeemScript));
CScript script(scriptData.begin(), scriptData.end());
- CScriptID scriptID = script.GetID();
+ CScriptID scriptID(script);
LOCK(wallet->cs_wallet);
if(!wallet->HaveCScript(scriptID))
ui->TorOnly->setEnabled(false);
ui->torName->setEnabled(false);
- ui->socksVersion->setEnabled(false);
- ui->socksVersion->addItem("5", 5);
- ui->socksVersion->addItem("4", 4);
- ui->socksVersion->setCurrentIndex(0);
-
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
- connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));
connect(ui->connectTor, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Tor()));
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
- mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
mapper->addMapping(ui->connectTor, OptionsModel::TorUse);
mapper->addMapping(ui->torIp, OptionsModel::TorIP);
{
QSettings settings;
CService addrProxy(settings.value("addrProxy", "127.0.0.1:9050").toString().toStdString());
- int nSocksVersion(settings.value("nSocksVersion", 5).toInt());
if (!settings.value("fUseProxy", false).toBool()) {
addrProxy = CService();
- nSocksVersion = 0;
return false;
}
- if (nSocksVersion && !addrProxy.IsValid())
+ if (!addrProxy.IsValid())
return false;
if (!IsLimited(NET_IPV4))
- SetProxy(NET_IPV4, addrProxy, nSocksVersion);
- if (nSocksVersion > 4) {
+ SetProxy(NET_IPV4, addrProxy);
#ifdef USE_IPV6
if (!IsLimited(NET_IPV6))
- SetProxy(NET_IPV6, addrProxy, nSocksVersion);
+ SetProxy(NET_IPV6, addrProxy);
#endif
- }
- SetNameProxy(addrProxy, nSocksVersion);
+ SetNameProxy(addrProxy);
return true;
}
if (!addrTor.IsValid())
return false;
- SetProxy(NET_TOR, addrTor, 5);
+ SetProxy(NET_TOR, addrTor);
SetReachable(NET_TOR);
return true;
case ProxyIP: {
proxyType proxy;
if (GetProxy(NET_IPV4, proxy))
- return QVariant(QString::fromStdString(proxy.first.ToStringIP()));
+ return QVariant(QString::fromStdString(proxy.ToStringIP()));
else
return QVariant(QString::fromStdString("127.0.0.1"));
}
case ProxyPort: {
proxyType proxy;
if (GetProxy(NET_IPV4, proxy))
- return QVariant(proxy.first.GetPort());
+ return QVariant(proxy.GetPort());
else
return QVariant(nSocksDefault);
}
- case ProxySocksVersion:
- return settings.value("nSocksVersion", 5);
case TorUse:
return settings.value("fUseTor", false);
case TorIP: {
proxyType proxy;
if (GetProxy(NET_TOR, proxy))
- return QVariant(QString::fromStdString(proxy.first.ToStringIP()));
+ return QVariant(QString::fromStdString(proxy.ToStringIP()));
else
return QVariant(QString::fromStdString("127.0.0.1"));
}
case TorPort: {
proxyType proxy;
if (GetProxy(NET_TOR, proxy))
- return QVariant(proxy.first.GetPort());
+ return QVariant(proxy.GetPort());
else
return QVariant(nSocksDefault);
}
break;
case ProxyIP: {
proxyType proxy;
- proxy.first = CService("127.0.0.1", nSocksDefault);
+ proxy = CService("127.0.0.1", nSocksDefault);
GetProxy(NET_IPV4, proxy);
CNetAddr addr(value.toString().toStdString());
- proxy.first.SetIP(addr);
- settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str());
+ proxy.SetIP(addr);
+ settings.setValue("addrProxy", proxy.ToStringIPPort().c_str());
successful = ApplyProxySettings();
}
break;
case ProxyPort: {
proxyType proxy;
- proxy.first = CService("127.0.0.1", nSocksDefault);
- GetProxy(NET_IPV4, proxy);
-
- proxy.first.SetupPort(value.toInt());
- settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str());
- successful = ApplyProxySettings();
- }
- break;
- case ProxySocksVersion: {
- proxyType proxy;
- proxy.second = 5;
+ proxy = CService("127.0.0.1", nSocksDefault);
GetProxy(NET_IPV4, proxy);
- proxy.second = value.toInt();
- settings.setValue("nSocksVersion", proxy.second);
+ proxy.SetupPort(value.toInt());
+ settings.setValue("addrProxy", proxy.ToStringIPPort().c_str());
successful = ApplyProxySettings();
}
break;
break;
case TorIP: {
proxyType proxy;
- proxy.first = CService("127.0.0.1", nSocksDefault);
+ proxy = CService("127.0.0.1", nSocksDefault);
GetProxy(NET_TOR, proxy);
CNetAddr addr(value.toString().toStdString());
- proxy.first.SetIP(addr);
- settings.setValue("addrTor", proxy.first.ToStringIPPort().c_str());
+ proxy.SetIP(addr);
+ settings.setValue("addrTor", proxy.ToStringIPPort().c_str());
successful = ApplyTorSettings();
}
break;
case TorPort: {
proxyType proxy;
- proxy.first = CService("127.0.0.1", nSocksDefault);
+ proxy = CService("127.0.0.1", nSocksDefault);
GetProxy(NET_TOR, proxy);
- proxy.first.SetupPort((uint16_t)value.toUInt());
- settings.setValue("addrTor", proxy.first.ToStringIPPort().c_str());
+ proxy.SetupPort((uint16_t)value.toUInt());
+ settings.setValue("addrTor", proxy.ToStringIPPort().c_str());
successful = ApplyTorSettings();
}
break;
if (params.size() != 0)
{
- CBigNum bnTarget(uint256(params[0].get_str()));
+ uint256 bnTarget(params[0].get_str());
nBits = bnTarget.GetCompact();
}
else
if (dDiff <= 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, diff must be greater than zero");
- CBigNum bnTarget(nPoWBase);
+ uint256 bnTarget(nPoWBase);
bnTarget *= 1000;
bnTarget /= (int) (dDiff * 1000);
nBits = bnTarget.GetCompact();
char phash1[64];
FormatHashBuffers(pblock, pmidstate, pdata, phash1);
- auto hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
+ auto hashTarget = uint256().SetCompact(pblock->nBits);
auto coinbaseTx = pblock->vtx[0];
auto merkle = pblock->GetMerkleBranch(0);
Object result;
- result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata))));
+ result.push_back(Pair("data", HexStr(begin(pdata), end(pdata))));
result.push_back(Pair("target", HexStr(hashTarget.begin(), hashTarget.end())));
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
char phash1[64];
FormatHashBuffers(pblock, pmidstate, pdata, phash1);
- auto hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
+ auto hashTarget = uint256().SetCompact(pblock->nBits);
Object result;
- result.push_back(Pair("midstate", HexStr(BEGIN(pmidstate), END(pmidstate)))); // deprecated
- result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata))));
- result.push_back(Pair("hash1", HexStr(BEGIN(phash1), END(phash1)))); // deprecated
+ result.push_back(Pair("midstate", HexStr(begin(pmidstate), end(pmidstate)))); // deprecated
+ result.push_back(Pair("data", HexStr(begin(pdata), end(pdata))));
+ result.push_back(Pair("hash1", HexStr(begin(phash1), end(phash1)))); // deprecated
result.push_back(Pair("target", HexStr(hashTarget.begin(), hashTarget.end())));
return result;
}
Object aux;
aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
- auto hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
+ auto hashTarget = uint256().SetCompact(pblock->nBits);
static Array aMutable;
if (aMutable.empty())
}
ScriptPubKeyToJSON(script, r, false);
- r.push_back(Pair("p2sh", CBitcoinAddress(script.GetID()).ToString()));
+ r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
return r;
}
throw runtime_error(
strprintf("redeemScript exceeds size limit: %" PRIszu " > %d", inner.size(), MAX_SCRIPT_ELEMENT_SIZE));
- auto innerID = inner.GetID();
+ auto innerID = CScriptID(inner);
CBitcoinAddress address(innerID);
Object result;
obj.push_back(Pair("moneysupply", ValueFromAmount(pindexBest->nMoneySupply)));
obj.push_back(Pair("connections", (int)vNodes.size()));
- obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
+ obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.ToStringIPPort() : string())));
obj.push_back(Pair("ip", addrSeenByPeer.ToStringIP()));
diff.push_back(Pair("proof-of-work", GetDifficulty()));
strprintf("redeemScript exceeds size limit: %" PRIszu " > %d", inner.size(), MAX_SCRIPT_ELEMENT_SIZE));
pwalletMain->AddCScript(inner);
- CBitcoinAddress address(inner.GetID());
+ CBitcoinAddress address{ CScriptID(inner) }; // "most vexing parse"
pwalletMain->SetAddressBookName(address, strAccount);
return address.ToString();
auto innerData = ParseHexV(params[0], "redeemScript");
CScript inner(innerData.begin(), innerData.end());
pwalletMain->AddCScript(inner);
- CBitcoinAddress address(inner.GetID());
+ CBitcoinAddress address{ CScriptID(inner) }; // "most vexing parse"
pwalletMain->SetAddressBookName(address, strAccount);
return address.ToString();
if (whichType == TX_PUBKEY)
{
- addressRet = CPubKey(vSolutions[0]).GetID();
+ CPubKey pubKey(vSolutions[0]);
+ if (!pubKey.IsValid())
+ return false;
+
+ addressRet = pubKey.GetID();
return true;
}
else if (whichType == TX_PUBKEYHASH)
nRequiredRet = vSolutions.front()[0];
for (unsigned int i = 1; i < vSolutions.size()-1; i++)
{
- CTxDestination address = CPubKey(vSolutions[i]).GetID();
+ CPubKey pubKey(vSolutions[i]);
+ if (!pubKey.IsValid())
+ continue;
+
+ CTxDestination address = pubKey.GetID();
addressRet.push_back(address);
}
+
+ if (addressRet.empty())
+ return false;
}
else
{
{
printf("%s\n", ToString().c_str());
}
-
-CScriptID CScript::GetID() const
-{
- return CScriptID(Hash160(*this));
-}
void PrintHex() const;
std::string ToString(bool fShort=false) const;
void print() const;
- CScriptID GetID() const;
};
bool IsCanonicalPubKey(const std::vector<unsigned char> &vchPubKey, unsigned int flags);
-
-
//
// Basic types
//
-
-
//
// Compact size
// size < 253 -- 1 byte
template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const std::tuple<T0, T1, T2>& item, int nType, int nVersion);
template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, std::tuple<T0, T1, T2>& item, int nType, int nVersion);
-// 4 tuple
-template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
-template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
-template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion);
-
// map
template<typename K, typename T, typename Pred, typename A> unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion);
template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m, int nType, int nVersion);
-
//
// If none of the specialized versions above matched, default to calling member function.
// "int nType" is changed to "long nType" to keep from getting an ambiguous overload error.
-
//
// string
//
//
-// 4 tuple
-//
-template<typename T0, typename T1, typename T2, typename T3>
-unsigned int GetSerializeSize(const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
-{
- unsigned int nSize = 0;
- nSize += GetSerializeSize(std::get<0>(item), nType, nVersion);
- nSize += GetSerializeSize(std::get<1>(item), nType, nVersion);
- nSize += GetSerializeSize(std::get<2>(item), nType, nVersion);
- nSize += GetSerializeSize(std::get<3>(item), nType, nVersion);
- return nSize;
-}
-
-template<typename Stream, typename T0, typename T1, typename T2, typename T3>
-void Serialize(Stream& os, const std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
-{
- Serialize(os, std::get<0>(item), nType, nVersion);
- Serialize(os, std::get<1>(item), nType, nVersion);
- Serialize(os, std::get<2>(item), nType, nVersion);
- Serialize(os, std::get<3>(item), nType, nVersion);
-}
-
-template<typename Stream, typename T0, typename T1, typename T2, typename T3>
-void Unserialize(Stream& is, std::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
-{
- Unserialize(is, std::get<0>(item), nType, nVersion);
- Unserialize(is, std::get<1>(item), nType, nVersion);
- Unserialize(is, std::get<2>(item), nType, nVersion);
- Unserialize(is, std::get<3>(item), nType, nVersion);
-}
-
-
-
-//
// map
//
template<typename K, typename T, typename Pred, typename A>
-
-
-
-
-
-
-
typedef std::vector<char, zero_after_free_allocator<char> > CSerializeData;
/** Double ended buffer combining vector and stream-like interfaces.
static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Saturday, 20-Jul-2013 00:00:00 UTC
static const unsigned int CHECKLOCKTIMEVERIFY_SWITCH_TIME = 1461110400; // Wednesday, 20-Apr-16 00:00:00 UTC
+// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
+static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
#endif
* these. Do not add them to the wallet and warn. */
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
{
- auto strAddr = CBitcoinAddress(redeemScript.GetID()).ToString();
+ auto strAddr = CBitcoinAddress(CScriptID(redeemScript)).ToString();
printf("LoadCScript() : Warning: This wallet contains a redeemScript of size %" PRIszu " which exceeds maximum size %i thus can never be redeemed. Do not use address %s.\n",
redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE, strAddr.c_str());
return true;