Commit Graph

1128 Commits

Author SHA1 Message Date
Jeff Garzik
4ad495c243 select(): Use precise fd presence check, rather than imprecise hSocketMax test 2012-09-10 23:42:06 +00:00
Luke Dashjr
1ce15535f0 Bugfix: Don't consider invalid listening socket in hSocketMax
Fixed upstream in 8f10a28890.
2012-09-10 23:40:27 +00:00
xanatos
c1124277c5 Correct LoadWallet() return value (false -> DB_LOAD_OK)
Equivalent code. (false == 0 == DB_LOAD_OK). Fixes #1706.
2012-09-06 20:39:12 +00:00
Luke Dashjr
b9b15578bb Bump version to 0.4.8 2012-08-27 19:07:05 +00:00
Gavin Andresen
e0adf13897 Special-case the last alert for alert-key-compromised case
Hard-code a special nId=max int alert, to be broadcast if the
alert key is ever compromised. It applies to all versions, never
expires, cancels all previous alerts, and has a fixed message:
   URGENT: Alert key compromised, upgrade required

Variations are not allowed (ignored), so an attacker with
the private key cannot broadcast empty-message nId=max alerts.
2012-08-27 19:01:17 +00:00
Luke Dashjr
01cc7bf0c5 Support sending to script (P2SH) addresses
Upstream partials from 9e470585b3, e679ec969c, and 922e8e2929.
2012-08-26 22:43:42 +00:00
Gavin Andresen
bfd2ddfc47 Checkpoint at block 185333 (and remove a couple of intermediate checkpoints) 2012-08-26 22:14:06 +00:00
Gavin Andresen
2d57b561c2 Reject block.nVersion<=1 blocks if network has upgraded to version=2
If 950 of the last 1,000 blocks are nVersion=2, reject nVersion=1
(or zero, but no bitcoin release has created block.nVersion=0) blocks
-- 75 of last 100 on testnet3.

This rule is being put in place now so that we don't have to go
through another "express support" process to get what we really
want, which is for every single new block to include the block height
in the coinbase.
2012-08-26 21:07:08 +00:00
Gavin Andresen
9adab76e0a Block height in coinbase as a new block rule
"Version 2" blocks are blocks that have nVersion=2 and
have the block height as the first item in their coinbase.
Block-height-in-the-coinbase is strictly enforced when
version=2 blocks are a supermajority in the block chain
(750 of the last 1,000 blocks on main net, 51 of 100 for
testnet). This does not affect old clients/miners at all,
which will continue producing nVersion=1 blocks, and
which will continue to be valid.
2012-08-26 21:06:26 +00:00
Gavin Andresen
d710ed5b63 Add CBlock::CURRENT_VERSION and CTransaction::CURRENT_VERSION constants.
Partial of upstream dae3e10a5a
2012-08-26 21:02:57 +00:00
Philip Kaufmann
f51b175e3c fix a compiler sign warning in OpenBlockFile() 2012-08-22 17:17:42 +00:00
Luke Dashjr
448f6b3d9b Bugfix: Correct English grammar regarding "'s" 2012-08-12 17:30:36 +00:00
Luke Dashjr
8911ac0b27 Bugfix: Use standard BTC unit in comments 2012-08-12 17:27:46 +00:00
Luke Dashjr
9e98fe6f58 Bugfix: Fix a variety of misspellings
(PARTIAL: Left out anything changing debug.log)
2012-08-12 17:00:02 +00:00
Luke Dashjr
ae8ccfd24b Merge branch 'bugfix_CNBerr_daggy' into 0.4.x 2012-08-12 16:39:03 +00:00
fanquake
fb4dbbd188 Docs Tidy up
(PARTIAL cherry pick)
2012-07-22 23:38:26 +00:00
Philip Kaufmann
ec9a3c04ed fix OpenSSL not written as proper noun in some comments 2012-07-22 22:09:49 +00:00
Rune K. Svendsen
63f319353c Let the comment in GetBlockValue() reflect the uncertainty about the time interval between subsidy reductions 2012-07-22 21:45:32 +00:00
Luke Dashjr
7a161e4847 CBigNum: Convert negative int64 values in a more well-defined way
Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate
2012-07-22 21:10:19 +00:00
Ricardo M. Correia
3bd1d6645e Fix signed subtraction overflow in CBigNum::setint64().
As noticed by sipa (Pieter Wuille), this can happen when CBigNum::setint64() is
called with an integer value of INT64_MIN (-2^63).

When compiled with -ftrapv, the program would crash. Otherwise, it would
execute an undefined operation (although in practice, usually the correct one).
2012-07-22 21:10:15 +00:00
Gregory Maxwell
580f7cd731 Do not consider inbound peers for outbound network group exclusion.
Bitcoin will not make an outbound connection to a network group
(/16 for IPv4) that it is already connected to. This means that
if an attacker wants good odds of capturing all a nodes outbound
connections he must have hosts on a a large number of distinct
groups.

Previously both inbound and outbound connections were used to
feed this exclusion. The use of inbound connections, which can be
controlled by the attacker, actually has the potential of making
sibyl attacks _easier_: An attacker can start up hosts in groups
which house many honest nodes and make outbound connections to
the victim to exclude big swaths of honest nodes. Because the
attacker chooses to make the outbound connection he can always
beat out honest nodes for the consumption of inbound slots.

At _best_ the old behavior increases attacker costs by a single
group (e.g. one distinct group to use to fill up all your inbound
slots), but at worst it allows the attacker to select whole
networks you won't connect to.

This commit makes the nodes use only outbound links to exclude
network groups for outbound connections. Fancier things could
be done, like weaker exclusion for inbound groups... but
simplicity is good and I don't believe more complexity is
currently needed.
2012-07-06 00:28:30 +00:00
fanquake
26199789ed Fix a few typos 2012-07-05 23:54:32 +00:00
Luke Dashjr
3edb53eeed gitian-downloader: Update luke-jr's key 2012-07-05 22:50:53 +00:00
Pieter Wuille
6d6995bc83 Update my GPG key 2012-07-05 22:50:06 +00:00
Gavin Andresen
3023e782bd print large orphan warning BEFORE deleting pvMsg 2012-06-20 18:55:24 +00:00
Luke Dashjr
b199f7547f Bump VERSION so we can differentiate between 0.4.7rc2 and 0.4.7rc3 2012-06-20 17:59:36 +00:00
Gavin Andresen
01473c3f40 Remove invalid dependent orphans from memory
Remove orphan transactions from memory once
all of their parent transactions are received
and they're still not valid.
Thanks to Sergio Demian Lerner for suggesting this fix.
2012-06-20 17:53:18 +00:00
Gavin Andresen
ce1a071f6d Further DoS prevention: Verify signatures last
Loop over all inputs doing inexpensive validity checks first,
and then loop over them a second time doing expensive signature
checks. This helps prevent possible CPU exhaustion attacks
where an attacker tries to make a victim waste time checking
signatures for invalid transactions.
2012-06-20 17:39:24 +00:00
Gavin Andresen
c3def40293 Optimize orphan transaction handling
Changes suggested by Sergio Demian Lerner to
help prevent potential DoS attacks.
2012-06-20 17:16:19 +00:00
Ricardo M. Correia
b0d9f41cd2 Don't overflow integer on 32-bit machines.
This was causing test_bitcoin to abort on a 32-bit system likely due to -ftrapv.
2012-06-18 19:39:10 +00:00
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
b354251f1a Bugfix: getwork: NULL pindexPrev across CreateNewBlock, in case it fails 2012-05-09 17:02:07 +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