aboutsummaryrefslogtreecommitdiff
path: root/src/coins.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Check FRESH validity in CCoinsViewCache::BatchWriteRussell Yanofsky2017-01-041-0/+7
|
* Merge #9107: Safer modify new coinsPieter Wuille2017-01-041-6/+31
|\ | | | | | | b50cd7a Fix dangerous condition in ModifyNewCoins. (Alex Morcos)
| * Fix dangerous condition in ModifyNewCoins.Alex Morcos2017-01-041-6/+31
| | | | | | | | | | | | | | We were marking coins FRESH before being sure they were not overwriting dirty undo data. This condition was never reached in existing code because undo data was always flushed before UpdateCoins was called with new transactions, but could have been exposed in an otherwise safe refactor. Clarify in the comments the assumptions made in ModifyNewCoins. Add ability to undo transactions to UpdateCoins unit test. Thanks to Russ Yanofsky for suggestion on how to make logic clearer and fixing up the ccoins_modify_new test cases.
* | Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
|/ | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Fix relaypriority calculation errormaiiz2016-09-201-1/+1
|
* Use C++11 thread-safe static initializersPieter Wuille2016-06-071-5/+1
|
* Use SipHash-2-4 for CCoinsCache indexPieter Wuille2016-05-171-1/+5
| | | | | This is ~1.7x slower than the Lookup3-of-Xor-with-salt construct we were using before, but it is a primitive designed for exactly this.
* txdb: Add Cursor() method to CCoinsView to iterate over UTXO setWladimir J. van der Laan2016-04-151-2/+6
| | | | | | | | | | Add a method Cursor() to CCoinsView that returns a cursor which can be used to iterate over the whole UTXO set. - rpc: Change gettxoutsetinfo to use new Cursor method - txdb: Remove GetStats method - Now that GetStats is implemented in terms of Cursor, remove it.
* Merge #7056: Save last db readWladimir J. van der Laan2016-01-221-2/+8
|\ | | | | | | 8504867 Save the last unnecessary database read (Alex Morcos)
| * Save the last unnecessary database readAlex Morcos2015-11-181-2/+8
| | | | | | | | It's possible coins with the same hash exist when you create a duplicate coinbase, so previously we were reading from the database to make sure we had the old coins cached so if we were to spend the new ones, the old ones would also be spent. This pull instead just marks the new coins as not fresh if they are from a coinbase, so if they are spent they will be written all the way down to the database anyway overwriting any duplicates.
* | Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
| |
* | Add CCoinsViewCache::HaveCoinsInCache to check if a tx is cachedMatt Corallo2015-12-011-0/+5
| |
* | Add method to remove a tx from CCoinsViewCache if it is unchangedMatt Corallo2015-12-011-0/+9
| |
* | Change GetPriority calculation.Alex Morcos2015-11-191-2/+4
|/ | | | Compute the value of inputs that already are in the chain at time of mempool entry and only increase priority due to aging for those inputs. This effectively changes the CTxMemPoolEntry's GetPriority calculation from an upper bound to a lower bound.
* Alter assumptions in CCoinsViewCache::BatchWriteAlex Morcos2015-11-181-7/+12
| | | | Previously it would break if you flushed a parent cache while there was a child cache referring to it. This change will allow the flushing of parent caches.
* ModifyNewCoins saves database lookupsAlex Morcos2015-11-021-0/+9
| | | | When processing a new transaction, in addition to spending the Coins of its txin's it creates a new Coins for its outputs. The existing ModifyCoins function will first make sure this Coins does not already exist. It can not exist due to BIP 30, but because of that the lookup can't be cached and always has to go to the database. Since we are creating the coins to match the new tx anyway, there is no point in checking if they exist first anyway. However this should not be used for coinbase tx's in order to preserve the historical behavior of overwriting the two existing duplicate tx pairs.
* Separate core memory usage computation in core_memusage.hPieter Wuille2015-07-201-7/+7
|
* Keep track of memory usage in CCoinsViewCachePieter Wuille2015-05-111-3/+21
|
* Merge pull request #5597Wladimir J. van der Laan2015-01-071-2/+4
|\ | | | | | | | | e413457 Catch LevelDB errors during flush (Pieter Wuille) 02bced1 Bugfix: only track UTXO modification after lookup (Pieter Wuille)
| * Bugfix: only track UTXO modification after lookupPieter Wuille2015-01-041-2/+4
| | | | | | | | | | | | | | | | | | Otherwise, if CCoinsViewCache::ModifyCoins throws an exception in between setting hasModifier and constructing the CCoinsModifier, the cache ends up in an inconsistent state, resulting in an assert failure in the next modification. Bug discovered by Wladimir J. van der Laan.
* | Replace direct use of 0 with SetNull and IsNullWladimir J. van der Laan2015-01-051-3/+3
| | | | | | | | | | | | Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256().
* | Decouple CCoins from CTxInUndojtimon2014-12-271-18/+4
|/
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Convert remaining comments in /src to doxygen formatMichael Ford2014-11-211-6/+8
| | | | | | | | | | - Update comments in checkpoints to be doxygen compatible - Update comments in checkqueue to be doxygen compatible - Update coins to be doxygen compatible - Fix comment typo in crypter.h - Update licenses/copyright dates Closes #5325 #5184 #5183 #5182
* Merge pull request #4834Pieter Wuille2014-10-081-37/+80
|\ | | | | | | | | | | | | | | 7c70438 Get rid of the dummy CCoinsViewCache constructor arg (Pieter Wuille) ed27e53 Add coins_tests with a large randomized CCoinViewCache test. (Pieter Wuille) 058b08c Do not keep fully spent but unwritten CCoins entries cached. (Pieter Wuille) c9d1a81 Get rid of CCoinsView's SetCoins and SetBestBlock. (Pieter Wuille) f28aec0 Use ModifyCoins instead of mutable GetCoins. (Pieter Wuille)
| * Get rid of the dummy CCoinsViewCache constructor argPieter Wuille2014-09-241-2/+2
| |
| * Do not keep fully spent but unwritten CCoins entries cached.Pieter Wuille2014-09-231-23/+62
| | | | | | | | | | | | | | | | | | | | | | Instead of storing CCoins entries directly in CCoinsMap, store a CCoinsCacheEntry which additionally keeps track of whether a particular entry is: * dirty: potentially different from its parent view. * fresh: the parent view is known to not have a non-pruned version. This allows us to skip non-dirty cache entries when pushing batches of changes up, and to remove CCoins entries about transactions that are fully spent before the parent cache learns about them.
| * Get rid of CCoinsView's SetCoins and SetBestBlock.Pieter Wuille2014-09-231-11/+1
| | | | | | | | | | | | All direct modifications are now done through ModifyCoins, and BatchWrite is used for pushing batches of queued modifications up, so we don't need the low-level SetCoins and SetBestBlock anymore in the top-level CCoinsView class.
| * Use ModifyCoins instead of mutable GetCoins.Pieter Wuille2014-09-231-11/+25
| | | | | | | | | | | | | | | | | | Replace the mutable non-copying GetCoins method with a ModifyCoins, which returns an encapsulated iterator, so we can keep track of concurrent modifications (as iterators can be invalidated by those) and run cleanup code after a modification is finished. This also removes the overloading of the 'GetCoins' name.
* | Use a typedef for monetary valuesMark Friedenbach2014-09-261-2/+2
|/
* Combine CCoinsViewCache's HaveCoins and const GetCoins into AccessCoins.Pieter Wuille2014-09-031-20/+18
| | | | | | | | | | | | The efficient version of CCoinsViewCache::GetCoins only works for known-to-exist cache entries, requiring a separate HaveCoins call beforehand. This is inefficient as both perform a hashtable lookup. Replace the non-mutable GetCoins with AccessCoins, which returns a potentially-NULL pointer. This also decreases the overloading of GetCoins. Also replace some copying (inefficient) GetCoins calls with equivalent AccessCoins, decreasing the copying.
* Make appropriate getter-routines "const" in CCoinsView.Daniel Kraft2014-08-261-17/+27
| | | | Mark the "Get"/"Have" routines in CCoinsView and subclasses as "const".
* Allow BatchWrite to destroy its input, reducing copyingPieter Wuille2014-08-241-7/+9
|
* Merge pull request #4505Wladimir J. van der Laan2014-07-151-1/+6
|\ | | | | | | d4d3fbd Do not flush the cache after every block outside of IBD (Pieter Wuille)
| * Do not flush the cache after every block outside of IBDPieter Wuille2014-07-111-1/+6
| |
* | Use unordered_map for CCoinsViewCache with salted hashPieter Wuille2014-07-141-2/+6
|/
* typedef std::map<uint256, CCoins> to CCoinsMapWladimir J. van der Laan2014-07-011-8/+8
| | | | | | | This makes it possible to switch to a more efficient map type without changing all occurences manually. Merges half of #4413.
* Add verbose boolean to getrawmempoolGavin Andresen2013-11-301-0/+16
| | | | | Also changes mempool to store CTxMemPoolEntries to keep track of when they enter/exit the pool.
* Move CCoins-related logic to coins.{cpp.h}Pieter Wuille2013-11-101-0/+180