Commit graph

2492 commits

Author SHA1 Message Date
Matt Corallo 4c8fc1a588 Let a node opt out of tx invs before we get a their bloom filter
Note that the default value for fRelayTxes is false, meaning we
now no longer relay tx inv messages before receiving the remote
peer's version message.
2013-01-16 12:48:02 -05:00
Matt Corallo b02ddbedcb Relay CMerkleBlocks when asked for MSG_FILTERED_BLOCK 2013-01-16 12:48:02 -05:00
Matt Corallo 2878c67cb5 Add test cases for CMerkleBlock and CBloomFilter. 2013-01-16 12:48:02 -05:00
Matt Corallo 9fb106e757 Add a CMerkleBlock to store merkle branches of filtered txes. 2013-01-16 12:48:02 -05:00
Matt Corallo 587f0f855e Add a CBlock.GetBlockHeader 2013-01-16 12:48:02 -05:00
Matt Corallo d3b26f7077 Automatically add any matching outputs to a filter during matching. 2013-01-16 12:48:02 -05:00
Matt Corallo 269d9c6492 Replace RelayMessage with RelayTransaction. 2013-01-16 12:48:02 -05:00
Matt Corallo 422d122537 Add a filter field in CNode, add filterload+filteradd+filterclear 2013-01-16 12:48:02 -05:00
Matt Corallo 133a546074 Bump PROTOCOL_VERSION for filter messages. 2013-01-16 12:48:02 -05:00
Matt Corallo bd21612c37 Add a CBloomFilter class for use as a transaction filter. 2013-01-16 12:48:01 -05:00
Matt Corallo 7ab026f449 Add MurmurHash3 implementation to hash.h/add hash.cpp. 2013-01-16 12:48:01 -05:00
Matt Corallo 68feac96b6 Add const versions of base_uint.end()/begin(), make size() const. 2013-01-16 12:48:01 -05:00
Gavin Andresen 5f04881618 Fix clang warnings 2013-01-15 17:27:29 -05:00
Gavin Andresen ce99358f4a Remove IsFromMe() check in CTxMemPool::accept()
Fixes issue #2178 : attacker could penny-flood with invalid-signature
transactions to deduce which addresses belonged to your node.

I'm committing this early for code review; I still need to write up
a test plan.

Executive summary of fix: check all transactions received from the network
for penny-flood rate-limiting before adding to the memory pool. But do NOT
ratelimit transactions added to the memory pool:
  - because of blockchain reorgs
  - stored in the wallet and added at startup
  - sent from the GUI or one of the send* RPC commands (CWallet::CommitTransaction)

The limit-free-transactions code really should be a method on CNode, with
counters per-peer. But that is a bigger change for another day.
2013-01-15 09:10:22 -05:00
Philip Kaufmann 3a2e07493b update bitcoinstrings.cpp and bitcoin_en.ts (2013-01-14) 2013-01-14 22:52:52 +01:00
Gavin Andresen c83c3cbe97 Merge pull request #2172 from Diapolo/init_messages
make database init messages more valuable
2013-01-14 12:49:42 -08:00
Gavin Andresen e4f2b6b08f Merge pull request #2159 from petertodd/display-nlocktime-correctly
Display tx nLockTime correctly when set to block #
2013-01-14 12:06:07 -08:00
Gavin Andresen 9980d118ee Merge pull request #2129 from gmaxwell/wallet_less_frequent_fees
If the prio. will be enough after the next block don't force fees. [wallet]
2013-01-14 12:05:06 -08:00
Gavin Andresen 1b72229797 Merge pull request #2161 from sipa/noclient
Remove fClient
2013-01-14 11:41:19 -08:00
Gavin Andresen dd46c88f2f Merge pull request #2099 from gavinandresen/blkfile_upgrade
Upgrading to 0.8: re-use blkNNNN.dat files.
2013-01-14 11:37:12 -08:00
Gavin Andresen 40e31fd373 Merge pull request #2142 from gavinandresen/utilprint
OutputDebugStringF code cleanup
2013-01-14 11:36:48 -08:00
Philip Kaufmann 06494cabb4 make database init messages more valuable
- it was bad, that quite some messages were just talking about a database,
  I think a user should know, if we are talking about wallet db or
  block/coin db
- also adds a new init message for "Verifying block database integrity..."
2013-01-13 21:22:40 +01:00
Wladimir J. van der Laan 6213b25cd4 Merge pull request #2166 from Diapolo/Qt_signverify
Bitcoin-Qt: use reference in setAddress_SM() and setAddress_VM()
2013-01-13 10:53:42 -08:00
Philip Kaufmann bb41a87d57 add InitMessage() to noui and use debug.log for GUI
- this pull adds an InitMessage() function to noui.cpp, which outputs init
  messages to debug.log (this allows to remove some printf() calls from
  init.cpp)
- change InitMessage() in bitcoin.cpp to also write init messages to
  debug.log to ensure nothting is missing in the log because of the
  removal of printf() calls in init.cpp
2013-01-11 22:57:22 +01:00
Philip Kaufmann ec95a809af small main.h cleanup (no code changes)
- removes some obsolete comments about CTransaction::FetchInputs(), a
  space and a few new-lines
2013-01-11 17:36:53 +01:00
Gregory Maxwell 1f4b80a437 Merge pull request #2145 from sipa/checkcoins
Coin database checks
2013-01-11 06:27:30 -08:00
Peter Todd 8686f6467c Add timeoffset to getinfo RPC call
Provides a method to get the difference between network adjusted time
and local time from the RPC interface.
2013-01-11 06:11:34 -05:00
Pieter Wuille 45a1ec51b1 Merge pull request #2115 from forrestv/getblocktemplate_allfees
Provide fee data for all txs in RPC getblocktemplate response
2013-01-10 13:09:51 -08:00
Philip Kaufmann 17c1f7f04f Bitcoin-Qt: use reference in setAddress_SM() and setAddress_VM() 2013-01-10 14:04:32 +01:00
Pieter Wuille c2b72ba27f Remove fClient
Client (SPV) mode never got implemented entirely, and whatever part was already
working, is likely not been tested (or even executed at all) for the past two
years. This removes it entirely.

If we want an SPV implementation, I think we should first get the block chain
data structures to be encapsulated in a class implementing a standard interface,
and then writing an alternate implementation with SPV semantics.
2013-01-09 22:28:46 +01:00
Philip Kaufmann e6d2300562 Bitcoin-Qt: fix known addressbook bugs
- add qSort() for cachedAddressTable, as qLowerBound() and qUpperBound()
  require the list to be in ascending order (see
  http://harmattan-dev.nokia.com/docs/library/html/qt4/qtalgorithms.html#qLowerBound)
- add a new check in AddressTableModel::setData() to just return, when no
  changes were made to a label or an address (prevents entry duplication
  issue)
- remove "rec->label = value.toString();" from
  AddressTableModel::setData() as the label gets updated by
  AddressTablePriv::updateEntry() anyway (seems @sipa added this line via
  1025440184 (L6R225))
- add another new check in AddressTableModel::setData() to just return, if
  a duplicate address was found (prevents address overwrite)
- add a new check to EditAddressDialog::setModel() to prevent setting an
  invalid model
- re-work the switch-case statement in AddressTableModel::accept() to
  always break (as return get's called anyway) and order the list to match
  the enum definition
- make accept() in editaddressdialog.h a public slot, which it should be
- misc small coding style changes
2013-01-09 16:55:24 +01:00
Peter Todd 10046e27db Display tx nLockTime correctly when set to block #
Previously when a transaction was set to lock at a specific block the
calculation was reversed, returning a negative number. This broke the UI
and caused it to display %n in place of the actual number.

In addition the previous calculation would display "Open for 0 blocks"
when the block height was such that the next block created would
finalize the transaction. Inserted the word "more" and changed the
calculation so that the last message would be "Open for 1 more block" to
better match user expectations.
2013-01-09 04:18:26 -05:00
Pieter Wuille ef0f422519 Remove contention on signature cache during block validation
Since block validation happens in parallel, multiple threads may be
accessing the signature cache simultaneously. To prevent contention:
* Turn the signature cache lock into a shared mutex
* Make reading from the cache only acquire a shared lock
* Let block validations not store their results in the cache
2013-01-08 02:00:59 +01:00
Pieter Wuille f9cae832e6 Parallelize script verification
* During block verification (when parallelism is requested), script
  check actions are stored instead of being executed immediately.
* After every processed transactions, its signature actions are
  pushed to a CScriptCheckQueue, which maintains a queue and some
  synchronization mechanism.
* Two or more threads (if enabled) start processing elements from
  this queue,
* When the block connection code is finished processing transactions,
  it joins the worker pool until the queue is empty.

As cs_main is held the entire time, and all verification must be
finished before the block continues processing, this does not reach
the best possible performance. It is a less drastic change than
some more advanced mechanisms (like doing verification out-of-band
entirely, and rolling back blocks when a failure is detected).

The -par=N flag controls the number of threads (1-16). 0 means auto,
and is the default.
2013-01-08 02:00:59 +01:00
Pieter Wuille 1d70f4bde8 Remove CheckSig_mode and move logic out of CheckInputs() 2013-01-08 01:49:15 +01:00
Pieter Wuille 2800ce7367 Add CScriptCheck: a closure representing a script check 2013-01-08 01:49:15 +01:00
Pieter Wuille f1136200a6 Move VerifySignature to main 2013-01-08 01:49:14 +01:00
Wladimir J. van der Laan 429915bd0d Merge pull request #2153 from Diapolo/overviewpage
Bitcoin-Qt: fix small stylesheet glitch in overviewpage.ui
2013-01-06 07:26:43 -08:00
Wladimir J. van der Laan 12aacd582a Merge pull request #2151 from Diapolo/signmessage
Bitcoin-Qt: add a Signature label on sign message page
2013-01-06 05:23:01 -08:00
Wladimir J. van der Laan 51b05d0dca Merge pull request #2147 from Diapolo/mq_name_testnet
Bitcoin-Qt: give testnet a unique IPC message queue name
2013-01-06 05:22:34 -08:00
Philip Kaufmann 765e22b82c Bitcoin-Qt: fix small stylesheet glitch in overviewpage.ui 2013-01-06 12:41:49 +01:00
Philip Kaufmann aec056edb5 Bitcoin-Qt: add a Signature label on sign message page 2013-01-06 03:52:33 +01:00
Philip Kaufmann 37f070f564 update noui_ThreadSafeMessageBox function to use strCaption
- ensure we use strCaption for printf and fprintf, as before it could
  happen to have an error message in the debug.log, which had no "Error"
  (or whatever) in front
2013-01-06 03:47:10 +01:00
Philip Kaufmann 8ffbd6c378 Bitcoin-Qt: give testnet a unique IPC message queue name
- this prevents an interference with the IPC message queue (which is used
  for URI processing) when running a testnet and mainnet instance in
  parallel
- to check for testnet, I had to raise the ParseParameters() call in
  main() to the topmost position
2013-01-06 03:42:40 +01:00
Wladimir J. van der Laan 1f4fdb70f0 Merge pull request #2110 from Diapolo/addrbook
Bitcoin-Qt: comment out unused parameter in addressbookpage
2013-01-05 07:56:31 -08:00
Wladimir J. van der Laan eb5c24c464 Merge pull request #2148 from Diapolo/est_block_count
Bitcoin-Qt: never display own block count > estimated block count
2013-01-05 07:45:02 -08:00
Wladimir J. van der Laan 744adb2e61 Merge pull request #1685 from Diapolo/Qt_add_options_reset
Bitcoin-Qt: add a Reset button to the options dialog
2013-01-05 07:36:05 -08:00
Philip Kaufmann 2e43c92428 translations update (bitcoinstrings.cpp + bitcoin_en.ts) 2013-01-05 13:56:24 +01:00
Philip Kaufmann 5fb445b49e Bitcoin-Qt: add a Reset button to the options dialog
- a click on "Reset Options" sets all options to the default values by
  removing all stored settings (QSettings), loading the defaults and
  saving them as the new settings
- before the reset is executed the user is presented a confirmation dialog
- special casing was needed for StartAtStartup
2013-01-05 13:51:36 +01:00
Pieter Wuille 4e68391a7f Make output of gettxout RPC more consistent
* Report "value" in BTC, rather than "amount" in satoshis
* Use ScriptPubKeyToJSON to report script data
2013-01-04 22:51:11 +01:00
Philip Kaufmann 54413aab13 Bitcoin-Qt: never display own block count > estimated block count
- some users reported it as weird, that the estimated block count could be
  lower than our own nodes block number (which is indeed true and not good)
- this pull adds a new default behaviour, which displays our own block
  number as estimated block number, if own >= est. block count
- the pull raises space for nodes block counts in cPeerBlockCounts to 8 to
  be more accurate
- also removes a reduntant setNumBlocks() call in RPCConsole and moves
  initialisation of numBlocksAtStartup in ClientModel, where it belongs
2013-01-04 17:21:40 +01:00
Pieter Wuille 1f355b66cd New database check routine
-checklevel gets a new meaning:
0: verify blocks can be read from disk (like before)
1: verify (contextless) block validity (like before)
2: verify undo files can be read and have good checksums
3: verify coin database is consistent with the last few blocks
   (close to level 6 before)
4: verify all validity rules of the last few blocks

Level 3 is the new default, as it's reasonably fast. As level 3 and
4 are implemented using an in-memory rollback of the database, they
are limited to as many blocks as possible without exceeding the
limits set by -dbcache. The default of -dbcache=25 allows for some
150-200 blocks to be rolled back.

In case an error is found, the application quits with a message
instructing the user to restart with -reindex. Better instructions,
and automatic recovery (when possible) or automatic reindexing are
left as future work.
2013-01-04 14:58:47 +01:00
Forrest Voight f3d872d1ea moved "index_in_template" to a separate variable to clarify what it is 2013-01-03 23:58:40 -05:00
Pieter Wuille 8539361e66 Add checksums to undo data
This should be compatible with older code that didn't write checksums.
2013-01-03 15:29:19 +01:00
Pieter Wuille 2cbd71da06 Make DisconnectBlock fault-tolerant 2013-01-03 15:29:19 +01:00
Jeff Garzik ea9788517b test/util_tests.cpp: one more DateTimeStrFormat 'T' removal 2013-01-01 19:48:28 -05:00
Gavin Andresen ee3374234c OutputDebugStringF code cleanup
Initialize the OutputDebugStringF mutex and file pointer using
boost::call_once, to be thread-safe.
Make the return value of OutputDebugStringF really be the number of
characters written (*printf() semantics).
Declare the fReopenDebugLog flag volatile, since it is changed from
a signal handler.
And don't declare OutputDebugStringF() as inline.
2013-01-01 17:12:30 -05:00
Jeff Garzik 3f964b3c50 Remove 'T' from remaining date/time format strings. 2013-01-01 15:28:28 -05:00
Wladimir J. van der Laan 15ffcc3642 Merge pull request #2032 from burger2/fix_shortcut
Fix duplicate shortcut usage in sign/verify message dialog.
2013-01-01 11:21:58 -08:00
Gavin Andresen 567128a345 Merge pull request #2133 from Diapolo/init_strings
update 2 command-line parameter help messages
2012-12-31 15:06:08 -08:00
Jeff Garzik 393819cde4 Remove 'T' from debug log timestamps
Space separation between major fields is easier for human eyes and
libs to parse.
2012-12-30 20:46:54 -05:00
Philip Kaufmann b8397fbfcd update 2 command-line parameter help messages
- -checkpoints is now much more understandable and should be way easier
  to translate
- -loadblock uses the same format (blk000??.dat) as -reindex
2012-12-28 14:55:38 +01:00
Gregory Maxwell d7836552e6 If the prio. will be enough after the next block don't force fees.
If the user was really after the fastest possible confirmation times
they would be manually setting a fee. In cases where the wallet builds
a transaction with a priority that is too low to qualify as free until
the next block, go ahead without a fee.  Confirmation frequently takes
multiple blocks even when a minimum fee is provided.
2012-12-26 14:16:45 -05:00
Pieter Wuille bffc744444 Make IsCanonicalScript() check the hash type more thoroughly
0 and 128 were previously accepted as standard hash type.

Note that this function is not active in the current verification
code.
2012-12-22 18:39:36 +01:00
Gavin Andresen 23826f1b7f Merge pull request #2116 from sipa/importrescanbool
Convert fRescan argument to importprivkey to bool
2012-12-21 06:30:53 -08:00
Forrest Voight 0f927ceb5b use fee/sigop data in BlockTemplate struct instead of (not always correctly) calculating it ourselves 2012-12-19 16:12:58 -05:00
Forrest Voight 03cac0bb8e changed CreateNewBlock to return a CBlockTemplate object, which includes per-tx fee and sigop count data 2012-12-19 16:12:58 -05:00
Pieter Wuille 5dfbd4ff68 Convert fRescan argument to importprivkey to bool 2012-12-19 12:23:29 +01:00
Pieter Wuille 0fb9073edd Split off hash.h from util.h 2012-12-18 21:39:29 +01:00
fanquake f0bf5fb245 Fix two typos in main.h
Break one long comment down into 3 lines so it's readable.
2012-12-17 18:09:53 +08:00
Gavin Andresen f4445f9982 Upgrading to 0.8: re-use blkNNNN.dat files. 2012-12-16 12:23:59 -05:00
Philip Kaufmann a8fbbd8fb0 Bitcoin-Qt: comment out unused parameter in addressbookpage 2012-12-15 11:15:19 +01:00
Gregory Maxwell a3fad2119b In listaddressgroupings push down the IsMine check to run on each input.
This avoids a potential crash when trying to read the scrippubkeys on
transactions where the first input IsMine but some of the rest are not
when running listaddressgroupings.
2012-12-14 07:35:56 -05:00
Pieter Wuille da8c5c9f4e Merge pull request #2087 from gavinandresen/check210000
Checkpoint at first 25-btc-reward block (210,000)
2012-12-13 14:40:22 -08:00
Pieter Wuille 33766c9557 Merge pull request #2096 from 94m3k1n9/fix-time-formats
Change timestamps to use ISO8601 formatting
2012-12-13 14:39:57 -08:00
Wladimir J. van der Laan 07c3f846c2 Merge pull request #2045 from Diapolo/use_message
use new message() function in BitcoinGUI
2012-12-12 21:17:40 -08:00
Philip Kaufmann 50ce5735d6 LevelDB: build_detect_platform fix NATIVE_WINDOWS indentation
- fix some indentation issues
2012-12-12 19:39:00 +01:00
Gavin Andresen 51dc438942 Merge pull request #2080 from mcassano/importprivkey_rescan_false
add rescan bool to importprivkey to control whether to do a rescan after import
2012-12-12 09:34:24 -08:00
Gavin Andresen 278a09a6c6 Merge pull request #2095 from al42and/upnp
OptionsModel now has MapPortUPnP=false if UPNP is not supported
2012-12-12 09:31:24 -08:00
Gavin Andresen 8a7277a578 Merge pull request #2003 from alexanderkjeldaas/documented-locking-part-2
Documented locking part 1+2
2012-12-12 09:27:35 -08:00
Gavin Andresen d339da70e5 Merge pull request #1825 from roques/bignum2
Bignum2
2012-12-12 09:23:16 -08:00
Gavin Andresen 5bd5d6c45c Merge pull request #1940 from grimd34th/patch-1
Add NATIVE_WINDOWS
2012-12-12 09:20:46 -08:00
Gavin Andresen 095b06cfae Merge pull request #2073 from grimd34th/patch-3
Update src/makefile.mingw
2012-12-12 09:19:26 -08:00
Gavin Andresen a9e055a1ca Merge pull request #2048 from jgarzik/no-checkpoints
Add "checkpoints" option, to permit disabling of checkpoint logic.
2012-12-12 09:18:00 -08:00
Gavin Andresen 78504bb04f Merge pull request #1861 from jgarzik/coinlock
Add new RPC "lockunspent", to prevent spending of selected outputs
2012-12-12 09:15:43 -08:00
Gavin Andresen 043a8fb98d Merge pull request #2059 from sipa/benchmark
Add -benchmark for reporting block processing times
2012-12-12 09:14:52 -08:00
Gavin Andresen dbd5bb8039 Merge pull request #2062 from sipa/nocoins
Reconstruct coins/ database when missing
2012-12-12 09:11:36 -08:00
Gavin Andresen 8b83e2fc2e Merge pull request #2074 from sipa/minor
Two minor inconvenience fixes
2012-12-12 09:10:44 -08:00
Richard Schwab 303b0009dc Change timestamps to use ISO8601 formatting 2012-12-12 16:32:22 +01:00
Andrey Alekseenko 6a3aef39e7 OptionsModel now has MapPortUPnP=false if UPNP is not supported 2012-12-12 13:10:02 +04:00
Gavin Andresen 5d32d3f8cd Checkpoint at first 25-btc-reward block (210,000) 2012-12-10 09:53:22 -05:00
Pieter Wuille 622da5df6e Merge pull request #2068 from Diapolo/CheckDiskSpace
some CheckDiskSpace() related changes
2012-12-07 13:33:24 -08:00
Mike Cassano 44051af1a8 add rescan bool to importprivkey to control whether to do a rescan after import 2012-12-06 20:18:17 -06:00
Pieter Wuille 3fb9b99cca Allow lengthy block reconnections to be interrupted
When the coin database is out of date with the block database, the
best block in it is automatically switched to. This reconnection
process can take time, so allow it to be interrupted.

This also stops block connection as soon as shutdown is requested,
leading to a faster shutdown.
2012-12-06 22:04:59 +01:00
Pieter Wuille c8b2e4426b Update the block file counter in database when using -reindex
This problem is like earth (mostly harmless). After/during a
-reindex, it means the statistics about the last block file
reported in debug.log are always of blk00000.dat instead of the
last file. Apart from that, it means a few more database entries
need to be read when finding a file to append to the first time.
2012-12-06 22:04:58 +01:00
Pieter Wuille 89b7019be8 Reconstruct coins/ from scratch when missing. 2012-12-06 17:00:12 +01:00
Pieter Wuille d79775a04d Merge pull request #2057 from Diapolo/FlushBlockFile
FlushBlockFile(): check for valid FILE pointer
2012-12-06 01:35:36 -08:00
Wladimir J. van der Laan 25fd38090a Merge pull request #2066 from Diapolo/small_uiint_changes
UI interface changes
2012-12-05 23:30:06 -08:00
Pieter Wuille cd1391ae4d Merge pull request #2056 from sipa/fix_2052
Fixes for obscure mempool-checkpoint interaction
2012-12-05 14:15:17 -08:00
Pieter Wuille 8a28bb6dee Add -benchmark for reporting block processing times 2012-12-05 23:06:01 +01:00
Pieter Wuille 0ae0712b1c Add GetTimeMicros() for ore accurate benchmarking 2012-12-05 23:06:01 +01:00
Pieter Wuille a485c1b69e Merge pull request #2063 from Diapolo/CDiskBlockPos
add 2 constructors in CDiskBlockPos to simplify class usage
2012-12-05 14:01:03 -08:00
Philip Kaufmann fa45c26a0e call CheckDiskSpace() before pre-allocating space
- even if we are allowed to fail pre-allocating, it's better to check
  for sufficient space before calling AllocateFileRange() and if we
  are out of disk space return with error()
- the above change allows us to remove the CheckDiskSpace() check
  in CBlock::AcceptBlock()
2012-12-05 14:39:09 +01:00
grimd34th 679131b235 Update src/makefile.mingw
With MinGW we use .a not .lib
2012-12-04 16:00:47 -05:00
Philip Kaufmann 15d8ff2029 rework ThreadSafeAskFee() / askFee() functions
- remove unused parameter from ThreadSafeAskFee(), which also results in
  the removal of an orphan translation-string
2012-12-04 21:35:41 +01:00
Philip Kaufmann 7f5a1b529b remove unneeded flag from MSG_INFORMATION and fix an indentation 2012-12-04 21:35:40 +01:00
Pieter Wuille 469e606141 Merge pull request #2058 from sipa/atomicreorg
Make SetBestChain() atomic
2012-12-03 15:11:31 -08:00
Philip Kaufmann 50ecd7b689 use new message() function in BitcoinGUI
- use it for displaying URI parsing warnings
- use it for displaying error and information in backup wallet function
  (the information display is new and the error was a warning before)

- cleanup BitcoinGUI::incomingTransaction()
-- use message() + the information icon from message
-- comment out an unused parameter in the function definition and
   declaration
-- move all pre-checks at the beginning of the function
2012-12-03 14:02:02 +01:00
Philip Kaufmann 3675588a30 Bitcoin-Qt: remove obsolete modal flag from GUI APIs
- as we (can) supply the CClientUIInterface::MODAL flag via the style
  parameter, we don't need a separate bool for checking the modality
2012-12-03 13:24:42 +01:00
Wladimir J. van der Laan 7a8dd98863 Merge pull request #2046 from Diapolo/traymenu
split of createTrayIconMenu() from createTrayIcon() in BitcoinGUI
2012-12-03 01:53:18 -08:00
Philip Kaufmann a8a4b9673e add 2 constructors in CDiskBlockPos to simplify class usage
- add a default-constructor, which simply calls SetNull() and a
  constructor to directly pass nFile and nPos
- change code to use that new constructors
2012-12-03 10:19:17 +01:00
Pieter Wuille d33a9218ab Make SetBestChain() atomic
In case a reorganisation fails, the internal state could become
inconsistent (memory only). Previously, a cache per block connect
or disconnect action was used, so blocks could not be applied in
a partial way. Extend this to a cache for the entire reorganisation,
making it atomic entirely. This also simplifies the code a bit.
2012-12-02 01:43:35 +01:00
Philip Kaufmann b19388dd88 FlushBlockFile(): check for valid FILE pointer
- don't call FileCommit() and fclose() if no valid FILE pointer was
  returned by OpenBlockFile()
2012-12-01 11:36:53 +01:00
Pieter Wuille cd7fb7d1de Merge pull request #2033 from sipa/kickconflicts
Bugfix: remove conflicting transactions from memory pool
2012-11-30 17:10:07 -08:00
Pieter Wuille 8259c57321 Only send reorged txn to mempool after checkpoint 2012-12-01 02:09:41 +01:00
Gavin Andresen aaef016a07 Merge pull request #2037 from luke-jr/printpriority
Allow -printpriority without -debug
2012-11-30 16:16:59 -08:00
Pieter Wuille 038784b979 Enable script verification for reorganized mempool tx 2012-12-01 00:45:17 +01:00
Pieter Wuille 487db8a2b1 Make test_bitcoin run in a temp datadir 2012-11-29 22:09:16 +01:00
Pieter Wuille 597fa4cd63 Add GetTempPath() to util 2012-11-29 01:00:35 +01:00
Jeff Garzik e6955d0411 New 'checkpoints' option should default to true. 2012-11-28 12:10:57 -05:00
Jeff Garzik 857b3ad923 Add "checkpoints" option, to permit disabling of checkpoint logic. 2012-11-28 12:07:42 -05:00
Wladimir J. van der Laan 5c37be2db6 Merge pull request #2044 from Diapolo/backupwallet
do not silently ignore errors on "backupwallet" RPC cmd
2012-11-27 23:41:50 -08:00
Philip Kaufmann f82102121f split of createTrayIconMenu() from createTrayIcon() in BitcoinGUI
- this allows to setup the trayicon before we have and want a trayicon menu
- should be of great use, when we remove that splash screen
- fixes a small bug with the toggleHideAction icon, which is not only used with
  trayicon but also with the Mac dock
2012-11-27 22:20:43 +01:00
Pieter Wuille 0c50d8b007 Merge pull request #2006 from robbak/make-leveldb-macro
Change 'make' to $(MAKE) in leveldb make command line
2012-11-27 12:49:37 -08:00
Philip Kaufmann ad525e9c8f do not silently ignore errors on "backupwallet" RPC cmd 2012-11-27 16:27:54 +01:00
Luke Dashjr 2646080e3d Allow -printpriority without -debug 2012-11-26 16:30:54 +00:00
Philip Kaufmann 5350ea4171 update CClientUIInterface and remove orphan Wx stuff
- fix ThreadSafeMessageBox always displays error icon
- allow to specify MSG_ERROR / MSG_WARNING or MSG_INFORMATION without a
  custom caption / title
- allow to specify CClientUIInterface::ICON_ERROR / ICON_WARNING and
  ICON_INFORMATION (which is default) as message box icon
- remove CClientUIInterface::OK from ThreadSafeMessageBox-calls, as
  the OK button will be set as default, if none is specified
- prepend "Bitcoin - " to used captions
- rename BitcoinGUI::error() -> BitcoinGUI::message() and add function
  documentation
- change all style parameters and enum flags to unsigned
- update code to use that new API

- update Client- and WalletModel to use new BitcoinGUI::message() and
  rename the classes error() method into message()
- include the possibility to supply the wanted icon for messages from
  Client- and WalletModel via "style" parameter
2012-11-26 13:32:31 +01:00
Pieter Wuille 231b399952 Bugfix: remove conflicting transactions from memory pool
When a transaction A is in the memory pool, while a transaction B
(which shares an input with A) gets accepted into a block, A was
kept forever in the memory pool.

This commit adds a CTxMemPool::removeConflicts method, which
removes transactions that conflict with a given transaction, and
all their children.

This results in less transactions in the memory pool, and faster
construction of new blocks.
2012-11-25 11:50:35 +01:00
Pieter Wuille 3ed1ccb089 Merge pull request #2004 from alexanderkjeldaas/simplify-cmutexlock
Simplify CMutexLock
2012-11-24 13:55:00 -08:00
Pieter Wuille 7818d230a2 Merge pull request #2013 from sipa/blockheader
Split off CBlockHeader from CBlock
2012-11-24 13:54:12 -08:00
burger2 ecd67a1420 Fix duplicate shortcut usage in sign/verify message dialog. 2012-11-22 22:50:30 +01:00
Pieter Wuille c07a1a6ee4 Merge pull request #1980 from sipa/noreorgsame
Do not reorganize if new branch has same amount of work
2012-11-22 13:33:03 -08:00
Wladimir J. van der Laan b0e228a4b0 Merge pull request #2024 from Diapolo/fix_qt_crash
Bitcoin-Qt: fix crash on Windows caused by CDBEnv::EnvShutdown()
2012-11-22 02:08:42 -08:00
Gavin Andresen a91efb2d8d Add assert and comment for subtle pay-to-script-hash logic 2012-11-21 13:58:10 -05:00
Philip Kaufmann be8e1f8479 Bitcoin-Qt: fix crash on Windows caused by CDBEnv::EnvShutdown()
- can be triggerd by just adding -proxy=crashme with 0.7.1
- crash occured, when AppInit2() was left with return false; after the
  first call to bitdb.open() (Step 6 in init)
- this is caused by GetDataDir() or .string() in CDBEnv::EnvShutdown()
  called via the bitdb global destructor
- init fDbEnvInit and fMockDb to false in CDBEnv::CDBEnv()
2012-11-18 14:10:26 +01:00
Wladimir J. van der Laan 4725e96a3a Merge pull request #2022 from Diapolo/fix_#2018
fix pull #2018
2012-11-17 01:00:20 -08:00
Philip Kaufmann 11406c89fe ConnectBlock(): fix error() format to be unsigned
- I introduced the wrong format macro with my former patch (#2018), this
  needs to be signed not unsigned (thanks Luke-Jr)
2012-11-17 09:57:58 +01:00
Wladimir J. van der Laan 98e7771ca1 Merge pull request #2019 from Diapolo/bitcoinstrings_upd
update bitcoinstrings.cpp and bitcoin_en.ts
2012-11-16 17:29:04 -08:00
Philip Kaufmann baa510b210 update bitcoinstrings.cpp and bitcoin_en.ts 2012-11-16 19:02:39 +01:00
Gavin Andresen e45d39f9ee Merge pull request #2009 from sipa/fixmove
Prevent RPC 'move' from deadlocking
2012-11-16 08:09:41 -08:00
Philip Kaufmann 42152c3da9 ensure we use our format macros to avoid compilation warnings
- fixes 2 warnings I observed while compiling on Windows with MinGW
2012-11-16 08:29:47 +01:00
Wladimir J. van der Laan 0c42ee8130 Merge pull request #1767 from Diapolo/RPCCon_clear_history
clear history when using clear button in RPC console
2012-11-15 22:31:12 -08:00
Jeff Garzik 3ef292dc7d Merge pull request #1670 from luke-jr/blksubstr
Use full block hash as unique identifier in debug.log
2012-11-15 18:47:07 -08:00
Jeff Garzik 848c0d5d95 Merge pull request #1945 from centromere/leveldb_fix
Fixed compile error on FreeBSD 9.
2012-11-15 18:31:20 -08:00
Jeff Garzik 34ea321ccd Merge pull request #1987 from jgarzik/no-pw-match
RPC: Forbid RPC username == RPC password
2012-11-15 18:22:50 -08:00
Jeff Garzik 824e196054 Merge pull request #2005 from Diapolo/fixes_main
some small fixes for main.cpp/.h
2012-11-15 18:20:35 -08:00
Jeff Garzik a0bf93b809 Merge pull request #2012 from luke-jr/invblk_errs
Print error for coinbase-pays-too-much case of ConnectBlock failing
2012-11-15 18:18:55 -08:00
Jeff Garzik fdbb537d26 Add new RPC "lockunspent", to prevent spending of selected outputs
and associated RPC "listlockunspent".

This is a memory-only filter, which is empty when a node restarts.
2012-11-15 21:11:30 -05:00
Jeff Garzik 7e1610d51e RPC: Forbid RPC username == RPC password
Added security measure.
2012-11-15 20:33:42 -05:00
Pieter Wuille bb76267cc4 Merge pull request #2010 from Diapolo/bind_unsigned
make enum and parameter used in Bind() unsigned
2012-11-15 15:37:00 -08:00
Pieter Wuille e754cf4133 Split off CBlockHeader from CBlock
Cleaner and removes the need for the application-specific flags in
serialize.h.
2012-11-16 00:12:33 +01:00
Pieter Wuille 99d0d0f356 Introduce script verification flags
These flags select features to be enabled/disabled during script
evaluation/checking, instead of several booleans passed along.
Currently these flags are defined:
* SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
* SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
2012-11-15 23:00:16 +01:00
Luke Dashjr 4ade04ddbd Print error for coinbase-pays-too-much case of ConnectBlock failing 2012-11-14 19:16:56 +00:00
Philip Kaufmann 29e214aaf5 make enum and parameter used in Bind() unsigned
- it's good practise to use unsigned int for enum flags, so change this
  one, as I introduced this for Bind()
2012-11-14 16:13:18 +01:00
Alexander Kjeldaas bfc9620799 Simplify CMutexLock
o Remove unused Leave and GetLock functions
o Make Enter and TryEnter private.
o Simplify Enter and TryEnter.
  boost::unique_lock doesn't really know whether the
  mutex it wraps is locked or not when the defer_lock
  option is used.
  The boost::recursive_mutex does not expose this
  information, so unique_lock only infers this
  knowledge.  When taking the lock is defered, it
  (randomly) assumes that the lock is not taken.
  boost::unique_lock has the following definition:

        unique_lock(Mutex& m_,defer_lock_t):
            m(&m_),is_locked(false)
        {}

        bool owns_lock() const
        {
            return is_locked;
        }
  Thus it is a mistake to check owns_lock() in Enter
  and TryEnter - they will always return false.
2012-11-14 00:00:23 -03:00
Pieter Wuille 4291e8feab Prevent RPC 'move' from deadlocking
It seemed to create two CWalletDB objects that both grab the
database lock.
2012-11-14 00:31:56 +01:00
Luke Dashjr c34a32699e Change block references in debug.log to full hash instead of just 0..20 2012-11-13 21:19:58 +00:00
Luke Dashjr f3a84c3a6b Abstract block hash substr extraction (for debug.log) into BlockHashStr inline 2012-11-13 21:18:32 +00:00
Philip Kaufmann 966a0e8cc9 add CWalletTx::GetImmatureCredit() and use it in CWallet::GetImmatureBalance() 2012-11-13 07:56:48 +01:00
Wladimir J. van der Laan 0d5b1d2a3e Merge pull request #2002 from alexanderkjeldaas/clang-warnings
o Removed verbose clang warning
2012-11-12 22:26:08 -08:00
Robert Backhaus 978770b59d Change 'make' to $(MAKE) in leveldb make command line 2012-11-13 11:45:07 +10:00
Philip Kaufmann 13e5cce4c3 some small fixes for main.cpp/.h
- remove an unwanted ";" at the end of the ~CCoinsView() destructor
- in FindBlockPos() and FindUndoPos() only call fclose(), is file is open
- fix an error string in the CBlockUndo class
2012-11-11 13:16:42 +01:00
Pieter Wuille e12efb9d33 Merge pull request #1970 from Arnavion/fix-make-leveldb
leveldb cannot compile with custom CFLAGS / CXXFLAGS / LDFLAGS
2012-11-11 03:20:29 -08:00
Pieter Wuille 537c890f24 Merge pull request #1997 from Diapolo/bdb_open
simplify CDBEnv::Open() / fix small glitches
2012-11-11 03:16:52 -08:00
Pieter Wuille 337f876cbb Merge pull request #2000 from Diapolo/fix_indentation
fix some missing indentations in main.cpp for better readability
2012-11-11 02:23:10 -08:00
Alexander Kjeldaas 25511af4a5 o Annotated lock-like functions in net.h.
o Removed unused function EndMessageAbortIfEmpty
2012-11-11 00:55:48 -03:00
Alexander Kjeldaas 05f97d1263 o Added AnnotatedMixin which adds locking annotations to the mutex
API, compatible with clang's -Wthread-safety
2012-11-11 00:55:48 -03:00
Alexander Kjeldaas c043ff79e3 o Added threadsafety.h - a set of macros using the -Wthread-safety
feature in clang.  These macros should primarily be used to
  document which locks protect a given piece of data.  Secondary it
  can be used to document the set of held and excluded locks when
  entering a function.
2012-11-11 00:53:00 -03:00
Alexander Kjeldaas 40c5e409e1 o Removed verbose clang warning 2012-11-11 00:25:19 -03:00
Pieter Wuille 6ca2ea2fa2 Merge pull request #1979 from sipa/corefndoc
One-line comments for public main functions
2012-11-10 13:47:00 -08:00
Pieter Wuille 160b028b88 One-line comments for public main functions 2012-11-10 22:40:21 +01:00
Pieter Wuille 45a9365f18 Fix status text after reindex 2012-11-10 22:08:46 +01:00
Gregory Maxwell 91cee34638 Merge pull request #1992 from Diapolo/no_memset
don't use memset() in privacy/security relevant code parts
2012-11-10 09:29:32 -08:00
Philip Kaufmann b56585d067 fix some missing indentations in main.cpp for better readability 2012-11-10 14:26:34 +01:00
Wladimir J. van der Laan e88f8887b6 Merge pull request #1977 from Diapolo/rem_printf_redef_rpc
remove printf redefinition from bitcoinrpc.cpp
2012-11-10 03:47:11 -08:00
Wladimir J. van der Laan d7db72998b Merge pull request #1993 from Diapolo/qt_header_cleanup
Qt: small header changes / fixes
2012-11-10 03:46:35 -08:00
Philip Kaufmann c74bae0fdf simplify CDBEnv::Open() / fix small glitches
- remove pathEnv from CDBEnv, as this attribute is not needed
- change path parameter in ::Open() to a reference
- make nDbCache variable an unsigned integer
- remove a missplaced ";" behin ::IsMock()
2012-11-10 01:11:22 +01:00
Philip Kaufmann c73323eec9 allow listening on -bind=address for blocked networks
- this allows the client to listen on via -bind specified addresses
  (e.g. 127.0.0.1), even when a network (IPv4 in that case) was blocked
  via e.g -onlynet="Tor"
- introduce enum BindFlags to avoid passing multiple bools to Bind()
- make -bind help text clear we ALWAYS listen on the specified address
- remove an unused variable
- remove 2 unneeded IsLimited() checks before calling Bind(), which does
  these checks anyway

- usage case: specify -bind=127.0.0.1 -onlynet="Tor" to allow incoming
  connections to a Tor hidden service, but still don't allow other IPv4
  nodes to connect / get connected
2012-11-10 00:29:12 +01:00
Pieter Wuille c7075c4b65 Fix tests after cache tweaks 2012-11-10 00:09:57 +01:00
Pieter Wuille 485cf044ba Merge pull request #1943 from sipa/reindex2
Add -reindex, to perform in-place reindexing of block chain files
2012-11-09 14:50:30 -08:00
Jeff Garzik 8146591a53 Merge branch 'http-improvements'
The base bits of pull req #1982.
2012-11-09 17:34:25 -05:00
Pieter Wuille b41de54a2c Merge pull request #1978 from sipa/nodetach
Remove -detachdb and stop's detach argument.
2012-11-09 14:10:50 -08:00
Philip Kaufmann d0b0925be9 make CBase58Data class use zero_after_free_allocator
- this way there is no need for an explicit destructor, who does the same
  thing anyway
2012-11-09 19:25:20 +01:00
Philip Kaufmann 0f8a647782 don't use memset() in privacy/security relevant code parts
As memset() can be optimized out by a compiler it should not be used in
privacy/security relevant code parts. OpenSSL provides the safe
OPENSSL_cleanse() function in crypto.h, which perfectly does the job of
clean and overwrite data.

For details see: http://www.viva64.com/en/b/0178/

- change memset() to OPENSSL_cleanse() where appropriate
- change a hard-coded number from netbase.cpp into a sizeof()
2012-11-09 12:53:53 +01:00
Pieter Wuille 7fea484674 Add -reindex, to perform in-place reindexing of block chain files
Flushes the blktree/ and coins/ databases, and reindexes the
block chain files, as if their contents was loaded via -loadblock.

Based on earlier work by Jeff Garzik.
2012-11-09 01:06:32 +01:00
Pieter Wuille 7a5b7535bf Move ThreadImport to init.cpp 2012-11-09 01:06:32 +01:00
Pieter Wuille 05d9726805 LoadExternalBlockFile switched to CBufferedFile 2012-11-09 01:06:06 +01:00
Pieter Wuille b5d5f44c95 Add CBufferedFile 2012-11-09 01:06:06 +01:00
Pieter Wuille 16d9d61f99 Merge pull request #1981 from sipa/caches
Cache size optimizations
2012-11-08 14:17:37 -08:00
Philip Kaufmann 128eefa0f8 Qt: small header changes / fixes
- ensure header inclusion guard is named after the header file
- add missing comments at the end of some inclusion guards
- add a small Qt5 compatibility fix in macdockiconhandler.h
2012-11-08 21:45:32 +01:00
Pieter Wuille cd6dc96c4f Do not reorganize if new branch has same amount of work 2012-11-05 21:24:11 +01:00
Wladimir J. van der Laan 86406daeca Merge pull request #1830 from Diapolo/trans_rem_spaces
fix some double-spaces in strings
2012-11-04 23:34:57 -08:00
Jeff Garzik fcf234fc08 RPC: HTTP server uses its own ReadHTTPRequestLine()
rather than reusing ReadHTTPStatus() from the client mode.

The following additional HTTP request validations are added, both in line with
existing HTTP client practice:

1) HTTP method must be GET or POST.  Most clients use POST, some
   use GET.  Either way, this continues to work.
2) HTTP URI must start with "/" character.
   Normal URI is "/" (a 1-char string), so this is fine.
2012-11-04 17:16:46 -05:00
Jeff Garzik 2306dc4b76 RPC, cosmetic: push down ReadHTTPStatus() calls into ReadHTTP() callers
ReadHTTPStatus() is currently overloaded:  In client mode, it properly parses
and receives an HTTP status line.  In server mode, it incorrectly parses the
HTTP request line as an HTTP status line.

This server mode bug has never mattered, because the RPC server never
cared about the URI (path) provided in the HTTP request.  That will change in
the future, so go ahead and begin fixing the problem.

This patch is cosmetic, and should result in NO behavior changes.

Further renames:
ReadHTTPHeader -> ReadHTTPHeaders
ReadHTTP -> ReadHTTPMessage
2012-11-04 16:06:38 -05:00
Pieter Wuille 1c83b0a377 Cache size optimizations 2012-11-04 18:06:25 +01:00
Pieter Wuille 92467073ad Remove -detachdb and stop's detach argument.
As the only BDB database left is the wallet, and it is always
detached.

Also remove IsChainFile() predicate and related chainfile-specific
logic.
2012-11-04 12:59:06 +01:00
Philip Kaufmann ed552cfae0 remove printf redefinition from bitcoinrpc.cpp
- as the redefiniton of printf happens in util.h, which is included in
  bitcoinrpc.cpp, we don't need another redefinition
2012-11-04 11:24:54 +01:00
Pieter Wuille a56d3f8a10 Merge pull request #1971 from sipa/bugfix_norelayspent
Bugfix: do not keep relaying spent wallet transactions
2012-11-03 11:51:13 -07:00
kjj2 cae686d31e Add -walletnotify to call an external script on wallet transactions 2012-11-03 10:07:57 -05:00
Pieter Wuille 9d6633ac0d Comments for constants 2012-11-03 00:14:43 +01:00
Pieter Wuille c9c7d4824f Add virtual destructor to CCoinsView 2012-11-01 22:54:06 +01:00
Pieter Wuille 5eaf91a428 Bugfix: do not keep relaying spent wallet transactions
The original test (checking whether the transaction occurs in the
txindex) is not usable anymore, as it will miss anything already
fully spent. However, as merkle transactions (and by extension,
wallet transactions) track which block they were last seen being
included in, we can use that to determine the need for
rebroadcasting.
2012-11-01 18:06:29 +01:00
Arnav Singh 8986a1369f Fixed making leveldb with custom CFLAGS/CXXFLAGS in the same way as makefile.unix 2012-11-01 08:29:17 -07:00
Philip Kaufmann 6f959c4cb3 Bitcoin-Qt: use statustips in addition to tooltips
- add setStatusTip() in addition to setTooltip() where it makes sense
- add only setStatusTip() if GUI element is only used in main- or tray menu

- add an event filter on our BitcoinGUI object to prevent garbelled text
  on the status bar, which happens when we use it for e.g. displaying
  block-sync state and then a QEvent::StatusTip wants to write own text to it

- remove a double translation of "Bitcoin client"
2012-10-31 08:05:27 +01:00
Wladimir J. van der Laan 578fc80003 Merge pull request #1932 from Diapolo/thread_printf
fix some thread related log messages
2012-10-30 23:19:35 -07:00
Pieter Wuille 41db7c224a Merge pull request #1963 from sipa/bugfix_nonewblock
Bugfix: don't crash by trying to write unchanged best block
2012-10-30 13:53:11 -07:00
Gavin Andresen ae8fc19788 Merge branch 'rawtx_p2sh' 2012-10-29 15:49:46 -04:00
Matt Corallo 38fe2e6a68 Add missing calls to ranlib in Windows makefiles 2012-10-29 15:43:18 -04:00
Matt Corallo f53b125507 Fix linux-mingw makefile's leveldb build by setting CXX. 2012-10-29 15:43:17 -04:00
Matt Corallo 3b4f8ad71d Use && instead of ; in leveldb calls to makefile. 2012-10-29 15:43:17 -04:00
Gavin Andresen 34226be7a8 New createmultisig rpc command
This is to support the signrawtransaction API call; given the public
keys involved in a multisig transaction, this gives back the redeemScript
needed to sign it.
2012-10-29 13:34:35 -04:00
Gavin Andresen 03346a61b1 Add redeemScript to listunspent output and signrawtransaction input
signrawtransaction was unable to sign pay-to-script-hash inputs
when given the list of private keys to use. With this commit
you can provide the p2sh redemption script in the list of
inputs.
2012-10-29 13:34:35 -04:00
Gavin Andresen 2d43f88e1f Tests for raw transactions argument checking 2012-10-29 13:34:35 -04:00
Gavin Andresen c4d884e20e No need for test fixture now that multisig is enabled on main network. 2012-10-29 13:34:35 -04:00
Pieter Wuille 28982cc9dc Remove P2SH transition code: P2SH violations may cause DoS trigger 2012-10-29 00:41:39 +01:00
Pieter Wuille 0b297a614f Bugfix: don't crash by trying to write unchanged best block 2012-10-28 19:14:51 +01:00
Philip Kaufmann 6b3783a9c9 fix some double-spaces in strings
- remove some unneeded stuff in sendcoinsentry.ui
- harmonize some "Error:"-messages
2012-10-25 22:25:50 +02:00
Pieter Wuille bb790aa24d First flush block tree, then coin set
As the coinset data refers to the best block, stored in the block
tree. Flushing the coin set first can cause inconsistencies if
the process gets killed in between.
2012-10-25 20:47:17 +02:00
tucenaber 3026baaa7c Added checks for null pointers in Shutdown
Estetics
2012-10-25 20:45:38 +02:00
Pieter Wuille 344620e953 Merge pull request #1904 from laanwj/2012_10_remove_getorder
remove "checkorder" P2P command
2012-10-25 11:41:22 -07:00
Pieter Wuille e74d0ab675 Merge pull request #1899 from Diapolo/proxy_optionsmodel
make optionsmodel query real proxy state for ::data()
2012-10-25 11:33:59 -07:00
Pieter Wuille 66444558a5 Merge pull request #1953 from gmaxwell/createnewblock-race
Fixes a race condition in CreateNewBlock and a future null deref on testnet.
2012-10-25 11:30:51 -07:00
Philip Kaufmann 847593228d fix some thread related log messages
- "ThreadIRCSeed started" was not displayed, even if the thread ran
  (although only for a short time as the "do we want this thread?"-checks
  happen IN ThreadIRCSeed2())
- the patch ensures we always get that message
- add a "ThreadIRCSeed trying to connect..." message
- add missing "ThreadDumpAddress started" message
2012-10-25 16:12:40 +02:00
Wladimir J. van der Laan 1f7c5c5a3e Merge pull request #1926 from laanwj/2012_10_maindummybounds
Fix out-of-bounds read in main (issue #1924)
2012-10-25 06:12:10 -07:00
Wladimir J. van der Laan 7a1786084d Merge pull request #1956 from laanwj/2012_10_prerelease_warning
Show warning when using prerelease version
2012-10-25 05:52:55 -07:00
Pieter Wuille 2e9e6641e1 Merge pull request #1955 from gmaxwell/gbt_paramfix
Don't force getblocktemplate to have a parameter.
2012-10-25 05:37:51 -07:00
Philip Kaufmann 83a3fb81f3 ensure AskPassphraseDialog::eventFilter forwards events
- instead of "return false;" use "return QDialog::eventFilter(object,
  event);" to harmonize this event filter with our default behaviour
- remove orphan spaces found while editting the files
2012-10-25 11:52:34 +02:00
Wladimir J. van der Laan 62e21fb5d0 Show warning when using prerelease version
Implements #1948

- Add macro `CLIENT_VERSION_IS_RELEASE` to clientversion.h
- When running a prerelease (the above macro is `false`):
  - In UI, show an orange warning bar at the top. This will be used for other
    warnings (and alerts) as well, instead of the status bar.
  - For `bitcoind`, show the warning in the "errors" field in `getinfo`
    response.
2012-10-25 07:33:45 +02:00
Gregory Maxwell 3beac9837f Don't force getblocktemplate to have a parameter.
This looks like it was just a munged merge when ultraprune
was committed.
2012-10-24 12:39:46 -04:00
Pieter Wuille 55913c9971 Merge pull request #1947 from centromere/freebsd_cpu_fix
Fixed 100% CPU utilization problem on FreeBSD 9
2012-10-24 02:15:54 -07:00
Wladimir J. van der Laan 4fbad9124e Fix out-of-bounds read noticed by Ricardo Correia
Sizeof() returned the size of a pointer instead of the size of the buffer.
Fixes issue #1924.
2012-10-24 08:26:50 +02:00
Gregory Maxwell faff50d129 Fixes a race condition in CreateNewBlock and a future null deref on testnet.
CreateNewBlock was reading pindexBest at the start before taking the lock
so it was possible to have the the block content not match the prevheader
and this can also trigger a newly added assert in ConnectBlock.

I noticed this during a code review after twobitcoins reported that ab91bf39
(BIP30 for all blocks) could cause a null dereference on a modified node
that mined during the IBD, or on testnet when it reached heights 91842 and
91880 due to CreateNewBlock calling ConnectBlock with pindex->phashBlock NULL.
2012-10-24 02:13:03 -04:00
Pieter Wuille 4afc0b5411 Bugfix: actually use CCoinsViewMemPool 2012-10-23 01:43:33 +02:00
Pieter Wuille c2ed184f98 Added some comments
Some clarifications after a code review by Mike Hearn.
2012-10-23 00:27:17 +02:00
Pieter Wuille 1e64c2d585 Bugfix: off-by-one in priority calculation 2012-10-23 00:23:39 +02:00
Pieter Wuille 9e957fb3b1 Bugfix: add missing fee check 2012-10-23 00:23:39 +02:00
Pieter Wuille 56424040a4 Bugfix: off-by-one error in coinbase maturity check 2012-10-23 00:23:39 +02:00
Alex 39ad0aa692 Fixed 100% CPU utilization problem on FreeBSD 9 2012-10-22 08:37:17 -04:00
Alex 17bfb1f437 Fixed compile error on FreeBSD 9.
See http://code.google.com/p/leveldb/issues/detail?id=98
2012-10-22 01:46:31 -04:00
Gregory Maxwell 2ef15697f8 Merge pull request #1939 from sipa/bugfix_zerobalance
Bugfix: do not mark all future coins spent
2012-10-21 16:20:04 -07:00
Philip Kaufmann 729b180686 change blockchain -> block chain (spelling)
- Wiki says "block chain" is correct ;)
- remove some unneeded spaces I found in the source, while fixing the spelling
2012-10-21 21:32:25 +02:00
Philip Kaufmann 039bcbf12d remove init messages from ThreadImport()
- remove uiInterface.InitMessage() calls from ThreadImport(), as Qt
  doesn't like them getting called out of it's main thread and because the
  thread will continue to run after the GUI was loaded
2012-10-21 21:16:52 +02:00
grimd34th 46936f343c Add NATIVE_WINDOWS
With a change of libs, and specifying NATIVE_WINDOWS as TARGET_OS it should compile libleveldb.a and libmemenv.a just fine, it did for me and Diapolo when testing.
2012-10-21 11:38:12 -03:00
Pieter Wuille 80fe60959d Tab instead of 4 spaces in makefile.mingw 2012-10-21 16:10:01 +02:00
Pieter Wuille ddba582377 Bugfix: do not mark all future coins spent 2012-10-21 15:19:19 +02:00
Gregory Maxwell d12b694106 Merge pull request #1938 from sipa/v0799
Update version numbers to 0.7.99
2012-10-21 03:12:25 -07:00
Pieter Wuille fcfa7a588e Update version numbers to 0.7.99 2012-10-21 12:10:08 +02:00
Gregory Maxwell 67e2c8a40a Merge pull request #1916 from jgarzik/caddrdb-bug
Fix: CAddrMan: verify pchMessageStart file marker, before reading address data
2012-10-20 15:06:25 -07:00
Pieter Wuille f50fb5470b Merge pull request #1936 from sipa/morehashwriter
Use CHashWriter also in SignatureHash(), and for message signing
2012-10-20 14:53:43 -07:00
Pieter Wuille 4ca60bba5c Remove BDB block database support 2012-10-20 23:08:57 +02:00
Pieter Wuille beeb57610c Add gettxout and gettxoutsetinfo RPCs 2012-10-20 23:08:57 +02:00
Pieter Wuille e1bfbab802 Add LevelDB MemEnv support
Support LevelDB memory-backed environments, and use them in unit tests.
2012-10-20 23:08:57 +02:00
Pieter Wuille 2d8a48292b LevelDB block and coin databases
Split off CBlockTreeDB and CCoinsViewDB into txdb-*.{cpp,h} files,
implemented by either LevelDB or BDB.

Based on code from earlier commits by Mike Hearn in his leveldb
branch.
2012-10-20 23:08:57 +02:00
Pieter Wuille 44d40f26dc Flush and sync block data 2012-10-20 23:08:57 +02:00
Pieter Wuille d979e6e36a Use singleton block tree database instance 2012-10-20 23:08:57 +02:00
Pieter Wuille 857c61df0b Prepare database format for multi-stage block processing
This commit adds a status field and a transaction counter to the block
indexes.
2012-10-20 23:08:57 +02:00
Pieter Wuille 4fea06db25 Automatically reorganize at startup to best known block
Given that the block tree database (chain.dat) and the active chain
database (coins.dat) are entirely separate now, it becomes legal to
swap one with another instance without affecting the other.

This commit introduces a check in the startup code that detects the
presence of a better chain in chain.dat that has not been activated
yet, and does so efficiently (in batch, while reusing the blk???.dat
files).
2012-10-20 23:08:57 +02:00
Pieter Wuille 13c51f20f6 Direct CCoins references
To prevent excessive copying of CCoins in and out of the CCoinsView
implementations, introduce a GetCoins() function in CCoinsViewCache
with returns a direct reference. The block validation and connection
logic is updated to require caching CCoinsViews, and exploits the
GetCoins() function heavily.
2012-10-20 23:08:57 +02:00
Pieter Wuille 64dd46fd05 Transaction hash caching
Use CBlock's vMerkleTree to cache transaction hashes, and pass them
along as argument in more function calls. During initial block download,
this results in every transaction's hash to be only computed once.
2012-10-20 23:08:57 +02:00
Pieter Wuille ae8bfd12da Batch block connection during IBD
During the initial block download (or -loadblock), delay connection
of new blocks a bit, and perform them in a single action. This reduces
the load on the database engine, as subsequent blocks often update an
earlier block's transaction already.
2012-10-20 23:08:57 +02:00
Pieter Wuille 450cbb0944 Ultraprune
This switches bitcoin's transaction/block verification logic to use a
"coin database", which contains all unredeemed transaction output scripts,
amounts and heights.

The name ultraprune comes from the fact that instead of a full transaction
index, we only (need to) keep an index with unspent outputs. For now, the
blocks themselves are kept as usual, although they are only necessary for
serving, rescanning and reorganizing.

The basic datastructures are CCoins (representing the coins of a single
transaction), and CCoinsView (representing a state of the coins database).
There are several implementations for CCoinsView. A dummy, one backed by
the coins database (coins.dat), one backed by the memory pool, and one
that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock,
DisconnectBlock, ... now operate on a generic CCoinsView.

The block switching logic now builds a single cached CCoinsView with
changes to be committed to the database before any changes are made.
This means no uncommitted changes are ever read from the database, and
should ease the transition to another database layer which does not
support transactions (but does support atomic writes), like LevelDB.

For the getrawtransaction() RPC call, access to a txid-to-disk index
would be preferable. As this index is not necessary or even useful
for any other part of the implementation, it is not provided. Instead,
getrawtransaction() uses the coin database to find the block height,
and then scans that block to find the requested transaction. This is
slow, but should suffice for debug purposes.
2012-10-20 23:08:57 +02:00
Pieter Wuille bba89aa82a Pre-allocate block and undo files in chunks
Introduce a AllocateFileRange() function in util, which wipes or
at least allocates a given range of a file. It can be overriden
by more efficient OS-dependent versions if necessary.

Block and undo files are now allocated in chunks of 16 and 1 MiB,
respectively.
2012-10-20 23:08:57 +02:00
Pieter Wuille 5382bcf8cd Multiple blocks per file
Change the block storage layer again, this time with multiple files
per block, but tracked by txindex.dat database entries. The file
format is exactly the same as the earlier blk00001.dat, but with
smaller files (128 MiB for now).

The database entries track how many bytes each block file already
uses, how many blocks are in it, which range of heights is present
and which range of dates.
2012-10-20 23:08:57 +02:00
Pieter Wuille 8adf48dc9b Preliminary undo file creation
Create files (one per block) with undo information for the transactions
in it.
2012-10-20 23:08:57 +02:00
Pieter Wuille 630fd8dcb6 One file per block
Refactor of the block storage code, which now stores one file per block.
This will allow easier pruning, as blocks can be removed individually.
2012-10-20 23:08:57 +02:00
Pieter Wuille 44ac1c0fe3 Add CTxUndo: transaction undo information
The CTxUndo class encapsulates data necessary to undo the effects of
a transaction on the txout set, namely the previous outputs consumed
by it (script + amount), and potentially transaction meta-data when
it is spent entirely.
2012-10-20 23:08:56 +02:00
Pieter Wuille 10fd8604d7 Add CCoins: pruned list of transaction outputs
The CCoins class represents a pruned set of transaction outputs from
a given transaction. It only retains information about its height in
the block chain, whether it was a coinbase transaction, and its
unspent outputs (script + amount).

It has a custom serializer that has very low redundancy.
2012-10-20 23:08:56 +02:00
Pieter Wuille 0fa593d0fb Compact serialization for amounts
Special serializer/deserializer for amount values. It is optimized for
values which have few non-zero digits in decimal representation. Most
amounts currently in the txout set take only 1 or 2 bytes to
represent.
2012-10-20 23:08:56 +02:00
Pieter Wuille 69fc8047a9 Compact serialization for scripts
Special serializers for script which detect common cases and encode
them much more efficiently. 3 special cases are defined:
* Pay to pubkey hash (encoded as 21 bytes)
* Pay to script hash (encoded as 21 bytes)
* Pay to pubkey starting with 0x02, 0x03 or 0x04 (encoded as 33 bytes)

Other scripts up to 121 bytes require 1 byte + script length. Above
that, scripts up to 16505 bytes require 2 bytes + script length.
2012-10-20 23:08:56 +02:00
Pieter Wuille 4d6144f97f Compact serialization for variable-length integers
Variable-length integers: bytes are a MSB base-128 encoding of the number.
The high bit in each byte signifies whether another digit follows. To make
the encoding is one-to-one, one is subtracted from all but the last digit.
Thus, the byte sequence a[] with length len, where all but the last byte
has bit 128 set, encodes the number:

  (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1))

Properties:
* Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes)
* Every integer has exactly one encoding
* Encoding does not depend on size of original integer type
2012-10-20 23:08:56 +02:00
Pieter Wuille 43b7905e98 LevelDB glue
Database-independent glue for supporting LevelDB databases.

Based on code from earlier commits by Mike Hearn in his leveldb
branch.
2012-10-20 23:08:56 +02:00
Pieter Wuille 3ff3a2bd60 Makefile integration of LevelDB 2012-10-20 23:08:56 +02:00
Pieter Wuille 9f56678fce Backport Win32 LevelDB env from C++0x to C++
Since the gitian mingw compiler doesn't support C++0x yet.
2012-10-20 23:08:56 +02:00
Pieter Wuille 9d503a7285 Disable libsnappy detection in LevelDB 2012-10-20 23:08:56 +02:00
justmoon 94a50fb339 Leveldb Windows port by Edouard Alligand, adapted for MingW by me. 2012-10-20 23:08:56 +02:00
Mike Hearn 5e650d6d2d Import LevelDB 1.5, it will be used for the transaction database. 2012-10-20 23:08:56 +02:00
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
Pieter Wuille 8980a50924 Use CHashWriter also in SignatureHash(), and for message signing 2012-10-19 23:18:07 +02:00
Wladimir J. van der Laan 485d667748 Revert "Merge pull request #1931 from laanwj/2012_10_newicons"
This reverts commit 199d88cf90, reversing
changes made to 65bc1573e7.

License is worse instead of better. Will only accept public domain and
MIT-licensed icons from now on.
2012-10-14 20:49:06 +02:00
xanatos cddda5d9f0 Changed connect?_16.png to non-GPL one and changed the assets attribution. 2012-10-14 13:01:38 +02:00
xanatos b96238a9c9 Changed the spinner to a non-GPL one, added instructions on how to regenerate it, changed the assets attribution, removed old spinner + old spinner's sources. 2012-10-14 12:34:07 +02:00
Philip Kaufmann 34710818a7 Bitcoin-Qt: intregrate current translations from Transifex 2012-10-12 15:51:49 +02:00
Philip Kaufmann 0e005c3ddc Bitcoin-Qt: update english translation master file 2012-10-12 15:45:27 +02:00
Wladimir J. van der Laan 22bb049011 Fix a use-after-free problem in initialization (#1920)
Don't store the result of c_str().

Luckily, this only affects logging, though it could crash or leak
sensitive data to the log in rare cases.
2012-10-12 03:09:05 +02:00
Wladimir J. van der Laan 16f3618c13 Merge pull request #1879 from sipa/fdatasync
Use fdatasync instead of fsync on supported platforms
2012-10-11 00:42:47 -07:00
Wladimir J. van der Laan 24694e24ed Merge pull request #1913 from sipa/noi2p
Remove I2P support from netbase
2012-10-11 00:41:33 -07:00
Wladimir J. van der Laan fae3989ffc Merge pull request #1900 from Diapolo/optionsmodel_getters
move most explicit getters in optionsmodel to header
2012-10-11 00:40:20 -07:00
Wladimir J. van der Laan 089b10a28a Merge pull request #1911 from Diapolo/fix_signed_unsigned
fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cpp
2012-10-11 00:40:08 -07:00
Wladimir J. van der Laan ac0ad5dc63 Merge pull request #1901 from laanwj/2012_10_remove_strlcpy
get rid of strlcpy.h
2012-10-11 00:39:51 -07:00
Gavin Andresen 1d1f32d16d Bump versions for 0.7.1 release 2012-10-09 12:37:35 -04:00
Gavin Andresen de038acd96 Fix bad merge, pszDataDir duplication 2012-10-09 12:28:00 -04:00
Gavin Andresen 673021410f Merge branch 'wallet_exceptions' of github.com:gavinandresen/bitcoin-git 2012-10-09 12:14:26 -04:00
Gavin Andresen cf64347d70 Merge branch 'crash_at_exit' of github.com:gavinandresen/bitcoin-git 2012-10-09 12:10:18 -04:00
Wladimir J. van der Laan 0a5ce30bc1 Merge pull request #1915 from Diapolo/Qt5_compat_leftover
change Q_WS_MAC -> Q_OS_MAC (Qt5 compatibility)
2012-10-08 22:28:24 -07: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
Gavin Andresen d0b3e77a08 Don't try to verify a non-existent wallet.dat 2012-10-08 17:46:46 -04:00