aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
AgeCommit message (Collapse)Author
2021-04-04Fix assumeutxo crash due to missing base_blockhashMarcoFalke
2021-04-01Merge #21567: docs: fix various misleading commentsW. J. van der Laan
4eca20d6f7d850492d331d89d1cdd77abb3c70c1 [doc] correct comment about ATMPW (glozow) 8fa74aeb5b96419c7d40b40f8e1e1269509278e2 [doc] correct comment in chainparams (glozow) 2f8272c2a4b6fa84c04dfeb4d751bb218f2d4c78 [doc] GetBestBlock() doesn't do nothing (gzhao408) Pull request description: Came across a few misleading comments, wanted to fix them ACKs for top commit: jnewbery: ACK 4eca20d6f7 MarcoFalke: ACK 4eca20d6f7d850492d331d89d1cdd77abb3c70c1 laanwj: Code review ACK 4eca20d6f7d850492d331d89d1cdd77abb3c70c1 Tree-SHA512: 5bef1f1e7703f304128cf0eb8945e139e031580c99062bbbe15bf4db8443c2ba5a8c65844833132e6646c8980c678fc1d2ab0c63e17105585d583570ee350fd0
2021-04-01[doc] correct comment about ATMPWglozow
ATMPW stands for AcceptToMemoryPoolWorker, which was removed in #16400.
2021-04-01[doc] GetBestBlock() doesn't do nothinggzhao408
This has tripped people up multiple times because it looks like GetBestBlock is a const function returning the value of hashBlock.
2021-03-30validation: Make BlockManager::LookupBlockIndex constCarl Dong
2021-03-22refactor: return std::nullopt instead of {}fanquake
In #21415 we decided to return `std::optional` rather than `{}` for uninitialized values. This PR repalces the two remaining usages of `{}` with `std::nullopt`. As a side-effect, this also quells the spurious GCC 10.2.x warning that we've had reported quite a few times. i.e #21318, #21248, #20797. ```bash txmempool.cpp: In member function ‘CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>&) const’: txmempool.cpp:898:13: warning: ‘<anonymous>’ may be used uninitialized in this function [-Wmaybe-uninitialized] 898 | return {}; | ^ ```
2021-03-20Merge #20921: validation: don't try to invalidate genesis block in ↵MarcoFalke
CChainState::InvalidateBlock 787df19b09babf50dd8124b3ac990b29c33cfe93 validation: don't try to invalidate genesis block (Sebastian Falbesoner) Pull request description: In the block invalidation method (`CChainState::InvalidateBlock`), the code for creating the candidate block map assumes that the passed block's previous block (`pindex->pprev`) is available and otherwise segfaults due to null-pointer deference in `CBlockIndexWorkComparator()` (see analysis by practicalswift in #20914), i.e. it doesn't work with the genesis block. Rather than analyzing all possible code paths and implications for this corner case, simply fail early if the genesis block is passed. Fixes #20914. ACKs for top commit: sipa: ACK 787df19b09babf50dd8124b3ac990b29c33cfe93. Tested invalidation of generic on regtest. practicalswift: Tested ACK 787df19b09babf50dd8124b3ac990b29c33cfe93 Tree-SHA512: 978be7cf2bd1c1faebfe945d191ac77dea72791bea826459abd308f77c74c5991efee495a38817c306e488ecd5208b5c888df7d9d044132dd9a06bbbdb256b6c
2021-03-17Merge #21415: refactor: remove Optional & nulloptWladimir J. van der Laan
ebc4ab721b0371c0ef217c0f5bd7d42613e951e6 refactor: post Optional<> removal cleanups (fanquake) 57e980d13ca488031bde6ef197cf34d493d36796 scripted-diff: remove Optional & nullopt (fanquake) Pull request description: Same rationale & motivation as #21404, which turned out to be quite low in the number of potential conflicts. Lets see what the bot has to say here. ACKs for top commit: practicalswift: cr ACK ebc4ab721b0371c0ef217c0f5bd7d42613e951e6: patch looks correct jnewbery: utACK ebc4ab721b0371c0ef217c0f5bd7d42613e951e6 laanwj: Code review ACK ebc4ab721b0371c0ef217c0f5bd7d42613e951e6 Tree-SHA512: 550fbeef09b9d35ddefaa805d1755c18c8fd499c4b0f77ebfece8c20296a7abd1cf6c699e2261f92fe3552deeb7555ec2a2287ffe3ab9e98bb9f8612a4d43be3
2021-03-17refactor: post Optional<> removal cleanupsfanquake
2021-03-15Merge #19259: fuzz: Add fuzzing harness for LoadMempool(...) and ↵MarcoFalke
DumpMempool(...) 68afd3eeec27a270765ad26cd62d87cd0935e99f tests: Add fuzzing harness for LoadMempool(...) and DumpMempool(...) (practicalswift) 91af6b97c9197f8ac9766a8559dd50bbc443ad38 validation: Make DumpMempool(...) and LoadMempool(...) easier to test/fuzz/mock (practicalswift) af322c7494d6bc4b94890c85d16623b082c4fe24 tests: Set errno in FuzzedFileProvider. Implement seek(..., ..., SEEK_END). (practicalswift) Pull request description: Add fuzzing harness for `LoadMempool(...)` and `DumpMempool(...)`. See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets). Happy fuzzing :) ACKs for top commit: jonatack: Tested re-ACK 68afd3eeec27a270765ad26cd62d87cd0935e99f Tree-SHA512: 4b5fcaa87e6eb478611d3b68eb6859645a5e121e7e3b056ad2815699dace0a6123706ff542def371b47f4ab3ce2b8a29782026d84fb505827121e9b4cc7dac31
2021-03-15scripted-diff: remove Optional & nulloptfanquake
-BEGIN VERIFY SCRIPT- git rm src/optional.h sed -i -e 's/Optional</std::optional</g' $(git grep -l 'Optional<' src) sed -i -e 's/{nullopt}/{std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt;/ std::nullopt;/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt)/ std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/(nullopt)/(std::nullopt)/g' $(git grep -l 'nullopt' src) sed -i -e 's/ nullopt,/ std::nullopt,/g' $(git grep -l 'nullopt' src) sed -i -e 's/? nullopt :/? std::nullopt :/g' $(git grep -l 'nullopt' src) sed -i -e 's/: nullopt}/: std::nullopt}/g' $(git grep -l 'nullopt' src) sed -i -e '/optional.h \\/d' src/Makefile.am sed -i -e '/#include <optional.h>/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp sed -i -e 's/#include <optional.h>/#include <optional>/g' $(git grep -l '#include <optional.h>' src) -END VERIFY SCRIPT-
2021-03-12Merge #21404: refactor: Remove MakeUnique<T>()MarcoFalke
1a6323bdbe20bdb7b1c907d8fa0333ffa88b21ff doc: update developer notes for removal of MakeUnique (fanquake) 3ba2840e7ee81341b0748c0121aedc2e9305041a scripted-diff: remove MakeUnique<T>() (fanquake) Pull request description: Since requiring C++17, this is just pointless abstraction. I think we should just "tear the band-aid off" and remove it. Similar to the changes happening in #21366. Also, having a comment saying this is deprecated doesn't prevent it's usage in new code. i.e : https://github.com/bitcoin/bitcoin/pull/20946#discussion_r561949731. The repository is fairly quiet at the moment, so any potential complaints about having to rebase should be minimal. Might as well get this over and done with. ACKs for top commit: jnewbery: utACK 1a6323bdbe20bdb7b1c907d8fa0333ffa88b21ff practicalswift: cr ACK 1a6323bdbe20bdb7b1c907d8fa0333ffa88b21ff: patch looks correct ajtowns: ACK 1a6323bdbe20bdb7b1c907d8fa0333ffa88b21ff -- code review only glozow: ACK https://github.com/bitcoin/bitcoin/commit/1a6323bdbe20bdb7b1c907d8fa0333ffa88b21ff looks correct Tree-SHA512: 4a14b9611b60b9b3026b54d6f5a2dce4c5d9b63a7b93d7de1307512df736503ed84bac66e7b93372c76e3117f49bf9f29cd473d3a47cb41fb2775bc10234736f
2021-03-11validation: Make DumpMempool(...) and LoadMempool(...) easier to test/fuzz/mockpracticalswift
2021-03-11scripted-diff: remove MakeUnique<T>()fanquake
-BEGIN VERIFY SCRIPT- git rm src/util/memory.h sed -i -e 's/MakeUnique/std::make_unique/g' $(git grep -l MakeUnique src) sed -i -e '/#include <util\/memory.h>/d' $(git grep -l '#include <util/memory.h>' src) sed -i -e '/util\/memory.h \\/d' src/Makefile.am -END VERIFY SCRIPT-
2021-03-08node/coinstats: Pass in BlockManager to GetUTXOStatsCarl Dong
2021-03-03validation: CVerifyDB::VerifyDB: Use locking annotationCarl Dong
...instead of recursively locking unconditionally
2021-03-03validation: Use existing chain member in CChainState::LoadGenesisBlockCarl Dong
2021-03-03validation: Use existing chain member in CChainState::AcceptBlockCarl Dong
2021-03-03validation: Pass in chain to FindBlockPos+SaveBlockToDiskCarl Dong
2021-03-03validation: Use *this in CChainState::ActivateBestChainStepCarl Dong
2021-03-03validation: Pass in chainstate to CTxMemPool::checkCarl Dong
This is the only instance where validation reaches for something outside of it.
2021-03-01validation: Use *this in CChainState::InvalidateBlockCarl Dong
2021-03-01validation: Move LoadBlockIndexDB to CChainStateCarl Dong
CChainState needed cuz setBlockIndexCandidates
2021-03-01validation: Move invalid block handling to CChainStateCarl Dong
- InvalidChainFound - CheckForkWarningConditions
2021-03-01validation: Pass in chainstate to CVerifyDB::VerifyDBCarl Dong
2021-03-01validation: Remove global ::VersionBitsTip{State,SinceHeight,Statistics}Carl Dong
Tip: versionbitscache is currently a global so we didn't need to pass it in to any of ::VersionBitsTip*'s callers
2021-03-01validation: Pass in chainstate to ::PruneBlockFilesManualCarl Dong
2021-03-01validation: Pass in chainstate to UpdateTipCarl Dong
2021-02-22validation: Remove global ::{{Precious,Invalidate}Block,ResetBlockFailureFlags}Carl Dong
2021-02-22validation: Remove global ::LoadGenesisBlockCarl Dong
2021-02-22validation: Check chain tip is non-null in CheckFinalTxCarl Dong
...also update comments to remove mention of ::ChainActive() From: https://github.com/bitcoin/bitcoin/pull/20750#discussion_r579400663 > Also, what about passing a const reference instead of a pointer? I > know this is only theoretical, but previously if the tip was nullptr, > then Height() evaluated to -1, now it evaluates to UB
2021-02-22Merge #21202: [validation] Two small clang lock annotation improvementsMarcoFalke
25c57d640992255ed67964a44b17afbfd4bed0cf [doc] Add a note about where lock annotations should go. (Amiti Uttarwar) ad5f01b96045f304b6cf9100879592b835c49c40 [validation] Move the lock annotation from function definition to declaration (Amiti Uttarwar) Pull request description: Based on reviewing #21188 the first commit switches the lock annotations on `CheckInputScripts` to be on the function declaration instead of on the function definition. this ensures that all call sites are checked, not just ones that come after the definition. the second commit adds a note to the developer-notes section to clarify where the annotations should be applied. ACKs for top commit: MarcoFalke: ACK 25c57d640992255ed67964a44b17afbfd4bed0cf 🥘 promag: Code review ACK 25c57d640992255ed67964a44b17afbfd4bed0cf. Tree-SHA512: 61b6ef856bf6c6016d535fbdd19daf57b9e59fe54a1f30d47282a071b9b9d60b2466b044ee57929e0320cb1bdef52e7a1687cacaa27031bbc43d058ffffe22ba
2021-02-18style-only: Make AcceptToMemoryPool signature readableCarl Dong
2021-02-18style-only: Make CheckSequenceLock signature readableCarl Dong
2021-02-18validation: Use *this in CChainState::LoadMempoolCarl Dong
2021-02-18validation: Pass in chainstate to UpdateMempoolForReorgCarl Dong
2021-02-18validation: Pass in chainstate to CTxMemPool::removeForReorgCarl Dong
Several other parameters are now redundant since they can be safely obtained from the chainstate given that ::cs_main is locked. These are now removed.
2021-02-18validation: Pass in chain to ::TestLockPointValidityCarl Dong
2021-02-18validation: Remove old AcceptToMemoryPool w/o chainstate paramCarl Dong
2021-02-18validation: Pass in chainstate to ::AcceptToMemoryPoolCarl Dong
2021-02-18validation: Pass in chainstate to ::LoadMempoolCarl Dong
2021-02-18validation: Pass in chainstate to AcceptToMemoryPoolWithTimeCarl Dong
2021-02-18validation: Add chainstate member to MemPoolAcceptCarl Dong
2021-02-18validation: Pass in chainstate to ::CheckSequenceLocksCarl Dong
2021-02-18validation: Remove old CheckFinalTx w/o chain tip paramCarl Dong
2021-02-18validation: Pass in chain tip to ::CheckFinalTxCarl Dong
2021-02-18validation: Pass in coins tip to CheckInputsFromMempoolAndCacheCarl Dong
2021-02-18validation: Pass in chainstate to IsCurrentForFeeEstimationCarl Dong
2021-02-18validation: Pass in coins cache to ::LimitMempoolSizeCarl Dong
2021-02-18Merge #15946: Allow maintaining the blockfilterindex when using pruneJonas Schnelli
84716b134e9afca2fba7731de4af1f22fa1b1518 Add "index/blockfilterindex -> validation -> index/blockfilterindex" to expected circular dependencies (Jonas Schnelli) ab3a0a2fb915d8b8384c30a8b38b4b5cc35236fd Add functional test for blockfilterindex in prune-mode (Jonas Schnelli) c286a22f7b63a8bd336d5d7606c339053ee0054b Add debug startup parameter -fastprune for more effective pruning tests (Jonas Schnelli) 5e112269c311a559bfded814d3c3c438349a1986 Avoid pruning below the blockfilterindex sync height (Jonas Schnelli) 00d57ff76854938ead800767fb673a8af46eac8e Avoid accessing nullpointer in BaseIndex::GetSummary() (Jonas Schnelli) 6abe9f5b11cd4a5ecb6caca8443fe2950a417842 Allow blockfilter in conjunction with prune (Jonas Schnelli) Pull request description: Maintaining the blockfilterindexes in prune mode is possible and may lead to efficient p2p based rescans of wallets (restore backups, import/sweep keys) beyond the prune height (rescans not part of that PR). This PR allows running the blockfilterindex(es) in conjunction with pruning. * Bitcoind/Qt will shutdown during startup when missing block data has been detected ([re]enable `-blockfilterindex` when we already have pruned) * manual block pruning is disabled during blockfilterindex sync * auto-pruning is delayed during blockfilterindex sync ToDos: * [x] Functional tests ACKs for top commit: fjahr: Code review ACK 84716b1 ryanofsky: Code review ACK 84716b134e9afca2fba7731de4af1f22fa1b1518. Only changes since last review were suggested new FindFilesToPrune argument and test. benthecarman: tACK 84716b134e9afca2fba7731de4af1f22fa1b1518 Tree-SHA512: 91d832c6c562c463f7ec7655c08956385413a99a896640b9737bda0183607fac530435d03d87c3c0e70c61ccdfe73fe8f3639bc7d26d33ca7e60925ebb97d77a