aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-osx.txt9
-rw-r--r--build-unix.txt2
-rw-r--r--contrib/gitian.yml15
-rw-r--r--db.h12
-rw-r--r--doc/README30
-rw-r--r--doc/README_windows.txt34
-rw-r--r--init.cpp24
-rw-r--r--license.txt2
-rw-r--r--main.cpp61
-rw-r--r--main.h2
-rw-r--r--makefile.unix3
-rw-r--r--net.cpp8
-rw-r--r--rpc.cpp35
-rw-r--r--serialize.h2
-rw-r--r--setup.nsi6
-rw-r--r--ui.cpp24
-rw-r--r--ui.h1
-rw-r--r--util.cpp48
-rw-r--r--util.h11
19 files changed, 238 insertions, 91 deletions
diff --git a/build-osx.txt b/build-osx.txt
index a67a3be2e8..79279838d3 100644
--- a/build-osx.txt
+++ b/build-osx.txt
@@ -59,7 +59,10 @@ cd ~/bitcoin/deps
tar xvjf ~/Downloads/boost_1_42_0.tar.bz2
cd boost_1_42_0
./bootstrap.sh
-./bjam architecture=combined address-model=32_64 macosx-version=10.6 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install
+./bjam architecture=combined address-model=32_64 macosx-version=10.5 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install
+
+If you're using Snow Leopard, you will need to specify 10.6 as your Mac OS X
+version instead of 10.5.
This part takes a while.. use your judgement and fix it if something doesn't
build for some reason.
@@ -90,12 +93,12 @@ tar xvf ~/Downloads/openssl-1.0.0.tar
mv openssl-1.0.0 openssl-1.0.0-x86_64
# build i386 (32 bit intel) binary
cd openssl-1.0.0-i386
-./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin-i386-cc && make
+./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin-i386-cc && make
make install # only do this on one of the architectures, to install the headers
cd ..
# build x86_64 (64 bit intel) binary
cd openssl-1.0.0-x86_64
-./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin64-x86_64-cc && make
+./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin64-x86_64-cc && make
cd ..
# combine the libs
diff --git a/build-unix.txt b/build-unix.txt
index b959f1a2d9..d0cbc40fab 100644
--- a/build-unix.txt
+++ b/build-unix.txt
@@ -73,7 +73,7 @@ tar -xzvf wxWidgets-2.9.0.tar.gz
cd wxWidgets-2.9.0
mkdir buildgtk
cd buildgtk
-../configure --with-gtk --enable-debug --disable-shared --enable-monolithic
+../configure --with-gtk --enable-debug --disable-shared --enable-monolithic --without-libpng --disable-svg
make
sudo su
make install
diff --git a/contrib/gitian.yml b/contrib/gitian.yml
index 92385e50b2..5d12f72700 100644
--- a/contrib/gitian.yml
+++ b/contrib/gitian.yml
@@ -18,20 +18,29 @@ remotes:
"dir": "bitcoin"
files:
- "wxWidgets-2.9.1.tar.bz2"
+- "miniupnpc-1.5.tar.gz"
script: |
INSTDIR="$HOME/install"
export LIBRARY_PATH="$INSTDIR/lib"
+ #
+ tar xzf miniupnpc-1.5.tar.gz
+ cd miniupnpc-1.5
+ INSTALLPREFIX=$INSTDIR make $MAKEOPTS install
+ cd ..
+ #
tar xjf wxWidgets-2.9.1.tar.bz2
cd wxWidgets-2.9.1
./configure --prefix=$INSTDIR --enable-monolithic --disable-shared
perl -i -p -e "s/__TIME__/\"$REFERENCE_TIME\"/;s/__DATE__/\"$REFERENCE_DATE\"/" include/wx/chartype.h
make $MAKEOPTS install
- cd ../bitcoin
+ cd ..
+ #
+ cd bitcoin
mkdir -p $OUTDIR/src
cp -a . $OUTDIR/src
rm -rf $OUTDIR/src/.git
mv $OUTDIR/src/locale $OUTDIR
cp $OUTDIR/src/license.txt $OUTDIR
- make -f makefile.unix $MAKEOPTS WXLIBS="-Wl,-Bstatic -l wx_gtk2u-2.9 -Wl,-Bdynamic -l gtk-x11-2.0 -l SM -l Xxf86vm" INCLUDEPATHS="`$INSTDIR/bin/wx-config --cflags`" bitcoin bitcoind
+ PATH=$INSTDIR/bin:$PATH make -f makefile.unix CXX="g++ -I$INSTDIR/include -L$INSTDIR/lib" $MAKEOPTS bitcoin bitcoind
mkdir -p $OUTDIR/bin/$GBUILD_BITS
- cp bitcoin bitcoind $OUTDIR/bin/$GBUILD_BITS
+ install -s bitcoin bitcoind $OUTDIR/bin/$GBUILD_BITS
diff --git a/db.h b/db.h
index c9c40d58c6..290981c06a 100644
--- a/db.h
+++ b/db.h
@@ -13,6 +13,7 @@ class CAddress;
class CWalletTx;
class CAccount;
class CAccountingEntry;
+class CBlockLocator;
extern map<string, string> mapAddressBook;
extern CCriticalSection cs_mapAddressBook;
@@ -405,6 +406,17 @@ public:
return Write(make_pair(string("key"), vchPubKey), vchPrivKey, false);
}
+ bool WriteBestBlock(const CBlockLocator& locator)
+ {
+ nWalletDBUpdated++;
+ return Write(string("bestblock"), locator);
+ }
+
+ bool ReadBestBlock(CBlockLocator& locator)
+ {
+ return Read(string("bestblock"), locator);
+ }
+
bool ReadDefaultKey(vector<unsigned char>& vchPubKey)
{
vchPubKey.clear();
diff --git a/doc/README b/doc/README
new file mode 100644
index 0000000000..3137d0adc7
--- /dev/null
+++ b/doc/README
@@ -0,0 +1,30 @@
+Bitcoin 0.3.21 BETA
+
+Copyright (c) 2009-2011 Bitcoin Developers
+Distributed under the MIT/X11 software license, see the accompanying
+file license.txt or http://www.opensource.org/licenses/mit-license.php.
+This product includes software developed by the OpenSSL Project for use in
+the OpenSSL Toolkit (http://www.openssl.org/). This product includes
+cryptographic software written by Eric Young (eay@cryptsoft.com).
+
+
+Intro
+-----
+Bitcoin is a free open source peer-to-peer electronic cash system that is
+completely decentralized, without the need for a central server or trusted
+parties. Users hold the crypto keys to their own money and transact directly
+with each other, with the help of a P2P network to check for double-spending.
+
+
+Setup
+-----
+Unpack the files into a directory and run:
+ bin/32/bitcoin (GUI, 32-bit)
+ bin/32/bitcoind (headless, 32-bit)
+ bin/64/bitcoin (GUI, 64-bit)
+ bin/64/bitcoind (headless, 64-bit)
+
+See the documentation at the bitcoin wiki:
+ https://en.bitcoin.it/wiki/Main_Page
+
+... for help and more information.
diff --git a/doc/README_windows.txt b/doc/README_windows.txt
new file mode 100644
index 0000000000..4c2065235b
--- /dev/null
+++ b/doc/README_windows.txt
@@ -0,0 +1,34 @@
+Bitcoin 0.3.21 BETA
+
+Copyright (c) 2009-2011 Bitcoin Developers
+Distributed under the MIT/X11 software license, see the accompanying
+file license.txt or http://www.opensource.org/licenses/mit-license.php.
+This product includes software developed by the OpenSSL Project for use in
+the OpenSSL Toolkit (http://www.openssl.org/). This product includes
+cryptographic software written by Eric Young (eay@cryptsoft.com).
+
+
+Intro
+-----
+Bitcoin is a free open source peer-to-peer electronic cash system that is
+completely decentralized, without the need for a central server or trusted
+parties. Users hold the crypto keys to their own money and transact directly
+with each other, with the help of a P2P network to check for double-spending.
+
+
+Setup
+-----
+Unpack the files into a directory and run bitcoin.exe.
+
+If you have Microsoft Security Essentials, you need to add bitcoin.exe to its
+"Excluded processes" list. Microsoft Security Essentials->Settings tab,
+select Excluded processes, press Add, select bitcoin.exe, OK, Save changes.
+
+The software automatically finds other nodes to connect to. You can
+enable Universal Plug and Play using a menu entry or set your firewall
+to forward port 8333 (TCP) to your computer so you can receive
+incoming connections. Bitcoin work without incoming connections,
+but allowing incoming connections helps the Bitcoin network.
+
+See the bitcoin wiki at: https://en.bitcoin.it/wiki/Main_Page
+for more help and information.
diff --git a/init.cpp b/init.cpp
index effac288fc..a8e93140b3 100644
--- a/init.cpp
+++ b/init.cpp
@@ -41,6 +41,7 @@ void Shutdown(void* parg)
DBFlush(false);
StopNode();
DBFlush(true);
+ boost::filesystem::remove(GetPidFile());
CreateThread(ExitTimeout, NULL);
Sleep(50);
printf("Bitcoin exiting\n\n");
@@ -143,7 +144,7 @@ bool AppInit2(int argc, char* argv[])
{
string beta = VERSION_IS_BETA ? _(" beta") : "";
string strUsage = string() +
- _("Bitcoin version") + " " + FormatVersion(VERSION) + pszSubVer + beta + "\n\n" +
+ _("Bitcoin version") + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
" bitcoin [options] \t " + "\n" +
" bitcoin [options] <command> [params]\t " + _("Send command to -server or bitcoind\n") +
@@ -151,6 +152,7 @@ bool AppInit2(int argc, char* argv[])
" bitcoin [options] help <command> \t\t " + _("Get help for a command\n") +
_("Options:\n") +
" -conf=<file> \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") +
+ " -pid=<file> \t\t " + _("Specify pid file (default: bitcoind.pid)\n") +
" -gen \t\t " + _("Generate coins\n") +
" -gen=0 \t\t " + _("Don't generate coins\n") +
" -min \t\t " + _("Start minimized\n") +
@@ -251,7 +253,10 @@ bool AppInit2(int argc, char* argv[])
return false;
}
if (pid > 0)
+ {
+ CreatePidFile(GetPidFile(), pid);
return true;
+ }
pid_t sid = setsid();
if (sid < 0)
@@ -262,7 +267,7 @@ bool AppInit2(int argc, char* argv[])
if (!fDebug && !pszSetDataDir[0])
ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- printf("Bitcoin version %s%s%s\n", FormatVersion(VERSION).c_str(), pszSubVer, VERSION_IS_BETA ? _(" beta") : "");
+ printf("Bitcoin version %s\n", FormatFullVersion().c_str());
#ifdef GUI
printf("OS version %s\n", ((string)wxGetOsDescription()).c_str());
printf("System default language is %d %s\n", g_locale.GetSystemLanguage(), ((string)g_locale.GetSysName()).c_str());
@@ -321,7 +326,7 @@ bool AppInit2(int argc, char* argv[])
// Make sure only a single bitcoin process is using the data directory.
string strLockFile = GetDataDir() + "/.lock";
FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
- fclose(file);
+ if (file) fclose(file);
static boost::interprocess::file_lock lock(strLockFile.c_str());
if (!lock.try_lock())
{
@@ -367,10 +372,21 @@ bool AppInit2(int argc, char* argv[])
strErrors += _("Error loading wallet.dat \n");
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+ CBlockIndex *pindexRescan = pindexBest;
if (GetBoolArg("-rescan"))
+ pindexRescan = pindexGenesisBlock;
+ else
+ {
+ CWalletDB walletdb;
+ CBlockLocator locator;
+ if (walletdb.ReadBestBlock(locator))
+ pindexRescan = locator.GetBlockIndex();
+ }
+ if (pindexBest != pindexRescan)
{
+ printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
nStart = GetTimeMillis();
- ScanForWalletTransactions(pindexGenesisBlock);
+ ScanForWalletTransactions(pindexRescan);
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
}
diff --git a/license.txt b/license.txt
index c27d7b053f..ab042014e8 100644
--- a/license.txt
+++ b/license.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2009-2010 Bitcoin Developers
+Copyright (c) 2009-2011 Bitcoin Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/main.cpp b/main.cpp
index 67db0bce88..7e1e420b35 100644
--- a/main.cpp
+++ b/main.cpp
@@ -178,22 +178,12 @@ bool AddToWallet(const CWalletTx& wtxIn)
return true;
}
-bool AddToWalletIfMine(const CTransaction& tx, const CBlock* pblock)
+bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate = false)
{
- if (tx.IsMine() || mapWallet.count(tx.GetHash()))
- {
- CWalletTx wtx(tx);
- // Get merkle branch if transaction was found in a block
- if (pblock)
- wtx.SetMerkleBranch(pblock);
- return AddToWallet(wtx);
- }
- return true;
-}
-
-bool AddToWalletIfFromMe(const CTransaction& tx, const CBlock* pblock)
-{
- if (tx.IsFromMe() || mapWallet.count(tx.GetHash()))
+ uint256 hash = tx.GetHash();
+ bool fExisted = mapWallet.count(hash);
+ if (fExisted && !fUpdate) return false;
+ if (fExisted || tx.IsMine() || tx.IsFromMe())
{
CWalletTx wtx(tx);
// Get merkle branch if transaction was found in a block
@@ -201,7 +191,7 @@ bool AddToWalletIfFromMe(const CTransaction& tx, const CBlock* pblock)
wtx.SetMerkleBranch(pblock);
return AddToWallet(wtx);
}
- return true;
+ return false;
}
bool EraseFromWallet(uint256 hash)
@@ -691,8 +681,8 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
if (GetSigOpCount() > nSize / 34 || nSize < 100)
return error("AcceptToMemoryPool() : nonstandard transaction");
- // Rather not work on nonstandard transactions
- if (!IsStandard())
+ // Rather not work on nonstandard transactions (unless -testnet)
+ if (!fTestNet && !IsStandard())
return error("AcceptToMemoryPool() : nonstandard transaction type");
// Do we already have it?
@@ -911,22 +901,8 @@ int ScanForWalletTransactions(CBlockIndex* pindexStart)
block.ReadFromDisk(pindex, true);
foreach(CTransaction& tx, block.vtx)
{
- uint256 hash = tx.GetHash();
- if (mapWallet.count(hash)) continue;
- AddToWalletIfMine(tx, &block);
- if (mapWallet.count(hash))
- {
- ++ret;
- printf("Added missing RECEIVE %s\n", hash.ToString().c_str());
- continue;
- }
- AddToWalletIfFromMe(tx, &block);
- if (mapWallet.count(hash))
- {
- ++ret;
- printf("Added missing SEND %s\n", hash.ToString().c_str());
- continue;
- }
+ if (AddToWalletIfInvolvingMe(tx, &block))
+ ret++;
}
pindex = pindex->pnext;
}
@@ -1471,7 +1447,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
// Watch for transactions paying to me
foreach(CTransaction& tx, vtx)
- AddToWalletIfMine(tx, this);
+ AddToWalletIfInvolvingMe(tx, this, true);
return true;
}
@@ -1611,6 +1587,15 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
}
}
+ // Update best block in wallet (so we can detect restored wallets)
+ if (!IsInitialBlockDownload())
+ {
+ CWalletDB walletdb;
+ const CBlockLocator locator(pindexNew);
+ if (!walletdb.WriteBestBlock(locator))
+ return error("SetBestChain() : WriteWalletBest failed");
+ }
+
// New best block
hashBestChain = hash;
pindexBest = pindexNew;
@@ -2705,7 +2690,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
bool fMissingInputs = false;
if (tx.AcceptToMemoryPool(true, &fMissingInputs))
{
- AddToWalletIfMine(tx, NULL);
+ AddToWalletIfInvolvingMe(tx, NULL, true);
RelayMessage(inv, vMsg);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
@@ -2726,7 +2711,7 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (tx.AcceptToMemoryPool(true))
{
printf(" accepted orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str());
- AddToWalletIfMine(tx, NULL);
+ AddToWalletIfInvolvingMe(tx, NULL, true);
RelayMessage(inv, vMsg);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
@@ -4082,7 +4067,7 @@ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAs
{
string strError;
if (nValue + nFeeRequired > GetBalance())
- strError = strprintf(_("Error: This is an oversized transaction that requires a transaction fee of %s "), FormatMoney(nFeeRequired).c_str());
+ strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds "), FormatMoney(nFeeRequired).c_str());
else
strError = _("Error: Transaction creation failed ");
printf("SendMoney() : %s", strError.c_str());
diff --git a/main.h b/main.h
index 355ef5313f..8ff105124e 100644
--- a/main.h
+++ b/main.h
@@ -1028,7 +1028,7 @@ public:
if (!ptx->IsFinal())
return false;
if (ptx->GetDepthInMainChain() >= 1)
- return true;
+ continue;
if (!ptx->IsFromMe())
return false;
diff --git a/makefile.unix b/makefile.unix
index 61b925e3bc..f1ffc2f7ed 100644
--- a/makefile.unix
+++ b/makefile.unix
@@ -32,7 +32,8 @@ LIBS+= \
-Wl,-Bdynamic \
-l gthread-2.0 \
-l z \
- -l dl
+ -l dl \
+ -l pthread
DEBUGFLAGS=-g -D__WXDEBUG__
diff --git a/net.cpp b/net.cpp
index 833aafc0a1..a403655660 100644
--- a/net.cpp
+++ b/net.cpp
@@ -906,7 +906,8 @@ void ThreadMapPort2(void* parg)
struct IGDdatas data;
int r;
- if (UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)) == 1)
+ r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
+ if (r == 1)
{
char intClient[16];
char intPort[6];
@@ -937,9 +938,10 @@ void ThreadMapPort2(void* parg)
} else {
printf("No valid UPnP IGDs found\n");
freeUPNPDevlist(devlist); devlist = 0;
- FreeUPNPUrls(&urls);
+ if (r != 0)
+ FreeUPNPUrls(&urls);
loop {
- if (fShutdown)
+ if (fShutdown || !fUseUPnP)
return;
Sleep(2000);
}
diff --git a/rpc.cpp b/rpc.cpp
index 93df5c22a4..90e7f15a91 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -640,40 +640,39 @@ Value getbalance(const Array& params, bool fHelp)
if (params.size() == 0)
return ValueFromAmount(GetBalance());
+ int nMinDepth = 1;
+ if (params.size() > 1)
+ nMinDepth = params[1].get_int();
+
if (params[0].get_str() == "*") {
// Calculate total balance a different way from GetBalance()
// (GetBalance() sums up all unspent TxOuts)
// getbalance and getbalance '*' should always return the same number.
int64 nBalance = 0;
- vector<string> vAccounts;
for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx& wtx = (*it).second;
+ if (!wtx.IsFinal())
+ continue;
+
int64 allGeneratedImmature, allGeneratedMature, allFee;
allGeneratedImmature = allGeneratedMature = allFee = 0;
string strSentAccount;
list<pair<string, int64> > listReceived;
list<pair<string, int64> > listSent;
wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount);
- foreach(const PAIRTYPE(string,int64)& r, listReceived)
- {
- nBalance += r.second;
- if (!count(vAccounts.begin(), vAccounts.end(), r.first))
- vAccounts.push_back(r.first);
- }
+ if (wtx.GetDepthInMainChain() >= nMinDepth)
+ foreach(const PAIRTYPE(string,int64)& r, listReceived)
+ nBalance += r.second;
foreach(const PAIRTYPE(string,int64)& r, listSent)
nBalance -= r.second;
nBalance -= allFee;
nBalance += allGeneratedMature;
}
- printf("Found %d accounts\n", vAccounts.size());
return ValueFromAmount(nBalance);
}
string strAccount = AccountFromValue(params[0]);
- int nMinDepth = 1;
- if (params.size() > 1)
- nMinDepth = params[1].get_int();
int64 nBalance = GetAccountBalance(strAccount, nMinDepth);
@@ -1480,7 +1479,7 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader
{
ostringstream s;
s << "POST / HTTP/1.1\r\n"
- << "User-Agent: json-rpc/1.0\r\n"
+ << "User-Agent: bitcoin-json-rpc/" << FormatFullVersion() << "\r\n"
<< "Host: 127.0.0.1\r\n"
<< "Content-Type: application/json\r\n"
<< "Content-Length: " << strMsg.size() << "\r\n"
@@ -1498,7 +1497,10 @@ string rfc1123Time()
time_t now;
time(&now);
struct tm* now_gmt = gmtime(&now);
- strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S %Z", now_gmt);
+ string locale(setlocale(LC_TIME, NULL));
+ setlocale(LC_TIME, "C"); // we want posix (aka "C") weekday/month strings
+ strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S +0000", now_gmt);
+ setlocale(LC_TIME, locale.c_str());
return string(buffer);
}
@@ -1507,7 +1509,7 @@ string HTTPReply(int nStatus, const string& strMsg)
if (nStatus == 401)
return strprintf("HTTP/1.0 401 Authorization Required\r\n"
"Date: %s\r\n"
- "Server: bitcoin-json-rpc\r\n"
+ "Server: bitcoin-json-rpc/%s\r\n"
"WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 296\r\n"
@@ -1520,7 +1522,7 @@ string HTTPReply(int nStatus, const string& strMsg)
"<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>\r\n"
"</HEAD>\r\n"
"<BODY><H1>401 Unauthorized.</H1></BODY>\r\n"
- "</HTML>\r\n", rfc1123Time().c_str());
+ "</HTML>\r\n", rfc1123Time().c_str(), FormatFullVersion().c_str());
string strStatus;
if (nStatus == 200) strStatus = "OK";
else if (nStatus == 400) strStatus = "Bad Request";
@@ -1532,13 +1534,14 @@ string HTTPReply(int nStatus, const string& strMsg)
"Connection: close\r\n"
"Content-Length: %d\r\n"
"Content-Type: application/json\r\n"
- "Server: bitcoin-json-rpc/1.0\r\n"
+ "Server: bitcoin-json-rpc/%s\r\n"
"\r\n"
"%s",
nStatus,
strStatus.c_str(),
rfc1123Time().c_str(),
strMsg.size(),
+ FormatFullVersion().c_str(),
strMsg.c_str());
}
diff --git a/serialize.h b/serialize.h
index 383c987864..ee39c0703d 100644
--- a/serialize.h
+++ b/serialize.h
@@ -25,7 +25,7 @@ class CDataStream;
class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000;
-static const int VERSION = 32100;
+static const int VERSION = 32200;
static const char* pszSubVer = "";
static const bool VERSION_IS_BETA = true;
diff --git a/setup.nsi b/setup.nsi
index 2b5900a407..b17e553372 100644
--- a/setup.nsi
+++ b/setup.nsi
@@ -4,7 +4,7 @@ RequestExecutionLevel highest
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
-!define VERSION 0.3.20
+!define VERSION 0.3.22
!define COMPANY "Bitcoin project"
!define URL http://www.bitcoin.org/
@@ -39,12 +39,12 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English
# Installer attributes
-OutFile bitcoin-0.3.20-win32-setup.exe
+OutFile bitcoin-0.3.22-win32-setup.exe
InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on
XPStyle on
ShowInstDetails show
-VIProductVersion 0.3.20.0
+VIProductVersion 0.3.22.0
VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
diff --git a/ui.cpp b/ui.cpp
index 14711d029a..5e53489116 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -1805,7 +1805,7 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
{
- m_staticTextVersion->SetLabel(strprintf(_("version %s%s BETA"), FormatVersion(VERSION).c_str(), pszSubVer));
+ m_staticTextVersion->SetLabel(strprintf(_("version %s"), FormatFullVersion().c_str()));
// Change (c) into UTF-8 or ANSI copyright symbol
wxString str = m_staticTextMain->GetLabel();
@@ -1850,6 +1850,7 @@ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDi
m_bitmapCheckMark->Show(false);
fEnabledPrev = true;
m_textCtrlAddress->SetFocus();
+
//// todo: should add a display of your balance for convenience
#ifndef __WXMSW__
wxFont fontTmp = m_staticTextInstructions->GetFont();
@@ -1858,7 +1859,7 @@ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDi
m_staticTextInstructions->SetFont(fontTmp);
SetSize(725, 180);
#endif
-
+
// Set Icon
wxIcon iconSend;
iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm));
@@ -2238,7 +2239,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
if (!CreateTransaction(scriptPubKey, nPrice, wtx, reservekey, nFeeRequired))
{
if (nPrice + nFeeRequired > GetBalance())
- Error(strprintf(_("This is an oversized transaction that requires a transaction fee of %s"), FormatMoney(nFeeRequired).c_str()));
+ Error(strprintf(_("This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds"), FormatMoney(nFeeRequired).c_str()));
else
Error(_("Transaction creation failed"));
return;
@@ -2596,6 +2597,7 @@ void CAddressBookDialog::OnClose(wxCloseEvent& event)
enum
{
ID_TASKBAR_RESTORE = 10001,
+ ID_TASKBAR_SEND,
ID_TASKBAR_OPTIONS,
ID_TASKBAR_GENERATE,
ID_TASKBAR_EXIT,
@@ -2604,6 +2606,7 @@ enum
BEGIN_EVENT_TABLE(CMyTaskBarIcon, wxTaskBarIcon)
EVT_TASKBAR_LEFT_DCLICK(CMyTaskBarIcon::OnLeftButtonDClick)
EVT_MENU(ID_TASKBAR_RESTORE, CMyTaskBarIcon::OnMenuRestore)
+ EVT_MENU(ID_TASKBAR_SEND, CMyTaskBarIcon::OnMenuSend)
EVT_MENU(ID_TASKBAR_OPTIONS, CMyTaskBarIcon::OnMenuOptions)
EVT_UPDATE_UI(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnUpdateUIGenerate)
EVT_MENU(ID_TASKBAR_EXIT, CMyTaskBarIcon::OnMenuExit)
@@ -2614,9 +2617,9 @@ void CMyTaskBarIcon::Show(bool fShow)
static char pszPrevTip[200];
if (fShow)
{
- string strTooltip = _("Bitcoin");
+ string strTooltip = strprintf(_("Balance: %s"), FormatMoney(GetBalance()).c_str());
if (fGenerateBitcoins)
- strTooltip = _("Bitcoin - Generating");
+ strTooltip = strprintf(_("Bitcoin - Generating (Balance: %s)"), FormatMoney(GetBalance()).c_str());
if (fGenerateBitcoins && vNodes.empty())
strTooltip = _("Bitcoin - (not connected)");
@@ -2655,6 +2658,13 @@ void CMyTaskBarIcon::OnMenuRestore(wxCommandEvent& event)
Restore();
}
+void CMyTaskBarIcon::OnMenuSend(wxCommandEvent& event)
+{
+ // Taskbar: Send
+ CSendDialog dialog(pframeMain);
+ dialog.ShowModal();
+}
+
void CMyTaskBarIcon::OnMenuOptions(wxCommandEvent& event)
{
// Since it's modal, get the main window to do it
@@ -2691,6 +2701,7 @@ wxMenu* CMyTaskBarIcon::CreatePopupMenu()
{
wxMenu* pmenu = new wxMenu;
pmenu->Append(ID_TASKBAR_RESTORE, _("&Open Bitcoin"));
+ pmenu->Append(ID_TASKBAR_SEND, _("&Send Bitcoins"));
pmenu->Append(ID_TASKBAR_OPTIONS, _("O&ptions..."));
#ifndef __WXMAC_OSX__ // Mac has built-in quit menu
pmenu->AppendSeparator();
@@ -2823,9 +2834,6 @@ bool CMyApp::OnInit()
extern int g_isPainting;
g_isPainting = 10000;
#endif
-#ifdef GUI
- wxImage::AddHandler(new wxPNGHandler);
-#endif
#if defined(__WXMSW__ ) || defined(__WXMAC_OSX__)
SetAppName("Bitcoin");
#else
diff --git a/ui.h b/ui.h
index af97d5abb1..05c4ee9a4f 100644
--- a/ui.h
+++ b/ui.h
@@ -323,6 +323,7 @@ protected:
// Event handlers
void OnLeftButtonDClick(wxTaskBarIconEvent& event);
void OnMenuRestore(wxCommandEvent& event);
+ void OnMenuSend(wxCommandEvent& event);
void OnMenuOptions(wxCommandEvent& event);
void OnUpdateUIGenerate(wxUpdateUIEvent& event);
void OnMenuGenerate(wxCommandEvent& event);
diff --git a/util.cpp b/util.cpp
index 655626dd3b..2359616689 100644
--- a/util.cpp
+++ b/util.cpp
@@ -747,6 +747,25 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
}
}
+string GetPidFile()
+{
+ namespace fs = boost::filesystem;
+ fs::path pathConfig(GetArg("-pid", "bitcoind.pid"));
+ if (!pathConfig.is_complete())
+ pathConfig = fs::path(GetDataDir()) / pathConfig;
+ return pathConfig.string();
+}
+
+void CreatePidFile(string pidFile, pid_t pid)
+{
+ FILE* file;
+ if (file = fopen(pidFile.c_str(), "w"))
+ {
+ fprintf(file, "%d\n", pid);
+ fclose(file);
+ }
+}
+
int GetFilesize(FILE* file)
{
int nSavePos = ftell(file);
@@ -855,3 +874,32 @@ void AddTimeData(unsigned int ip, int64 nTime)
printf("| nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
}
}
+
+
+
+
+
+
+
+
+
+string FormatVersion(int nVersion)
+{
+ if (nVersion%100 == 0)
+ return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100);
+ else
+ return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100);
+}
+
+string FormatFullVersion()
+{
+ string s = FormatVersion(VERSION) + pszSubVer;
+ if (VERSION_IS_BETA)
+ s += _("-beta");
+ return s;
+}
+
+
+
+
+
diff --git a/util.h b/util.h
index 2a7dbb5107..44afffcbf6 100644
--- a/util.h
+++ b/util.h
@@ -172,6 +172,8 @@ bool WildcardMatch(const string& str, const string& mask);
int GetFilesize(FILE* file);
void GetDataDir(char* pszDirRet);
string GetConfigFile();
+string GetPidFile();
+void CreatePidFile(string pidFile, pid_t pid);
void ReadConfigFile(map<string, string>& mapSettingsRet, map<string, vector<string> >& mapMultiSettingsRet);
#ifdef __WXMSW__
string MyGetSpecialFolderPath(int nFolder, bool fCreate);
@@ -184,6 +186,7 @@ uint64 GetRand(uint64 nMax);
int64 GetTime();
int64 GetAdjustedTime();
void AddTimeData(unsigned int ip, int64 nTime);
+string FormatFullVersion();
@@ -431,14 +434,6 @@ inline bool GetBoolArg(const string& strArg)
return false;
}
-inline string FormatVersion(int nVersion)
-{
- if (nVersion%100 == 0)
- return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100);
- else
- return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100);
-}
-