aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.h
AgeCommit message (Collapse)Author
2013-08-22Payment Protocol: X509-validated payment requestsGavin Andresen
Add support for a Payment Protocol to Bitcoin-Qt. Payment messages are protocol-buffer encoded and communicated over http(s), so this adds a dependency on the Google protocol buffer library, and requires Qt with OpenSSL support.
2013-08-22Refactor: Move GetAccountAddresses to CWalletGavin Andresen
2013-08-22Refactor: CAddressBookData for mapAddressBookGavin Andresen
Straight refactor, so mapAddressBook stores a CAddressBookData (which just contains a std::string) instead of a std::string. Preparation for payment protocol work, which will add the notion of refund addresses to the address book.
2013-08-14Merge pull request #2776 from jgarzik/keypoolsizeGavin Andresen
RPC: keypoolrefill now permits optional size parameter, to bump keypool
2013-07-29Make sure new wallet variables are initializedPieter Wuille
2013-07-17Bugfix: Store last/next wallet resend times unique per CWallet objectLuke Dashjr
2013-06-25CWallet::TopUpKeyPool() takes optional pool size argumentJeff Garzik
Also, GetKeyPoolSize() now returns an accurate type, unsigned int.
2013-06-22Add GetKeyBirthTimes to walletPieter Wuille
Compute safe lower bounds on the birth times of all wallet keys. For pool keys or keys with metadata, the actually stored birth time is used. For all others, the birth times are inferred from the wallet transactions.
2013-06-20Refactor keytime/metadata and wallet encryption bugfixPieter Wuille
Refactor keytime: * Key metadata is kept in a CWallet::mapKeyMetadata (std::map<CKeyId,CKeyMetadata>). * When generating a new key, time is put in that map, and new key is written. * AddKeyPubKey and AddCryptedKey do not take a creation time argument, but instead pull it from that map, if it exists there. Bugfix: * AddKeyPubKey and AddCryptedKey in CWallet didn't override the CKeyStore definition anymore. This is fixed, as they no longed need the nCreationTime argument now. Also a few related other changes: * Metadata can be overwritten. * Only GenerateNewKey calls GetTime(), as it's the only place where we know for sure a key was not constructed earlier. * When the nTimeFirstKey is known to be inaccurate, it is set to the value 1 (instead of 0, which would mean unknown). * Use CPubKey instead of std::vector<unsigned char> where possible.
2013-06-13Remove broken option to skip input checking for wallet txn.Matt Corallo
2013-06-10Wallet: store key creation time. Calculate whole-wallet birthday.Jeff Garzik
This also encapsulate wallet-read state information into CWalletScanState.
2013-06-05Removed AcceptToMemoryPool method from CTransaction. This method belongs to ↵Eric Lombrozo
the mempool instance. Removed AreInputsStandard from CTransaction, made it a regular function in main. Moved CTransaction::GetOutputFor to CCoinsViewCache. Moved GetLegacySigOpCount and GetP2SHSigOpCount out of CTransaction into regular functions in main. Moved GetValueIn and HaveInputs from CTransaction into CCoinsViewCache. Moved AllowFree, ClientCheckInputs, CheckInputs, UpdateCoins, and CheckTransaction out of CTransaction and into main. Moved IsStandard and IsFinal out of CTransaction and put them in main as IsStandardTx and IsFinalTx. Moved GetValueOut out of CTransaction into main. Moved CTxIn, CTxOut, and CTransaction into core. Added minimum fee parameter to CTxOut::IsDust() temporarily until CTransaction is moved to core.h so that CTxOut needn't know about CTransaction.
2013-06-05Get rid of db dependencies on mainEric Lombrozo
2013-05-30CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille
2013-05-04Merge pull request #2577 from gavinandresen/fee_bandaidGavin Andresen
Treat dust outputs as non-standard, un-hardcode TX_FEE constants
2013-05-03Merge pull request #2566 from sipa/nodefGavin Andresen
Allow the default key to be unavailable
2013-05-03CreateTransaction: return strFailReason on failureGavin Andresen
2013-05-02Do not write to wallet during LoadWalletGavin Andresen
When debugging another issue, I found a hang-during-startup race condition due to LoadWallet calling SetMinVersion (via LoadCryptedKey). Writing to the file that you're in the process of reading is a bad idea.
2013-04-25Allow the default key to be unavailablePieter Wuille
This solves the issue where no default key can be added after -salvagewallet.
2013-04-07Always print full hashes (tx, block, inv)Pieter Wuille
2013-04-03Clean up shutdown processGavin Andresen
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