Commit graph

982 commits

Author SHA1 Message Date
Gavin Andresen 5e67e124cf Merge pull request #1889 from tcatm/multi-wallet
let user select wallet file with -wallet=foo.dat
2013-07-24 22:52:21 -07:00
Jeff Garzik 0a740650a5 Merge pull request #2795 from fanquake/log_aborted_rebuilds
Log aborted block database rebuilds
2013-07-22 08:32:59 -07:00
Matt Corallo f89faa2584 Call the -alertnotify script when we see a long or invalid fork. 2013-07-22 12:11:46 +02:00
Luke Dashjr dabd4bd48e Bugfix: Include block creation and SSL options headings in usage 2013-07-21 16:13:00 +00:00
fcicq b34255b758 Ignore SIGPIPE signal on Solaris 2013-07-17 16:50:51 +08:00
Nils Schneider 674cb304b3 let user select wallet file with -wallet=foo.dat
use std::string instead of psz for WalletFile

only allow wallets within $DATADIR

Use strWalletFile in salvage/recover

fix: remove unused variable pszWalletFile

move strWalletFile to init.h/init.cpp

avoid conversion of strWalletfile to c-string
2013-07-04 17:19:36 +02:00
Michael Ford 664aeb2871 Log aborted block database rebuilds 2013-06-25 23:54:17 +08:00
Eric Lombrozo e6fe8e77fb Calling UnregisterAllWallets() instead of UnregisterWallet(pwalletMain) in init.cpp 2013-06-24 09:33:15 -07:00
Eric Lombrozo 7db120d531 Moved CBlock::ReadFromDisk out of CBlock to functions ReadBlockFromDisk in main.h 2013-06-23 19:59:34 -07:00
Pieter Wuille fd967fed89 Merge pull request #2783 from sipa/newtxindex
Initialize database before checking changed txindex
2013-06-23 15:49:08 -07:00
Jeff Garzik 6d3f0058f7 init.cpp: fix chainparams.h double include.
Noticed by Diapolo.
2013-06-23 11:32:38 -04:00
Jeff Garzik 4be2aba302 Merge pull request #2778 from jgarzik/rpc-verifydb
RPC: add 'verifychain' to verify chain database at runtime
2013-06-22 23:08:13 -07:00
Pieter Wuille 067a6092ac Initialize database before checking changed txindex
In case no database exists yet, and -txindex(=1) is passed, we currently first
check whether fTxIndex differs from -txindex (and ask the user to reindex in
that case), and only afterwards initialize the database. By swapping these
around (the initialization is a no-op in case the database already exists),
we allow it to be born in txindex mode, without warning.

That also means we don't need to check -reindex anymore, as the wiping/reinit
of the databases happens before checking.
2013-06-22 16:14:26 +02:00
Jeff Garzik 168ba99392 Pass check level, check depth to VerifyDB() 2013-06-19 11:32:49 -04:00
Mike Hearn 0e4b317555 Introduce a CChainParameters singleton class and regtest mode.
The new class is accessed via the Params() method and holds
most things that vary between main, test and regtest networks.
The regtest mode has two purposes, one is to run the
bitcoind/bitcoinj comparison tool which compares two separate
implementations of the Bitcoin protocol looking for divergence.

The other is that when run, you get a local node which can mine
a single block instantly, which is highly convenient for testing
apps during development as there's no need to wait 10 minutes for
a block on the testnet.
2013-06-19 16:28:52 +02:00
Philip Kaufmann 0206e38dcd allow txindex to be removed and add a reindex dialog
- adds a reindex dialog for Bitcoin-Qt to change -txindex without the need
  to supply -reindex
- now also does a -reindex, when removing the -txindex switch
2013-06-10 19:27:57 +02:00
Eric Lombrozo 501da2503a Using boost::signals2 to message main from net.cpp. 2013-06-05 23:15:20 -07:00
Eric Lombrozo 05df3fc68d Removed AcceptToMemoryPool method from CTransaction. This method belongs to the mempool instance.
Removed AreInputsStandard from CTransaction, made it a regular function in main.
Moved CTransaction::GetOutputFor to CCoinsViewCache.

Moved GetLegacySigOpCount and GetP2SHSigOpCount out of CTransaction into regular functions in main.

Moved GetValueIn and HaveInputs from CTransaction into CCoinsViewCache.

Moved AllowFree, ClientCheckInputs, CheckInputs, UpdateCoins, and CheckTransaction out of CTransaction and into main.

Moved IsStandard and IsFinal out of CTransaction and put them in main as IsStandardTx and IsFinalTx. Moved GetValueOut out of CTransaction into main. Moved CTxIn, CTxOut, and CTransaction into core.

Added minimum fee parameter to CTxOut::IsDust() temporarily until CTransaction is moved to core.h so that CTxOut needn't know about CTransaction.
2013-06-05 23:15:20 -07:00
Eric Lombrozo 663224c232 Removed net.cpp's dependency on init.h.
Added explicit include of main.h in init.cpp, changed include of init.h to include of main.h in net.cpp.

Added function registration for net.cpp in init.cpp's network initialization.

Removed protocol.cpp's dependency on main.h.

TODO: Remove main.h include in net.cpp.
2013-06-05 20:36:10 -07:00
Eric Lombrozo 4751d07efd Moved unrelated-to-network calls in StartNode and StopNode into init.cpp 2013-06-05 20:36:10 -07:00
Eric Lombrozo 336fe971e6 Get rid of db dependencies on main 2013-06-05 20:36:10 -07:00
Cory Fields 7f61f1ac78 build: use runtime setting for displaying the help message rather than QT_GUI define 2013-06-04 03:54:14 -04:00
Cory Fields c98c88b3ab build: cosmetic: split usage string for easier formatting 2013-06-04 03:54:14 -04:00
Cory Fields c862d2ff22 build: split the non-gui startup routines into a new file
This will allow each to have its own main(), meaning that we can build a common
base client and simply link in the correct startup object to create the
appropriate binary.
2013-06-04 03:54:14 -04:00
Cory Fields a9380c72be build: prepare to move DetectShutdownThread 2013-06-04 03:53:40 -04:00
Philip Kaufmann 3260b4c090 remove GetBoolArg() fDefault parameter defaulting to false
- explicitly set the default of all GetBoolArg() calls
- rework getarg_test.cpp and util_tests.cpp to cover this change
- some indentation fixes
- move macdockiconhandler.h include in bitcoin.cpp to the "our headers"
  section
2013-06-01 12:53:57 +02:00
Jeff Garzik 6bc6d57303 Merge pull request #2716 from laanwj/2013_05_30_getwork
Move pMiningKey init out of StartRPCThreads
2013-05-30 09:15:16 -07:00
Jeff Garzik 3fad76bf83 Merge pull request #2642 from sipa/rightgenesis
Check for correct genesis
2013-05-30 08:04:02 -07:00
Jeff Garzik 1803fa1db9 Merge pull request #2693 from jgarzik/checkpoint-bool
Replace repeated GetBoolArg() calls with Checkpoint::fEnabled variable set once at init time
2013-05-30 07:44:42 -07:00
Wladimir J. van der Laan d98bf10f23 Move pMiningKey init out of StartRPCThreads
This commit decouples the pMiningKey initialization and shutdown from the RPC
threads.

`getwork` and `getblocktemplate` rely on pMiningKey, and can also be ran
from the debug window in the UI even when the RPC server is not running.

Solves issue #2706.
2013-05-30 16:41:35 +02:00
Pieter Wuille d315eb0a76 Merge pull request #2695 from robbak/init_cpp-explicit_cast
Explictly cast calculation to int, to allow std::min to work.
2013-05-29 19:41:51 -07:00
Gavin Andresen dbc6dea1b2 Fix crash-at-shutdown if exiting before initializing wallet 2013-05-24 15:52:52 -04:00
Jeff Garzik f0d8a52cc0 Replace repeated GetBoolArg() calls with Checkpoint::fEnabled variable
set once at init time.
2013-05-24 11:10:53 -04:00
Robert Backhaus 03f498080a Explictly cast calculation to int, to allow std::max to work. 2013-05-24 23:40:51 +10:00
Pieter Wuille 95c7db3dbf More bestblock records in wallets
Write bestblock records in wallets:
* Every 20160 blocks synced, no matter what (before: none during IBD)
* Every 144 blocks after IBD (before: for every block, slow)
* When creating a new wallet
* At shutdown

This should result in far fewer spurious rescans.
2013-05-22 20:59:36 +02:00
Pieter Wuille 5d274c9927 Check for correct genesis
At startup, check that the expected genesis is loaded. This should prevent
cases where accidentally a datadir from the wrong network is loaded
(testnet vs mainnet, e.g.).
2013-05-12 13:21:03 +02:00
Gavin Andresen 33edd0a477 Merge pull request #2577 from gavinandresen/fee_bandaid
Treat dust outputs as non-standard, un-hardcode TX_FEE constants
2013-05-04 10:15:39 -07:00
Pieter Wuille f309cb76c2 Merge pull request #2606 from gavinandresen/threadfix
Exit cleanly if AppInit2 returns false
2013-05-04 07:43:15 -07:00
Pieter Wuille 674ae7a26f Merge pull request #2558 from sipa/nodbdir
Some database/-related recovery improvements
2013-05-03 15:17:33 -07:00
Gavin Andresen 61a845dcb6 Merge pull request #2566 from sipa/nodef
Allow the default key to be unavailable
2013-05-03 14:33:02 -07:00
Pieter Wuille aa6b3061ee Merge pull request #2603 from sipa/nobestblock
Bugfix: if no bestblock record is present, do a -rescan
2013-05-03 14:08:46 -07:00
Philip Kaufmann 110257a631 small init.cpp changes (strings / Winsock init)
- add a check that requested Winsock version is available
- update some strings
- remove -gen=0 from help-message as this is default
2013-05-03 19:42:12 +02:00
Gavin Andresen 000dc55181 Un-hardcode TX_FEE constants
Allow setting of MIN_TX_FEE / MIN_RELAY_TX_FEE with
-mintxfee / -mintxrelayfee

Default values are the same (0.0001 BTC).
2013-05-03 10:54:31 -04:00
Gavin Andresen d605bc4cd1 Exit cleanly if AppInit2 returns false
Bitcoin-Qt could core dump if application initialization failed in certain ways.

I double-fixed this:
1) qt/bitcoin.cpp now shuts down core threads cleanly if AppInit2 returns false
2) init.cpp now exits before StartNode() if strErrors is set (no reason to StartNode if we're just going to exit immediately anyway).

Tested by triggering all of the various ways AppInit2 can fail, either by passing bogus command-line arguments or just recompiling tweaked code to simulate failure.

This is a partial fix for #2480
2013-05-02 12:26:33 -04:00
Pieter Wuille 2aceeb01a9 Bugfix: if no bestblock record is present, do a -rescan
It is possible to have a wallet.dat file without any bestblock
record at all (if created offline, for example), which - when
loaded into a client with a up-to-date chain - does no rescan and
shows no transactions.

Also make sure to write the current best block after a rescan, so
it isn't necessary twice.
2013-05-01 19:21:55 +02:00
Gavin Andresen 67f93dc513 Merge pull request #2568 from sipa/rlimit
Try to increase file descriptor rlimit if necessary
2013-04-29 13:25:13 -07:00
David Serrano ebd7e8bf91 Accept negative -par values to leave N CPUs free. 2013-04-29 19:35:47 +02:00
Pieter Wuille ba29a5590b Try to increase file descriptor rlimit if necessary
As the default can be too low, especially on OSX.
2013-04-29 01:46:24 +02:00
Wladimir J. van der Laan d23fa49c52 move WSAStartup to init
WSAStartup should be called before using any other socket
functions. BindListenPort is not called if not listening.

Closes #2585.
2013-04-28 08:54:27 +02:00
Pieter Wuille 360cfe142c Allow the default key to be unavailable
This solves the issue where no default key can be added after -salvagewallet.
2013-04-25 19:36:10 +02:00
Pieter Wuille 1859aafef0 Try moving database/ away in case of failure 2013-04-24 01:37:19 +02:00
Philip Kaufmann e79110822e remove duplicate bitdb.Open() code from init
- remove code from step 7, which we already have in step 5 of init
2013-04-24 00:49:50 +02:00
Wladimir J. van der Laan 212b42c623 qt: don't show rpcconnect command line option in help
GUI can't connect to RPC. Showing this option in the help confuses
people, so remove it.
2013-04-11 22:29:05 +02:00
Philip Kaufmann 6a270c5f81 translations update 2013-04-08
- updates for bitcoinstrings.cpp and bitcoin_en.ts
- changes help text for -rpcthreads to match -par
- fix a small glitch with -par to be "-par=<n>"
2013-04-08 08:50:03 +02:00
Philip Kaufmann b001c87126 small indentation, space, formatting fixes (no code changes) 2013-04-06 02:29:33 +02:00
Gavin Andresen 723035bb68 Have Qt poll for shutdown requested, the QT way. 2013-04-03 19:58:47 -04:00
Gavin Andresen b31499ec72 Clean up shutdown process 2013-04-03 19:57:53 -04:00
Gavin Andresen 21eb5adadb Port Thread* methods to boost::thread_group 2013-04-03 19:57:13 -04:00
Gavin Andresen 1b43bf0d3a Rename util.h Sleep --> MilliSleep
Two reasons for this change:
1. Need to always use boost::thread's sleep, even on Windows, so the
sleeps can be interrupted (prior code used Windows' built-in Sleep).

2. I always forgot what units the old Sleep took.
2013-04-03 14:04:21 -04:00
Gavin Andresen c8c2fbe07f Shutdown cleanup prep-work
Create a boost::thread_group object at the qt/bitcoind main-loop level
that will hold pointers to all the main-loop threads.

This will replace the vnThreadsRunning[] array.

For testing, ported the BitcoinMiner threads to use its
own boost::thread_group.
2013-04-03 14:04:21 -04:00
Gavin Andresen 06db61f09e Merge pull request #2431 from jgarzik/gen-bitcoins-init
Move GenerateBitcoins() call out of net.cpp's StartNode()
2013-04-02 08:56:57 -07:00
Wladimir J. van der Laan cf4d976f0e Merge pull request #2387 from Diapolo/translations
translations update 2013-03-19 (bitcoinstrings.cpp / bitcoin_en.ts)
2013-04-01 07:45:11 -07:00
Jeff Garzik a0cafb7945 Move GenerateBitcoins() call out of net.cpp's StartNode()
The internal miner is closely bound to the wallet engine,
not the blockchain engine.
2013-03-31 01:54:27 -04:00
Jeff Garzik ea83336f4e Merge pull request #2411 from TheBlueMatt/master
(finally) Remove IRC Seed support now that lfnet is down.
2013-03-29 08:03:18 -07:00
Jeff Garzik 8455310a7b Merge pull request #2385 from gavinandresen/alertnotify
alertnotify, so bitcoind users can get email/sms/whatever of alerts
2013-03-29 07:49:56 -07:00
Matt Corallo c2efd981aa (finally) Remove IRC Seed support now that lfnet is down. 2013-03-24 19:38:19 -04:00
Philip Kaufmann 967125ca4a blockchain -> block chain (used everywhere else) 2013-03-21 08:23:23 +01:00
Gavin Andresen e5f163a041 -alertnotify=<cmd>
Runs a shell command when an AppliesToMe() alert is received.
%s in the <cmd> string is replaced with the alert.strStatusBar
message.
2013-03-19 15:16:30 -04:00
Gregory Maxwell 124f823714 Deleting everything except the wallet will not help recover from BDB errors.
Now that the wallet is the only thing in BDB any DB open errors must be
from the wallet itself-- so deleting everything else will not likely help.
2013-03-19 10:11:43 -07:00
Philip Kaufmann e1ca89df1f harmonize 2 init messages and remove one
- harmonize the database related init messages
- as we have a thread for importing blocks, that init message is obsolete
2013-03-13 09:17:59 +01:00
Wladimir J. van der Laan 0bd573d666 Merge pull request #2186 from Diapolo/misc_stuff
small changes in init, main, checkpoints.h and bitcoin-qt.pro
2013-02-23 23:52:27 -08:00
Gavin Andresen 49e332f6fc Merge pull request #1974 from kjj2/walletnotify
Add -walletnotify to call an external script on wallet transactions
2013-02-22 08:47:04 -08:00
Mike Hearn 0556bb22e1 Shorten a startup message. It was getting truncated and looks ugly. 2013-02-20 16:35:30 +01:00
Philip Kaufmann 69e0774714 small changes in init, main, checkpoints.h and bitcoin-qt.pro
- remove an unneeded MODAL flag, as MSG_ERROR sets MODAL
- re-order an if-clause in main to have bool checks before a function call
- fix some log messages that used wrong function names
- make a log message use a correct ellipsis
- remove some unneded spaces, brackets and line-breaks
- fix style for adding files in the Qt project
2013-02-20 08:46:38 +01:00
Pieter Wuille f7f3a96b74 Improve block database load error reporting 2013-02-17 23:25:42 +01:00
Pieter Wuille 386037615a Make sure the genesis block is present after reindex 2013-02-01 23:29:59 +01:00
Pieter Wuille 421218d304 Deal with LevelDB errors 2013-01-30 04:30:02 +01:00
Pieter Wuille ef3988ca36 CValidationState framework 2013-01-30 03:56:44 +01:00
Pieter Wuille 56869fc07c Check only 288 blocks at startup by default 2013-01-26 18:57:07 +01:00
Gavin Andresen 63cc7661a5 Merge pull request #2168 from sipa/txindex
Add optional transaction index to databases
2013-01-25 12:55:52 -08:00
Wladimir J. van der Laan 0c16cc73ef Merge pull request #2171 from Diapolo/init
add InitMessage() to noui and use debug.log for GUI
2013-01-19 06:29:34 -08:00
Pieter Wuille 2d1fa42e85 Add optional transaction index to databases
By specifying -txindex when initializing the database, a txid-to-diskpos
index is maintained in the blktree database. This database is used to
help answering getrawtransaction() RPC queries, when enabled.

Changing the -txindex value requires a -reindex; the client will abort
at startup if the database and the specified -txindex mismatch.
2013-01-18 14:39:11 +01:00
Gavin Andresen 0e31ae9818 Merge pull request #2060 from sipa/parallel
Parallel script verification
2013-01-17 16:58:58 -08: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 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
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
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
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 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
Jeff Garzik 3f964b3c50 Remove 'T' from remaining date/time format strings. 2013-01-01 15:28:28 -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
Gavin Andresen f4445f9982 Upgrading to 0.8: re-use blkNNNN.dat files. 2012-12-16 12:23:59 -05: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
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 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
Richard Schwab 303b0009dc Change timestamps to use ISO8601 formatting 2012-12-12 16:32:22 +01: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 89b7019be8 Reconstruct coins/ from scratch when missing. 2012-12-06 17:00:12 +01:00
Pieter Wuille 8a28bb6dee Add -benchmark for reporting block processing times 2012-12-05 23:06:01 +01: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
Jeff Garzik 857b3ad923 Add "checkpoints" option, to permit disabling of checkpoint logic. 2012-11-28 12:07:42 -05: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
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
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 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
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
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 16d9d61f99 Merge pull request #1981 from sipa/caches
Cache size optimizations
2012-11-08 14:17:37 -08: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
kjj2 cae686d31e Add -walletnotify to call an external script on wallet transactions 2012-11-03 10:07:57 -05: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
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
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 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 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 66b02c93e6 Move external block import to separate thread 2012-10-20 01:54:10 +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
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
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
Gavin Andresen eed1785f70 Handle corrupt wallets gracefully.
Corrupt wallets used to cause a DB_RUNRECOVERY uncaught exception and a
crash. This commit does three things:

1) Runs a BDB verify early in the startup process, and if there is a
low-level problem with the database:
  + Moves the bad wallet.dat to wallet.timestamp.bak
  + Runs a 'salvage' operation to get key/value pairs, and
    writes them to a new wallet.dat
  + Continues with startup.

2) Much more tolerant of serialization errors. All errors in deserialization
are reported by tolerated EXCEPT for errors related to reading keypairs
or master key records-- those are reported and then shut down, so the user
can get help (or recover from a backup).

3) Adds a new -salvagewallet option, which:
 + Moves the wallet.dat to wallet.timestamp.bak
 + extracts ONLY keypairs and master keys into a new wallet.dat
 + soft-sets -rescan, to recreate transaction history

This was tested by randomly corrupting testnet wallets using a little
python script I wrote (https://gist.github.com/3812689)
2012-10-08 17:46:45 -04:00
Gavin Andresen 8d5f461cb6 Handle incompatible BDB environments
Before, opening a -datadir that was created with a new
version of Berkeley DB would result in an un-caught DB_RUNRECOVERY
exception.

After these changes, the error is caught and the user is told
that there is a problem and is told how to try to recover from
it.
2012-10-08 17:25:17 -04:00
Gavin Andresen c2bb42168b Merge branch 'BDB_DOWNGRADE' 2012-10-08 17:18:17 -04:00
Gavin Andresen e4954b1297 Handle incompatible BDB environments
Before, opening a -datadir that was created with a new
version of Berkeley DB would result in an un-caught DB_RUNRECOVERY
exception.

After these changes, the error is caught and the user is told
that there is a problem and is told how to try to recover from
it.
2012-10-08 15:51:59 -04:00
Wladimir J. van der Laan bb353618f1 Send --help message to stdout i.s.o stderr
This allows fun stuff such as `bitcoin --help | less`, and more
easy piping to files.

Looking at other tools such as bash, gcc, they all send their help
text to stdout.
2012-10-04 07:56:57 +02:00
Philip Kaufmann d210f4f5b8 fix -Wformat warnings all over the source 2012-10-01 19:45:42 +02:00
Pieter Wuille 842a31ad1b Merge pull request #1862 from kjj2/testports
Fix: when testnet=1 specified, change default RPC port to 18332
2012-09-28 08:03:45 -07:00
kjj2 b202d43076 Fix: when testnet=1 specified, change default ports to 18332 and 18333 2012-09-24 15:26:04 -05: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 52c90a2b2b Import $DataDir/bootstrap.dat automatically, if it exists.
As discussed on IRC. Intended to make using an external blockchain download
solution just a bit easier.
2012-09-24 13:37:03 -04:00
Gavin Andresen 1913b6e2fc Fix double-paren typo 2012-09-06 16:29:59 -04:00
Philip Kaufmann 274b7ab123 remove double logging of startup time, when !fLogTimestamps 2012-09-05 08:36:50 +02:00
Jeff Garzik dcb14198bb init.cpp: fix build error, and possibly-uninit'd warning 2012-09-04 12:24:08 -04:00
Jeff Garzik 38e8f282d2 Merge pull request #1427 from rebroad/StartTimeFix
No need to log start time if it's already being done on every line.
2012-09-04 09:10:47 -07:00
Jeff Garzik 8c7b6c05db Merge pull request #1738 from laanwj/2012_08_boostthread
implement CreateThread with boost::thread
2012-09-04 08:53:05 -07:00
R E Broadley 016178132e No need to log start time if it's already being done on every line. 2012-09-01 14:24:33 +01:00
Philip Kaufmann d93e5986d7 add default value in -timeout description 2012-08-30 23:28:19 +02: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
Luke Dashjr 9655d73f49 Allow building with IPv6 support, but it disabled by default 2012-08-23 21:01:01 +00:00
Pieter Wuille f161a2c211 Fix infinite loops in connection logic 2012-08-22 13:35:33 +02:00
Philip Kaufmann 2d914f89fe add splashscreen message when importing blocks via -loadblock 2012-08-17 14:21:17 +02:00
Philip Kaufmann 3d88c9b4d3 Bitcoin-Qt (Windows only): enable DEP for bitcoin-qt.exe
- this enables DEP on all Windows version which support the
  SetProcessDEPPolicy() call in Kernel32.dll
- use a dynamic approach via GetProcAddress() to not rely on headers or
  compiler libs
- this is the same way the Tor-project does it
2012-08-03 14:51:51 +02: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 06e0e1c853 Merge pull request #1465 from Diapolo/NOUI_showSSLVersion
write used OpenSSL library version to debug.log
2012-08-01 10:08:45 -07:00
Jeff Garzik b5029b87c8 Merge pull request #1396 from rebroad/NoShrinkOption
Make truncating the debug.log file an option.
2012-08-01 09:41:50 -07:00
Philip Kaufmann 6986c779f0 update HelpMessage()
- place "-?" option at first
- re-work description and "\n" usage for Gavins new block creation options
  to better match current description syntax
- ensure no "\n" is in translated strings, which is better for Transifex
2012-07-27 14:03:37 +02: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
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
Philip Kaufmann 31b581bcac write used OpenSSL library version to debug.log 2012-07-04 08:18:03 +02:00
Matt Corallo 6d6c2afb2b Change default send buffer to 1Mb. 2012-07-01 04:17:26 +02:00
Matt Corallo 18c4beb05b Revert "*Always* send a shutdown signal to enable custom shutdown actions"
This reverts commit 896899e0d6.
2012-06-28 15:52:45 +02:00
R E Broadley 7f1de3fec8 Make truncating the debug.log file an option.
Useful for developers who need to refer to futher back in debug.log history, but who don't want to
enable the -debug option and all the verbosity that comes with that.
2012-06-27 23:42:22 +01:00
Pieter Wuille 6c88568fef Merge pull request #973 from TheBlueMatt/diffsendbuffer
Stop processing messages on full send buffer and dont disconnect.
2012-06-27 07:49:28 -07:00
Pieter Wuille 4a52c187d3 Merge pull request #457 from muggenhor/async-ipv6-rpc
IPv6 RPC using asynchronously accepted connections
2012-06-27 07:48:38 -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
Philip Kaufmann a8c20ea946 fix a comment to correctly use -upgradewallet 2012-06-24 18:08:27 +02:00
Jeff Garzik d887f54494 Document -debugnet option in command line help.
Fixes #1507
2012-06-24 10:38:02 -04:00
Giel van Schijndel 415a87ef36 Merge branch 'master' into async-ipv6-rpc 2012-06-24 12:34:15 +02:00
Gregory Maxwell 817ee0d826 Merge pull request #1174 from sipa/torhs
Tor hidden service support
2012-06-23 19:21:13 -07:00
Pieter Wuille 54ce3bad64 Add -tor and related configuration 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
Giel van Schijndel 896899e0d6 *Always* send a shutdown signal to enable custom shutdown actions
NOTE: This is required to be sure that we can properly shut down the RPC
      thread.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-06-17 21:50:49 +02:00
Gregory Maxwell 3bbb49de55 Fix inverted logic for !Discover/!UPNP when !Listen. 2012-06-17 12:13:34 -04:00
Philip Kaufmann 9247134eab introduce a new StartShutdown() function, which starts a thread with Shutdown() if no GUI is used and calls uiInterface.QueueShutdown() if a GUI is used / all direct uiInterface.QueueShutdown() calls are replaced with Shutdown() - this ensures a clean GUI shutdown, even when catching a SIGTERM and allows the BitcoinGUI destructor to get called (which fixes a tray-icon issue and keeps the tray-icon until Bitcoin-Qt exits) 2012-06-12 07:21:03 +02:00
Philip Kaufmann 618b250e34 add used datadir to debug.log 2012-06-05 07:37:07 +02:00
Pieter Wuille 587f929c64 Rework network config settings 2012-05-31 18:12:35 +02:00
Pieter Wuille a52c7a1b65 Merge pull request #1357 from sipa/keyid
Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
2012-05-26 10:17:27 -07:00
Pieter Wuille 1025440184 Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddress
This introduces internal types:
* CKeyID: reference (hash160) of a key
* CScriptID: reference (hash160) of a script
* CTxDestination: a boost::variant of the former two

CBitcoinAddress is retrofitted to be a Base58 encoding of a
CTxDestination. This allows all internal code to only use the
internal types, and only have RPC and GUI depend on the base58 code.

Furthermore, the header dependencies are a lot saner now. base58.h is
at the top (right below rpc and gui) instead of at the bottom. For the
rest: wallet -> script -> keystore -> key. Only keystore still requires
a forward declaration of CScript. Solving that would require splitting
script into two layers.
2012-05-24 20:26:19 +02:00
Pieter Wuille fd61d6f506 Encapsulate public keys in CPubKey 2012-05-24 19:58:12 +02:00
Philip Kaufmann 41c6b8abc6 add client startup time as an entry to debug.log (note: logged time in debug.log differs by a few seconds from the one displayed in the Debug window) / make ClientModel::formatClientStartupTime() return a QString 2012-05-23 18:44:28 +02:00
Jeff Garzik 0134a1c08c Merge branch 'dbenv' into tmp
Conflicts:
	src/db.cpp
2012-05-22 17:45:00 -04:00
Pieter Wuille fa638ec8af Merge pull request #1369 from sipa/bootorder
Reorder AppInit2
2012-05-22 13:54:46 -07:00
Pieter Wuille 63407fd6e2 Merge pull request #917 from mndrix/reopen-log-file
Reopen log file on SIGHUP
2012-05-21 10:04:26 -07:00
Pieter Wuille 7d80d2e3d7 Reorder AppInit2
This reorders AppInit2 into 10 sections:
1)  basic setup (OS stuff, signal handlers)
2)  parameter interactions (softset)
3)  interpreting options without side effects (just setting internal variables)
4)  application initialization (datadir lock, daemonize, pidfile, log file)
5)  network initialization (network params, proxy, binding)
6)  load blockchain
7)  load wallet
8)  import blocks (-loadblock=)
9)  load peers
10) start node/rpc threads
11) finished

This means invalid configurations will be detected as soon as possible
(in particular, before loading the block chain).
2012-05-21 18:43:22 +02:00
Pieter Wuille 46784d0826 Merge pull request #1354 from fanquake/master
Update Header Licenses
2012-05-20 12:27:50 -07:00
Pieter Wuille 6e86c4700b Merge pull request #1363 from Diapolo/remove_strncasecmp
remove strncasecmp() + strnicmp() calls use boost::algorithm::istarts_with()
2012-05-20 12:26:43 -07:00
Wladimir J. van der Laan 239c11d0dd Make testcases build, prevent windows symbol collision 2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan ab1b288fa7 Convert UI interface to boost::signals2.
- Signals now go directly from the core to WalletModel/ClientModel.
  - WalletModel subscribes to signals on CWallet: Prepares for multi-wallet support, by no longer assuming an implicit global wallet.
- Gets rid of noui.cpp, the few lines that were left are merged into init.cpp
- Rename wxXXX message flags to MF_XXX, to make them UI indifferent.
- ThreadSafeMessageBox no longer returns the value `4` which was never used, converted to void.
2012-05-20 10:44:50 +02:00
Wladimir J. van der Laan 563f3efda3 Merge pull request #1323 from Diapolo/string_fixes
translation updates / string updates
2012-05-20 01:34:06 -07:00
Jeff Garzik cd9696fc97 Encapsulate BDB environment inside new CDBEnv class
Cleans up and organizes several scattered functions and variables related to
the BDB env.  Class CDBInit() existed to provide a
guaranteed-via-C++-destructor cleanup of the db environment.

A formal CDBEnv class provides all of this inside a single wrapper.
2012-05-19 20:43:19 -04:00
Philip Kaufmann 00fb08158d remove strncasecmp() + strnicmp() calls and replace that code via boost::algorithm::istarts_with() / do not call ipcInit() on Mac and Windows as this is unneeded currently 2012-05-20 00:48:34 +02:00
Michael Hendricks 9af080c351 Reopen debug.log on SIGHUP
The best log rotation method formerly available was to configure
logrotate with the copytruncate option.  As described in the logrotate
documentation, "there is a very small time slice between copying the
file and truncating it, so some logging data might be lost".

By sending SIGHUP to the server process, one can now reopen the debug
log file without losing any data.
2012-05-18 16:20:03 -06:00
Philip Kaufmann ff0ee876bb change strings to Bitcoin (uppercase), where it is used as a noun and update strings to use "Qt" (and not qt or QT) / update initialisation of notificator to use qApp->applicationName() instead of a static string 2012-05-18 23:13:58 +02:00
Fordy 3a25a2b9b0 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-18 22:02:28 +08:00
Jeff Garzik f9dd136a09 Revert "use _strnicmp (ISO C++) instead of deprecated strnicmp (POSIX) and add missing "#define strncasecmp _strnicmp" in init.cpp"
This reverts commit f4ac41806a.

Reason: breaks build.
2012-05-17 20:14:24 -04:00
Philip Kaufmann f4ac41806a use _strnicmp (ISO C++) instead of deprecated strnicmp (POSIX) and add missing "#define strncasecmp _strnicmp" in init.cpp 2012-05-17 23:20:47 +02:00
Jeff Garzik 7563424f32 Merge pull request #1334 from rebroad/Exiting2Exited
Corrected grammar. As per Principle Of Least Surprise.
2012-05-17 11:29:09 -07:00
R E Broadley 1d764d631f Corrected grammar. As per Principle Of Least Surprise. 2012-05-17 18:52:38 +01:00
Philip Kaufmann 8b4d653663 allow translation of "options" used in the --help message / split translation of RPC console welcome message and remove the need to take care of "<br>" / remove some spaces in strings and misc other stuff related to translations 2012-05-17 15:49:00 +02:00
Jeff Garzik 928d3a011c CAddrDB: Replace BDB-managed addr.dat with internally managed peers.dat 2012-05-16 22:11:19 -04:00
Pieter Wuille 91dace35a1 Do not listen on blocked networks 2012-05-14 17:52:51 +02:00
Pieter Wuille 55bb0cfbb6 Allow binding to the any address, and report failure 2012-05-14 17:52:50 +02:00
Pieter Wuille 0f1707de67 -onlynet instead of -blocknet 2012-05-14 17:52:45 +02:00
Wladimir J. van der Laan 9f5b11e6fd Move help message out of AppInit2
- Solves #1278, attempts to address #1049
- Removes \t's from help message that are removed afterwards anyway
- Moves UI-specific command-line options help to UI code
- Moves "-detachdb" out of #ifdef USE_UPNP
2012-05-13 18:41:19 +02:00
Pieter Wuille 9fc0a15cd4 Merge pull request #1285 from sipa/initerror
Improve error reporting at startup
2012-05-13 06:01:21 -07:00
Pieter Wuille ac7c7ab99a Improve error reporting at startup 2012-05-13 12:35:39 +02:00
Wladimir J. van der Laan 67d4cbab46 Move GetStartOnSystemStartup and SetStartOnSystemStartup to GUI code 2012-05-13 12:31:28 +02:00
Jeff Garzik 80af836ce0 Merge pull request #1277 from Diapolo/IPv6_IPv4_strings
use "IPv6" and "IPv4" in strings as these are the official spellings
2012-05-12 18:59:31 -07:00
Pieter Wuille 5a3cb32e59 Take -port into account when resolving -bind's 2012-05-13 01:26:14 +02:00
Philip Kaufmann ea933b03b4 use "IPv6" and "IPv4" in strings as these are the official spellings and make ParseNetwork() in netbase.cpp case-insensitive 2012-05-13 01:12:24 +02:00
Pieter Wuille 839c4e7966 Fix initialization of inaddr_any 2012-05-12 17:20:43 +02:00
Pieter Wuille 8f10a28890 Separate listening sockets, -bind=<addr> 2012-05-11 15:29:20 +02:00
Pieter Wuille 457754d2c2 Add -blocknet to prevent connections to a given network 2012-05-11 15:29:19 +02:00
Pieter Wuille 623b987813 Add -noproxy to circumvent proxy for some network 2012-05-11 15:29:19 +02:00
Jeff Garzik 203f9e6c00 Merge branch 'tmp-ipv6' into merge-ipv6 2012-05-08 19:43:17 -04:00
Gregory Maxwell f1ae31d8af Merge pull request #883 from sipa/loadblock
Add -loadblock to load from an external blk000?.dat file
2012-05-08 12:37:27 -07:00
Pieter Wuille 19b6958cfd Added -externalip and -discover
-externalip=<ip> can be used to explicitly set the public IP address
of your node. -discover=0 can be used to disable the automatic public
IP discovery system.
2012-05-04 16:12:23 +02:00
Pieter Wuille 478b01d9a7 Add -seednode connections, and use this for -dnsseed + -proxydns 2012-05-04 16:11:54 +02:00
Pieter Wuille 9bab521df8 Support connecting by hostnames passed to proxy (-proxydns) 2012-05-04 16:11:54 +02:00
Pieter Wuille 60a87bce87 SOCKS5 support by default
Add -socks=<n> to select SOCKS version to use. 4 and 5 are supported,
5 is default.
2012-05-04 16:11:54 +02:00
Philip Kaufmann 00d971e1e7 remove references to bitcoin-wx from comment in init.cpp 2012-05-01 01:59:54 +02:00
Pieter Wuille 83743ed681 Make lsn_reset ("detach databases") optional and off by default.
Add an option -detachdb (and entry in OptionDialog), without which no
lsn_reset is called on addr.dat and blkindex.dat. That means these
files cannot be moved to a new environment, but shutdown can be
significantly faster. The wallet file is always lsn_reset'ed.

-detachdb corresponds to the old behaviour, though it is off by
default now to speed up shutdowns.
2012-04-26 00:31:54 +02:00
Pieter Wuille f4203de302 Make GetDataDir return absolute paths 2012-04-22 17:38:47 +02:00
Pieter Wuille 1d740055da -loadblock to load from an external blk000?.dat file 2012-04-22 03:09:35 +02:00
R E Broadley 871c3557bf Added ability to respond to signals during Block Loading stage. 2012-04-18 12:30:24 +01:00
Pieter Wuille 6b6aaa1698 Further reduce header dependencies
This commit removes the dependency of serialize.h on PROTOCOL_VERSION,
and makes this parameter required instead of implicit. This is much saner,
as it makes the places where changing a version number can have an
influence obvious.
2012-04-17 20:03:42 +02:00
Jeff Garzik 9eace6b113 Move CWalletDB code to new walletdb module.
In addition to standard code separation, this change opens the door
to fixing several include inter-dependencies.
2012-04-17 20:00:55 +02:00
Pieter Wuille ed6d0b5f85 Remove headers.h 2012-04-17 20:00:55 +02:00
Pieter Wuille ee12c3d60c Use filesystem::path instead of manual string tinkering
Where possible, use boost::filesystem::path instead of std::string or
char* for filenames. This avoids a lot of manual string tinkering, in
favor of path::operator/.

GetDataDir is also reworked significantly, it now only keeps two cached
directory names (the network-specific data dir, and the root data dir),
which are decided through a parameter instead of pre-initialized global
variables.

Finally, remove the "upgrade from 0.1.5" case where a debug.log in the
current directory has to be removed.
2012-04-11 22:30:23 +02:00
Pieter Wuille 702764f53b Merge pull request #1054 from sipa/buildinfo
Build identification strings
2012-04-10 13:31:12 -07:00
Pieter Wuille a20c0d0f67 Build identification strings
All client version information is moved to version.cpp, which optionally
(-DHAVE_BUILD_INFO) includes build.h. build.h is automatically generated
on supporting platforms via contrib/genbuild.sh, using git describe.

The git export-subst attribute is used to put the commit id statically
in version.cpp inside generated archives, and this value is used if no
build.h is present.

The gitian descriptors are modified to use git archive instead of a
copy, to create the src/ directory in the output. This way,
src/src/version.cpp will contain the static commit id. To prevent
gitian builds from getting the "-dirty" marker in their git-describe
generated identifiers, no touching of files or running sed on the
makefile is performed anymore. This does not seem to influence
determinism.
2012-04-10 18:16:53 +02:00
Pieter Wuille f8dcd5ca6f Use scoped locks instead of CRITICAL_BLOCK 2012-04-09 01:59:46 +02:00
Pieter Wuille e88ed65a39 Flush on log size instead of transaction count 2012-04-05 20:29:47 +02:00
Gavin Andresen 5ce4c2a23a Remove USE_SSL #define 2012-04-04 21:19:27 -04:00
Wladimir J. van der Laan 7cfbe1fee4 qtui.h/noui.h interface cleanup
- rename wxMessageBox, remove redundant arguments to noui/qtui calls
- also, add flag to force blocking, modal dialog box for disk space warning etc
- clarify function naming
- no more special MessageBox needed from AppInit2, as window object is created before calling AppInit2
2012-04-04 09:37:25 +02:00
Wladimir J. van der Laan 55f69a4700 move QT_PLUGINS stuff to qt main file, where it belongs 2012-04-04 08:46:12 +02:00
Wladimir J. van der Laan 52d3a48128 VC2010 compile fixes 2012-04-03 20:22:41 +02:00
Pieter Wuille 439e1497e1 Introduce explicit -walletupgrade option
Do not automatically change the wallet format unless the user takes an
explicit action that implies an upgrade (encrypting, for now), or uses
-walletupgrade.

-walletupgrade optionally takes an integer argument: the client version
up to which upgrading is allowed. Without an argument, it is upgraded
to latest supported version. If an argument to -walletupgrade is
provided at the time the wallet is created, the new wallet will initially
not use features beyond that version.

Third, the current wallet version number is reported in getinfo.
2012-03-22 23:47:29 +01:00
Gavin Andresen 958fe01c32 Merge branch 'checklevel' of https://github.com/sipa/bitcoin 2012-03-22 12:18:56 -04:00
Gavin Andresen a6b4a11385 Merge branch 'addrman' of https://github.com/sipa/bitcoin 2012-03-22 09:19:01 -04:00
Gavin Andresen 0e894be626 Merge pull request #964 from sipa/fastblocks
Speed up block downloading
2012-03-22 06:17:44 -07:00
Pieter Wuille 4538e45c46 Add -checklevel and improve -checkblocks
-checkblocks now takes a numeric argument: the number of blocks that must
be verified at the end of the chain. Default is 2500, and 0 means all
blocks.

-checklevel specifies how thorough the verification must be:
0: only check whether the block exists on disk
1: verify block validity (default)
2: verify transaction index validity
3: check transaction hashes
4: check whether spent txouts were spent within the main chain
5: check whether all prevouts are marked spent
6: check whether spent txouts were spent by a valid transaction that consumes them
2012-03-22 03:19:23 +01:00
Gavin Andresen 8f188ece3c Remove -bip16 and -paytoscripthashtime command-line arguments 2012-03-21 15:45:58 -04:00
Pieter Wuille 89516bd4e0 Speed up block downloading 2012-03-21 01:32:00 +01:00
Luke Dashjr 21e875c958 Print wallet load errors (to debug.log) 2012-03-11 17:57:47 -04:00
Gavin Andresen 46aa2a6bdd Move BIP16 switchover time to April 1 2012-02-27 11:41:20 -05:00
Gavin Andresen 3f8cb2c565 Reworked QT settings 2012-02-26 23:38:28 +01:00
Gavin Andresen 972060ce0e bitcoind changes to stop storing settings in wallet.dat. 2012-02-26 23:21:33 +01:00
Chris Moore ec4efde40c Add option "-splash" so we can disable the splash screen.
Don't show splash screen when -min is specified on the command line.
2012-02-24 19:17:22 -08:00
Pieter Wuille 5fee401fe1 CAddrMan: stochastic address manager
Design goals:
 * Only keep a limited number of addresses around, so that addr.dat does not grow without bound.
 * Keep the address tables in-memory, and occasionally write the table to addr.dat.
 * Make sure no (localized) attacker can fill the entire table with his nodes/addresses.

See comments in addrman.h for more detailed information.
2012-02-24 13:41:04 +01:00
Pieter Wuille 92d5864b80 Leave IRC enabled by default on testnet
As testnet has neither DNS seeds or built-in seed addresses to
bootstrap from.
2012-02-22 05:19:09 +01:00
Wladimir J. van der Laan f7b8f824de Merge pull request #857 from laanwj/2012_02_fixhelpwindow
On windows, show message box with help, as there is no stderr (fixes #702)
2012-02-20 08:56:41 -08:00
Wladimir J. van der Laan 72075edafb Allow setting UI language from commandline (implements #678) 2012-02-17 18:47:31 +01:00
Wladimir J. van der Laan a3f3e54eee Change #ifdef GUI to #ifdef QT_GUI, GUI is not defined anymore... 2012-02-17 18:01:01 +01:00
Wladimir J. van der Laan bc5e6b9f21 On windows, show message box with help, as there is no stderr (fixes #702) 2012-02-17 17:55:46 +01:00
Wladimir J. van der Laan 39231e9105 don't allow -daemon in bitcoin-qt (changes only #defines) 2012-02-17 14:47:56 +01:00
Wladimir J. van der Laan 2e5a781c64 Enable accessible widgets Qt module on win32, so that people with screen readers such as NVDA can make sense of it. 2012-02-10 08:28:32 +01:00
Gavin Andresen 882164196e Update all copyrights to 2012 2012-02-07 11:28:30 -05:00
Gavin Andresen 9d952d17bb Look for flushwallet/listen/irc/dnsseed/upnp instead of noflushwallet/etc. And switch default for irc to 0. 2012-02-07 09:14:31 -05:00
Gavin Andresen 7bf8b7c25c -bip16 option (default: 1) to support / not support BIP 16. And bumped default BIP16 switchover date from Feb 15 to Mar 1 2012-02-06 16:27:05 -05:00
Gavin Andresen 8beb917c6c Allow -upnp to override setting in wallet (and simplify logic a bit) 2012-02-01 13:24:15 -05:00
Wladimir J. van der Laan 70f55355e2 Merge pull request #593 (Full URL Support in bitcoin-qt) 2012-01-26 19:00:02 +01:00
Pieter Wuille c981d768b3 Fix handling of default ports 2012-01-17 02:12:35 +01:00
Matt Corallo b24e6e4d1b Add -keepnode which attempts to -addnode and keep a connection open 2012-01-12 22:13:16 -05:00
Gavin Andresen 3f64fa1369 Merge pull request #743 from gavinandresen/blocknotify
-blocknotify : run a command when best-block changes
2012-01-12 06:31:25 -08:00
Pieter Wuille 67a42f929b Network stack refactor
This introduces CNetAddr and CService, respectively wrapping an
(IPv6) IP address and an IP+port combination. This functionality used
to be part of CAddress, which also contains network flags and
connection attempt information. These extra fields are however not
always necessary.

These classes, along with logic for creating connections and doing
name lookups, are moved to netbase.{h,cpp}, which does not depend on
headers.h.

Furthermore, CNetAddr is mostly IPv6-ready, though IPv6
functionality is not yet enabled for the application itself.
2012-01-06 18:55:37 +01:00
Matt Corallo 7d145a0f59 Add support for opening bitcoin: URIs directly. 2012-01-05 00:29:28 -05:00
Gavin Andresen d237f62c23 -blocknotify=command argument, implemented using system() and boost::thread 2012-01-03 15:48:59 -05:00
Gavin Andresen 8677f9c751 I broke -testnet with my TOR option-parsing fixes. 2012-01-03 11:17:24 -05:00
Gavin Andresen 0fcf91ea1e Fix issue #659, and cleanup wallet/command-line argument handling a bit 2012-01-03 10:17:28 -05:00
Wladimir J. van der Laan bde280b9a4 Revert "Use standard C99 (and Qt) types for 64-bit integers"
This reverts commit 21d9f36781.
2011-12-21 22:33:19 +01:00
Luke Dashjr 21d9f36781 Use standard C99 (and Qt) types for 64-bit integers 2011-12-20 16:52:59 -05:00
Gavin Andresen f06e3e0ea6 Merge pull request #717 from TheBlueMatt/installerqtupgrade
Implement "Start on window system startup" on Win32 + Linux.
2011-12-20 11:42:53 -08:00
Matt Corallo f18a119ac0 Implement "Start on window system startup" on Win32 + Linux. 2011-12-20 13:51:06 -05:00
Gavin Andresen 3528650560 Merge pull request #690 from runeksvendsen/qt-cmdline-options-parsing
When using Qt GUI, move parameter-parsing to start of qt/bitcoin.cpp:main()
2011-12-19 12:23:00 -08:00
Gavin Andresen 6e39e7c9b3 Move more newlines out of strings, and fix translations. 2011-12-16 17:13:45 -05:00
Nils Schneider 43421af2e4 move \\n outside _() in --help 2011-12-13 06:46:37 +01:00
Rune K Svendsen 4dba26620c When using Qt GUI, move parameter-parsing to start of qt/bitcoin.cpp:main() 2011-12-09 19:19:27 +01:00
Gavin Andresen 43ae68b5ef Merge pull request #654 from TheBlueMatt/dnsseed-thread
Move DNS Seed lookup to a new thread.
2011-12-02 07:09:41 -08:00
Gavin Andresen e1b1055b46 Add missing command-line arguments to --help/-? output 2011-11-27 14:53:30 -05:00
Matt Corallo 2bc6cecebb Move DNS Seed lookup to a new thread. 2011-11-26 14:28:46 -05:00
Gavin Andresen 1c15f88653 Only remove database log files on shutdown after wallet encryption/rewrite 2011-11-17 14:21:32 -05:00
Gavin Andresen d764d9161e Obsolete keypool and make sure database removes log files on shutdown. 2011-11-15 09:30:16 -05:00
Matt Corallo 5f2e76b8c7 Optionally include additional QT plugins when required to build. 2011-10-25 11:51:34 -04:00
Gavin Andresen 6853e627f1 Fix build on windows and mac
Replaced all occurrences of #if* __WXMSW__ with WIN32,
and all occurrences of __WXMAC_OSX__ with MAC_OSX, and made
sure those are defined appropriately in the makefile and bitcoin-qt.pro.
2011-10-07 11:02:21 -04:00
Gavin Andresen 565c4771b6 Remove wxWidgets
Makefiles now build bitcoind only.
qmake/make in top-level directory is used to build Bitcoin QT
Deleted almost all #ifdef GUI from the code (left one possibly controversial one)
Deleted xpm/ files.
2011-09-26 10:04:04 -04:00
Gavin Andresen 17e2c24645 Merge pull request #517 from gavinandresen/DoSprevention
Denial-of-service prevention
2011-09-26 06:06:16 -07:00
Gavin Andresen 15f3ad4dbd Framework for banning mis-behaving peers 2011-09-21 12:49:53 -04:00
Wladimir J. van der Laan b2d1129f27 bitcoin-qt cannot be used as command line rpc client 2011-09-02 18:05:08 +02:00
Misbakh-Soloviev Vadim A 3f0816e3d9 add russian translation and add unicode compatibility (merges pull request #20) 2011-08-28 14:14:29 +02:00
Wladimir J. van der Laan b90c9ecb13 Merge branch 'master' of https://github.com/bitcoin/bitcoin 2011-08-16 10:28:24 +02:00
Matt Corallo b2120e223a Unify copyright notices.
To a variation on:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2011 The Bitcoin developers
2011-08-09 13:32:52 +02:00
Wladimir J. van der Laan 330c190958 Merge branch 'master' of https://github.com/bitcoin/bitcoin 2011-08-06 18:45:15 +02:00
Matt Corallo 01a509fa26 Don't listen if on TOR (resolves #441). 2011-08-03 22:16:29 +02:00
Wladimir J. van der Laan 10d680cff4 add splash screen 2011-08-02 21:48:59 +02:00
Wladimir J. van der Laan 491ad6db50 Merge remote branch 'upstream/master'
Conflicts:
	src/bitcoinrpc.cpp
2011-07-26 16:47:23 +02:00
Pieter Wuille 03fbd79049 get rid of mapPubKeys
Make CKeyStore's interface work on uint160's instead of pubkeys, so
no separate global mapPubKeys is necessary anymore.
2011-07-17 12:07:59 +02:00
Wladimir J. van der Laan d421117620 Merge branch 'master' of https://github.com/bitcoin/bitcoin 2011-07-15 16:42:44 +02:00
Jeff Garzik 0fa89d8e81 Merge pull request #381 from TheBlueMatt/nminversion
Add minversion to wallet.
2011-07-12 19:34:30 -07:00
Pieter Wuille acd6501610 Prepare codebase for Encrypted Keys. 2011-07-08 15:46:47 +02:00
Wladimir J. van der Laan ae3d0aba15 Sync to bitcoin git e94010b239 2011-07-07 15:22:54 +02:00
Matt Corallo 7ec552676c Add minversion to wallet. 2011-07-05 18:36:01 +02:00
Wladimir J. van der Laan 8fe2308b34 windows build fixes 2011-07-03 22:29:26 +02:00
Jeff Garzik 362efb24c1 Enable DNS seeding by default. 2011-07-01 17:58:03 -04:00
Wladimir J. van der Laan e8ef3da713 update core to d0d80170a2 (CWallet class) 2011-06-26 19:23:24 +02:00
James Burkle ed2c01405f Edited init.cpp to include a check that -datadir exists 2011-06-23 23:43:26 -04:00
Wladimir J. van der Laan 47c6215c22 use #ifdef QT_UI to distinguish Qt UI instead of hardcoded #if 0 2011-06-22 20:11:35 +02:00
mark 3c7ebaedcd fixes for mac build 2011-06-20 07:30:54 -04:00
Shane Wegner 926e14b362 Fix missing includes needed for Boost 1.46. 2011-06-19 15:12:31 -07:00
Wladimir J. van der Laan 0eeb4f5d5b update bitcoin core from git (eeac8727bc) 2011-06-18 18:46:01 +02:00
Pieter Wuille 64c7ee7e6b CWallet class
* A new class CKeyStore manages private keys, and script.cpp depends on access to CKeyStore.
* A new class CWallet extends CKeyStore, and contains all former wallet-specific globals; CWallet depends on script.cpp, not the other way around.
* Wallet-specific functions in CTransaction/CTxIn/CTxOut (GetDebit, GetCredit, GetChange, IsMine, IsFromMe), are moved to CWallet, taking their former 'this' argument as an explicit parameter
* CWalletTx objects know which CWallet they belong to, for convenience, so they have their own direct (and caching) GetDebit/... functions.
* Some code was moved from CWalletDB to CWallet, such as handling of reserve keys.
* Main.cpp keeps a set of all 'registered' wallets, which should be informed about updates to the block chain, and does not have any notion about any 'main' wallet. Function in main.cpp that require a wallet (such as GenerateCoins), take an explicit CWallet* argument.
* The actual CWallet instance used by the application is defined in init.cpp as "CWallet* pwalletMain". rpc.cpp and ui.cpp use this variable.
* Functions in main.cpp and db.cpp that are not used by other modules are marked static.
* The code for handling the 'submitorder' message is removed, as it not really compatible with the idea that a node is independent from the wallet(s) connected to it, and obsolete anyway.
2011-06-15 11:05:55 +02:00
Jeff Garzik 19ea44208f Merge pull request #226 from jordanlewis/betterheaders
Optimize header dependencies; improve Makefile dependency graph
2011-06-14 02:05:57 -07:00
Wladimir J. van der Laan 18cf214528 update bitcoin core to git ce148944c7 2011-06-12 12:27:01 +02:00
Pieter Wuille 76d660ebd3 Faster timeout when connecting
Use non-blocking connects, and a select() call to wait a predefined
time (5s by default, but configurable with -timeout) for either
success or failure. This allows much more connections to be tried
per time unit.

Based on a patch by phantomcircuit.
2011-06-12 00:29:05 +02:00
Wladimir J. van der Laan ba4081c1fc move back to original directory structure 2011-06-11 22:11:58 +02:00
Han Lin Yap a299e551fe Remove unused variable 2011-06-11 03:21:32 -07:00
Pieter Wuille 1c528eeee9 Update transactions already in the wallet when rescanning.
When rescanning, if the scanned transaction is already in the wallet, it
is skipped. However, if someone sends a transaction, does not wait for
confirmation, switches wallets, waits for a block that contains his original
transaction, and switches wallets again, a rescan will leave his wallet
transaction (which has no merkle branch, so no confirmations) untouched.
2011-05-22 17:12:20 +02:00
Jordan Lewis 31f2931281 Only include certain boost headers if necessary. 2011-05-17 18:58:47 -05:00
Jordan Lewis fdd7d04744 Only include strlcpy.h when we have to 2011-05-15 22:23:42 -05:00
Jordan Lewis edd309e537 Only include init.h when we have to 2011-05-15 22:23:37 -05:00
Jordan Lewis 40c2614ef4 Only include net.h when we have to 2011-05-15 22:19:17 -05:00
Jordan Lewis ed0c143242 Only included rpc.h when necessary 2011-05-15 22:19:16 -05:00
Jordan Lewis 1512d5ce64 Only include db.h when we have to. 2011-05-15 22:19:16 -05:00
Wladimir J. van der Laan 223b6f1ba4 make bitcoin include files more modular 2011-05-15 12:04:20 +02:00
Pieter Wuille a6a5bb7c20 Support for name lookups in -connect and -addnode
* A new option -dns is introduced that enables name lookups in
  -connect and -addnode, which is not enabled by default,
  as it may be considered a security issue.
* A Lookup function is added that supports retrieving one or
  more addresses based on a host name
* CAddress constructors (optionally) support name lookups.
* The different places in the source code that did name lookups
  are refactored to use NameLookup or CAddress instead (dns seeding,
  irc server lookup, getexternalip, ...).
* Removed ToStringLog() from CAddress, and switched to ToString(),
  since it was empty.
2011-05-10 23:49:30 +02:00
Jeff Garzik b17be7e14b Manual merge of jaromil's source tree reorg commit.
Conflicts:
	src/sha256.cpp
2011-05-09 14:00:14 -04:00
Jaromil 84c3fb07b0 directory re-organization (keeps the old build system)
there is no internal modification of any file in this commit

files are moved into directories according to established standards in
sourcecode distribution; these directories contain:

 src - Files that are used in constructing the executable binaries,
       but are not installed.

 doc - Files in HTML and text format that document usage, quirks of
       the implementation, and contributor checklists.

 locale - Files that contain human language translation of strings
          used in the program

 contrib - Files contributed from distributions or other third party
 	   implementing scripts and auxiliary programs
2011-04-23 12:10:25 +02:00
Renamed from init.cpp (Browse further)