Commit graph

99 commits

Author SHA1 Message Date
Jeff Garzik
6e3a1a3742 Merge pull request #1304 from rebroad/ShowBlockTimestamp
Show block timestamp
2012-07-05 15:28:42 -07:00
Pieter Wuille
70f6049f71 Remove CTxDB::ReadOwnerTxes.
It seems it wasn't ever used since 0.1.5.
2012-06-20 15:07:48 +02:00
R E Broadley
e69a797990 Show the timestamp for the block.
wrap lines
2012-05-29 20:11:37 +01:00
Jeff Garzik
9ac282ca0c Refactor: add IsChainFile helper. LoadBlockIndex() code movement. 2012-05-23 00:17:07 -04:00
Jeff Garzik
0134a1c08c Merge branch 'dbenv' into tmp
Conflicts:
	src/db.cpp
2012-05-22 17:45:00 -04:00
Jeff Garzik
f94b64c2f3 Prevent crashes due to missing or corrupted database records
Any problems seen during deserialization will throw an uncaught
exception, crashing the entire bitcoin process.  Properly return an
error instead, so that we may at least log the error and gracefully
shutdown other portions of the app.
2012-05-22 15:12:52 -04:00
Jeff Garzik
9c137aaccf BDB: restore DB_PRIVATE flag to environment
Satoshi's commits fdbf76d and c8ad9b8 (SVN import) removed the
DB_PRIVATE flag from the environment.  In part, this enables processes
other than bitcoind to examine the active database environment.

However, this incurs a slight performance penalty versus working
entirely within application memory (DB_PRIVATE).  Because bitcointools
and other direct-BDB-accessing tools are not used by the vast
majority of users, prefer to default with DB_PRIVATE with the option
of disabling it if needed via -privdb=0.
2012-05-21 12:38:45 -04:00
Pieter Wuille
46784d0826 Merge pull request #1354 from fanquake/master
Update Header Licenses
2012-05-20 12:27:50 -07:00
Jeff Garzik
ffe8b77a61 Further CDBEnv encapsulation work. 2012-05-19 20:46:52 -04:00
Jeff Garzik
94e34fa0ad CDB::CDB: properly initialize activeTxn to NULL 2012-05-19 20:45:39 -04:00
Jeff Garzik
8b1202c52c Remove unused nested BDB transaction support 2012-05-19 20:45:39 -04: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
Jeff Garzik
394b9298fa Default to DB_TXN_WRITE_NOSYNC for all transactional operations
* This is safer than DB_TXN_NOSYNC, and does not appear to impact
  performance.
* Applying this to the dbenv is necessary to avoid many fdatasync(2)
  calls on db 5.x
* We carefully and thoroughly flush databases upon shutdown and
  other important events already.
2012-05-19 01:25:06 -04: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
R E Broadley
53d0e6dd6a Report how long DBFlush took. 2012-05-17 22:56:14 +01:00
Jeff Garzik
d17ac27a72 Merge pull request #1316 from jgarzik/dead-code
Remove dead code: CTxDB::EraseBlockIndex(), CBlockIndex::EraseBlockFromDisk()
2012-05-17 08:47:54 -07:00
Jeff Garzik
928d3a011c CAddrDB: Replace BDB-managed addr.dat with internally managed peers.dat 2012-05-16 22:11:19 -04:00
Jeff Garzik
a7d45c5a7a Remove dead code: CTxDB::EraseBlockIndex(), CBlockIndex::EraseBlockFromDisk() 2012-05-15 13:36:25 -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
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
Jeff Garzik
735a60698c Change signed->unsigned at 3 code sites
This resolves signed/unsigned comparison warnings.
2012-04-23 14:14:36 -04: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
031eae7864 Merge pull request #1114 from sipa/lesssync
Reduce sync frequency for blkindex.dat
2012-04-17 14:23:31 -07: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
8f2b50f178 Reduce sync frequency for blkindex.dat
Since auto-remove-db-logs was enabled, each time a CTxDB was closed
outside of the initial download window, it causes a checkpoint + log
cleanup. This is overkill, so reduce the sync frequency to once per
minute at most.
2012-04-17 18:27:18 +02:00
Wladimir J. van der Laan
da7bbd9dfd fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] 2012-04-15 13:40:14 +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
Gavin Andresen
2232717cba Remove path.make_preferred() calls, and fix compiler error in bitcoinrpc RE: boost::system 2012-04-11 14:00:48 -04:00
Pieter Wuille
1a275bac2b Merge pull request #1052 from sipa/scopedlocks
Use scoped locks instead of CRITICAL_BLOCK
2012-04-09 13:25:17 -07:00
Pieter Wuille
f8dcd5ca6f Use scoped locks instead of CRITICAL_BLOCK 2012-04-09 01:59:46 +02:00
Philip Kaufmann
9c24588e73 updated db.cpp to use make_preferred() 2012-04-06 15:29:18 +02:00
Pieter Wuille
e88ed65a39 Flush on log size instead of transaction count 2012-04-05 20:29:47 +02:00
Gavin Andresen
f146061d24 Merge pull request #1010 from sipa/fastblocks2
Use transactions-updated as flush condition
2012-03-29 12:10:30 -07:00
Pieter Wuille
25c5eca893 Use transactions-updated as flush condition
The normal checkpointing during the block chain download is reduced
to every five minutes only, but forced every 200000 updated transactions.
2012-03-29 21:00:31 +02:00
Gavin Andresen
6293a9f87f Workaround hangs when upgrading old addr.dat files 2012-03-29 13:34:07 -04:00
Gavin Andresen
9f18347034 Auto-remove logs, and decrease logfile size to 10M 2012-03-29 09:03:11 -04:00
Pieter Wuille
53cb1a49e7 Use erase instead of rewrite to remove old addr entries 2012-03-26 20:22:38 +02:00
Gavin Andresen
958fe01c32 Merge branch 'checklevel' of https://github.com/sipa/bitcoin 2012-03-22 12:18:56 -04:00
Gavin Andresen
e12d131734 Merge pull request #975 from sipa/versioncheck
Check minversion before loading the rest of the wallet
2012-03-22 09:18:11 -07:00
Gavin Andresen
a6b4a11385 Merge branch 'addrman' of https://github.com/sipa/bitcoin 2012-03-22 09:19:01 -04:00
Pieter Wuille
ef12c2184d Check minversion before loading the rest of the wallet
When a 0.6 wallet with compressed pubkeys is created, it writes a
minversion record to prevent older clients from reading it. If the 0.5
loading it sees a key record before seeing the minversion record however,
it will fail with DB_CORRUPT instead of DB_TOO_NEW.
2012-03-22 04:59:59 +01: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
Pieter Wuille
89516bd4e0 Speed up block downloading 2012-03-21 01:32:00 +01:00
Luke Dashjr
3cc0624932 Print more diagnostic info for the various DB_CORRUPT conditions 2012-03-12 14:01:15 -04:00
Gavin Andresen
972060ce0e bitcoind changes to stop storing settings in wallet.dat. 2012-02-26 23:21:33 +01:00
Pieter Wuille
4a10d4c6dc Fix addrProxy setting
Before 0.6 addrProxy was a CAddress, but netbase changed it to CService.
Retain compatibility by wrapping/unwrapping with a CAddress when saving
or loading.

This commit retains compatibility with 0.6.0rc1 (which wrote the setting
as a CService) by trying to parse twice.
2012-02-25 21:13:34 +01: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