Commit graph

724 commits

Author SHA1 Message Date
Pieter Wuille a96d113962 Rename CWalletInterface to CValidationInterface
It's useful for much more than wallets.
2014-10-20 10:59:12 -07:00
Pieter Wuille afc32c5eea Fix rebuild-chainstate feature and improve its performance
Previous refactorings broke the ability to rebuild the chainstate by deleting the chainstate
directory, resulting in an incorrect "Incorrect or no genesis block found" error message. Fix
that.

Also, improve the performance of ActivateBestBlockStep by using the skiplist to only discover
a few potential blocks to connect at a time, instead of all blocks forever - as we likely bail
out after connecting a single one anyway.
2014-10-14 15:42:01 -07:00
Luke Dashjr c0195b1c31 Bugfix: Remove default from -zapwallettxes description (inaccurate) 2014-10-14 20:13:44 +00:00
Wladimir J. van der Laan 992ab87114
Merge pull request #4942
9406471 Write fee estimate and peers files only when initialized (Wladimir J. van der Laan)
2014-10-14 11:35:17 +02:00
Luke Dashjr 0a08aa8f2a Parameterise command line option defaults, so translations are independent of them 2014-10-11 08:22:26 +00:00
Pieter Wuille d4a42334d4
Merge pull request #4834
7c70438 Get rid of the dummy CCoinsViewCache constructor arg (Pieter Wuille)
ed27e53 Add coins_tests with a large randomized CCoinViewCache test. (Pieter Wuille)
058b08c Do not keep fully spent but unwritten CCoins entries cached. (Pieter Wuille)
c9d1a81 Get rid of CCoinsView's SetCoins and SetBestBlock. (Pieter Wuille)
f28aec0 Use ModifyCoins instead of mutable GetCoins. (Pieter Wuille)
2014-10-08 14:58:16 -07:00
Wladimir J. van der Laan 6860a55ea0
Merge pull request #4979
de10efd add -timeout default as constant and use them (Philip Kaufmann)
2014-10-08 09:16:19 +02:00
Cozz Lovan 3e61eb9c51 minor txindex documentation improvement 2014-10-06 18:52:51 +02:00
Philip Kaufmann de10efd154 add -timeout default as constant and use them
- update help message text
- simplify code in init to check for -timeout
2014-10-06 13:13:25 +02:00
Cozz Lovan 44bc988e7b [Wallet] Do not flush the wallet in AddToWalletIfInvolvingMe(..) 2014-10-03 05:11:27 +02:00
Pieter Wuille 471d38b015
Merge pull request #4980
20a11ff minor variable init changes in init.cpp (Philip Kaufmann)
2014-10-02 04:29:01 +02:00
Wladimir J. van der Laan 3fd192f8b4
Merge pull request #4234
c122f55 qt: Register CAmount metatype (Wladimir J. van der Laan)
a372168 Use a typedef for monetary values (Mark Friedenbach)
2014-10-01 11:28:55 +02:00
Pieter Wuille bf3a5dd7f0
Merge pull request #4796
e8b5f0d Move CBlockIndex, CChain and related code out of main (jtimon)
6db83db Decouple CChain from mapBlockIndex (jtimon)
2014-09-29 06:06:57 +02:00
Mark Friedenbach a372168e77 Use a typedef for monetary values 2014-09-26 15:42:04 -07:00
Cory Fields eee030f6bc autofile: don't copy CAutoFile by value 2014-09-25 19:25:19 -04:00
Philip Kaufmann 20a11ffabf minor variable init changes in init.cpp
- explicit init of pcoinsdbview and pwalletMain (even if not needed, as
  globals are init to NULL, it seems cleaner)
- remove check if (pwalletMain) in Shutdown() as delete is valid even if
  pwalletMain is NULL
2014-09-25 13:49:49 +02:00
Pieter Wuille 7c70438dc6 Get rid of the dummy CCoinsViewCache constructor arg 2014-09-24 03:19:04 +02:00
Wladimir J. van der Laan d6712db354
Also create pid file in non-daemon mode
Always make a pid file, not only when `-daemon` specified.

This is useful for troubleshooting, for attaching debuggers and loggers
and such.

- Write the pid file only after the datadir lock was acquired
- Don't create or remove a pid file on WIN32, and also don't show the option
2014-09-20 11:03:59 +02:00
Wladimir J. van der Laan 94064710b9 Write fee estimate and peers files only when initialized
Fixes #4669.

Move the loading of addresses to StartNode() to make it more
self-contained.
2014-09-18 14:20:18 +02:00
Pieter Wuille dc54e9db98
Merge pull request #4825
8d657a6 Fixing compiler warning C4800: 'type' forcing value to bool 'true' or 'false' (ENikS)
2014-09-16 04:47:55 +02:00
Pieter Wuille 7388b74cd2
Merge pull request #4911
611116d header include cleanup (Philip Kaufmann)
2014-09-16 04:12:52 +02:00
Pieter Wuille 765f398436
Merge pull request #4875
f7e3637 Eliminate extra assignment (Suhas Daftuar)
ec7eb0f When reindexing check for file before trying to open (refactored) (Suhas Daftuar)
2014-09-16 03:21:21 +02:00
Philip Kaufmann 611116d4e3 header include cleanup
- ensures alphabetical ordering for includes etc. in source file headers
2014-09-14 12:43:56 +02:00
Wladimir J. van der Laan 3fa1c81b94
Merge pull request #4885
aa3c697 Store fewer orphan tx by default, add -maxorphantx option (Gavin Andresen)
c74332c Stricter handling of orphan transactions (Gavin Andresen)
2014-09-11 14:46:27 +02:00
Gavin Andresen aa3c697e90
Store fewer orphan tx by default, add -maxorphantx option
There is no reason to store thousands of orphan transactions;
normally an orphan's parents will either be broadcast or
mined reasonably quickly.

This pull drops the maximum number of orphans from 10,000 down
to 100, and adds a command-line option (-maxorphantx) that is
just like -maxorphanblocks to override the default.
2014-09-10 14:09:40 -04:00
Suhas Daftuar ec7eb0fa80 When reindexing check for file before trying to open (refactored) 2014-09-10 13:51:53 -04:00
Adam Weiss e982b574a5 Use explicit fflush() instead of setvbuf()
Flushing after every line when printing to console is desirable when
running with systemd but setvbuf() has slightly different semantics
on Windows that causes warnings.  Just do an explicit fflush() after
each line print to console instead.
2014-09-10 12:48:13 -04:00
jtimon 6db83db3eb Decouple CChain from mapBlockIndex 2014-09-08 22:14:24 +02:00
ENikS 8d657a6517 Fixing compiler warning C4800: 'type' forcing value to bool 'true' or 'false' 2014-09-06 15:59:59 -04:00
Pieter Wuille 145d5be896 Introduce BlockMap type for mapBlockIndex 2014-09-04 02:04:51 +02:00
Wladimir J. van der Laan 93f97aab62
Merge pull request #4768
2e28031 Perform CVerifyDB on pcoinsdbview instead of pcoinsTip (Wladimir J. van der Laan)
2014-09-01 09:42:10 +02:00
jtimon e9dd83f0a9 missing include boost/algorithm/string/replace.hpp 2014-08-29 22:52:41 +02:00
Jeff Garzik 309aa76d27
Merge pull request #4599 2014-08-29 15:23:13 -04:00
Wladimir J. van der Laan 2e280311b8
Perform CVerifyDB on pcoinsdbview instead of pcoinsTip
Bypassing the main coins cache allows more thorough checking with the same
memory budget.

This has no effect on performance because everything ends up in the child
cache created by VerifyDB itself.

It has bugged me ever since #4675, which effectively reduced the
number of checked blocks to reduce peak memory usage.

- Pass the coinsview to use as argument to VerifyDB

- This also avoids that the first `pcoinsTip->Flush()` after VerifyDB
  writes a large slew of unchanged coin records back to the database.
2014-08-27 09:20:33 +02:00
Wladimir J. van der Laan ad49c256c3 Split up util.cpp/h
Split up util.cpp/h into:

- string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach)
- money utilities (parsesmoney, formatmoney)
- time utilities (gettime*, sleep, format date):
- and the rest (logging, argument parsing, config file parsing)

The latter is basically the environment and OS handling,
and is stripped of all utility functions, so we may want to
rename it to something else than util.cpp/h for clarity (Matt suggested
osinterface).

Breaks dependency of sha256.cpp on all the things pulled in by util.
2014-08-26 13:25:22 +02:00
Wladimir J. van der Laan 81212588c0 Remove print() from core functions
Break dependency on util.
2014-08-20 10:43:47 +02:00
Wladimir J. van der Laan 04d6c7d10c
Merge pull request #4605
aa82795 Add detailed network info to getnetworkinfo RPC (Wladimir J. van der Laan)
075cf49 Add GetNetworkName function (Wladimir J. van der Laan)
c91a947 Add IsReachable(net) function (Wladimir J. van der Laan)
60dc8e4 Allow -onlynet=onion to be used (Wladimir J. van der Laan)
2014-08-18 13:37:54 +02:00
Wladimir J. van der Laan aa8279513b
Add detailed network info to getnetworkinfo RPC
This commit adds per-network information to the
getnetworkinfo RPC call:

- Is the network limited?
- Is the network reachable
- Which proxy is used for this network, if any

Inspired by #2575.
2014-08-18 13:36:10 +02:00
Jeff Garzik c7b6117deb Create new signal for notification of new blocks. Use w/ -blocknotify 2014-08-14 12:32:34 -04:00
Wladimir J. van der Laan 5f1b76aaf0
Merge pull request #4615
283a3b8 small ordering cleanup of init help message (Philip Kaufmann)
2014-08-06 16:00:39 +02:00
pryds 2b410c2fe1 Typo, and a few "Bitcoin" -> "Bitcoin Core"
Github-Pull: #4619
2014-08-04 10:30:59 +02:00
Philip Kaufmann 283a3b88b6 small ordering cleanup of init help message 2014-08-01 08:04:46 +02:00
Wladimir J. van der Laan 60dc8e4208 Allow -onlynet=onion to be used
Just an alias for onlynet=tor, but matches the new name
of the proxy option -onion= better.
2014-07-30 15:38:58 +02:00
Wladimir J. van der Laan efec4ec6c5
Merge pull request #4593
d70bc52 Rework block processing benchmark code (Pieter Wuille)
2014-07-30 11:06:33 +02:00
Jeff Garzik 2e7009d67b Avoid querying DNS seeds, if we have open connections.
The goal is to increase independence and privacy.
2014-07-29 11:04:46 -04:00
Wladimir J. van der Laan aaa7076937
Merge pull request #4531
ebdcc36 Add helptexts for -whitelist and rpc prioritisetransaction and switch to bitcoin instead of satoshis (Cozz Lovan)
2014-07-28 14:37:40 +02:00
Pieter Wuille d70bc52ee3 Rework block processing benchmark code
* Replace -benchmark (and the related fBenchmark) with a regular debug option, -debug=bench.
* Increase coverage and granularity of individual block processing steps.
* Add cummulative times.
2014-07-27 00:41:03 +02:00
Wladimir J. van der Laan 98e84aae7a Revert "Relay double-spends, subject to anti-DOS"
This reverts commit d640a3ceab.
2014-07-21 07:46:34 +02:00
Wladimir J. van der Laan 67cc8f25c2 Revert "Remove signal DoubleSpendDetected, use function"
This reverts commit 0da6b3fd18.
2014-07-21 07:46:33 +02:00
Jeff Garzik 3da434a2ef Introduce option to disable relay/mining of bare multisig scripts in TX outputs
First and foremost, this defaults to OFF.

This option lets a node consider such transactions non-standard,
meaning they will not be relayed or mined by default, but other miners
are free to mine these as usual.
2014-07-18 10:16:47 -04:00
Pieter Wuille 09c744c2a8 Make sure CAutoFile for fees estimate goes out of scope 2014-07-16 21:46:01 +02:00
Cozz Lovan ebdcc360b6 Add helptexts for -whitelist and rpc prioritisetransaction and switch to bitcoin instead of satoshis 2014-07-15 05:20:52 +02:00
Rune K. Svendsen bdd5b587fc
Add option to disable 077 umask (create new files with system default umask)
The option is only effective for either wallet-less builds or if
-disablewallet is specified as well.

Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-From: 34d5fc0 4e1a196 bd4307b d53a33b 7e09b36
Github-Pull: #4286
2014-07-14 13:58:57 +02:00
Wladimir J. van der Laan 49d57125f9
qt: Ignore showNormalIfMinimized in initialization or shutdown
Also get rid of ui_interface flag NOSHOWGUI. It's up to the GUI to
decide this.

Fixes #4360.
2014-07-14 10:49:12 +02:00
Wladimir J. van der Laan c9bc398ad9
Merge pull request #4378
dc942e6 Introduce whitelisted peers. (Pieter Wuille)
2014-07-14 10:23:39 +02:00
Zak Wilcox a7e1d503c4 In -? output: -keypool, -gen, -genproclimit depend on ENABLE_WALLET 2014-07-12 06:43:41 +01:00
Pieter Wuille dc942e6f27 Introduce whitelisted peers.
This adds a -whitelist option to specify subnet ranges from which peers
that connect are whitelisted. In addition, there is a -whitebind option
which works like -bind, except peers connecting to it are also
whitelisted (allowing a separate listen port for trusted connections).

Being whitelisted has two effects (for now):
* They are immune to DoS disconnection/banning.
* Transactions they broadcast (which are valid) are always relayed,
  even if they were already in the mempool. This means that a node
  can function as a gateway for a local network, and that rebroadcasts
  from the local network will work as expected.

Whitelisting replaces the magic exemption localhost had for DoS
disconnection (local addresses are still never banned, though), which
implied hidden service connects (from a localhost Tor node) were
incorrectly immune to DoS disconnection as well. This old
behaviour is removed for that reason, but can be restored using
-whitelist=127.0.0.1 or -whitelist=::1 can be specified. -whitebind
is safer to use in case non-trusted localhost connections are expected
(like hidden services).
2014-07-09 20:40:14 +02:00
Philip Kaufmann 00d1980b8f init.cpp: log fee estimates filename on error
- small changes to Shutdown(), buffer __func__, which is now used in
  all LogPrintf() calls and format for better readability
- order using namespace alpabetically
2014-07-09 09:22:36 +02:00
Cozz Lovan d88af56011 Fee fixes 2014-07-08 05:09:19 +02:00
Wladimir J. van der Laan 4252f2928b
Merge pull request #4327
a339a37 error out, when we detect -socks argument (Philip Kaufmann)
0127a9b remove SOCKS4 support from core and GUI (Philip Kaufmann)
2014-07-07 12:45:28 +02:00
Wladimir J. van der Laan 73ac7abd08 Move ui_interface to bitcoin_server.a
There is no need for it in the utility libraries or tools.
Put it in init.cpp, and in the tests separately (as they can't link init).
2014-07-07 09:58:56 +02:00
Philip Kaufmann a339a37b28 error out, when we detect -socks argument 2014-07-07 08:15:14 +02:00
Philip Kaufmann 0127a9be14 remove SOCKS4 support from core and GUI
- now we support SOCKS5 only
2014-07-07 08:15:14 +02:00
Wladimir J. van der Laan 00fa78c35b
Merge pull request #3764
2e36866 Show nodeid instead of addresses (for anonymity) unless otherwise requested. (R E Broadley)
2014-07-04 08:04:30 +02:00
Wladimir J. van der Laan e61c6d69ad
Merge pull request #4450
0da6b3f Remove signal DoubleSpendDetected, use function (Tom Harding)
88dd359 Check signatures before respend relay (Tom Harding)
2014-07-04 05:50:53 +02:00
R E Broadley 2e36866fec Show nodeid instead of addresses (for anonymity) unless otherwise requested. 2014-07-04 09:38:44 +07:00
Gavin Andresen 13fc83c77b
Move fee policy out of core 2014-07-03 14:42:16 -04:00
Gavin Andresen b33d1f5ee5
Use fee/priority estimates in wallet CreateTransaction
The wallet now uses the mempool fee estimator with a new
command-line option: -txconfirmtarget (default: 1) instead
of using hard-coded fees or priorities.

A new bitcoind that hasn't seen enough transactions to estimate
will fall back to the old hard-coded minimum priority or
transaction fee.

-paytxfee option overrides -txconfirmtarget.

Relaying and mining code isn't changed.

For Qt, the coin control dialog now uses priority estimates to
label transaction priority (instead of hard-coded constants);
unspent outputs were consistently labeled with a much higher
priority than is justified by the free transactions actually
being accepted into blocks.

I did not implement any GUI for setting -txconfirmtarget; I would
suggest getting rid of the "Pay transaction fee" GUI and replace
it with either "target number of confirmations" or maybe
a "faster confirmation <--> lower fee" slider or select box.
2014-07-03 13:44:33 -04:00
Wladimir J. van der Laan 4278b1df45
Clarify error message when invalid -rpcallowip
Also add to HelpMessage() what specifications are valid.
2014-07-03 07:11:59 +02:00
Tom Harding 0da6b3fd18 Remove signal DoubleSpendDetected, use function
Also removes the need for forward reference to RelayableRespend.
2014-07-02 09:27:29 -07:00
Wladimir J. van der Laan b29b509612
Merge pull request #4325
4aaa017 rework help messages for fee-related options (Philip Kaufmann)
2014-07-01 12:55:33 +02:00
Tom Harding 9004798e62 Add -respendnotify option and new RPC data
-respendnotify=<cmd> Execute command when a network tx respends wallet
tx input (%s=respend TxID, %t=wallet TxID)

Add respendsobserved array to gettransaction, listtransactions, and
listsinceblock RPCs.  This omits the malleated clones that are included
in the walletconflicts array.

Add RPC help for respendsobserved and walletconflicts (help was missing
for the latter).
2014-06-27 07:54:21 -07:00
Tom Harding d640a3ceab Relay double-spends, subject to anti-DOS
Allows network wallets and other clients to see transactions that respend
a prevout already spent in an unconfirmed transaction in this node's mempool.

Knowledge of an attempted double-spend is of interest to recipients of the
first spend.  In some cases, it will allow these recipients to withhold
goods or services upon being alerted of a double-spend that deprives them
of payment.

As before, respends are not added to the mempool.

Anti-Denial-of-Service-Attack provisions:
 - Use a bloom filter to relay only one respend per mempool prevout
 - Rate-limit respend relays to a default of 100 thousand bytes/minute
 - Define tx2.IsEquivalentTo(tx1): equality when scriptSigs are not considered
 - Do not relay these equivalent transactions

Remove an unused variable declaration in txmempool.cpp.
2014-06-27 07:54:21 -07:00
Luke Dashjr e44fea55ea Add an option to allow users to disable relaying/mining data carrier transactions 2014-06-26 14:31:06 +00:00
Wladimir J. van der Laan 0410d11b3a
Merge pull request #4130
1c750db remove -tor compatibility code (only allow -onion) (Philip Kaufmann)
2014-06-24 17:51:32 +02:00
Wladimir J. van der Laan d4392c8989
Merge pull request #3674
77cbd46 Let -zapwallettxes recover transaction meta data (Cozz Lovan)
2014-06-24 17:04:52 +02:00
Philip Kaufmann 1c750dbd40 remove -tor compatibility code (only allow -onion)
- exit, if -tor option is found and give error to user
2014-06-24 16:07:20 +02:00
Cory Fields f3967bcc50 build: fix build weirdness after 54372482.
bitcoin-config.h moved, but the old file is likely to still exist when
reconfiguring or switching branches. This would've caused files to not rebuild
correctly, and other strange problems.

Make the path explicit so that the old one cannot be found.

Core libs use config/bitcoin-config.h.

Libs (like crypto) which don't want access to bitcoin's headers continue
to use -Iconfig and #include bitcoin-config.h.
2014-06-23 14:04:38 -04:00
Pieter Wuille cf0c47b269 Remove getwork() RPC call 2014-06-21 19:47:39 +02:00
Wladimir J. van der Laan b8e56aa8ef
Merge pull request #4339
92a6220 sanity: hook up sanity checks (Cory Fields)
679240d sanity: add libc/stdlib sanity checks (Cory Fields)
11404af sanity: autoconf check for sys/select.h (Cory Fields)
2014-06-18 09:52:50 +02:00
Wladimir J. van der Laan 5694d10781
Merge pull request #4346
1569353 Add `-stopafterblockimport` option (Wladimir J. van der Laan)
2014-06-17 14:51:15 +02:00
Philip Kaufmann 1020f599f3 add comment to HelpMessage() to ensure alphabetical ordering
- also rename hmm to mode, to be consistent between .h and .cpp
2014-06-17 09:17:12 +02:00
Cory Fields 92a6220711 sanity: hook up sanity checks 2014-06-16 17:21:34 -04:00
Cozz Lovan 77cbd4623e Let -zapwallettxes recover transaction meta data 2014-06-16 18:56:57 +02:00
Wladimir J. van der Laan 1569353b8a
Add -stopafterblockimport option
Stop after importing blocks. This can be useful for development
and trouble shooting.
2014-06-16 11:47:32 +02:00
Wladimir J. van der Laan 45615af26f Add 'about' information to -version output
Adds a copyright and attribution message to the `-version` output
(the same as shown in the About dialog in the GUI).

Move the message to a function LicenseInfo in init.cpp.
2014-06-12 16:11:56 +02:00
Philip Kaufmann 4aaa01783d rework help messages for fee-related options
- mention the units and show the default for -paytxfee
2014-06-11 12:16:26 +02:00
Philip Kaufmann 56b07d2dcd [Qt] allow setting listen via GUI
- add DEFAULT_LISTEN in net.h and use in the code (shared
  setting between core and GUI)

Important: This makes it obvious, that we need to re-think the
settings/options handling, as GUI settings are processed before
any parameter-interaction (which is mostly important for network
stuff) in AppInit2()!
2014-06-11 12:04:17 +02:00
Wladimir J. van der Laan d01574f792
Merge pull request #4277
4a09e1d key.cpp: fail with a friendlier message on missing ssl EC support (Andrew Poelstra)
2014-06-11 08:34:25 +02:00
Wladimir J. van der Laan 62fdf381fa
Merge pull request #3824
f0a83fc Use Params().NetworkID() instead of TestNet() from the payment protocol (jtimon)
2871889 net.h was using std namespace through chainparams.h included in protocol.h (jtimon)
c8c52de Replace virtual methods with static attributes, chainparams.h depends on protocol.h instead of the other way around (jtimon)
a3d946e Get rid of TestNet() (jtimon)
6fc0fa6 Add RPCisTestNet chain parameter (jtimon)
cfeb823 Add RequireStandard chain parameter (jtimon)
21913a9 Add AllowMinDifficultyBlocks chain parameter (jtimon)
d754f34 Move majority constants to chainparams (jtimon)
8d26721 Get rid of RegTest() (jtimon)
cb9bd83 Add DefaultCheckMemPool chain parameter (jtimon)
2595b9a Add DefaultMinerThreads chain parameter (jtimon)
bfa9a1a Add MineBlocksOnDemand chain parameter (jtimon)
1712adb Add MiningRequiresPeers chain parameter (jtimon)
2014-06-09 12:52:29 +02:00
Gavin Andresen 171ca7745e estimatefee / estimatepriority RPC methods
New RPC methods: return an estimate of the fee (or priority) a
transaction needs to be likely to confirm in a given number of
blocks.

Mike Hearn created the first version of this method for estimating fees.
It works as follows:

For transactions that took 1 to N (I picked N=25) blocks to confirm,
keep N buckets with at most 100 entries in each recording the
fees-per-kilobyte paid by those transactions.

(separate buckets are kept for transactions that confirmed because
they are high-priority)

The buckets are filled as blocks are found, and are saved/restored
in a new fee_estiamtes.dat file in the data directory.

A few variations on Mike's initial scheme:

To estimate the fee needed for a transaction to confirm in X buckets,
all of the samples in all of the buckets are used and a median of
all of the data is used to make the estimate. For example, imagine
25 buckets each containing the full 100 entries. Those 2,500 samples
are sorted, and the estimate of the fee needed to confirm in the very
next block is the 50'th-highest-fee-entry in that sorted list; the
estimate of the fee needed to confirm in the next two blocks is the
150'th-highest-fee-entry, etc.

That algorithm has the nice property that estimates of how much fee
you need to pay to get confirmed in block N will always be greater
than or equal to the estimate for block N+1. It would clearly be wrong
to say "pay 11 uBTC and you'll get confirmed in 3 blocks, but pay
12 uBTC and it will take LONGER".

A single block will not contribute more than 10 entries to any one
bucket, so a single miner and a large block cannot overwhelm
the estimates.
2014-06-06 10:44:57 -04:00
Gavin Andresen c6cb21d17a Type-safe CFeeRate class
Use CFeeRate instead of an int64_t for quantities that are
fee-per-size.

Helps prevent unit-conversion mismatches between the wallet,
relaying, and mining code.
2014-06-06 10:34:18 -04:00
Wladimir J. van der Laan 7d4dda7630 Remove global strWalletFile
As it says on the tin. There is no need to have this variable be
global, it's only used in AppInit2.
2014-06-05 14:52:34 +02:00
Philip Kaufmann 5bd02cf715 log used config file to debug.log on startup 2014-06-04 21:19:22 +02:00
Jeff Garzik c79897af31 Merge pull request #4247 from Diapolo/listen
rename fNoListen to fListen and move to net
2014-06-04 15:00:38 -04:00
Wladimir J. van der Laan f0f4904bec
Merge pull request #4258
7b45d94 Make max number of orphan blocks kept in memory a startup parameter (fixes #4253) (shshshsh)
2014-06-04 19:30:44 +02:00
shshshsh 7b45d943b2 Make max number of orphan blocks kept in memory a startup parameter (fixes #4253) 2014-06-04 11:58:18 +00:00
jtimon cb9bd83bba Add DefaultCheckMemPool chain parameter 2014-06-04 13:29:35 +02:00
Andrew Poelstra 4a09e1df51
key.cpp: fail with a friendlier message on missing ssl EC support
Previously if bitcoind is linked with an OpenSSL which is compiled
without EC support, this is seen as an assertion failure "pKey !=
NULL" at key.cpp:134, which occurs after several seconds. It is an
esoteric piece of knowledge to interpret this as "oops, I linked
with the wrong OpenSSL", and because of the delay it may not even
be noticed.

The new output is

: OpenSSL appears to lack support for elliptic curve cryptography. For
more information, visit
https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries
: Initialization sanity check failed. Bitcoin Core is shutting down.

which occurs immediately after attempted startup.

This also blocks in an InitSanityCheck() function which currently only
checks for EC support but should eventually do more. See #4081.
2014-06-03 12:09:51 -07:00
Cozz Lovan 06a91d9698 VerifyDB progress 2014-06-03 15:21:47 +02:00
Philip Kaufmann 53a088154c rename fNoListen to fListen and move to net
- better code readability and it belongs to net
- this is a prerequisite for a pull to add -listen to the GUI
2014-05-29 14:01:39 +02:00
R E Broadley 79d06dc6e0 Remove redundant c_str 2014-05-22 00:23:03 +07:00
Wladimir J. van der Laan deb3572ab1 Add -rpcbind option to allow binding RPC port on a specific interface
Add -rpcbind command option to specify binding RPC service on one
or multiple specific interfaces.

Functionality if -rpcbind is not specified remains the same as before:

- If no -rpcallowip specified, bind on localhost
- If no -rpcbind specified, bind on any interface

Implements part of #3111.
2014-05-13 07:23:23 +02:00
Wladimir J. van der Laan c3ad56f4e0
Merge pull request #4138
783b182 Remove dummy PRIszX macros for formatting (Wladimir J. van der Laan)
2014-05-12 14:01:48 +02:00
shshshsh 283e405c06 Switch stdout to line buffering
Use line buffering (instead of block buffering) so that messages arrive
immediately in systemd-journald, tail -f debug.log, and the like.
2014-05-11 23:09:21 +00:00
Wladimir J. van der Laan 783b182c8f Remove dummy PRIszX macros for formatting
Size specifiers are no longer needed now that we use typesafe tinyformat
for string formatting, instead of the system's sprintf.

No functional changes.

This continues the work in #3735.
2014-05-06 15:29:16 +02:00
Wladimir J. van der Laan 3e578aa9b9
Merge pull request #4114
bfb154e Update build instructions for Berkeley DB (Wladimir J. van der Laan)
d0a2e2e Log BerkeleyDB version at startup (Wladimir J. van der Laan)
2014-05-02 18:14:39 +02:00
Wladimir J. van der Laan e27c4110d9 Remove build-time no-IPv6 setting
The year is 2014. All supported operating systems have IPv6 support,
most certainly at build time (this doesn't mean that IPv6 is configured,
of course).

If noone is exercising the functionality to disable it, that means it
doesn't get tested, and IMO it's better to get rid of it.

(it's also not used consistently in RPC/boost and Net code...)
2014-05-01 12:15:36 +02:00
Wladimir J. van der Laan d0a2e2eb87 Log BerkeleyDB version at startup
Prints the actual version of BerkeleyDB that is linked against, if
wallet support is enabled.

Useful for troubleshooting.

For example:

    2014-05-01 07:44:02 Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)

    2014-05-01 07:54:25 Using BerkeleyDB version Berkeley DB 5.1.29: (October 25, 20 11)
2014-05-01 09:56:14 +02:00
Bardi Harborow ffeb47366d Add nHighTransactionFeeWarning as per #3969. 2014-03-29 05:17:28 -04:00
Philip Kaufmann 5409404d75 add constant for shared (GUI/core) -par settings
- introduce DEFAULT_SCRIPTCHECK_THREADS in main.h
- only show values from -"MAX_HW_THREADS" up to 16 for -par, as it
  makes no sense to try to leave more "cores free" than the system
  supports anyway
- use the new constant in optionsdialog and remove defaults from
  .ui file
2014-03-27 11:54:13 +01:00
Cozz Lovan 7398f4a796 improve command-line options output 2014-03-25 13:09:20 +01:00
Wladimir J. van der Laan fc5d85c4bb
Merge pull request #3806
9e2872c Adjust branding in datadir lock error message (Michagogo)
d30d379 Slightly tweak error when unable to bind port (Michagogo)
2014-03-21 09:58:02 +01:00
Michagogo 9e2872c234 Adjust branding in datadir lock error message 2014-03-12 22:14:11 +02:00
Wladimir J. van der Laan 8a6894ca3e Log which wallet is used during init
Now that the wallet can be selected using -wallet it is important
to log which wallet is being used for later troubleshooting.
2014-03-05 16:15:04 +01:00
Wladimir J. van der Laan f48742c2bf Get rid of C99 PRI?64 usage in source files
Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h
indirectly, so we cannot fix this with just macros.

Trivial commit: apply the following script to all .cpp and .h files:

    # Middle
    sed -i 's/"PRIx64"/x/g' "$1"
    sed -i 's/"PRIu64"/u/g' "$1"
    sed -i 's/"PRId64"/d/g' "$1"
    # Initial
    sed -i 's/PRIx64"/"x/g' "$1"
    sed -i 's/PRIu64"/"u/g' "$1"
    sed -i 's/PRId64"/"d/g' "$1"
    # Trailing
    sed -i 's/"PRIx64/x"/g' "$1"
    sed -i 's/"PRIu64/u"/g' "$1"
    sed -i 's/"PRId64/d"/g' "$1"

After this commit, `git grep` for PRI.64 should turn up nothing except
the defines in util.h.
2014-02-24 09:08:56 +01:00
Wladimir J. van der Laan d5f1e727a8 Don't use PRIx64 formatting derives from inttypes.h
As the tinyformat-based formatting system (introduced in b77dfdc) is
type-safe, no special format characters are needed to specify sizes.

Tinyformat can support (ignore) the C99 prefixes such as "ll" but
chokes on MSVC's inttypes.h defines prefixes such as "I64X". So don't
include inttypes.h and define our own for compatibility.

(an alternative would be to sweep the entire codebase using sed -i to
get rid of the size specifiers but this has less diff impact)
2014-02-22 11:36:37 +01:00
Philip Kaufmann 82e96006ae add constants for shared (GUI/core) -dbcache settings
- adds nDefaultDbCache, nMaxDbCache and nMinDbCache in txdb.h
2014-02-17 15:44:21 +01:00
Pieter Wuille 879b390758 Increase default dbcache to 100 MiB 2014-02-17 15:11:06 +01:00
Wladimir J. van der Laan 129429dd8f
Merge pull request #3643
d54e819 Log warnings when bootstrap files are specified but cannot be opened (Wladimir J. van der Laan)
2014-02-17 10:59:03 +01:00
Wladimir J. van der Laan b8d9058a4d
Merge pull request #3646
5770254 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does. (gubatron)
2014-02-16 11:44:48 +01:00
Jeff Garzik 518f3bdae3 Add -zapwallettxes cli/config option, used for wallet recovery
This diagnostic tool removes all "tx" records from the wallet db,
then forces a full rescan, to rebuild "tx" records accurately.
2014-02-14 11:33:07 -05:00
Wladimir J. van der Laan 1bbca249b2 Add option to avoid spending unconfirmed change 2014-02-11 12:49:33 +01:00
gubatron 57702541a2 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014.
contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
2014-02-09 21:06:06 -05:00
Wladimir J. van der Laan d54e819f65 Log warnings when bootstrap files are specified but cannot be opened
- Log a warning when bootstrap files are specified using `-loadblock`
but cannot be opened.
- Log a warning when bootstrap.dat exists in the home directory
but cannot be opened.
2014-02-09 09:12:57 +01:00
Wladimir J. van der Laan 9b818ed8bf
Merge pull request #3588
df966d1 log parameter interactions to debug.log (Philip Kaufmann)
2014-01-30 08:47:10 +01:00
Pieter Wuille 75f51f2a63 Prepare block connection logic for headers-first.
This changes the block processing logic from "try to atomically switch
to a new block" to a continuous "(dis)connect a block, aiming for the
assumed best chain".

This means the smallest atomic operations on the chainstate become
individual block connections or disconnections, instead of entire
reorganizations. It may mean that we try to reorganize to one block,
fail, and rereorganize again to the old block. This is slower, but
doesn't require unbounded RAM.

It also means that a ConnectBlock which fails may be no longer called
from the ProcessBlock which knows which node sent it. To deal with that,
a mapBlockSource is kept, and invalid blocks cause asynchronous "reject"
messages and banning (if necessary).
2014-01-27 21:20:41 +01:00
Philip Kaufmann df966d1b24 log parameter interactions to debug.log 2014-01-27 12:08:48 +01:00
Wladimir J. van der Laan 7d9d134bf9 Remove redundant .c_str()s
After the tinyformat switch sprintf() family functions support passing
actual std::string objects.

Remove unnecessary c_str calls (236 of them) in logging and formatting.
2014-01-23 16:05:01 +01:00
Wladimir J. van der Laan 549e69a558
Merge pull request #3449
8b9adca Allow `-noserver` with bitcoind (Wladimir J. van der Laan)
2014-01-08 14:42:07 +01:00
Wladimir J. van der Laan 362755d018
Merge pull request #3427
1ad2636 qt: Prevent non-functional GUI from popping up during Init (Wladimir J. van der Laan)
2013-12-23 09:53:30 +01:00
Wladimir J. van der Laan 8b9adca446 Allow -noserver with bitcoind
Allow running bitcoind without server.

- Default to -server mode (of course) for bitcoind with SoftSetBoolArg
- Remove fForceServer argument from AppInit2
- Move fDaemon to a static variable in bitcoind
2013-12-20 16:07:33 +01:00
Philip Kaufmann 3c955993a4 init: add better formating for some command-line options 2013-12-20 15:44:14 +01:00
Wladimir J. van der Laan f498d43ee2
Merge pull request #3416
9e9056c Remove -logtodebugger (Wladimir J. van der Laan)
2013-12-20 15:03:41 +01:00
Thomas Holenstein df840de5da
Make bitcoin compile without wallet if "db_cxx.h" is not present
Moved includes of "db.h" into #ifdef ENABLE_WALLET blocks or remove
them.
2013-12-19 10:46:41 +01:00
Wladimir J. van der Laan 285cf7a1a6
Merge pull request #3412
c3a7f51 Move `verifymessage` from rpcwallet to rpcmisc (Wladimir J. van der Laan)
723a03d Move `createmultisig` from rpcwallet to rpcmisc (Wladimir J. van der Laan)
452955f Move `validateaddress` from rpcwallet to rpcmisc (Wladimir J. van der Laan)
cd7fa8b Move `nTransactionFee` from main.cpp to wallet.cpp (Wladimir J. van der Laan)
a943bde Move `settxfee` from rpcblockchain to rpcwallet (Wladimir J. van der Laan)
16bc9aa Move `getinfo` from rpcnet to rpcmisc (Wladimir J. van der Laan)
652e156 add new RPC implementation file `rpcmisc.cpp` (Wladimir J. van der Laan)
2013-12-19 10:11:13 +01:00
Wladimir J. van der Laan 03d9dd47f6
Merge pull request #3424
06eb2f2 Seperate out wallet options in help message (Wladimir J. van der Laan)
2013-12-18 08:15:18 +01:00
Philip Kaufmann 46469d0f86 some more small re-branding changes (Bitcoin Core) 2013-12-16 23:36:22 +01:00
Wladimir J. van der Laan 1ad26362c9 qt: Prevent non-functional GUI from popping up during Init
When a InitError or InitWarning happens, the
GUI pops up but is unusable (until Init finishes).

This is caused by showNormalIfMinimized. Add a message
flag to skip this call for Init errors or warnings.
2013-12-16 18:51:30 +01:00
Wladimir J. van der Laan 06eb2f215b Seperate out wallet options in help message
Seperate out the wallet options in HelpMessage, and
don't show them if compiled with --disable-wallet.

Also add documentation for `-disablewallet` option.
2013-12-16 10:23:39 +01:00
Wladimir J. van der Laan 9e9056cd1a Remove -logtodebugger
`-logtodebugger` is a strange, obscure, WIN32-only (mostly MSVC) thing.
Let's clean up the options a bit get rid of it.

test_bitcoin was using fLogToDebugger as a way to prevent logging to
debug.log. For this, add a boolean (not exposed as option) fLogToDebugLog that
defaults to true and is disabled in the tests.
2013-12-15 10:12:38 +01:00
Wladimir J. van der Laan cd7fa8bb43 Move nTransactionFee from main.cpp to wallet.cpp
Transaction fee is only used by the wallet.
No need for it to be in main.cpp.
2013-12-13 16:34:57 +01:00
Philip Kaufmann a9a37c8bb5 update help for -blockmaxsize and blockprioritysize
- was left out in #3326
2013-12-13 10:01:21 +01:00
Wladimir J. van der Laan 6939a0d50e
Merge pull request #3350
fdbdb7f cleanup includes in rpcnet.cpp (Philip Kaufmann)
b6aafca some string and indentation updates in init/rpcclient (Philip Kaufmann)
2013-12-10 12:37:43 +01:00
Gavin Andresen d47bbbd261 Merge pull request #3368 from laanwj/2013_11_disable_wallet_mining
Allow mining RPCs with --disable-wallet
2013-12-09 19:36:39 -08:00
Philip Kaufmann b6aafca03d some string and indentation updates in init/rpcclient 2013-12-09 10:09:59 +01:00
Wladimir J. van der Laan 4a85e06750 Allow mining RPCs with --disable-wallet
The following mining-related RPC calls don't use the wallet:

- getnetworkhashps
- getmininginfo
- getblocktemplate
- submitblock

Enable them when compiling with --disable-wallet.
2013-12-09 08:44:57 +01:00
Pieter Wuille b2864d2fb3 Add main-specific node state 2013-12-08 14:51:37 +01:00
Wladimir J. van der Laan 48ba56cdfd Delimit code with #ifdef ENABLE_WALLET
Delimit all code that uses the wallet functions
in implementation files that conditionally use the wallet.
2013-12-04 12:46:13 +01:00
Wladimir J. van der Laan 0b47fe6bdc bitcoin-cli: remove unneeded dependencies (only code movement)
Remove unnecessary dependencies for bitcoin-cli
(leveldb, berkelydb, wallet, RPC server)

Build system changes:
- split libbitcoin.a into libbitcoin_common.a, libbitcoin_server.a and
  libbitcoin_cli.a

Code changes (movement only):
- split up HelpMessage into HelpMessage in init.cpp and HelpMessageCli
  in rpcclient.cpp
- move uiInterface from init.cpp to util.cpp
2013-12-03 09:07:13 +01:00
Wladimir J. van der Laan fb78cc2378 Split up bitcoinrpc (code movement only)
Split bitcoinrpc up into

- rpcserver: bitcoind RPC server
- rpcclient: bitcoin-cli RPC client
- rpcprotocol: shared common HTTP/JSON-RPC protocol code

One step towards making bitcoin-cli independent from the rest
of the code, and thus a smaller executable that doesn't have to
be linked against leveldb.

This commit only does code movement, there are no functional changes.
2013-11-27 06:00:29 +01:00
Gavin Andresen c8b74258ba setgenerate creates multiple blocks in -regtest mode
I'm writing some wallet regression tests using -regtest mode, and
need to generate an initial multi-hundred-block chain. Repeatedly
calling setgenerate to generate one block is slow and doesn't
work properly, because block creation happens asynchronously.

This adds two features to setgenerate in -regtest mode:

1) Instead of being interpreted as number of threads to start, the
third argument is the number of blocks to generate.

2) setgenerate will not return until the block creation threads
have created the requested number of blocks.
2013-11-22 09:51:13 +10:00
Gavin Andresen 480e75ceab RPC client option: -rpcwait, to wait for server start 2013-11-20 16:00:51 +10:00
Jeff Garzik e6b7e3dc79 Add -disablewallet option, to disable wallet support (and BDB) 2013-11-13 09:22:00 +01:00
Jeff Garzik f9ee7a032b init.cpp: cosmetic indent changes, preparing for no-wallet mode 2013-11-12 13:22:10 +01:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
2013-11-10 09:36:28 -06:00
Wladimir J. van der Laan 25d056a58f Merge pull request #3196 from laanwj/2013_11_nohavegui
No more fHaveGUI
2013-11-05 04:06:08 -08:00
Wladimir J. van der Laan c4f2a002ca Merge pull request #3188 from Diapolo/logtimestamp_def
make -logtimestamps default on and rework help-message
2013-11-04 06:18:23 -08:00
Wladimir J. van der Laan e30bd78f81 No more fHaveGUI
No more specific handling of GUI in bitcoin core.
Replace the last usage of fHaveGUI with a fForceServer
parameter on AppInit2.
2013-11-04 14:36:49 +01:00
Gavin Andresen 319b11607f Refactor: CTxMempool class to its own txmempool.{cpp,h} 2013-11-04 11:27:02 +10:00
Philip Kaufmann 959e62f0c8 make -logtimestamps default on and rework help-message 2013-11-02 22:43:50 +01:00
Philip Kaufmann 3b570559f8 re-work -debug switch handling
- re-work -debug help message text
- make -debug log every debugging information again (even all categories)
- remove unneeded fDebug checks in front of LogPrint()/qDebug(), as that
  check is done in LogPrintf() when category is != NULL (true for all
  LogPrint() calls
- remove fDebug ONLY in code which is NOT performance-critical
- harmonize addrman category name
- deprecate -debugnet usage, should be used via -debug=net and remove the
  corresponding global
2013-10-30 16:02:09 +01:00
Philip Kaufmann 2e11999e2b remove duplicate -rpcsslciphers help message from init 2013-10-22 20:43:19 +02:00
Wladimir J. van der Laan 2a03a39020 Add separate bitcoin-rpc client
This adds an executable `bitcoin-rpc` that only serves as a Bitcoin RPC
client.
The commit does not remove RPC functionality from the `bitcoind` yet,
this functionality should be deprecated but is left for a later version
to give users some time to switch.
2013-10-21 09:22:48 +02:00
Gavin Andresen cc7562b7d2 Merge pull request #3104 from Diapolo/rpcssl-defaultciphers
update default -rpcsslciphers to include TLSv1.2
2013-10-20 19:50:11 -07:00
Pieter Wuille 9b1200c23b
Merge pull request #3119
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20 22:25:44 +02:00
super3 db0e8ccd90 Bump Year Number to 2013 2013-10-20 15:25:06 -04:00
Philip Kaufmann 1728bf0873 update default -rpcsslciphers to include TLSv1.2
- this extends the accepted ciphersuites with TLSv1.2 ones
- also removes !AH, as I could not find documentation on it and the change
  did not result in a changed ciphersuite list (checked via openssl
  ciphers -v)
- closes #3096 (which also contains more details)
2013-10-17 16:11:25 +02:00
Gavin Andresen a5bba245a3 Merge pull request #2981 from gmaxwell/tor2onion
Rename -tor to -onion to better reflect what it does.
2013-10-16 20:14:46 -07:00
Pieter Wuille e4daecda0b Reimplement CBlockLocator's chain-related logic in CChain.
This removes a few unused CBlockLocator methods, and moves the
construction and fork-finding logic to CChain (which can do these
more efficiently, as it has a height-indexable chain available).
It also makes CBlockLocator independent from the validation code.
2013-10-15 11:09:29 +02:00
Pieter Wuille 4c6d41b8b6 Refactor/encapsulate chain globals into a CChain class 2013-10-11 23:25:50 +02:00
Philip Kaufmann ced3c24816 log start and end of Shutdown()
- could be helpful when debugging shutdown related problems
2013-10-02 08:36:47 +02:00
Jeff Garzik b0730874d9 Support absence of wallet (pwalletMain==NULL) in several locations,
notably RPC.
2013-10-01 16:14:37 -04:00
Philip Kaufmann f65dddc7b2 misc small spelling/indentation fixes 2013-10-01 09:47:16 +02:00
Gavin Andresen 881a85a22d Replace printf with LogPrintf / LogPrint 2013-09-18 20:39:25 +10:00
Gavin Andresen e51321fb75 Refactor: OutputDebugStringF -> LogPrint(category, ...) 2013-09-18 20:39:24 +10:00
Philip Kaufmann d78900cc1b fix some cosmetic glitches in the codebase
- rename URL into URI in paymentserver where correct
- add some missing Qt-coding-stuff in paymentserver
- change QSpinBox to QLineEdit as base for BitcoinAmountField in .ui files
  (as this is the result when converting the BAF back into base)
- remove some c_str() and replace with QString::fromStdString()
- remove several new-lines
- remove unneeded spaces
- indentation fixes
2013-09-09 12:36:04 +02:00
Gregory Maxwell 102518fdb7 Rename -tor to -onion to better reflect what it does.
I've seen users confused multiple times thinking they
 should be using -tor to set their tor proxy and then
 finding in horror that they were still connecting to
 the IPv4 internet.

Even Jeff guesses wrong about what the knob does, so
 I think we should rename it. This leaves the old
 knob working, we can pull it out completely in a
 later release.
2013-09-08 04:54:06 -07:00
Cory Fields 35b8af9226 autotools: switch to autotools buildsystem 2013-09-05 21:31:03 -04:00
Pieter Wuille ae6eac667b Merge pull request #2940 from Diapolo/checkpoint
move Checkpoints:fEnabled from step 2 to step 3 in init
2013-08-29 01:59:35 -07:00
Gregory Maxwell 1ef0067eab Merge pull request #2904 from gmaxwell/newaddr-no-passphrase
[QT] Don't ask for a passphrase to getnewaddress.
2013-08-28 11:20:09 -07:00
Philip Kaufmann 60fc1b4034 move Checkpoints:fEnabled from step 2 to step 3 in init
- it belongs to parameter-to-internal flags step, not parameter
  interactions phase
2013-08-25 13:25:21 +02:00
Jeff Garzik 3d86e7cd48 Merge pull request #2618 from fcicq/solaris-support
Partial solaris support
2013-08-24 20:19:24 -07:00
Gregory Maxwell 71ac5052d8 Remove fAllowReuse from GetKeyFromPool.
With the GUI password fix this was always false.
2013-08-23 12:54:50 -07:00
Gavin Andresen a41d5fe019 Payment Protocol: X509-validated payment requests
Add support for a Payment Protocol to Bitcoin-Qt.

Payment messages are protocol-buffer encoded and communicated over
http(s), so this adds a dependency on the Google protocol buffer
library, and requires Qt with OpenSSL support.
2013-08-22 16:18:25 +10:00
Philip Kaufmann a2189fbaf6 update SelectParamsFromCommandLine() handling/order
- move SelectParamsFromCommandLine() from init.cpp to bitcoin.cpp to allow
  to use TestNet() for Bitcoin-Qt instead of GetBoolArg("-testnet", false)
- change order in bitcoind.cpp to match bitcoin.cpp functionality
- hamonize error message strings for missing datadir and failing
  SelectParamsFromCommandLine() in bitcoin.cpp and bitcoind.cpp
- use TestNet() call in splashscreen.cpp
2013-08-22 11:05:45 +10:00
Gavin Andresen 31b28082fe Merge pull request #2891 from gavinandresen/leveldb_printerror
Use HandleError() consistently to handle leveldb errors
2013-08-15 19:02:32 -07:00
Pieter Wuille 2461aba1ac Mempool consistency check 2013-08-15 23:55:35 +02:00
Gavin Andresen 8fa9b5cc45 Merge pull request #2658 from TheBlueMatt/forkalert
Detect any sufficiently long fork and alert the user just like any other alert
2013-08-12 23:33:40 -07:00
Gavin Andresen b35e993200 Use HandleError() consistently to handle leveldb errors 2013-08-12 18:06:17 +10:00
Philip Kaufmann 265e2657b4 remove a newline from a string in init.cpp
- to match all other translatable strings in init.cpp and to simplify
  translations via Transifex
2013-08-06 10:28:52 +02:00
Jeff Garzik d247a5d130 Move internal miner/block creation to separate miner.cpp module.
Public functions referenced elsewhere are added to miner.h.
2013-07-31 09:43:35 -04:00
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