aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
AgeCommit message (Collapse)Author
2012-12-12Merge pull request #1861 from jgarzik/coinlockGavin Andresen
Add new RPC "lockunspent", to prevent spending of selected outputs
2012-11-16Merge pull request #2009 from sipa/fixmoveGavin Andresen
Prevent RPC 'move' from deadlocking
2012-11-15Add new RPC "lockunspent", to prevent spending of selected outputsJeff Garzik
and associated RPC "listlockunspent". This is a memory-only filter, which is empty when a node restarts.
2012-11-14Prevent RPC 'move' from deadlockingPieter Wuille
It seemed to create two CWalletDB objects that both grab the database lock.
2012-11-13add CWalletTx::GetImmatureCredit() and use it in CWallet::GetImmatureBalance()Philip Kaufmann
2012-10-20Transaction hash cachingPieter Wuille
Use CBlock's vMerkleTree to cache transaction hashes, and pass them along as argument in more function calls. During initial block download, this results in every transaction's hash to be only computed once.
2012-10-20Batch block connection during IBDPieter Wuille
During the initial block download (or -loadblock), delay connection of new blocks a bit, and perform them in a single action. This reduces the load on the database engine, as subsequent blocks often update an earlier block's transaction already.
2012-10-20UltraprunePieter Wuille
This switches bitcoin's transaction/block verification logic to use a "coin database", which contains all unredeemed transaction output scripts, amounts and heights. The name ultraprune comes from the fact that instead of a full transaction index, we only (need to) keep an index with unspent outputs. For now, the blocks themselves are kept as usual, although they are only necessary for serving, rescanning and reorganizing. The basic datastructures are CCoins (representing the coins of a single transaction), and CCoinsView (representing a state of the coins database). There are several implementations for CCoinsView. A dummy, one backed by the coins database (coins.dat), one backed by the memory pool, and one that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock, DisconnectBlock, ... now operate on a generic CCoinsView. The block switching logic now builds a single cached CCoinsView with changes to be committed to the database before any changes are made. This means no uncommitted changes are ever read from the database, and should ease the transition to another database layer which does not support transactions (but does support atomic writes), like LevelDB. For the getrawtransaction() RPC call, access to a txid-to-disk index would be preferable. As this index is not necessary or even useful for any other part of the implementation, it is not provided. Instead, getrawtransaction() uses the coin database to find the block height, and then scans that block to find the requested transaction. This is slow, but should suffice for debug purposes.
2012-10-08Handle corrupt wallets gracefully.Gavin Andresen
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)
2012-09-18Trim trailing whitespace for src/*.{h,cpp}Jeff Garzik
2012-09-18Merge branch 'refactor_times' of git://github.com/luke-jr/bitcoinGavin Andresen
2012-09-08Bugfix: Initialize CWallet::nOrderPosNext on an empty wallet, and save it in dbLuke Dashjr
2012-09-02Merge pull request #1774 from luke-jr/refactor_timesGavin Andresen
Bugfix: Require OrderedTxItems to provide properly scoped accounting entry list
2012-09-02Bugfix: Require OrderedTxItems to provide properly scoped accounting entry listLuke Dashjr
OrderedTxItems returns a multimap of pointers, but needs a place to store the actual CAccountingEntries it points to. It had been using a stack item, which was clobbered as soon as it returned, resulting in undefined behaviour. This fixes at least bug #1768.
2012-08-24Merge pull request #1672 from gmaxwell/filter_listunspentGregory Maxwell
Listunspent txout address filtering and listaddressgroupings
2012-08-24Change CWallet addressgrouping to use CTxDestination instead of strings.Gregory Maxwell
This is cleanup for the listaddressgroupings code. Also add some real help text.
2012-08-24Avoid leaving return types or function attributes on their own lines.Gregory Maxwell
2012-08-23Treat generation (mined) transactions less different from receive transactionsLuke Dashjr
- Show address receiving the generation, and include it in the correct "account" - Multiple entries in listtransactions output if the coinbase has multiple outputs to us
2012-08-23Add txout address filtering to listunspent.Gregory Maxwell
This applies on top of the coincontrol listaddressgroupings patch and makes finding eligible outputs from the groups returned by listaddressgroupings possible.
2012-08-23Add address groupings RPC from the coincontrol patches.coderrr
Signed-off-by: Gregory Maxwell <greg@xiph.org>
2012-08-23Choose reasonable "smart" times to display for transactionsLuke Dashjr
Logic: - If sending a transaction, assign its timestamp to the current time. - If receiving a transaction outside a block, assign its timestamp to the current time. - If receiving a block with a future timestamp, assign all its (not already known) transactions' timestamps to the current time. - If receiving a block with a past timestamp, before the most recent known transaction (that we care about), assign all its (not already known) transactions' timestamps to the same timestamp as that most-recent-known transaction. - If receiving a block with a past timestamp, but after the most recent known transaction, assign all its (not already known) transactions' timestamps to the block time.
2012-08-23Store a fixed order of transactions (and accounting) in the walletLuke Dashjr
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.
2012-07-05Implement raw transaction RPC callsGavin Andresen
Implement listunspent / getrawtransaction / createrawtransaction / signrawtransaction, to support creation and signing-on-multiple-device multisignature transactions.
2012-06-29Fix a few typosfanquake
2012-06-04Refactor SelectCoinsMinConf() and add unit tests.Chris Moore
AvailableCoins() makes a vector of available outputs which is then passed to SelectCoinsMinConf(). This allows unit tests to test the coin selection algorithm without having the whole blockchain available.
2012-06-02Merge pull request #837 from sje397/ShowImmatureBalanceWladimir J. van der Laan
Added 'immature balance' for miners. Only displayed if the balance is > 0
2012-05-25Added 'immature balance' for miners. Only displayed if the balance is ↵sje397
greater than zero. This adds a field labelled 'Immature' in the overview section under the 'unconfirmed' field, which shows mined income that has not yet matured (which is currently not displayed anywhere, even though the transactions exist in the transaction list). To do that I added a 'GetImmatureBalance' method to the wallet, and connected that through to the GUI as per the 'GetBalance' and 'GetUnconfirmedBalance' methods. I did a small 'no-op' change to make the code in adjacent functions a little more readable (imo); it was a change I had made in my repo earlier...but I thought it wouldn't hurt so left it in. Immature balance comes from mined income that is at least two blocks deep in the chain (same logic as displayed transactions). My reasoning is: - as a miner, it's a critical stat I want to see - as a miner, and taking into account the label 'immature', the uncertainty is pretty clearly implied - those numbers are already displayed in the transaction list - this makes the overview numbers add up to what's in the transaction list - it's not displayed if the immature balance is 0, so won't bother non-miners I also 'cleaned' the overview UI a little, moving code to the XML and removing HTML.
2012-05-24Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille
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-24Encapsulate public keys in CPubKeyPieter Wuille
2012-05-20Merge pull request #1354 from fanquake/masterPieter Wuille
Update Header Licenses
2012-05-20Process address book updates incrementallyWladimir J. van der Laan
- No longer invalidates selection model, thus retains selection on address book changes - Fixes selection of new address when added
2012-05-20Convert UI interface to boost::signals2.Wladimir J. van der Laan
- 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-20Fine-grained UI updatesWladimir J. van der Laan
Gets rid of `MainFrameRepaint` in favor of specific update functions that tell the UI exactly what changed. This improves the efficiency of various handlers. Also fixes problems with mined transactions not showing up until restart. The following notifications were added: - `NotifyBlocksChanged`: Block chain changed - `NotifyKeyStoreStatusChanged`: Wallet status (encrypted, locked) changed. - `NotifyAddressBookChanged`: Address book entry changed. - `NotifyTransactionChanged`: Wallet transaction added, removed or updated. - `NotifyNumConnectionsChanged`: Number of connections changed. - `NotifyAlertChanged`: New, updated or cancelled alert. As this finally makes it possible for the UI to know when a new alert arrived, it can be shown as OS notification. These notifications could also be useful for RPC clients. However, currently, they are ignored in bitcoind (in noui.cpp). Also brings back polling with timer for numBlocks in ClientModel. This value updates so frequently during initial download that the number of signals clogs the UI thread and causes heavy CPU usage. And after initial block download, the value changes so rarely that a delay of half a second until the UI updates is unnoticable.
2012-05-18Update License in File HeadersFordy
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-03remove obsolete BackupWallet() entry in wallet.hPhilip Kaufmann
2012-04-21Remove no-longer used UI hints in bitcoin coreWladimir J. van der Laan
The Qt UI has its own associated structures for temporary transaction state / cache.
2012-04-21change type of various bare chars to bool that are only used as bool (and ↵Wladimir J. van der Laan
never serialized)
2012-04-17Further reduce header dependenciesPieter Wuille
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-17Remove headers.hPieter Wuille
2012-04-15Fix loop index var types, fixing many minor sign comparison warningsJeff Garzik
foo.size() typically returns an unsigned integral type; make loop variables match those types' signedness.
2012-04-15fix warnings: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]Wladimir J. van der Laan
2012-04-09Use scoped locks instead of CRITICAL_BLOCKPieter Wuille
2012-03-26Begin doxygen-compatible commentsPieter Wuille
2012-03-22Introduce explicit -walletupgrade optionPieter Wuille
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-02-18Move GenerateNewKey back to CWalletPieter Wuille
2012-02-18Add SetMinVersion to CWalletPieter Wuille
2012-02-07Update all copyrights to 2012Gavin Andresen
2012-01-13Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen
2012-01-09Remove unused definitionPieter Wuille
2011-12-21Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan
This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.