aboutsummaryrefslogtreecommitdiff
path: root/src/db.cpp
AgeCommit message (Collapse)Author
2012-03-22Merge branch 'checklevel' of https://github.com/sipa/bitcoinGavin Andresen
2012-03-22Merge pull request #975 from sipa/versioncheckGavin Andresen
Check minversion before loading the rest of the wallet
2012-03-22Merge branch 'addrman' of https://github.com/sipa/bitcoinGavin Andresen
2012-03-22Check minversion before loading the rest of the walletPieter Wuille
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-22Add -checklevel and improve -checkblocksPieter Wuille
-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-21Speed up block downloadingPieter Wuille
2012-03-12Print more diagnostic info for the various DB_CORRUPT conditionsLuke Dashjr
2012-02-26bitcoind changes to stop storing settings in wallet.dat.Gavin Andresen
2012-02-25Fix addrProxy settingPieter Wuille
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-24CAddrMan: stochastic address managerPieter Wuille
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-18Add SetMinVersion to CWalletPieter Wuille
2012-02-15Added 'Backup Wallet' menu optionsje397
- icon from the LGPL Nuvola set (like the tick) - http://www.icon-king.com/projects/nuvola/ - include 'boost/version.hpp' in db.cpp so that the overwrite version of copy can be used - catch exceptions in BackupWallet (e.g. filesystem_error thrown when trying to overwrite without the overwrite flag set) - include db.h in walletmodel.cpp for BackupWallet function - updated doc/assets-attribution.txt and contrib/debian/copyright with copyright info for new icon
2012-02-07Update all copyrights to 2012Gavin Andresen
2012-02-07Look for flushwallet/listen/irc/dnsseed/upnp instead of noflushwallet/etc. ↵Gavin Andresen
And switch default for irc to 0.
2012-01-26Full checking of all loaded keysPieter Wuille
2012-01-25Check consistency of private keysPieter Wuille
Reported by onlineproof on IRC: Bitcoin does not verify whether private keys and public keys correspond, when loading a wallet.
2012-01-13Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen
2012-01-09Compressed pubkeysPieter Wuille
This patch enabled compressed pubkeys when -compressedpubkeys is passed. These are 33 bytes instead of 65, and require only marginally more CPU power when verifying. Compressed pubkeys have a different corresponding address, so it is determined at generation. When -compressedpubkeys is given, all newly generated addresses will use a compressed key, while older/other addresses keep using normal keys. Unpatched clients will relay and verify these transactions.
2011-12-21Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan
This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
2011-12-20Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr
2011-12-19Use block times for 'hard' OP_EVAL switchover, and refactored EvalScriptGavin Andresen
so it takes a flag for how to interpret OP_EVAL. Also increased IsStandard size of scriptSigs to 500 bytes, so a 3-of-3 multisig transaction IsStandard.
2011-12-19OP_EVAL implementationGavin Andresen
OP_EVAL is a new opcode that evaluates an item on the stack as a script. It enables a new type of bitcoin address that needs an arbitrarily complex script to redeem.
2011-12-19Merge pull request #574 from sipa/dumpprivkeyGavin Andresen
Dumpprivkey
2011-12-19Implement BIP 14 : separate protocol version from client versionGavin Andresen
2011-12-17Make CWalletTx::pwallet privatePieter Wuille
2011-11-20close old db when rewritingv0.5.0rc7v0.5.0Pieter Wuille
2011-11-20Never remove database files on shutdown, it caused unreadable wallets on ↵Gavin Andresen
some testers' machines.
2011-11-17Only remove database log files on shutdown after wallet encryption/rewritev0.5.0rc6Gavin Andresen
2011-11-15Tweak handling of boost filesystem versionsGavin Andresen
2011-11-15Fix crash-on-osx-on-shutdown bug. And cleanup CDB handling in Rewrite.Gavin Andresen
2011-11-15Fix boost filesystem incompatibility problemv0.5.0rc4Gavin Andresen
2011-11-15Obsolete keypool and make sure database removes log files on shutdown.Gavin Andresen
2011-11-14ResilveringPieter Wuille
2011-10-07Fix build on windows and macGavin Andresen
Replaced all occurrences of #if* __WXMSW__ with WIN32, and all occurrences of __WXMAC_OSX__ with MAC_OSX, and made sure those are defined appropriately in the makefile and bitcoin-qt.pro.
2011-10-01remove code that reads addr.txt in LoadAddreses()Nils Schneider
2011-09-26Remove wxWidgetsGavin Andresen
Makefiles now build bitcoind only. qmake/make in top-level directory is used to build Bitcoin QT Deleted almost all #ifdef GUI from the code (left one possibly controversial one) Deleted xpm/ files.
2011-08-31Fix rpc-hanging deadlocksGavin Andresen
Collapsed multiple wallet mutexes to a single cs_wallet, to avoid deadlocks with wallet methods that acquired locks in different order. Also change master RPC call handler to acquire cs_main and cs_wallet locks before executing RPC calls; requiring each RPC call to acquire the right set of locks in the right order was too error-prone.
2011-08-11Merge pull request #458 from TheBlueMatt/copyrightGavin Andresen
Unify copyright notices.
2011-08-10Qualify make_tuple with boost:: namespace.Venkatesh Srinivas
db.cpp has a number of uses of make_tuple and has 'using namespace std' and 'using namespace boost'. Without qualifying make_tuple, std::make_tuple is preferred, which is incorrect. This patch qualifies make_tuple. Signed-off-by: Jeff Garzik <jgarzik@exmulti.com>
2011-08-09Unify copyright notices.Matt Corallo
To a variation on: // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers
2011-07-26CAddrDB::LoadAddresses: properly initialize CAddressJeff Garzik
Fixes issue #424
2011-07-14Fix bad return values in LoadWallet.Matt Corallo
2011-07-13fix warning: unused variable 'X' [-Wunused-variable]Giel van Schijndel
Remove several unused variables. Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-07-12Merge pull request #381 from TheBlueMatt/nminversionJeff Garzik
Add minversion to wallet.
2011-07-13Make an invalid addrIncoming so that old clients crash.Matt Corallo
This prevents old clients from opening, and thus corrupting or otherwise causing harm to encrypted wallets.
2011-07-13Add wallet privkey encryption.Matt Corallo
This commit adds support for ckeys, or enCrypted private keys, to the wallet. All keys are stored in memory in their encrypted form and thus the passphrase is required from the user to spend coins, or to create new addresses. Keys are encrypted with AES-256-CBC using OpenSSL's EVP library. The key is calculated via EVP_BytesToKey using SHA512 with (by default) 25000 rounds and a random salt. By default, the user's wallet remains unencrypted until they call the RPC command encryptwallet <passphrase> or, from the GUI menu, Options-> Encrypt Wallet. When the user is attempting to call RPC functions which require the password to unlock the wallet, an error will be returned unless they call walletpassphrase <passphrase> <time to keep key in memory> first. A keypoolrefill command has been added which tops up the users keypool (requiring the passphrase via walletpassphrase first). keypoolsize has been added to the output of getinfo to show the user the number of keys left before they need to specify their passphrase (and call keypoolrefill). Note that walletpassphrase will automatically fill keypool in a separate thread which it spawns when the passphrase is set. This could cause some delays in other threads waiting for locks on the wallet passphrase, including one which could cause the passphrase to be stored longer than expected, however it will not allow the passphrase to be used longer than expected as ThreadCleanWalletPassphrase will attempt to get a lock on the key as soon as the specified lock time has arrived. When the keypool runs out (and wallet is locked) GetOrReuseKeyFromPool returns vchDefaultKey, meaning miners may start to generate many blocks to vchDefaultKey instead of a new key each time. A walletpassphrasechange <oldpassphrase> <newpassphrase> has been added to allow the user to change their password via RPC. Whenever keying material (unencrypted private keys, the user's passphrase, the wallet's AES key) is stored unencrypted in memory, any reasonable attempt is made to mlock/VirtualLock that memory before storing the keying material. This is not true in several (commented) cases where mlock/VirtualLocking the memory is not possible. Although encryption of private keys in memory can be very useful on desktop systems (as some small amount of protection against stupid viruses), on an RPC server, the password is entered fairly insecurely. Thus, the only main advantage encryption has for RPC servers is for RPC servers that do not spend coins, except in rare cases, eg. a webserver of a merchant which only receives payment except for cases of manual intervention. Thanks to jgarzik for the original patch and sipa, gmaxwell and many others for all their input. Conflicts: src/wallet.cpp
2011-07-08Prepare codebase for Encrypted Keys.Pieter Wuille
2011-07-05Add minversion to wallet.Matt Corallo
2011-06-19Fix missing includes needed for Boost 1.46.Shane Wegner
2011-06-15CWallet classPieter Wuille
* A new class CKeyStore manages private keys, and script.cpp depends on access to CKeyStore. * A new class CWallet extends CKeyStore, and contains all former wallet-specific globals; CWallet depends on script.cpp, not the other way around. * Wallet-specific functions in CTransaction/CTxIn/CTxOut (GetDebit, GetCredit, GetChange, IsMine, IsFromMe), are moved to CWallet, taking their former 'this' argument as an explicit parameter * CWalletTx objects know which CWallet they belong to, for convenience, so they have their own direct (and caching) GetDebit/... functions. * Some code was moved from CWalletDB to CWallet, such as handling of reserve keys. * Main.cpp keeps a set of all 'registered' wallets, which should be informed about updates to the block chain, and does not have any notion about any 'main' wallet. Function in main.cpp that require a wallet (such as GenerateCoins), take an explicit CWallet* argument. * The actual CWallet instance used by the application is defined in init.cpp as "CWallet* pwalletMain". rpc.cpp and ui.cpp use this variable. * Functions in main.cpp and db.cpp that are not used by other modules are marked static. * The code for handling the 'submitorder' message is removed, as it not really compatible with the idea that a node is independent from the wallet(s) connected to it, and obsolete anyway.