aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-06-01Rename CCoinsCacheEntry::coins to coinPieter Wuille
2017-06-01Merge CCoinsViewCache's GetOutputFor and AccessCoinPieter Wuille
They're doing the same thing now.
2017-06-01[MOVEONLY] Move old CCoins class to txdb.cppPieter Wuille
It's only used for upgrading from the old database anymore.
2017-06-01Upgrade from per-tx database to per-txoutPieter Wuille
2017-06-01Reduce reserved memory space for flushingPieter Wuille
As the maximum amount of data that can be pulled into the cache due to a block validation is much lower now (at most one CCoin entry per input and per output), reduce the conservative estimate used to determine flushing time.
2017-06-01Pack Coin more tightlyPieter Wuille
2017-06-01Remove unused CCoins methodsPieter Wuille
2017-06-01Extend coins_testsPieter Wuille
2017-06-01Switch CCoinsView and chainstate db from per-txid to per-txoutPieter Wuille
This patch makes several related changes: * Changes the CCoinsView virtual methods (GetCoins, HaveCoins, ...) to be COutPoint/Coin-based rather than txid/CCoins-based. * Changes the chainstate db to a new incompatible format that is also COutPoint/Coin based. * Implements reconstruction code for hash_serialized_2. * Adapts the coins_tests unit tests (thanks to Russell Yanofsky). A side effect of the new CCoinsView model is that we can no longer use the (unreliable) test for transaction outputs in the UTXO set to determine whether we already have a particular transaction.
2017-06-01Refactor GetUTXOStats in preparation for per-COutPoint iterationPieter Wuille
2017-06-01Replace CCoins-based CTxMemPool::pruneSpent with isSpentPieter Wuille
2017-06-01Remove ModifyCoins/ModifyNewCoinsPieter Wuille
2017-06-01Switch tests from ModifyCoins to AddCoin/SpendCoinPieter Wuille
2017-06-01Switch CScriptCheck to use Coin instead of CCoinsPieter Wuille
2017-06-01Only pass things committed to by tx's witness hash to CScriptCheckMatt Corallo
This clarifies a bit more the ways in which the new script execution cache could break consensus in the future if additional data from the CCoins object were to be used as a part of script execution. After this change, any such consensus breaks should be very visible to reviewers, hopefully ensuring no such changes can be made.
2017-06-01Switch from per-tx to per-txout CCoinsViewCache methods in some placesPieter Wuille
2017-06-01Introduce new per-txout CCoinsViewCache functionsPieter Wuille
The new functions are: * CCoinsViewCache::AddCoin: Add a single COutPoint/Coin pair. * CCoinsViewCache::SpendCoin: Remove a single COutPoint. * AddCoins: utility function that invokes CCoinsViewCache::AddCoin for each output in a CTransaction. * AccessByTxid: utility function that searches for any output with a given txid. * CCoinsViewCache::AccessCoin: retrieve the Coin for a COutPoint. * CCoinsViewCache::HaveCoins: check whether a non-empty Coin exists for a given COutPoint. The AddCoin and SpendCoin methods will eventually replace ModifyCoins and ModifyNewCoins, AddCoins will replace CCoins::FromTx, and the new AccessCoins and HaveCoins functions will replace their per-txid counterparts. Note that AccessCoin for now returns a copy of the Coin object. In a later commit it will be change to returning a const reference (which keeps working in all call sites).
2017-06-01Optimization: Coin&& to ApplyTxInUndoPieter Wuille
This avoids a prevector copy in ApplyTxInUndo.
2017-06-01Replace CTxInUndo with CoinPieter Wuille
The earlier CTxInUndo class now holds the same information as the Coin class. Instead of duplicating functionality, replace CTxInUndo with a serialization adapter for Coin.
2017-05-26Introduce Coin, a single unspent outputPieter Wuille
2017-05-26Store/allow tx metadata in all undo recordsPieter Wuille
Previously, transaction metadata (height, coinbase or not, and before the previous commit also nVersion) was only stored for undo records that correspond to the last output of a transaction being spent. This only saves 2 bytes per undo record. Change this to storing this information for every undo record, and stop complaining for having it in non-last output spends. This means that undo dat written with this patch won't be readable by older versions anymore.
2017-05-26Report on-disk size in gettxoutsetinfoPieter Wuille
2017-05-26Remove/ignore tx version in utxo and undoPieter Wuille
This makes the following changes: * In undo data and the chainstate database, the transaction nVersion field is removed from the data structures, always written as 0, and ignored when reading. * The definition of hash_serialized in gettxoutsetinfo is changed to no longer incude the nVersion field. It is renamed to hash_serialized_2 to avoid confusion. The new definition also includes transaction height and coinbase information, as this information was missing before. This depends on having a CHashVerifier-based undo data checksum verifier. Apart from changing the definition of serialized_hash, downgrading after using this patch is supported, as no release ever used the value of nVersion field in UTXO entries.
2017-05-26Add specialization of SipHash for 256 + 32 bit dataPieter Wuille
We'll need a version of SipHash for tuples of 256 bits and 32 bits data, when CCoinsViewCache switches from using txids to COutPoints as keys.
2017-05-26Introduce CHashVerifier to hash read dataPieter Wuille
This is necessary later, when we drop the nVersion field from the undo data. At that point deserializing and reserializing the data won't roundtrip anymore, and thus that approach can't be used to verify checksums anymore. With this CHashVerifier approach, we can deserialize while hashing the exact serialized form that was used. This is both more efficient and more correct in that case.
2017-05-26error() in disconnect for disk corruption, not inconsistencyPieter Wuille
The error() function unconditionally reports an error. It should only be used for actually exception situations, and not for the type of inconsistencies that ApplyTxInUndo/DisconnectBlock can graciously deal with. This also makes a subtle semantics change: in ApplyTxInUndo, when a record with metadata is encountered (indicating it is the last spend from a tx), don't wipe the CCoins record if it wasn't empty at that point. This makes sure that UTXO operations never affect any other UTXOs (including those from the same tx).
2017-05-26Add SizeEstimate to CDBBatchPieter Wuille
This allows estimating the in-memory size of a LevelDB batch.
2017-05-26Merge #10445: Add test for empty chain and reorg consistency for ↵Pieter Wuille
gettxoutsetinfo. 513da90cd Add test for empty chain and reorg consistency for gettxoutsetinfo. (Gregory Maxwell) 822755a42 Fix: make CCoinsViewDbCursor::Seek work for missing keys (Pieter Wuille) Tree-SHA512: e549921e8b8f599bf61ebe0ee7ef1d2f474043723d633e24665fe434b996a98e039612de8a1c2cd16b63f154943ff5ea1c1935e9561cfb813a00d47d926d0b22
2017-05-26Merge #10419: [trivial] Fix three recently introduced typosPieter Wuille
efc2e3302 [trivial] Fix three recently introduced typos (practicalswift) Tree-SHA512: 99e97f3c1350299dfce9c0c35547d480f25c0b877da311d9120f113afd3089eda31b88b2378e2370f288b0c41bb69cee0fd3abca661cd93d5a56982f90709f91
2017-05-24Merge #10420: Add Qt tests for wallet spends & bumpfeeJonas Schnelli
5749a4882 Add Qt tests for wallet spends & bumpfee (Russell Yanofsky) Tree-SHA512: 026785e7b5ab662f37029d0694916757e46e68bf10e1a7bf1e8538a36593ada0768c6cf3c810c66d65fad891c137fc8bb13904ed09ab3bcffd6cf43d09e48621
2017-05-23Fix: make CCoinsViewDbCursor::Seek work for missing keysPieter Wuille
Thanks to Suhas Daftuar for figuring this out.
2017-05-23Merge #10313: [Consensus] Add constant for maximum stack sizePieter Wuille
cb184b3 Add constant for maximum stack size (Gregory Sanders) Tree-SHA512: 0ec4a28552a6eee7fba8c69278f63c61f095e4ba06cb34456bd0162cd702370d10cca621ae1797a0d5e62fb39814cbb8245d3a7adc007ca39dab7a49cbc925dc
2017-05-23Merge #10347: Use range-based for loops (C++11) when looping over vector ↵Pieter Wuille
elements 211adc0 Use range-based for loops (C++11) when looping over vector elements (practicalswift) Tree-SHA512: 0e007f20dcef99d3c7a1036265e00f689d69f42e02fd82dd8389f45b52d31947e5f9388de2610d3d9bd9f554915ce0d35ebce561e5ae3a9013956d0ee4937145
2017-05-23Add Qt tests for wallet spends & bumpfeeRussell Yanofsky
A few code changes were needed to accompany the test: * Adding setObjectName() calls for a few Qt controls to make them easily accessible from the test. * Calling contextMenu->popup() instead of contextMenu->exec() to open the transaction list context menu without blocking the test thread. * Opening the context menu at the contextualMenu event point rather than the cursor position (this change was not strictly needed to make the test work, but is more correct). * Updating the bumped transaction row with showTransaction=true instead of false. This is needed to prevent the bumped tx from being hidden, so the last part of the test which attempts to bump the bumped tx can work. (Technically this change is a more general bugfix not limited to the testing environment, but the bug doesn't happen outside of the testing environment because in the full Qt client, a queued NotifyTransactionChanged notification causes the row to be updated twice, first with showTransaction=false, then immediately after with showTransaction=true.)
2017-05-23Merge #9539: [net] Avoid initialization to a value that is never readWladimir J. van der Laan
5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
2017-05-23Merge #10295: [qt] Move some WalletModel functions into CWalletWladimir J. van der Laan
108f04f Add missing LOCK2 in CWallet::GetAvailableBalance (Russell Yanofsky) 429aa9e [test] Move some tests from qt -> wallet (Russell Yanofsky) d944bd7 [qt] Move some WalletModel functions into CWallet (Russell Yanofsky) ef8ca17 [test] Add tests for some walletmodel functions (Russell Yanofsky) Tree-SHA512: f6384d9f2ff3f7fb173d414588c3e7dc8c311b8ed2ce2b0979fb824a0ed83a7302890ccd3d83197f07f6fdcb6b1ca151584d90ea1961d88dfe8956c87087cde8
2017-05-23Merge #9571: RPC: getblockchaininfo returns BIP signaling statisticsWladimir J. van der Laan
557c9a6 RPC: getblockchaininfo: BIP9 stats (Matthew Zipkin) Tree-SHA512: ecf0bf47f04f92becc77acc649fdfa270e768939acce42df39d30069398d40d9a30539862f7c307e08239f78d5c58c470ca5f6e717d2ab8e24db9be0dd7bec0c
2017-05-23Merge #10421: [qt] Remove excess logic: Prefer "return foo;" to "if (foo) { ↵Wladimir J. van der Laan
return true; } else { return false; }" e49b868 [qt] Remove excess logic (practicalswift) Tree-SHA512: ffcdc94843ea5ddd05ab5acec1f047def8d910da8f53c5019ec49199828d7c370efaedc801537b8e1f44e87f694d19d04b70c240416d2eddfaff9cd4abe3ca07
2017-05-23Merge #10372: Add perf counter data to GetStrongRandBytes state in schedulerWladimir J. van der Laan
888cce5 Add perf counter data to GetStrongRandBytes state in scheduler (Matt Corallo) 399fb8f Add internal method to add new random data to our internal RNG state (Matt Corallo) Tree-SHA512: 9732a3804d015eaf48d56b60c73880014845fd17a098f1ac2eff6bd50a4beb8b8be65956ac1f0d641e96e3a53c17daddd919401edbf2e3797c3fb687730fb913
2017-05-23Merge #10410: Fix importwallet edge case rescan bugWladimir J. van der Laan
2a8e35a Fix importwallet edge case rescan bug (Russell Yanofsky) Tree-SHA512: 59522c962290f9ef64436349d11183dd1fd829e515d1f5ec802b63dd813d04303e28d4f3ba38df77a6c151ee4c14f3ca5d3d82204c57456ac94054de62ae4bc7
2017-05-23[trivial] Fix three recently introduced typospracticalswift
``` $ git blame src/policy/fees.cpp | grep becuase 3810e976 (2017-03-07 11:33:44 -0500 789) * checks for 2*target becuase we are taking the max over all time $ git blame src/policy/fees.h | grep successfullly 2d2e1705 (2017-04-12 12:29:03 -0400 54) * representing that a tx was successfullly confirmed in less than or equal to $ git blame src/wallet/feebumper.cpp | grep "hasen't" a3878374 (2017-05-11 09:34:39 +0200 258) // make sure the transaction still has no descendants and hasen't been mined in the meantime ```
2017-05-22Add perf counter data to GetStrongRandBytes state in schedulerMatt Corallo
2017-05-22Add internal method to add new random data to our internal RNG stateMatt Corallo
2017-05-22Merge #10390: [wallet] remove minimum total fee optionWladimir J. van der Laan
091a9ae remove minimum total fee option (Gregory Sanders) Tree-SHA512: 9be4df3dab0219f30917211408f47b242f7c96dd7663b06ab1cf3cc63027f14956dc680883be6c58673b6452d0f339cf893694e4f21d0d248e70760614d5a344
2017-05-22Merge #10415: [tests] Speed up fuzzing by ~200x when using afl-fuzzWladimir J. van der Laan
693247b [test] Speed up fuzzing by ~200x when using afl-fuzz (practicalswift) Tree-SHA512: 95922fc2616b8cb00dd531ed1140a52bbda4e04292dd8c1c60a8f49dbf6ccb797a18b61180b3fb68d695456b478a1f5ae7fda47e8ecee41dd65555487aef40a3
2017-05-22Merge #10424: Populate services in GetLocalAddressWladimir J. van der Laan
3070134 Populate services in GetLocalAddress (Alex Morcos) Tree-SHA512: b822d7e898ccb5b959ccb1b1d0f159f27190c2105fbf8f5b67ae54debab6fa6a0723d65a66e7341f55cd0d80398c3fbb39a41e067b9f4e0bfa2c1cd366032404
2017-05-22Merge #10431: Prevent shadowing the global dustRelayFeeMarcoFalke
43c5877 Prevent shadowing the global dustRelayFee. (Pavel Janík) Tree-SHA512: 9765931a7753c484990003396afd0bb65a53f42d1cad9502017720618ce90b3c5ae68591db01e3524adecdbe6925a5eeeebf04012ba644ef3b65073af207ae5d
2017-05-19Merge #10429: tests: fix spurious addrman test failureWladimir J. van der Laan
6b51b0a tests: fix spurious addrman test failure (Cory Fields) Tree-SHA512: 3d41723b1a31ff459d950331ffea7f383e4ef6187990be6a634978bead0c29d7c096f68e7edb6d4dc56069c1fe8a6f12a6daf573cb1e542b15d000eaa54ad288
2017-05-19[Trivial] Add BITCOIN_FS_H endif footer in fs.hAhmad Kazi
2017-05-19Prevent shadowing the global dustRelayFee.Pavel Janík