Commit graph

286 commits

Author SHA1 Message Date
Gavin Andresen 91c218a1cb Merge branch 'testnet_alert' of git://github.com/gavinandresen/bitcoin-git 2012-09-05 11:38:38 -04:00
Philip Kaufmann 8d367c7e66 fix signed/unsigned usage in BlockFilePath() 2012-09-05 08:34:41 +02:00
Jeff Garzik 42613c97d5 Add block file naming helper, BlockFilePath() 2012-09-04 21:40:26 -04:00
Jeff Garzik bec02998b4 Merge pull request #1779 from xanatos/patch-15
Useless vector declaration
2012-09-04 08:59:05 -07:00
xanatos 89fbd1f11c Useless vector declaration
The vector isn't referenced in the small code block it's declared. I don't see any "useful" side effect in its declaration.
2012-09-03 17:53:27 +03:00
Wladimir J. van der Laan 4d1d94c56c Rename CreateThread to NewThread
Prevent clash with win32 API symbol
2012-08-29 20:25:37 +02:00
Gavin Andresen f35c6c4fb9 Refactor: move alert code from main to alert.cpp/h 2012-08-28 17:04:54 -04:00
Gavin Andresen ea2fda46c3 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 10:22:57 -04:00
Gavin Andresen d5a52d9b3e Alert system DoS prevention
This fixes two alert system vulnerabilities found by
Sergio Lerner; you could send peers unlimited numbers
of invalid alert message to try to either fill up their
debug.log with messages and/or keep their CPU busy
checking signatures.

Fixed by disconnecting/banning peers if they send 10 or more
bad (invalid/expired/cancelled) alerts.
2012-08-26 17:08:18 -04:00
Pieter Wuille 65ce215641 Make 0-value outputs non-standard 2012-08-24 12:15:12 +02:00
Gregory Maxwell bdab0cf58c Avoid leaving return types or function attributes on their own lines. 2012-08-24 02:48:19 -04:00
Pieter Wuille 5c88e3c108 Do not accept orphan blocks in -loadblock mode 2012-08-21 19:18:53 +02:00
Gavin Andresen d18f2fd9d6 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-20 10:46:07 -04:00
Gavin Andresen de237cbfa4 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-20 10:46:07 -04:00
Jeff Garzik b3a570d158 Merge pull request #1641 from jgarzik/mempool
Add 'mempool' P2P command, and extend 'getdata' behavior
2012-08-20 07:21:34 -07:00
Jeff Garzik dabb95b892 Merge pull request #1678 from Diapolo/LoadExternalBlockFile_add_timer
log how long LoadExternalBlockFile() takes in ms (Benchmark)
2012-08-17 08:45:11 -07:00
Philip Kaufmann 1e7027b41e fix a compiler sign warning in OpenBlockFile() 2012-08-17 10:35:51 +02:00
Philip Kaufmann 746f502a79 log how long LoadExternalBlockFile() takes in ms (Benchmark) 2012-08-17 00:14:40 +02:00
Gregory Maxwell 8ce7915aad Merge pull request #1612 from luke-jr/opti_getblkhash
Optimize JSON-RPC getblockhash
2012-08-01 11:49:26 -07:00
Luke Dashjr 1be064190e Optimize JSON-RPC getblockhash
- If the height is in the first half, start at the genesis block and go up, rather than at the top
- Cache the last lookup and use it as a reference point if it's close to the next request, to make linear lookups always fast
2012-08-01 18:23:30 +00:00
Jeff Garzik f81e6f779b Merge pull request #1632 from luke-jr/spelling
Fix spelling and grammar errors
2012-08-01 10:56:47 -07:00
Luke Dashjr b49f1398a1 Bugfix: Correct English grammar regarding "'s" 2012-08-01 17:50:00 +00:00
Luke Dashjr 814efd6f1f Bugfix: Fix a variety of misspellings 2012-08-01 17:49:51 +00:00
Philip Kaufmann e6bc9c35f3 Update Warning-strings to use a standard-format
- ensure warnings always start with "Warning:" and that the first
  character after ":" is written uppercase
- ensure the first sentence in warnings ends with an "!"
- remove unneeded spaces from Warning-strings
- add missing Warning-string translation
- remove a "\n" and replace with untranslatable "<br><br>"
2012-08-01 19:33:32 +02:00
Jeff Garzik 05a85b2b38 Add 'mempool' P2P command, and extend 'getdata' behavior
to permit downloading of mempool transactions from the remote peer.
2012-07-31 17:42:35 -04:00
Gregory Maxwell a9d811a976 Switch testnet3's message bytes to avoid connecting to old nodes.
The new bytes are based on "11" to appeal to Gavin's 11 fetish.

This breaks existing testnet3 nodes as the blockchain files
are also versioned.  To upgrade a node delete everything
except wallet.dat from your .bitcoin/testnet3 folder.
2012-07-26 17:50:23 -04:00
Gavin Andresen e0e54740b1 Handle should-never-happen case of orphan in mempool 2012-07-26 15:29:59 -04:00
Gavin Andresen c555400ca1 When creating new blocks, sort 'paid' area by fee-per-kb
Modify CreateNewBlock so that instead of processing all transactions
in priority order, process the first 27K of transactions in
priority order and then process the rest in fee-per-kilobyte
order.

This is the first, minimal step towards better a better fee-handling
system for both miners and end-users; this patch should be easy
to backport to the old versions of Bitcoin, and accomplishes the
most important goal-- allow users to "buy their way in" to blocks
using transaction fees.
2012-07-26 14:24:19 -04:00
Gavin Andresen 29c8fb0d93 Merge branch 'checknewblock' of git://github.com/luke-jr/bitcoin 2012-07-26 13:55:27 -04:00
Rune K. Svendsen 5f2e4b0565 Let the comment in GetBlockValue() reflect the uncertainty about the time interval between subsidy reductions 2012-07-18 09:37:05 +02:00
Giel van Schijndel 9f46ab62b1 Fix thread names after review
* Fix wrong thread name for wallet *relocking* thread
  - Was named the unlocking thread
 * Use consistent naming

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-07-17 01:50:35 +02:00
Giel van Schijndel 96931d6f78 Give threads a recognisable name to aid in debugging
NOTE: These thread names are visible in gdb when using 'info threads'.
      Additionally both 'top' and 'ps' show these names *unless* told to
      display the command-line instead of task name.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-07-17 01:50:35 +02:00
Luke Dashjr 639b61d78e Tests for CreateNewBlock 2012-07-12 16:35:34 +00:00
Luke Dashjr fbf99a9cdc Merge branch 'checknewblock_0.6.0' into checknewblock
Conflicts:
	src/main.cpp
2012-07-11 04:24:58 +00:00
Gavin Andresen 2a919e396d Warn if blockchain majority doesn't match CBlock::CURRENT_VERSION
This adds a warning "this version is obsolete, upgrade required" if
more than 50 of the previous 100 blocks in the blockchain are
a new version.
2012-07-06 11:37:01 -04:00
Gavin Andresen dae3e10a5a Treat non-version-1 transactions as non-standard
Adds CBlock::CURRENT_VERSION and CTransaction::CURRENT_VERSION
constants, and makes non-CURRENT_VERSION transactions nonstandard.
This will help make future upgrades smoother.
2012-07-06 11:37:01 -04:00
Jeff Garzik 6e3a1a3742 Merge pull request #1304 from rebroad/ShowBlockTimestamp
Show block timestamp
2012-07-05 15:28:42 -07:00
Jeff Garzik f77654a0e9 CTxMemPool: eliminate redundant lock, GetHash() call
::addUnchecked()'s only caller already takes the necessary lock,
and has already calculated the TX's hash.
2012-07-04 01:12:44 -04:00
Matt Corallo 96929a5515 Remove duplicate GetHash() in ConnectBlock 2012-07-04 00:04:57 -04:00
Jeff Garzik e75acc006e Merge pull request #1511 from jgarzik/quieten2
Quieten 'getdata' P2P message output
2012-06-27 09:06:59 -07:00
Pieter Wuille abbb9a829c Merge pull request #1347 from rebroad/FixAlreadyAskedFor
mapAlreadyAskedFor gets additions when AlreadyHave()
2012-06-27 08:06:57 -07:00
Matt Corallo 9d6cd04b3b Stop processing messages on full send buffer and dont disconnect.
Also decrease default send/receive buffer sizes from 10 to 5 mb
as this patch makes it easy for a node to fill both instead of
only send.
2012-06-27 15:31:34 +02:00
Gregory Maxwell 817ee0d826 Merge pull request #1174 from sipa/torhs
Tor hidden service support
2012-06-23 19:21:13 -07:00
Gregory Maxwell 0ae2ac5431 Merge pull request #1503 from gmaxwell/testnet_tweaks
Remove some rule differences which aren't needed with testnet3.
2012-06-23 19:02:55 -07:00
Jeff Garzik 983e4bdef0 Quieten 'getdata' P2P message output
Output one message per getdata, not one message per 'inv' entry.
2012-06-23 21:38:33 -04:00
Pieter Wuille 863e995b79 Debug version messages 2012-06-23 01:11:38 +02:00
Jeff Garzik d62a1947be Merge pull request #1458 from jgarzik/tracenet
Introduce -tracenet option, thereby quieting some redundant debug messages
2012-06-22 10:13:31 -07:00
Jeff Garzik d07eaba195 Introduce -debugnet option, thereby quieting some redundant debug messages
Prior to this change, each TX typically generated 3+ debug messages,

	askfor tx 8644cc97480ba1537214   0
	sending getdata: tx 8644cc97480ba1537214
	askfor tx 8644cc97480ba1537214   1339640761000000
	askfor tx 8644cc97480ba1537214   1339640881000000
	CTxMemPool::accept() : accepted 8644cc9748 (poolsz 6857)

After this change, there is only one message for each valid TX received

	CTxMemPool::accept() : accepted 22a73c5d8c (poolsz 42)

and two messages for each orphan tx received

	ERROR: FetchInputs() : 673dc195aa mempool Tx prev not found 1e439346fc
	stored orphan tx 673dc195aa (mapsz 19)

The -debugnet option, or its superset -debug, will restore the full debug
output.
2012-06-22 13:11:57 -04:00
Gregory Maxwell e6332751c6 Remove some rule differences which aren't needed with testnet3.
Bip16 and Bip30 had early activation dates for testnet, but
with the reset they might as well use the same dates as
the main network.
2012-06-22 11:50:52 -04:00
Jeff Garzik 25d5c19522 RPC: add 'getrawmempool', listing all transaction ids in memory pool 2012-06-22 11:43:34 -04:00