aboutsummaryrefslogtreecommitdiff
path: root/src/walletdb.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Handle corrupt wallets gracefully.Gavin Andresen2012-10-081-178/+330
| | | | | | | | | | | | | | | | | | | | | | | | | Corrupt wallets used to cause a DB_RUNRECOVERY uncaught exception and a crash. This commit does three things: 1) Runs a BDB verify early in the startup process, and if there is a low-level problem with the database: + Moves the bad wallet.dat to wallet.timestamp.bak + Runs a 'salvage' operation to get key/value pairs, and writes them to a new wallet.dat + Continues with startup. 2) Much more tolerant of serialization errors. All errors in deserialization are reported by tolerated EXCEPT for errors related to reading keypairs or master key records-- those are reported and then shut down, so the user can get help (or recover from a backup). 3) Adds a new -salvagewallet option, which: + Moves the wallet.dat to wallet.timestamp.bak + extracts ONLY keypairs and master keys into a new wallet.dat + soft-sets -rescan, to recreate transaction history This was tested by randomly corrupting testnet wallets using a little python script I wrote (https://gist.github.com/3812689)
* Bugfix: Initialize CWallet::nOrderPosNext on an empty wallet, and save it in dbLuke Dashjr2012-09-081-0/+4
|
* Store a fixed order of transactions (and accounting) in the walletLuke Dashjr2012-08-231-1/+96
| | | | | For backward compatibility, new accounting data is stored after a \0 in the comment string. This way, old versions and third-party software should load and store them, but all actual use (listtransactions, for example) ignores it.
* Give threads a recognisable name to aid in debuggingGiel van Schijndel2012-07-171-0/+3
| | | | | | | | NOTE: These thread names are visible in gdb when using 'info threads'. Additionally both 'top' and 'ps' show these names *unless* told to display the command-line instead of task name. Signed-off-by: Giel van Schijndel <[email protected]>
* Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille2012-05-241-1/+1
| | | | | | | | | | | | | | | | | 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.
* Encapsulate public keys in CPubKeyPieter Wuille2012-05-241-1/+1
|
* Merge branch 'dbenv' into tmpJeff Garzik2012-05-221-19/+13
|\ | | | | | | | | Conflicts: src/db.cpp
| * Further CDBEnv encapsulation work.Jeff Garzik2012-05-191-12/+9
| |
| * Encapsulate BDB environment inside new CDBEnv classJeff Garzik2012-05-191-7/+4
| | | | | | | | | | | | | | | | 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.
* | Update License in File HeadersFordy2012-05-181-1/+1
|/ | | | | | 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.
* ensure that no double timestamps show up in the debug.log, by removing ↵Philip Kaufmann2012-05-131-1/+0
| | | | manual timestamps from the source (now only -logtimestamps parameter adds timestamps to debug.log)
* Bugfix: %-12I64d is not valid and causes the parameter to be skipped, use ↵Luke Dashjr2012-05-051-1/+1
| | | | %12"PRI64d" instead
* Further reduce header dependenciesPieter Wuille2012-04-171-4/+4
| | | | | | | 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.
* Move CWalletDB code to new walletdb module.Jeff Garzik2012-04-171-0/+428
In addition to standard code separation, this change opens the door to fixing several include inter-dependencies.