Browse Source

Merge branch 'master' of https://github.com/bitcoin/bitcoin

Conflicts:
	.gitignore (used upstream version)
	bitcoin-qt.pro
pull/1/head
Wladimir J. van der Laan 11 years ago
parent
commit
002a4dcad0
  1. 4
      .gitignore
  2. 9
      INSTALL
  3. 12
      README.md
  4. 4
      bitcoin-qt.pro
  5. 2
      contrib/Bitcoin.app/Contents/Info.plist
  6. BIN
      contrib/BitcoinTemplate.dmg
  7. 60
      contrib/create_osx_dmg.sh
  8. 0
      contrib/gitian-downloader/linux-download-config
  9. 30
      contrib/gitian-downloader/win32-download-config
  10. 2
      doc/README
  11. 2
      doc/README_windows.txt
  12. 21
      doc/build-msw.txt
  13. 102
      doc/build-osx.txt
  14. 77
      doc/build-unix.txt
  15. 10
      doc/readme-qt.rst
  16. 74
      doc/release-process.txt
  17. 6
      share/setup.nsi
  18. 6388
      share/uiproject.fbp
  19. 10
      src/bitcoinrpc.cpp
  20. 2
      src/db.cpp
  21. 28
      src/headers.h
  22. 70
      src/init.cpp
  23. 86
      src/main.cpp
  24. 8
      src/main.h
  25. 28
      src/makefile.linux-mingw
  26. 33
      src/makefile.mingw
  27. 20
      src/makefile.osx
  28. 51
      src/makefile.unix
  29. 18
      src/makefile.vc
  30. 54
      src/net.cpp
  31. 28
      src/net.h
  32. 2
      src/serialize.h
  33. 68
      src/test/DoS_tests.cpp
  34. 2
      src/test/test_bitcoin.cpp
  35. 3221
      src/ui.cpp
  36. 355
      src/ui.h
  37. 1018
      src/uibase.cpp
  38. 425
      src/uibase.h
  39. 51
      src/util.cpp
  40. 3
      src/util.h
  41. 665
      src/xpm/about.xpm
  42. 278
      src/xpm/addressbook16.xpm
  43. 282
      src/xpm/addressbook20.xpm
  44. 219
      src/xpm/bitcoin16.xpm
  45. 160
      src/xpm/bitcoin20.xpm
  46. 232
      src/xpm/bitcoin32.xpm
  47. 277
      src/xpm/bitcoin48.xpm
  48. 292
      src/xpm/bitcoin80.xpm
  49. 41
      src/xpm/check.xpm
  50. 278
      src/xpm/send16.xpm
  51. 278
      src/xpm/send16noshadow.xpm
  52. 282
      src/xpm/send20.xpm

4
.gitignore vendored

@ -10,11 +10,7 @@ src/bitcoind @@ -10,11 +10,7 @@ src/bitcoind
*.patch
.bitcoin
#compilation and Qt preprocessor part
*.o
ui_*.h
*.qm
moc_*
*.moc
Makefile
bitcoin-qt
#resources cpp

9
INSTALL

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
Building Bitcoin
See doc/readme-qt.rst for instructions on building Bitcoin QT,
the intended-for-end-users, nice-graphical-interface, reference
implementation of Bitcoin.
See doc/build-*.txt for instructions on building bitcoind,
the intended-for-services, no-graphical-interface, reference
implementation of Bitcoin.

12
README-original.md → README.md

@ -28,3 +28,15 @@ help test the Bitcoin core, please contact QA@BitcoinTesting.org. @@ -28,3 +28,15 @@ help test the Bitcoin core, please contact QA@BitcoinTesting.org.
Feature branches are created when there are major new features being
worked on by several people.
From time to time a pull request will become outdated. If this occurs, and
the pull is no longer automatically mergeable; a comment on the pull will
be used to issue a warning of closure. The pull will be closed 15 days
after the warning if action is not taken by the author. Pull requests closed
in this manner will have their corresponding issue labeled 'stagnant'.
Issues with no commits will be given a similar warning, and closed after
15 days from their last activity. Issues closed in this manner will be
labeled 'stale'.
Requests to reopen closed pull requests and/or issues can be submitted to
QA@BitcoinTesting.org.

4
bitcoin-qt.pro

@ -12,6 +12,10 @@ CONFIG += no_include_pwd @@ -12,6 +12,10 @@ CONFIG += no_include_pwd
# BOOST_LIB_PATH, BDB_INCLUDE_PATH, BDB_LIB_PATH
# OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
# use: qmake "USE_UPNP=1"
# miniupnpc (http://miniupnp.free.fr/files/) must be installed
count(USE_UPNP, 1) {

2
contrib/Bitcoin.app/Contents/Info.plist

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.4.00</string>
<string>0.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

BIN
contrib/BitcoinTemplate.dmg

Binary file not shown.

60
contrib/create_osx_dmg.sh

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
#!/usr/bin/env bash
#
# Creates a Bitcoin.dmg OSX file from the contrib/BitcoinTemplate.dmg file
#
# Recipe from: http://digital-sushi.org/entry/how-to-create-a-disk-image-installer-for-apple-mac-os-x/
#
# To make a prettier BitcoinTemplate.dmg:
# + open (mount) BitcoinTemplate.dmg
# + change the file properties, icon positions, background image, etc
# + eject, then commit the changed BitcoinTemplate.dmg
#
CWD=$(pwd)
if [ $# -lt 1 ]; then
if [ $(basename $CWD) == "contrib" ]
then
TOP=$(dirname $CWD)
else
echo "Usage: $0 /path/to/bitcoin/tree"
exit 1
fi
else
TOP=$1
fi
CONTRIB=$TOP/contrib
BUILD_DIR=/tmp/bitcoin_osx_build
# First, compile bitcoin and bitcoind
cd "$TOP/src"
if [ ! -e bitcoin ]; then make -f makefile.osx bitcoin; fi
if [ ! -e bitcoind ]; then make -f makefile.osx bitcoind; fi
strip bitcoin bitcoind
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
rm -f Bitcoin.sparseimage
hdiutil convert "$CONTRIB/BitcoinTemplate.dmg" -format UDSP -o Bitcoin
hdiutil mount Bitcoin.sparseimage
# Copy over placeholders in /Volumes/Bitcoin
cp "$TOP/src/bitcoind" /Volumes/Bitcoin/
cp "$TOP/src/bitcoin" /Volumes/Bitcoin/Bitcoin.app/Contents/MacOS/
# Create source code .zip
cd "$TOP"
git archive -o /Volumes/Bitcoin/bitcoin.zip $(git branch 2>/dev/null|grep -e ^* | cut -d ' ' -f 2)
# Fix permissions
chmod -Rf go-w /Volumes/Bitcoin
cd "$BUILD_DIR"
hdiutil eject /Volumes/Bitcoin
rm -f "$CWD/Bitcoin.dmg"
hdiutil convert Bitcoin.sparseimage -format UDBZ -o "$CWD/Bitcoin.dmg"
cd "$CWD"
rm -rf "$BUILD_DIR"

0
contrib/gitian-downloader/bitcoin-download-config → contrib/gitian-downloader/linux-download-config

30
contrib/gitian-downloader/win32-download-config

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
---
name: bitcoin
urls:
- http://bitcoin.org/bitcoin-latest-win32-gitian.zip
rss:
- url: http://sourceforge.net/api/file/index/project-id/244765/mtime/desc/limit/100/rss
xpath: //item/link/text()
pattern: bitcoin-\d+.\d+.\d+-win32-gitian.zip
signers:
0A82509767C7D4A5D14DA2301AE1D35043E08E54:
weight: 40
name: BlueMatt
key: bluematt
BF6273FAEF7CC0BA1F562E50989F6B3048A116B5:
weight: 40
name: Devrandom
key: devrandom
D762373D24904A3E42F33B08B9A408E71DAAC974:
weight: 40
name: Sipa
key: sipa
77E72E69DA7EE0A148C06B21B34821D4944DE5F7:
weight: 40
name: tcatm
key: tcatm
01CDF4627A3B88AAE4A571C87588242FBE38D3A8:
weight: 40
name: "Gavin Andresen"
key: gavinandresen
minimum_weight: 120

2
doc/README

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
Bitcoin 0.4.0rc1 BETA
Bitcoin 0.4.1 BETA
Copyright (c) 2009-2011 Bitcoin Developers
Distributed under the MIT/X11 software license, see the accompanying

2
doc/README_windows.txt

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
Bitcoin 0.4.00rc1 BETA
Bitcoin 0.4.1 BETA
Copyright (c) 2009-2011 Bitcoin Developers
Distributed under the MIT/X11 software license, see the accompanying

21
doc/build-msw.txt

@ -7,6 +7,9 @@ cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP @@ -7,6 +7,9 @@ cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP
software written by Thomas Bernard.
See readme-qt.rst for instructions on building Bitcoin QT, the
graphical user interface.
WINDOWS BUILD NOTES
===================
@ -27,39 +30,24 @@ Dependencies @@ -27,39 +30,24 @@ Dependencies
Libraries you need to download separately and build:
default path download
wxWidgets \wxwidgets-2.9.2-mgw http://www.wxwidgets.org/downloads/
OpenSSL \openssl-1.0.0d-mgw http://www.openssl.org/source/
Berkeley DB \db-4.8.30.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html
Boost \boost-1.47.0-mgw http://www.boost.org/users/download/
miniupnpc \miniupnpc-1.6-mgw http://miniupnp.tuxfamily.org/files/
Their licenses:
wxWidgets LGPL 2.1 with very liberal exceptions
OpenSSL Old BSD license with the problematic advertising requirement
Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license
miniupnpc New (3-clause) BSD license
Versions used in this release:
wxWidgets 2.9.2
OpenSSL 1.0.0d
Berkeley DB 4.8.30.NC
Boost 1.47.0
miniupnpc 1.6
Notes
-----
The UI layout is edited with wxFormBuilder. The project file is
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
classes that do the rote work of constructing all the UI elements.
wxWidgets
---------
DOS shell:
cd \wxWidgets-2.9.2-mgw\build\msw
mingw32-make -f makefile.gcc
OpenSSL
-------
MSYS shell:
@ -98,6 +86,5 @@ Bitcoin @@ -98,6 +86,5 @@ Bitcoin
-------
DOS prompt:
cd \bitcoin\src
mingw32-make bitcoin.exe bitcoind.exe -f makefile.mingw
strip bitcoin.exe
mingw32-make bitcoind.exe -f makefile.mingw
strip bitcoind.exe

102
doc/build-osx.txt

@ -8,11 +8,14 @@ software written by Eric Young (eay@cryptsoft.com) and UPnP software written by @@ -8,11 +8,14 @@ software written by Eric Young (eay@cryptsoft.com) and UPnP software written by
Thomas Bernard.
Mac OS X build instructions
Mac OS X bitcoind build instructions
Laszlo Hanyecz <solar@heliacal.net>
Douglas Huff <dhuff@jrbobdobbs.org>
See readme-qt.rst for instructions on building Bitcoin QT, the
graphical user interface.
Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian.
All of the commands should be executed in Terminal.app.. it's in
@ -32,7 +35,6 @@ structure I use looks like this: @@ -32,7 +35,6 @@ structure I use looks like this:
~/bitcoin/bitcoin # Upstream source tree
~/bitcoin/src # source code (symlink to ~/bitcoin/bitcoin/src)
~/bitcoin/deps # dependencies.. like libraries and headers needed to compile
~/bitcoin/Bitcoin.app # the application bundle where you can run the app
Just execute: mkdir ~/bitcoin
This will create the top dir for you..
@ -180,99 +182,7 @@ cd db-4.8.30/build_unix @@ -180,99 +182,7 @@ cd db-4.8.30/build_unix
../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install
wxWidgets
---------
(The wxWidgets-devel MacPorts package will work but will throw annoying assertion dialogs.)
This is the big one..
Check it out from svn
cd ~/bitcoin/deps
svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk
This will make a wxWidgets-trunk directory in deps.
Use this script snippet, change your prefix to whatever your dir is:
PREFIX=~/bitcoin/deps
SRCDIR="$PREFIX/wxWidgets-trunk"
BUILDDIR="$SRCDIR/macbuild"
cd "$PREFIX" &&
#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk &&
cd "$SRCDIR" &&
[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig &&
sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h &&
[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig &&
sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h &&
rm -vrf "$BUILDDIR" &&
mkdir "$BUILDDIR" &&
cd "$BUILDDIR" &&
../configure --prefix="$PREFIX" \
--with-osx_cocoa \
--disable-shared \
--disable-debug_flag \
--with-macosx-version-min=10.5 \
--enable-stl \
--enable-utf8 \
--enable-universal_binary \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-regex=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
--with-expat=builtin \
--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk &&
find . -name Makefile |
while read i; do
echo $i;
sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new &&
mv "$i" "$i".old &&
mv "$i".new "$i";
done
make &&
make install
Now you should be able to build bitcoin
Now you should be able to build bitcoind:
cd ~/bitcoin/src
make -f makefile.osx bitcoin
Before you can run it, you need to create an application bundle for Mac OS.
A bundle is provided in contrib/Bitcoin.app.
Copy the bitcoin binary in to it like this:
cp -pR ~/bitcoin/bitcoin/contrib/Bitcoin.app ~/bitcoin/
cp ~/bitcoin/src/bitcoin ~/bitcoin/Bitcoin.app/Contents/MacOS/
To run it you can just click the Bitcoin.app in Finder, or just do:
open ~/bitcoin/Bitcoin.app
If you want to run it with arguments you can just run it without backgrounding
by specifying the full name in terminal:
~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66
You can also run it with arguments in the background with output going to the
normal places for apps (Console) like this:
open ~/bitcoin/Bitcoin.app --args -connect=192.75.207.66
It is advisable to relocate Bitcoin.app to /Applications or $HOME/Applications.
make -f makefile.osx bitcoind

77
doc/build-unix.txt

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
Copyright (c) 2009-2010 Satoshi Nakamoto
Copyright (c) 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
@ -14,16 +15,14 @@ To Build @@ -14,16 +15,14 @@ To Build
--------
cd src/
make -f makefile.unix # Headless bitcoin
make -f makefile.unix # Bitcoin with wxWidgets GUI
or
make -f makefile.unix bitcoind # Headless bitcoin
See readme-qt.rst for instructions on building Bitcoin QT,
the graphical bitcoin.
Dependencies
------------
sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
sudo apt-get install libssl-dev
sudo apt-get install libdb4.8-dev
sudo apt-get install libdb4.8++-dev
@ -32,12 +31,6 @@ or Boost 1.37: sudo apt-get install libboost1.37-dev @@ -32,12 +31,6 @@ or Boost 1.37: sudo apt-get install libboost1.37-dev
If using Boost 1.37, append -mt to the boost libraries in the makefile.
Requires wxWidgets 2.9.1 or newer.
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. 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:
@ -46,7 +39,6 @@ USE_UPNP=0 (the default) UPnP support turned off by default at runtime; @@ -46,7 +39,6 @@ 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
Berkeley DB New BSD license with additional requirement that linked software must be free open source
Boost MIT-like license
miniupnpc New (3-clause) BSD license
@ -54,7 +46,6 @@ miniupnpc New (3-clause) BSD license @@ -54,7 +46,6 @@ miniupnpc New (3-clause) BSD license
Versions used in this release:
GCC 4.3.3
OpenSSL 0.9.8g
wxWidgets 2.9.2
Berkeley DB 4.8.30.NC
Boost 1.37
miniupnpc 1.6
@ -62,28 +53,10 @@ miniupnpc 1.6 @@ -62,28 +53,10 @@ miniupnpc 1.6
Notes
-----
The UI layout is edited with wxFormBuilder. The project file is
uiproject.fbp. It generates uibase.cpp and uibase.h, which define base
classes that do the rote work of constructing all the UI elements.
The release is built with GCC and then "strip bitcoin" to strip the debug
symbols, which reduces the executable size by about 90%.
wxWidgets
---------
cd /usr/local
tar -xzvf wxWidgets-2.9.2.tar.gz
cd wxWidgets-2.9.2
mkdir buildgtk
cd buildgtk
../configure --with-gtk --enable-debug --disable-shared --enable-monolithic --without-libpng --disable-svg
make
sudo su
make install
ldconfig
miniupnpc
---------
tar -xzvf miniupnpc-1.6.tar.gz
@ -106,3 +79,45 @@ If you need to build Boost yourself: @@ -106,3 +79,45 @@ If you need to build Boost yourself:
sudo su
./bootstrap.sh
./bjam install
Security
--------
To help make your bitcoin installation more secure by making certain attacks impossible to
exploit even if a vulnerability is found, you can take the following measures:
* Position Independent Executable
Build position independent code to take advantage of Address Space Layout Randomization
offered by some kernels. An attacker who is able to cause execution of code at an arbitrary
memory location is thwarted if he doesn't know where anything useful is located.
The stack and heap are randomly located by default but this allows the code section to be
randomly located as well.
On an Amd64 processor where a library was not compiled with -fPIC, this will cause an error
such as: "relocation R_X86_64_32 against `......' can not be used when making a shared object;"
To build with PIE, use:
make -f makefile.unix ... -e PIE=1
To test that you have built PIE executable, install scanelf, part of paxutils, and use:
scanelf -e ./bitcoin
The output should contain:
TYPE
ET_DYN
* Non-executable Stack
If the stack is executable then trivial stack based buffer overflow exploits are possible if
vulnerable buffers are found. By default, bitcoin should be built with a non-executable stack
but if one of the libraries it uses asks for an executable stack or someone makes a mistake
and uses a compiler extension which requires an executable stack, it will silently build an
executable without the non-executable stack protection.
To verify that the stack is non-executable after compiling use:
scanelf -e ./bitcoin
the output should contain:
STK/REL/PTL
RW- R-- RW-
The STK RW- means that the stack is readable and writeable but not executable.

10
README.rst → doc/readme-qt.rst

@ -19,7 +19,7 @@ Features @@ -19,7 +19,7 @@ Features
- Asks for confirmation before sending coins, for your own safety
- CSV export of transactions and address book (for Excel bookkeeping)
- Shows alternative icon when connected to testnet, so you never accidentally send real coins during testing
- Shows a progress bar on initial block download, so that you don't have to wonder how many blocks it needs to download to be up to date
@ -34,7 +34,7 @@ Features @@ -34,7 +34,7 @@ Features
- Accepts "bitcoin:" URLs from browsers and other sources through drag and drop
Build instructions
Build instructions
===================
Debian
@ -138,7 +138,7 @@ You can execute the following commands in a terminal to install it: @@ -138,7 +138,7 @@ You can execute the following commands in a terminal to install it:
Notification support for recent (k)ubuntu versions
---------------------------------------------------
To see desktop notifications on (k)ubuntu versions starting from 10.04, enable usage of the
To see desktop notifications on (k)ubuntu versions starting from 10.04, enable usage of the
FreeDesktop notification interface through DBUS using the following qmake option:
::
@ -152,10 +152,10 @@ A warning for people using the *static binary* version of Bitcoin on a Linux/UNI @@ -152,10 +152,10 @@ A warning for people using the *static binary* version of Bitcoin on a Linux/UNI
The static binary version of Bitcoin is linked against libdb4.7 or libdb4.8 (see also `this Debian issue`_).
Now the nasty thing is that databases from 5.X are not compatible with 4.X.
Now the nasty thing is that databases from 5.X are not compatible with 4.X.
If the globally installed development package of Berkely DB installed on your system is 5.X, any source you
build yourself will be linked against that. The first time you run with a 5.X version the database will be upgraded,
build yourself will be linked against that. The first time you run with a 5.X version the database will be upgraded,
and 4.X cannot open the new format. This means that you cannot go back to the old statically linked version without
significant hassle!

74
doc/release-process.txt

@ -23,15 +23,45 @@ @@ -23,15 +23,45 @@
* perform gitian builds
* From the bitcoin source dir
$ cd ../gitian-builder
$ ./bin/gbuild --commit bitcoin=v0.3.23 ../bitcoin/contrib/gitian.yml
$ ./bin/gbuild --commit bitcoin=v0.3.23 ../bitcoin/contrib/gitian-win32.yml
* From a directory containing the bitcoin source, gitian-builder and bitcoin-gitian-sigs
$ export VERSION=0.3.23
$ cd ./gitian-builder
$ ./bin/gbuild --commit bitcoin=v$VERSION ../bitcoin/contrib/gitian-descriptors/gitian.yml
$ ./bin/gsign --signer (your gitian key, ie bluematt, sipa, etc) --release $VERSION --destination ../bitcoin-gitian-sigs/ ../bitcoin/contrib/gitian-descriptors/gitian.yml
$ cd build/out
$ zip bitcoin-$VERSION-linux-gitian.zip *
$ mv bitcoin-$VERSION-linux-gitian.zip ../../
$ ./bin/gbuild --commit bitcoin=v$VERSION ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml
$ ./bin/gsign --signer (your gitian key, ie bluematt, sipa, etc) --release $VERSION-win32 --destination ../bitcoin-gitian-sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml
$ cd build/out
$ zip bitcoin-$VERSION-win32-gitian.zip *
$ mv bitcoin-$VERSION-win32-gitian.zip ../../
Build output expected:
1. linux 32-bit and 64-bit binaries + source
2. windows 32-bit binary + source
3. windows installer
1. linux 32-bit and 64-bit binaries + source (bitcoin-$VERSION-linux-gitian.zip)
2. windows 32-bit binary, installer + source (bitcoin-$VERSION-win32-gitian.zip)
3. Gitian signatures (in bitcoin-gitian-sigs/$VERSION[-win32]/(your gitian key)/
* repackage gitian builds for release as stand-alone zip/tar/installer exe
* Windows .zip and setup.exe:
$ mkdir bitcoin-$VERSION-win32
$ cd bitcoin-$VERSION-win32
$ unzip bitcoin-$VERSION-win32-gitian.zip
$ mv bitcoin-$VERSION-win32-setup.exe ..
$ cd ..; zip bitcoin-$VERSION-win32.zip bitcoin-$VERSION-win32
* Linux .tar.gz:
$ mkdir bitcoin-$VERSION-linux
$ cd bitcoin-$VERSION-linux
$ unzip bitcoin-$VERSION-linux-gitian.zip
$ cd ..; tar czvf bitcoin-$VERSION-linux.tar.gz bitcoin-$VERSION-linux
* perform Mac build
* From the bitcoin source dir
$ cd contrib
$ ./create_osx_dmg.sh
$ mv Bitcoin.dmg bitcoin-$VERSION-macosx.dmg
* upload source and builds to SF
@ -45,4 +75,34 @@ @@ -45,4 +75,34 @@
* update wiki download links
* release gitian-signed gitian archives
* Collect enough gitian signatures to meet minimum_weight (see contrib/gitian-downloader/*-download-config)
* From a directory containing bitcoin source, bitcoin-gitian-sigs and gitian zips
$ export VERSION=0.3.23
$ mkdir bitcoin-$VERSION-win32-gitian; cd bitcoin-$VERSION-win32-gitian
$ unzip ../bitcoin-$VERSION-win32-gitian.zip
$ mkdir gitian
$ cp ../bitcoin/contrib/gitian-downloader/*.pgp ./gitian/
$ for file in `ls ../bitcoin-gitian-sigs/$VERSION-win32/`; do
$ cp ../bitcoin-gitian-sigs/$VERSION-win32/$file/bitcoin-build.assert ./gitian/$file-build.assert
$ cp ../bitcoin-gitian-sigs/$VERSION-win32/$file/bitcoin-build.assert.sig ./gitian/$file-build.assert.sig
$ done
$ zip bitcoin-$VERSION-win32-gitian.zip *
$ cp bitcoin-$VERSION-win32-gitian.zip ../
$ cd ..
$ mkdir bitcoin-$VERSION-linux-gitian; cd bitcoin-$VERSION-linux-gitian
$ unzip ../bitcoin-$VERSION-linux-gitian.zip
$ mkdir gitian
$ cp ../bitcoin/contrib/gitian-downloader/*.pgp ./gitian/
$ for file in `ls ../bitcoin-gitian-sigs/$VERSION/`; do
$ cp ../bitcoin-gitian-sigs/$VERSION/$file/bitcoin-build.assert ./gitian/$file-build.assert
$ cp ../bitcoin-gitian-sigs/$VERSION/$file/bitcoin-build.assert.sig ./gitian/$file-build.assert.sig
$ done
$ zip bitcoin-$VERSION-linux-gitian.zip *
$ cp bitcoin-$VERSION-linux-gitian.zip ../
* Upload gitian zips to SF

6
share/setup.nsi

@ -5,7 +5,7 @@ SetCompressor /SOLID lzma @@ -5,7 +5,7 @@ SetCompressor /SOLID lzma
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 0.4.00
!define VERSION 0.4.1
!define COMPANY "Bitcoin project"
!define URL http://www.bitcoin.org/
@ -45,13 +45,13 @@ Var StartMenuGroup @@ -45,13 +45,13 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile bitcoin-0.4.00-win32-setup.exe
OutFile bitcoin-0.4.1-win32-setup.exe
InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on
XPStyle on
BrandingText " "
ShowInstDetails show
VIProductVersion 0.4.00.0
VIProductVersion 0.4.1.0
VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"

6388
share/uiproject.fbp

File diff suppressed because it is too large Load Diff

10
src/bitcoinrpc.cpp

@ -64,11 +64,7 @@ void PrintConsole(const std::string &format, ...) @@ -64,11 +64,7 @@ void PrintConsole(const std::string &format, ...)
buffer[limit-1] = 0;
}
printf("%s", buffer);
#if defined(__WXMSW__) && defined(GUI)
MyMessageBox(buffer, "Bitcoin", wxOK | wxICON_EXCLAMATION);
#else
fprintf(stdout, "%s", buffer);
#endif
}
@ -2357,13 +2353,7 @@ int CommandLineRPC(int argc, char *argv[]) @@ -2357,13 +2353,7 @@ int CommandLineRPC(int argc, char *argv[])
if (strPrint != "")
{
#if defined(__WXMSW__) && defined(GUI)
// Windows GUI apps can't print to command line,
// so settle for a message box yuck
MyMessageBox(strPrint, "Bitcoin", wxOK);
#else
fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
#endif
}
return nRet;
}

2
src/db.cpp

@ -822,7 +822,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet) @@ -822,7 +822,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
ssKey >> strKey;
// Options
#ifndef GUI
#ifndef QT_GUI
if (strKey == "fGenerateBitcoins") ssValue >> fGenerateBitcoins;
#endif
if (strKey == "nTransactionFee") ssValue >> nTransactionFee;

28
src/headers.h

@ -27,14 +27,6 @@ @@ -27,14 +27,6 @@
#define BSD 1
#endif
#endif
#ifdef GUI
#include <wx/wx.h>
#include <wx/stdpaths.h>
#include <wx/snglinst.h>
#include <wx/utils.h>
#include <wx/clipbrd.h>
#include <wx/taskbar.h>
#endif
#include <openssl/buffer.h>
#include <openssl/ecdsa.h>
#include <openssl/evp.h>
@ -95,28 +87,8 @@ @@ -95,28 +87,8 @@
#include "bignum.h"
#include "base58.h"
#include "main.h"
#ifdef GUI
#include "uibase.h"
#include "ui.h"
#else
#ifdef QT_GUI
#include "qtui.h"
#else
#include "noui.h"
#endif
#endif
#ifdef GUI
#include "xpm/addressbook16.xpm"
#include "xpm/addressbook20.xpm"
#include "xpm/bitcoin16.xpm"
#include "xpm/bitcoin20.xpm"
#include "xpm/bitcoin32.xpm"
#include "xpm/bitcoin48.xpm"
#include "xpm/bitcoin80.xpm"
#include "xpm/check.xpm"
#include "xpm/send16.xpm"
#include "xpm/send16noshadow.xpm"
#include "xpm/send20.xpm"
#include "xpm/about.xpm"
#endif

70
src/init.cpp

@ -80,7 +80,7 @@ void HandleSIGTERM(int) @@ -80,7 +80,7 @@ void HandleSIGTERM(int)
//
// Start
//
#if !defined(QT_GUI) && !defined(GUI)
#if !defined(QT_GUI)
int main(int argc, char* argv[])
{
bool fRet = false;
@ -179,6 +179,8 @@ bool AppInit2(int argc, char* argv[]) @@ -179,6 +179,8 @@ bool AppInit2(int argc, char* argv[])
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
" -connect=<ip> \t\t " + _("Connect only to the specified node\n") +
" -nolisten \t " + _("Don't accept connections from outside\n") +
" -banscore=<n> \t " + _("Threshold for disconnecting misbehaving peers (default: 100)\n") +
" -bantime=<n> \t " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)\n") +
#ifdef USE_UPNP
#if USE_UPNP
" -noupnp \t " + _("Don't attempt to use UPnP to map the listening port\n") +
@ -214,14 +216,9 @@ bool AppInit2(int argc, char* argv[]) @@ -214,14 +216,9 @@ bool AppInit2(int argc, char* argv[])
strUsage += string() +
" -? \t\t " + _("This help message\n");
#if defined(__WXMSW__) && defined(GUI)
// Tabs make the columns line up in the message box
wxMessageBox(strUsage, "Bitcoin", wxOK);
#else
// Remove tabs
strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
fprintf(stderr, "%s", strUsage.c_str());
#endif
return false;
}
@ -240,7 +237,7 @@ bool AppInit2(int argc, char* argv[]) @@ -240,7 +237,7 @@ bool AppInit2(int argc, char* argv[])
fServer = GetBoolArg("-server");
/* force fServer when running without GUI */
#if !defined(QT_GUI) && !defined(GUI)
#if !defined(QT_GUI)
fServer = true;
#endif
fPrintToConsole = GetBoolArg("-printtoconsole");
@ -289,11 +286,6 @@ bool AppInit2(int argc, char* argv[]) @@ -289,11 +286,6 @@ bool AppInit2(int argc, char* argv[])
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\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());
printf("Language file %s (%s)\n", (string("locale/") + (string)g_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)g_locale.GetLocale()).c_str());
#endif
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
if (GetBoolArg("-loadblockindextest"))
@ -304,46 +296,6 @@ bool AppInit2(int argc, char* argv[]) @@ -304,46 +296,6 @@ bool AppInit2(int argc, char* argv[])
return false;
}
//
// Limit to single instance per user
// Required to protect the database files if we're going to keep deleting log.*
//
#if defined(__WXMSW__) && defined(GUI)
// wxSingleInstanceChecker doesn't work on Linux
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
for (int i = 0; i < strMutexName.size(); i++)
if (!isalnum(strMutexName[i]))
strMutexName[i] = '.';
wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
if (psingleinstancechecker->IsAnotherRunning())
{
printf("Existing instance found\n");
unsigned int nStart = GetTime();
loop
{
// Show the previous instance and exit
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
if (hwndPrev)
{
if (IsIconic(hwndPrev))
ShowWindow(hwndPrev, SW_RESTORE);
SetForegroundWindow(hwndPrev);
return false;
}
if (GetTime() > nStart + 60)
return false;
// Resume this instance if the other exits
delete psingleinstancechecker;
Sleep(1000);
psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
if (!psingleinstancechecker->IsAnotherRunning())
break;
}
}
#endif
// 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.
@ -536,13 +488,8 @@ bool AppInit2(int argc, char* argv[]) @@ -536,13 +488,8 @@ bool AppInit2(int argc, char* argv[])
}
//
// Create the main window and start the node
// Start the node
//
#ifdef GUI
if (!fDaemon)
CreateMainWindow();
#endif
if (!CheckDiskSpace())
return false;
@ -554,12 +501,7 @@ bool AppInit2(int argc, char* argv[]) @@ -554,12 +501,7 @@ bool AppInit2(int argc, char* argv[])
if (fServer)
CreateThread(ThreadRPCServer, NULL);
#if defined(__WXMSW__) && defined(GUI)
if (fFirstRun)
SetStartOnSystemStartup(true);
#endif
#if !defined(QT_GUI) && !defined(GUI)
#if !defined(QT_GUI)
while (1)
Sleep(5000);
#endif

86
src/main.cpp

@ -293,24 +293,24 @@ bool CTransaction::CheckTransaction() const @@ -293,24 +293,24 @@ bool CTransaction::CheckTransaction() const
{
// Basic checks that don't depend on any context
if (vin.empty())
return error("CTransaction::CheckTransaction() : vin empty");
return DoS(10, error("CTransaction::CheckTransaction() : vin empty"));
if (vout.empty())
return error("CTransaction::CheckTransaction() : vout empty");
return DoS(10, error("CTransaction::CheckTransaction() : vout empty"));
// Size limits
if (::GetSerializeSize(*this, SER_NETWORK) > MAX_BLOCK_SIZE)
return error("CTransaction::CheckTransaction() : size limits failed");
return DoS(100, error("CTransaction::CheckTransaction() : size limits failed"));
// Check for negative or overflow output values
int64 nValueOut = 0;
BOOST_FOREACH(const CTxOut& txout, vout)
{
if (txout.nValue < 0)
return error("CTransaction::CheckTransaction() : txout.nValue negative");
return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue negative"));
if (txout.nValue > MAX_MONEY)
return error("CTransaction::CheckTransaction() : txout.nValue too high");
return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue too high"));
nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
return error("CTransaction::CheckTransaction() : txout total out of range");
return DoS(100, error("CTransaction::CheckTransaction() : txout total out of range"));
}
// Check for duplicate inputs
@ -325,13 +325,13 @@ bool CTransaction::CheckTransaction() const @@ -325,13 +325,13 @@ bool CTransaction::CheckTransaction() const
if (IsCoinBase())
{
if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)
return error("CTransaction::CheckTransaction() : coinbase script size");
return DoS(100, error("CTransaction::CheckTransaction() : coinbase script size"));
}
else
{
BOOST_FOREACH(const CTxIn& txin, vin)
if (txin.prevout.IsNull())
return error("CTransaction::CheckTransaction() : prevout is null");
return DoS(10, error("CTransaction::CheckTransaction() : prevout is null"));
}
return true;
@ -347,7 +347,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi @@ -347,7 +347,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
// Coinbase is only valid in a block, not as a loose transaction
if (IsCoinBase())
return error("AcceptToMemoryPool() : coinbase as individual tx");
return DoS(100, error("AcceptToMemoryPool() : coinbase as individual tx"));
// To help v0.1.5 clients who would see it as a negative number
if ((int64)nLockTime > INT_MAX)
@ -360,7 +360,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi @@ -360,7 +360,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
// 34 bytes because a TxOut is:
// 20-byte address + 8 byte bitcoin amount + 5 bytes of ops + 1 byte script length
if (GetSigOpCount() > nSize / 34 || nSize < 100)
return error("AcceptToMemoryPool() : nonstandard transaction");
return error("AcceptToMemoryPool() : transaction with out-of-bounds SigOpCount");
// Rather not work on nonstandard transactions (unless -testnet)
if (!fTestNet && !IsStandard())
@ -806,6 +806,9 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo @@ -806,6 +806,9 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo
CBlockIndex* pindexBlock, int64& nFees, bool fBlock, bool fMiner, int64 nMinFee)
{
// Take over previous transactions' spent pointers
// fBlock is true when this is called from AcceptBlock when a new best-block is added to the blockchain
// fMiner is true when called from the internal bitcoin miner
// ... both are false when called from CTransaction::AcceptToMemoryPool
if (!IsCoinBase())
{
int64 nValueIn = 0;
@ -851,7 +854,7 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo @@ -851,7 +854,7 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo
}
if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size())
return error("ConnectInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str());
return DoS(100, error("ConnectInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str()));
// If prev is coinbase, check that it's matured
if (txPrev.IsCoinBase())
@ -859,18 +862,24 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo @@ -859,18 +862,24 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo
if (pindex->nBlockPos == txindex.pos.nBlockPos && pindex->nFile == txindex.pos.nFile)
return error("ConnectInputs() : tried to spend coinbase at depth %d", pindexBlock->nHeight - pindex->nHeight);
// Verify signature
if (!VerifySignature(txPrev, *this, i))
return error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str());
// Check for conflicts
// Skip ECDSA signature verification when connecting blocks (fBlock=true) during initial download
// (before the last blockchain checkpoint). This is safe because block merkle hashes are
// still computed and checked, and any change will be caught at the next checkpoint.
if (!(fBlock && IsInitialBlockDownload()))
// Verify signature
if (!VerifySignature(txPrev, *this, i))
return DoS(100,error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str()));
// Check for conflicts (double-spend)
// This doesn't trigger the DoS code on purpose; if it did, it would make it easier
// for an attacker to attempt to split the network.
if (!txindex.vSpent[prevout.n].IsNull())
return fMiner ? false : error("ConnectInputs() : %s prev tx already used at %s", GetHash().ToString().substr(0,10).c_str(), txindex.vSpent[prevout.n].ToString().c_str());
// Check for negative or overflow input values
nValueIn += txPrev.vout[prevout.n].nValue;
if (!MoneyRange(txPrev.vout[prevout.n].nValue) || !MoneyRange(nValueIn))
return error("ConnectInputs() : txin values out of range");
return DoS(100, error("ConnectInputs() : txin values out of range"));
// Mark outpoints as spent
txindex.vSpent[prevout.n] = posThisTx;
@ -883,17 +892,17 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo @@ -883,17 +892,17 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo
}
if (nValueIn < GetValueOut())
return error("ConnectInputs() : %s value in < value out", GetHash().ToString().substr(0,10).c_str());
return DoS(100, error("ConnectInputs() : %s value in < value out", GetHash().ToString().substr(0,10).c_str()));
// Tally transaction fees
int64 nTxFee = nValueIn - GetValueOut();
if (nTxFee < 0)
return error("ConnectInputs() : %s nTxFee < 0", GetHash().ToString().substr(0,10).c_str());
return DoS(100, error("ConnectInputs() : %s nTxFee < 0", GetHash().ToString().substr(0,10).c_str()));
if (nTxFee < nMinFee)
return false;
nFees += nTxFee;
if (!MoneyRange(nFees))
return error("ConnectInputs() : nFees out of range");
return DoS(100, error("ConnectInputs() : nFees out of range"));
}
if (fBlock)
@ -1236,11 +1245,11 @@ bool CBlock::CheckBlock() const @@ -1236,11 +1245,11 @@ bool CBlock::CheckBlock() const
// Size limits
if (vtx.empty() || vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(*this, SER_NETWORK) > MAX_BLOCK_SIZE)
return error("CheckBlock() : size limits failed");
return DoS(100, error("CheckBlock() : size limits failed"));
// Check proof of work matches claimed amount
if (!CheckProofOfWork(GetHash(), nBits))
return error("CheckBlock() : proof of work failed");
return DoS(50, error("CheckBlock() : proof of work failed"));
// Check timestamp
if (GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60)
@ -1248,23 +1257,23 @@ bool CBlock::CheckBlock() const @@ -1248,23 +1257,23 @@ bool CBlock::CheckBlock() const
// First transaction must be coinbase, the rest must not be
if (vtx.empty() || !vtx[0].IsCoinBase())
return error("CheckBlock() : first tx is not coinbase");
return DoS(100, error("CheckBlock() : first tx is not coinbase"));
for (int i = 1; i < vtx.size(); i++)
if (vtx[i].IsCoinBase())
return error("CheckBlock() : more than one coinbase");
return DoS(100, error("CheckBlock() : more than one coinbase"));
// Check transactions
BOOST_FOREACH(const CTransaction& tx, vtx)
if (!tx.CheckTransaction())
return error("CheckBlock() : CheckTransaction failed");
return DoS(tx.nDoS, error("CheckBlock() : CheckTransaction failed"));
// Check that it's not full of nonstandard transactions
if (GetSigOpCount() > MAX_BLOCK_SIGOPS)
return error("CheckBlock() : too many nonstandard transactions");
return DoS(100, error("CheckBlock() : out-of-bounds SigOpCount"));
// Check merkleroot
if (hashMerkleRoot != BuildMerkleTree())
return error("CheckBlock() : hashMerkleRoot mismatch");
return DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
return true;
}
@ -1279,13 +1288,13 @@ bool CBlock::AcceptBlock() @@ -1279,13 +1288,13 @@ bool CBlock::AcceptBlock()
// Get prev block index
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrevBlock);
if (mi == mapBlockIndex.end())
return error("AcceptBlock() : prev block not found");
return DoS(10, error("AcceptBlock() : prev block not found"));
CBlockIndex* pindexPrev = (*mi).second;
int nHeight = pindexPrev->nHeight+1;
// Check proof of work
if (nBits != GetNextWorkRequired(pindexPrev))
return error("AcceptBlock() : incorrect proof of work");
return DoS(100, error("AcceptBlock() : incorrect proof of work"));
// Check timestamp against prev
if (GetBlockTime() <= pindexPrev->GetMedianTimePast())
@ -1294,7 +1303,7 @@ bool CBlock::AcceptBlock() @@ -1294,7 +1303,7 @@ bool CBlock::AcceptBlock()
// Check that all transactions are finalized
BOOST_FOREACH(const CTransaction& tx, vtx)
if (!tx.IsFinal(nHeight, GetBlockTime()))
return error("AcceptBlock() : contains a non-final transaction");
return DoS(10, error("AcceptBlock() : contains a non-final transaction"));
// Check that the block chain matches the known block chain up to a checkpoint
if (!fTestNet)
@ -1307,7 +1316,7 @@ bool CBlock::AcceptBlock() @@ -1307,7 +1316,7 @@ bool CBlock::AcceptBlock()
(nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) ||
(nHeight == 134444 && hash != uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) ||
(nHeight == 140700 && hash != uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd")))
return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight);
return DoS(100, error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight));
// Write block to history file
if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK)))
@ -1765,7 +1774,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -1765,7 +1774,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
// Each connection can only send one version message
if (pfrom->nVersion != 0)
{
pfrom->Misbehaving(1);
return false;
}
int64 nTime;
CAddress addrMe;
@ -1851,6 +1863,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -1851,6 +1863,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
else if (pfrom->nVersion == 0)
{
// Must have a version message before anything else
pfrom->Misbehaving(1);
return false;
}
@ -1872,7 +1885,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -1872,7 +1885,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (pfrom->nVersion < 31402 && mapAddresses.size() > 1000)
return true;
if (vAddr.size() > 1000)
{
pfrom->Misbehaving(20);
return error("message addr size() = %d", vAddr.size());
}
// Store the new addresses
CAddrDB addrDB;
@ -1930,7 +1946,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -1930,7 +1946,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > 50000)
{
pfrom->Misbehaving(20);
return error("message inv size() = %d", vInv.size());
}
CTxDB txdb("r");
BOOST_FOREACH(const CInv& inv, vInv)
@ -1959,7 +1978,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -1959,7 +1978,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > 50000)
{
pfrom->Misbehaving(20);
return error("message getdata size() = %d", vInv.size());
}
BOOST_FOREACH(const CInv& inv, vInv)
{
@ -2131,6 +2153,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -2131,6 +2153,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
printf("storing orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str());
AddOrphanTx(vMsg);
}
if (tx.nDoS) pfrom->Misbehaving(tx.nDoS);
}
@ -2147,6 +2170,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -2147,6 +2170,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (ProcessBlock(pfrom, &block))
mapAlreadyAskedFor.erase(inv);
if (block.nDoS) pfrom->Misbehaving(block.nDoS);
}

8
src/main.h

@ -400,6 +400,9 @@ public: @@ -400,6 +400,9 @@ public:
std::vector<CTxOut> vout;
unsigned int nLockTime;
// Denial-of-service detection:
mutable int nDoS;
bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; }
CTransaction()
{
@ -421,6 +424,7 @@ public: @@ -421,6 +424,7 @@ public:
vin.clear();
vout.clear();
nLockTime = 0;
nDoS = 0; // Denial-of-service prevention
}
bool IsNull() const
@ -787,6 +791,9 @@ public: @@ -787,6 +791,9 @@ public:
// memory only
mutable std::vector<uint256> vMerkleTree;
// Denial-of-service detection:
mutable int nDoS;
bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; }
CBlock()
{
@ -820,6 +827,7 @@ public: @@ -820,6 +827,7 @@ public:
nNonce = 0;
vtx.clear();
vMerkleTree.clear();
nDoS = 0;
}
bool IsNull() const

28
src/makefile.linux-mingw

@ -10,18 +10,12 @@ INCLUDEPATHS= \ @@ -10,18 +10,12 @@ INCLUDEPATHS= \
-I"$(DEPSDIR)/boost_1_47_0" \
-I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-I"$(DEPSDIR)/openssl-1.0.0d/include" \
-I"$(DEPSDIR)/wxWidgets-2.9.2/lib/gcc_lib/mswud" \
-I"$(DEPSDIR)/wxWidgets-2.9.2/include" \
-I"$(DEPSDIR)/wxWidgets-2.9.2/lib/wx/include/i586-mingw32msvc-msw-unicode-static-2.9/" \
-I"$(DEPSDIR)"
LIBPATHS= \
-L"$(DEPSDIR)/boost_1_47_0/stage/lib" \
-L"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-L"$(DEPSDIR)/openssl-1.0.0d" \
-L"$(DEPSDIR)/wxWidgets-2.9.2/lib"
WXLIBS= -l wx_mswu-2.9-i586-mingw32msvc
-L"$(DEPSDIR)/openssl-1.0.0d"
LIBS= \
-l boost_system-mt-s \
@ -32,8 +26,8 @@ LIBS= \ @@ -32,8 +26,8 @@ LIBS= \
-l ssl \
-l crypto
DEFS=-D_MT -DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g -D__WXDEBUG__
DEFS=-D_MT -DWIN32 -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g
CFLAGS=-O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
HEADERS = \
base58.h \
@ -53,8 +47,6 @@ HEADERS = \ @@ -53,8 +47,6 @@ HEADERS = \
script.h \
serialize.h \
strlcpy.h \
ui.h \
uibase.h \
uint256.h \
util.h \
wallet.h
@ -84,22 +76,11 @@ OBJS= \ @@ -84,22 +76,11 @@ OBJS= \
cryptopp/obj/cpu.o
all: bitcoin.exe
obj/%.o: %.cpp $(HEADERS)
i586-mingw32msvc-g++ -c $(CFLAGS) -DGUI -o $@ $<
all: bitcoind.exe
cryptopp/obj/%.o: cryptopp/%.cpp
i586-mingw32msvc-g++ -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $<
obj/ui_res.o: ../share/ui.rc ../share/pixmaps/bitcoin.ico ../share/pixmaps/check.ico ../share/pixmaps/send16.bmp ../share/pixmaps/send16mask.bmp ../share/pixmaps/send16masknoshadow.bmp ../share/pixmaps/send20.bmp ../share/pixmaps/send20mask.bmp ../share/pixmaps/addressbook16.bmp ../share/pixmaps/addressbook16mask.bmp ../share/pixmaps/addressbook20.bmp ../share/pixmaps/addressbook20mask.bmp
i586-mingw32msvc-windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $<
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o
i586-mingw32msvc-g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
obj/nogui/%.o: %.cpp $(HEADERS)
i586-mingw32msvc-g++ -c $(CFLAGS) -o $@ $<
@ -121,6 +102,5 @@ clean: @@ -121,6 +102,5 @@ clean:
-rm -f cryptopp/obj/*.o
-rm -f test/*.o
-rm -f headers.h.gch
-rm -f bitcoin.exe
-rm -f bitcoind.exe
-rm -f test_bitcoin.exe

33
src/makefile.mingw

@ -7,18 +7,12 @@ USE_UPNP:=0 @@ -7,18 +7,12 @@ USE_UPNP:=0
INCLUDEPATHS= \
-I"C:\boost-1.47.0-mgw" \
-I"C:\db-4.8.30.NC-mgw\build_unix" \
-I"C:\openssl-1.0.0d-mgw\include" \
-I"C:\wxWidgets-2.9.2-mgw\lib\gcc_lib\mswud" \
-I"C:\wxWidgets-2.9.2-mgw\include"
-I"C:\openssl-1.0.0d-mgw\include"
LIBPATHS= \
-L"C:\boost-1.47.0-mgw\stage\lib" \
-L"C:\db-4.8.30.NC-mgw\build_unix" \
-L"C:\openssl-1.0.0d-mgw" \
-L"C:\wxWidgets-2.9.2-mgw\lib\gcc_lib"
WXLIBS= \
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd
-L"C:\openssl-1.0.0d-mgw"
LIBS= \
-l boost_system-mgw45-mt-s-1_47 \
@ -29,8 +23,8 @@ LIBS= \ @@ -29,8 +23,8 @@ LIBS= \
-l ssl \
-l crypto
DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g -D__WXDEBUG__
DEFS=-DWIN32 -D_WINDOWS -DNOPCH -DUSE_SSL -DBOOST_THREAD_USE_LIB
DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
HEADERS = \
base58.h \
@ -50,8 +44,6 @@ HEADERS = \ @@ -50,8 +44,6 @@ HEADERS = \
script.h \
serialize.h \
strlcpy.h \
ui.h \
uibase.h \
uint256.h \
util.h \
wallet.h
@ -82,21 +74,10 @@ OBJS= \ @@ -82,21 +74,10 @@ OBJS= \
cryptopp/obj/cpu.o
all: bitcoin.exe
obj/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -DGUI -o $@ $<
all: bitcoind.exe
cryptopp/obj/%.o: cryptopp/%.cpp
g++ -c $(CFLAGS) -O3 -DCRYPTOPP_X86_ASM_AVAILABLE -o $@ $<
obj/ui_res.o: ../share/ui.rc ../share/pixmaps/bitcoin.ico ../share/pixmaps/check.ico ../share/pixmaps/send16.bmp ../share/pixmaps/send16mask.bmp ../share/pixmaps/send16masknoshadow.bmp ../share/pixmaps/send20.bmp ../share/pixmaps/send20mask.bmp ../share/pixmaps/addressbook16.bmp ../share/pixmaps/addressbook16mask.bmp ../share/pixmaps/addressbook20.bmp ../share/pixmaps/addressbook20mask.bmp
windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $<
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
g++ -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $<
obj/nogui/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
@ -111,7 +92,7 @@ test_bitcoin.exe: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:o @@ -111,7 +92,7 @@ test_bitcoin.exe: obj/test/test_bitcoin.o $(filter-out obj/nogui/init.o,$(OBJS:o
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
clean:
-del /Q bitcoin bitcoind test_bitcoin
-del /Q bitcoind test_bitcoin
-del /Q obj\*
-del /Q obj\nogui\*
-del /Q obj\test\*

20
src/makefile.osx vendored

@ -14,8 +14,6 @@ INCLUDEPATHS= \ @@ -14,8 +14,6 @@ INCLUDEPATHS= \
LIBPATHS= \
-L"$(DEPSDIR)/lib"
WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static)
USE_UPNP:=0
LIBS= -dead_strip \
@ -27,9 +25,9 @@ LIBS= -dead_strip \ @@ -27,9 +25,9 @@ LIBS= -dead_strip \
$(DEPSDIR)/lib/libssl.a \
$(DEPSDIR)/lib/libcrypto.a
DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL
DEFS=-D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL
DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0
DEBUGFLAGS=-g
# ppc doesn't work because we don't support big-endian
CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
HEADERS = \