Commit Graph

200 Commits

Author SHA1 Message Date
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