Commit graph

301 commits

Author SHA1 Message Date
Jeff Garzik 38ac953b9d Merge pull request #1880 from sipa/threadimport
Move external block import to separate thread
2012-10-20 13:36:36 -07:00
Jeff Garzik dee0ee2ac9 Merge pull request #1742 from sipa/canonical
Check for canonical public keys and signatures
2012-10-20 10:56:04 -07:00
Pieter Wuille 66b02c93e6 Move external block import to separate thread 2012-10-20 01:54:10 +02:00
Jeff Garzik de2b9459bd Merge pull request #1834 from jgarzik/kickblocks
P2P: Do not request blocks from peers with fewer blocks than us
2012-10-08 15:15:58 -07:00
Jeff Garzik b855abb8db Revert "Send 'mempool' P2P command at the start of each P2P session"
Fat-fingered on github, and merged this too early.

This reverts commit 22f9b06903.
2012-10-08 18:14:15 -04:00
Jeff Garzik 56caa38a67 Merge pull request #1833 from jgarzik/mempool-query
Send 'mempool' P2P command at the start of each P2P session
2012-10-08 15:12:25 -07:00
Philip Kaufmann d210f4f5b8 fix -Wformat warnings all over the source 2012-10-01 19:45:42 +02:00
Jeff Garzik 22f9b06903 Send 'mempool' P2P command at the start of each P2P session
to query remote node mempool contents.
2012-09-24 13:53:44 -04:00
Jeff Garzik 93dd68e924 P2P: Do not request blocks from peers with fewer blocks than us
If the remote node has a shorter chain, do not waste our
special getblocks request on them.
2012-09-24 13:26:09 -04:00
Pieter Wuille 58bc86e37f Check for canonical public keys and signatures
Only enabled inside tests for now.
2012-09-21 01:24:25 +02:00
Jeff Garzik b1d3e95a0a When rejected TX relay due to lack of fees, log full txid 2012-09-18 15:24:31 -04:00
Jeff Garzik f8c449b5c8 Merge pull request #1812 from jgarzik/misc-07
Two minor generic cleanups done during OP_DROP hacking
2012-09-18 09:14:53 -07:00
Gregory Maxwell ab91bf39b7 Apply BIP30 checks to all blocks except the two historic violations.
Matt pointed out some time ago that there existed a minor DOS
attack where a node in its initial block download could be wedged
by an overwrite attack in a fork created between checkpoints before
a time where BIP30 was enforced. Now that the BIP30 timestamp
is irreversibly past the check can be more aggressive and apply to
all blocks except the two historic violations.
2012-09-09 20:11:04 -04:00
Jeff Garzik 17f8d6e400 Improve debug logging, for mempool TXs that do not include sufficient fees 2012-09-09 17:05:26 -04:00
Jeff Garzik 76970091f1 Cosmetic: move CTransaction::GetMinFee out of header file 2012-09-09 17:01:18 -04:00
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