diff options
-rw-r--r-- | build-osx.txt | 9 | ||||
-rw-r--r-- | build-unix.txt | 11 | ||||
-rw-r--r-- | contrib/gitian.yml | 15 | ||||
-rw-r--r-- | db.cpp | 6 | ||||
-rw-r--r-- | db.h | 12 | ||||
-rw-r--r-- | doc/README | 30 | ||||
-rw-r--r-- | doc/README_windows.txt | 34 | ||||
-rw-r--r-- | init.cpp | 24 | ||||
-rw-r--r-- | license.txt | 2 | ||||
-rw-r--r-- | locale/de/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | locale/es/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | locale/fr/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | locale/it/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | locale/nl/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | locale/pt/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | locale/ru/LC_MESSAGES/bitcoin.po | 5 | ||||
-rw-r--r-- | main.cpp | 143 | ||||
-rw-r--r-- | main.h | 2 | ||||
-rw-r--r-- | makefile.unix | 10 | ||||
-rw-r--r-- | net.cpp | 8 | ||||
-rw-r--r-- | rpc.cpp | 42 | ||||
-rw-r--r-- | serialize.h | 2 | ||||
-rw-r--r-- | setup.nsi | 6 | ||||
-rw-r--r-- | sha256.cpp | 475 | ||||
-rw-r--r-- | ui.cpp | 60 | ||||
-rw-r--r-- | ui.h | 3 | ||||
-rw-r--r-- | uibase.cpp | 25 | ||||
-rw-r--r-- | uibase.h | 52 | ||||
-rw-r--r-- | uiproject.fbp | 196 | ||||
-rw-r--r-- | util.cpp | 48 | ||||
-rw-r--r-- | util.h | 11 |
31 files changed, 277 insertions, 984 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..922a43bd23 100644 --- a/build-unix.txt +++ b/build-unix.txt @@ -37,9 +37,12 @@ You need to download wxWidgets from http://www.wxwidgets.org/downloads/ and build it yourself. See the build instructions and configure parameters below. -Requires miniupnpc for UPnP port mapping. To compile with UPnP support, -install miniupnpc and compile after setting USE_UPNP. It can be downloaded -from http://miniupnp.tuxfamily.org/files/. +Requires miniupnpc for UPnP port mapping. It can be downloaded from +http://miniupnp.tuxfamily.org/files/. UPnP support is compiled in and +turned off by default. Set USE_UPNP to a different value to control this: +USE_UPNP= no UPnP support, miniupnp not required; +USE_UPNP=0 (the default) UPnP support turned off by default at runtime; +USE_UPNP=1 UPnP support turned on by default at runtime. Licenses of statically linked libraries: wxWidgets LGPL 2.1 with very liberal exceptions @@ -73,7 +76,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 @@ -778,10 +778,10 @@ bool CWalletDB::LoadWallet() string strKey; ssKey >> strKey; - // Menu state - if (strKey == "fGenerateBitcoins") ssValue >> fGenerateBitcoins; - // Options +#ifndef GUI + if (strKey == "fGenerateBitcoins") ssValue >> fGenerateBitcoins; +#endif if (strKey == "nTransactionFee") ssValue >> nTransactionFee; if (strKey == "addrIncoming") ssValue >> addrIncoming; if (strKey == "fLimitProcessors") ssValue >> fLimitProcessors; @@ -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.
@@ -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/locale/de/LC_MESSAGES/bitcoin.po b/locale/de/LC_MESSAGES/bitcoin.po index 33b32d17ee..7504db1fcf 100644 --- a/locale/de/LC_MESSAGES/bitcoin.po +++ b/locale/de/LC_MESSAGES/bitcoin.po @@ -531,11 +531,6 @@ msgstr "Bitcoin Ö&ffnen" msgid "O&ptions..." msgstr "O&ptionen..." -#: ../../../ui.cpp:2502 -#: ../../../uibase.cpp:34 -msgid "&Generate Coins" -msgstr "Münzen Er&zeugen" - #: ../../../ui.cpp:2505 #: ../../../uibase.cpp:27 msgid "E&xit" diff --git a/locale/es/LC_MESSAGES/bitcoin.po b/locale/es/LC_MESSAGES/bitcoin.po index 0617ab4b48..5f4bef8732 100644 --- a/locale/es/LC_MESSAGES/bitcoin.po +++ b/locale/es/LC_MESSAGES/bitcoin.po @@ -556,11 +556,6 @@ msgstr "&Abrir Bitcoin" msgid "O&ptions..." msgstr "O&pciones" -#: ../../../ui.cpp:2521 -#: ../../../uibase.cpp:32 -msgid "&Generate Coins" -msgstr "&Generar monedas" - #: ../../../ui.cpp:2524 #: ../../../uibase.cpp:25 msgid "E&xit" diff --git a/locale/fr/LC_MESSAGES/bitcoin.po b/locale/fr/LC_MESSAGES/bitcoin.po index b173364c09..a714e01026 100644 --- a/locale/fr/LC_MESSAGES/bitcoin.po +++ b/locale/fr/LC_MESSAGES/bitcoin.po @@ -559,11 +559,6 @@ msgstr "&Ouvrir Bitcoin" msgid "O&ptions..." msgstr "O&ptions..." -#: ../../../ui.cpp:2521 -#: ../../../uibase.cpp:32 -msgid "&Generate Coins" -msgstr "&Générer des pièces" - #: ../../../ui.cpp:2524 #: ../../../uibase.cpp:25 msgid "E&xit" diff --git a/locale/it/LC_MESSAGES/bitcoin.po b/locale/it/LC_MESSAGES/bitcoin.po index cf13239a1b..ccb74eac99 100644 --- a/locale/it/LC_MESSAGES/bitcoin.po +++ b/locale/it/LC_MESSAGES/bitcoin.po @@ -527,11 +527,6 @@ msgstr "&Apri Bitcoin" msgid "O&ptions..." msgstr "O&pzioni..." -#: ../../../ui.cpp:2502 -#: ../../../uibase.cpp:34 -msgid "&Generate Coins" -msgstr "&Genera monete" - #: ../../../ui.cpp:2505 #: ../../../uibase.cpp:27 msgid "E&xit" diff --git a/locale/nl/LC_MESSAGES/bitcoin.po b/locale/nl/LC_MESSAGES/bitcoin.po index 2e30388dba..399ad8b871 100644 --- a/locale/nl/LC_MESSAGES/bitcoin.po +++ b/locale/nl/LC_MESSAGES/bitcoin.po @@ -528,11 +528,6 @@ msgstr "&Open Bitcoin" msgid "O&ptions..." msgstr "O&pties" -#: ../../../ui.cpp:2502 -#: ../../../uibase.cpp:34 -msgid "&Generate Coins" -msgstr "&Genereer coins" - #: ../../../ui.cpp:2505 #: ../../../uibase.cpp:27 msgid "E&xit" diff --git a/locale/pt/LC_MESSAGES/bitcoin.po b/locale/pt/LC_MESSAGES/bitcoin.po index 9bf193e19b..040fb1da68 100644 --- a/locale/pt/LC_MESSAGES/bitcoin.po +++ b/locale/pt/LC_MESSAGES/bitcoin.po @@ -527,11 +527,6 @@ msgstr "&Abrir Bitcoin" msgid "O&ptions..."
msgstr "O&pções"
-#: ../../../ui.cpp:2502
-#: ../../../uibase.cpp:34
-msgid "&Generate Coins"
-msgstr "&Gerar Moedas"
-
#: ../../../ui.cpp:2505
#: ../../../uibase.cpp:27
msgid "E&xit"
diff --git a/locale/ru/LC_MESSAGES/bitcoin.po b/locale/ru/LC_MESSAGES/bitcoin.po index 5a87259c9e..545f54db2e 100644 --- a/locale/ru/LC_MESSAGES/bitcoin.po +++ b/locale/ru/LC_MESSAGES/bitcoin.po @@ -587,11 +587,6 @@ msgstr "&Открыть Bitcoin" msgid "O&ptions..." msgstr "О&пции..." -#: ../../../ui.cpp:2713 -#: ../../../uibase.cpp:32 -msgid "&Generate Coins" -msgstr "&Генерировать монеты" - #: ../../../ui.cpp:2716 #: ../../../uibase.cpp:25 msgid "E&xit" @@ -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); @@ -3160,71 +3145,6 @@ void ThreadBitcoinMiner(void* parg) printf("ThreadBitcoinMiner exiting, %d threads remaining\n", vnThreadsRunning[3]); } -#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) -void CallCPUID(int in, int& aret, int& cret) -{ - int a, c; - asm ( - "mov %2, %%eax; " // in into eax - "cpuid;" - "mov %%eax, %0;" // eax into a - "mov %%ecx, %1;" // ecx into c - :"=r"(a),"=r"(c) /* output */ - :"r"(in) /* input */ - :"%eax","%ebx","%ecx","%edx" /* clobbered register */ - ); - aret = a; - cret = c; -} - -bool Detect128BitSSE2() -{ - int a, c, nBrand; - CallCPUID(0, a, nBrand); - bool fIntel = (nBrand == 0x6c65746e); // ntel - bool fAMD = (nBrand == 0x444d4163); // cAMD - - struct - { - unsigned int nStepping : 4; - unsigned int nModel : 4; - unsigned int nFamily : 4; - unsigned int nProcessorType : 2; - unsigned int nUnused : 2; - unsigned int nExtendedModel : 4; - unsigned int nExtendedFamily : 8; - } - cpu; - CallCPUID(1, a, c); - memcpy(&cpu, &a, sizeof(cpu)); - int nFamily = cpu.nExtendedFamily + cpu.nFamily; - int nModel = cpu.nExtendedModel*16 + cpu.nModel; - - // We need Intel Nehalem or AMD K10 or better for 128bit SSE2 - // Nehalem = i3/i5/i7 and some Xeon - // K10 = Opterons with 4 or more cores, Phenom, Phenom II, Athlon II - // Intel Core i5 family 6, model 26 or 30 - // Intel Core i7 family 6, model 26 or 30 - // Intel Core i3 family 6, model 37 - // AMD Phenom family 16, model 10 - bool fUseSSE2 = ((fIntel && nFamily * 10000 + nModel >= 60026) || - (fAMD && nFamily * 10000 + nModel >= 160010)); - - // AMD reports a lower model number in 64-bit mode - if (fAMD && sizeof(void*) > 4 && nFamily * 10000 + nModel >= 160000) - fUseSSE2 = true; - - static bool fPrinted; - if (!fPrinted) - { - fPrinted = true; - printf("CPUID %08x family %d, model %d, stepping %d, fUseSSE2=%d\n", nBrand, nFamily, nModel, cpu.nStepping, fUseSSE2); - } - return fUseSSE2; -} -#else -bool Detect128BitSSE2() { return false; } -#endif int FormatHashBlocks(void* pbuffer, unsigned int len) { @@ -3285,9 +3205,6 @@ unsigned int ScanHash_CryptoPP(char* pmidstate, char* pdata, char* phash1, char* } } -extern unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pblock, char* phash1, char* phash, unsigned int& nHashesDone); - - class COrphan { @@ -3561,9 +3478,6 @@ void BitcoinMiner() { printf("BitcoinMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); - bool f4WaySSE2 = Detect128BitSSE2(); - if (mapArgs.count("-4way")) - f4WaySSE2 = GetBoolArg("-4way"); // Each thread has its own key and counter CReserveKey reservekey; @@ -3625,14 +3539,9 @@ void BitcoinMiner() unsigned int nHashesDone = 0; unsigned int nNonceFound; -#ifdef FOURWAYSSE2 - if (f4WaySSE2) - // tcatm's 4-way 128-bit SSE2 SHA-256 - nNonceFound = ScanHash_4WaySSE2(pmidstate, pdata + 64, phash1, (char*)&hash, nHashesDone); - else -#endif - // Crypto++ SHA-256 - nNonceFound = ScanHash_CryptoPP(pmidstate, pdata + 64, phash1, (char*)&hash, nHashesDone); + // Crypto++ SHA-256 + nNonceFound = ScanHash_CryptoPP(pmidstate, pdata + 64, phash1, + (char*)&hash, nHashesDone); // Check if something found if (nNonceFound != -1) @@ -4082,7 +3991,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()); @@ -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..4f2da37894 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__ @@ -62,17 +63,14 @@ obj/%.o: %.cpp $(HEADERS) cryptopp/obj/%.o: cryptopp/%.cpp $(CXX) -c $(CXXFLAGS) -O3 -o $@ $< -obj/sha256.o: sha256.cpp - $(CXX) -c $(CXXFLAGS) -msse2 -O3 -march=amdfam10 -o $@ $< - -bitcoin: $(OBJS) obj/ui.o obj/uibase.o obj/sha256.o +bitcoin: $(OBJS) obj/ui.o obj/uibase.o $(CXX) $(CXXFLAGS) -o $@ $^ $(WXLIBS) $(LIBS) obj/nogui/%.o: %.cpp $(HEADERS) $(CXX) -c $(CXXFLAGS) -o $@ $< -bitcoind: $(OBJS:obj/%=obj/nogui/%) obj/sha256.o +bitcoind: $(OBJS:obj/%=obj/nogui/%) $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS) @@ -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); } @@ -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); @@ -1483,7 +1482,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" @@ -1501,7 +1500,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); } @@ -1510,7 +1512,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" @@ -1523,7 +1525,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"; @@ -1535,13 +1537,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()); } @@ -1570,10 +1573,11 @@ int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHea { string strHeader = str.substr(0, nColon); boost::trim(strHeader); + boost::to_lower(strHeader); string strValue = str.substr(nColon+1); boost::trim(strValue); mapHeadersRet[strHeader] = strValue; - if (strHeader == "Content-Length") + if (strHeader == "content-length") nLen = atoi(strValue.c_str()); } } @@ -1643,7 +1647,7 @@ string DecodeBase64(string s) bool HTTPAuthorized(map<string, string>& mapHeaders) { - string strAuth = mapHeaders["Authorization"]; + string strAuth = mapHeaders["authorization"]; if (strAuth.substr(0,6) != "Basic ") return false; string strUserPass64 = strAuth.substr(6); boost::trim(strUserPass64); @@ -1872,7 +1876,7 @@ void ThreadRPCServer2(void* parg) } // Check authorization - if (mapHeaders.count("Authorization") == 0) + if (mapHeaders.count("authorization") == 0) { stream << HTTPReply(401, "") << std::flush; continue; 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; @@ -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/sha256.cpp b/sha256.cpp deleted file mode 100644 index ca116bdcd3..0000000000 --- a/sha256.cpp +++ /dev/null @@ -1,475 +0,0 @@ -// Copyright (c) 2010 Nils Schneider -// Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. - -// 4-way 128-bit SSE2 SHA-256 - -#ifdef FOURWAYSSE2 - -#include <string.h> -#include <assert.h> - -#include <xmmintrin.h> -#include <stdint.h> -#include <stdio.h> - -#define NPAR 32 - -extern void DoubleBlockSHA256(const void* pin, void* pout, const void* pinit, unsigned int hash[8][NPAR], const void* init2); - -static const unsigned int sha256_consts[] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, /* 0 */ - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, /* 8 */ - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, /* 16 */ - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, /* 24 */ - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, /* 32 */ - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, /* 40 */ - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, /* 48 */ - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, /* 56 */ - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -}; - - -static inline __m128i Ch(const __m128i b, const __m128i c, const __m128i d) { - return (b & c) ^ (~b & d); -} - -static inline __m128i Maj(const __m128i b, const __m128i c, const __m128i d) { - return (b & c) ^ (b & d) ^ (c & d); -} - -static inline __m128i ROTR(__m128i x, const int n) { - return _mm_srli_epi32(x, n) | _mm_slli_epi32(x, 32 - n); -} - -static inline __m128i SHR(__m128i x, const int n) { - return _mm_srli_epi32(x, n); -} - -/* SHA256 Functions */ -#define BIGSIGMA0_256(x) (ROTR((x), 2) ^ ROTR((x), 13) ^ ROTR((x), 22)) -#define BIGSIGMA1_256(x) (ROTR((x), 6) ^ ROTR((x), 11) ^ ROTR((x), 25)) -#define SIGMA0_256(x) (ROTR((x), 7) ^ ROTR((x), 18) ^ SHR((x), 3)) -#define SIGMA1_256(x) (ROTR((x), 17) ^ ROTR((x), 19) ^ SHR((x), 10)) - -static inline unsigned int store32(const __m128i x, int i) { - union { unsigned int ret[4]; __m128i x; } box; - box.x = x; - return box.ret[i]; -} - -static inline void store_epi32(const __m128i x, unsigned int *x0, unsigned int *x1, unsigned int *x2, unsigned int *x3) { - union { unsigned int ret[4]; __m128i x; } box; - box.x = x; - *x0 = box.ret[3]; *x1 = box.ret[2]; *x2 = box.ret[1]; *x3 = box.ret[0]; -} - -#define add4(x0, x1, x2, x3) _mm_add_epi32(_mm_add_epi32(_mm_add_epi32(x0, x1), x2), x3) -#define add5(x0, x1, x2, x3, x4) _mm_add_epi32(add4(x0, x1, x2, x3), x4) - -#define SHA256ROUND(a, b, c, d, e, f, g, h, i, w) \ - T1 = add5(h, BIGSIGMA1_256(e), Ch(e, f, g), _mm_set1_epi32(sha256_consts[i]), w); \ -d = _mm_add_epi32(d, T1); \ -h = _mm_add_epi32(T1, _mm_add_epi32(BIGSIGMA0_256(a), Maj(a, b, c))); - -static inline void dumpreg(__m128i x, char *msg) { - union { unsigned int ret[4]; __m128i x; } box; - box.x = x ; - printf("%s %08x %08x %08x %08x\n", msg, box.ret[0], box.ret[1], box.ret[2], box.ret[3]); -} - -#if 1 -#define dumpstate(i) printf("%s: %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", \ - __func__, store32(w0, i), store32(a, i), store32(b, i), store32(c, i), store32(d, i), store32(e, i), store32(f, i), store32(g, i), store32(h, i)); -#else -#define dumpstate() -#endif - -// Align by increasing pointer, must have extra space at end of buffer -template <size_t nBytes, typename T> -T* alignup(T* p) -{ - union - { - T* ptr; - size_t n; - } u; - u.ptr = p; - u.n = (u.n + (nBytes-1)) & ~(nBytes-1); - return u.ptr; -} - -static const unsigned int pSHA256InitState[8] = -{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; - - -unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pdata, char* phash1, char* phash, unsigned int& nHashesDone) -{ - unsigned int& nNonce = *(unsigned int*)(pdata + 12); - for (;;) - { - nNonce += NPAR; - unsigned int thashbuf[9][NPAR]; - unsigned int (&thash)[9][NPAR] = *alignup<16>(&thashbuf); - DoubleBlockSHA256(pdata, phash1, pmidstate, thash, pSHA256InitState); - - for (int j = 0; j < NPAR; j++) - { - if (thash[7][j] == 0) - { - for (int i = 0; i < 32/4; i++) - ((unsigned int*)phash)[i] = thash[i][j]; - return nNonce + j; - } - } - - if ((nNonce & 0xffff) == 0) - { - nHashesDone = 0xffff+1; - return -1; - } - } -} - - -void DoubleBlockSHA256(const void* pin, void* pad, const void *pre, unsigned int thash[9][NPAR], const void *init) -{ - unsigned int* In = (unsigned int*)pin; - unsigned int* Pad = (unsigned int*)pad; - unsigned int* hPre = (unsigned int*)pre; - unsigned int* hInit = (unsigned int*)init; - unsigned int i, j, k; - - /* vectors used in calculation */ - __m128i w0, w1, w2, w3, w4, w5, w6, w7; - __m128i w8, w9, w10, w11, w12, w13, w14, w15; - __m128i T1; - __m128i a, b, c, d, e, f, g, h; - __m128i nonce; - - /* nonce offset for vector */ - __m128i offset = _mm_set_epi32(0x00000003, 0x00000002, 0x00000001, 0x00000000); - - - for(k = 0; k<NPAR; k+=4) { - w0 = _mm_set1_epi32(In[0]); - w1 = _mm_set1_epi32(In[1]); - w2 = _mm_set1_epi32(In[2]); - //w3 = _mm_set1_epi32(In[3]); nonce will be later hacked into the hash - w4 = _mm_set1_epi32(In[4]); - w5 = _mm_set1_epi32(In[5]); - w6 = _mm_set1_epi32(In[6]); - w7 = _mm_set1_epi32(In[7]); - w8 = _mm_set1_epi32(In[8]); - w9 = _mm_set1_epi32(In[9]); - w10 = _mm_set1_epi32(In[10]); - w11 = _mm_set1_epi32(In[11]); - w12 = _mm_set1_epi32(In[12]); - w13 = _mm_set1_epi32(In[13]); - w14 = _mm_set1_epi32(In[14]); - w15 = _mm_set1_epi32(In[15]); - - /* hack nonce into lowest byte of w3 */ - nonce = _mm_set1_epi32(In[3]); - nonce = _mm_add_epi32(nonce, offset); - nonce = _mm_add_epi32(nonce, _mm_set1_epi32(k)); - w3 = nonce; - - a = _mm_set1_epi32(hPre[0]); - b = _mm_set1_epi32(hPre[1]); - c = _mm_set1_epi32(hPre[2]); - d = _mm_set1_epi32(hPre[3]); - e = _mm_set1_epi32(hPre[4]); - f = _mm_set1_epi32(hPre[5]); - g = _mm_set1_epi32(hPre[6]); - h = _mm_set1_epi32(hPre[7]); - - SHA256ROUND(a, b, c, d, e, f, g, h, 0, w0); - SHA256ROUND(h, a, b, c, d, e, f, g, 1, w1); - SHA256ROUND(g, h, a, b, c, d, e, f, 2, w2); - SHA256ROUND(f, g, h, a, b, c, d, e, 3, w3); - SHA256ROUND(e, f, g, h, a, b, c, d, 4, w4); - SHA256ROUND(d, e, f, g, h, a, b, c, 5, w5); - SHA256ROUND(c, d, e, f, g, h, a, b, 6, w6); - SHA256ROUND(b, c, d, e, f, g, h, a, 7, w7); - SHA256ROUND(a, b, c, d, e, f, g, h, 8, w8); - SHA256ROUND(h, a, b, c, d, e, f, g, 9, w9); - SHA256ROUND(g, h, a, b, c, d, e, f, 10, w10); - SHA256ROUND(f, g, h, a, b, c, d, e, 11, w11); - SHA256ROUND(e, f, g, h, a, b, c, d, 12, w12); - SHA256ROUND(d, e, f, g, h, a, b, c, 13, w13); - SHA256ROUND(c, d, e, f, g, h, a, b, 14, w14); - SHA256ROUND(b, c, d, e, f, g, h, a, 15, w15); - - w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0); - SHA256ROUND(a, b, c, d, e, f, g, h, 16, w0); - w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1); - SHA256ROUND(h, a, b, c, d, e, f, g, 17, w1); - w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2); - SHA256ROUND(g, h, a, b, c, d, e, f, 18, w2); - w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3); - SHA256ROUND(f, g, h, a, b, c, d, e, 19, w3); - w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4); - SHA256ROUND(e, f, g, h, a, b, c, d, 20, w4); - w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5); - SHA256ROUND(d, e, f, g, h, a, b, c, 21, w5); - w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6); - SHA256ROUND(c, d, e, f, g, h, a, b, 22, w6); - w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7); - SHA256ROUND(b, c, d, e, f, g, h, a, 23, w7); - w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8); - SHA256ROUND(a, b, c, d, e, f, g, h, 24, w8); - w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9); - SHA256ROUND(h, a, b, c, d, e, f, g, 25, w9); - w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10); - SHA256ROUND(g, h, a, b, c, d, e, f, 26, w10); - w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11); - SHA256ROUND(f, g, h, a, b, c, d, e, 27, w11); - w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); - SHA256ROUND(e, f, g, h, a, b, c, d, 28, w12); - w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); - SHA256ROUND(d, e, f, g, h, a, b, c, 29, w13); - w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); - SHA256ROUND(c, d, e, f, g, h, a, b, 30, w14); - w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); - SHA256ROUND(b, c, d, e, f, g, h, a, 31, w15); - - w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0); - SHA256ROUND(a, b, c, d, e, f, g, h, 32, w0); - w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1); - SHA256ROUND(h, a, b, c, d, e, f, g, 33, w1); - w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2); - SHA256ROUND(g, h, a, b, c, d, e, f, 34, w2); - w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3); - SHA256ROUND(f, g, h, a, b, c, d, e, 35, w3); - w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4); - SHA256ROUND(e, f, g, h, a, b, c, d, 36, w4); - w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5); - SHA256ROUND(d, e, f, g, h, a, b, c, 37, w5); - w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6); - SHA256ROUND(c, d, e, f, g, h, a, b, 38, w6); - w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7); - SHA256ROUND(b, c, d, e, f, g, h, a, 39, w7); - w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8); - SHA256ROUND(a, b, c, d, e, f, g, h, 40, w8); - w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9); - SHA256ROUND(h, a, b, c, d, e, f, g, 41, w9); - w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10); - SHA256ROUND(g, h, a, b, c, d, e, f, 42, w10); - w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11); - SHA256ROUND(f, g, h, a, b, c, d, e, 43, w11); - w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); - SHA256ROUND(e, f, g, h, a, b, c, d, 44, w12); - w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); - SHA256ROUND(d, e, f, g, h, a, b, c, 45, w13); - w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); - SHA256ROUND(c, d, e, f, g, h, a, b, 46, w14); - w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); - SHA256ROUND(b, c, d, e, f, g, h, a, 47, w15); - - w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0); - SHA256ROUND(a, b, c, d, e, f, g, h, 48, w0); - w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1); - SHA256ROUND(h, a, b, c, d, e, f, g, 49, w1); - w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2); - SHA256ROUND(g, h, a, b, c, d, e, f, 50, w2); - w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3); - SHA256ROUND(f, g, h, a, b, c, d, e, 51, w3); - w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4); - SHA256ROUND(e, f, g, h, a, b, c, d, 52, w4); - w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5); - SHA256ROUND(d, e, f, g, h, a, b, c, 53, w5); - w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6); - SHA256ROUND(c, d, e, f, g, h, a, b, 54, w6); - w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7); - SHA256ROUND(b, c, d, e, f, g, h, a, 55, w7); - w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8); - SHA256ROUND(a, b, c, d, e, f, g, h, 56, w8); - w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9); - SHA256ROUND(h, a, b, c, d, e, f, g, 57, w9); - w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10); - SHA256ROUND(g, h, a, b, c, d, e, f, 58, w10); - w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11); - SHA256ROUND(f, g, h, a, b, c, d, e, 59, w11); - w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); - SHA256ROUND(e, f, g, h, a, b, c, d, 60, w12); - w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); - SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13); - w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); - SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14); - w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); - SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15); - -#define store_load(x, i, dest) \ - T1 = _mm_set1_epi32((hPre)[i]); \ - dest = _mm_add_epi32(T1, x); - - store_load(a, 0, w0); - store_load(b, 1, w1); - store_load(c, 2, w2); - store_load(d, 3, w3); - store_load(e, 4, w4); - store_load(f, 5, w5); - store_load(g, 6, w6); - store_load(h, 7, w7); - - w8 = _mm_set1_epi32(Pad[8]); - w9 = _mm_set1_epi32(Pad[9]); - w10 = _mm_set1_epi32(Pad[10]); - w11 = _mm_set1_epi32(Pad[11]); - w12 = _mm_set1_epi32(Pad[12]); - w13 = _mm_set1_epi32(Pad[13]); - w14 = _mm_set1_epi32(Pad[14]); - w15 = _mm_set1_epi32(Pad[15]); - - a = _mm_set1_epi32(hInit[0]); - b = _mm_set1_epi32(hInit[1]); - c = _mm_set1_epi32(hInit[2]); - d = _mm_set1_epi32(hInit[3]); - e = _mm_set1_epi32(hInit[4]); - f = _mm_set1_epi32(hInit[5]); - g = _mm_set1_epi32(hInit[6]); - h = _mm_set1_epi32(hInit[7]); - - SHA256ROUND(a, b, c, d, e, f, g, h, 0, w0); - SHA256ROUND(h, a, b, c, d, e, f, g, 1, w1); - SHA256ROUND(g, h, a, b, c, d, e, f, 2, w2); - SHA256ROUND(f, g, h, a, b, c, d, e, 3, w3); - SHA256ROUND(e, f, g, h, a, b, c, d, 4, w4); - SHA256ROUND(d, e, f, g, h, a, b, c, 5, w5); - SHA256ROUND(c, d, e, f, g, h, a, b, 6, w6); - SHA256ROUND(b, c, d, e, f, g, h, a, 7, w7); - SHA256ROUND(a, b, c, d, e, f, g, h, 8, w8); - SHA256ROUND(h, a, b, c, d, e, f, g, 9, w9); - SHA256ROUND(g, h, a, b, c, d, e, f, 10, w10); - SHA256ROUND(f, g, h, a, b, c, d, e, 11, w11); - SHA256ROUND(e, f, g, h, a, b, c, d, 12, w12); - SHA256ROUND(d, e, f, g, h, a, b, c, 13, w13); - SHA256ROUND(c, d, e, f, g, h, a, b, 14, w14); - SHA256ROUND(b, c, d, e, f, g, h, a, 15, w15); - - w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0); - SHA256ROUND(a, b, c, d, e, f, g, h, 16, w0); - w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1); - SHA256ROUND(h, a, b, c, d, e, f, g, 17, w1); - w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2); - SHA256ROUND(g, h, a, b, c, d, e, f, 18, w2); - w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3); - SHA256ROUND(f, g, h, a, b, c, d, e, 19, w3); - w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4); - SHA256ROUND(e, f, g, h, a, b, c, d, 20, w4); - w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5); - SHA256ROUND(d, e, f, g, h, a, b, c, 21, w5); - w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6); - SHA256ROUND(c, d, e, f, g, h, a, b, 22, w6); - w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7); - SHA256ROUND(b, c, d, e, f, g, h, a, 23, w7); - w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8); - SHA256ROUND(a, b, c, d, e, f, g, h, 24, w8); - w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9); - SHA256ROUND(h, a, b, c, d, e, f, g, 25, w9); - w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10); - SHA256ROUND(g, h, a, b, c, d, e, f, 26, w10); - w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11); - SHA256ROUND(f, g, h, a, b, c, d, e, 27, w11); - w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); - SHA256ROUND(e, f, g, h, a, b, c, d, 28, w12); - w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); - SHA256ROUND(d, e, f, g, h, a, b, c, 29, w13); - w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); - SHA256ROUND(c, d, e, f, g, h, a, b, 30, w14); - w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); - SHA256ROUND(b, c, d, e, f, g, h, a, 31, w15); - - w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0); - SHA256ROUND(a, b, c, d, e, f, g, h, 32, w0); - w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1); - SHA256ROUND(h, a, b, c, d, e, f, g, 33, w1); - w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2); - SHA256ROUND(g, h, a, b, c, d, e, f, 34, w2); - w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3); - SHA256ROUND(f, g, h, a, b, c, d, e, 35, w3); - w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4); - SHA256ROUND(e, f, g, h, a, b, c, d, 36, w4); - w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5); - SHA256ROUND(d, e, f, g, h, a, b, c, 37, w5); - w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6); - SHA256ROUND(c, d, e, f, g, h, a, b, 38, w6); - w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7); - SHA256ROUND(b, c, d, e, f, g, h, a, 39, w7); - w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8); - SHA256ROUND(a, b, c, d, e, f, g, h, 40, w8); - w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9); - SHA256ROUND(h, a, b, c, d, e, f, g, 41, w9); - w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10); - SHA256ROUND(g, h, a, b, c, d, e, f, 42, w10); - w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11); - SHA256ROUND(f, g, h, a, b, c, d, e, 43, w11); - w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); - SHA256ROUND(e, f, g, h, a, b, c, d, 44, w12); - w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); - SHA256ROUND(d, e, f, g, h, a, b, c, 45, w13); - w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); - SHA256ROUND(c, d, e, f, g, h, a, b, 46, w14); - w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); - SHA256ROUND(b, c, d, e, f, g, h, a, 47, w15); - - w0 = add4(SIGMA1_256(w14), w9, SIGMA0_256(w1), w0); - SHA256ROUND(a, b, c, d, e, f, g, h, 48, w0); - w1 = add4(SIGMA1_256(w15), w10, SIGMA0_256(w2), w1); - SHA256ROUND(h, a, b, c, d, e, f, g, 49, w1); - w2 = add4(SIGMA1_256(w0), w11, SIGMA0_256(w3), w2); - SHA256ROUND(g, h, a, b, c, d, e, f, 50, w2); - w3 = add4(SIGMA1_256(w1), w12, SIGMA0_256(w4), w3); - SHA256ROUND(f, g, h, a, b, c, d, e, 51, w3); - w4 = add4(SIGMA1_256(w2), w13, SIGMA0_256(w5), w4); - SHA256ROUND(e, f, g, h, a, b, c, d, 52, w4); - w5 = add4(SIGMA1_256(w3), w14, SIGMA0_256(w6), w5); - SHA256ROUND(d, e, f, g, h, a, b, c, 53, w5); - w6 = add4(SIGMA1_256(w4), w15, SIGMA0_256(w7), w6); - SHA256ROUND(c, d, e, f, g, h, a, b, 54, w6); - w7 = add4(SIGMA1_256(w5), w0, SIGMA0_256(w8), w7); - SHA256ROUND(b, c, d, e, f, g, h, a, 55, w7); - w8 = add4(SIGMA1_256(w6), w1, SIGMA0_256(w9), w8); - SHA256ROUND(a, b, c, d, e, f, g, h, 56, w8); - w9 = add4(SIGMA1_256(w7), w2, SIGMA0_256(w10), w9); - SHA256ROUND(h, a, b, c, d, e, f, g, 57, w9); - w10 = add4(SIGMA1_256(w8), w3, SIGMA0_256(w11), w10); - SHA256ROUND(g, h, a, b, c, d, e, f, 58, w10); - w11 = add4(SIGMA1_256(w9), w4, SIGMA0_256(w12), w11); - SHA256ROUND(f, g, h, a, b, c, d, e, 59, w11); - w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); - SHA256ROUND(e, f, g, h, a, b, c, d, 60, w12); - w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); - SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13); - w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); - SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14); - w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); - SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15); - - /* store resulsts directly in thash */ -#define store_2(x,i) \ - w0 = _mm_set1_epi32(hInit[i]); \ - *(__m128i *)&(thash)[i][0+k] = _mm_add_epi32(w0, x); - - store_2(a, 0); - store_2(b, 1); - store_2(c, 2); - store_2(d, 3); - store_2(e, 4); - store_2(f, 5); - store_2(g, 6); - store_2(h, 7); - *(__m128i *)&(thash)[8][0+k] = nonce; - } - -} - -#endif // FOURWAYSSE2 @@ -1094,12 +1094,6 @@ void CMainFrame::OnMenuFileExit(wxCommandEvent& event) Close(true); } -void CMainFrame::OnMenuOptionsGenerate(wxCommandEvent& event) -{ - // Options->Generate Coins - GenerateBitcoins(event.IsChecked()); -} - void CMainFrame::OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event) { event.Check(fGenerateBitcoins); @@ -1655,13 +1649,6 @@ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent) // Init values m_textCtrlTransactionFee->SetValue(FormatMoney(nTransactionFee)); - m_checkBoxLimitProcessors->SetValue(fLimitProcessors); - m_spinCtrlLimitProcessors->Enable(fLimitProcessors); - m_spinCtrlLimitProcessors->SetValue(nLimitProcessors); - int nProcessors = wxThread::GetCPUCount(); - if (nProcessors < 1) - nProcessors = 999; - m_spinCtrlLimitProcessors->SetRange(1, nProcessors); m_checkBoxStartOnSystemStartup->SetValue(fTmpStartOnSystemStartup = GetStartOnSystemStartup()); m_checkBoxMinimizeToTray->SetValue(fMinimizeToTray); m_checkBoxMinimizeOnClose->SetValue(fMinimizeOnClose); @@ -1702,11 +1689,6 @@ void COptionsDialog::OnKillFocusTransactionFee(wxFocusEvent& event) m_textCtrlTransactionFee->SetValue(FormatMoney(nTmp)); } -void COptionsDialog::OnCheckBoxLimitProcessors(wxCommandEvent& event) -{ - m_spinCtrlLimitProcessors->Enable(event.IsChecked()); -} - void COptionsDialog::OnCheckBoxUseProxy(wxCommandEvent& event) { m_textCtrlProxyIP->Enable(event.IsChecked()); @@ -1755,20 +1737,6 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event) if (ParseMoney(m_textCtrlTransactionFee->GetValue(), nTransactionFee) && nTransactionFee != nPrevTransactionFee) walletdb.WriteSetting("nTransactionFee", nTransactionFee); - int nPrevMaxProc = (fLimitProcessors ? nLimitProcessors : INT_MAX); - if (fLimitProcessors != m_checkBoxLimitProcessors->GetValue()) - { - fLimitProcessors = m_checkBoxLimitProcessors->GetValue(); - walletdb.WriteSetting("fLimitProcessors", fLimitProcessors); - } - if (nLimitProcessors != m_spinCtrlLimitProcessors->GetValue()) - { - nLimitProcessors = m_spinCtrlLimitProcessors->GetValue(); - walletdb.WriteSetting("nLimitProcessors", nLimitProcessors); - } - if (fGenerateBitcoins && (fLimitProcessors ? nLimitProcessors : INT_MAX) > nPrevMaxProc) - GenerateBitcoins(fGenerateBitcoins); - if (fTmpStartOnSystemStartup != m_checkBoxStartOnSystemStartup->GetValue()) { fTmpStartOnSystemStartup = m_checkBoxStartOnSystemStartup->GetValue(); @@ -1814,7 +1782,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(); @@ -1859,6 +1827,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(); @@ -1867,7 +1836,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)); @@ -1960,6 +1929,7 @@ void CSendDialog::OnButtonSend(wxCommandEvent& event) { wxMessageBox(strError + " ", _("Sending...")); EndModal(false); + return; } } } @@ -2247,7 +2217,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; @@ -2605,6 +2575,7 @@ void CAddressBookDialog::OnClose(wxCloseEvent& event) enum { ID_TASKBAR_RESTORE = 10001, + ID_TASKBAR_SEND, ID_TASKBAR_OPTIONS, ID_TASKBAR_GENERATE, ID_TASKBAR_EXIT, @@ -2613,8 +2584,8 @@ 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_MENU(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnMenuGenerate) EVT_UPDATE_UI(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnUpdateUIGenerate) EVT_MENU(ID_TASKBAR_EXIT, CMyTaskBarIcon::OnMenuExit) END_EVENT_TABLE() @@ -2665,6 +2636,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 @@ -2681,11 +2659,6 @@ void CMyTaskBarIcon::Restore() pframeMain->Raise(); } -void CMyTaskBarIcon::OnMenuGenerate(wxCommandEvent& event) -{ - GenerateBitcoins(event.IsChecked()); -} - void CMyTaskBarIcon::OnUpdateUIGenerate(wxUpdateUIEvent& event) { event.Check(fGenerateBitcoins); @@ -2706,8 +2679,8 @@ 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...")); - pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, _("&Generate Coins"))->Check(fGenerateBitcoins); #ifndef __WXMAC_OSX__ // Mac has built-in quit menu pmenu->AppendSeparator(); pmenu->Append(ID_TASKBAR_EXIT, _("E&xit")); @@ -2839,9 +2812,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 @@ -52,7 +52,6 @@ protected: void OnPaint(wxPaintEvent& event); void OnPaintListCtrl(wxPaintEvent& event); void OnMenuFileExit(wxCommandEvent& event); - void OnMenuOptionsGenerate(wxCommandEvent& event); void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event); void OnMenuOptionsChangeYourAddress(wxCommandEvent& event); void OnMenuOptionsOptions(wxCommandEvent& event); @@ -127,7 +126,6 @@ protected: // Event handlers void OnListBox(wxCommandEvent& event); void OnKillFocusTransactionFee(wxFocusEvent& event); - void OnCheckBoxLimitProcessors(wxCommandEvent& event); void OnCheckBoxUseProxy(wxCommandEvent& event); void OnKillFocusProxy(wxFocusEvent& event); @@ -323,6 +321,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/uibase.cpp b/uibase.cpp index 41be5d7527..1b901a1edb 100644 --- a/uibase.cpp +++ b/uibase.cpp @@ -28,10 +28,6 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString& m_menubar->Append( m_menuFile, _("&File") ); m_menuOptions = new wxMenu(); - wxMenuItem* m_menuOptionsGenerateBitcoins; - m_menuOptionsGenerateBitcoins = new wxMenuItem( m_menuOptions, wxID_OPTIONSGENERATEBITCOINS, wxString( _("&Generate Coins") ) , wxEmptyString, wxITEM_CHECK ); - m_menuOptions->Append( m_menuOptionsGenerateBitcoins ); - wxMenuItem* m_menuOptionsChangeYourAddress; m_menuOptionsChangeYourAddress = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Your Receiving Addresses...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuOptions->Append( m_menuOptionsChangeYourAddress ); @@ -190,8 +186,6 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString& this->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) ); this->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaint ) ); this->Connect( m_menuFileExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuFileExit ) ); - this->Connect( m_menuOptionsGenerateBitcoins->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsGenerate ) ); - this->Connect( m_menuOptionsGenerateBitcoins->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIOptionsGenerate ) ); this->Connect( m_menuOptionsChangeYourAddress->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsChangeYourAddress ) ); this->Connect( m_menuOptionsOptions->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsOptions ) ); this->Connect( m_menuHelpAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuHelpAbout ) ); @@ -250,8 +244,6 @@ CMainFrameBase::~CMainFrameBase() this->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) ); this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaint ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuFileExit ) ); - this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsGenerate ) ); - this->Disconnect( wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIOptionsGenerate ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsChangeYourAddress ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsOptions ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuHelpAbout ) ); @@ -350,21 +342,6 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w bSizer69->Add( 0, 16, 0, wxEXPAND, 5 ); - wxBoxSizer* bSizer71; - bSizer71 = new wxBoxSizer( wxHORIZONTAL ); - - m_checkBoxLimitProcessors = new wxCheckBox( m_panelMain, wxID_ANY, _("&Limit coin generation to"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer71->Add( m_checkBoxLimitProcessors, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_spinCtrlLimitProcessors = new wxSpinCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 48,-1 ), wxSP_ARROW_KEYS, 1, 999, 1 ); - bSizer71->Add( m_spinCtrlLimitProcessors, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticText35 = new wxStaticText( m_panelMain, wxID_ANY, _("processors"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText35->Wrap( -1 ); - bSizer71->Add( m_staticText35, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - bSizer69->Add( bSizer71, 0, 0, 5 ); - m_checkBoxStartOnSystemStartup = new wxCheckBox( m_panelMain, wxID_ANY, _("&Start Bitcoin on system startup"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer69->Add( m_checkBoxStartOnSystemStartup, 0, wxALL, 5 ); @@ -479,7 +456,6 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w // Connect Events m_listBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this ); - m_checkBoxLimitProcessors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxLimitProcessors ), NULL, this ); m_checkBoxMinimizeToTray->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxMinimizeToTray ), NULL, this ); m_checkBoxUseProxy->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxUseProxy ), NULL, this ); m_textCtrlProxyIP->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this ); @@ -494,7 +470,6 @@ COptionsDialogBase::~COptionsDialogBase() { // Disconnect Events m_listBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this ); - m_checkBoxLimitProcessors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxLimitProcessors ), NULL, this ); m_checkBoxMinimizeToTray->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxMinimizeToTray ), NULL, this ); m_checkBoxUseProxy->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnCheckBoxUseProxy ), NULL, this ); m_textCtrlProxyIP->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this ); @@ -34,36 +34,34 @@ #include <wx/dialog.h> #include <wx/listbox.h> #include <wx/checkbox.h> -#include <wx/spinctrl.h> #include <wx/scrolwin.h> #include <wx/statbmp.h> /////////////////////////////////////////////////////////////////////////// #define wxID_MAINFRAME 1000 -#define wxID_OPTIONSGENERATEBITCOINS 1001 -#define wxID_BUTTONSEND 1002 -#define wxID_BUTTONRECEIVE 1003 -#define wxID_TEXTCTRLADDRESS 1004 -#define wxID_BUTTONNEW 1005 -#define wxID_BUTTONCOPY 1006 -#define wxID_PROXYIP 1007 -#define wxID_PROXYPORT 1008 -#define wxID_TRANSACTIONFEE 1009 -#define wxID_TEXTCTRLPAYTO 1010 -#define wxID_BUTTONPASTE 1011 -#define wxID_BUTTONADDRESSBOOK 1012 -#define wxID_TEXTCTRLAMOUNT 1013 -#define wxID_CHOICETRANSFERTYPE 1014 -#define wxID_LISTCTRL 1015 -#define wxID_BUTTONRENAME 1016 -#define wxID_PANELSENDING 1017 -#define wxID_LISTCTRLSENDING 1018 -#define wxID_PANELRECEIVING 1019 -#define wxID_LISTCTRLRECEIVING 1020 -#define wxID_BUTTONDELETE 1021 -#define wxID_BUTTONEDIT 1022 -#define wxID_TEXTCTRL 1023 +#define wxID_BUTTONSEND 1001 +#define wxID_BUTTONRECEIVE 1002 +#define wxID_TEXTCTRLADDRESS 1003 +#define wxID_BUTTONNEW 1004 +#define wxID_BUTTONCOPY 1005 +#define wxID_PROXYIP 1006 +#define wxID_PROXYPORT 1007 +#define wxID_TRANSACTIONFEE 1008 +#define wxID_TEXTCTRLPAYTO 1009 +#define wxID_BUTTONPASTE 1010 +#define wxID_BUTTONADDRESSBOOK 1011 +#define wxID_TEXTCTRLAMOUNT 1012 +#define wxID_CHOICETRANSFERTYPE 1013 +#define wxID_LISTCTRL 1014 +#define wxID_BUTTONRENAME 1015 +#define wxID_PANELSENDING 1016 +#define wxID_LISTCTRLSENDING 1017 +#define wxID_PANELRECEIVING 1018 +#define wxID_LISTCTRLRECEIVING 1019 +#define wxID_BUTTONDELETE 1020 +#define wxID_BUTTONEDIT 1021 +#define wxID_TEXTCTRL 1022 /////////////////////////////////////////////////////////////////////////////// /// Class CMainFrameBase @@ -99,8 +97,6 @@ class CMainFrameBase : public wxFrame virtual void OnMouseEvents( wxMouseEvent& event ) { event.Skip(); } virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); } virtual void OnMenuFileExit( wxCommandEvent& event ) { event.Skip(); } - virtual void OnMenuOptionsGenerate( wxCommandEvent& event ) { event.Skip(); } - virtual void OnUpdateUIOptionsGenerate( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnMenuOptionsChangeYourAddress( wxCommandEvent& event ) { event.Skip(); } virtual void OnMenuOptionsOptions( wxCommandEvent& event ) { event.Skip(); } virtual void OnMenuHelpAbout( wxCommandEvent& event ) { event.Skip(); } @@ -165,9 +161,6 @@ class COptionsDialogBase : public wxDialog wxScrolledWindow* m_scrolledWindow; wxPanel* m_panelMain; - wxCheckBox* m_checkBoxLimitProcessors; - wxSpinCtrl* m_spinCtrlLimitProcessors; - wxStaticText* m_staticText35; wxCheckBox* m_checkBoxStartOnSystemStartup; wxCheckBox* m_checkBoxMinimizeToTray; wxCheckBox* m_checkBoxUseUPnP; @@ -192,7 +185,6 @@ class COptionsDialogBase : public wxDialog // Virtual event handlers, overide them in your derived class virtual void OnListBox( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCheckBoxLimitProcessors( wxCommandEvent& event ) { event.Skip(); } virtual void OnCheckBoxMinimizeToTray( wxCommandEvent& event ) { event.Skip(); } virtual void OnCheckBoxUseProxy( wxCommandEvent& event ) { event.Skip(); } virtual void OnKillFocusProxy( wxFocusEvent& event ) { event.Skip(); } diff --git a/uiproject.fbp b/uiproject.fbp index d55566eefc..d9d46382d3 100644 --- a/uiproject.fbp +++ b/uiproject.fbp @@ -152,21 +152,6 @@ <property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
- <property name="id">wxID_OPTIONSGENERATEBITCOINS</property>
- <property name="kind">wxITEM_CHECK</property>
- <property name="label">&Generate Coins</property>
- <property name="name">m_menuOptionsGenerateBitcoins</property>
- <property name="permission">none</property>
- <property name="shortcut"></property>
- <property name="unchecked_bitmap"></property>
- <event name="OnMenuSelection">OnMenuOptionsGenerate</event>
- <event name="OnUpdateUI">OnUpdateUIOptionsGenerate</event>
- </object>
- <object class="wxMenuItem" expanded="1">
- <property name="bitmap"></property>
- <property name="checked">0</property>
- <property name="enabled">1</property>
- <property name="help"></property>
<property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">&Your Receiving Addresses...</property>
@@ -1831,187 +1816,6 @@ </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag"></property>
- <property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="1">
- <property name="minimum_size"></property>
- <property name="name">bSizer71</property>
- <property name="orient">wxHORIZONTAL</property>
- <property name="permission">none</property>
- <object class="sizeritem" expanded="1">
- <property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
- <property name="proportion">0</property>
- <object class="wxCheckBox" expanded="1">
- <property name="bg"></property>
- <property name="checked">0</property>
- <property name="context_help"></property>
- <property name="enabled">1</property>
- <property name="fg"></property>
- <property name="font"></property>
- <property name="hidden">0</property>
- <property name="id">wxID_ANY</property>
- <property name="label">&Limit coin generation to</property>
- <property name="maximum_size"></property>
- <property name="minimum_size"></property>
- <property name="name">m_checkBoxLimitProcessors</property>
- <property name="permission">protected</property>
- <property name="pos"></property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="tooltip"></property>
- <property name="validator_data_type"></property>
- <property name="validator_style">wxFILTER_NONE</property>
- <property name="validator_type">wxDefaultValidator</property>
- <property name="validator_variable"></property>
- <property name="window_extra_style"></property>
- <property name="window_name"></property>
- <property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnCheckBox">OnCheckBoxLimitProcessors</event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
- </object>
- </object>
- <object class="sizeritem" expanded="1">
- <property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL</property>
- <property name="proportion">0</property>
- <object class="wxSpinCtrl" expanded="1">
- <property name="bg"></property>
- <property name="context_help"></property>
- <property name="enabled">1</property>
- <property name="fg"></property>
- <property name="font"></property>
- <property name="hidden">0</property>
- <property name="id">wxID_ANY</property>
- <property name="initial">1</property>
- <property name="max">999</property>
- <property name="maximum_size"></property>
- <property name="min">1</property>
- <property name="minimum_size"></property>
- <property name="name">m_spinCtrlLimitProcessors</property>
- <property name="permission">protected</property>
- <property name="pos"></property>
- <property name="size">48,-1</property>
- <property name="style">wxSP_ARROW_KEYS</property>
- <property name="subclass"></property>
- <property name="tooltip"></property>
- <property name="validator_data_type"></property>
- <property name="validator_style">wxFILTER_NONE</property>
- <property name="validator_type">wxDefaultValidator</property>
- <property name="validator_variable"></property>
- <property name="value"></property>
- <property name="window_extra_style"></property>
- <property name="window_name"></property>
- <property name="window_style"></property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnSpinCtrl"></event>
- <event name="OnSpinCtrlText"></event>
- <event name="OnUpdateUI"></event>
- </object>
- </object>
- <object class="sizeritem" expanded="1">
- <property name="border">5</property>
- <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
- <property name="proportion">0</property>
- <object class="wxStaticText" expanded="1">
- <property name="bg"></property>
- <property name="context_help"></property>
- <property name="enabled">1</property>
- <property name="fg"></property>
- <property name="font"></property>
- <property name="hidden">0</property>
- <property name="id">wxID_ANY</property>
- <property name="label">processors</property>
- <property name="maximum_size"></property>
- <property name="minimum_size"></property>
- <property name="name">m_staticText35</property>
- <property name="permission">protected</property>
- <property name="pos"></property>
- <property name="size"></property>
- <property name="style"></property>
- <property name="subclass"></property>
- <property name="tooltip"></property>
- <property name="validator_data_type"></property>
- <property name="validator_style">wxFILTER_NONE</property>
- <property name="validator_type">wxDefaultValidator</property>
- <property name="validator_variable"></property>
- <property name="window_extra_style"></property>
- <property name="window_name"></property>
- <property name="window_style"></property>
- <property name="wrap">-1</property>
- <event name="OnChar"></event>
- <event name="OnEnterWindow"></event>
- <event name="OnEraseBackground"></event>
- <event name="OnKeyDown"></event>
- <event name="OnKeyUp"></event>
- <event name="OnKillFocus"></event>
- <event name="OnLeaveWindow"></event>
- <event name="OnLeftDClick"></event>
- <event name="OnLeftDown"></event>
- <event name="OnLeftUp"></event>
- <event name="OnMiddleDClick"></event>
- <event name="OnMiddleDown"></event>
- <event name="OnMiddleUp"></event>
- <event name="OnMotion"></event>
- <event name="OnMouseEvents"></event>
- <event name="OnMouseWheel"></event>
- <event name="OnPaint"></event>
- <event name="OnRightDClick"></event>
- <event name="OnRightDown"></event>
- <event name="OnRightUp"></event>
- <event name="OnSetFocus"></event>
- <event name="OnSize"></event>
- <event name="OnUpdateUI"></event>
- </object>
- </object>
- </object>
- </object>
- <object class="sizeritem" expanded="1">
- <property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
@@ -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; +} + + + + + @@ -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); -} - |