aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge #15552: 0.18: Granular invalidateblock and RewindBlockIndexWladimir J. van der Laan2019-03-071-120/+187
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 519b0bc5dc5155b6f7e2362c2105552bb7618ad0 Make last disconnected block BLOCK_FAILED_VALID, even when aborted (Pieter Wuille) 8d220417cd7bc34464e28a4861a885193ec091c2 Optimization: don't add txn back to mempool after 10 invalidates (Pieter Wuille) 9ce9c37004440d6a329874dbf66b51666d497dcb Prevent callback overruns in InvalidateBlock and RewindBlockIndex (Pieter Wuille) 9bb32eb571a846b66ed3bac493f55cee11a3a1b9 Release cs_main during InvalidateBlock iterations (Pieter Wuille) 9b1ff5c742dec0a6e0d6aab29b0bb771ad6d8135 Call InvalidateBlock without cs_main held (Pieter Wuille) 241b2c74ac8c4c3000e778554da1271e3f293e5d Make RewindBlockIndex interruptible (Pieter Wuille) 880ce7d46b51835c00d77a366ec28f54a05239df Call RewindBlockIndex without cs_main held (Pieter Wuille) 436f7d735f1c37e77d42ff59d4cbb1bd76d5fcfb Release cs_main during RewindBlockIndex operation (Pieter Wuille) 1d342875c21b5d0a17cf4d176063bb14b35b657e Merge the disconnection and erasing loops in RewindBlockIndex (Pieter Wuille) 32b2696ab4b079db736074b57bbc24deaee0b3d9 Move erasure of non-active blocks to a separate loop in RewindBlockIndex (Pieter Wuille) 9d6dcc52c6cb0cdcda220fddccaabb0ffd40068d Abstract EraseBlockData out of RewindBlockIndex (Pieter Wuille) Pull request description: Same repo and branch like "Granular invalidateblock and RewindBlockIndex #15402 ", can be merged as is. This saves us all the cherry-picks and review of the backport cherry-picks. Tree-SHA512: 20c27c5f807c3d85e0072f9e2cdefad4ad7d329d6b26658a00844d5fcf0ed729059daf765e04e6382db2b5915117b15949cd4989d864917ab105c92e2e5e9986
| * Make last disconnected block BLOCK_FAILED_VALID, even when abortedPieter Wuille2019-03-031-5/+10
| |
| * Optimization: don't add txn back to mempool after 10 invalidatesPieter Wuille2019-02-281-2/+5
| |
| * Prevent callback overruns in InvalidateBlock and RewindBlockIndexPieter Wuille2019-02-281-9/+21
| |
| * Release cs_main during InvalidateBlock iterationsPieter Wuille2019-02-281-40/+50
| |
| * Call InvalidateBlock without cs_main heldPieter Wuille2019-02-241-2/+2
| |
| * Make RewindBlockIndex interruptiblePieter Wuille2019-02-241-1/+1
| |
| * Release cs_main during RewindBlockIndex operationPieter Wuille2019-02-241-45/+57
| |
| * Merge the disconnection and erasing loops in RewindBlockIndexPieter Wuille2019-02-241-18/+21
| |
| * Move erasure of non-active blocks to a separate loop in RewindBlockIndexPieter Wuille2019-02-241-6/+15
| | | | | | | | | | This lets us simplify the iteration to just walking back in the chain, rather than looping over all of mapBlockIndex.
| * Abstract EraseBlockData out of RewindBlockIndexPieter Wuille2019-02-241-27/+40
| | | | | | | | | | | | | | Note that the former 'else' branch in RewindBlockIndex is now dealt with more naturally inside the EraseBlockData call (by checking whether the parent needs to be re-added as candidate after deleting a child).
* | rpc/gui: Remove 'Unknown block versions being mined' warningWladimir J. van der Laan2019-02-251-6/+0
|/ | | | | | | | | | | Due to miners inserting garbage into the version numbers, the current version signalling has become completely useless. This removes the "unknown block versions" warning which has the tendency to scare users unnecessarily (and might get them to "update" to something bad). It preserves the warning in the logs. Whether this is desirable can be a point of discussion.
* Remove unnecessary const_castJulian Fleischer2019-02-121-1/+1
| | | | Signed-off-by: Julian Fleischer <[email protected]>
* doc: Add cs_main lock annotations for mapBlockIndexpracticalswift2019-02-011-1/+1
|
* Merge #15159: [RPC] Remove lookup to UTXO set from GetTransactionMarcoFalke2019-01-301-14/+5
|\ | | | | | | | | | | | | | | | | | | | | 04da9f4834 [RPC] Update getrawtransaction interface (Amiti Uttarwar) Pull request description: - stop checking unspent UTXOs for a transaction when txindex is not enabled, as per conversation here: https://github.com/bitcoin/bitcoin/issues/3220#issuecomment-377458383 - code contributed by sipa Tree-SHA512: aa07353bccc14b81b7803992a25d076d6bc06d15ec7c1b85828dc10aea7e0498d9b49f71783e352ab8a14b0bb2010cfb7835de3dfd1bc6f2323f460449348e66
| * [RPC] Update getrawtransaction interfaceAmiti Uttarwar2019-01-261-14/+5
| |
* | Merge #14963: mempool, validation: Explain cs_main locking semanticsMarcoFalke2019-01-151-4/+12
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | fa5e373365 validation: Add cs_main locking annotations (MarcoFalke) fa5c346c5a doc: Add comment to cs_main and mempool::cs (MarcoFalke) fafe941bdd test: Add missing validation locks (MarcoFalke) fac4558462 sync: Add RecursiveMutex type alias (MarcoFalke) Pull request description: Both the chain state and the transaction pool are validation specific, but access to them is protected by two locks. The two locks have the following semantics: * Writing to the chain state or adding transactions to the transaction pool -> Take both `cs_main` and `mempool::cs` * Reading either or removing transactions from the the transaction pool -> Take only the appropriate lock Tree-SHA512: 6f6e612ffc391904c6434a79a4f3f8de1b928bf0a3e3434b73561037b395e2b40a70a5a4bd8472dd230e9eacc8e5d5374c904a3c509910cf3971dd7ff59a626c
| * validation: Add cs_main locking annotationsMarcoFalke2018-12-221-1/+1
| |
| * doc: Add comment to cs_main and mempool::csMarcoFalke2018-12-201-3/+11
| |
* | Merge #13910: Log progress while verifying blocks at level 4MarcoFalke2019-01-041-2/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e58985c916 Log progress while verifying blocks at level 4. (Daniel Kraft) Pull request description: When verifying blocks at startup, the progress is printed in 10% increments to logs. When `-checklevel=4`, however, the second half of the verification (connecting the blocks again) does not log the progress anymore. (It is still computed and shown in the UI, but not printed to logs.) This change makes the behaviour consistent, by adding the missing progress logging also for level-4 checks. Tree-SHA512: 6a4c5914726fc1a1337de0c5130b20d4edf4e2feeb0aa0449d2ce422b2d8c41e56ede94163a02044d9a28ac4dc6624b1ad611da93ce5792ff32ad9fb1f0ea1e0
| * | Log progress while verifying blocks at level 4.Daniel Kraft2018-08-081-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When verifying blocks at startup, the progress is printed in 10% increments to logs. When -checklevel=4, however, the second half of the verification (connecting the blocks again) does not log the progress anymore. (It is still computed and shown in the UI, but not printed to logs.) This change makes the behaviour consistent, by adding the missing progress logging also for level-4 checks.
* | | Merge #13743: refactor: Replace boost::bind with std::bindMarcoFalke2018-12-291-5/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cb53b825c2 scripted-diff: Replace boost::bind with std::bind (Chun Kuan Lee) 2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform (Chun Kuan Lee) Pull request description: Replace boost::bind with std::bind - In `src/rpc/server.cpp`, replace `std::transform` with simple loop. - In `src/validation.cpp`, store the `boost::signals2::connection` object and use it to disconnect. - In `src/validationinterface.cpp`, use 2 map to store the `boost::signals2::scoped_connection` object. Tree-SHA512: 6653cbe00036fecfc495340618efcba6d7be0227c752b37b81a27184433330f817e8de9257774e9b35828026cb55f11ee7f17d6c388aebe22c4a3df13b5092f0
| * | | scripted-diff: Replace boost::bind with std::bindChun Kuan Lee2018-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for j in $(seq 1 5) do sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h') done sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h') sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h') sed -i '/boost\/bind/d' $(git grep --name-only boost/bind) -END VERIFY SCRIPT-
| * | | refactor: Use boost::scoped_connection in signal/slot, also prefer ↵Chun Kuan Lee2018-10-201-5/+2
| | | | | | | | | | | | | | | | range-based loop instead of std::transform
* | | | Merge #13930: doc: Better explain GetAncestor check for m_failed_blocks in ↵MarcoFalke2018-12-221-3/+23
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AcceptBlockHeader 66e15e8f97 Explain GetAncestor check for m_failed_blocks in AcceptBlockHeader (Sjors Provoost) Pull request description: Salvaged (but slightly modified) from #12138, the comment there was really helpful to wrap my head around that part of the code. In addition, a naive reader like yours truly will first think `IsValid(BLOCK_VALID_SCRIPTS)` means the previous block was invalid. But IIUC that's not what it means. Instead, it means the block hasn't been checked for validity at the `BLOCK_VALID_SCRIPTS` level yet. So in that case the existing text "previous block index isn't valid" is wrong. Tree-SHA512: 442a319a83290d94697fdf51376463b70454e0f3909d4a45594ddc2e7c26cd19dc703808385a25e26d6d2dddab0aa35ca41722f2e65ee6fe57bbaf62652d3ec8
| * | | Explain GetAncestor check for m_failed_blocks in AcceptBlockHeaderSjors Provoost2018-09-041-3/+23
| | |/ | |/|
* | | Merge #14834: validation: assert that pindexPrev is non-null when requiredWladimir J. van der Laan2018-12-131-0/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fbaaf782cea54dc433e72129ee1088b3169cdfd4 validation: assert that pindexPrev is non-null when required (Karl-Johan Alm) Pull request description: In `ContextualCheckBlock`, we are checking if `pindexPrev == nullptr` conditionally at the start, but then assume it is non-`null` later. This removes the latter assumption. Tree-SHA512: 95f1e9dc839b2cc0e099d155e6180634ece8c6760d00b53e7d27128762e64c92e82d98a5f4a5786b48a4851b17cdbb4b667d3b6a99adb651256e2032de67d05c
| * | | validation: assert that pindexPrev is non-null when requiredKarl-Johan Alm2018-11-291-0/+1
| | | |
* | | | Merge #14480: refactor: Drop boost::this_thread::interruption_point and ↵Wladimir J. van der Laan2018-12-071-2/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | boost::thread_interrupted in main thread b7df96f4565064bcb7cbbf7e2507e03bdcf339f0 refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread (Chun Kuan Lee) Pull request description: This PR drops useless `boost::this_thread::interruption_point` and `boost::thread_interrupted` catch. They are only executed in main thread. Tree-SHA512: a980d098c1a8238e4f0da9493731d7e69b9ca8e010103f442722d0d4cce471cc40a1fafd5f05535ad0e18899b6cf7563ee20e4025f7c7bc15182a0058c028922
| * | | | refactor: Drop boost::this_thread::interruption_point and ↵Chun Kuan Lee2018-10-151-2/+0
| | |_|/ | |/| | | | | | | | | | boost::thread_interrupted in main thread
* | | | validation: Add and use HaveTxsDownloaded where appropriateMarcoFalke2018-12-041-12/+12
| | | |
* | | | Move CheckBlock() call to critical sectionHennadii Stepanov2018-11-301-3/+5
| |/ / |/| | | | | | | | This prevents data race for CBlock::fChecked.
* | | Convert comments to thread safety annotationsMarcoFalke2018-11-201-4/+2
| | |
* | | scripted-diff: Move util files to separate directory.Jim Posen2018-11-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- mkdir -p src/util git mv src/util.h src/util/system.h git mv src/util.cpp src/util/system.cpp git mv src/utilmemory.h src/util/memory.h git mv src/utilmoneystr.h src/util/moneystr.h git mv src/utilmoneystr.cpp src/util/moneystr.cpp git mv src/utilstrencodings.h src/util/strencodings.h git mv src/utilstrencodings.cpp src/util/strencodings.cpp git mv src/utiltime.h src/util/time.h git mv src/utiltime.cpp src/util/time.cpp sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp') sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj -END VERIFY SCRIPT-
* | | Merge #13783: validation: Pass tx pool reference into CheckSequenceLocksMarcoFalke2018-10-271-4/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fa511e8dad Pass tx pool reference into CheckSequenceLocks (MarcoFalke) Pull request description: `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance. This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes) Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
| * | | Pass tx pool reference into CheckSequenceLocksMarcoFalke2018-09-111-4/+4
| | | |
* | | | Merge #12842: Prevent concurrent savemempoolWladimir J. van der Laan2018-10-241-0/+3
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 585b47cfe133fae112782ad0a88fe25c71d465fa rpc: Prevent concurrent savemempool (João Barbosa) Pull request description: Follow up of #12172, this change prevents calling `savemempool` RPC concurrently. Tree-SHA512: 4759a7107658a9794f5c6ab7e3e3002276abadd64996010be67a2791914d284db6fe0377c071a8d6a42387bfb0178f219b73aeec077ce5c4fe5c634a30b3e081
| * | | | rpc: Prevent concurrent savemempoolJoão Barbosa2018-10-201-0/+3
| | |/ / | |/| |
* / | | validation: Pass chainparams in AcceptToMemoryPoolWorker(...)practicalswift2018-09-241-1/+1
|/ / /
* | | Merge #14214: convert C-style (void) parameter lists to C++ style ()MarcoFalke2018-09-201-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3ccfa34b32 convert C-style (void) parameter lists to C++ style () (Arvid Norberg) Pull request description: In C, an empty parameter list, `()`, means the function takes any arguments, and `(void)` means the function does not take any parameters. In C++, an empty parameter list means the function does not take any parameters. So, C++ still supports `(void)` parameter lists with the same semantics, why change to `()`? 1. removing the redundant `void` improves signal-to-noise ratio of the code 2. using `(void)` exposes a rare inconsistency in that a template taking a template `(T)` parameter list, cannot be instantiated with `T=void` Tree-SHA512: be2897b6c5e474873aa878ed6bac098382cd21866aec33752fe40b089a6331aa6263cae749aba1b4a41e8467f1a47086d32eb74abaf09927fd5a2f44a4b2109a
| * | | convert C-style (void) parameter lists to C++ style ()Arvid Norberg2018-09-131-2/+2
| | | |
* | | | Fix crash bug with duplicate inputs within a transactionSuhas Daftuar2018-09-171-1/+1
|/ / / | | | | | | | | | Introduced by #9049
* | | Merge #13310: Report progress in ReplayBlocks while rolling forwardWladimir J. van der Laan2018-09-131-0/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | b16ab9af07f802cc769c2443df1c637e8e12ab80 Report progress in ReplayBlocks while rolling forward (João Barbosa) Pull request description: Fixes #13303. Tree-SHA512: 9375bda03bd2527018b9d24a25c82fa01a841e41ae2cb5307be61af19e2b759d3a7db76852baba9a286fbcb52f70f427a5ab4375df08215ac439e47e73633e54
| * | Report progress in ReplayBlocks while rolling forwardJoão Barbosa2018-05-231-0/+1
| | |
* | | Merge #13558: Drop unused GetType() from CSizeComputerWladimir J. van der Laan2018-09-111-6/+6
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 893628be0166b4096b6e52f516e0f65bb63a75a2 Drop minor GetSerializeSize template (Ben Woosley) da74db0940720407fafaf3582bbaf9c81a4d3b4d Drop unused GetType() from CSizeComputer (Ben Woosley) Pull request description: Based on conversation in #13462, it seems the serialization `GetType` has very narrow use/effect. In every case except for `CAddress`, which specifically relates to a network peer's address, not a wallet address etc., the serialized representation of an object is irrespective of its destination / type. This removes the unused `GetType` method from `CSizeComputer` as a step to further narrowing that use. Tree-SHA512: e72b8e9e5160396691e05aeaee3aba5a57935a75bd5005cfcc7fb51c936f3d1728a397f999da5c36696506dd815fafa5c738f3894df8864f25f91f639eba9c3d
| * | | Drop minor GetSerializeSize templateBen Woosley2018-09-111-2/+2
| | | | | | | | | | | | | | | | Now that `GetType()` is not propagated, the benefits are not worth the code.
| * | | Drop unused GetType() from CSizeComputerBen Woosley2018-09-111-4/+4
| | | |
* | | | tx pool: Use class methods to hide raw map iterator impl detailsMarcoFalke2018-09-071-15/+6
| | | |
* | | | Merge #13249: Make objects in range declarations immutable by default. Avoid ↵Wladimir J. van der Laan2018-09-041-3/+3
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unnecessary copying of objects in range declarations. f34c8c466a0e514edac2e8683127b4176ad5d321 Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations. (practicalswift) Pull request description: Make objects in range declarations immutable by default. Rationale: * Immutable objects are easier to reason about. * Prevents accidental or hard-to-notice change of value. Tree-SHA512: cad69d35f0cf8a938b848e65dd537c621d96fe3369be306b65ef0cd1baf6cc0a9f28bc230e1e383d810c555a6743d08cb6b2b0bd51856d4611f537a12e5abb8b
| * | | | Make objects in range declarations immutable by default. Avoid unnecessary ↵practicalswift2018-08-271-3/+3
| | | | | | | | | | | | | | | | | | | | copying of objects in range declarations.