aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | Switch CCoinsView and chainstate db from per-txid to per-txoutPieter Wuille2017-06-011-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Switch CScriptCheck to use Coin instead of CCoinsPieter Wuille2017-06-011-4/+4
| | | | |
| * | | | Only pass things committed to by tx's witness hash to CScriptCheckMatt Corallo2017-06-011-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Switch from per-tx to per-txout CCoinsViewCache methods in some placesPieter Wuille2017-06-011-51/+36
| | | | |
| * | | | Optimization: Coin&& to ApplyTxInUndoPieter Wuille2017-06-011-5/+5
| | | | | | | | | | | | | | | | | | | | This avoids a prevector copy in ApplyTxInUndo.
| * | | | Replace CTxInUndo with CoinPieter Wuille2017-06-011-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Store/allow tx metadata in all undo recordsPieter Wuille2017-05-261-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Remove/ignore tx version in utxo and undoPieter Wuille2017-05-261-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Introduce CHashVerifier to hash read dataPieter Wuille2017-05-261-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | error() in disconnect for disk corruption, not inconsistencyPieter Wuille2017-05-261-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | | | | Merge #10464: Introduce static DoWarning (simplify UpdateTip)Pieter Wuille2017-05-301-14/+15
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f28514576 Introduce static DoWarning (simplify UpdateTip) (Jorge Timón) Tree-SHA512: 58b39f00bc921d47d199ef1cc15e9e36f918ec86e9182de46dc2f24fa9474853a92b18d330a274a3ea7c9b001681fdfa3d86aa2bbebb5c92ac8c5a6f7690dfc1
| * | | | | Introduce static DoWarning (simplify UpdateTip)Jorge Timón2017-05-271-14/+15
| |/ / / /
* | | | | Merge #9208: Improve DisconnectTip performanceWladimir J. van der Laan2017-05-301-30/+95
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | c1235e3 Add RecursiveDynamicUsage overload for std::shared_ptr (Russell Yanofsky) 71f1903 Store disconnected block transactions outside mempool during reorg (Suhas Daftuar) 9decd64 [qa] Relax assumptions on mempool behavior during reorg (Suhas Daftuar) Tree-SHA512: c160ad853a5cd060d0307af7606a0c77907497ed7033c9599b95e73d83f68fdfcd4214bd8a83db1c5b7a58022722b9de1ed2e6ea2e02f38a7b6c717f079dd0c6
| * | | | Store disconnected block transactions outside mempool during reorgSuhas Daftuar2017-05-041-30/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than re-add disconnected block transactions back to the mempool immediately, store them in a separate disconnectpool for later processing, because we expect most such transactions to reappear in the chain that is still to be connected (and thus we can avoid the work of reprocessing those transactions through the mempool altogether).
* | | | | Merge #10347: Use range-based for loops (C++11) when looping over vector ↵Pieter Wuille2017-05-231-3/+2
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | elements 211adc0 Use range-based for loops (C++11) when looping over vector elements (practicalswift) Tree-SHA512: 0e007f20dcef99d3c7a1036265e00f689d69f42e02fd82dd8389f45b52d31947e5f9388de2610d3d9bd9f554915ce0d35ebce561e5ae3a9013956d0ee4937145
| * | | | | Use range-based for loops (C++11) when looping over vector elementspracticalswift2017-05-191-3/+2
| | |/ / / | |/| | |
* | | | | Merge #9571: RPC: getblockchaininfo returns BIP signaling statisticsWladimir J. van der Laan2017-05-231-0/+6
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | 557c9a6 RPC: getblockchaininfo: BIP9 stats (Matthew Zipkin) Tree-SHA512: ecf0bf47f04f92becc77acc649fdfa270e768939acce42df39d30069398d40d9a30539862f7c307e08239f78d5c58c470ca5f6e717d2ab8e24db9be0dd7bec0c
| * | | | RPC: getblockchaininfo: BIP9 statsMatthew Zipkin2017-03-241-0/+6
| | | | | | | | | | | | | | | | | | | | add RPC tests for BIP9 counting stats
* | | | | Merge #8329: Consensus: MOVEONLY: Move functions for tx verificationWladimir J. van der Laan2017-05-181-243/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 618d07f MOVEONLY: tx functions to consensus/tx_verify.o (Jorge Timón) Tree-SHA512: 63fa2777c070a344dbfe61974526a770d962e049881c6f371b0034b1682c1e6e24f47454f01ee35ded20ade34488e023d4467a05369662906b99a73bb5de8497
| * | | | | MOVEONLY: tx functions to consensus/tx_verify.oJorge Timón2017-04-061-243/+1
| | | | | | | | | | | | | | | | | | | | | | | | Functions related to transaction verification.
* | | | | | Output line to debug.log when IsInitialBlockDownload latches to falseAlex Morcos2017-05-111-0/+1
| |_|/ / / |/| | | |
* | | | | Merge #10297: Simplify DisconnectBlock arguments/return valuePieter Wuille2017-05-021-26/+33
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | db994b2 Simplify DisconnectBlock arguments/return value (Pieter Wuille) Tree-SHA512: 62ce1a85bde2a5baffb9173ed28f2d8008200ecf8b09332122f1516fe68b33b9d7223cc1c2fffe804e38f767874c6353b76bd483e8ad7d48c4a5e80d6b683039
| * | | | | Simplify DisconnectBlock arguments/return valuePieter Wuille2017-04-281-26/+33
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DisconnectBlock currently has a complicated interface: Situation Return value pfClean != nullptr pfClean == nullptr All good: true true Failure: false false Unclean rewind: true false with *pfClean=false Change this to return a tristate enum instead. As an added bonus, remove the ValidationState& argument which was unused.
* | | | | Merge #10175: Remove excess logic.Wladimir J. van der Laan2017-05-021-4/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9a763d4 Remove excess logic. (practicalswift) Tree-SHA512: cfef280cc9cccf5042c9c49a8cd6fb6700764671cdd0d988149121f56c2d43a9ac38c5fc99c92385a9619d2d846480e02a9d655fa2586b1c284961b4634c229b
| * | | | | Remove excess logic.practicalswift2017-04-101-4/+1
| | |/ / / | |/| | |
* | | | | Fix potential NPD introduced in b297426cMatt Corallo2017-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/bitcoin/bitcoin/pull/10290#discussion_r113954232 for more info.
* | | | | Add -stopatheight for benchmarkingPieter Wuille2017-04-271-0/+3
| |/ / / |/| | |
* | | | Merge #10201: pass Consensus::Params& to ReceivedBlockTransactions()Wladimir J. van der Laan2017-04-211-4/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | 25660e9 pass Consensus::Params& to ReceivedBlockTransactions() (Mario Dian) Tree-SHA512: d3a5b19d93313e4bda622b322bc9cbfb7e31486010eac40fca6eea9703f814f9667f778122ba7366bb304482a2c03e2e3325083beecac374751692361952e467
| * | | | pass Consensus::Params& to ReceivedBlockTransactions()Mario Dian2017-04-131-4/+4
| | | | |
* | | | | Merge #10181: Include cleanupWladimir J. van der Laan2017-04-201-0/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1c897fc Missing includes (Jorge Timón) a1fd450 Trivial: Remove unneeded includes from .h: (Jorge Timón) Tree-SHA512: ada3e62cc2435e58172a88b380be371b717a05725956c15e5493b6e19fe2903e5e6e43fd22dc24699333a0e8a0c7b42eb1ae61b41cb4ba82495be18e2d4ef3c6
| * | | | | Trivial: Remove unneeded includes from .h:Jorge Timón2017-04-131-0/+1
| |/ / / / | | | | | | | | | | | | | | | | | | | | - validation.h doesn't need to include chain.h anymore - Remove unneeded includes from net.h
* | | | | Merge #9942: Refactor CBlockPolicyEstimatorWladimir J. van der Laan2017-04-201-1/+2
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 68af651 MOVEONLY: move TxConfirmStats to cpp (Alex Morcos) 2332f19 Initialize TxConfirmStats in constructor (Alex Morcos) 5ba81e5 Read and Write fee estimate file directly from CBlockPolicyEstimator (Alex Morcos) 14e10aa Call estimate(Smart)Fee directly from CBlockPolicyEstimator (Alex Morcos) dbb9e36 Give CBlockPolicyEstimator it's own lock (Alex Morcos) f6187d6 Make processBlockTx private. (Alex Morcos) ae7327b Make feeEstimator its own global instance of CBlockPolicyEstimator (Alex Morcos) Tree-SHA512: dbf3bd2b30822e609a35f3da519b62d23f8a50e564750695ddebd08553b4c01874ae3e07d792c6cc78cc377d2db33b951ffedc46ac7edaf5793f9ebb931713af
| * | | | | Make feeEstimator its own global instance of CBlockPolicyEstimatorAlex Morcos2017-04-101-1/+2
| | | | | |
* | | | | | Remove CValidationInterface::UpdatedTransactionMatt Corallo2017-04-131-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes another callback from block connection logic, making it easier to reason about the wallet-RPCs-returns-stale-info issue. UpdatedTransaction was previously used by the GUI to display coinbase transactions only after they have a block built on top of them. This worked fine for in most cases, but only worked due to a corner case if the user received a coinbase payout in a block immediately prior to restart. In that case, the normal process of caching the most recent coinbase transaction's hash would not work, and instead it would only work because of the on-load -checkblocks calling DisconnectBlock and ConnectBlock on the current tip. In order to make this more robust, a full mapWallet loop after the first block which is connected after restart was added.
* | | | | | Make DisconnectBlock and ConnectBlock static in validation.cppMatt Corallo2017-04-101-3/+10
| |/ / / / |/| | | |
* | | | | Merge #9725: CValidationInterface CleanupsWladimir J. van der Laan2017-04-101-67/+75
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b1a6d4c Take a CTransactionRef in AddToWalletIfInvolvingMe to avoid a copy (Matt Corallo) 1c95e2f Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining (Matt Corallo) 91f1e6c Remove dead-code tracking of requests for blocks we generated (Matt Corallo) acad82f Add override to functions using CValidationInterface methods (Matt Corallo) e6d5e6c Hold cs_wallet for whole block [dis]connection processing (Matt Corallo) 461e49f SyncTransaction->TxAddedToMempool/BlockConnected/Disconnected (Matt Corallo) f404334 Handle SyncTransaction in ActivateBestChain instead of ConnectTrace (Matt Corallo) a147687 Keep conflictedTxs in ConnectTrace per-block (Matt Corallo) d3167ba Handle conflicted transactions directly in ConnectTrace (Matt Corallo) 29e6e23 Make ConnectTrace::blocksConnected private, hide behind accessors (Matt Corallo) 822000c Add pblock to connectTrace at the end of ConnectTip, not start (Matt Corallo) f5e9a01 Include missing #include in zmqnotificationinterface.h (Matt Corallo) Tree-SHA512: 8893d47559da3b28d2ef7359768547cba8a4b43b6f891d80f5848f995a84b1517bfb0f706fdc8cd43f09a1350349eb440d9724a59363ab517dfcc4fcb31b2018
| * | | | SyncTransaction->TxAddedToMempool/BlockConnected/DisconnectedMatt Corallo2017-04-071-27/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies fixing the wallet-returns-stale-info issue as we can now hold cs_wallet across an entire block instead of only per-tx (though we only actually do so in the next commit). This change also removes the NOT_IN_BLOCK constant in favor of only passing the CBlockIndex* parameter to SyncTransactions when a new block is being connected, instead of also when a block is being disconnected. This change adds a parameter to BlockConnectedDisconnected which lists the transactions which were removed from mempool due to confliction as a result of this operation. While its somewhat of a shame to make block-validation-logic generate a list of mempool changes to be included in its generated callbacks, fixing this isnt too hard. Further in this change-set, CValidationInterface starts listening to mempool directly, placing it in the middle and giving it a bit of logic to know how to route notifications from block-validation, mempool, etc (though not listening for conflicted-removals yet).
| * | | | Handle SyncTransaction in ActivateBestChain instead of ConnectTraceMatt Corallo2017-04-071-26/+48
| | | | | | | | | | | | | | | | | | | | | | | | | This makes a later change to move it all into one per-block callback simpler.
| * | | | Keep conflictedTxs in ConnectTrace per-blockMatt Corallo2017-04-071-7/+11
| | | | |
| * | | | Handle conflicted transactions directly in ConnectTraceMatt Corallo2017-04-071-45/+39
| | | | |
| * | | | Make ConnectTrace::blocksConnected private, hide behind accessorsMatt Corallo2017-04-071-2/+12
| | | | |
| * | | | Add pblock to connectTrace at the end of ConnectTip, not startMatt Corallo2017-04-071-8/+7
| |/ / / | | | | | | | | | | | | | | | | This makes ConnectTip responsible for the ConnectTrace instead of splitting the logic between ActivateBestChainStep and ConnectTip
* | | | Merge #10135: [p2p] Send the correct error code in reject messagesWladimir J. van der Laan2017-04-101-4/+6
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | 5d08c9c Send the correct error code in reject messages (John Newbery) Tree-SHA512: 0cd3ef3ae202584b138cc0bbfba4125635822e0c5a755fb9276a604b39286959ab22dabc3104aa5d7e71358cd69d965de2a333ff04bf3e8ed43cf0296ac01264
| * | | Send the correct error code in reject messagesJohn Newbery2017-03-311-4/+6
| |/ /
* | | Merge #9902: Lightweight abstraction of boost::filesystemWladimir J. van der Laan2017-04-061-12/+11
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f110272 Remove `namespace fs=fs` (Wladimir J. van der Laan) 75594bd torcontrol: Use fs::path instead of std::string for private key path (Wladimir J. van der Laan) 2a5f574 Use fsbridge for fopen and freopen (Wladimir J. van der Laan) bac5c9c Replace uses of boost::filesystem with fs (Wladimir J. van der Laan) 7d5172d Replace includes of boost/filesystem.h with fs.h (Wladimir J. van der Laan) 19e36bb Add fs.cpp/h (Wladimir J. van der Laan) Tree-SHA512: 2c34f059dfa6850b9323f3389e9090a6b5f839a457a2960d182c2ecfafd9883c956f5928bb796613402d3aad68ebc78259796a7a313f4a6cfa98aaf507a66842
| * | | Use fsbridge for fopen and freopenWladimir J. van der Laan2017-04-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Abstracts away how a path is opened to a `FILE*`. Reduces the number of places where path is converted to a string for anything else but printing.
| * | | Replace uses of boost::filesystem with fsWladimir J. van der Laan2017-04-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Step two in abstracting away boost::filesystem. To repeat this, simply run: ``` git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g' ```
| * | | Replace includes of boost/filesystem.h with fs.hWladimir J. van der Laan2017-04-031-2/+1
| | | | | | | | | | | | | | | | This is step one in abstracting the use of boost::filesystem.
* | | | Merge #10133: Clean up calculations of pcoinsTip memory usageWladimir J. van der Laan2017-04-051-3/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1b55e07 Make threshold for flushing more conservative. (Alex Morcos) f33afd3 Lower default memory footprint slightly (Alex Morcos) 5b95a19 Make pcoinsTip memory calculations consistent (Alex Morcos) Tree-SHA512: d0061138596cf89008397b8729d9b25293938b1ad454cc99a6fe2f6210e94f76dfa78a8f0fce4c1ba3efec4e742a9c1a3ab26676a4a8346d3e7c3055d032669b
| * | | | Make threshold for flushing more conservative.Alex Morcos2017-03-311-2/+3
| | | | | | | | | | | | | | | | | | | | Always leave a reasonable buffer of 50MB for usage from newly connected block (once over 50%) and increase the high water mark buffer to 200MB.