Browse Source

Sync to bitcoin git e94010b239

0.8
Wladimir J. van der Laan 14 years ago
parent
commit
ae3d0aba15
  1. 25
      src/bitcoinrpc.cpp
  2. 4
      src/init.cpp
  3. 1
      src/keystore.cpp
  4. 19
      src/main.cpp
  5. 41
      src/net.cpp
  6. 2
      src/net.h
  7. 16
      src/qt/addresstablemodel.cpp
  8. 2
      src/serialize.h
  9. 7
      src/util.cpp
  10. 101
      src/wallet.cpp
  11. 9
      src/wallet.h

25
src/bitcoinrpc.cpp

@ -13,7 +13,7 @@
#include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#ifdef USE_SSL #ifdef USE_SSL
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream; typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
@ -332,12 +332,15 @@ Value getnewaddress(const Array& params, bool fHelp)
// Generate a new key that is added to wallet // Generate a new key that is added to wallet
string strAddress = PubKeyToAddress(pwalletMain->GetKeyFromKeyPool()); string strAddress = PubKeyToAddress(pwalletMain->GetKeyFromKeyPool());
pwalletMain->SetAddressBookName(strAddress, strAccount); // This could be done in the same main CS as GetKeyFromKeyPool.
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
pwalletMain->SetAddressBookName(strAddress, strAccount);
return strAddress; return strAddress;
} }
// requires cs_main, cs_mapWallet locks // requires cs_main, cs_mapWallet, cs_mapAddressBook locks
string GetAccountAddress(string strAccount, bool bForceNew=false) string GetAccountAddress(string strAccount, bool bForceNew=false)
{ {
string strAddress; string strAddress;
@ -393,6 +396,7 @@ Value getaccountaddress(const Array& params, bool fHelp)
CRITICAL_BLOCK(cs_main) CRITICAL_BLOCK(cs_main)
CRITICAL_BLOCK(pwalletMain->cs_mapWallet) CRITICAL_BLOCK(pwalletMain->cs_mapWallet)
CRITICAL_BLOCK(pwalletMain->cs_mapAddressBook)
{ {
ret = GetAccountAddress(strAccount); ret = GetAccountAddress(strAccount);
} }
@ -431,9 +435,10 @@ Value setaccount(const Array& params, bool fHelp)
if (strAddress == GetAccountAddress(strOldAccount)) if (strAddress == GetAccountAddress(strOldAccount))
GetAccountAddress(strOldAccount, true); GetAccountAddress(strOldAccount, true);
} }
pwalletMain->SetAddressBookName(strAddress, strAccount);
} }
pwalletMain->SetAddressBookName(strAddress, strAccount);
return Value::null; return Value::null;
} }
@ -838,7 +843,7 @@ Value sendmany(const Array& params, bool fHelp)
CScript scriptPubKey; CScript scriptPubKey;
if (!scriptPubKey.SetBitcoinAddress(strAddress)) if (!scriptPubKey.SetBitcoinAddress(strAddress))
throw JSONRPCError(-5, string("Invalid bitcoin address:")+strAddress); throw JSONRPCError(-5, string("Invalid bitcoin address:")+strAddress);
int64 nAmount = AmountFromValue(s.value_); int64 nAmount = AmountFromValue(s.value_);
totalAmount += nAmount; totalAmount += nAmount;
vecSend.push_back(make_pair(scriptPubKey, nAmount)); vecSend.push_back(make_pair(scriptPubKey, nAmount));
@ -1156,7 +1161,7 @@ Value listtransactions(const Array& params, bool fHelp)
} }
// ret is now newest to oldest // ret is now newest to oldest
} }
// Make sure we return only last nCount items (sends-to-self might give us an extra): // Make sure we return only last nCount items (sends-to-self might give us an extra):
if (ret.size() > nCount) if (ret.size() > nCount)
{ {
@ -1532,7 +1537,7 @@ string rfc1123Time()
return string(buffer); return string(buffer);
} }
string HTTPReply(int nStatus, const string& strMsg) static string HTTPReply(int nStatus, const string& strMsg)
{ {
if (nStatus == 401) if (nStatus == 401)
return strprintf("HTTP/1.0 401 Authorization Required\r\n" return strprintf("HTTP/1.0 401 Authorization Required\r\n"
@ -1554,6 +1559,7 @@ string HTTPReply(int nStatus, const string& strMsg)
string strStatus; string strStatus;
if (nStatus == 200) strStatus = "OK"; if (nStatus == 200) strStatus = "OK";
else if (nStatus == 400) strStatus = "Bad Request"; else if (nStatus == 400) strStatus = "Bad Request";
else if (nStatus == 403) strStatus = "Forbidden";
else if (nStatus == 404) strStatus = "Not Found"; else if (nStatus == 404) strStatus = "Not Found";
else if (nStatus == 500) strStatus = "Internal Server Error"; else if (nStatus == 500) strStatus = "Internal Server Error";
return strprintf( return strprintf(
@ -1887,7 +1893,12 @@ void ThreadRPCServer2(void* parg)
// Restrict callers by IP // Restrict callers by IP
if (!ClientAllowed(peer.address().to_string())) if (!ClientAllowed(peer.address().to_string()))
{
// Only send a 403 if we're not using SSL to prevent a DoS during the SSL handshake.
if (!fUseSSL)
stream << HTTPReply(403, "") << std::flush;
continue; continue;
}
map<string, string> mapHeaders; map<string, string> mapHeaders;
string strRequest; string strRequest;

4
src/init.cpp

@ -493,7 +493,9 @@ bool AppInit2(int argc, char* argv[])
} }
} }
if (mapArgs.count("-dnsseed")) if (GetBoolArg("-nodnsseed"))
printf("DNS seeding disabled\n");
else
DNSAddressSeed(); DNSAddressSeed();
if (mapArgs.count("-paytxfee")) if (mapArgs.count("-paytxfee"))

1
src/keystore.cpp

@ -29,5 +29,6 @@ bool CKeyStore::AddKey(const CKey& key)
mapKeys[key.GetPubKey()] = key.GetPrivKey(); mapKeys[key.GetPubKey()] = key.GetPrivKey();
mapPubKeys[Hash160(key.GetPubKey())] = key.GetPubKey(); mapPubKeys[Hash160(key.GetPubKey())] = key.GetPubKey();
} }
return true;
} }

19
src/main.cpp

@ -32,8 +32,8 @@ map<COutPoint, CInPoint> mapNextTx;
map<uint256, CBlockIndex*> mapBlockIndex; map<uint256, CBlockIndex*> mapBlockIndex;
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
CBigNum bnProofOfWorkLimit(~uint256(0) >> 32); CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
const int nTotalBlocksEstimate = 131000; // Conservative estimate of total nr of blocks on main chain const int nTotalBlocksEstimate = 134444; // Conservative estimate of total nr of blocks on main chain
const int nInitialBlockThreshold = 10000; // Regard blocks up until N-threshold as "initial download" const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download"
CBlockIndex* pindexGenesisBlock = NULL; CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1; int nBestHeight = -1;
CBigNum bnBestChainWork = 0; CBigNum bnBestChainWork = 0;
@ -1294,7 +1294,8 @@ bool CBlock::AcceptBlock()
(nHeight == 70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) || (nHeight == 70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) ||
(nHeight == 74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) || (nHeight == 74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) ||
(nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) || (nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) ||
(nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553"))) (nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) ||
(nHeight == 134444 && hash != uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")))
return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight); return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight);
// Write block to history file // Write block to history file
@ -1311,7 +1312,7 @@ bool CBlock::AcceptBlock()
if (hashBestChain == hash) if (hashBestChain == hash)
CRITICAL_BLOCK(cs_vNodes) CRITICAL_BLOCK(cs_vNodes)
BOOST_FOREACH(CNode* pnode, vNodes) BOOST_FOREACH(CNode* pnode, vNodes)
if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 118000)) if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 134444))
pnode->PushInventory(CInv(MSG_BLOCK, hash)); pnode->PushInventory(CInv(MSG_BLOCK, hash));
return true; return true;
@ -2040,20 +2041,24 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (pindex) if (pindex)
pindex = pindex->pnext; pindex = pindex->pnext;
int nLimit = 500 + locator.GetDistanceBack(); int nLimit = 500 + locator.GetDistanceBack();
unsigned int nBytes = 0;
printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit); printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit);
for (; pindex; pindex = pindex->pnext) for (; pindex; pindex = pindex->pnext)
{ {
if (pindex->GetBlockHash() == hashStop) if (pindex->GetBlockHash() == hashStop)
{ {
printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str()); printf(" getblocks stopping at %d %s (%u bytes)\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str(), nBytes);
break; break;
} }
pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash()));
if (--nLimit <= 0) CBlock block;
block.ReadFromDisk(pindex, true);
nBytes += block.GetSerializeSize(SER_NETWORK);
if (--nLimit <= 0 || nBytes >= SendBufferSize()/2)
{ {
// When this block is requested, we'll send an inv that'll make them // When this block is requested, we'll send an inv that'll make them
// getblocks the next batch of inventory. // getblocks the next batch of inventory.
printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str()); printf(" getblocks stopping at limit %d %s (%u bytes)\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str(), nBytes);
pfrom->hashContinue = pindex->GetBlockHash(); pfrom->hashContinue = pindex->GetBlockHash();
break; break;
} }

41
src/net.cpp

@ -9,6 +9,15 @@
#include "init.h" #include "init.h"
#include "strlcpy.h" #include "strlcpy.h"
#ifdef __WXMSW__
#include <string.h>
// This file can be downloaded as a part of the Windows Platform SDK
// and is required for Bitcoin binaries to work properly on versions
// of Windows before XP. If you are doing builds of Bitcoin for
// public release, you should uncomment this line.
//#include <WSPiApi.h>
#endif
#ifdef USE_UPNP #ifdef USE_UPNP
#include <miniupnpc/miniwget.h> #include <miniupnpc/miniwget.h>
#include <miniupnpc/miniupnpc.h> #include <miniupnpc/miniupnpc.h>
@ -148,7 +157,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout
} }
if (nRet != 0) if (nRet != 0)
{ {
printf("connect() failed after select(): %i\n",nRet); printf("connect() failed after select(): %s\n",strerror(nRet));
closesocket(hSocket); closesocket(hSocket);
return false; return false;
} }
@ -159,7 +168,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout
else else
#endif #endif
{ {
printf("connect() failed: %s\n",WSAGetLastError()); printf("connect() failed: %i\n",WSAGetLastError());
closesocket(hSocket); closesocket(hSocket);
return false; return false;
} }
@ -915,7 +924,7 @@ void ThreadSocketHandler2(void* parg)
CDataStream& vRecv = pnode->vRecv; CDataStream& vRecv = pnode->vRecv;
unsigned int nPos = vRecv.size(); unsigned int nPos = vRecv.size();
if (nPos > 1000*GetArg("-maxreceivebuffer", 10*1000)) { if (nPos > ReceiveBufferSize()) {
if (!pnode->fDisconnect) if (!pnode->fDisconnect)
printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size()); printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size());
pnode->CloseSocketDisconnect(); pnode->CloseSocketDisconnect();
@ -980,7 +989,7 @@ void ThreadSocketHandler2(void* parg)
pnode->CloseSocketDisconnect(); pnode->CloseSocketDisconnect();
} }
} }
if (vSend.size() > 1000*GetArg("-maxsendbuffer", 10*1000)) { if (vSend.size() > SendBufferSize()) {
if (!pnode->fDisconnect) if (!pnode->fDisconnect)
printf("socket send flood control disconnect (%d bytes)\n", vSend.size()); printf("socket send flood control disconnect (%d bytes)\n", vSend.size());
pnode->CloseSocketDisconnect(); pnode->CloseSocketDisconnect();
@ -1139,25 +1148,29 @@ void MapPort(bool fMapPort)
static const char *strDNSSeed[] = { static const char *strDNSSeed[] = {
"bitseed.xf2.org", "bitseed.xf2.org",
"bitseed.bitcoin.org.uk", "bitseed.bitcoin.org.uk",
"dnsseed.bluematt.me",
}; };
void DNSAddressSeed() void DNSAddressSeed()
{ {
int found = 0; int found = 0;
printf("Loading addresses from DNS seeds (could take a while)\n"); if (!fTestNet)
{
printf("Loading addresses from DNS seeds (could take a while)\n");
for (int seed_idx = 0; seed_idx < ARRAYLEN(strDNSSeed); seed_idx++) { for (int seed_idx = 0; seed_idx < ARRAYLEN(strDNSSeed); seed_idx++) {
vector<CAddress> vaddr; vector<CAddress> vaddr;
if (Lookup(strDNSSeed[seed_idx], vaddr, NODE_NETWORK, -1, true)) if (Lookup(strDNSSeed[seed_idx], vaddr, NODE_NETWORK, -1, true))
{
BOOST_FOREACH (CAddress& addr, vaddr)
{ {
if (addr.GetByte(3) != 127) BOOST_FOREACH (CAddress& addr, vaddr)
{ {
addr.nTime = 0; if (addr.GetByte(3) != 127)
AddAddress(addr); {
found++; addr.nTime = 0;
AddAddress(addr);
found++;
}
} }
} }
} }

2
src/net.h

@ -24,6 +24,8 @@ extern int nConnectTimeout;
inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 10*1000); }
inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 10*1000); }
inline unsigned short GetDefaultPort() { return fTestNet ? 18333 : 8333; } inline unsigned short GetDefaultPort() { return fTestNet ? 18333 : 8333; }
static const unsigned int PUBLISH_HOPS = 5; static const unsigned int PUBLISH_HOPS = 5;
enum enum

16
src/qt/addresstablemodel.cpp

@ -165,10 +165,13 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu
// Double-check that we're not overwriting receiving address // Double-check that we're not overwriting receiving address
if(rec->type == AddressTableEntry::Sending) if(rec->type == AddressTableEntry::Sending)
{ {
// Remove old entry CRITICAL_BLOCK(wallet->cs_mapAddressBook)
wallet->EraseAddressBookName(rec->address.toStdString()); {
// Add new entry with new address // Remove old entry
wallet->SetAddressBookName(value.toString().toStdString(), rec->label.toStdString()); wallet->DelAddressBookName(rec->address.toStdString());
// Add new entry with new address
wallet->SetAddressBookName(value.toString().toStdString(), rec->label.toStdString());
}
rec->address = value.toString(); rec->address = value.toString();
} }
@ -274,7 +277,10 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex & paren
// Also refuse to remove receiving addresses. // Also refuse to remove receiving addresses.
return false; return false;
} }
wallet->EraseAddressBookName(rec->address.toStdString()); CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
wallet->DelAddressBookName(rec->address.toStdString());
}
updateList(); updateList();
return true; return true;
} }

2
src/serialize.h

@ -33,7 +33,7 @@ class CDataStream;
class CAutoFile; class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000; static const unsigned int MAX_SIZE = 0x02000000;
static const int VERSION = 32300; static const int VERSION = 32400;
static const char* pszSubVer = ""; static const char* pszSubVer = "";
static const bool VERSION_IS_BETA = true; static const bool VERSION_IS_BETA = true;

7
src/util.cpp

@ -344,11 +344,6 @@ string FormatMoney(int64 n, bool fPlus)
if (nTrim) if (nTrim)
str.erase(str.size()-nTrim, nTrim); str.erase(str.size()-nTrim, nTrim);
// Insert thousands-separators:
size_t point = str.find(".");
for (int i = (str.size()-point)+3; i < str.size(); i += 4)
if (isdigit(str[str.size() - i - 1]))
str.insert(str.size() - i, 1, ',');
if (n < 0) if (n < 0)
str.insert((unsigned int)0, 1, '-'); str.insert((unsigned int)0, 1, '-');
else if (fPlus && n > 0) else if (fPlus && n > 0)
@ -371,8 +366,6 @@ bool ParseMoney(const char* pszIn, int64& nRet)
p++; p++;
for (; *p; p++) for (; *p; p++)
{ {
if (*p == ',' && p > pszIn && isdigit(p[-1]) && isdigit(p[1]) && isdigit(p[2]) && isdigit(p[3]) && !isdigit(p[4]))
continue;
if (*p == '.') if (*p == '.')
{ {
p++; p++;

101
src/wallet.cpp

@ -98,14 +98,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
BOOST_FOREACH(const CTxOut& txout, wtx.vout) BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{ {
if (txout.scriptPubKey == scriptDefaultKey) if (txout.scriptPubKey == scriptDefaultKey)
{ SetDefaultKey(GetKeyFromKeyPool());
if (!fFileBacked)
continue;
CWalletDB walletdb(strWalletFile);
vchDefaultKey = GetKeyFromKeyPool();
walletdb.WriteDefaultKey(vchDefaultKey);
walletdb.WriteName(PubKeyToAddress(vchDefaultKey), "");
}
} }
#endif #endif
// Notify UI // Notify UI
@ -967,16 +960,33 @@ bool CWallet::LoadWallet(bool& fFirstRunRet)
// Create new default key // Create new default key
RandAddSeedPerfmon(); RandAddSeedPerfmon();
vchDefaultKey = GetKeyFromKeyPool(); SetDefaultKey(GetKeyFromKeyPool());
if (!SetAddressBookName(PubKeyToAddress(vchDefaultKey), "")) if (!SetAddressBookName(PubKeyToAddress(vchDefaultKey), ""))
return false; return false;
CWalletDB(strWalletFile).WriteDefaultKey(vchDefaultKey);
} }
CreateThread(ThreadFlushWalletDB, &strWalletFile); CreateThread(ThreadFlushWalletDB, &strWalletFile);
return true; return true;
} }
bool CWallet::SetAddressBookName(const string& strAddress, const string& strName)
{
mapAddressBook[strAddress] = strName;
if (!fFileBacked)
return false;
return CWalletDB(strWalletFile).WriteName(strAddress, strName);
}
bool CWallet::DelAddressBookName(const string& strAddress)
{
mapAddressBook.erase(strAddress);
if (!fFileBacked)
return false;
return CWalletDB(strWalletFile).EraseName(strAddress);
}
void CWallet::PrintWallet(const CBlock& block) void CWallet::PrintWallet(const CBlock& block)
{ {
CRITICAL_BLOCK(cs_mapWallet) CRITICAL_BLOCK(cs_mapWallet)
@ -1004,6 +1014,17 @@ bool CWallet::GetTransaction(const uint256 &hashTx, CWalletTx& wtx)
return false; return false;
} }
bool CWallet::SetDefaultKey(const std::vector<unsigned char> &vchPubKey)
{
if (fFileBacked)
{
if (!CWalletDB(strWalletFile).WriteDefaultKey(vchPubKey))
return false;
}
vchDefaultKey = vchPubKey;
return true;
}
bool GetWalletFile(CWallet* pwallet, string &strWalletFileOut) bool GetWalletFile(CWallet* pwallet, string &strWalletFileOut)
{ {
if (!pwallet->fFileBacked) if (!pwallet->fFileBacked)
@ -1070,65 +1091,6 @@ void CWallet::ReturnKey(int64 nIndex)
printf("keypool return %"PRI64d"\n", nIndex); printf("keypool return %"PRI64d"\n", nIndex);
} }
bool CWallet::SetAddressBookName(const std::string& strAddress, const std::string& strName)
{
if (!fFileBacked)
return false;
if(CWalletDB(strWalletFile).WriteName(strAddress, strName))
{
CRITICAL_BLOCK(cs_mapAddressBook)
mapAddressBook[strAddress] = strName;
return true;
}
else
{
return false;
}
}
bool CWallet::EraseAddressBookName(const std::string& strAddress)
{
if (!fFileBacked)
return false;
if(CWalletDB(strWalletFile).EraseName(strAddress))
{
CRITICAL_BLOCK(cs_mapAddressBook)
mapAddressBook.erase(strAddress);
return true;
}
else
{
return false;
}
}
std::string CWallet::GetDefaultAddress()
{
if (!fFileBacked)
return false;
std::vector<unsigned char> vchPubKey;
if (CWalletDB(strWalletFile, "r").ReadDefaultKey(vchPubKey))
{
return PubKeyToAddress(vchPubKey);
}
else
{
return "";
}
}
bool CWallet::SetDefaultAddress(const std::string& strAddress)
{
uint160 hash160;
if (!AddressToHash160(strAddress, hash160))
return false;
if (!mapPubKeys.count(hash160))
return false;
return CWalletDB(strWalletFile).WriteDefaultKey(mapPubKeys[hash160]);
}
vector<unsigned char> CWallet::GetKeyFromKeyPool() vector<unsigned char> CWallet::GetKeyFromKeyPool()
{ {
int64 nIndex = 0; int64 nIndex = 0;
@ -1174,3 +1136,4 @@ void CReserveKey::ReturnKey()
nIndex = -1; nIndex = -1;
vchPubKey.clear(); vchPubKey.clear();
} }

9
src/wallet.h

@ -149,10 +149,12 @@ public:
bool LoadWallet(bool& fFirstRunRet); bool LoadWallet(bool& fFirstRunRet);
// bool BackupWallet(const std::string& strDest); // bool BackupWallet(const std::string& strDest);
// requires cs_mapAddressBook lock
bool SetAddressBookName(const std::string& strAddress, const std::string& strName); bool SetAddressBookName(const std::string& strAddress, const std::string& strName);
bool EraseAddressBookName(const std::string& strAddress);
std::string GetDefaultAddress(); // requires cs_mapAddressBook lock
bool SetDefaultAddress(const std::string& strAddress); bool DelAddressBookName(const std::string& strAddress);
void UpdatedTransaction(const uint256 &hashTx) void UpdatedTransaction(const uint256 &hashTx)
{ {
@ -174,6 +176,7 @@ public:
bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx); bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx);
bool SetDefaultKey(const std::vector<unsigned char> &vchPubKey);
}; };

Loading…
Cancel
Save