Commit graph

2746 commits

Author SHA1 Message Date
Pieter Wuille
434e4273b9 Add GetKeyBirthTimes to wallet
Compute safe lower bounds on the birth times of all wallet keys. For
pool keys or keys with metadata, the actually stored birth time is
used. For all others, the birth times are inferred from the wallet
transactions.
2013-06-22 17:30:56 +02:00
Pieter Wuille
acc775c554 Add ExtractAffectedKeys to script
This function finds all keys affected by a particular output script,
supporting everything ExtractDestinations supports (pay-to-pubkey,
pay-to-pubkeyhash, multisig) and recurses into subscripts (P2SH).
2013-06-22 16:49:30 +02: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
Pieter Wuille
01b45731b7 Merge pull request #2632 from mikehearn/chainparams
Refactor chain-specific tweaks into a CChainParams class and introduce a regtest mode
2013-06-22 06:56:14 -07:00
Pieter Wuille
4addb2c066 Refactor keytime/metadata and wallet encryption bugfix
Refactor keytime:
* Key metadata is kept in a CWallet::mapKeyMetadata (std::map<CKeyId,CKeyMetadata>).
* When generating a new key, time is put in that map, and new key is written.
* AddKeyPubKey and AddCryptedKey do not take a creation time argument, but instead
  pull it from that map, if it exists there.

Bugfix:
* AddKeyPubKey and AddCryptedKey in CWallet didn't override the CKeyStore
  definition anymore. This is fixed, as they no longed need the nCreationTime
  argument now.

Also a few related other changes:
* Metadata can be overwritten.
* Only GenerateNewKey calls GetTime(), as it's the only place where we know for
  sure a key was not constructed earlier.
* When the nTimeFirstKey is known to be inaccurate, it is set to the value 1
  (instead of 0, which would mean unknown).
* Use CPubKey instead of std::vector<unsigned char> where possible.
2013-06-20 01:31:18 +02:00
Jeff Garzik
f590653377 RPC: add 'verifychain', to verify chain database at runtime 2013-06-19 11:53:02 -04: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
Mike Hearn
70e7fba06d Move implementation of some CBlockLocator methods
Move out of main.h to improve compile times and add documentation
for what the methods do.
2013-06-19 15:39:45 +02:00
Jeff Garzik
25dbb92860 Merge pull request #2760 from cozz/cozz2
fix comment about dust logic
2013-06-18 06:23:58 -07:00
Pieter Wuille
5e6f7cc8ad Merge pull request #2763 from bitsofproof/master
Send tx relay flag with version message
2013-06-17 01:43:11 -07:00
Wladimir J. van der Laan
be77b637fc qt: allow user to choose data directory
This adds an introduction screen that is shown when the client is first
started in which the user can choose a data directory.

It is also possible to force the intro screen to appear using command
line argument `-choosedatadir`.

The user is warned that the client will download and store 10Gb of data.
The intro screen shows how much space is available on the device that
contains the chosen directory and warns if this is less than the 10Gb.

To make it possible to translate the introduction dialog, the initialization
sequence is changed so that translations are
loaded before the data directory. This has the by-effect that it is
no longer possible to specify a language in bitcoin.conf inside the data
directory.
2013-06-16 10:21:41 +02:00
Pieter Wuille
e58154c447 Merge pull request #2648 from Diapolo/txindex
allow txindex to be removed and add a reindex dialog
2013-06-15 07:49:40 -07:00
Pieter Wuille
f5442aeef4 Merge pull request #2766 from theuni/fix-shutdown-deadlock
Fix shutdown deadlock, ticket #2690
2013-06-15 07:40:35 -07:00
Matt Corallo
87cce04c17 Refactor fee rules to make them actually readable.
This (nearly) doesn't change fee rules at all:
 * To make it into the fee transaction area, the dPriority comparison
   changed from < to <=
 * We now just ignore transactions > MAX_BLOCK_SIZE/4 instead of
   doing some calculations to require increasingly large fees as
   size increases.
2013-06-14 13:37:43 +02:00
theuni
e2654c8d28 fixed: don't use thread::sleep_for where it's known to be broken
Fixes #2690.
2013-06-14 00:01:57 -04:00
theuni
f2763d6d60 fixed: include boost header as necessary
Without this include, sometimes BOOST_VERSION was defined and sometimes
it was not, depending on which includes came before it. The result was a
random mix of sleep or sleep_for for boost versions >= 1.50.
2013-06-13 23:40:59 -04:00
Matt Corallo
b1f15b218b Remove broken option to skip input checking for wallet txn. 2013-06-13 22:28:03 +02:00
Vaclav Vobornik
1d626952f9 Added GNU/kFreeBSD kernel name (TARGET_OS)
uname -s returns "GNU/kFreeBSD" on Debian GNU/kFreeBSD port. See http://www.debian.org/ports/kfreebsd-gnu/
2013-06-12 14:46:16 +02:00
bitsofproof
c87f462b74 send tx relay flag with version 2013-06-11 23:29:41 +02:00
Cozz Lovan
346427f01b fix comment about dust logic 2013-06-11 05:06:02 +02:00
Jeff Garzik
d1020b780a Merge pull request #2553 from Diapolo/threads
changes to thread code (directly use boost::thread)
2013-06-10 13:42:59 -07:00
Pieter Wuille
61983b3d16 Merge pull request #1863 from jgarzik/keytime
"Wallet birthdays": store key create time; calc whole-wallet birthday
2013-06-10 13:38:19 -07:00
Philip Kaufmann
53e71135de changes to thread code (directly use boost::thread)
- removes our NewThread() function an replaces remaining calls with
  boost::thread with our TraceThread template
- remove ExitThread() function
- fix THREAD_PRIORITY_ABOVE_NORMAL for non Windows OSes
2013-06-10 19:49:54 +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
Jeff Garzik
543d70a676 Merge pull request #2747 from luke-jr/getblock_verbose0
Add verbose flag to getblock RPC so it is possible to get hex dumps of blocks
2013-06-10 08:16:39 -07:00
Jeff Garzik
8da9dd0725 Wallet: optimize rescan to skip blocks prior to birthday 2013-06-10 09:38:13 -04:00
Jeff Garzik
3869fb89b6 Wallet: store key creation time. Calculate whole-wallet birthday.
This also encapsulate wallet-read state information into CWalletScanState.
2013-06-10 09:36:29 -04:00
Jeff Garzik
f59530ce6e Merge pull request #2154 from CodeShark/dependencycleanup
Clean up code dependencies
2013-06-10 06:17:38 -07:00
Wladimir J. van der Laan
8b313c9331 Merge pull request #2749 from laanwj/2013_06_addtotalbalance
qt: Add total balance in overview page
2013-06-09 01:06:36 -07:00
Wladimir J. van der Laan
3e9c8bab54 Create parent directories if needed in GetDataDir
One-line change. Fixes #2752.
2013-06-08 10:03:23 +02:00
Luke Dashjr
2331952141 RPC: getblock(): Accept 2nd "verbose" parameter, similar to getrawtransaction, but defaulting to 1 for backward compatibility 2013-06-07 17:44:39 +00:00
Wladimir J. van der Laan
cb85aeb06c qt: Add total balance in overview page 2013-06-07 15:33:32 +02:00
Eric Lombrozo
6e68524e95 Removed the main.h include from net.cpp. 2013-06-06 00:04:33 -07:00
Eric Lombrozo
501da2503a Using boost::signals2 to message main from net.cpp. 2013-06-05 23:15:20 -07:00
Eric Lombrozo
aabdf9e899 Moved UpdateTime out of CBlockHeader and moved CBlockHeader into core. 2013-06-05 23:15:20 -07:00
Eric Lombrozo
48343a0a50 Removed script.cpp's dependence on main.h 2013-06-05 23:15:20 -07:00
Eric Lombrozo
65e7bbef74 Moved CCoins, CTxOutCompressor, CTxInUndo, and CTxUndo to core. 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
788536f175 Moved CInPoint to core. Removed GetMinFee from CTransaction and made it a regular function in main. 2013-06-05 23:15:19 -07:00
Eric Lombrozo
effc2770f5 Created core.h/core.cpp, added to makefiles. Started moving core structures from main to core beginning with COutPoint. 2013-06-05 23:14:52 -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
8926263dde Moved PushGetBlocks to main.cpp to eliminate dependence of net.cpp on CBlockLocator. 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
Jeff Garzik
c94bd68547 Merge pull request #2700 from theuni/gui-split
autotools: Gui split
2013-06-05 10:56:24 -07:00
Wladimir J. van der Laan
fc1f360fce Merge pull request #2731 from Diapolo/rpcconsole
Bitcoin-Qt: harmonize 2 setClientModel() functions
2013-06-05 09:27:23 -07:00
Cory Fields
99add01e76 osx: fix bitcoin-qt startup crash when clicking dock icon
Crash probably introduced by 4d17a1b0.
Inialize the window to NULL and verify it before use.
2013-06-04 23:55:35 -04:00
Cory Fields
34994ebcb0 build: cosmetics after last commit 2013-06-04 03:54:14 -04:00
Cory Fields
ee4b170c92 build: use runtime setting for wallet rather than QT_GUI define 2013-06-04 03:54:14 -04: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
13c84b3bd5 build: add global var for whether or not the gui is enabled 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
Wladimir J. van der Laan
c83d4d2170 Merge pull request #2613 from jonasschnelli/prefsFix
MaxOSX: settings fixes (#2371)
2013-06-03 09:17:55 -07:00
Wladimir J. van der Laan
cd945c3bc9 Merge pull request #2727 from TheBlueMatt/master
One more data-driven test-case
2013-06-03 09:14:58 -07:00
Jonas Schnelli
39fe9de6b2 Merge branch 'master' of git://github.com/bitcoin/bitcoin into prefsFix
Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch>

Conflicts:
	bitcoin-qt.pro
2013-06-03 15:18:41 +02:00
Philip Kaufmann
1fc57d568b Bitcoin-Qt: harmonize 2 setClientModel() functions
- harmonize BitcoinGUI::setClientModel() and RPCConsole::setClientModel()
- now RPCConsole::setClientModel() also includes a direct call to
  setNumBlocks()
2013-06-03 14:10:14 +02:00
Jonas Schnelli
f679b2900a MaxOSX: settings fixes (#2371)
- Launch-At-Startup implementation for mac
- Remove "Window" tab in settings

Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch>
2013-06-03 12:26:56 +02:00
Matt Corallo
14c12b094b Add new data-driven test-case. 2013-06-02 20:51:01 +02:00
Philip Kaufmann
80fccb0eb3 Bitcoin-Qt: setup testnet GUI directly
- this directly sets up all GUI elements that have testnet special-casing
  without first setting up main net stuff and changing afterwards (titles,
  icons etc.)
- also fixes 2 wrong icons shown during testnet usage on our toolbar
2013-06-02 17:40:28 +02:00
vhf / victor felder
a35e268da4 Too many bitcoins allowed in amount. (#2401)
Using magic number doesn't seem right. Could we factor this out, together with https://github.com/bitcoin/bitcoin/blob/master/src/bitcoinrpc.cpp#L96 ?
And what about BitcoinUnits::parse() as well ?
2013-06-02 14:44:55 +02:00
Wladimir J. van der Laan
50b4086a4a Merge pull request #2588 from Diapolo/GetBoolArg
remove GetBoolArg() fDefault parameter defaulting to false
2013-06-02 05:21:24 -07: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
Wladimir J. van der Laan
25c0cce7fb Qt5 compatibility
This commit squashes all the changes in the Qt5 branch
relative to master.

Backward compatibility with Qt4 is retained.

Original authors:

- Philip Kaufmann <phil.kaufmann@t-online.de>
- Jonas Schnelli <jonas.schnelli@include7.ch>
2013-06-01 11:05:08 +02:00
Jeff Garzik
3fbd87e0dc Merge pull request #2552 from Diapolo/win-typedef
remove obsolete and unused typedef for Windows
2013-05-30 09:42:47 -07:00
Wladimir J. van der Laan
a2d2e5e466 Merge pull request #2615 from jonasschnelli/mac10_8_not_center
osx: make use of the 10.8+ user notification center to display growl lik...
2013-05-30 09:25:54 -07: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
87ec1929cf Merge pull request #2705 from robbak/crash_zero_size_peers.dat
Don't attempt to resize vector to negative size.
2013-05-30 09:13:44 -07:00
Jeff Garzik
d397715661 Merge pull request #2644 from sipa/constfindblock
Make FindBlockByHeight constant-time
2013-05-30 08:06:44 -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
9c95a2e836 Merge pull request #2625 from gavinandresen/walletlock_asio
Use boost::asio::deadline_timer for walletpassphrase timeout
2013-05-30 08:01:22 -07:00
Jeff Garzik
e2f42142a0 Merge pull request #2600 from sipa/keyrefactor
Refactor key.cpp/.h
2013-05-30 07:55:25 -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
Jeff Garzik
9d01dd7658 Merge pull request #2104 from al42and/listreceivedbyaddress_txids
listreceivedbyaddress now provides tx ids (issue #1149)
2013-05-30 07:42:01 -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
Jeff Garzik
af93273799 Merge pull request #2657 from gmaxwell/its_after_may15_forever
It's after 2013-05-15 forever now, so remove the code for the May 15 fork
2013-05-30 07:35:44 -07:00
Pieter Wuille
896185d7ed Make signature cache store CPubKeys 2013-05-30 05:20:23 +02:00
Pieter Wuille
dfa23b94c2 CSecret/CKey -> CKey/CPubKey split/refactor 2013-05-30 05:20:21 +02:00
Pieter Wuille
5d891489ab Make CPubKey statically allocated 2013-05-30 05:18:42 +02:00
Pieter Wuille
ec0004aca0 Merge pull request #2671 from bytemaster/master
Fix Memory Leak
2013-05-29 20:14:20 -07:00
Pieter Wuille
5a336768ca Merge pull request #2713 from sipa/zerodotnine
Prepare for 0.9 merge window
2013-05-29 20:12:41 -07:00
Pieter Wuille
8c8132be73 Prepare for 0.9 merge window 2013-05-30 04:43:51 +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
Robert Backhaus
98ab2b5a26 Don't attempt to resize vector to negative size. 2013-05-29 12:12:33 +10:00
Wladimir J. van der Laan
09e437ba4e Merge pull request #2696 from robbak/util_h-Add_stdarg_include
Explicitly #include stdarg.h, for access to va_list
2013-05-25 08:48:25 -07:00
Gavin Andresen
ef9acc5124 Bump build number to 0.8.2.2 for v0.8.2rc3 2013-05-24 16:11:44 -04:00
Gavin Andresen
378c526ee1 Merge pull request #2683 from Diapolo/translations
translations update 2013-05-23
2013-05-24 13:07:36 -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
65ec9eab2b Explicitly #include stdarg.h, for access to va_list 2013-05-24 23:45:08 +10:00
Robert Backhaus
03f498080a Explictly cast calculation to int, to allow std::max to work. 2013-05-24 23:40:51 +10:00
Jonas Schnelli
b4b0170595 osx: make use of the 10.8+ user notification center to display growl like notifications
- if 10.8, use user notification center, if <10.8, use growl

Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch>
2013-05-24 12:51:46 +02:00
Gavin Andresen
36e826cea1 Clean up mining CReserveKey to prevent crash at shutdown
Fixes issue#2687
2013-05-23 14:17:15 -04:00
Philip Kaufmann
6a2da2ba96 translations update 2013-05-23
- integrates current translations from Transifex
2013-05-23 08:39:31 +02:00
Gregory Maxwell
95c2ba1689 Merge pull request #2682 from sipa/morewalletbb
More bestblock records in wallets
2013-05-22 14:01:31 -07:00
Gavin Andresen
0c4434cf77 Merge pull request #2652 from gavinandresen/version_0.8.2_final
Set CLIENT_VERSION_IS_RELEASE, bump build to 0.8.2.1
2013-05-22 13:23:38 -07:00
Gavin Andresen
f1e76e8121 Merge pull request #2649 from Diapolo/translations
translations update 2013-05-19 (for 0.8.2 release)
2013-05-22 12:22:45 -07: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