mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-28 02:46:31 +01:00
Compare commits
288 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d787e00a3b | ||
|
|
e6e87891a9 | ||
|
|
930a07c3f5 | ||
|
|
5a3e82f9f5 | ||
|
|
9cbae55a6e | ||
|
|
cf7c1874fe | ||
|
|
47908a8907 | ||
|
|
d2e2cb0d27 | ||
|
|
98ba262a48 | ||
|
|
bd7d9140f9 | ||
|
|
b1a657a00d | ||
|
|
d9711a5798 | ||
|
|
10abe4f26e | ||
|
|
84e7ad922b | ||
|
|
4698dd9a02 | ||
|
|
c90ea2bd6d | ||
|
|
fdec7fe203 | ||
|
|
18cb92ab18 | ||
|
|
86c0af514b | ||
|
|
2aadc8bb5b | ||
|
|
ae42d69d72 | ||
|
|
5284e1b60e | ||
|
|
05563e9ef2 | ||
|
|
458cf9070b | ||
|
|
245e1b4fdb | ||
|
|
87c1947d49 | ||
|
|
8b8d59eefb | ||
|
|
dbe79d3451 | ||
|
|
10152506fe | ||
|
|
aaac71d38f | ||
|
|
415535e47b | ||
|
|
3475caf8f5 | ||
|
|
f1307515b7 | ||
|
|
ab931be45b | ||
|
|
d9574c2f14 | ||
|
|
1d23c74361 | ||
|
|
0654e1c4ef | ||
|
|
ed4e8830d7 | ||
|
|
c9f70b381d | ||
|
|
b4671902f2 | ||
|
|
76e97c4002 | ||
|
|
1aefe491fb | ||
|
|
04a9217dcf | ||
|
|
fa446a563e | ||
|
|
2eb09b66ef | ||
|
|
80be6e69a9 | ||
|
|
009d5fb41f | ||
|
|
f86655fddd | ||
|
|
0ded557af6 | ||
|
|
72b9861635 | ||
|
|
5f88e8887a | ||
|
|
ddb68acebe | ||
|
|
2d96276e24 | ||
|
|
86c2bdfd5d | ||
|
|
cba3a1741a | ||
|
|
5568d82c26 | ||
|
|
1c0bf23ba2 | ||
|
|
8250760617 | ||
|
|
59948a6e1c | ||
|
|
55c43da5d8 | ||
|
|
809ee79592 | ||
|
|
629e37dde1 | ||
|
|
bc530fe89f | ||
|
|
fc73ad644f | ||
|
|
9c17a685bd | ||
|
|
986b5e257e | ||
|
|
97ee01ad89 | ||
|
|
d12e53ea09 | ||
|
|
8220180133 | ||
|
|
a206a23980 | ||
|
|
0a87c91692 | ||
|
|
865c3a2383 | ||
|
|
f03304a9c7 | ||
|
|
bdde31d787 | ||
|
|
0575c0a667 | ||
|
|
bfd471f53e | ||
|
|
6f8ba620c2 | ||
|
|
84d7c981dc | ||
|
|
24324d83e8 | ||
|
|
b7ccd48dd8 | ||
|
|
94073ecf7b | ||
|
|
776d0f3459 | ||
|
|
262430f705 | ||
|
|
e4ff4e6898 | ||
|
|
593f74b9cb | ||
|
|
298a771494 | ||
|
|
2d8b65e837 | ||
|
|
51d9b435cd | ||
|
|
f35e21e2e4 | ||
|
|
683bcb9154 | ||
|
|
11c570cfb4 | ||
|
|
c4679ad0f1 | ||
|
|
2f7a9997c8 | ||
|
|
8595d31ee8 | ||
|
|
026c5f7617 | ||
|
|
222e3de4be | ||
|
|
910bd45756 | ||
|
|
a0cd439788 | ||
|
|
838e8c9166 | ||
|
|
695aa2d5a2 | ||
|
|
e2a186af10 | ||
|
|
5d4b0c9026 | ||
|
|
461764cbbe | ||
|
|
de374ba6b1 | ||
|
|
3b8848fa4e | ||
|
|
3cac997e19 | ||
|
|
be7eecafd2 | ||
|
|
c891967b6f | ||
|
|
2ea321d85a | ||
|
|
c285051c08 | ||
|
|
2ce73dbe85 | ||
|
|
07c46dac87 | ||
|
|
d9c6b09ac4 | ||
|
|
2ea5fa0710 | ||
|
|
bcd88403e2 | ||
|
|
d1e4a866ad | ||
|
|
5cbf75324d | ||
|
|
2bda554be4 | ||
|
|
2fad3d34b7 | ||
|
|
cc8005b4e7 | ||
|
|
77cd030ac3 | ||
|
|
ed54768f5f | ||
|
|
83082f04a4 | ||
|
|
687c5ef794 | ||
|
|
103849419a | ||
|
|
7d5d89856d | ||
|
|
0a27bd065e | ||
|
|
1b5e57e935 | ||
|
|
b22c884231 | ||
|
|
a2ae4a8a0f | ||
|
|
dc8adc3b48 | ||
|
|
5ccee900a0 | ||
|
|
369010406e | ||
|
|
6ce5af574f | ||
|
|
81b2d877fb | ||
|
|
3764c12b1f | ||
|
|
8d13ca1f11 | ||
|
|
645cc8cf49 | ||
|
|
1c21b7943d | ||
|
|
6aeb45187b | ||
|
|
a43a7dfa58 | ||
|
|
fe37c35018 | ||
|
|
4b36f34d6d | ||
|
|
71cc095cb2 | ||
|
|
43e4a2a289 | ||
|
|
c8ad9b8375 | ||
|
|
41016bfc46 | ||
|
|
2323664a37 | ||
|
|
00728c24e7 | ||
|
|
90e165aa0c | ||
|
|
8555125a1a | ||
|
|
14002c8eba | ||
|
|
a2120986ff | ||
|
|
8c9479c6bb | ||
|
|
6690680538 | ||
|
|
2742fdfda2 | ||
|
|
343328c6b8 | ||
|
|
d3631907d6 | ||
|
|
87cfcfd374 | ||
|
|
522dfe3422 | ||
|
|
c545563d46 | ||
|
|
7a37c906a1 | ||
|
|
43deefa435 | ||
|
|
21ca2d833b | ||
|
|
bb3fd02930 | ||
|
|
c923cdbd5b | ||
|
|
019b456605 | ||
|
|
7d489192fd | ||
|
|
76793dc969 | ||
|
|
6ac7f9f144 | ||
|
|
2d12315c94 | ||
|
|
7f71fd13ae | ||
|
|
819adfff6f | ||
|
|
f5d2bc8a36 | ||
|
|
9db7bf5f52 | ||
|
|
410b618d18 | ||
|
|
c2fa70ddfd | ||
|
|
8a38d5663a | ||
|
|
dd9e71843b | ||
|
|
b34e8c3c36 | ||
|
|
73aa262647 | ||
|
|
e1cb7ce017 | ||
|
|
a75560d828 | ||
|
|
ec82517c89 | ||
|
|
31ffe954b6 | ||
|
|
872d60f6e4 | ||
|
|
2689f4d02b | ||
|
|
3dd20ff2f8 | ||
|
|
9f35575ca3 | ||
|
|
b6dc3b517b | ||
|
|
f0c11b1917 | ||
|
|
40cd036941 | ||
|
|
fe98cf8dc5 | ||
|
|
e96cd730d1 | ||
|
|
4110f33cde | ||
|
|
8e79c64750 | ||
|
|
05708fc63e | ||
|
|
9d2174b6f5 | ||
|
|
8bd66202c3 | ||
|
|
f32339e700 | ||
|
|
c8063ff034 | ||
|
|
cefe611ce5 | ||
|
|
a280b4e661 | ||
|
|
603c7ccea8 | ||
|
|
64f9370691 | ||
|
|
e2bf701454 | ||
|
|
c929529f9f | ||
|
|
6cc56d8e83 | ||
|
|
2adc9062d8 | ||
|
|
6970bd96d1 | ||
|
|
d63b0adabd | ||
|
|
bed3ad104e | ||
|
|
dbe23aadae | ||
|
|
a66d097cbe | ||
|
|
3ca507a6eb | ||
|
|
c58e10565e | ||
|
|
904ff7d07b | ||
|
|
d0ac235c8f | ||
|
|
78c7bb8e26 | ||
|
|
3b318ed095 | ||
|
|
d9dac6772f | ||
|
|
5fe8bc0b4d | ||
|
|
7a47324c78 | ||
|
|
9c1e9f0b6a | ||
|
|
240f3fbe2f | ||
|
|
288424ad63 | ||
|
|
91e615bfec | ||
|
|
9a33582204 | ||
|
|
8a46ed83cc | ||
|
|
5eede9d4d9 | ||
|
|
30158c77e9 | ||
|
|
ee618d7540 | ||
|
|
6ff4388ffa | ||
|
|
794298063d | ||
|
|
bcd2714038 | ||
|
|
f3cd4206b8 | ||
|
|
cc4b78d59f | ||
|
|
297a50a063 | ||
|
|
7271c7ff35 | ||
|
|
19765903dc | ||
|
|
22f721dbf2 | ||
|
|
73278c0a16 | ||
|
|
40d324f102 | ||
|
|
1c5d5e58c6 | ||
|
|
a43c00c569 | ||
|
|
2939cab06d | ||
|
|
9e56521b4b | ||
|
|
80264be428 | ||
|
|
95d839f15c | ||
|
|
9228c53cf5 | ||
|
|
2da02dd774 | ||
|
|
2ed2b9a3e4 | ||
|
|
bd336ba272 | ||
|
|
25b12b8839 | ||
|
|
433fb54b25 | ||
|
|
0bbbee96b7 | ||
|
|
ba0909e96a | ||
|
|
658b5b414a | ||
|
|
70918a6645 | ||
|
|
e4db374421 | ||
|
|
01fe1d2137 | ||
|
|
31e6ea7f5d | ||
|
|
e9c2b5c84d | ||
|
|
158ea66c6c | ||
|
|
1a01afab23 | ||
|
|
85c33b9602 | ||
|
|
93cfb02acb | ||
|
|
fba4088941 | ||
|
|
f7d3cc0e58 | ||
|
|
e66ec79b18 | ||
|
|
99142385da | ||
|
|
e874738d3d | ||
|
|
8938414f0c | ||
|
|
ae3ae3df76 | ||
|
|
7be46ce487 | ||
|
|
fc0e97a70e | ||
|
|
cc0b4c3b62 | ||
|
|
6ccefea62a | ||
|
|
44e1254d1c | ||
|
|
5210998688 | ||
|
|
c199b8499d | ||
|
|
f13dff6977 | ||
|
|
f01a4ca4e2 | ||
|
|
75aa0fbf70 | ||
|
|
d1b70ffa03 | ||
|
|
e00d4805d7 | ||
|
|
edffb50b98 | ||
|
|
4405b78d60 |
16
README.md
Normal file
16
README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
Bitcoin integration/staging tree
|
||||
|
||||
Development process
|
||||
===================
|
||||
|
||||
Developers work in their own trees, then submit pull requests when they think their feature or bug fix is ready.
|
||||
|
||||
If it is a simple/trivial/non-controversial change, then one of the bitcoin development team members simply pulls it.
|
||||
|
||||
If it is a more complicated or potentially controversial change, then the patch submitter will be asked to start a discussion (if they haven't already) on the development forums: http://www.bitcoin.org/smf/index.php?board=6.0
|
||||
The patch will be accepted if there is broad consensus that it is a good thing. Developers should expect to rework and resubmit patches if they don't match the project's coding conventions (see coding.txt) or are controversial.
|
||||
|
||||
The master branch is regularly built and tested (by who? need people willing to be quality assurance testers), and periodically pushed to the subversion repo to become the official, stable, released bitcoin.
|
||||
|
||||
|
||||
Feature branches are created when there are major new features being worked on by several people.
|
||||
2
base58.h
2
base58.h
@@ -152,7 +152,7 @@ inline bool DecodeBase58Check(const string& str, vector<unsigned char>& vchRet)
|
||||
|
||||
|
||||
|
||||
static const unsigned char ADDRESSVERSION = 0;
|
||||
#define ADDRESSVERSION ((unsigned char)(fTestNet ? 111 : 0))
|
||||
|
||||
inline string Hash160ToAddress(uint160 hash160)
|
||||
{
|
||||
|
||||
103
build-msw.txt
103
build-msw.txt
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
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
|
||||
@@ -11,27 +11,25 @@ WINDOWS BUILD NOTES
|
||||
|
||||
Compilers Supported
|
||||
-------------------
|
||||
MinGW GCC (recommended)
|
||||
MinGW GCC http://tdm-gcc.tdragon.net/
|
||||
TDM-GCC with gcc 4.5.1 was used to build this release.
|
||||
MSYS 1.0.11 was also used (sh needed to compile some dependencies)
|
||||
|
||||
MSVC 6.0 SP6: You'll need Boost version 1.34 because they dropped support
|
||||
for MSVC 6.0 after that. However, they didn't add Asio until 1.35.
|
||||
You should still be able to build with MSVC 6.0 by adding Asio to 1.34 by
|
||||
unpacking boost_asio_*.zip into the boost directory:
|
||||
http://sourceforge.net/projects/asio/files/asio
|
||||
|
||||
MSVC 8.0 (2005) SP1 has been tested. Note: MSVC 7.0 and up have a habit of
|
||||
linking to runtime DLLs that are not installed on XP by default.
|
||||
Candidate releases were built with MSVC 10.0 (2010), but
|
||||
compiling with Visual C++ caused rendering artifacts when
|
||||
bitcoin was run.
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
Libraries you need to download separately and build:
|
||||
|
||||
default path download
|
||||
wxWidgets-2.9 \wxwidgets http://www.wxwidgets.org/downloads/
|
||||
OpenSSL \openssl http://www.openssl.org/source/
|
||||
Berkeley DB \db http://www.oracle.com/technology/software/products/berkeley-db/index.html
|
||||
Boost \boost http://www.boost.org/users/download/
|
||||
default path download
|
||||
wxWidgets \wxwidgets-2.9.1-mgw http://www.wxwidgets.org/downloads/
|
||||
OpenSSL \openssl-1.0.0c-mgw http://www.openssl.org/source/
|
||||
Berkeley DB \db-4.7.25.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html
|
||||
Boost \boost-1.43.0-mgw http://www.boost.org/users/download/
|
||||
|
||||
Their licenses:
|
||||
wxWidgets LGPL 2.1 with very liberal exceptions
|
||||
@@ -40,11 +38,10 @@ Berkeley DB New BSD license with additional requirement that linked software
|
||||
Boost MIT-like license
|
||||
|
||||
Versions used in this release:
|
||||
MinGW GCC 3.4.5
|
||||
wxWidgets 2.9.0
|
||||
OpenSSL 0.9.8k
|
||||
wxWidgets 2.9.1
|
||||
OpenSSL 1.0.0c
|
||||
Berkeley DB 4.7.25.NC
|
||||
Boost 1.42.1
|
||||
Boost 1.43.0
|
||||
|
||||
|
||||
Notes
|
||||
@@ -53,62 +50,50 @@ 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.exe" to strip the debug
|
||||
symbols, which reduces the executable size by about 90%.
|
||||
|
||||
|
||||
wxWidgets
|
||||
---------
|
||||
cd \wxwidgets\build\msw
|
||||
make -f makefile.gcc
|
||||
or
|
||||
nmake -f makefile.vc
|
||||
|
||||
DOS shell:
|
||||
cd \wxWidgets-2.9.1-mgw\build\msw
|
||||
mingw32-make -f makefile.gcc
|
||||
|
||||
OpenSSL
|
||||
-------
|
||||
Bitcoin does not use any encryption. If you want to do a no-everything
|
||||
build of OpenSSL to exclude encryption routines, a few patches are required.
|
||||
(instructions for OpenSSL v0.9.8k)
|
||||
MSYS shell:
|
||||
un-tar sources with MSYS 'tar xfz' to avoid issue with symlinks (OpenSSL ticket 2377)
|
||||
change 'MAKE' env. variable from 'C:\MinGW32\bin\mingw32-make.exe' to '/c/MinGW32/bin/mingw32-make.exe'
|
||||
|
||||
Edit engines\e_gmp.c and engines\e_capi.c and add this #ifndef around
|
||||
the openssl/rsa.h include:
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
cd /c/openssl-1.0.0c-mgw
|
||||
./config
|
||||
make
|
||||
|
||||
Edit ms\mingw32.bat and replace the Configure line's parameters with this
|
||||
no-everything list. You have to put this in the batch file because batch
|
||||
files can't take more than nine command line parameters.
|
||||
perl Configure mingw threads no-rc2 no-rc4 no-rc5 no-idea no-des no-bf no-cast no-aes no-camellia no-seed no-rsa no-dh
|
||||
|
||||
Also REM out the following line in ms\mingw32.bat after the mingw32-make
|
||||
line. The build fails after it's already finished building libeay32, which
|
||||
is all we care about, but the failure aborts the script before it runs
|
||||
dllwrap to generate libeay32.dll.
|
||||
REM if errorlevel 1 goto end
|
||||
|
||||
Build
|
||||
cd \openssl
|
||||
ms\mingw32.bat
|
||||
|
||||
If you want to use it with MSVC, generate the .lib file
|
||||
lib /machine:i386 /def:ms\libeay32.def /out:out\libeay32.lib
|
||||
perl util/mkdef.pl 32 libeay enable-static-engine > libeay32.def
|
||||
dllwrap --dllname libeay32.dll --output-lib libeay32.a --def libeay32.def libcrypto.a -lws2_32 -lgdi32
|
||||
|
||||
after that openssl libeay is in main source dir (openssl-1.0.0c-mgw)
|
||||
|
||||
Berkeley DB
|
||||
-----------
|
||||
Using MinGW and MSYS:
|
||||
cd \db\build_unix
|
||||
MSYS shell:
|
||||
cd /c/db-4.7.25.NC-mgw/build_unix
|
||||
sh ../dist/configure --enable-mingw --enable-cxx
|
||||
make
|
||||
|
||||
|
||||
Boost
|
||||
-----
|
||||
download bjam.exe from
|
||||
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941
|
||||
cd \boost
|
||||
DOS prompt:
|
||||
downloaded boost jam 3.1.18
|
||||
cd \boost-1.43.0-mgw
|
||||
bjam toolset=gcc --build-type=complete stage
|
||||
or
|
||||
bjam toolset=msvc --build-type=complete stage
|
||||
|
||||
Note:
|
||||
building with boost 1.45.0 failed because of boost ticket 4614, 4258
|
||||
builds fine with boost 1.43.0
|
||||
|
||||
Bitcoin
|
||||
-------
|
||||
DOS prompt:
|
||||
cd \bitcoin
|
||||
mingw32-make bitcoin.exe bitcoind.exe -f makefile.mingw
|
||||
strip bitcoin.exe
|
||||
strip bitcoind.exe
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
Copyright (c) 2010 Laszlo Hanyecz
|
||||
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
|
||||
|
||||
@@ -9,6 +9,14 @@ cryptographic software written by Eric Young (eay@cryptsoft.com).
|
||||
UNIX BUILD NOTES
|
||||
================
|
||||
|
||||
To Build
|
||||
--------
|
||||
|
||||
make -f makefile.unix # Bitcoin with wxWidgets GUI
|
||||
or
|
||||
make -f makefile.unix bitcoind # Headless bitcoin
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
sudo apt-get install build-essential
|
||||
@@ -21,7 +29,8 @@ 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.
|
||||
|
||||
We're now using wxWidgets 2.9, which uses UTF-8. Don't try 2.8, it won't work.
|
||||
We're using wxWidgets 2.9.0, which uses UTF-8. Don't try 2.8, it won't work.
|
||||
The build hasn't been updated to work with wxWidgets 2.9.1 yet.
|
||||
|
||||
You need to download wxWidgets from http://www.wxwidgets.org/downloads/
|
||||
and build it yourself. See the build instructions and configure parameters
|
||||
|
||||
41
coding.txt
Normal file
41
coding.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
Please be consistent with the existing coding style.
|
||||
|
||||
Block style:
|
||||
|
||||
bool Function(char* psz, int n)
|
||||
{
|
||||
// Comment summarising what this section of code does
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
// When something fails, return early
|
||||
if (!Something())
|
||||
return false;
|
||||
...
|
||||
}
|
||||
|
||||
// Success return is usually at the end
|
||||
return true;
|
||||
}
|
||||
|
||||
- ANSI/Allman block style
|
||||
- 4 space indenting, no tabs
|
||||
- No extra spaces inside parenthesis; please don't do ( this )
|
||||
- No space after function names, one space after if, for and while
|
||||
|
||||
Variable names begin with the type in lowercase, like nSomeVariable.
|
||||
Please don't put the first word of the variable name in lowercase like
|
||||
someVariable.
|
||||
|
||||
Common types:
|
||||
n integer number: short, unsigned short, int, unsigned int,
|
||||
int64, uint64, sometimes char if used as a number
|
||||
d double, float
|
||||
f flag
|
||||
hash uint256
|
||||
p pointer or array, one p for each level of indirection
|
||||
psz pointer to null terminated string
|
||||
str string object
|
||||
v vector or similar list objects
|
||||
map map or multimap
|
||||
set set or multiset
|
||||
bn CBigNum
|
||||
2
cryptopp/obj/.gitignore
vendored
Normal file
2
cryptopp/obj/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
211
db.cpp
211
db.cpp
@@ -8,7 +8,7 @@ void ThreadFlushWalletDB(void* parg);
|
||||
|
||||
|
||||
unsigned int nWalletDBUpdated;
|
||||
|
||||
uint64 nAccountingEntryNumber = 0;
|
||||
|
||||
|
||||
|
||||
@@ -132,6 +132,8 @@ void CDB::Close()
|
||||
|
||||
// Flush database activity from memory pool to disk log
|
||||
unsigned int nMinutes = 0;
|
||||
if (fReadOnly)
|
||||
nMinutes = 1;
|
||||
if (strFile == "addr.dat")
|
||||
nMinutes = 2;
|
||||
if (strFile == "blkindex.dat" && IsInitialBlockDownload() && nBestHeight % 500 != 0)
|
||||
@@ -503,6 +505,11 @@ bool CAddrDB::WriteAddress(const CAddress& addr)
|
||||
return Write(make_pair(string("addr"), addr.GetKey()), addr);
|
||||
}
|
||||
|
||||
bool CAddrDB::EraseAddress(const CAddress& addr)
|
||||
{
|
||||
return Erase(make_pair(string("addr"), addr.GetKey()));
|
||||
}
|
||||
|
||||
bool CAddrDB::LoadAddresses()
|
||||
{
|
||||
CRITICAL_BLOCK(cs_mapAddresses)
|
||||
@@ -554,11 +561,6 @@ bool CAddrDB::LoadAddresses()
|
||||
pcursor->close();
|
||||
|
||||
printf("Loaded %d addresses\n", mapAddresses.size());
|
||||
|
||||
// Fix for possible bug that manifests in mapAddresses.count in irc.cpp,
|
||||
// just need to call count here and it doesn't happen there. The bug was the
|
||||
// pack pragma in irc.cpp and has been fixed, but I'm not in a hurry to delete this.
|
||||
mapAddresses.count(vector<unsigned char>(18));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -576,10 +578,87 @@ bool LoadAddresses()
|
||||
// CWalletDB
|
||||
//
|
||||
|
||||
static set<int64> setKeyPool;
|
||||
static CCriticalSection cs_setKeyPool;
|
||||
|
||||
bool CWalletDB::ReadAccount(const string& strAccount, CAccount& account)
|
||||
{
|
||||
account.SetNull();
|
||||
return Read(make_pair(string("acc"), strAccount), account);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
|
||||
{
|
||||
return Write(make_pair(string("acc"), strAccount), account);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
|
||||
{
|
||||
return Write(make_tuple(string("acentry"), acentry.strAccount, ++nAccountingEntryNumber), acentry);
|
||||
}
|
||||
|
||||
int64 CWalletDB::GetAccountCreditDebit(const string& strAccount)
|
||||
{
|
||||
list<CAccountingEntry> entries;
|
||||
ListAccountCreditDebit(strAccount, entries);
|
||||
|
||||
int64 nCreditDebit = 0;
|
||||
foreach (const CAccountingEntry& entry, entries)
|
||||
nCreditDebit += entry.nCreditDebit;
|
||||
|
||||
return nCreditDebit;
|
||||
}
|
||||
|
||||
void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& entries)
|
||||
{
|
||||
int64 nCreditDebit = 0;
|
||||
|
||||
bool fAllAccounts = (strAccount == "*");
|
||||
|
||||
Dbc* pcursor = GetCursor();
|
||||
if (!pcursor)
|
||||
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
|
||||
unsigned int fFlags = DB_SET_RANGE;
|
||||
loop
|
||||
{
|
||||
// Read next record
|
||||
CDataStream ssKey;
|
||||
if (fFlags == DB_SET_RANGE)
|
||||
ssKey << make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64(0));
|
||||
CDataStream ssValue;
|
||||
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
|
||||
fFlags = DB_NEXT;
|
||||
if (ret == DB_NOTFOUND)
|
||||
break;
|
||||
else if (ret != 0)
|
||||
{
|
||||
pcursor->close();
|
||||
throw runtime_error("CWalletDB::ListAccountCreditDebit() : error scanning DB");
|
||||
}
|
||||
|
||||
// Unserialize
|
||||
string strType;
|
||||
ssKey >> strType;
|
||||
if (strType != "acentry")
|
||||
break;
|
||||
CAccountingEntry acentry;
|
||||
ssKey >> acentry.strAccount;
|
||||
if (!fAllAccounts && acentry.strAccount != strAccount)
|
||||
break;
|
||||
|
||||
ssValue >> acentry;
|
||||
entries.push_back(acentry);
|
||||
}
|
||||
|
||||
pcursor->close();
|
||||
}
|
||||
|
||||
|
||||
bool CWalletDB::LoadWallet()
|
||||
{
|
||||
vchDefaultKey.clear();
|
||||
int nFileVersion = 0;
|
||||
vector<uint256> vWalletUpgrade;
|
||||
|
||||
// Modify defaults
|
||||
#ifndef __WXMSW__
|
||||
@@ -629,6 +708,25 @@ bool CWalletDB::LoadWallet()
|
||||
if (wtx.GetHash() != hash)
|
||||
printf("Error in wallet.dat, hash mismatch\n");
|
||||
|
||||
// Undo serialize changes in 31600
|
||||
if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703)
|
||||
{
|
||||
if (!ssValue.empty())
|
||||
{
|
||||
char fTmp;
|
||||
char fUnused;
|
||||
ssValue >> fTmp >> fUnused >> wtx.strFromAccount;
|
||||
printf("LoadWallet() upgrading tx ver=%d %d '%s' %s\n", wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount.c_str(), hash.ToString().c_str());
|
||||
wtx.fTimeReceivedIsTxTime = fTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("LoadWallet() repairing tx ver=%d %s\n", wtx.fTimeReceivedIsTxTime, hash.ToString().c_str());
|
||||
wtx.fTimeReceivedIsTxTime = 0;
|
||||
}
|
||||
vWalletUpgrade.push_back(hash);
|
||||
}
|
||||
|
||||
//// debug print
|
||||
//printf("LoadWallet %s\n", wtx.GetHash().ToString().c_str());
|
||||
//printf(" %12I64d %s %s %s\n",
|
||||
@@ -637,6 +735,15 @@ bool CWalletDB::LoadWallet()
|
||||
// wtx.hashBlock.ToString().substr(0,20).c_str(),
|
||||
// wtx.mapValue["message"].c_str());
|
||||
}
|
||||
else if (strType == "acentry")
|
||||
{
|
||||
string strAccount;
|
||||
ssKey >> strAccount;
|
||||
uint64 nNumber;
|
||||
ssKey >> nNumber;
|
||||
if (nNumber > nAccountingEntryNumber)
|
||||
nAccountingEntryNumber = nNumber;
|
||||
}
|
||||
else if (strType == "key" || strType == "wkey")
|
||||
{
|
||||
vector<unsigned char> vchPubKey;
|
||||
@@ -654,6 +761,12 @@ bool CWalletDB::LoadWallet()
|
||||
{
|
||||
ssValue >> vchDefaultKey;
|
||||
}
|
||||
else if (strType == "pool")
|
||||
{
|
||||
int64 nIndex;
|
||||
ssKey >> nIndex;
|
||||
setKeyPool.insert(nIndex);
|
||||
}
|
||||
else if (strType == "version")
|
||||
{
|
||||
ssValue >> nFileVersion;
|
||||
@@ -683,6 +796,9 @@ bool CWalletDB::LoadWallet()
|
||||
pcursor->close();
|
||||
}
|
||||
|
||||
foreach(uint256 hash, vWalletUpgrade)
|
||||
WriteTx(hash, mapWallet[hash]);
|
||||
|
||||
printf("nFileVersion = %d\n", nFileVersion);
|
||||
printf("fGenerateBitcoins = %d\n", fGenerateBitcoins);
|
||||
printf("nTransactionFee = %"PRI64d"\n", nTransactionFee);
|
||||
@@ -693,14 +809,6 @@ bool CWalletDB::LoadWallet()
|
||||
printf("addrProxy = %s\n", addrProxy.ToString().c_str());
|
||||
|
||||
|
||||
// The transaction fee setting won't be needed for many years to come.
|
||||
// Setting it to zero here in case they set it to something in an earlier version.
|
||||
if (nTransactionFee != 0)
|
||||
{
|
||||
nTransactionFee = 0;
|
||||
WriteSetting("nTransactionFee", nTransactionFee);
|
||||
}
|
||||
|
||||
// Upgrade
|
||||
if (nFileVersion < VERSION)
|
||||
{
|
||||
@@ -711,6 +819,7 @@ bool CWalletDB::LoadWallet()
|
||||
WriteVersion(VERSION);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -836,3 +945,77 @@ void BackupWallet(const string& strDest)
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CWalletDB::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool)
|
||||
{
|
||||
nIndex = -1;
|
||||
keypool.vchPubKey.clear();
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
CRITICAL_BLOCK(cs_setKeyPool)
|
||||
{
|
||||
// Top up key pool
|
||||
int64 nTargetSize = max(GetArg("-keypool", 100), (int64)0);
|
||||
while (setKeyPool.size() < nTargetSize+1)
|
||||
{
|
||||
int64 nEnd = 1;
|
||||
if (!setKeyPool.empty())
|
||||
nEnd = *(--setKeyPool.end()) + 1;
|
||||
if (!Write(make_pair(string("pool"), nEnd), CKeyPool(GenerateNewKey())))
|
||||
throw runtime_error("ReserveKeyFromKeyPool() : writing generated key failed");
|
||||
setKeyPool.insert(nEnd);
|
||||
printf("keypool added key %"PRI64d", size=%d\n", nEnd, setKeyPool.size());
|
||||
}
|
||||
|
||||
// Get the oldest key
|
||||
assert(!setKeyPool.empty());
|
||||
nIndex = *(setKeyPool.begin());
|
||||
setKeyPool.erase(setKeyPool.begin());
|
||||
if (!Read(make_pair(string("pool"), nIndex), keypool))
|
||||
throw runtime_error("ReserveKeyFromKeyPool() : read failed");
|
||||
if (!mapKeys.count(keypool.vchPubKey))
|
||||
throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool");
|
||||
assert(!keypool.vchPubKey.empty());
|
||||
printf("keypool reserve %"PRI64d"\n", nIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void CWalletDB::KeepKey(int64 nIndex)
|
||||
{
|
||||
// Remove from key pool
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
{
|
||||
Erase(make_pair(string("pool"), nIndex));
|
||||
}
|
||||
printf("keypool keep %"PRI64d"\n", nIndex);
|
||||
}
|
||||
|
||||
void CWalletDB::ReturnKey(int64 nIndex)
|
||||
{
|
||||
// Return to key pool
|
||||
CRITICAL_BLOCK(cs_setKeyPool)
|
||||
setKeyPool.insert(nIndex);
|
||||
printf("keypool return %"PRI64d"\n", nIndex);
|
||||
}
|
||||
|
||||
vector<unsigned char> GetKeyFromKeyPool()
|
||||
{
|
||||
CWalletDB walletdb;
|
||||
int64 nIndex = 0;
|
||||
CKeyPool keypool;
|
||||
walletdb.ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
walletdb.KeepKey(nIndex);
|
||||
return keypool.vchPubKey;
|
||||
}
|
||||
|
||||
int64 GetOldestKeyPoolTime()
|
||||
{
|
||||
CWalletDB walletdb;
|
||||
int64 nIndex = 0;
|
||||
CKeyPool keypool;
|
||||
walletdb.ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
walletdb.ReturnKey(nIndex);
|
||||
return keypool.nTime;
|
||||
}
|
||||
|
||||
99
db.h
99
db.h
@@ -11,6 +11,8 @@ class CUser;
|
||||
class CReview;
|
||||
class CAddress;
|
||||
class CWalletTx;
|
||||
class CAccount;
|
||||
class CAccountingEntry;
|
||||
|
||||
extern map<string, string> mapAddressBook;
|
||||
extern CCriticalSection cs_mapAddressBook;
|
||||
@@ -24,6 +26,8 @@ extern DbEnv dbenv;
|
||||
|
||||
|
||||
extern void DBFlush(bool fShutdown);
|
||||
extern vector<unsigned char> GetKeyFromKeyPool();
|
||||
extern int64 GetOldestKeyPoolTime();
|
||||
|
||||
|
||||
|
||||
@@ -261,7 +265,7 @@ public:
|
||||
class CTxDB : public CDB
|
||||
{
|
||||
public:
|
||||
CTxDB(const char* pszMode="r+") : CDB(!fClient ? "blkindex.dat" : NULL, pszMode) { }
|
||||
CTxDB(const char* pszMode="r+") : CDB("blkindex.dat", pszMode) { }
|
||||
private:
|
||||
CTxDB(const CTxDB&);
|
||||
void operator=(const CTxDB&);
|
||||
@@ -298,6 +302,7 @@ private:
|
||||
void operator=(const CAddrDB&);
|
||||
public:
|
||||
bool WriteAddress(const CAddress& addr);
|
||||
bool EraseAddress(const CAddress& addr);
|
||||
bool LoadAddresses();
|
||||
};
|
||||
|
||||
@@ -308,10 +313,41 @@ bool LoadAddresses();
|
||||
|
||||
|
||||
|
||||
class CKeyPool
|
||||
{
|
||||
public:
|
||||
int64 nTime;
|
||||
vector<unsigned char> vchPubKey;
|
||||
|
||||
CKeyPool()
|
||||
{
|
||||
nTime = GetTime();
|
||||
}
|
||||
|
||||
CKeyPool(const vector<unsigned char>& vchPubKeyIn)
|
||||
{
|
||||
nTime = GetTime();
|
||||
vchPubKey = vchPubKeyIn;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (!(nType & SER_GETHASH))
|
||||
READWRITE(nVersion);
|
||||
READWRITE(nTime);
|
||||
READWRITE(vchPubKey);
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CWalletDB : public CDB
|
||||
{
|
||||
public:
|
||||
CWalletDB(const char* pszMode="r+") : CDB("wallet.dat", pszMode) { }
|
||||
CWalletDB(const char* pszMode="r+") : CDB("wallet.dat", pszMode)
|
||||
{
|
||||
}
|
||||
private:
|
||||
CWalletDB(const CWalletDB&);
|
||||
void operator=(const CWalletDB&);
|
||||
@@ -395,7 +431,20 @@ public:
|
||||
return Write(make_pair(string("setting"), strKey), value);
|
||||
}
|
||||
|
||||
bool ReadAccount(const string& strAccount, CAccount& account);
|
||||
bool WriteAccount(const string& strAccount, const CAccount& account);
|
||||
bool WriteAccountingEntry(const CAccountingEntry& acentry);
|
||||
int64 GetAccountCreditDebit(const string& strAccount);
|
||||
void ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& acentries);
|
||||
|
||||
bool LoadWallet();
|
||||
protected:
|
||||
void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
|
||||
void KeepKey(int64 nIndex);
|
||||
static void ReturnKey(int64 nIndex);
|
||||
friend class CReserveKey;
|
||||
friend vector<unsigned char> GetKeyFromKeyPool();
|
||||
friend int64 GetOldestKeyPoolTime();
|
||||
};
|
||||
|
||||
bool LoadWallet(bool& fFirstRunRet);
|
||||
@@ -405,3 +454,49 @@ inline bool SetAddressBookName(const string& strAddress, const string& strName)
|
||||
{
|
||||
return CWalletDB().WriteName(strAddress, strName);
|
||||
}
|
||||
|
||||
class CReserveKey
|
||||
{
|
||||
protected:
|
||||
int64 nIndex;
|
||||
vector<unsigned char> vchPubKey;
|
||||
public:
|
||||
CReserveKey()
|
||||
{
|
||||
nIndex = -1;
|
||||
}
|
||||
|
||||
~CReserveKey()
|
||||
{
|
||||
if (!fShutdown)
|
||||
ReturnKey();
|
||||
}
|
||||
|
||||
vector<unsigned char> GetReservedKey()
|
||||
{
|
||||
if (nIndex == -1)
|
||||
{
|
||||
CKeyPool keypool;
|
||||
CWalletDB().ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
vchPubKey = keypool.vchPubKey;
|
||||
}
|
||||
assert(!vchPubKey.empty());
|
||||
return vchPubKey;
|
||||
}
|
||||
|
||||
void KeepKey()
|
||||
{
|
||||
if (nIndex != -1)
|
||||
CWalletDB().KeepKey(nIndex);
|
||||
nIndex = -1;
|
||||
vchPubKey.clear();
|
||||
}
|
||||
|
||||
void ReturnKey()
|
||||
{
|
||||
if (nIndex != -1)
|
||||
CWalletDB::ReturnKey(nIndex);
|
||||
nIndex = -1;
|
||||
vchPubKey.clear();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <db_cxx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
@@ -70,6 +71,7 @@
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/interprocess/sync/file_lock.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
|
||||
#include <boost/date_time/gregorian/gregorian_types.hpp>
|
||||
|
||||
108
init.cpp
108
init.cpp
@@ -158,24 +158,47 @@ bool AppInit2(int argc, char* argv[])
|
||||
|
||||
if (mapArgs.count("-?") || mapArgs.count("--help"))
|
||||
{
|
||||
string beta = VERSION_IS_BETA ? _(" beta") : "";
|
||||
string strUsage = string() +
|
||||
_("Bitcoin version") + " " + FormatVersion(VERSION) + pszSubVer + beta + "\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") +
|
||||
" bitcoin [options] help \t\t " + _("List commands\n") +
|
||||
" bitcoin [options] help <command> \t\t " + _("Get help for a command\n") +
|
||||
_("Options:\n") +
|
||||
" -conf=<file> \t " + _("Specify configuration file (default: bitcoin.conf)\n") +
|
||||
" -gen \t " + _("Generate coins\n") +
|
||||
" -gen=0 \t " + _("Don't generate coins\n") +
|
||||
" -min \t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port>\t " + _("Connect through socks4 proxy\n") +
|
||||
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
|
||||
" -connect=<ip> \t " + _("Connect only to the specified node\n") +
|
||||
" -server \t " + _("Accept command line and JSON-RPC commands\n") +
|
||||
" -daemon \t " + _("Run in the background as a daemon and accept commands\n") +
|
||||
" -? \t " + _("This help message\n");
|
||||
" -conf=<file> \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") +
|
||||
" -gen \t\t " + _("Generate coins\n") +
|
||||
" -gen=0 \t\t " + _("Don't generate coins\n") +
|
||||
" -min \t\t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t\t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") +
|
||||
" -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") +
|
||||
" -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send\n") +
|
||||
" -server \t\t " + _("Accept command line and JSON-RPC commands\n") +
|
||||
" -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") +
|
||||
" -testnet \t\t " + _("Use the test network\n") +
|
||||
" -rpcuser=<user> \t " + _("Username for JSON-RPC connections\n") +
|
||||
" -rpcpassword=<pw>\t " + _("Password for JSON-RPC connections\n") +
|
||||
" -rpcport=<port> \t\t " + _("Listen for JSON-RPC connections on <port> (default: 8332)\n") +
|
||||
" -rpcallowip=<ip> \t\t " + _("Allow JSON-RPC connections from specified IP address\n") +
|
||||
" -rpcconnect=<ip> \t " + _("Send commands to node running on <ip> (default: 127.0.0.1)\n") +
|
||||
" -keypool=<n> \t " + _("Set key pool size to <n> (default: 100)\n") +
|
||||
" -rescan \t " + _("Rescan the block chain for missing wallet transactions\n");
|
||||
|
||||
#ifdef USE_SSL
|
||||
strUsage += string() +
|
||||
_("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)\n") +
|
||||
" -rpcssl \t " + _("Use OpenSSL (https) for JSON-RPC connections\n") +
|
||||
" -rpcsslcertificatechainfile=<file.cert>\t " + _("Server certificate file (default: server.cert)\n") +
|
||||
" -rpcsslprivatekeyfile=<file.pem> \t " + _("Server private key (default: server.pem)\n") +
|
||||
" -rpcsslciphers=<ciphers> \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n");
|
||||
#endif
|
||||
|
||||
strUsage += string() +
|
||||
" -? \t\t " + _("This help message\n");
|
||||
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
// Tabs make the columns line up in the message box
|
||||
@@ -188,11 +211,14 @@ bool AppInit2(int argc, char* argv[])
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-debug"))
|
||||
fDebug = true;
|
||||
fDebug = GetBoolArg("-debug");
|
||||
|
||||
if (mapArgs.count("-printtodebugger"))
|
||||
fPrintToDebugger = true;
|
||||
fPrintToConsole = GetBoolArg("-printtoconsole");
|
||||
fPrintToDebugger = GetBoolArg("-printtodebugger");
|
||||
|
||||
fTestNet = GetBoolArg("-testnet");
|
||||
|
||||
fNoListen = GetBoolArg("-nolisten");
|
||||
|
||||
if (fCommandLine)
|
||||
{
|
||||
@@ -203,7 +229,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 beta\n", FormatVersion(VERSION).c_str(), pszSubVer);
|
||||
printf("Bitcoin version %s%s%s\n", FormatVersion(VERSION).c_str(), pszSubVer, VERSION_IS_BETA ? _(" beta") : "");
|
||||
#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());
|
||||
@@ -211,7 +237,7 @@ bool AppInit2(int argc, char* argv[])
|
||||
#endif
|
||||
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
|
||||
|
||||
if (mapArgs.count("-loadblockindextest"))
|
||||
if (GetBoolArg("-loadblockindextest"))
|
||||
{
|
||||
CTxDB txdb("r");
|
||||
txdb.LoadBlockIndex();
|
||||
@@ -224,8 +250,7 @@ bool AppInit2(int argc, char* argv[])
|
||||
// Required to protect the database files if we're going to keep deleting log.*
|
||||
//
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
// todo: wxSingleInstanceChecker wasn't working on Linux, never deleted its lock file
|
||||
// maybe should go by whether successfully bind port 8333 instead
|
||||
// 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]))
|
||||
@@ -237,7 +262,6 @@ bool AppInit2(int argc, char* argv[])
|
||||
unsigned int nStart = GetTime();
|
||||
loop
|
||||
{
|
||||
// TODO: find out how to do this in Linux, or replace with wxWidgets commands
|
||||
// Show the previous instance and exit
|
||||
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
|
||||
if (hwndPrev)
|
||||
@@ -261,15 +285,28 @@ bool AppInit2(int argc, char* argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
// This is a backup to wxSingleInstanceChecker, which doesn't work on Linux.
|
||||
string strErrors;
|
||||
if (!BindListenPort(strErrors))
|
||||
// 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);
|
||||
static boost::interprocess::file_lock lock(strLockFile.c_str());
|
||||
if (!lock.try_lock())
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
wxMessageBox(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin is probably already running."), GetDataDir().c_str()), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
string strErrors;
|
||||
if (!fNoListen)
|
||||
{
|
||||
if (!BindListenPort(strErrors))
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Load data files
|
||||
//
|
||||
@@ -297,6 +334,13 @@ bool AppInit2(int argc, char* argv[])
|
||||
strErrors += _("Error loading wallet.dat \n");
|
||||
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
if (GetBoolArg("-rescan"))
|
||||
{
|
||||
nStart = GetTimeMillis();
|
||||
ScanForWalletTransactions(pindexGenesisBlock);
|
||||
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
}
|
||||
|
||||
printf("Done loading\n");
|
||||
|
||||
//// debug print
|
||||
@@ -319,7 +363,7 @@ bool AppInit2(int argc, char* argv[])
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (mapArgs.count("-printblockindex") || mapArgs.count("-printblocktree"))
|
||||
if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
|
||||
{
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
@@ -348,13 +392,7 @@ bool AppInit2(int argc, char* argv[])
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-gen"))
|
||||
{
|
||||
if (mapArgs["-gen"].empty())
|
||||
fGenerateBitcoins = true;
|
||||
else
|
||||
fGenerateBitcoins = (atoi(mapArgs["-gen"].c_str()) != 0);
|
||||
}
|
||||
fGenerateBitcoins = GetBoolArg("-gen");
|
||||
|
||||
if (mapArgs.count("-proxy"))
|
||||
{
|
||||
@@ -385,7 +423,7 @@ bool AppInit2(int argc, char* argv[])
|
||||
wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
if (nTransactionFee > 1 * COIN)
|
||||
if (nTransactionFee > 0.25 * COIN)
|
||||
wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
|
||||
@@ -405,7 +443,7 @@ bool AppInit2(int argc, char* argv[])
|
||||
if (!CreateThread(StartNode, NULL))
|
||||
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
|
||||
|
||||
if (mapArgs.count("-server") || fDaemon)
|
||||
if (GetBoolArg("-server") || fDaemon)
|
||||
CreateThread(ThreadRPCServer, NULL);
|
||||
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
|
||||
131
irc.cpp
131
irc.cpp
@@ -5,6 +5,7 @@
|
||||
#include "headers.h"
|
||||
|
||||
int nGotIRCAddresses = 0;
|
||||
bool fGotExternalIP = false;
|
||||
|
||||
void ThreadIRCSeed2(void* parg);
|
||||
|
||||
@@ -84,18 +85,31 @@ bool RecvLine(SOCKET hSocket, string& strLine)
|
||||
}
|
||||
else if (nBytes <= 0)
|
||||
{
|
||||
if (fShutdown)
|
||||
return false;
|
||||
if (nBytes < 0)
|
||||
{
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEMSGSIZE)
|
||||
continue;
|
||||
if (nErr == WSAEWOULDBLOCK || nErr == WSAEINTR || nErr == WSAEINPROGRESS)
|
||||
{
|
||||
Sleep(10);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!strLine.empty())
|
||||
return true;
|
||||
// socket closed
|
||||
printf("IRC socket closed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket error
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
|
||||
if (nBytes == 0)
|
||||
{
|
||||
// socket closed
|
||||
printf("IRC socket closed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket error
|
||||
int nErr = WSAGetLastError();
|
||||
printf("IRC recv failed: %d\n", nErr);
|
||||
return false;
|
||||
}
|
||||
@@ -126,7 +140,7 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)
|
||||
}
|
||||
}
|
||||
|
||||
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
|
||||
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL, const char* psz4=NULL)
|
||||
{
|
||||
loop
|
||||
{
|
||||
@@ -141,6 +155,8 @@ int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const cha
|
||||
return 2;
|
||||
if (psz3 && strLine.find(psz3) != -1)
|
||||
return 3;
|
||||
if (psz4 && strLine.find(psz4) != -1)
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +174,70 @@ bool Wait(int nSeconds)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet)
|
||||
{
|
||||
strRet.clear();
|
||||
loop
|
||||
{
|
||||
string strLine;
|
||||
if (!RecvLineIRC(hSocket, strLine))
|
||||
return false;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 2)
|
||||
continue;
|
||||
|
||||
if (vWords[1] == psz1)
|
||||
{
|
||||
printf("IRC %s\n", strLine.c_str());
|
||||
strRet = strLine;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GetIPFromIRC(SOCKET hSocket, string strMyName, unsigned int& ipRet)
|
||||
{
|
||||
Send(hSocket, strprintf("USERHOST %s\r", strMyName.c_str()).c_str());
|
||||
|
||||
string strLine;
|
||||
if (!RecvCodeLine(hSocket, "302", strLine))
|
||||
return false;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 4)
|
||||
return false;
|
||||
|
||||
string str = vWords[3];
|
||||
if (str.rfind("@") == string::npos)
|
||||
return false;
|
||||
string strHost = str.substr(str.rfind("@")+1);
|
||||
|
||||
unsigned int a=0, b=0, c=0, d=0;
|
||||
if (sscanf(strHost.c_str(), "%u.%u.%u.%u", &a, &b, &c, &d) == 4 &&
|
||||
inet_addr(strHost.c_str()) != INADDR_NONE)
|
||||
{
|
||||
printf("GetIPFromIRC() userhost is IP %s\n", strHost.c_str());
|
||||
ipRet = CAddress(strHost).ip;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hybrid IRC used by lfnet always returns IP when you userhost yourself,
|
||||
// but in case another IRC is ever used this should work.
|
||||
printf("GetIPFromIRC() got userhost %s\n", strHost.c_str());
|
||||
if (fUseProxy)
|
||||
return false;
|
||||
struct hostent* phostent = gethostbyname(strHost.c_str());
|
||||
if (!phostent || !phostent->h_addr_list || !phostent->h_addr_list[0])
|
||||
return false;
|
||||
ipRet = *(u_long*)phostent->h_addr_list[0];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ThreadIRCSeed(void* parg)
|
||||
@@ -177,9 +257,11 @@ void ThreadIRCSeed(void* parg)
|
||||
|
||||
void ThreadIRCSeed2(void* parg)
|
||||
{
|
||||
if (mapArgs.count("-connect"))
|
||||
/* Dont advertise on IRC if we don't allow incoming connections */
|
||||
if (mapArgs.count("-connect") || fNoListen)
|
||||
return;
|
||||
if (mapArgs.count("-noirc"))
|
||||
|
||||
if (GetBoolArg("-noirc"))
|
||||
return;
|
||||
printf("ThreadIRCSeed started\n");
|
||||
int nErrorWait = 10;
|
||||
@@ -210,7 +292,7 @@ void ThreadIRCSeed2(void* parg)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname"))
|
||||
if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname", "ignoring hostname"))
|
||||
{
|
||||
closesocket(hSocket);
|
||||
hSocket = INVALID_SOCKET;
|
||||
@@ -250,8 +332,23 @@ void ThreadIRCSeed2(void* parg)
|
||||
}
|
||||
Sleep(500);
|
||||
|
||||
Send(hSocket, "JOIN #bitcoin\r");
|
||||
Send(hSocket, "WHO #bitcoin\r");
|
||||
// Get our external IP from the IRC server and re-nick before joining the channel
|
||||
CAddress addrFromIRC;
|
||||
if (GetIPFromIRC(hSocket, strMyName, addrFromIRC.ip))
|
||||
{
|
||||
printf("GetIPFromIRC() returned %s\n", addrFromIRC.ToStringIP().c_str());
|
||||
if (!fUseProxy && addrFromIRC.IsRoutable())
|
||||
{
|
||||
// IRC lets you to re-nick
|
||||
fGotExternalIP = true;
|
||||
addrLocalHost.ip = addrFromIRC.ip;
|
||||
strMyName = EncodeAddress(addrLocalHost);
|
||||
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Send(hSocket, fTestNet ? "JOIN #bitcoinTEST\r" : "JOIN #bitcoin\r");
|
||||
Send(hSocket, fTestNet ? "WHO #bitcoinTEST\r" : "WHO #bitcoin\r");
|
||||
|
||||
int64 nStart = GetTime();
|
||||
string strLine;
|
||||
@@ -291,8 +388,8 @@ void ThreadIRCSeed2(void* parg)
|
||||
CAddress addr;
|
||||
if (DecodeAddress(pszName, addr))
|
||||
{
|
||||
addr.nTime = GetAdjustedTime() - 51 * 60;
|
||||
if (AddAddress(addr))
|
||||
addr.nTime = GetAdjustedTime();
|
||||
if (AddAddress(addr, 51 * 60))
|
||||
printf("IRC got new address\n");
|
||||
nGotIRCAddresses++;
|
||||
}
|
||||
|
||||
1
irc.h
1
irc.h
@@ -6,3 +6,4 @@ bool RecvLine(SOCKET hSocket, string& strLine);
|
||||
void ThreadIRCSeed(void* parg);
|
||||
|
||||
extern int nGotIRCAddresses;
|
||||
extern bool fGotExternalIP;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
Copyright (c) 2009-2010 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
|
||||
|
||||
Binary file not shown.
@@ -321,8 +321,8 @@ msgstr "Beim schließen &Minimieren"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version %s%s beta"
|
||||
msgstr "Version %s%s Beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "Version %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
@@ -698,7 +698,7 @@ msgstr "Version"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -709,7 +709,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Dies ist experimentelle Software.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -350,8 +350,8 @@ msgstr "&Minimizar al cerrar"
|
||||
|
||||
#: ../../../ui.cpp:1610
|
||||
#, c-format
|
||||
msgid "version %s%s beta"
|
||||
msgstr "version %s%s beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "version %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1696
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
@@ -727,7 +727,7 @@ msgstr "version"
|
||||
|
||||
#: ../../../uibase.cpp:557
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -738,7 +738,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Este es un software experimental.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -351,8 +351,8 @@ msgstr "&Réduire à la fermeture"
|
||||
|
||||
#: ../../../ui.cpp:1610
|
||||
#, c-format
|
||||
msgid "version %s%s beta"
|
||||
msgstr "version %s%s beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "version %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1696
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
@@ -730,7 +730,7 @@ msgstr "version"
|
||||
|
||||
#: ../../../uibase.cpp:557
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -741,7 +741,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Ceci est un logiciel expérimental.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -319,8 +319,8 @@ msgstr "&Minimizza se chiuso"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version %s%s beta"
|
||||
msgstr "versione %s%s beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "versione %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
@@ -696,7 +696,7 @@ msgstr "versione"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -707,7 +707,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Questo è un software sperimentale.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -320,8 +320,8 @@ msgstr "&Minimalizeer bij sluiten"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version %s%s beta"
|
||||
msgstr "versie %s%s beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "versie %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
@@ -697,7 +697,7 @@ msgstr "versie"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -708,7 +708,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Dit is experimentele software.\n"
|
||||
"\n"
|
||||
|
||||
Binary file not shown.
@@ -319,8 +319,8 @@ msgstr "&Minimizar ao fechar"
|
||||
|
||||
#: ../../../ui.cpp:1595
|
||||
#, c-format
|
||||
msgid "version %s%s beta"
|
||||
msgstr "versão %s%s beta"
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "versão %s%s BETA"
|
||||
|
||||
#: ../../../ui.cpp:1681
|
||||
msgid "Will appear as \"From: Unknown\""
|
||||
@@ -696,7 +696,7 @@ msgstr "versão"
|
||||
|
||||
#: ../../../uibase.cpp:563
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
@@ -707,7 +707,7 @@ msgid ""
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Copyright (c) 2009-2010 Satoshi Nakamoto.\n"
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Este software é experimental.\n"
|
||||
"\n"
|
||||
|
||||
BIN
locale/ru/LC_MESSAGES/bitcoin.mo
Normal file
BIN
locale/ru/LC_MESSAGES/bitcoin.mo
Normal file
Binary file not shown.
895
locale/ru/LC_MESSAGES/bitcoin.po
Normal file
895
locale/ru/LC_MESSAGES/bitcoin.po
Normal file
@@ -0,0 +1,895 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-10-05 10:53+0300\n"
|
||||
"PO-Revision-Date: 2010-10-05 11:43+0300\n"
|
||||
"Last-Translator: eurekafag\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SearchPath-0: ../../..\n"
|
||||
|
||||
#: ../../../init.cpp:162
|
||||
msgid "Usage:"
|
||||
msgstr "Использование"
|
||||
|
||||
#: ../../../init.cpp:164
|
||||
msgid "Send command to -server or bitcoind\n"
|
||||
msgstr "Отправить команду bitcoin, запущенному с -server\n"
|
||||
|
||||
#: ../../../init.cpp:165
|
||||
msgid "List commands\n"
|
||||
msgstr "Список команд\n"
|
||||
|
||||
#: ../../../init.cpp:166
|
||||
msgid "Get help for a command\n"
|
||||
msgstr "Получить помощь для команды\n"
|
||||
|
||||
#: ../../../init.cpp:167
|
||||
msgid "Options:\n"
|
||||
msgstr "Параметры:\n"
|
||||
|
||||
#: ../../../init.cpp:168
|
||||
msgid "Specify configuration file (default: bitcoin.conf)\n"
|
||||
msgstr "Укажите конфигурационный файл (по умолчанию: bitcoin.conf)\n"
|
||||
|
||||
#: ../../../init.cpp:169
|
||||
msgid "Generate coins\n"
|
||||
msgstr "Генерировать монеты\n"
|
||||
|
||||
#: ../../../init.cpp:170
|
||||
msgid "Don't generate coins\n"
|
||||
msgstr "Не генерировать монеты\n"
|
||||
|
||||
#: ../../../init.cpp:171
|
||||
msgid "Start minimized\n"
|
||||
msgstr "Запускать свёрнутым\n"
|
||||
|
||||
#: ../../../init.cpp:172
|
||||
msgid "Specify data directory\n"
|
||||
msgstr "Указать каталог данных\n"
|
||||
|
||||
#: ../../../init.cpp:173
|
||||
msgid "Connect through socks4 proxy\n"
|
||||
msgstr "Подключаться через socks4 прокси\n"
|
||||
|
||||
#: ../../../init.cpp:174
|
||||
msgid "Add a node to connect to\n"
|
||||
msgstr "Добавить узел для подключения\n"
|
||||
|
||||
#: ../../../init.cpp:175
|
||||
msgid "Connect only to the specified node\n"
|
||||
msgstr "Подключаться только к указанному узлу\n"
|
||||
|
||||
#: ../../../init.cpp:176
|
||||
msgid "Accept command line and JSON-RPC commands\n"
|
||||
msgstr "Принимать команды из командной строки и через JSON-RPC\n"
|
||||
|
||||
#: ../../../init.cpp:177
|
||||
msgid "Run in the background as a daemon and accept commands\n"
|
||||
msgstr "Запустить в фоне как демон и принимать команды\n"
|
||||
|
||||
#: ../../../init.cpp:178
|
||||
msgid "This help message\n"
|
||||
msgstr "Эта справка\n"
|
||||
|
||||
#: ../../../init.cpp:284
|
||||
msgid "Error loading addr.dat \n"
|
||||
msgstr "Ошибка загрузки addr.dat \n"
|
||||
|
||||
#: ../../../init.cpp:290
|
||||
msgid "Error loading blkindex.dat \n"
|
||||
msgstr "Ошибка загрузки blkindex.dat \n"
|
||||
|
||||
#: ../../../init.cpp:297
|
||||
msgid "Error loading wallet.dat \n"
|
||||
msgstr "Ошибка загрузки wallet.dat \n"
|
||||
|
||||
#: ../../../init.cpp:365
|
||||
msgid "Invalid -proxy address"
|
||||
msgstr "Неверный адрес -proxy"
|
||||
|
||||
#: ../../../init.cpp:385
|
||||
msgid "Invalid amount for -paytxfee=<amount>"
|
||||
msgstr "Неверное значение для -paytxfee=<amount>"
|
||||
|
||||
#: ../../../init.cpp:389
|
||||
msgid "Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."
|
||||
msgstr "Внимание: -paytxfee установлено в очень большое значение. Это комиссия, которую вы будете платить при переводе."
|
||||
|
||||
#: ../../../main.cpp:1641
|
||||
msgid "Warning: Disk space is low "
|
||||
msgstr "Внимание: мало места на диске "
|
||||
|
||||
#: ../../../main.cpp:3505
|
||||
#, c-format
|
||||
msgid "Error: This is an oversized transaction that requires a transaction fee of %s "
|
||||
msgstr "Ошибка: этот перевод слишком большого размера, который требует комиссию %s "
|
||||
|
||||
#: ../../../main.cpp:3507
|
||||
msgid "Error: Transaction creation failed "
|
||||
msgstr "Ошибка: не удалось создать перевод "
|
||||
|
||||
#: ../../../main.cpp:3512
|
||||
#: ../../../ui.cpp:1964
|
||||
#: ../../../ui.cpp:1966
|
||||
#: ../../../ui.cpp:2107
|
||||
#: ../../../ui.cpp:2260
|
||||
msgid "Sending..."
|
||||
msgstr "Отправка..."
|
||||
|
||||
#: ../../../main.cpp:3516
|
||||
msgid "Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
|
||||
msgstr "Перевод был отклонен. Это могло произойти, если некоторые из монет в вашем кошельке уже были потрачены, например, если вы использовали копию wallet.dat, и монеты были потрачены в копии, но не отмечены израсходованными здесь."
|
||||
|
||||
#: ../../../main.cpp:3528
|
||||
msgid "Invalid amount"
|
||||
msgstr "Неверное количество"
|
||||
|
||||
#: ../../../main.cpp:3530
|
||||
#: ../../../ui.cpp:2174
|
||||
#: ../../../ui.cpp:2245
|
||||
msgid "Insufficient funds"
|
||||
msgstr "Недостаточно средств"
|
||||
|
||||
#: ../../../main.cpp:3535
|
||||
msgid "Invalid bitcoin address"
|
||||
msgstr "Неверный адрес bitcoin"
|
||||
|
||||
#: ../../../rpc.cpp:963
|
||||
#: ../../../rpc.cpp:965
|
||||
#, c-format
|
||||
msgid "To use the %s option"
|
||||
msgstr "Чтобы использовать опцию %s"
|
||||
|
||||
#: ../../../rpc.cpp:967
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Warning: %s, you must set rpcpassword=<password>\n"
|
||||
"in the configuration file: %s\n"
|
||||
"If the file does not exist, create it with owner-readable-only file permissions.\n"
|
||||
msgstr ""
|
||||
"Внимание: %s, вы должны установить rpcpassword=<пароль>\n"
|
||||
"в конфигурационном файле: %s\n"
|
||||
"Если файл не существует, создайте его с правами \"чтение только владельцем\".\n"
|
||||
|
||||
#: ../../../rpc.cpp:1100
|
||||
#, c-format
|
||||
msgid ""
|
||||
"You must set rpcpassword=<password> in the configuration file:\n"
|
||||
"%s\n"
|
||||
"If the file does not exist, create it with owner-readable-only file permissions."
|
||||
msgstr ""
|
||||
"Вы должны установить rpcpassword=<пароль> в конфигурационном файле:\n"
|
||||
"%s\n"
|
||||
"Если файл не существует, создайте его с правами \"чтение только владельцем\"."
|
||||
|
||||
#: ../../../ui.cpp:202
|
||||
#, c-format
|
||||
msgid "This transaction is over the size limit. You can still send it for a fee of %s, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?"
|
||||
msgstr "Этот перевод превышает допустимый лимит. Вы можете провести его с комиссией %s, которую получат узлы, обрабатывающие перевод, и поможет поддерживать сеть. Вы хотите заплатить комиссию?"
|
||||
|
||||
#: ../../../ui.cpp:301
|
||||
msgid "Status"
|
||||
msgstr "Статус"
|
||||
|
||||
#: ../../../ui.cpp:302
|
||||
msgid "Date"
|
||||
msgstr "Дата"
|
||||
|
||||
#: ../../../ui.cpp:303
|
||||
msgid "Description"
|
||||
msgstr "Описание"
|
||||
|
||||
#: ../../../ui.cpp:304
|
||||
msgid "Debit"
|
||||
msgstr "Дебет"
|
||||
|
||||
#: ../../../ui.cpp:305
|
||||
msgid "Credit"
|
||||
msgstr "Кредит"
|
||||
|
||||
#: ../../../ui.cpp:511
|
||||
#, c-format
|
||||
msgid "Open for %d blocks"
|
||||
msgstr "Открыто для %d блоков"
|
||||
|
||||
#: ../../../ui.cpp:513
|
||||
#, c-format
|
||||
msgid "Open until %s"
|
||||
msgstr "Открыто до %s"
|
||||
|
||||
#: ../../../ui.cpp:519
|
||||
#, c-format
|
||||
msgid "%d/offline?"
|
||||
msgstr "%d/оффлайн?"
|
||||
|
||||
#: ../../../ui.cpp:521
|
||||
#, c-format
|
||||
msgid "%d/unconfirmed"
|
||||
msgstr "%d/не подтверждено"
|
||||
|
||||
#: ../../../ui.cpp:523
|
||||
#, c-format
|
||||
msgid "%d confirmations"
|
||||
msgstr "%d подтверждений"
|
||||
|
||||
#: ../../../ui.cpp:608
|
||||
msgid "Generated"
|
||||
msgstr "Сгенерировано"
|
||||
|
||||
#: ../../../ui.cpp:616
|
||||
#, c-format
|
||||
msgid "Generated (%s matures in %d more blocks)"
|
||||
msgstr "Сгенерировано (%s станет доступно через %d блоков)"
|
||||
|
||||
#: ../../../ui.cpp:620
|
||||
msgid "Generated - Warning: This block was not received by any other nodes and will probably not be accepted!"
|
||||
msgstr "Сгенерировано - Внимание: этот блок не был получен ни одним узлом и, скорее всего, не будет принят!"
|
||||
|
||||
#: ../../../ui.cpp:624
|
||||
msgid "Generated (not accepted)"
|
||||
msgstr "Сгенерировано (не принято)"
|
||||
|
||||
#: ../../../ui.cpp:634
|
||||
msgid "From: "
|
||||
msgstr "От: "
|
||||
|
||||
#: ../../../ui.cpp:658
|
||||
msgid "Received with: "
|
||||
msgstr "Получено для: "
|
||||
|
||||
#: ../../../ui.cpp:704
|
||||
msgid "Payment to yourself"
|
||||
msgstr "Платёж самому себе"
|
||||
|
||||
#: ../../../ui.cpp:741
|
||||
msgid "To: "
|
||||
msgstr "Кому: "
|
||||
|
||||
#: ../../../ui.cpp:1049
|
||||
msgid " Generating"
|
||||
msgstr " Генерация"
|
||||
|
||||
#: ../../../ui.cpp:1051
|
||||
msgid "(not connected)"
|
||||
msgstr "(не подключен)"
|
||||
|
||||
#: ../../../ui.cpp:1054
|
||||
#, c-format
|
||||
msgid " %d connections %d blocks %d transactions"
|
||||
msgstr " %d подключений %d блоков %d переводов"
|
||||
|
||||
#: ../../../ui.cpp:1165
|
||||
#: ../../../ui.cpp:2560
|
||||
msgid "New Receiving Address"
|
||||
msgstr "Новый адрес получения"
|
||||
|
||||
#: ../../../ui.cpp:1166
|
||||
#: ../../../ui.cpp:2561
|
||||
msgid ""
|
||||
"You should use a new address for each payment you receive.\n"
|
||||
"\n"
|
||||
"Label"
|
||||
msgstr ""
|
||||
"Вы должны использовать новый адрес для каждого получаемого платежа.\n"
|
||||
"\n"
|
||||
"Метка"
|
||||
|
||||
#: ../../../ui.cpp:1235
|
||||
msgid "<b>Status:</b> "
|
||||
msgstr "<b>Статус:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1240
|
||||
msgid ", has not been successfully broadcast yet"
|
||||
msgstr ", ещё не был успешно разослан"
|
||||
|
||||
#: ../../../ui.cpp:1242
|
||||
#, c-format
|
||||
msgid ", broadcast through %d node"
|
||||
msgstr ", рассылка через %d узел"
|
||||
|
||||
#: ../../../ui.cpp:1244
|
||||
#, c-format
|
||||
msgid ", broadcast through %d nodes"
|
||||
msgstr ", рассылка через %d узлов"
|
||||
|
||||
#: ../../../ui.cpp:1248
|
||||
msgid "<b>Date:</b> "
|
||||
msgstr "<b>Дата:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1256
|
||||
msgid "<b>Source:</b> Generated<br>"
|
||||
msgstr "<b>Источник:</b> Сгенерировано<br>"
|
||||
|
||||
#: ../../../ui.cpp:1262
|
||||
#: ../../../ui.cpp:1280
|
||||
msgid "<b>From:</b> "
|
||||
msgstr "<b>От:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1280
|
||||
msgid "unknown"
|
||||
msgstr "аноним"
|
||||
|
||||
#: ../../../ui.cpp:1281
|
||||
#: ../../../ui.cpp:1305
|
||||
#: ../../../ui.cpp:1364
|
||||
msgid "<b>To:</b> "
|
||||
msgstr "<b>Кому:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1284
|
||||
msgid " (yours, label: "
|
||||
msgstr " (ваш, метка: "
|
||||
|
||||
#: ../../../ui.cpp:1286
|
||||
msgid " (yours)"
|
||||
msgstr " (ваш)"
|
||||
|
||||
#: ../../../ui.cpp:1323
|
||||
#: ../../../ui.cpp:1335
|
||||
#: ../../../ui.cpp:1398
|
||||
msgid "<b>Credit:</b> "
|
||||
msgstr "<b>Кредит:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1325
|
||||
#, c-format
|
||||
msgid "(%s matures in %d more blocks)"
|
||||
msgstr "(%s станет доступно через %d блоков)"
|
||||
|
||||
#: ../../../ui.cpp:1327
|
||||
msgid "(not accepted)"
|
||||
msgstr "(не принято)"
|
||||
|
||||
#: ../../../ui.cpp:1372
|
||||
#: ../../../ui.cpp:1395
|
||||
msgid "<b>Debit:</b> "
|
||||
msgstr "<b>Дебет:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1386
|
||||
msgid "<b>Transaction fee:</b> "
|
||||
msgstr "<b>Комиссия:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1402
|
||||
msgid "<b>Net amount:</b> "
|
||||
msgstr "<b>Количество сети:</b> "
|
||||
|
||||
#: ../../../ui.cpp:1409
|
||||
msgid "Message:"
|
||||
msgstr "Сообщение:"
|
||||
|
||||
#: ../../../ui.cpp:1412
|
||||
msgid "Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours."
|
||||
msgstr "Сгенерированные монеты должны ждать 120 блоков, прежде чем они могут быть потрачены. Когда вы сгенерировали этот блок, он был разослан в сети для добавления в цепь блоков. Если не удалось добавить этот блок в цепь, он будет обозначен как \"не принятый\" и не может быть потрачен. Такое может случиться, если другой узел сгенерировал блок через несколько секунд после вас."
|
||||
|
||||
#: ../../../ui.cpp:1593
|
||||
msgid "Cannot write autostart/bitcoin.desktop file"
|
||||
msgstr "Не удаётся записать файл autostart/bitcoin.desktop"
|
||||
|
||||
#: ../../../ui.cpp:1629
|
||||
msgid "Main"
|
||||
msgstr "Основные"
|
||||
|
||||
#: ../../../ui.cpp:1634
|
||||
msgid "&Start Bitcoin on window system startup"
|
||||
msgstr "&Запускать Bitcoin при запуске оконной системы"
|
||||
|
||||
#: ../../../ui.cpp:1641
|
||||
msgid "&Minimize on close"
|
||||
msgstr "&Сворачивать при закрытии"
|
||||
|
||||
#: ../../../ui.cpp:1798
|
||||
#, c-format
|
||||
msgid "version %s%s BETA"
|
||||
msgstr "версия %s%s бета"
|
||||
|
||||
#: ../../../ui.cpp:1884
|
||||
msgid "n/a"
|
||||
msgstr "н/д"
|
||||
|
||||
#: ../../../ui.cpp:1885
|
||||
msgid "Can't include a message when sending to a Bitcoin address"
|
||||
msgstr "Не удаётся включить сообщение при отправке на адрес Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:1938
|
||||
msgid "Error in amount "
|
||||
msgstr "Ошибка в количестве "
|
||||
|
||||
#: ../../../ui.cpp:1938
|
||||
#: ../../../ui.cpp:1943
|
||||
#: ../../../ui.cpp:1948
|
||||
#: ../../../ui.cpp:1974
|
||||
#: ../../../uibase.cpp:59
|
||||
msgid "Send Coins"
|
||||
msgstr "Отправить монеты"
|
||||
|
||||
#: ../../../ui.cpp:1943
|
||||
msgid "Amount exceeds your balance "
|
||||
msgstr "Количество превышает ваш баланс "
|
||||
|
||||
#: ../../../ui.cpp:1948
|
||||
msgid "Total exceeds your balance when the "
|
||||
msgstr "Общая сумма превышает ваш баланс, когда "
|
||||
|
||||
#: ../../../ui.cpp:1948
|
||||
msgid " transaction fee is included "
|
||||
msgstr " комиссия включена "
|
||||
|
||||
#: ../../../ui.cpp:1964
|
||||
msgid "Payment sent "
|
||||
msgstr "Платёж отправлен "
|
||||
|
||||
#: ../../../ui.cpp:1974
|
||||
msgid "Invalid address "
|
||||
msgstr "Неверный адрес "
|
||||
|
||||
#: ../../../ui.cpp:2028
|
||||
#, c-format
|
||||
msgid "Sending %s to %s"
|
||||
msgstr "Отправка %s для %s"
|
||||
|
||||
#: ../../../ui.cpp:2101
|
||||
#: ../../../ui.cpp:2134
|
||||
msgid "CANCELLED"
|
||||
msgstr "ОТМЕНЕНО"
|
||||
|
||||
#: ../../../ui.cpp:2105
|
||||
msgid "Cancelled"
|
||||
msgstr "Отменено"
|
||||
|
||||
#: ../../../ui.cpp:2107
|
||||
msgid "Transfer cancelled "
|
||||
msgstr "Передача отменена "
|
||||
|
||||
#: ../../../ui.cpp:2160
|
||||
msgid "Error: "
|
||||
msgstr "Ошибка: "
|
||||
|
||||
#: ../../../ui.cpp:2179
|
||||
msgid "Connecting..."
|
||||
msgstr "Подключение..."
|
||||
|
||||
#: ../../../ui.cpp:2184
|
||||
msgid "Unable to connect"
|
||||
msgstr "Невозможно подключиться"
|
||||
|
||||
#: ../../../ui.cpp:2189
|
||||
msgid "Requesting public key..."
|
||||
msgstr "Запрос публичного ключа..."
|
||||
|
||||
#: ../../../ui.cpp:2201
|
||||
msgid "Received public key..."
|
||||
msgstr "Получен публичный ключ..."
|
||||
|
||||
#: ../../../ui.cpp:2215
|
||||
msgid "Recipient is not accepting transactions sent by IP address"
|
||||
msgstr "Получатель не принимает переводы на IP-адрес"
|
||||
|
||||
#: ../../../ui.cpp:2217
|
||||
msgid "Transfer was not accepted"
|
||||
msgstr "Передача не принята"
|
||||
|
||||
#: ../../../ui.cpp:2226
|
||||
msgid "Invalid response received"
|
||||
msgstr "Получен неверный отклик"
|
||||
|
||||
#: ../../../ui.cpp:2241
|
||||
msgid "Creating transaction..."
|
||||
msgstr "Создание перевода..."
|
||||
|
||||
#: ../../../ui.cpp:2253
|
||||
#, c-format
|
||||
msgid "This is an oversized transaction that requires a transaction fee of %s"
|
||||
msgstr "Это слишком большой перевод, который требует комиссию в размере %s"
|
||||
|
||||
#: ../../../ui.cpp:2255
|
||||
msgid "Transaction creation failed"
|
||||
msgstr "Не удалось создать перевод"
|
||||
|
||||
#: ../../../ui.cpp:2262
|
||||
msgid "Transaction aborted"
|
||||
msgstr "Перевод прерван"
|
||||
|
||||
#: ../../../ui.cpp:2270
|
||||
msgid "Lost connection, transaction cancelled"
|
||||
msgstr "Соединение разорвано, перевод отменён"
|
||||
|
||||
#: ../../../ui.cpp:2286
|
||||
msgid "Sending payment..."
|
||||
msgstr "Отправка платежа..."
|
||||
|
||||
#: ../../../ui.cpp:2292
|
||||
msgid "The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."
|
||||
msgstr "Перевод был отклонён. Это могло произойти, если некоторые из монет в вашем кошельке уже были потрачены, например, если вы использовали копию wallet.dat, и монеты были потрачены в копии, но не отмечены израсходованными здесь."
|
||||
|
||||
#: ../../../ui.cpp:2301
|
||||
msgid "Waiting for confirmation..."
|
||||
msgstr "Ожидание подтверждения..."
|
||||
|
||||
#: ../../../ui.cpp:2319
|
||||
msgid ""
|
||||
"The payment was sent, but the recipient was unable to verify it.\n"
|
||||
"The transaction is recorded and will credit to the recipient,\n"
|
||||
"but the comment information will be blank."
|
||||
msgstr ""
|
||||
"Платёж был отправлен, но получатель не смог проверить его.\n"
|
||||
"Перевод был записан и будет начислен получателю,\n"
|
||||
"но поле комментария будет пустое."
|
||||
|
||||
#: ../../../ui.cpp:2328
|
||||
msgid "Payment was sent, but an invalid response was received"
|
||||
msgstr "Платёж отправлен, но был получен неверный отклик"
|
||||
|
||||
#: ../../../ui.cpp:2334
|
||||
msgid "Payment completed"
|
||||
msgstr "Платёж проведён"
|
||||
|
||||
#: ../../../ui.cpp:2365
|
||||
#: ../../../ui.cpp:2511
|
||||
#: ../../../ui.cpp:2548
|
||||
msgid "Name"
|
||||
msgstr "Имя"
|
||||
|
||||
#: ../../../ui.cpp:2366
|
||||
#: ../../../ui.cpp:2511
|
||||
#: ../../../ui.cpp:2548
|
||||
msgid "Address"
|
||||
msgstr "Адрес"
|
||||
|
||||
#: ../../../ui.cpp:2368
|
||||
#: ../../../ui.cpp:2523
|
||||
msgid "Label"
|
||||
msgstr "Метка"
|
||||
|
||||
#: ../../../ui.cpp:2369
|
||||
#: ../../../uibase.cpp:902
|
||||
msgid "Bitcoin Address"
|
||||
msgstr "Адрес Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2493
|
||||
msgid "This is one of your own addresses for receiving payments and cannot be entered in the address book. "
|
||||
msgstr "Это один из ваших собственных адресов для получения платежей, он не может быть внесён в адресную книгу. "
|
||||
|
||||
#: ../../../ui.cpp:2511
|
||||
#: ../../../ui.cpp:2517
|
||||
msgid "Edit Address"
|
||||
msgstr "Правка адреса"
|
||||
|
||||
#: ../../../ui.cpp:2523
|
||||
msgid "Edit Address Label"
|
||||
msgstr "Правка метки адреса"
|
||||
|
||||
#: ../../../ui.cpp:2548
|
||||
#: ../../../ui.cpp:2554
|
||||
msgid "Add Address"
|
||||
msgstr "Добавить адрес"
|
||||
|
||||
#: ../../../ui.cpp:2630
|
||||
msgid "Bitcoin"
|
||||
msgstr "Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2632
|
||||
msgid "Bitcoin - Generating"
|
||||
msgstr "Bitcoin - Генерация"
|
||||
|
||||
#: ../../../ui.cpp:2634
|
||||
msgid "Bitcoin - (not connected)"
|
||||
msgstr "Bitcoin - (не подключен)"
|
||||
|
||||
#: ../../../ui.cpp:2711
|
||||
msgid "&Open Bitcoin"
|
||||
msgstr "&Открыть Bitcoin"
|
||||
|
||||
#: ../../../ui.cpp:2712
|
||||
msgid "O&ptions..."
|
||||
msgstr "О&пции..."
|
||||
|
||||
#: ../../../ui.cpp:2713
|
||||
#: ../../../uibase.cpp:32
|
||||
msgid "&Generate Coins"
|
||||
msgstr "&Генерировать монеты"
|
||||
|
||||
#: ../../../ui.cpp:2716
|
||||
#: ../../../uibase.cpp:25
|
||||
msgid "E&xit"
|
||||
msgstr "&Выход"
|
||||
|
||||
#: ../../../ui.cpp:2931
|
||||
msgid "Program has crashed and will terminate. "
|
||||
msgstr "Сбой программы, завершение. "
|
||||
|
||||
#: ../../../uibase.cpp:28
|
||||
msgid "&File"
|
||||
msgstr "&Файл"
|
||||
|
||||
#: ../../../uibase.cpp:36
|
||||
msgid "&Your Receiving Addresses..."
|
||||
msgstr "&Ваши адреса получения..."
|
||||
|
||||
#: ../../../uibase.cpp:40
|
||||
msgid "&Options..."
|
||||
msgstr "&Опции"
|
||||
|
||||
#: ../../../uibase.cpp:43
|
||||
msgid "&Settings"
|
||||
msgstr "&Настройки"
|
||||
|
||||
#: ../../../uibase.cpp:47
|
||||
msgid "&About..."
|
||||
msgstr "&О программе..."
|
||||
|
||||
#: ../../../uibase.cpp:50
|
||||
msgid "&Help"
|
||||
msgstr "&Справка"
|
||||
|
||||
#: ../../../uibase.cpp:60
|
||||
msgid "Address Book"
|
||||
msgstr "Адресная книга"
|
||||
|
||||
#: ../../../uibase.cpp:75
|
||||
msgid "Your Bitcoin Address:"
|
||||
msgstr "Ваш адрес Bitcoin:"
|
||||
|
||||
#: ../../../uibase.cpp:82
|
||||
msgid " &New... "
|
||||
msgstr " &Новый... "
|
||||
|
||||
#: ../../../uibase.cpp:85
|
||||
#: ../../../uibase.cpp:845
|
||||
#: ../../../uibase.cpp:948
|
||||
msgid " &Copy to Clipboard "
|
||||
msgstr " &Копировать в буфер обмена "
|
||||
|
||||
#: ../../../uibase.cpp:99
|
||||
msgid "Balance:"
|
||||
msgstr "Баланс:"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " All"
|
||||
msgstr " Все"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " Sent"
|
||||
msgstr " Отправленные"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " Received"
|
||||
msgstr " Полученные"
|
||||
|
||||
#: ../../../uibase.cpp:115
|
||||
msgid " In Progress"
|
||||
msgstr " В процессе"
|
||||
|
||||
#: ../../../uibase.cpp:136
|
||||
msgid "All Transactions"
|
||||
msgstr "Все переводы"
|
||||
|
||||
#: ../../../uibase.cpp:147
|
||||
msgid "Sent/Received"
|
||||
msgstr "Отправленные/Полученные"
|
||||
|
||||
#: ../../../uibase.cpp:158
|
||||
msgid "Sent"
|
||||
msgstr "Отправленные"
|
||||
|
||||
#: ../../../uibase.cpp:169
|
||||
msgid "Received"
|
||||
msgstr "Полученные"
|
||||
|
||||
#: ../../../uibase.cpp:312
|
||||
#: ../../../uibase.cpp:473
|
||||
#: ../../../uibase.cpp:574
|
||||
#: ../../../uibase.cpp:787
|
||||
#: ../../../uibase.cpp:848
|
||||
#: ../../../uibase.cpp:957
|
||||
#: ../../../uibase.cpp:1046
|
||||
msgid "OK"
|
||||
msgstr "ОК"
|
||||
|
||||
#: ../../../uibase.cpp:355
|
||||
msgid "Optional transaction fee you give to the nodes that process your transactions."
|
||||
msgstr "Необязательная комиссия, которую вы даёте узлам, проводящим ваш перевод."
|
||||
|
||||
#: ../../../uibase.cpp:364
|
||||
msgid "Transaction fee:"
|
||||
msgstr "Комиссия:"
|
||||
|
||||
#: ../../../uibase.cpp:380
|
||||
msgid "&Limit coin generation to"
|
||||
msgstr "&Ограничить генерацию монет до"
|
||||
|
||||
#: ../../../uibase.cpp:387
|
||||
msgid "processors"
|
||||
msgstr "процессоров"
|
||||
|
||||
#: ../../../uibase.cpp:393
|
||||
msgid "&Start Bitcoin on system startup"
|
||||
msgstr "&Запускать Bitcoin при старте системы"
|
||||
|
||||
#: ../../../uibase.cpp:397
|
||||
msgid "&Minimize to the tray instead of the taskbar"
|
||||
msgstr "&Сворачивать в трей вместо панели задач"
|
||||
|
||||
#: ../../../uibase.cpp:401
|
||||
msgid "M&inimize to the tray on close"
|
||||
msgstr "С&ворачивать в трей при закрытии"
|
||||
|
||||
#: ../../../uibase.cpp:408
|
||||
msgid "&Connect through socks4 proxy: "
|
||||
msgstr "&Подключаться через socks4 прокси: "
|
||||
|
||||
#: ../../../uibase.cpp:420
|
||||
msgid "Proxy &IP:"
|
||||
msgstr "IP п&рокси:"
|
||||
|
||||
#: ../../../uibase.cpp:428
|
||||
msgid " &Port:"
|
||||
msgstr " &Порт"
|
||||
|
||||
#: ../../../uibase.cpp:450
|
||||
msgid "// [don't translate] Test panel 2 for future expansion"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:454
|
||||
msgid "// [don't translate] Let's not start multiple pages until the first page is filled up"
|
||||
msgstr ""
|
||||
|
||||
#: ../../../uibase.cpp:476
|
||||
#: ../../../uibase.cpp:729
|
||||
#: ../../../uibase.cpp:792
|
||||
#: ../../../uibase.cpp:851
|
||||
#: ../../../uibase.cpp:960
|
||||
#: ../../../uibase.cpp:1049
|
||||
msgid "Cancel"
|
||||
msgstr "Отмена"
|
||||
|
||||
#: ../../../uibase.cpp:479
|
||||
msgid "&Apply"
|
||||
msgstr "&Применить"
|
||||
|
||||
#: ../../../uibase.cpp:540
|
||||
msgid "Bitcoin "
|
||||
msgstr "Bitcoin "
|
||||
|
||||
#: ../../../uibase.cpp:546
|
||||
msgid "version"
|
||||
msgstr "версия"
|
||||
|
||||
#: ../../../uibase.cpp:557
|
||||
msgid ""
|
||||
"Copyright (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"This is experimental software.\n"
|
||||
"\n"
|
||||
"Distributed under the MIT/X11 software license, see the accompanying file \n"
|
||||
"license.txt or http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"This product includes software developed by the OpenSSL Project for use in the \n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
msgstr ""
|
||||
"Все права защищены (c) 2009-2010 Bitcoin Developers\n"
|
||||
"\n"
|
||||
"Это экспериментальное ПО.\n"
|
||||
"\n"
|
||||
"Распространяется под лицензией MIT/X11, см. файл\n"
|
||||
"license.txt или http://www.opensource.org/licenses/mit-license.php.\n"
|
||||
"\n"
|
||||
"Этот продукт включает ПО, разработанное проектом OpenSSL для использования в\n"
|
||||
"OpenSSL Toolkit (http://www.openssl.org/), и криптографическое ПО, написанное\n"
|
||||
"Eric Young (eay@cryptsoft.com)."
|
||||
|
||||
#: ../../../uibase.cpp:613
|
||||
msgid "Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) or IP address (e.g. 123.45.6.7)"
|
||||
msgstr "Введите адрес Bitcoin (напр. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJED9L) или IP адрес (напр. 123.45.6.7)"
|
||||
|
||||
#: ../../../uibase.cpp:627
|
||||
msgid "Pay &To:"
|
||||
msgstr "&Кому:"
|
||||
|
||||
#: ../../../uibase.cpp:642
|
||||
msgid "&Paste"
|
||||
msgstr "&Вставить"
|
||||
|
||||
#: ../../../uibase.cpp:645
|
||||
msgid " Address &Book..."
|
||||
msgstr " А&дресная книга..."
|
||||
|
||||
#: ../../../uibase.cpp:652
|
||||
msgid "&Amount:"
|
||||
msgstr "К&оличество:"
|
||||
|
||||
#: ../../../uibase.cpp:662
|
||||
msgid "T&ransfer:"
|
||||
msgstr "&Передача:"
|
||||
|
||||
#: ../../../uibase.cpp:668
|
||||
msgid " Standard"
|
||||
msgstr " Стандарт"
|
||||
|
||||
#: ../../../uibase.cpp:690
|
||||
msgid "&From:"
|
||||
msgstr "О&т:"
|
||||
|
||||
#: ../../../uibase.cpp:707
|
||||
msgid "&Message:"
|
||||
msgstr "&Сообщение:"
|
||||
|
||||
#: ../../../uibase.cpp:724
|
||||
msgid "&Send"
|
||||
msgstr "Отп&равить"
|
||||
|
||||
#: ../../../uibase.cpp:776
|
||||
msgid ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Connecting..."
|
||||
msgstr ""
|
||||
"\n"
|
||||
"\n"
|
||||
"Подключение..."
|
||||
|
||||
#: ../../../uibase.cpp:826
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you. The highlighted address is displayed in the main window."
|
||||
msgstr "Это ваши адреса для получения платежей. Вы можете использовать разные для каждого отправителя, чтобы отслеживать, кто вам платит. Выделенный адрес отображается в главном окне."
|
||||
|
||||
#: ../../../uibase.cpp:839
|
||||
#: ../../../uibase.cpp:951
|
||||
msgid "&Edit..."
|
||||
msgstr "&Правка..."
|
||||
|
||||
#: ../../../uibase.cpp:842
|
||||
#: ../../../uibase.cpp:954
|
||||
msgid " &New Address... "
|
||||
msgstr " &Новый адрес... "
|
||||
|
||||
#: ../../../uibase.cpp:914
|
||||
msgid "Sending"
|
||||
msgstr "Отправка"
|
||||
|
||||
#: ../../../uibase.cpp:922
|
||||
msgid "These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."
|
||||
msgstr "Это ваши адреса для получения платежей. Вы можете использовать разные для каждого отправителя, чтобы отслеживать, кто вам платит. Выделенный адрес отображается в главном окне."
|
||||
|
||||
#: ../../../uibase.cpp:935
|
||||
msgid "Receiving"
|
||||
msgstr "Получение"
|
||||
|
||||
#: ../../../uibase.cpp:945
|
||||
msgid "&Delete"
|
||||
msgstr "&Удалить"
|
||||
|
||||
#: ../../../util.cpp:807
|
||||
msgid "Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly."
|
||||
msgstr "Внимание: пожалуйста, проверьте дату и время на вашем компьютере. Если часы идут неверно, Bitcoin не будет работать правильно."
|
||||
|
||||
#: ../../../uibase.h:149
|
||||
msgid "Transaction Details"
|
||||
msgstr "Подробности транзакции"
|
||||
|
||||
#: ../../../uibase.h:202
|
||||
msgid "Options"
|
||||
msgstr "Опции"
|
||||
|
||||
#: ../../../uibase.h:230
|
||||
msgid "About Bitcoin"
|
||||
msgstr "О Bitcoin"
|
||||
|
||||
#: ../../../uibase.h:340
|
||||
msgid "Your Bitcoin Addresses"
|
||||
msgstr "Ваш адрес Bitcoin"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "It's good policy to use a new address for each payment you receive.\n"
|
||||
#~ "\n"
|
||||
#~ "Label"
|
||||
#~ msgstr ""
|
||||
#~ "Неплохо будет использовать новый адрес для каждого получаемого платежа.\n"
|
||||
#~ "\n"
|
||||
#~ "Метка"
|
||||
|
||||
#~ msgid "Will appear as \"From: Unknown\""
|
||||
#~ msgstr "Будет отображаться как \"От: Аноним\""
|
||||
308
main.h
308
main.h
@@ -22,7 +22,6 @@ static const int64 CENT = 1000000;
|
||||
static const int64 MAX_MONEY = 21000000 * COIN;
|
||||
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
|
||||
static const int COINBASE_MATURITY = 100;
|
||||
static const CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +30,8 @@ static const CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
|
||||
|
||||
extern CCriticalSection cs_main;
|
||||
extern map<uint256, CBlockIndex*> mapBlockIndex;
|
||||
extern const uint256 hashGenesisBlock;
|
||||
extern uint256 hashGenesisBlock;
|
||||
extern CBigNum bnProofOfWorkLimit;
|
||||
extern CBlockIndex* pindexGenesisBlock;
|
||||
extern int nBestHeight;
|
||||
extern CBigNum bnBestChainWork;
|
||||
@@ -69,6 +69,7 @@ bool AddKey(const CKey& key);
|
||||
vector<unsigned char> GenerateNewKey();
|
||||
bool AddToWallet(const CWalletTx& wtxIn);
|
||||
void WalletUpdateSpent(const COutPoint& prevout);
|
||||
int ScanForWalletTransactions(CBlockIndex* pindexStart);
|
||||
void ReacceptWalletTransactions();
|
||||
bool LoadBlockIndex(bool fAllowNew=true);
|
||||
void PrintBlockTree();
|
||||
@@ -76,13 +77,17 @@ bool ProcessMessages(CNode* pfrom);
|
||||
bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv);
|
||||
bool SendMessages(CNode* pto, bool fSendTrickle);
|
||||
int64 GetBalance();
|
||||
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CKey& keyRet, int64& nFeeRequiredRet);
|
||||
bool CommitTransaction(CWalletTx& wtxNew, const CKey& key);
|
||||
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet);
|
||||
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
|
||||
bool BroadcastTransaction(CWalletTx& wtxNew);
|
||||
string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
|
||||
string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
|
||||
void GenerateBitcoins(bool fGenerate);
|
||||
void ThreadBitcoinMiner(void* parg);
|
||||
CBlock* CreateNewBlock(CReserveKey& reservekey);
|
||||
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime);
|
||||
void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1);
|
||||
bool CheckWork(CBlock* pblock, CReserveKey& reservekey);
|
||||
void BitcoinMiner();
|
||||
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
|
||||
bool IsInitialBlockDownload();
|
||||
@@ -195,7 +200,7 @@ public:
|
||||
|
||||
string ToString() const
|
||||
{
|
||||
return strprintf("COutPoint(%s, %d)", hash.ToString().substr(0,6).c_str(), n);
|
||||
return strprintf("COutPoint(%s, %d)", hash.ToString().substr(0,10).c_str(), n);
|
||||
}
|
||||
|
||||
void print() const
|
||||
@@ -341,9 +346,25 @@ public:
|
||||
{
|
||||
if (!MoneyRange(nValue))
|
||||
throw runtime_error("CTxOut::GetCredit() : value out of range");
|
||||
if (IsMine())
|
||||
return nValue;
|
||||
return 0;
|
||||
return (IsMine() ? nValue : 0);
|
||||
}
|
||||
|
||||
bool IsChange() const
|
||||
{
|
||||
// On a debit transaction, a txout that's mine but isn't in the address book is change
|
||||
vector<unsigned char> vchPubKey;
|
||||
if (ExtractPubKey(scriptPubKey, true, vchPubKey))
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
if (!mapAddressBook.count(PubKeyToAddress(vchPubKey)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int64 GetChange() const
|
||||
{
|
||||
if (!MoneyRange(nValue))
|
||||
throw runtime_error("CTxOut::GetChange() : value out of range");
|
||||
return (IsChange() ? nValue : 0);
|
||||
}
|
||||
|
||||
friend bool operator==(const CTxOut& a, const CTxOut& b)
|
||||
@@ -361,7 +382,7 @@ public:
|
||||
{
|
||||
if (scriptPubKey.size() < 6)
|
||||
return "CTxOut(error)";
|
||||
return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,24).c_str());
|
||||
return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str());
|
||||
}
|
||||
|
||||
void print() const
|
||||
@@ -479,6 +500,17 @@ public:
|
||||
return n;
|
||||
}
|
||||
|
||||
bool IsStandard() const
|
||||
{
|
||||
foreach(const CTxIn& txin, vin)
|
||||
if (!txin.scriptSig.IsPushOnly())
|
||||
return error("nonstandard txin: %s", txin.scriptSig.ToString().c_str());
|
||||
foreach(const CTxOut& txout, vout)
|
||||
if (!::IsStandard(txout.scriptPubKey))
|
||||
return error("nonstandard txout: %s", txout.scriptPubKey.ToString().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsMine() const
|
||||
{
|
||||
foreach(const CTxOut& txout, vout)
|
||||
@@ -487,6 +519,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsFromMe() const
|
||||
{
|
||||
return (GetDebit() > 0);
|
||||
}
|
||||
|
||||
int64 GetDebit() const
|
||||
{
|
||||
int64 nDebit = 0;
|
||||
@@ -511,6 +548,20 @@ public:
|
||||
return nCredit;
|
||||
}
|
||||
|
||||
int64 GetChange() const
|
||||
{
|
||||
if (IsCoinBase())
|
||||
return 0;
|
||||
int64 nChange = 0;
|
||||
foreach(const CTxOut& txout, vout)
|
||||
{
|
||||
nChange += txout.GetChange();
|
||||
if (!MoneyRange(nChange))
|
||||
throw runtime_error("CTransaction::GetChange() : value out of range");
|
||||
}
|
||||
return nChange;
|
||||
}
|
||||
|
||||
int64 GetValueOut() const
|
||||
{
|
||||
int64 nValueOut = 0;
|
||||
@@ -523,21 +574,29 @@ public:
|
||||
return nValueOut;
|
||||
}
|
||||
|
||||
int64 GetMinFee(unsigned int nBlockSize=1) const
|
||||
int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=true) const
|
||||
{
|
||||
// Base fee is 1 cent per kilobyte
|
||||
unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK);
|
||||
unsigned int nNewBlockSize = nBlockSize + nBytes;
|
||||
int64 nMinFee = (1 + (int64)nBytes / 1000) * CENT;
|
||||
|
||||
// Transactions under 25K are free as long as block size is under 40K
|
||||
// (about 11,000bc if made of 50bc inputs)
|
||||
if (nBytes < 25000 && nNewBlockSize < 40000)
|
||||
nMinFee = 0;
|
||||
|
||||
// Transactions under 3K are free as long as block size is under 50K
|
||||
if (nBytes < 3000 && nNewBlockSize < 50000)
|
||||
nMinFee = 0;
|
||||
if (fAllowFree)
|
||||
{
|
||||
if (nBlockSize == 1)
|
||||
{
|
||||
// Transactions under 10K are free
|
||||
// (about 4500bc if made of 50bc inputs)
|
||||
if (nBytes < 10000)
|
||||
nMinFee = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Free transaction area
|
||||
if (nNewBlockSize < 27000)
|
||||
nMinFee = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// To limit dust spam, require a 0.01 fee if any output is less than 0.01
|
||||
if (nMinFee < CENT)
|
||||
@@ -580,7 +639,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
friend bool operator==(const CTransaction& a, const CTransaction& b)
|
||||
{
|
||||
return (a.nVersion == b.nVersion &&
|
||||
@@ -599,7 +657,7 @@ public:
|
||||
{
|
||||
string str;
|
||||
str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%d, vout.size=%d, nLockTime=%d)\n",
|
||||
GetHash().ToString().substr(0,6).c_str(),
|
||||
GetHash().ToString().substr(0,10).c_str(),
|
||||
nVersion,
|
||||
vin.size(),
|
||||
vout.size(),
|
||||
@@ -617,6 +675,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool ReadFromDisk(CTxDB& txdb, COutPoint prevout, CTxIndex& txindexRet);
|
||||
bool ReadFromDisk(CTxDB& txdb, COutPoint prevout);
|
||||
bool ReadFromDisk(COutPoint prevout);
|
||||
bool DisconnectInputs(CTxDB& txdb);
|
||||
bool ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPool, CDiskTxPos posThisTx,
|
||||
CBlockIndex* pindexBlock, int64& nFees, bool fBlock, bool fMiner, int64 nMinFee=0);
|
||||
@@ -706,13 +767,15 @@ public:
|
||||
unsigned int nTimeReceived; // time received by this node
|
||||
char fFromMe;
|
||||
char fSpent;
|
||||
//// probably need to sign the order info so know it came from payer
|
||||
string strFromAccount;
|
||||
|
||||
// memory only
|
||||
mutable char fDebitCached;
|
||||
mutable char fCreditCached;
|
||||
mutable char fChangeCached;
|
||||
mutable int64 nDebitCached;
|
||||
mutable int64 nCreditCached;
|
||||
mutable int64 nChangeCached;
|
||||
|
||||
// memory only UI hints
|
||||
mutable unsigned int nTimeDisplayed;
|
||||
@@ -737,24 +800,39 @@ public:
|
||||
|
||||
void Init()
|
||||
{
|
||||
vtxPrev.clear();
|
||||
mapValue.clear();
|
||||
vOrderForm.clear();
|
||||
fTimeReceivedIsTxTime = false;
|
||||
nTimeReceived = 0;
|
||||
fFromMe = false;
|
||||
fSpent = false;
|
||||
strFromAccount.clear();
|
||||
fDebitCached = false;
|
||||
fCreditCached = false;
|
||||
fChangeCached = false;
|
||||
nDebitCached = 0;
|
||||
nCreditCached = 0;
|
||||
nChangeCached = 0;
|
||||
nTimeDisplayed = 0;
|
||||
nLinesDisplayed = 0;
|
||||
fConfirmedDisplayed = false;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
CWalletTx* pthis = const_cast<CWalletTx*>(this);
|
||||
if (fRead)
|
||||
pthis->Init();
|
||||
nSerSize += SerReadWrite(s, *(CMerkleTx*)this, nType, nVersion, ser_action);
|
||||
nVersion = this->nVersion;
|
||||
READWRITE(vtxPrev);
|
||||
|
||||
pthis->mapValue["fromaccount"] = pthis->strFromAccount;
|
||||
READWRITE(mapValue);
|
||||
pthis->strFromAccount = pthis->mapValue["fromaccount"];
|
||||
pthis->mapValue.erase("fromaccount");
|
||||
pthis->mapValue.erase("version");
|
||||
|
||||
READWRITE(vOrderForm);
|
||||
READWRITE(fTimeReceivedIsTxTime);
|
||||
READWRITE(nTimeReceived);
|
||||
@@ -773,7 +851,7 @@ public:
|
||||
return nDebitCached;
|
||||
}
|
||||
|
||||
int64 GetCredit(bool fUseCache=false) const
|
||||
int64 GetCredit(bool fUseCache=true) const
|
||||
{
|
||||
// Must wait until coinbase is safely deep enough in the chain before valuing it
|
||||
if (IsCoinBase() && GetBlocksToMaturity() > 0)
|
||||
@@ -787,6 +865,67 @@ public:
|
||||
return nCreditCached;
|
||||
}
|
||||
|
||||
int64 GetChange() const
|
||||
{
|
||||
if (fChangeCached)
|
||||
return nChangeCached;
|
||||
nChangeCached = CTransaction::GetChange();
|
||||
fChangeCached = true;
|
||||
return nChangeCached;
|
||||
}
|
||||
|
||||
void GetAmounts(int64& nGenerated, list<pair<string /* address */, int64> >& listReceived,
|
||||
list<pair<string /* address */, int64> >& listSent, int64& nFee, string& strSentAccount) const;
|
||||
|
||||
void GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived,
|
||||
int64& nSent, int64& nFee) const;
|
||||
|
||||
bool IsFromMe() const
|
||||
{
|
||||
return (GetDebit() > 0);
|
||||
}
|
||||
|
||||
bool IsConfirmed() const
|
||||
{
|
||||
// Quick answer in most cases
|
||||
if (!IsFinal())
|
||||
return false;
|
||||
if (GetDepthInMainChain() >= 1)
|
||||
return true;
|
||||
if (!IsFromMe()) // using wtx's cached debit
|
||||
return false;
|
||||
|
||||
// If no confirmations but it's from us, we can still
|
||||
// consider it confirmed if all dependencies are confirmed
|
||||
map<uint256, const CMerkleTx*> mapPrev;
|
||||
vector<const CMerkleTx*> vWorkQueue;
|
||||
vWorkQueue.reserve(vtxPrev.size()+1);
|
||||
vWorkQueue.push_back(this);
|
||||
for (int i = 0; i < vWorkQueue.size(); i++)
|
||||
{
|
||||
const CMerkleTx* ptx = vWorkQueue[i];
|
||||
|
||||
if (!ptx->IsFinal())
|
||||
return false;
|
||||
if (ptx->GetDepthInMainChain() >= 1)
|
||||
return true;
|
||||
if (!ptx->IsFromMe())
|
||||
return false;
|
||||
|
||||
if (mapPrev.empty())
|
||||
foreach(const CMerkleTx& tx, vtxPrev)
|
||||
mapPrev[tx.GetHash()] = &tx;
|
||||
|
||||
foreach(const CTxIn& txin, ptx->vin)
|
||||
{
|
||||
if (!mapPrev.count(txin.prevout.hash))
|
||||
return false;
|
||||
vWorkQueue.push_back(mapPrev[txin.prevout.hash]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WriteToDisk()
|
||||
{
|
||||
return CWalletDB().WriteTx(GetHash(), *this);
|
||||
@@ -1003,14 +1142,12 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool WriteToDisk(bool fWriteTransactions, unsigned int& nFileRet, unsigned int& nBlockPosRet)
|
||||
bool WriteToDisk(unsigned int& nFileRet, unsigned int& nBlockPosRet)
|
||||
{
|
||||
// Open history file to append
|
||||
CAutoFile fileout = AppendBlockFile(nFileRet);
|
||||
if (!fileout)
|
||||
return error("CBlock::WriteToDisk() : AppendBlockFile failed");
|
||||
if (!fWriteTransactions)
|
||||
fileout.nType |= SER_BLOCKHEADERONLY;
|
||||
|
||||
// Write index header
|
||||
unsigned int nSize = fileout.GetSerializeSize(*this);
|
||||
@@ -1065,7 +1202,7 @@ public:
|
||||
GetHash().ToString().substr(0,20).c_str(),
|
||||
nVersion,
|
||||
hashPrevBlock.ToString().substr(0,20).c_str(),
|
||||
hashMerkleRoot.ToString().substr(0,6).c_str(),
|
||||
hashMerkleRoot.ToString().substr(0,10).c_str(),
|
||||
nTime, nBits, nNonce,
|
||||
vtx.size());
|
||||
for (int i = 0; i < vtx.size(); i++)
|
||||
@@ -1075,7 +1212,7 @@ public:
|
||||
}
|
||||
printf(" vMerkleTree: ");
|
||||
for (int i = 0; i < vMerkleTree.size(); i++)
|
||||
printf("%s ", vMerkleTree[i].ToString().substr(0,6).c_str());
|
||||
printf("%s ", vMerkleTree[i].ToString().substr(0,10).c_str());
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -1155,6 +1292,19 @@ public:
|
||||
nNonce = block.nNonce;
|
||||
}
|
||||
|
||||
CBlock GetBlockHeader() const
|
||||
{
|
||||
CBlock block;
|
||||
block.nVersion = nVersion;
|
||||
if (pprev)
|
||||
block.hashPrevBlock = pprev->GetBlockHash();
|
||||
block.hashMerkleRoot = hashMerkleRoot;
|
||||
block.nTime = nTime;
|
||||
block.nBits = nBits;
|
||||
block.nNonce = nNonce;
|
||||
return block;
|
||||
}
|
||||
|
||||
uint256 GetBlockHash() const
|
||||
{
|
||||
return *phashBlock;
|
||||
@@ -1233,7 +1383,7 @@ public:
|
||||
{
|
||||
return strprintf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%-6d nHeight=%d, merkle=%s, hashBlock=%s)",
|
||||
pprev, pnext, nFile, nBlockPos, nHeight,
|
||||
hashMerkleRoot.ToString().substr(0,6).c_str(),
|
||||
hashMerkleRoot.ToString().substr(0,10).c_str(),
|
||||
GetBlockHash().ToString().substr(0,20).c_str());
|
||||
}
|
||||
|
||||
@@ -1356,6 +1506,16 @@ public:
|
||||
READWRITE(vHave);
|
||||
)
|
||||
|
||||
void SetNull()
|
||||
{
|
||||
vHave.clear();
|
||||
}
|
||||
|
||||
bool IsNull()
|
||||
{
|
||||
return vHave.empty();
|
||||
}
|
||||
|
||||
void Set(const CBlockIndex* pindex)
|
||||
{
|
||||
vHave.clear();
|
||||
@@ -1476,6 +1636,84 @@ public:
|
||||
|
||||
|
||||
//
|
||||
// Account information.
|
||||
// Stored in wallet with key "acc"+string account name
|
||||
//
|
||||
class CAccount
|
||||
{
|
||||
public:
|
||||
vector<unsigned char> vchPubKey;
|
||||
|
||||
CAccount()
|
||||
{
|
||||
SetNull();
|
||||
}
|
||||
|
||||
void SetNull()
|
||||
{
|
||||
vchPubKey.clear();
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (!(nType & SER_GETHASH))
|
||||
READWRITE(nVersion);
|
||||
READWRITE(vchPubKey);
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Internal transfers.
|
||||
// Database key is acentry<account><counter>
|
||||
//
|
||||
class CAccountingEntry
|
||||
{
|
||||
public:
|
||||
string strAccount;
|
||||
int64 nCreditDebit;
|
||||
int64 nTime;
|
||||
string strOtherAccount;
|
||||
string strComment;
|
||||
|
||||
CAccountingEntry()
|
||||
{
|
||||
SetNull();
|
||||
}
|
||||
|
||||
void SetNull()
|
||||
{
|
||||
nCreditDebit = 0;
|
||||
nTime = 0;
|
||||
strAccount.clear();
|
||||
strOtherAccount.clear();
|
||||
strComment.clear();
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (!(nType & SER_GETHASH))
|
||||
READWRITE(nVersion);
|
||||
// Note: strAccount is serialized as part of the key, not here.
|
||||
READWRITE(nCreditDebit);
|
||||
READWRITE(nTime);
|
||||
READWRITE(strOtherAccount);
|
||||
READWRITE(strComment);
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Alerts are for notifying old versions if they become too obsolete and
|
||||
// need to upgrade. The message is displayed in the status bar.
|
||||
// Alert messages are broadcast as a vector of signed data. Unserializing may
|
||||
// not read the entire buffer if the alert is for a newer version, but older
|
||||
// versions can still relay the original data.
|
||||
@@ -1497,7 +1735,7 @@ public:
|
||||
// Actions
|
||||
string strComment;
|
||||
string strStatusBar;
|
||||
string strRPCError;
|
||||
string strReserved;
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
@@ -1515,7 +1753,7 @@ public:
|
||||
|
||||
READWRITE(strComment);
|
||||
READWRITE(strStatusBar);
|
||||
READWRITE(strRPCError);
|
||||
READWRITE(strReserved);
|
||||
)
|
||||
|
||||
void SetNull()
|
||||
@@ -1533,7 +1771,7 @@ public:
|
||||
|
||||
strComment.clear();
|
||||
strStatusBar.clear();
|
||||
strRPCError.clear();
|
||||
strReserved.clear();
|
||||
}
|
||||
|
||||
string ToString() const
|
||||
@@ -1558,7 +1796,6 @@ public:
|
||||
" nPriority = %d\n"
|
||||
" strComment = \"%s\"\n"
|
||||
" strStatusBar = \"%s\"\n"
|
||||
" strRPCError = \"%s\"\n"
|
||||
")\n",
|
||||
nVersion,
|
||||
nRelayUntil,
|
||||
@@ -1571,8 +1808,7 @@ public:
|
||||
strSetSubVer.c_str(),
|
||||
nPriority,
|
||||
strComment.c_str(),
|
||||
strStatusBar.c_str(),
|
||||
strRPCError.c_str());
|
||||
strStatusBar.c_str());
|
||||
}
|
||||
|
||||
void print() const
|
||||
@@ -1623,7 +1859,7 @@ public:
|
||||
bool Cancels(const CAlert& alert) const
|
||||
{
|
||||
if (!IsInEffect())
|
||||
false;
|
||||
return false; // this was a no-op before 31403
|
||||
return (alert.nID <= nCancel || setCancel.count(alert.nID));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,26 +4,26 @@
|
||||
|
||||
|
||||
INCLUDEPATHS= \
|
||||
-I"/boost" \
|
||||
-I"/db/build_unix" \
|
||||
-I"/openssl/include" \
|
||||
-I"/wxwidgets/lib/gcc_lib/mswud" \
|
||||
-I"/wxwidgets/include"
|
||||
-I"C:\boost-1.43.0-mgw" \
|
||||
-I"C:\db-4.7.25.NC-mgw\build_unix" \
|
||||
-I"C:\openssl-1.0.0c-mgw\include" \
|
||||
-I"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib\mswud" \
|
||||
-I"C:\wxWidgets-2.9.1-mgw\include"
|
||||
|
||||
LIBPATHS= \
|
||||
-L"/boost/stage/lib" \
|
||||
-L"/db/build_unix" \
|
||||
-L"/openssl/out" \
|
||||
-L"/wxwidgets/lib/gcc_lib"
|
||||
-L"C:\boost-1.43.0-mgw\stage\lib" \
|
||||
-L"C:\db-4.7.25.NC-mgw\build_unix" \
|
||||
-L"C:\openssl-1.0.0c-mgw" \
|
||||
-L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib"
|
||||
|
||||
WXLIBS= \
|
||||
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd
|
||||
|
||||
LIBS= \
|
||||
-l libboost_system-mgw34-mt-d \
|
||||
-l libboost_filesystem-mgw34-mt-d \
|
||||
-l libboost_program_options-mgw34-mt-d \
|
||||
-l libboost_thread-mgw34-mt-d \
|
||||
-l boost_system-mgw45-mt-s-1_43 \
|
||||
-l boost_filesystem-mgw45-mt-s-1_43 \
|
||||
-l boost_program_options-mgw45-mt-s-1_43 \
|
||||
-l boost_thread-mgw45-mt-s-1_43 \
|
||||
-l db_cxx \
|
||||
-l eay32 \
|
||||
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
# Copyright (c) 2010 Laszlo Hanyecz
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -22,9 +22,10 @@ LIBS= -dead_strip \
|
||||
$(DEPSDIR)/lib/libboost_filesystem.a \
|
||||
$(DEPSDIR)/lib/libboost_program_options.a \
|
||||
$(DEPSDIR)/lib/libboost_thread.a \
|
||||
$(DEPSDIR)/lib/libssl.a \
|
||||
$(DEPSDIR)/lib/libcrypto.a
|
||||
|
||||
DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0
|
||||
DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL
|
||||
|
||||
DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0
|
||||
# ppc doesn't work because we don't support big-endian
|
||||
|
||||
@@ -23,11 +23,14 @@ LIBS= \
|
||||
-l boost_program_options \
|
||||
-l boost_thread \
|
||||
-l db_cxx \
|
||||
-l ssl \
|
||||
-l crypto \
|
||||
-Wl,-Bdynamic \
|
||||
-l gthread-2.0
|
||||
-l gthread-2.0 \
|
||||
-l z \
|
||||
-l dl
|
||||
|
||||
DEFS=-D__WXGTK__ -DNOPCH -DFOURWAYSSE2
|
||||
DEFS=-D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
|
||||
31
makefile.vc
31
makefile.vc
@@ -7,29 +7,32 @@ INCLUDEPATHS= \
|
||||
/I"/boost" \
|
||||
/I"/db/build_windows" \
|
||||
/I"/openssl/include" \
|
||||
/I"/wxwidgets/lib/vc_lib/mswud" \
|
||||
/I"/wxwidgets/lib/vc_lib/mswu" \
|
||||
/I"/wxwidgets/include"
|
||||
|
||||
LIBPATHS= \
|
||||
/LIBPATH:"/boost/stage/lib" \
|
||||
/LIBPATH:"/db/build_windows/debug" \
|
||||
/LIBPATH:"/openssl/out" \
|
||||
/LIBPATH:"/wxwidgets/lib/vc_lib"
|
||||
/LIBPATH:"/db/build_windows/Release" \
|
||||
/LIBPATH:"/openssl/lib" \
|
||||
/LIBPATH:"/wxwidgets/lib/vc_lib" \
|
||||
/NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib \
|
||||
/NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib \
|
||||
/NODEFAULTLIB:msvcrtd.lib
|
||||
|
||||
WXLIBS=wxmsw29ud_html.lib wxmsw29ud_core.lib wxmsw29ud_adv.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib
|
||||
WXLIBS=wxmsw29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib
|
||||
|
||||
LIBS= \
|
||||
libboost_system-vc80-mt-gd.lib \
|
||||
libboost_filesystem-vc80-mt-gd.lib \
|
||||
libboost_program_options-vc80-mt-gd.lib \
|
||||
libboost_thread-vc80-mt-gd.lib \
|
||||
libdb47sd.lib \
|
||||
libboost_system-vc100-mt.lib \
|
||||
libboost_filesystem-vc100-mt.lib \
|
||||
libboost_program_options-vc100-mt.lib \
|
||||
libboost_thread-vc100-mt.lib \
|
||||
libdb47s.lib \
|
||||
libeay32.lib \
|
||||
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib
|
||||
|
||||
DEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
|
||||
DEBUGFLAGS=/Zi /D__WXDEBUG__
|
||||
CFLAGS=/c /nologo /MDd /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
DEBUGFLAGS=/Os
|
||||
CFLAGS=/MD /c /nologo /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
@@ -82,7 +85,7 @@ obj\ui.res: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp r
|
||||
rc $(INCLUDEPATHS) $(DEFS) /Fo$@ %s
|
||||
|
||||
bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\ui.res
|
||||
link /nologo /DEBUG /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(WXLIBS) $(LIBS)
|
||||
link /nologo /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
.cpp{obj\nogui}.obj:
|
||||
@@ -105,7 +108,7 @@ obj\nogui\rpc.obj: $(HEADERS)
|
||||
obj\nogui\init.obj: $(HEADERS)
|
||||
|
||||
bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\ui.res
|
||||
link /nologo /DEBUG /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
link /nologo /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
|
||||
277
net.cpp
277
net.cpp
@@ -20,7 +20,7 @@ bool OpenNetworkConnection(const CAddress& addrConnect);
|
||||
//
|
||||
bool fClient = false;
|
||||
uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
|
||||
CAddress addrLocalHost(0, DEFAULT_PORT, nLocalServices);
|
||||
CAddress addrLocalHost(0, 0, nLocalServices);
|
||||
CNode* pnodeLocalHost = NULL;
|
||||
uint64 nLocalHostNonce = 0;
|
||||
array<int, 10> vnThreadsRunning;
|
||||
@@ -128,7 +128,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
string strLine;
|
||||
while (RecvLine(hSocket, strLine))
|
||||
{
|
||||
if (strLine.empty())
|
||||
if (strLine.empty()) // HTTP response is separated from headers by blank line
|
||||
{
|
||||
loop
|
||||
{
|
||||
@@ -137,6 +137,8 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
closesocket(hSocket);
|
||||
return false;
|
||||
}
|
||||
if (pszKeyword == NULL)
|
||||
break;
|
||||
if (strLine.find(pszKeyword) != -1)
|
||||
{
|
||||
strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
|
||||
@@ -144,7 +146,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
}
|
||||
}
|
||||
closesocket(hSocket);
|
||||
if (strLine.find("<"))
|
||||
if (strLine.find("<") != -1)
|
||||
strLine = strLine.substr(0, strLine.find("<"));
|
||||
strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r"));
|
||||
while (strLine.size() > 0 && isspace(strLine[strLine.size()-1]))
|
||||
@@ -161,7 +163,7 @@ bool GetMyExternalIP2(const CAddress& addrConnect, const char* pszGet, const cha
|
||||
return error("GetMyExternalIP() : connection closed");
|
||||
}
|
||||
|
||||
|
||||
// We now get our external IP from the IRC server first and only use this as a backup
|
||||
bool GetMyExternalIP(unsigned int& ipRet)
|
||||
{
|
||||
CAddress addrConnect;
|
||||
@@ -174,28 +176,13 @@ bool GetMyExternalIP(unsigned int& ipRet)
|
||||
for (int nLookup = 0; nLookup <= 1; nLookup++)
|
||||
for (int nHost = 1; nHost <= 2; nHost++)
|
||||
{
|
||||
// We should be phasing out our use of sites like these. If we need
|
||||
// replacements, we should ask for volunteers to put this simple
|
||||
// php file on their webserver that prints the client IP:
|
||||
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>
|
||||
if (nHost == 1)
|
||||
{
|
||||
addrConnect = CAddress("70.86.96.218:80"); // www.ipaddressworld.com
|
||||
|
||||
if (nLookup == 1)
|
||||
{
|
||||
struct hostent* phostent = gethostbyname("www.ipaddressworld.com");
|
||||
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
|
||||
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
|
||||
}
|
||||
|
||||
pszGet = "GET /ip.php HTTP/1.1\r\n"
|
||||
"Host: www.ipaddressworld.com\r\n"
|
||||
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n";
|
||||
|
||||
pszKeyword = "IP:";
|
||||
}
|
||||
else if (nHost == 2)
|
||||
{
|
||||
addrConnect = CAddress("208.78.68.70:80"); // checkip.dyndns.org
|
||||
addrConnect = CAddress("91.198.22.70:80"); // checkip.dyndns.org
|
||||
|
||||
if (nLookup == 1)
|
||||
{
|
||||
@@ -212,6 +199,25 @@ bool GetMyExternalIP(unsigned int& ipRet)
|
||||
|
||||
pszKeyword = "Address:";
|
||||
}
|
||||
else if (nHost == 2)
|
||||
{
|
||||
addrConnect = CAddress("74.208.43.192:80"); // www.showmyip.com
|
||||
|
||||
if (nLookup == 1)
|
||||
{
|
||||
struct hostent* phostent = gethostbyname("www.showmyip.com");
|
||||
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
|
||||
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(80));
|
||||
}
|
||||
|
||||
pszGet = "GET /simple/ HTTP/1.1\r\n"
|
||||
"Host: www.showmyip.com\r\n"
|
||||
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n";
|
||||
|
||||
pszKeyword = NULL; // Returns just IP address
|
||||
}
|
||||
|
||||
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
|
||||
return true;
|
||||
@@ -220,16 +226,47 @@ bool GetMyExternalIP(unsigned int& ipRet)
|
||||
return false;
|
||||
}
|
||||
|
||||
void ThreadGetMyExternalIP(void* parg)
|
||||
{
|
||||
// Wait for IRC to get it first
|
||||
if (!GetBoolArg("-noirc"))
|
||||
{
|
||||
for (int i = 0; i < 2 * 60; i++)
|
||||
{
|
||||
Sleep(1000);
|
||||
if (fGotExternalIP || fShutdown)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback in case IRC fails to get it
|
||||
if (GetMyExternalIP(addrLocalHost.ip))
|
||||
{
|
||||
printf("GetMyExternalIP() returned %s\n", addrLocalHost.ToStringIP().c_str());
|
||||
if (addrLocalHost.IsRoutable())
|
||||
{
|
||||
// If we already connected to a few before we had our IP, go back and addr them.
|
||||
// setAddrKnown automatically filters any duplicate sends.
|
||||
CAddress addr(addrLocalHost);
|
||||
addr.nTime = GetAdjustedTime();
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
pnode->PushAddress(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool AddAddress(CAddress addr)
|
||||
|
||||
bool AddAddress(CAddress addr, int64 nTimePenalty)
|
||||
{
|
||||
if (!addr.IsRoutable())
|
||||
return false;
|
||||
if (addr.ip == addrLocalHost.ip)
|
||||
return false;
|
||||
addr.nTime = max((int64)0, (int64)addr.nTime - nTimePenalty);
|
||||
CRITICAL_BLOCK(cs_mapAddresses)
|
||||
{
|
||||
map<vector<unsigned char>, CAddress>::iterator it = mapAddresses.find(addr.GetKey());
|
||||
@@ -606,7 +643,9 @@ void ThreadSocketHandler2(void* parg)
|
||||
FD_ZERO(&fdsetSend);
|
||||
FD_ZERO(&fdsetError);
|
||||
SOCKET hSocketMax = 0;
|
||||
FD_SET(hListenSocket, &fdsetRecv);
|
||||
|
||||
if(hListenSocket != INVALID_SOCKET)
|
||||
FD_SET(hListenSocket, &fdsetRecv);
|
||||
hSocketMax = max(hSocketMax, hListenSocket);
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
{
|
||||
@@ -643,18 +682,24 @@ void ThreadSocketHandler2(void* parg)
|
||||
//
|
||||
// Accept new connections
|
||||
//
|
||||
if (FD_ISSET(hListenSocket, &fdsetRecv))
|
||||
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
|
||||
{
|
||||
struct sockaddr_in sockaddr;
|
||||
socklen_t len = sizeof(sockaddr);
|
||||
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
||||
CAddress addr(sockaddr);
|
||||
int nInbound = 0;
|
||||
|
||||
CRITICAL_BLOCK(cs_vNodes)
|
||||
foreach(CNode* pnode, vNodes)
|
||||
if (pnode->fInbound)
|
||||
nInbound++;
|
||||
if (hSocket == INVALID_SOCKET)
|
||||
{
|
||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
printf("socket error accept failed: %d\n", WSAGetLastError());
|
||||
}
|
||||
else if (mapArgs.count("-maxconnections") && (int)vNodes.size() >= atoi(mapArgs["-maxconnections"]) - MAX_OUTBOUND_CONNECTIONS)
|
||||
else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
|
||||
{
|
||||
closesocket(hSocket);
|
||||
}
|
||||
@@ -696,32 +741,39 @@ void ThreadSocketHandler2(void* parg)
|
||||
CDataStream& vRecv = pnode->vRecv;
|
||||
unsigned int nPos = vRecv.size();
|
||||
|
||||
// typical socket buffer is 8K-64K
|
||||
char pchBuf[0x10000];
|
||||
int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT);
|
||||
if (nBytes > 0)
|
||||
{
|
||||
vRecv.resize(nPos + nBytes);
|
||||
memcpy(&vRecv[nPos], pchBuf, nBytes);
|
||||
pnode->nLastRecv = GetTime();
|
||||
}
|
||||
else if (nBytes == 0)
|
||||
{
|
||||
// socket closed gracefully
|
||||
if (nPos > 1000*GetArg("-maxreceivebuffer", 2*1000)) {
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket closed\n");
|
||||
printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size());
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
else if (nBytes < 0)
|
||||
{
|
||||
// error
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
|
||||
else {
|
||||
// typical socket buffer is 8K-64K
|
||||
char pchBuf[0x10000];
|
||||
int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT);
|
||||
if (nBytes > 0)
|
||||
{
|
||||
vRecv.resize(nPos + nBytes);
|
||||
memcpy(&vRecv[nPos], pchBuf, nBytes);
|
||||
pnode->nLastRecv = GetTime();
|
||||
}
|
||||
else if (nBytes == 0)
|
||||
{
|
||||
// socket closed gracefully
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket recv error %d\n", nErr);
|
||||
printf("socket closed\n");
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
else if (nBytes < 0)
|
||||
{
|
||||
// error
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
|
||||
{
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket recv error %d\n", nErr);
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -754,6 +806,11 @@ void ThreadSocketHandler2(void* parg)
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
if (vSend.size() > 1000*GetArg("-maxsendbuffer", 256)) {
|
||||
if (!pnode->fDisconnect)
|
||||
printf("socket send flood control disconnect (%d bytes)\n", vSend.size());
|
||||
pnode->CloseSocketDisconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -806,42 +863,46 @@ void ThreadSocketHandler2(void* parg)
|
||||
|
||||
unsigned int pnSeed[] =
|
||||
{
|
||||
// 2010/06
|
||||
0x35218252, 0x9c9c9618, 0xda6bacad, 0xb9aca862, 0x97c235c6,
|
||||
0x146f9562, 0xb67b9e4b, 0x87cf4bc0, 0xb83945d0, 0x984333ad,
|
||||
0xbbeec555, 0x6f0eb440, 0xe0005318, 0x7797e460, 0xddc60fcc,
|
||||
0xb3bbd24a, 0x1ac85746, 0x641846a6, 0x85ee1155, 0xbb2e7a4c,
|
||||
0x9cb8514b, 0xfc342648, 0x62958fae, 0xd0a8c87a, 0xa800795b,
|
||||
0xda8c814e, 0x256a0c80, 0x3f23ec63, 0xd565df43, 0x997d9044,
|
||||
0xaa121448, 0xbed8688e, 0x59d09a5e, 0xb2931243, 0x3730ba18,
|
||||
0xdd3462d0, 0x4e4d1448, 0x171df645, 0x84ee1155,
|
||||
0x248ac445, 0x0e634444, 0x0ded1b63, 0x30c01e60,
|
||||
0xa2b9a094, 0x29e4fd43, 0x9ce61b4c, 0xdae09744,
|
||||
|
||||
// 2010/08
|
||||
0x5ae6bf43, 0x460be257, 0x7245c0cf, 0x4e0f028d, 0x26501760, 0x38643255, 0x67094f4f, 0x480449b8,
|
||||
0x16545143, 0x1f082e5a, 0xaa428018, 0xe411e793, 0x14c1f862, 0x2726105b, 0x9b33ea50, 0xeeef86ca,
|
||||
0xe3210d44, 0x0dca8b63, 0x3f9dfb18, 0x860340ad, 0xf33ba17a, 0x9018375c, 0x1de4e353, 0x0fa52dcb,
|
||||
0x89c4555b, 0x109cf37b, 0x28c55b40, 0x04c801ae, 0x275c1e80, 0x6f7f745d, 0x7a2a5653, 0xa28e26d8,
|
||||
0xa4e65db2, 0x99a06580, 0xf253ba44, 0x82cf6ab8, 0x859c2e8e, 0xf71a815d, 0xc18f1454, 0x71c8a943,
|
||||
0x90d24e18, 0x311789b2, 0x74aba645, 0xde0bbfc3, 0xad724fad, 0xbf1ae15e, 0xbaa6fb54, 0x06e4d145,
|
||||
0x51528645, 0x72120cd4, 0xd4cfd145, 0x0a7afed8, 0x9b9a5fad, 0x9e9ff45e, 0x10128355, 0xd44e8646,
|
||||
0x04a07b47, 0x5fc9d547, 0xe0491e45, 0xbac21b41, 0x7aa31bae, 0x10483c5f, 0x94a23055, 0x73d9dc47,
|
||||
0x1a99c247, 0x822fe847, 0x7e57ba48, 0xb19ea843, 0xa60621b2, 0x778cf163, 0x125c6556, 0xf94ba44f,
|
||||
0xa61a0948, 0x6c839e4b, 0x29af5348, 0x68d84845, 0x752b95c3, 0xcf0d4663, 0x08e11e56, 0x75109550,
|
||||
0x5f24b94c, 0x42426d4d, 0xfbbc0a4c, 0x70a9a246, 0xda7837cb, 0xae2a986d, 0xe283c358, 0x0c7ca954,
|
||||
0x8e9bde59, 0x61521760, 0x6884444c, 0xa194e548, 0x9b8809cc, 0x16e96a8f, 0x956ff859, 0xfad5e555,
|
||||
0x0ea70c80, 0x5b4ce26d, 0x7984444c, 0x1080d24a, 0x22a686cf, 0x6bf8c2ad, 0xb0f7485f, 0x06b66e56,
|
||||
0x668373bc, 0x75506279, 0x3868694e, 0x12a5954b, 0x3a8b62d1, 0xb74fcbad, 0xa7dc3360, 0xc070b359,
|
||||
0xa2b87242, 0xc45cab7c, 0x69882050, 0x14a5464b, 0x386acad5, 0x80b85db2, 0x1f78a062, 0xc608c55b,
|
||||
0x4257d543, 0x7636ad80, 0x4432d655, 0xb2114d4b, 0x32639bd9, 0xadd75db2, 0x9be5a362, 0x6831bc5e,
|
||||
0xf7f77046, 0x8f35ba81, 0x09bb4e59, 0xd0fb6b4e, 0xc5daa445, 0x9c611618, 0x355dcc62, 0xf2cf435e,
|
||||
0x31e72c46, 0xdd8a43ad, 0x171f9c5b, 0xb4c2e355, 0xbe8af945, 0x613d3942, 0xe6f9e863, 0x7a3d855f,
|
||||
0xa66adc47, 0x261089b2, 0x5a27105b, 0x6c28105b, 0xdd247946, 0xe6c3a445, 0x43a1ec63, 0x99b4dd5f,
|
||||
0xb6834347, 0x5e9649bc, 0xf9dd545d, 0x6ae4c15b, 0xa5318a47, 0x7984ec47, 0x93a73b63, 0x0c60195f,
|
||||
0xa5c85e4b, 0xa0a36dc2, 0x0739a95e, 0x3d44c15b, 0xfb940f4b, 0xd67c9148, 0x614f9876, 0x0a241c5f,
|
||||
0xad9da74c, 0x4459abc8, 0x12e71b5f, 0x1c534a5d, 0x8ff5fc50, 0x2ca8864b, 0xd894fd80, 0x82ab3160,
|
||||
0x390d804e, 0x2cf310cc, 0x680dad80, 0x691be15e, 0x5a8f4652, 0xaad0784d, 0x0d2431ad,
|
||||
0x1ddb1032, 0x6242ce40, 0x52d6a445, 0x2dd7a445, 0x8a53cd47, 0x73263750, 0xda23c257, 0xecd4ed57,
|
||||
0x0a40ec59, 0x75dce160, 0x7df76791, 0x89370bad, 0xa4f214ad, 0x767700ae, 0x638b0418, 0x868a1018,
|
||||
0xcd9f332e, 0x0129653e, 0xcc92dc3e, 0x96671640, 0x56487e40, 0x5b66f440, 0xb1d01f41, 0xf1dc6041,
|
||||
0xc1d12b42, 0x86ba1243, 0x6be4df43, 0x6d4cef43, 0xd18e0644, 0x1ab0b344, 0x6584a345, 0xe7c1a445,
|
||||
0x58cea445, 0xc5daa445, 0x21dda445, 0x3d3b5346, 0x13e55347, 0x1080d24a, 0x8e611e4b, 0x81518e4b,
|
||||
0x6c839e4b, 0xe2ad0a4c, 0xfbbc0a4c, 0x7f5b6e4c, 0x7244224e, 0x1300554e, 0x20690652, 0x5a48b652,
|
||||
0x75c5c752, 0x4335cc54, 0x340fd154, 0x87c07455, 0x087b2b56, 0x8a133a57, 0xac23c257, 0x70374959,
|
||||
0xfb63d45b, 0xb9a1685c, 0x180d765c, 0x674f645d, 0x04d3495e, 0x1de44b5e, 0x4ee8a362, 0x0ded1b63,
|
||||
0xc1b04b6d, 0x8d921581, 0x97b7ea82, 0x1cf83a8e, 0x91490bad, 0x09dc75ae, 0x9a6d79ae, 0xa26d79ae,
|
||||
0x0fd08fae, 0x0f3e3fb2, 0x4f944fb2, 0xcca448b8, 0x3ecd6ab8, 0xa9d5a5bc, 0x8d0119c1, 0x045997d5,
|
||||
0xca019dd9, 0x0d526c4d, 0xabf1ba44, 0x66b1ab55, 0x1165f462, 0x3ed7cbad, 0xa38fae6e, 0x3bd2cbad,
|
||||
0xd36f0547, 0x20df7840, 0x7a337742, 0x549f8e4b, 0x9062365c, 0xd399f562, 0x2b5274a1, 0x8edfa153,
|
||||
0x3bffb347, 0x7074bf58, 0xb74fcbad, 0x5b5a795b, 0x02fa29ce, 0x5a6738d4, 0xe8a1d23e, 0xef98c445,
|
||||
0x4b0f494c, 0xa2bc1e56, 0x7694ad63, 0xa4a800c3, 0x05fda6cd, 0x9f22175e, 0x364a795b, 0x536285d5,
|
||||
0xac44c9d4, 0x0b06254d, 0x150c2fd4, 0x32a50dcc, 0xfd79ce48, 0xf15cfa53, 0x66c01e60, 0x6bc26661,
|
||||
0xc03b47ae, 0x4dda1b81, 0x3285a4c1, 0x883ca96d, 0x35d60a4c, 0xdae09744, 0x2e314d61, 0x84e247cf,
|
||||
0x6c814552, 0x3a1cc658, 0x98d8f382, 0xe584cb5b, 0x15e86057, 0x7b01504e, 0xd852dd48, 0x56382f56,
|
||||
0x0a5df454, 0xa0d18d18, 0x2e89b148, 0xa79c114c, 0xcbdcd054, 0x5523bc43, 0xa9832640, 0x8a066144,
|
||||
0x3894c3bc, 0xab76bf58, 0x6a018ac1, 0xfebf4f43, 0x2f26c658, 0x31102f4e, 0x85e929d5, 0x2a1c175e,
|
||||
0xfc6c2cd1, 0x27b04b6d, 0xdf024650, 0x161748b8, 0x28be6580, 0x57be6580, 0x1cee677a, 0xaa6bb742,
|
||||
0x9a53964b, 0x0a5a2d4d, 0x2434c658, 0x9a494f57, 0x1ebb0e48, 0xf610b85d, 0x077ecf44, 0x085128bc,
|
||||
0x5ba17a18, 0x27ca1b42, 0xf8a00b56, 0xfcd4c257, 0xcf2fc15e, 0xd897e052, 0x4cada04f, 0x2f35f6d5,
|
||||
0x382ce8c9, 0xe523984b, 0x3f946846, 0x60c8be43, 0x41da6257, 0xde0be142, 0xae8a544b, 0xeff0c254,
|
||||
0x1e0f795b, 0xaeb28890, 0xca16acd9, 0x1e47ddd8, 0x8c8c4829, 0xd27dc747, 0xd53b1663, 0x4096b163,
|
||||
0x9c8dd958, 0xcb12f860, 0x9e79305c, 0x40c1a445, 0x4a90c2bc, 0x2c3a464d, 0x2727f23c, 0x30b04b6d,
|
||||
0x59024cb8, 0xa091e6ad, 0x31b04b6d, 0xc29d46a6, 0x63934fb2, 0xd9224dbe, 0x9f5910d8, 0x7f530a6b,
|
||||
0x752e9c95, 0x65453548, 0xa484be46, 0xce5a1b59, 0x710e0718, 0x46a13d18, 0xdaaf5318, 0xc4a8ff53,
|
||||
0x87abaa52, 0xb764cf51, 0xb2025d4a, 0x6d351e41, 0xc035c33e, 0xa432c162, 0x61ef34ae, 0xd16fddbc,
|
||||
0x0870e8c1, 0x3070e8c1, 0x9c71e8c1, 0xa4992363, 0x85a1f663, 0x4184e559, 0x18d96ed8, 0x17b8dbd5,
|
||||
0x60e7cd18, 0xe5ee104c, 0xab17ac62, 0x1e786e1b, 0x5d23b762, 0xf2388fae, 0x88270360, 0x9e5b3d80,
|
||||
0x7da518b2, 0xb5613b45, 0x1ad41f3e, 0xd550854a, 0x8617e9a9, 0x925b229c, 0xf2e92542, 0x47af0544,
|
||||
0x73b5a843, 0xb9b7a0ad, 0x03a748d0, 0x0a6ff862, 0x6694df62, 0x3bfac948, 0x8e098f4f, 0x746916c3,
|
||||
0x02f38e4f, 0x40bb1243, 0x6a54d162, 0x6008414b, 0xa513794c, 0x514aa343, 0x63781747, 0xdbb6795b,
|
||||
0xed065058, 0x42d24b46, 0x1518794c, 0x9b271681, 0x73e4ffad, 0x0654784f, 0x438dc945, 0x641846a6,
|
||||
0x2d1b0944, 0x94b59148, 0x8d369558, 0xa5a97662, 0x8b705b42, 0xce9204ae, 0x8d584450, 0x2df61555,
|
||||
0xeebff943, 0x2e75fb4d, 0x3ef8fc57, 0x9921135e, 0x8e31042e, 0xb5afad43, 0x89ecedd1, 0x9cfcc047,
|
||||
0x8fcd0f4c, 0xbe49f5ad, 0x146a8d45, 0x98669ab8, 0x98d9175e, 0xd1a8e46d, 0x839a3ab8, 0x40a0016c,
|
||||
0x6d27c257, 0x977fffad, 0x7baa5d5d, 0x1213be43, 0xb167e5a9, 0x640fe8ca, 0xbc9ea655, 0x0f820a4c,
|
||||
0x0f097059, 0x69ac957c, 0x366d8453, 0xb1ba2844, 0x8857f081, 0x70b5be63, 0xc545454b, 0xaf36ded1,
|
||||
0xb5a4b052, 0x21f062d1, 0x72ab89b2, 0x74a45318, 0x8312e6bc, 0xb916965f, 0x8aa7c858, 0xfe7effad,
|
||||
};
|
||||
|
||||
|
||||
@@ -920,8 +981,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
if (!pnode->fInbound)
|
||||
nOutbound++;
|
||||
int nMaxOutboundConnections = MAX_OUTBOUND_CONNECTIONS;
|
||||
if (mapArgs.count("-maxconnections"))
|
||||
nMaxOutboundConnections = min(nMaxOutboundConnections, atoi(mapArgs["-maxconnections"]));
|
||||
nMaxOutboundConnections = min(nMaxOutboundConnections, (int)GetArg("-maxconnections", 125));
|
||||
if (nOutbound < nMaxOutboundConnections)
|
||||
break;
|
||||
Sleep(2000);
|
||||
@@ -937,7 +997,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
// Add seed nodes if IRC isn't working
|
||||
static bool fSeedUsed;
|
||||
bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
|
||||
if (mapAddresses.empty() && (GetTime() - nStart > 60 || fTOR))
|
||||
if (mapAddresses.empty() && (GetTime() - nStart > 60 || fTOR) && !fTestNet)
|
||||
{
|
||||
for (int i = 0; i < ARRAYLEN(pnSeed); i++)
|
||||
{
|
||||
@@ -970,7 +1030,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
{
|
||||
foreach(PAIRTYPE(const vector<unsigned char>, CAddress)& item, mapAddresses)
|
||||
{
|
||||
if (setSeed.count(item.second.ip))
|
||||
if (setSeed.count(item.second.ip) && item.second.nTime != 0)
|
||||
{
|
||||
item.second.nTime = 0;
|
||||
CAddrDB().WriteAddress(item.second);
|
||||
@@ -1006,7 +1066,7 @@ void ThreadOpenConnections2(void* parg)
|
||||
|
||||
// Randomize the order in a deterministic way, putting the standard port first
|
||||
int64 nRandomizer = (uint64)(nStart * 4951 + addr.nLastTry * 9567851 + addr.ip * 7789) % (2 * 60 * 60);
|
||||
if (addr.port != DEFAULT_PORT)
|
||||
if (addr.port != GetDefaultPort())
|
||||
nRandomizer += 2 * 60 * 60;
|
||||
|
||||
// Last seen Base retry frequency
|
||||
@@ -1073,25 +1133,6 @@ bool OpenNetworkConnection(const CAddress& addrConnect)
|
||||
return false;
|
||||
pnode->fNetworkNode = true;
|
||||
|
||||
if (addrLocalHost.IsRoutable() && !fUseProxy)
|
||||
{
|
||||
// Advertise our address
|
||||
vector<CAddress> vAddr;
|
||||
vAddr.push_back(addrLocalHost);
|
||||
pnode->PushMessage("addr", vAddr);
|
||||
}
|
||||
|
||||
// Get as many addresses as we can
|
||||
pnode->PushMessage("getaddr");
|
||||
pnode->fGetAddr = true; // don't relay the results of the getaddr
|
||||
|
||||
////// should the one on the receiving end do this too?
|
||||
// Subscribe our local subscription list
|
||||
const unsigned int nHops = 0;
|
||||
for (unsigned int nChannel = 0; nChannel < pnodeLocalHost->vfSubscribe.size(); nChannel++)
|
||||
if (pnodeLocalHost->vfSubscribe[nChannel])
|
||||
pnode->PushMessage("subscribe", nChannel, nHops);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1185,6 +1226,7 @@ bool BindListenPort(string& strError)
|
||||
{
|
||||
strError = "";
|
||||
int nOne = 1;
|
||||
addrLocalHost.port = GetDefaultPort();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Initialize Windows Sockets
|
||||
@@ -1236,12 +1278,12 @@ bool BindListenPort(string& strError)
|
||||
memset(&sockaddr, 0, sizeof(sockaddr));
|
||||
sockaddr.sin_family = AF_INET;
|
||||
sockaddr.sin_addr.s_addr = INADDR_ANY; // bind to all IPs on this computer
|
||||
sockaddr.sin_port = DEFAULT_PORT;
|
||||
sockaddr.sin_port = GetDefaultPort();
|
||||
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) == SOCKET_ERROR)
|
||||
{
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEADDRINUSE)
|
||||
strError = strprintf("Unable to bind to port %d on this computer. Bitcoin is probably already running.", ntohs(sockaddr.sin_port));
|
||||
strError = strprintf(_("Unable to bind to port %d on this computer. Bitcoin is probably already running."), ntohs(sockaddr.sin_port));
|
||||
else
|
||||
strError = strprintf("Error: Unable to bind to port %d on this computer (bind returned error %d)", ntohs(sockaddr.sin_port), nErr);
|
||||
printf("%s\n", strError.c_str());
|
||||
@@ -1278,7 +1320,7 @@ void StartNode(void* parg)
|
||||
printf("host ip %d: %s\n", i, CAddress(*(unsigned int*)phostent->h_addr_list[i]).ToStringIP().c_str());
|
||||
for (int i = 0; phostent->h_addr_list[i] != NULL; i++)
|
||||
{
|
||||
CAddress addr(*(unsigned int*)phostent->h_addr_list[i], DEFAULT_PORT, nLocalServices);
|
||||
CAddress addr(*(unsigned int*)phostent->h_addr_list[i], GetDefaultPort(), nLocalServices);
|
||||
if (addr.IsValid() && addr.GetByte(3) != 127)
|
||||
{
|
||||
addrLocalHost = addr;
|
||||
@@ -1306,7 +1348,7 @@ void StartNode(void* parg)
|
||||
printf("ipv4 %s: %s\n", ifa->ifa_name, pszIP);
|
||||
|
||||
// Take the first IP that isn't loopback 127.x.x.x
|
||||
CAddress addr(*(unsigned int*)&s4->sin_addr, DEFAULT_PORT, nLocalServices);
|
||||
CAddress addr(*(unsigned int*)&s4->sin_addr, GetDefaultPort(), nLocalServices);
|
||||
if (addr.IsValid() && addr.GetByte(3) != 127)
|
||||
{
|
||||
addrLocalHost = addr;
|
||||
@@ -1325,8 +1367,7 @@ void StartNode(void* parg)
|
||||
#endif
|
||||
printf("addrLocalHost = %s\n", addrLocalHost.ToString().c_str());
|
||||
|
||||
// Get our external IP address for incoming connections
|
||||
if (fUseProxy)
|
||||
if (fUseProxy || mapArgs.count("-connect") || fNoListen)
|
||||
{
|
||||
// Proxies can't take incoming connections
|
||||
addrLocalHost.ip = CAddress("0.0.0.0").ip;
|
||||
@@ -1334,15 +1375,7 @@ void StartNode(void* parg)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addrIncoming.IsValid())
|
||||
addrLocalHost.ip = addrIncoming.ip;
|
||||
|
||||
if (GetMyExternalIP(addrLocalHost.ip))
|
||||
{
|
||||
addrIncoming = addrLocalHost;
|
||||
CWalletDB().WriteSetting("addrIncoming", addrIncoming);
|
||||
printf("addrLocalHost = %s\n", addrLocalHost.ToString().c_str());
|
||||
}
|
||||
CreateThread(ThreadGetMyExternalIP, NULL);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
35
net.h
35
net.h
@@ -12,7 +12,7 @@ extern int nBestHeight;
|
||||
|
||||
|
||||
|
||||
static const unsigned short DEFAULT_PORT = 0x8d20; // htons(8333)
|
||||
inline unsigned short GetDefaultPort() { return fTestNet ? htons(18333) : htons(8333); }
|
||||
static const unsigned int PUBLISH_HOPS = 5;
|
||||
enum
|
||||
{
|
||||
@@ -24,7 +24,7 @@ enum
|
||||
|
||||
bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet);
|
||||
bool GetMyExternalIP(unsigned int& ipRet);
|
||||
bool AddAddress(CAddress addr);
|
||||
bool AddAddress(CAddress addr, int64 nTimePenalty=0);
|
||||
void AddressCurrentlyConnected(const CAddress& addr);
|
||||
CNode* FindNode(unsigned int ip);
|
||||
CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0);
|
||||
@@ -48,10 +48,7 @@ bool StopNode();
|
||||
// (4) size
|
||||
// (4) checksum
|
||||
|
||||
// The message start string is designed to be unlikely to occur in normal data.
|
||||
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
|
||||
// a large 4-byte int at any alignment.
|
||||
static const char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };
|
||||
extern char pchMessageStart[4];
|
||||
|
||||
class CMessageHeader
|
||||
{
|
||||
@@ -142,7 +139,7 @@ public:
|
||||
unsigned int ip;
|
||||
unsigned short port;
|
||||
|
||||
// disk only
|
||||
// disk and network only
|
||||
unsigned int nTime;
|
||||
|
||||
// memory only
|
||||
@@ -153,11 +150,11 @@ public:
|
||||
Init();
|
||||
}
|
||||
|
||||
CAddress(unsigned int ipIn, unsigned short portIn=DEFAULT_PORT, uint64 nServicesIn=NODE_NETWORK)
|
||||
CAddress(unsigned int ipIn, unsigned short portIn=0, uint64 nServicesIn=NODE_NETWORK)
|
||||
{
|
||||
Init();
|
||||
ip = ipIn;
|
||||
port = portIn;
|
||||
port = (portIn == 0 ? GetDefaultPort() : portIn);
|
||||
nServices = nServicesIn;
|
||||
}
|
||||
|
||||
@@ -188,15 +185,15 @@ public:
|
||||
nServices = NODE_NETWORK;
|
||||
memcpy(pchReserved, pchIPv4, sizeof(pchReserved));
|
||||
ip = INADDR_NONE;
|
||||
port = DEFAULT_PORT;
|
||||
nTime = GetAdjustedTime();
|
||||
port = GetDefaultPort();
|
||||
nTime = 100000000;
|
||||
nLastTry = 0;
|
||||
}
|
||||
|
||||
bool SetAddress(const char* pszIn)
|
||||
{
|
||||
ip = INADDR_NONE;
|
||||
port = DEFAULT_PORT;
|
||||
port = GetDefaultPort();
|
||||
char psz[100];
|
||||
strlcpy(psz, pszIn, sizeof(psz));
|
||||
unsigned int a=0, b=0, c=0, d=0, e=0;
|
||||
@@ -221,11 +218,12 @@ public:
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (fRead)
|
||||
const_cast<CAddress*>(this)->Init();
|
||||
if (nType & SER_DISK)
|
||||
{
|
||||
READWRITE(nVersion);
|
||||
if ((nType & SER_DISK) || (nVersion >= 31402 && !(nType & SER_GETHASH)))
|
||||
READWRITE(nTime);
|
||||
}
|
||||
READWRITE(nServices);
|
||||
READWRITE(FLATDATA(pchReserved)); // for IPv6
|
||||
READWRITE(ip);
|
||||
@@ -418,7 +416,7 @@ public:
|
||||
const char* GetCommand() const
|
||||
{
|
||||
if (!IsKnownType())
|
||||
throw std::out_of_range(strprintf("CInv::GetCommand() : type=% unknown type", type));
|
||||
throw std::out_of_range(strprintf("CInv::GetCommand() : type=%d unknown type", type));
|
||||
return ppszTypeName[type];
|
||||
}
|
||||
|
||||
@@ -735,13 +733,6 @@ public:
|
||||
AbortMessage();
|
||||
}
|
||||
|
||||
const char* GetMessageCommand() const
|
||||
{
|
||||
if (nHeaderStart == -1)
|
||||
return "";
|
||||
return &vSend[nHeaderStart] + offsetof(CMessageHeader, pchCommand);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2
obj/.gitignore
vendored
Normal file
2
obj/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
obj/nogui/.gitignore
vendored
Normal file
2
obj/nogui/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
22
script.cpp
22
script.cpp
@@ -776,16 +776,11 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
|
||||
return false;
|
||||
|
||||
int nKeysCount = CastToBigNum(stacktop(-i)).getint();
|
||||
if (nKeysCount < 0)
|
||||
if (nKeysCount < 0 || nKeysCount > 20)
|
||||
return false;
|
||||
nOpCount += nKeysCount;
|
||||
if (nOpCount > 201)
|
||||
return false;
|
||||
if (nBestHeight > 84000)
|
||||
{
|
||||
if (nKeysCount > 20)
|
||||
return false;
|
||||
nOpCount += nKeysCount;
|
||||
if (nOpCount > 201)
|
||||
return false;
|
||||
}
|
||||
int ikey = ++i;
|
||||
i += nKeysCount;
|
||||
if (stack.size() < i)
|
||||
@@ -1002,7 +997,7 @@ bool Solver(const CScript& scriptPubKey, vector<pair<opcodetype, valtype> >& vSo
|
||||
break;
|
||||
if (opcode2 == OP_PUBKEY)
|
||||
{
|
||||
if (vch1.size() < 33)
|
||||
if (vch1.size() < 33 || vch1.size() > 120)
|
||||
break;
|
||||
vSolutionRet.push_back(make_pair(opcode2, vch1));
|
||||
}
|
||||
@@ -1081,6 +1076,13 @@ bool Solver(const CScript& scriptPubKey, uint256 hash, int nHashType, CScript& s
|
||||
}
|
||||
|
||||
|
||||
bool IsStandard(const CScript& scriptPubKey)
|
||||
{
|
||||
vector<pair<opcodetype, valtype> > vSolution;
|
||||
return Solver(scriptPubKey, vSolution);
|
||||
}
|
||||
|
||||
|
||||
bool IsMine(const CScript& scriptPubKey)
|
||||
{
|
||||
CScript scriptSig;
|
||||
|
||||
18
script.h
18
script.h
@@ -597,6 +597,23 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool IsPushOnly() const
|
||||
{
|
||||
if (size() > 200)
|
||||
return false;
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
if (!GetOp(pc, opcode))
|
||||
return false;
|
||||
if (opcode > OP_16)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint160 GetBitcoinAddressHash160() const
|
||||
{
|
||||
opcodetype opcode;
|
||||
@@ -684,6 +701,7 @@ public:
|
||||
|
||||
|
||||
uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
|
||||
bool IsStandard(const CScript& scriptPubKey);
|
||||
bool IsMine(const CScript& scriptPubKey);
|
||||
bool ExtractPubKey(const CScript& scriptPubKey, bool fMineOnly, vector<unsigned char>& vchPubKeyRet);
|
||||
bool ExtractHash160(const CScript& scriptPubKey, uint160& hash160Ret);
|
||||
|
||||
97
serialize.h
97
serialize.h
@@ -7,6 +7,9 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <boost/type_traits/is_fundamental.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <boost/tuple/tuple_io.hpp>
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
@@ -22,8 +25,9 @@ class CDataStream;
|
||||
class CAutoFile;
|
||||
static const unsigned int MAX_SIZE = 0x02000000;
|
||||
|
||||
static const int VERSION = 31300;
|
||||
static const int VERSION = 32001;
|
||||
static const char* pszSubVer = "";
|
||||
static const bool VERSION_IS_BETA = true;
|
||||
|
||||
|
||||
|
||||
@@ -338,6 +342,16 @@ template<typename K, typename T> unsigned int GetSerializeSize(const std::pair<K
|
||||
template<typename Stream, typename K, typename T> void Serialize(Stream& os, const std::pair<K, T>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename K, typename T> void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion=VERSION);
|
||||
|
||||
// 3 tuple
|
||||
template<typename T0, typename T1, typename T2> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion=VERSION);
|
||||
|
||||
// 4 tuple
|
||||
template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion=VERSION);
|
||||
|
||||
// map
|
||||
template<typename K, typename T, typename Pred, typename A> unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
|
||||
template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m, int nType, int nVersion=VERSION);
|
||||
@@ -554,6 +568,71 @@ void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 3 tuple
|
||||
//
|
||||
template<typename T0, typename T1, typename T2>
|
||||
unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = 0;
|
||||
nSize += GetSerializeSize(get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<2>(item), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2>
|
||||
void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
Serialize(os, get<0>(item), nType, nVersion);
|
||||
Serialize(os, get<1>(item), nType, nVersion);
|
||||
Serialize(os, get<2>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2>
|
||||
void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion)
|
||||
{
|
||||
Unserialize(is, get<0>(item), nType, nVersion);
|
||||
Unserialize(is, get<1>(item), nType, nVersion);
|
||||
Unserialize(is, get<2>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 4 tuple
|
||||
//
|
||||
template<typename T0, typename T1, typename T2, typename T3>
|
||||
unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
unsigned int nSize = 0;
|
||||
nSize += GetSerializeSize(get<0>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<1>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<2>(item), nType, nVersion);
|
||||
nSize += GetSerializeSize(get<3>(item), nType, nVersion);
|
||||
return nSize;
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3>
|
||||
void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
Serialize(os, get<0>(item), nType, nVersion);
|
||||
Serialize(os, get<1>(item), nType, nVersion);
|
||||
Serialize(os, get<2>(item), nType, nVersion);
|
||||
Serialize(os, get<3>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream, typename T0, typename T1, typename T2, typename T3>
|
||||
void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion)
|
||||
{
|
||||
Unserialize(is, get<0>(item), nType, nVersion);
|
||||
Unserialize(is, get<1>(item), nType, nVersion);
|
||||
Unserialize(is, get<2>(item), nType, nVersion);
|
||||
Unserialize(is, get<3>(item), nType, nVersion);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// map
|
||||
//
|
||||
@@ -684,6 +763,8 @@ struct secure_allocator : public std::allocator<T>
|
||||
typedef typename base::value_type value_type;
|
||||
secure_allocator() throw() {}
|
||||
secure_allocator(const secure_allocator& a) throw() : base(a) {}
|
||||
template <typename U>
|
||||
secure_allocator(const secure_allocator<U>& a) throw() : base(a) {}
|
||||
~secure_allocator() throw() {}
|
||||
template<typename _Other> struct rebind
|
||||
{ typedef secure_allocator<_Other> other; };
|
||||
@@ -725,39 +806,39 @@ public:
|
||||
typedef vector_type::const_iterator const_iterator;
|
||||
typedef vector_type::reverse_iterator reverse_iterator;
|
||||
|
||||
explicit CDataStream(int nTypeIn=0, int nVersionIn=VERSION)
|
||||
explicit CDataStream(int nTypeIn=SER_NETWORK, int nVersionIn=VERSION)
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn=0, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1300
|
||||
CDataStream(const char* pbegin, const char* pend, int nTypeIn=0, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
CDataStream(const char* pbegin, const char* pend, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(pbegin, pend)
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
#endif
|
||||
|
||||
CDataStream(const vector_type& vchIn, int nTypeIn=0, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
CDataStream(const vector_type& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
CDataStream(const vector<char>& vchIn, int nTypeIn=0, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
CDataStream(const vector<char>& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch(vchIn.begin(), vchIn.end())
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
CDataStream(const vector<unsigned char>& vchIn, int nTypeIn=0, int nVersionIn=VERSION) : vch((char*)&vchIn.begin()[0], (char*)&vchIn.end()[0])
|
||||
CDataStream(const vector<unsigned char>& vchIn, int nTypeIn=SER_NETWORK, int nVersionIn=VERSION) : vch((char*)&vchIn.begin()[0], (char*)&vchIn.end()[0])
|
||||
{
|
||||
Init(nTypeIn, nVersionIn);
|
||||
}
|
||||
|
||||
void Init(int nTypeIn=0, int nVersionIn=VERSION)
|
||||
void Init(int nTypeIn=SER_NETWORK, int nVersionIn=VERSION)
|
||||
{
|
||||
nReadPos = 0;
|
||||
nType = nTypeIn;
|
||||
|
||||
11
setup.nsi
11
setup.nsi
@@ -1,13 +1,10 @@
|
||||
# Auto-generated by EclipseNSIS Script Wizard
|
||||
# 3.10.2009 19:00:28
|
||||
|
||||
Name Bitcoin
|
||||
|
||||
RequestExecutionLevel highest
|
||||
|
||||
# General Symbol Definitions
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION 0.3.13
|
||||
!define VERSION 0.3.20
|
||||
!define COMPANY "Bitcoin project"
|
||||
!define URL http://www.bitcoin.org/
|
||||
|
||||
@@ -42,12 +39,12 @@ Var StartMenuGroup
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
# Installer attributes
|
||||
OutFile bitcoin-0.3.13-win32-setup.exe
|
||||
OutFile bitcoin-0.3.20-win32-setup.exe
|
||||
InstallDir $PROGRAMFILES\Bitcoin
|
||||
CRCCheck on
|
||||
XPStyle on
|
||||
ShowInstDetails show
|
||||
VIProductVersion 0.3.13.0
|
||||
VIProductVersion 0.3.20.0
|
||||
VIAddVersionKey ProductName Bitcoin
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey CompanyName "${COMPANY}"
|
||||
@@ -64,7 +61,6 @@ Section -Main SEC0000
|
||||
SetOverwrite on
|
||||
File bitcoin.exe
|
||||
File libeay32.dll
|
||||
File mingwm10.dll
|
||||
File license.txt
|
||||
File readme.txt
|
||||
SetOutPath $INSTDIR\daemon
|
||||
@@ -113,7 +109,6 @@ done${UNSECTION_ID}:
|
||||
Section /o -un.Main UNSEC0000
|
||||
Delete /REBOOTOK $INSTDIR\bitcoin.exe
|
||||
Delete /REBOOTOK $INSTDIR\libeay32.dll
|
||||
Delete /REBOOTOK $INSTDIR\mingwm10.dll
|
||||
Delete /REBOOTOK $INSTDIR\license.txt
|
||||
Delete /REBOOTOK $INSTDIR\readme.txt
|
||||
RMDir /r /REBOOTOK $INSTDIR\daemon
|
||||
|
||||
10
sha256.cpp
10
sha256.cpp
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// 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.
|
||||
|
||||
// tcatm's 4-way 128-bit SSE2 SHA-256
|
||||
// 4-way 128-bit SSE2 SHA-256
|
||||
|
||||
#ifdef FOURWAYSSE2
|
||||
|
||||
@@ -110,15 +110,15 @@ static const unsigned int pSHA256InitState[8] =
|
||||
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
||||
|
||||
|
||||
unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pblock, char* phash1, char* phash, unsigned int& nHashesDone)
|
||||
unsigned int ScanHash_4WaySSE2(char* pmidstate, char* pdata, char* phash1, char* phash, unsigned int& nHashesDone)
|
||||
{
|
||||
unsigned int& nNonce = *(unsigned int*)(pblock + 12);
|
||||
unsigned int& nNonce = *(unsigned int*)(pdata + 12);
|
||||
for (;;)
|
||||
{
|
||||
nNonce += NPAR;
|
||||
unsigned int thashbuf[9][NPAR];
|
||||
unsigned int (&thash)[9][NPAR] = *alignup<16>(&thashbuf);
|
||||
DoubleBlockSHA256(pblock, phash1, pmidstate, thash, pSHA256InitState);
|
||||
DoubleBlockSHA256(pdata, phash1, pmidstate, thash, pSHA256InitState);
|
||||
|
||||
for (int j = 0; j < NPAR; j++)
|
||||
{
|
||||
|
||||
213
ui.cpp
213
ui.cpp
@@ -196,7 +196,7 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style
|
||||
|
||||
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
|
||||
{
|
||||
if (nFeeRequired < CENT || fDaemon)
|
||||
if (nFeeRequired < CENT || nFeeRequired <= nTransactionFee || fDaemon)
|
||||
return true;
|
||||
string strMessage = strprintf(
|
||||
_("This transaction is over the size limit. You can still send it for a fee of %s, "
|
||||
@@ -391,7 +391,7 @@ void CMainFrame::OnIconize(wxIconizeEvent& event)
|
||||
if (!event.Iconized())
|
||||
fClosedToTray = false;
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
if (mapArgs.count("-minimizetotray")) {
|
||||
if (GetBoolArg("-minimizetotray")) {
|
||||
#endif
|
||||
// The tray icon sometimes disappears on ubuntu karmic
|
||||
// Hiding the taskbar button doesn't work cleanly on ubuntu lucid
|
||||
@@ -502,10 +502,9 @@ bool CMainFrame::DeleteLine(uint256 hashKey)
|
||||
return nIndex != -1;
|
||||
}
|
||||
|
||||
string FormatTxStatus(const CWalletTx& wtx, bool& fConfirmed)
|
||||
string FormatTxStatus(const CWalletTx& wtx)
|
||||
{
|
||||
// Status
|
||||
fConfirmed = false;
|
||||
if (!wtx.IsFinal())
|
||||
{
|
||||
if (wtx.nLockTime < 500000000)
|
||||
@@ -516,8 +515,6 @@ string FormatTxStatus(const CWalletTx& wtx, bool& fConfirmed)
|
||||
else
|
||||
{
|
||||
int nDepth = wtx.GetDepthInMainChain();
|
||||
if (nDepth >= 1 || wtx.GetDebit() > 0)
|
||||
fConfirmed = true;
|
||||
if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
|
||||
return strprintf(_("%d/offline?"), nDepth);
|
||||
else if (nDepth < 6)
|
||||
@@ -527,12 +524,6 @@ string FormatTxStatus(const CWalletTx& wtx, bool& fConfirmed)
|
||||
}
|
||||
}
|
||||
|
||||
string FormatTxStatus(const CWalletTx& wtx)
|
||||
{
|
||||
bool fConfirmed;
|
||||
return FormatTxStatus(wtx, fConfirmed);
|
||||
}
|
||||
|
||||
string SingleLine(const string& strIn)
|
||||
{
|
||||
string strOut;
|
||||
@@ -561,9 +552,8 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
int64 nDebit = wtx.GetDebit();
|
||||
int64 nNet = nCredit - nDebit;
|
||||
uint256 hash = wtx.GetHash();
|
||||
bool fConfirmed;
|
||||
string strStatus = FormatTxStatus(wtx, fConfirmed);
|
||||
wtx.fConfirmedDisplayed = fConfirmed;
|
||||
string strStatus = FormatTxStatus(wtx);
|
||||
bool fConfirmed = wtx.fConfirmedDisplayed = wtx.IsConfirmed();
|
||||
wxColour colour = (fConfirmed ? wxColour(0,0,0) : wxColour(128,128,128));
|
||||
map<string, string> mapValue = wtx.mapValue;
|
||||
wtx.nLinesDisplayed = 1;
|
||||
@@ -707,16 +697,13 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
if (fAllFromMe && fAllToMe)
|
||||
{
|
||||
// Payment to self
|
||||
int64 nValue = wtx.vout[0].nValue;
|
||||
int64 nChange = wtx.GetChange();
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
_("Payment to yourself"),
|
||||
"",
|
||||
"");
|
||||
/// issue: can't tell which is the payment and which is the change anymore
|
||||
// FormatMoney(nNet - nValue, true),
|
||||
// FormatMoney(nValue, true));
|
||||
FormatMoney(-(nDebit - nChange), true),
|
||||
FormatMoney(nCredit - nChange, true));
|
||||
}
|
||||
else if (fAllFromMe)
|
||||
{
|
||||
@@ -759,6 +746,12 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
strDescription += " - ";
|
||||
strDescription += mapValue["message"];
|
||||
}
|
||||
else if (!mapValue["comment"].empty())
|
||||
{
|
||||
if (!strDescription.empty())
|
||||
strDescription += " - ";
|
||||
strDescription += mapValue["comment"];
|
||||
}
|
||||
|
||||
int64 nValue = txout.nValue;
|
||||
if (nTxFee > 0)
|
||||
@@ -773,6 +766,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
SingleLine(strDescription),
|
||||
FormatMoney(-nValue, true),
|
||||
"");
|
||||
nIndex = -1;
|
||||
wtx.nLinesDisplayed++;
|
||||
}
|
||||
}
|
||||
@@ -914,16 +908,16 @@ void CMainFrame::RefreshStatusColumn()
|
||||
continue;
|
||||
}
|
||||
CWalletTx& wtx = (*mi).second;
|
||||
bool fConfirmed;
|
||||
string strStatus = FormatTxStatus(wtx, fConfirmed);
|
||||
if (wtx.IsCoinBase() || wtx.GetTxTime() != wtx.nTimeDisplayed || fConfirmed != wtx.fConfirmedDisplayed)
|
||||
if (wtx.IsCoinBase() ||
|
||||
wtx.GetTxTime() != wtx.nTimeDisplayed ||
|
||||
wtx.IsConfirmed() != wtx.fConfirmedDisplayed)
|
||||
{
|
||||
if (!InsertTransaction(wtx, false, nIndex))
|
||||
m_listCtrl->DeleteItem(nIndex--);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_listCtrl->SetItem(nIndex, 2, strStatus);
|
||||
m_listCtrl->SetItem(nIndex, 2, FormatTxStatus(wtx));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1180,7 +1174,7 @@ void CMainFrame::OnButtonNew(wxCommandEvent& event)
|
||||
string strName = dialog.GetValue();
|
||||
|
||||
// Generate new key
|
||||
string strAddress = PubKeyToAddress(GenerateNewKey());
|
||||
string strAddress = PubKeyToAddress(GetKeyFromKeyPool());
|
||||
|
||||
// Save
|
||||
SetAddressBookName(strAddress, strName);
|
||||
@@ -1385,10 +1379,10 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
if (fAllToMe)
|
||||
{
|
||||
// Payment to self
|
||||
/// issue: can't tell which is the payment and which is the change anymore
|
||||
//int64 nValue = wtx.vout[0].nValue;
|
||||
//strHTML += _("<b>Debit:</b> ") + FormatMoney(-nValue) + "<br>";
|
||||
//strHTML += _("<b>Credit:</b> ") + FormatMoney(nValue) + "<br>";
|
||||
int64 nChange = wtx.GetChange();
|
||||
int64 nValue = nCredit - nChange;
|
||||
strHTML += _("<b>Debit:</b> ") + FormatMoney(-nValue) + "<br>";
|
||||
strHTML += _("<b>Credit:</b> ") + FormatMoney(nValue) + "<br>";
|
||||
}
|
||||
|
||||
int64 nTxFee = nDebit - wtx.GetValueOut();
|
||||
@@ -1417,6 +1411,8 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
//
|
||||
if (!wtx.mapValue["message"].empty())
|
||||
strHTML += string() + "<br><b>" + _("Message:") + "</b><br>" + HtmlEscape(wtx.mapValue["message"], true) + "<br>";
|
||||
if (!wtx.mapValue["comment"].empty())
|
||||
strHTML += string() + "<br><b>" + _("Comment:") + "</b><br>" + HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
|
||||
|
||||
if (wtx.IsCoinBase())
|
||||
strHTML += string() + "<br>" + _("Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.") + "<br>";
|
||||
@@ -1435,7 +1431,10 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
if (txout.IsMine())
|
||||
strHTML += "<b>Credit:</b> " + FormatMoney(txout.GetCredit()) + "<br>";
|
||||
|
||||
strHTML += "<b>Inputs:</b><br>";
|
||||
strHTML += "<br><b>Transaction:</b><br>";
|
||||
strHTML += HtmlEscape(wtx.ToString(), true);
|
||||
|
||||
strHTML += "<br><b>Inputs:</b><br>";
|
||||
CRITICAL_BLOCK(cs_mapWallet)
|
||||
{
|
||||
foreach(const CTxIn& txin, wtx.vin)
|
||||
@@ -1454,9 +1453,6 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
strHTML += "<br><hr><br><b>Transaction:</b><br>";
|
||||
strHTML += HtmlEscape(wtx.ToString(), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1470,8 +1466,7 @@ CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetails
|
||||
|
||||
void CTxDetailsDialog::OnButtonOK(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
//Destroy();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1640,9 +1635,12 @@ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent)
|
||||
//m_listBox->Append(_("Test 2"));
|
||||
m_listBox->SetSelection(0);
|
||||
SelectPage(0);
|
||||
#ifndef __WXMSW__
|
||||
SetSize(1.0 * GetSize().GetWidth(), 1.2 * GetSize().GetHeight());
|
||||
#endif
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
m_checkBoxStartOnSystemStartup->SetLabel(_("&Start Bitcoin on window system startup"));
|
||||
if (!mapArgs.count("-minimizetotray"))
|
||||
if (!GetBoolArg("-minimizetotray"))
|
||||
{
|
||||
// Minimize to tray is just too buggy on Linux
|
||||
fMinimizeToTray = false;
|
||||
@@ -1737,12 +1735,12 @@ void COptionsDialog::OnKillFocusProxy(wxFocusEvent& event)
|
||||
void COptionsDialog::OnButtonOK(wxCommandEvent& event)
|
||||
{
|
||||
OnButtonApply(event);
|
||||
Close();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
void COptionsDialog::OnButtonCancel(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
void COptionsDialog::OnButtonApply(wxCommandEvent& event)
|
||||
@@ -1805,7 +1803,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%s BETA"), FormatVersion(VERSION).c_str(), pszSubVer));
|
||||
|
||||
// Change (c) into UTF-8 or ANSI copyright symbol
|
||||
wxString str = m_staticTextMain->GetLabel();
|
||||
@@ -1829,7 +1827,7 @@ CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
|
||||
|
||||
void CAboutDialog::OnButtonOK(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
EndModal(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1938,69 +1936,78 @@ void CSendDialog::OnButtonPaste(wxCommandEvent& event)
|
||||
|
||||
void CSendDialog::OnButtonSend(wxCommandEvent& event)
|
||||
{
|
||||
CWalletTx wtx;
|
||||
string strAddress = (string)m_textCtrlAddress->GetValue();
|
||||
static CCriticalSection cs_sendlock;
|
||||
TRY_CRITICAL_BLOCK(cs_sendlock)
|
||||
{
|
||||
CWalletTx wtx;
|
||||
string strAddress = (string)m_textCtrlAddress->GetValue();
|
||||
|
||||
// Parse amount
|
||||
int64 nValue = 0;
|
||||
if (!ParseMoney(m_textCtrlAmount->GetValue(), nValue) || nValue <= 0)
|
||||
{
|
||||
wxMessageBox(_("Error in amount "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue > GetBalance())
|
||||
{
|
||||
wxMessageBox(_("Amount exceeds your balance "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue + nTransactionFee > GetBalance())
|
||||
{
|
||||
wxMessageBox(string(_("Total exceeds your balance when the ")) + FormatMoney(nTransactionFee) + _(" transaction fee is included "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse bitcoin address
|
||||
uint160 hash160;
|
||||
bool fBitcoinAddress = AddressToHash160(strAddress, hash160);
|
||||
|
||||
if (fBitcoinAddress)
|
||||
{
|
||||
// Send to bitcoin address
|
||||
CScript scriptPubKey;
|
||||
scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
|
||||
string strError = SendMoney(scriptPubKey, nValue, wtx, true);
|
||||
if (strError == "")
|
||||
wxMessageBox(_("Payment sent "), _("Sending..."));
|
||||
else if (strError != "ABORTED")
|
||||
wxMessageBox(strError + " ", _("Sending..."));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse IP address
|
||||
CAddress addr(strAddress);
|
||||
if (!addr.IsValid())
|
||||
// Parse amount
|
||||
int64 nValue = 0;
|
||||
if (!ParseMoney(m_textCtrlAmount->GetValue(), nValue) || nValue <= 0)
|
||||
{
|
||||
wxMessageBox(_("Invalid address "), _("Send Coins"));
|
||||
wxMessageBox(_("Error in amount "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue > GetBalance())
|
||||
{
|
||||
wxMessageBox(_("Amount exceeds your balance "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
if (nValue + nTransactionFee > GetBalance())
|
||||
{
|
||||
wxMessageBox(string(_("Total exceeds your balance when the ")) + FormatMoney(nTransactionFee) + _(" transaction fee is included "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Message
|
||||
wtx.mapValue["to"] = strAddress;
|
||||
wtx.mapValue["from"] = m_textCtrlFrom->GetValue();
|
||||
wtx.mapValue["message"] = m_textCtrlMessage->GetValue();
|
||||
// Parse bitcoin address
|
||||
uint160 hash160;
|
||||
bool fBitcoinAddress = AddressToHash160(strAddress, hash160);
|
||||
|
||||
// Send to IP address
|
||||
CSendingDialog* pdialog = new CSendingDialog(this, addr, nValue, wtx);
|
||||
if (!pdialog->ShowModal())
|
||||
return;
|
||||
if (fBitcoinAddress)
|
||||
{
|
||||
// Send to bitcoin address
|
||||
CScript scriptPubKey;
|
||||
scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
|
||||
string strError = SendMoney(scriptPubKey, nValue, wtx, true);
|
||||
if (strError == "")
|
||||
wxMessageBox(_("Payment sent "), _("Sending..."));
|
||||
else if (strError == "ABORTED")
|
||||
return; // leave send dialog open
|
||||
else
|
||||
{
|
||||
wxMessageBox(strError + " ", _("Sending..."));
|
||||
EndModal(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse IP address
|
||||
CAddress addr(strAddress);
|
||||
if (!addr.IsValid())
|
||||
{
|
||||
wxMessageBox(_("Invalid address "), _("Send Coins"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Message
|
||||
wtx.mapValue["to"] = strAddress;
|
||||
wtx.mapValue["from"] = m_textCtrlFrom->GetValue();
|
||||
wtx.mapValue["message"] = m_textCtrlMessage->GetValue();
|
||||
|
||||
// Send to IP address
|
||||
CSendingDialog* pdialog = new CSendingDialog(this, addr, nValue, wtx);
|
||||
if (!pdialog->ShowModal())
|
||||
return;
|
||||
}
|
||||
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
if (!mapAddressBook.count(strAddress))
|
||||
SetAddressBookName(strAddress, "");
|
||||
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
if (!mapAddressBook.count(strAddress))
|
||||
SetAddressBookName(strAddress, "");
|
||||
|
||||
EndModal(true);
|
||||
}
|
||||
|
||||
void CSendDialog::OnButtonCancel(wxCommandEvent& event)
|
||||
@@ -2255,9 +2262,9 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
Error(_("Insufficient funds"));
|
||||
return;
|
||||
}
|
||||
CKey key;
|
||||
CReserveKey reservekey;
|
||||
int64 nFeeRequired;
|
||||
if (!CreateTransaction(scriptPubKey, nPrice, wtx, key, nFeeRequired))
|
||||
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()));
|
||||
@@ -2297,7 +2304,7 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
|
||||
return;
|
||||
|
||||
// Commit
|
||||
if (!CommitTransaction(wtx, key))
|
||||
if (!CommitTransaction(wtx, reservekey))
|
||||
{
|
||||
Error(_("The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."));
|
||||
return;
|
||||
@@ -2575,7 +2582,7 @@ void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
|
||||
strName = dialog.GetValue();
|
||||
|
||||
// Generate new key
|
||||
strAddress = PubKeyToAddress(GenerateNewKey());
|
||||
strAddress = PubKeyToAddress(GetKeyFromKeyPool());
|
||||
}
|
||||
|
||||
// Add to list and select it
|
||||
@@ -2741,10 +2748,10 @@ wxMenu* CMyTaskBarIcon::CreatePopupMenu()
|
||||
void CreateMainWindow()
|
||||
{
|
||||
pframeMain = new CMainFrame(NULL);
|
||||
if (mapArgs.count("-min"))
|
||||
if (GetBoolArg("-min"))
|
||||
pframeMain->Iconize(true);
|
||||
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
|
||||
if (!mapArgs.count("-minimizetotray"))
|
||||
if (!GetBoolArg("-minimizetotray"))
|
||||
fMinimizeToTray = false;
|
||||
#endif
|
||||
pframeMain->Show(true); // have to show first to get taskbar button to hide
|
||||
|
||||
48
uibase.cpp
48
uibase.cpp
@@ -61,7 +61,6 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
m_toolBar->Realize();
|
||||
|
||||
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
|
||||
m_statusBar->SetBackgroundColour( wxColour( 240, 240, 240 ) );
|
||||
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
@@ -352,28 +351,6 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
|
||||
|
||||
bSizer69->Add( 0, 16, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( m_panelMain, wxID_ANY, _("Optional transaction fee you give to the nodes that process your transactions."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( -1 );
|
||||
m_staticText32->Hide();
|
||||
|
||||
bSizer69->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer56;
|
||||
bSizer56 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText31 = new wxStaticText( m_panelMain, wxID_ANY, _("Transaction fee:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
m_staticText31->Hide();
|
||||
|
||||
bSizer56->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlTransactionFee = new wxTextCtrl( m_panelMain, wxID_TRANSACTIONFEE, wxEmptyString, wxDefaultPosition, wxSize( 70,-1 ), 0 );
|
||||
m_textCtrlTransactionFee->Hide();
|
||||
|
||||
bSizer56->Add( m_textCtrlTransactionFee, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
bSizer69->Add( bSizer56, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer71;
|
||||
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
@@ -435,6 +412,25 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
|
||||
|
||||
bSizer69->Add( bSizer103, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer69->Add( 0, 1, 0, 0, 5 );
|
||||
|
||||
m_staticText32 = new wxStaticText( m_panelMain, wxID_ANY, _("Optional transaction fee per KB that helps make sure your transactions are processed quickly. Most transactions are 1KB. Fee 0.01 recommended."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText32->Wrap( 365 );
|
||||
bSizer69->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer56;
|
||||
bSizer56 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText31 = new wxStaticText( m_panelMain, wxID_ANY, _("Pay transaction fee:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
bSizer56->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlTransactionFee = new wxTextCtrl( m_panelMain, wxID_TRANSACTIONFEE, wxEmptyString, wxDefaultPosition, wxSize( 70,-1 ), 0 );
|
||||
bSizer56->Add( m_textCtrlTransactionFee, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
bSizer69->Add( bSizer56, 0, wxEXPAND, 5 );
|
||||
|
||||
m_panelMain->SetSizer( bSizer69 );
|
||||
m_panelMain->Layout();
|
||||
bSizer69->Fit( m_panelMain );
|
||||
@@ -486,12 +482,12 @@ COptionsDialogBase::COptionsDialogBase( wxWindow* parent, wxWindowID id, const w
|
||||
|
||||
// Connect Events
|
||||
m_listBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this );
|
||||
m_textCtrlTransactionFee->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), 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 );
|
||||
m_textCtrlProxyPort->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
|
||||
m_textCtrlTransactionFee->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
|
||||
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonOK ), NULL, this );
|
||||
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonCancel ), NULL, this );
|
||||
m_buttonApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonApply ), NULL, this );
|
||||
@@ -501,12 +497,12 @@ COptionsDialogBase::~COptionsDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_listBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( COptionsDialogBase::OnListBox ), NULL, this );
|
||||
m_textCtrlTransactionFee->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), 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 );
|
||||
m_textCtrlProxyPort->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusProxy ), NULL, this );
|
||||
m_textCtrlTransactionFee->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( COptionsDialogBase::OnKillFocusTransactionFee ), NULL, this );
|
||||
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonOK ), NULL, this );
|
||||
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonCancel ), NULL, this );
|
||||
m_buttonApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( COptionsDialogBase::OnButtonApply ), NULL, this );
|
||||
@@ -554,7 +550,7 @@ CAboutDialogBase::CAboutDialogBase( wxWindow* parent, wxWindowID id, const wxStr
|
||||
|
||||
bSizer631->Add( 0, 4, 0, wxEXPAND, 5 );
|
||||
|
||||
m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Satoshi Nakamoto.\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextMain = new wxStaticText( this, wxID_ANY, _("Copyright (c) 2009-2010 Bitcoin Developers\n\nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file \nlicense.txt or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by \nEric Young (eay@cryptsoft.com)."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextMain->Wrap( -1 );
|
||||
bSizer631->Add( m_staticTextMain, 0, wxALL, 5 );
|
||||
|
||||
|
||||
15
uibase.h
15
uibase.h
@@ -47,9 +47,9 @@
|
||||
#define wxID_TEXTCTRLADDRESS 1004
|
||||
#define wxID_BUTTONNEW 1005
|
||||
#define wxID_BUTTONCOPY 1006
|
||||
#define wxID_TRANSACTIONFEE 1007
|
||||
#define wxID_PROXYIP 1008
|
||||
#define wxID_PROXYPORT 1009
|
||||
#define wxID_PROXYIP 1007
|
||||
#define wxID_PROXYPORT 1008
|
||||
#define wxID_TRANSACTIONFEE 1009
|
||||
#define wxID_TEXTCTRLPAYTO 1010
|
||||
#define wxID_BUTTONPASTE 1011
|
||||
#define wxID_BUTTONADDRESSBOOK 1012
|
||||
@@ -163,9 +163,6 @@ class COptionsDialogBase : public wxDialog
|
||||
wxScrolledWindow* m_scrolledWindow;
|
||||
wxPanel* m_panelMain;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* m_textCtrlTransactionFee;
|
||||
wxCheckBox* m_checkBoxLimitProcessors;
|
||||
wxSpinCtrl* m_spinCtrlLimitProcessors;
|
||||
wxStaticText* m_staticText35;
|
||||
@@ -178,6 +175,10 @@ class COptionsDialogBase : public wxDialog
|
||||
wxTextCtrl* m_textCtrlProxyIP;
|
||||
wxStaticText* m_staticTextProxyPort;
|
||||
wxTextCtrl* m_textCtrlProxyPort;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* m_textCtrlTransactionFee;
|
||||
wxPanel* m_panelTest2;
|
||||
|
||||
wxStaticText* m_staticText321;
|
||||
@@ -188,11 +189,11 @@ class COptionsDialogBase : public wxDialog
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnListBox( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnKillFocusTransactionFee( wxFocusEvent& 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(); }
|
||||
virtual void OnKillFocusTransactionFee( wxFocusEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnButtonApply( wxCommandEvent& event ){ event.Skip(); }
|
||||
|
||||
354
uiproject.fbp
354
uiproject.fbp
@@ -282,7 +282,7 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="wxStatusBar" expanded="1">
|
||||
<property name="bg">240,240,240</property>
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
@@ -1540,7 +1540,7 @@
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer55</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
@@ -1610,7 +1610,7 @@
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxScrolledWindow" expanded="0">
|
||||
<object class="wxScrolledWindow" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="enabled">1</property>
|
||||
@@ -1720,174 +1720,6 @@
|
||||
<property name="width">0</property>
|
||||
</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">1</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Optional transaction fee you give to the nodes that process your transactions.</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticText32</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="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 class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer56</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|wxTOP|wxBOTTOM|wxLEFT</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">1</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Transaction fee:</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticText31</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="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 class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" 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">1</property>
|
||||
<property name="id">wxID_TRANSACTIONFEE</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_textCtrlTransactionFee</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">70,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></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">OnKillFocusTransactionFee</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="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
@@ -2509,6 +2341,184 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">1</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</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">Optional transaction fee per KB that helps make sure your transactions are processed quickly. Most transactions are 1KB. Fee 0.01 recommended.</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticText32</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="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">365</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 class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer56</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|wxTOP|wxBOTTOM|wxLEFT</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">Pay transaction fee:</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticText31</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="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 class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" 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_TRANSACTIONFEE</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_textCtrlTransactionFee</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">70,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></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">OnKillFocusTransactionFee</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="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
@@ -3130,7 +3140,7 @@
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Copyright (c) 2009-2010 Satoshi Nakamoto.

This is experimental software.

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/) and cryptographic software written by 
Eric Young (eay@cryptsoft.com).</property>
|
||||
<property name="label">Copyright (c) 2009-2010 Bitcoin Developers

This is experimental software.

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/) and cryptographic software written by 
Eric Young (eay@cryptsoft.com).</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticTextMain</property>
|
||||
|
||||
80
util.cpp
80
util.cpp
@@ -16,7 +16,8 @@ bool fShutdown = false;
|
||||
bool fDaemon = false;
|
||||
bool fCommandLine = false;
|
||||
string strMiscWarning;
|
||||
|
||||
bool fTestNet = false;
|
||||
bool fNoListen = false;
|
||||
|
||||
|
||||
|
||||
@@ -156,10 +157,16 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
|
||||
else
|
||||
{
|
||||
// print to debug.log
|
||||
char pszFile[MAX_PATH+100];
|
||||
GetDataDir(pszFile);
|
||||
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
||||
FILE* fileout = fopen(pszFile, "a");
|
||||
static FILE* fileout = NULL;
|
||||
|
||||
if (!fileout)
|
||||
{
|
||||
char pszFile[MAX_PATH+100];
|
||||
GetDataDir(pszFile);
|
||||
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
||||
fileout = fopen(pszFile, "a");
|
||||
if (fileout) setbuf(fileout, NULL); // unbuffered
|
||||
}
|
||||
if (fileout)
|
||||
{
|
||||
//// Debug print useful for profiling
|
||||
@@ -168,15 +175,15 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
|
||||
va_start(arg_ptr, pszFormat);
|
||||
ret = vfprintf(fileout, pszFormat, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
fclose(fileout);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if (fPrintToDebugger)
|
||||
{
|
||||
// accumulate a line at a time
|
||||
static CCriticalSection cs_OutputDebugStringF;
|
||||
|
||||
// accumulate a line at a time
|
||||
CRITICAL_BLOCK(cs_OutputDebugStringF)
|
||||
{
|
||||
static char pszBuffer[50000];
|
||||
@@ -398,11 +405,11 @@ vector<unsigned char> ParseHex(const char* psz)
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
char c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == -1)
|
||||
if (c == (char)-1)
|
||||
break;
|
||||
unsigned char n = (c << 4);
|
||||
c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == -1)
|
||||
if (c == (char)-1)
|
||||
break;
|
||||
n |= c;
|
||||
vch.push_back(n);
|
||||
@@ -572,7 +579,7 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread)
|
||||
strMiscWarning = pszMessage;
|
||||
#ifdef GUI
|
||||
if (wxTheApp && !fDaemon)
|
||||
boost::thread(bind(ThreadOneMessageBox, string(pszMessage)));
|
||||
boost::thread(boost::bind(ThreadOneMessageBox, string(pszMessage)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -649,15 +656,11 @@ string GetDefaultDataDir()
|
||||
void GetDataDir(char* pszDir)
|
||||
{
|
||||
// pszDir must be at least MAX_PATH length.
|
||||
int nVariation;
|
||||
if (pszSetDataDir[0] != 0)
|
||||
{
|
||||
strlcpy(pszDir, pszSetDataDir, MAX_PATH);
|
||||
static bool fMkdirDone;
|
||||
if (!fMkdirDone)
|
||||
{
|
||||
fMkdirDone = true;
|
||||
filesystem::create_directory(pszDir);
|
||||
}
|
||||
nVariation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -665,11 +668,23 @@ void GetDataDir(char* pszDir)
|
||||
// value so we don't have to do memory allocations after that.
|
||||
static char pszCachedDir[MAX_PATH];
|
||||
if (pszCachedDir[0] == 0)
|
||||
{
|
||||
strlcpy(pszCachedDir, GetDefaultDataDir().c_str(), sizeof(pszCachedDir));
|
||||
filesystem::create_directory(pszCachedDir);
|
||||
}
|
||||
strlcpy(pszDir, pszCachedDir, MAX_PATH);
|
||||
nVariation = 1;
|
||||
}
|
||||
if (fTestNet)
|
||||
{
|
||||
char* p = pszDir + strlen(pszDir);
|
||||
if (p > pszDir && p[-1] != '/' && p[-1] != '\\')
|
||||
*p++ = '/';
|
||||
strcpy(p, "testnet");
|
||||
nVariation += 2;
|
||||
}
|
||||
static bool pfMkdir[4];
|
||||
if (!pfMkdir[nVariation])
|
||||
{
|
||||
pfMkdir[nVariation] = true;
|
||||
filesystem::create_directory(pszDir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,19 +810,24 @@ void AddTimeData(unsigned int ip, int64 nTime)
|
||||
else
|
||||
{
|
||||
nTimeOffset = 0;
|
||||
// If nobody else has the same time as us, give a warning
|
||||
bool fMatch = false;
|
||||
foreach(int64 nOffset, vTimeOffsets)
|
||||
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
|
||||
fMatch = true;
|
||||
|
||||
static bool fDone;
|
||||
if (!fMatch && !fDone)
|
||||
if (!fDone)
|
||||
{
|
||||
fDone = true;
|
||||
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
||||
strMiscWarning = strMessage;
|
||||
printf("*** %s\n", strMessage.c_str());
|
||||
boost::thread(bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
|
||||
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
|
||||
bool fMatch = false;
|
||||
foreach(int64 nOffset, vTimeOffsets)
|
||||
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
|
||||
fMatch = true;
|
||||
|
||||
if (!fMatch)
|
||||
{
|
||||
fDone = true;
|
||||
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
||||
strMiscWarning = strMessage;
|
||||
printf("*** %s\n", strMessage.c_str());
|
||||
boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach(int64 n, vTimeOffsets)
|
||||
|
||||
37
util.h
37
util.h
@@ -145,6 +145,8 @@ extern bool fShutdown;
|
||||
extern bool fDaemon;
|
||||
extern bool fCommandLine;
|
||||
extern string strMiscWarning;
|
||||
extern bool fTestNet;
|
||||
extern bool fNoListen;
|
||||
|
||||
void RandAddSeed();
|
||||
void RandAddSeedPerfmon();
|
||||
@@ -416,6 +418,17 @@ inline int64 GetArg(const string& strArg, int64 nDefault)
|
||||
return nDefault;
|
||||
}
|
||||
|
||||
inline bool GetBoolArg(const string& strArg)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
{
|
||||
if (mapArgs[strArg].empty())
|
||||
return true;
|
||||
return (atoi(mapArgs[strArg]) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline string FormatVersion(int nVersion)
|
||||
{
|
||||
if (nVersion%100 == 0)
|
||||
@@ -621,3 +634,27 @@ inline void ExitThread(unsigned int nExitCode)
|
||||
pthread_exit((void*)nExitCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline bool AffinityBugWorkaround(void(*pfn)(void*))
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
// Sometimes after a few hours affinity gets stuck on one processor
|
||||
DWORD dwProcessAffinityMask = -1;
|
||||
DWORD dwSystemAffinityMask = -1;
|
||||
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask);
|
||||
DWORD dwPrev1 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask);
|
||||
DWORD dwPrev2 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask);
|
||||
if (dwPrev2 != dwProcessAffinityMask)
|
||||
{
|
||||
printf("AffinityBugWorkaround() : SetThreadAffinityMask=%d, ProcessAffinityMask=%d, restarting thread\n", dwPrev2, dwProcessAffinityMask);
|
||||
if (!CreateThread(pfn, NULL))
|
||||
printf("Error: CreateThread() failed\n");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user