Commit Graph

1097 Commits

Author SHA1 Message Date
Ricardo M. Correia
7ff54e08aa Don't overflow signed ints in CBigNum::setint64().
CBigNum::setint64() does 'n <<= 8', where n is of type "long long".

This leads to shifting onto and past the sign bit, which is undefined
behavior in C++11 and can cause problems in the future.
2012-06-18 19:01:46 +00:00
Gavin Andresen
fa57170187 Document how to build/run unit tests 2012-06-18 16:07:05 +00:00
Gavin Andresen
b0e508a0c0 Include limits, not climints (using std::numeric_limits now) 2012-06-14 20:12:53 +00:00
Gavin Andresen
5cd2a640a5 Use std::numeric_limits<> for typesafe INT_MAX/etc
(this fixes a Mac OS X gitian build error for 0.5.x)
2012-06-14 19:52:31 +00:00
Matt Corallo
ca39829ecb Update wiki changelog at doc/release-process.txt 2012-06-14 17:21:05 +00:00
Luke Dashjr
9849f50b68 Bump VERSION so we can differentiate between fixed 0.4.7rc2 and not-fixed 0.4.7rc1 2012-06-14 15:59:18 +00:00
Luke Dashjr
9a48f56fb0 Bugfix: Move IsStandard scriptSig size check out of IsPushOnly, since BIP16 verification uses the latter too
This caused clients to reject block #177618 since it has a P2SH transaction with over 200 bytes in scriptSig.

(Upstream commit: e679ec969c)
2012-06-12 23:50:38 +00:00
Philip Kaufmann
af413c0a0f fix an incorrect if-clause in net.cpp 2012-06-06 19:37:53 +00:00
Michael Hendricks
a0ea95d3ce Serialize access to debug.log stream
Acquire an exclusive, advisory lock before sending output to debug.log
and release it when we're done. This should avoid output from multiple
threads being interspersed in the log file.

We can't use CRITICAL_SECTION machinery for this because the debug log
is written during startup and shutdown when that machinery is not
available.

(Thanks to Gavin for pointing out the CRITICAL_SECTION problems based
on his earlier work in this area)
2012-06-06 19:29:28 +00:00
Jeff Garzik
82a227b263 .gitignore: add test_bitcoin 2012-05-26 02:25:16 +00:00
Jeff Garzik
a2de1ea2d5 Prevent crashes due to missing or corrupted blk????.dat records 2012-05-22 22:50:02 +00:00
Jeff Garzik
b6862f7b74 Prevent crashes due to missing or corrupted database records
Any problems seen during deserialization will throw an uncaught
exception, crashing the entire bitcoin process.  Properly return an
error instead, so that we may at least log the error and gracefully
shutdown other portions of the app.
2012-05-22 22:47:51 +00:00
R E Broadley
8a39b0d613 Correct debug.log output to show correct function the debug is coming from. 2012-05-22 22:42:13 +00:00
Fordy
58ac600b2c Update License in File Headers
I originally created a pull to replace the "COPYING" in crypter.cpp and
crypter.h, but it turned out that COPYING was actually the correct
file.
2012-05-20 20:15:41 +00:00
Philip Kaufmann
334668cde4 remove 2 ugly spaces from a message string
(PARTIAL of 966ae00)
2012-05-20 19:54:14 +00:00
Jeff Garzik
738592a002 Always check return values of TxnBegin() and TxnCommit()
PARTIAL, since d68dcf7 isn't backported (yet)
2012-05-18 00:03:32 +00:00
Pieter Wuille
c455aec699 Hopefully final fix for the stuck blockchain issue
Immediately issue a "getblocks", instead of a "getdata" (which will
trigger the relevant "inv" to be sent anyway), and only do so when
the previous set of invs led us into a known and attached part of
the block tree.
2012-05-17 23:45:49 +00:00
Luke Dashjr
18b4eccddb Bump version to 0.4.7 2012-05-08 19:53:29 +00:00
Pieter Wuille
2403bb79bc Prevent stuck download: correct solution
Pull request #948 introduced a fix for nodes stuck on a long side branch
of the main chain. The fix was non-functional however, as the additional
getdata request was created in a first step of processing, but dropped
in a second step as it was considered redundant. This commits fixes it
by sending the request directly.
2012-05-07 02:45:08 +00:00
Pieter Wuille
eb3f661add Prevent stuck block download in large reorganisations
In cases of very large reorganisations (hundreds of blocks), a situation
may appear where an 'inv' is sent as response to a 'getblocks', but the
last block mentioned in the inv is already known to the receiver node.
However, the supplying node uses a request for this last block as a
trigger to send the rest of the inv blocks. If it never comes, the block
chain download is stuck.

This commit makes the receiver node always request the last inv'ed block,
even if it is already known, to prevent this problem.
2012-05-07 02:44:45 +00:00
Luke Dashjr
607739befb Bugfix: %-12I64d is not valid and causes the parameter to be skipped, use %12"PRI64d" instead
Conflicts:

	src/walletdb.cpp
2012-05-06 05:27:08 +00:00
Gavin Andresen
ad5a4c7c47 Check earlier for blocks with duplicate transactions. Fixes #1167 2012-05-04 18:52:16 +00:00
Philip Kaufmann
cae1a68267 remove obsolete BackupWallet() entry in wallet.h 2012-05-04 17:41:13 +00:00
Philip Kaufmann
4898482915 fix compiler warning "suggest parentheses around assignment used as truth
value [-Wparentheses]" in util.cpp
2012-05-01 23:11:56 -04:00
Philip Kaufmann
e6578e7fa7 remove unused typedef in serialize.h 2012-05-01 23:09:22 -04:00
Gavin Andresen
5ad4028050 Windows build: compile against openssl 1.0.1b 2012-04-27 11:19:20 -04:00
Luke Dashjr
c18b82d5db Bump version to 0.4.6 2012-04-27 10:50:24 -04:00
Timothy Redaelli
282e3ffe6e We should include netinet/in.h to use sockaddr_in (POSIX.1-2001) 2012-04-27 10:41:52 -04:00
Jeff Garzik
c21121752d CBlock::WriteToDisk() properly checks ftell(3) for error return
Rather than storing ftell(3)'s return value -- a long -- in an
unsigned int, we store and check a properly typed temp.  Then, assured a
non-negative value, we store in nBlockPosRet.
2012-04-24 01:00:15 -04:00
Timothy Redaelli
d0fe14ffec Add missing includes. (Fix bulding under GCC 4.7)
(Note: GCC 4.7 build NOT tested with backports -Luke)
2012-04-22 09:41:51 -04:00
Dwayne C. Litzenberger
e5b980d72f Fix bugs on 'unsigned char' platforms.
In ISO C++, the signedness of 'char' is undefined.  On some platforms (e.g.
ARM), 'char' is an unsigned type, but some of the code relies on 'char' being
signed (as it is on x86).  This is indicated by compiler warnings like this:

 bignum.h: In constructor 'CBigNum::CBigNum(char)':
 bignum.h:81:59: warning: comparison is always true due to limited range of data type [-Wtype-limits]

 util.cpp: In function 'bool IsHex(const string&)':
 util.cpp:427:28: warning: comparison is always false due to limited range of data type [-Wtype-limits]

In particular, IsHex erroneously returned true regardless of the input
characters, as long as the length of the string was a positive multiple of 2.

Note: For testing, it's possible using GCC to force char to be unsigned by
adding the -funsigned-char parameter to xCXXFLAGS.
2012-04-22 09:38:27 -04:00
Dwayne C. Litzenberger
bd043f19c8 Fix phexdigits[255] is undefined. 2012-04-22 09:26:11 -04:00
Pieter Wuille
dc588faf59 Fix potential deadlock
Conflict:
* cs_main in ProcessMessages() (before calling ProcessMessages)
* cs_vSend in CNode::BeginMessage
versus:
* cs_vSend in ThreadMessageHandler2 (before calling SendMessages)
* cs_main in SendMessages

Even though cs_vSend is a try_lock, if it succeeds simultaneously with
the locking of cs_main in ProcessMessages(), it could cause a deadlock.
2012-04-17 15:11:48 -04:00
Jeff Garzik
7f34351910 Fix misc. minor sign-comparison warnings 2012-04-17 15:08:18 -04:00
Jeff Garzik
1b7e5cbcad CNode's nHeaderStart may be negative, so change its type (PARTIAL) 2012-04-17 15:03:05 -04:00
Jeff Garzik
774e9b6dbb Fix loop index var types, fixing many minor sign comparison warnings
foo.size() typically returns an unsigned integral type; make loop variables
match those types' signedness.
2012-04-17 14:57:42 -04:00
Jeff Garzik
ef2f3ddaf7 The string class returns string::npos, when find() fails.
Noticed when sign-comparison warnings were enabled.
2012-04-17 14:50:26 -04:00
Jeff Garzik
1175d8f6a1 AlreadyHave(): only hold lock during mapTransactions access 2012-04-17 14:40:58 -04:00
Jeff Garzik
12570da46f Locking fix for AlreadyHave()
Access to mapTransactions[] must be guarded by cs_mapTransactions lock.
2012-04-17 13:20:29 -04:00
Wladimir J. van der Laan
8460185dec fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] 2012-04-15 19:43:41 -04:00
Wladimir J. van der Laan
678a319888 fix warnings: delete called on 'XX' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor] 2012-04-15 19:42:19 -04:00
Wladimir J. van der Laan
f650d62fc6 fix warnings: array subscript is of type 'char' [-Wchar-subscripts] 2012-04-15 19:28:00 -04:00
Wladimir J. van der Laan
401db6d96b work around issue in boost::program_options that prevents from compiling in clang 2012-04-15 19:23:01 -04:00
Gavin Andresen
e88b6b341d Bug fix listtransactions from/count handling. 2012-04-14 15:29:43 -04:00
Pieter Wuille
c7057326ea Verify status of encrypt/decrypt calls to detect failed padding 2012-04-05 18:03:48 -04:00
Matt Corallo
bf754cfd01 Add laanwj to gitian download scripts. 2012-04-04 15:58:02 -04:00
Luke Dashjr
8fae3dae11 Add Luke-Jr's PGP key to gitian-downloader 2012-04-04 10:23:02 -04:00
Pieter Wuille
2f98e8c1a4 Updated my GPG key 2012-04-04 10:17:18 -04:00
Luke Dashjr
d53fbb4a53 Fix script tests for P2SH
Upstream: 922e8e2929
2012-04-04 10:00:32 -04:00
Vegard Nossum
d15180297f Fix testing setup
There were some problems with the existing testing setup:

 - Makefile rules for test-file compilation used CFLAGS instead of
   CXXFLAGS in makefile.unix
2012-04-04 10:00:20 -04:00