aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge pull request #2182 from gavinandresen/addressoracleGavin Andresen2013-01-261-1/+1
|\ \ | | | | | | Remove IsFromMe() check in CTxMemPool::accept()
| * | Remove IsFromMe() check in CTxMemPool::accept()Gavin Andresen2013-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes issue #2178 : attacker could penny-flood with invalid-signature transactions to deduce which addresses belonged to your node. I'm committing this early for code review; I still need to write up a test plan. Executive summary of fix: check all transactions received from the network for penny-flood rate-limiting before adding to the memory pool. But do NOT ratelimit transactions added to the memory pool: - because of blockchain reorgs - stored in the wallet and added at startup - sent from the GUI or one of the send* RPC commands (CWallet::CommitTransaction) The limit-free-transactions code really should be a method on CNode, with counters per-peer. But that is a bigger change for another day.
* | | Merge pull request #1872 from gmaxwell/listaddrnotmineGregory Maxwell2013-01-211-12/+21
|\ \ \ | | | | | | | | In listaddressgroupings push down the IsMine check to run on each input.
| * | | In listaddressgroupings push down the IsMine check to run on each input.Gregory Maxwell2012-12-141-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | This avoids a potential crash when trying to read the scrippubkeys on transactions where the first input IsMine but some of the rest are not when running listaddressgroupings.
* | | | Replace RelayMessage with RelayTransaction.Matt Corallo2013-01-161-4/+3
| |/ / |/| |
* | | If the prio. will be enough after the next block don't force fees.Gregory Maxwell2012-12-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | If the user was really after the fastest possible confirmation times they would be manually setting a fee. In cases where the wallet builds a transaction with a priority that is too low to qualify as free until the next block, go ahead without a fee. Confirmation frequently takes multiple blocks even when a minimum fee is provided.
* | | Merge pull request #1861 from jgarzik/coinlockGavin Andresen2012-12-121-2/+36
|\ \ \ | | | | | | | | Add new RPC "lockunspent", to prevent spending of selected outputs
| * | | Add new RPC "lockunspent", to prevent spending of selected outputsJeff Garzik2012-11-151-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | and associated RPC "listlockunspent". This is a memory-only filter, which is empty when a node restarts.
* | | | rework ThreadSafeAskFee() / askFee() functionsPhilip Kaufmann2012-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | - remove unused parameter from ThreadSafeAskFee(), which also results in the removal of an orphan translation-string
* | | | Merge pull request #2013 from sipa/blockheaderPieter Wuille2012-11-241-1/+1
|\ \ \ \ | | | | | | | | | | Split off CBlockHeader from CBlock
| * | | | Split off CBlockHeader from CBlockPieter Wuille2012-11-161-1/+1
| |/ / / | | | | | | | | | | | | | | | | Cleaner and removes the need for the application-specific flags in serialize.h.
* | | | Merge pull request #2009 from sipa/fixmoveGavin Andresen2012-11-161-3/+7
|\ \ \ \ | |/ / / |/| | | Prevent RPC 'move' from deadlocking
| * | | Prevent RPC 'move' from deadlockingPieter Wuille2012-11-141-3/+7
| | | | | | | | | | | | | | | | | | | | It seemed to create two CWalletDB objects that both grab the database lock.
* | | | add CWalletTx::GetImmatureCredit() and use it in CWallet::GetImmatureBalance()Philip Kaufmann2012-11-131-3/+2
| | | |
* | | | Merge pull request #1830 from Diapolo/trans_rem_spacesWladimir J. van der Laan2012-11-041-4/+4
|\ \ \ \ | | | | | | | | | | fix some double-spaces in strings
| * | | | fix some double-spaces in stringsPhilip Kaufmann2012-10-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | - remove some unneeded stuff in sendcoinsentry.ui - harmonize some "Error:"-messages
* | | | | Bugfix: do not keep relaying spent wallet transactionsPieter Wuille2012-11-011-9/+5
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original test (checking whether the transaction occurs in the txindex) is not usable anymore, as it will miss anything already fully spent. However, as merkle transactions (and by extension, wallet transactions) track which block they were last seen being included in, we can use that to determine the need for rebroadcasting.
* | | | Bugfix: do not mark all future coins spentPieter Wuille2012-10-211-2/+2
| | | |
* | | | Transaction hash cachingPieter Wuille2012-10-201-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Batch block connection during IBDPieter Wuille2012-10-201-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | UltraprunePieter Wuille2012-10-201-44/+19
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Handle corrupt wallets gracefully.Gavin Andresen2012-10-081-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | | fix -Wformat warnings all over the sourcePhilip Kaufmann2012-10-011-3/+3
|/ /
* | Merge pull request #1717 from Diapolo/Qt_change_TX_displayWladimir J. van der Laan2012-09-201-1/+1
|\ \ | |/ |/| Qt: show mined transactions at depth 1
| * Qt: show mined transactions at depth 1Philip Kaufmann2012-08-241-1/+1
| | | | | | | | | | - before, we used to show them in GUI when depth >= 2, which could lead to confusion of users, as the RPC behaviour already showed the Tx
* | Merge branch 'refactor_times' of git://github.com/luke-jr/bitcoinGavin Andresen2012-09-181-1/+8
|\ \
| * | Bugfix: Initialize CWallet::nOrderPosNext on an empty wallet, and save it in dbLuke Dashjr2012-09-081-1/+8
| | |
* | | Correct LoadWallet() return value (false -> DB_LOAD_OK)xanatos2012-09-051-1/+1
| | | | | | | | | Equivalent code. (false == 0 == DB_LOAD_OK). Fixes #1706.
* | | Merge pull request #1738 from laanwj/2012_08_boostthreadJeff Garzik2012-09-041-1/+1
|\ \ \ | | | | | | | | implement CreateThread with boost::thread
| * | | Rename CreateThread to NewThreadWladimir J. van der Laan2012-08-291-1/+1
| | | | | | | | | | | | | | | | Prevent clash with win32 API symbol
* | | | Merge pull request #1774 from luke-jr/refactor_timesGavin Andresen2012-09-021-4/+4
|\ \ \ \ | |/ / / |/| / / | |/ / Bugfix: Require OrderedTxItems to provide properly scoped accounting entry list
| * | Bugfix: Require OrderedTxItems to provide properly scoped accounting entry listLuke Dashjr2012-09-021-4/+4
| | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #1672 from gmaxwell/filter_listunspentGregory Maxwell2012-08-241-0/+123
|\ \ \ | |_|/ |/| | Listunspent txout address filtering and listaddressgroupings
| * | Change CWallet addressgrouping to use CTxDestination instead of strings.Gregory Maxwell2012-08-241-34/+34
| | | | | | | | | | | | | | | This is cleanup for the listaddressgroupings code. Also add some real help text.
| * | Add address groupings RPC from the coincontrol patches.coderrr2012-08-231-0/+123
| |/ | | | | | | Signed-off-by: Gregory Maxwell <[email protected]>
* / Treat generation (mined) transactions less different from receive transactionsLuke Dashjr2012-08-231-18/+6
|/ | | | | - 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
* Choose reasonable "smart" times to display for transactionsLuke Dashjr2012-08-231-1/+72
| | | | | | | | | 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.
* Store a fixed order of transactions (and accounting) in the walletLuke Dashjr2012-08-231-0/+3
| | | | | 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.
* Removed useless assignmentxanatos2012-08-231-1/+0
| | | nLoadWalletRet is already equal to DB_NEED_REWRITE (we are in an if)
* Merge pull request #1632 from luke-jr/spellingJeff Garzik2012-08-011-2/+2
|\ | | | | Fix spelling and grammar errors
| * Bugfix: Fix a variety of misspellingsLuke Dashjr2012-08-011-2/+2
| |
* | Update Warning-strings to use a standard-formatPhilip Kaufmann2012-08-011-1/+1
|/ | | | | | | | | - ensure warnings always start with "Warning:" and that the first character after ":" is written uppercase - ensure the first sentence in warnings ends with an "!" - remove unneeded spaces from Warning-strings - add missing Warning-string translation - remove a "\n" and replace with untranslatable "<br><br>"
* Implement raw transaction RPC callsGavin Andresen2012-07-051-2/+5
| | | | | | Implement listunspent / getrawtransaction / createrawtransaction / signrawtransaction, to support creation and signing-on-multiple-device multisignature transactions.
* Fix coin selection to only include change when it's necessary.Chris Moore2012-06-041-42/+51
|
* Preserve the shuffled order of coins with equal value to give more ↵Chris Moore2012-06-041-1/+10
| | | | randomized coin selection.
* Move the random_shuffle call back into SelectCoinsMinConf() so we can unit ↵Chris Moore2012-06-041-0/+2
| | | | test it.
* Refactor SelectCoinsMinConf() and add unit tests.Chris Moore2012-06-041-47/+55
| | | | 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.
* Merge pull request #837 from sje397/ShowImmatureBalanceWladimir J. van der Laan2012-06-021-7/+20
|\ | | | | Added 'immature balance' for miners. Only displayed if the balance is > 0
| * Added 'immature balance' for miners. Only displayed if the balance is ↵sje3972012-05-251-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille2012-05-241-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.