aboutsummaryrefslogtreecommitdiff
path: root/src/chain.h
AgeCommit message (Collapse)Author
2020-08-27chain: Remove UB CChain comparisonCarl Dong
It was unused, and had UB
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-02-10Get rid of VARINT default argumentPieter Wuille
This removes the need for the GNU C++ extension of variadic macros.
2020-01-13Convert chain to new serializationPieter Wuille
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-10-16chain: Set all CBlockIndex members to null, remove SetNull helperMarcoFalke
2019-08-05[doc] chain: Declare BLOCK_VALID_HEADER reservedMarcoFalke
2019-03-27refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeightAntoine Riard
As suggested in #14711, pass height to CChain::FindEarliestAtLeast to simplify Chain interface by combining findFirstBlockWithTime and findFirstBlockWithTimeAndHeight into one Extend findearliestatleast_edge_test in consequence
2019-02-22scripted-diff: Rename CBlockDiskPos to FlatFilePos.Jim Posen
-BEGIN VERIFY SCRIPT- sed -i 's/CDiskBlockPos/FlatFilePos/g' $(git ls-files 'src/*.h' 'src/*.cpp') -END VERIFY SCRIPT-
2019-02-22Move CDiskBlockPos from chain to flatfile.Jim Posen
2019-01-03Don't label transactions "Open" while catching upHennadii Stepanov
Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed.
2018-12-04validation: Add and use HaveTxsDownloaded where appropriateMarcoFalke
2018-08-14[trivial] Fix typo in CDiskBlockPos struct's ToStringJon Layton
2018-07-27Update copyright headers to 2018DrahtBot
2018-05-14Break circular dependency: chain -> pow -> chainBen Woosley
chain.h does not actually depend on the methods defined in pow.h, just its include of consensus/params.h, which is standalone and can be included instead. Confirmed by inspection and successful build.
2018-03-15Add static_assert to prevent VARINT(<signed value>)Russell Yanofsky
Using VARINT with signed types is dangerous because negative values will appear to serialize correctly, but then deserialize as positive values mod 128. This commit changes the VARINT macro to trigger an error by default if called with an signed value, and updates broken uses of VARINT to pass a special flag that lets them keep working with no change in behavior.
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2017-11-16scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider
-BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
2017-11-11Merge #10749: Use compile-time constants instead of unnamed enumerations ↵MarcoFalke
(remove "enum hack") 1e65f0f33 Use compile-time constants instead of unnamed enumerations (remove "enum hack") (practicalswift) Pull request description: Use compile-time constants instead of unnamed enumerations (remove "enum hack"). Tree-SHA512: 1b6ebb2755398c5ebab6cce125b1dfc39cbd1504d98d55136b32703fe935c4070360ab3b2f52b1da48ba9f3b01082d204f3d87c92ccb5c8c333731f7f972e128
2017-09-07Ensure that data types are consistentjjz
1. nStatus of CBlockIndex is consistent with the definition of Enum(BlockStatus) 2. The BlockHeader is consistent with the type of variable defined in CBlockHeader
2017-08-16Declare single-argument (non-converting) constructors "explicit"practicalswift
In order to avoid unintended implicit conversions.
2017-08-16Merge #10956: Fix typosMarcoFalke
9d5e98ff8 Fix typos. (practicalswift) Pull request description: Fix some typos not covered by #10705. Tree-SHA512: f06e9541f6ae13ef5d6731399b61795997b21a8816abeb1749c93e99a5c47354e6cbd4a3d145f4dc6ef8a13db179799a3121ecbb7288abf3e8d81cdf81500d37
2017-08-08Fix typos.practicalswift
2017-08-07scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift
instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
2017-07-26Use compile-time constants instead of unnamed enumerations (remove "enum hack")practicalswift
2017-06-26[MOVEONLY] Move LastCommonAncestor to chainPieter Wuille
2017-03-06Merge #9908: Define 7200 second timestamp window constantWladimir J. van der Laan
e57a1fd Define 7200 second timestamp window constant (Russell Yanofsky) Tree-SHA512: 449d20e4fd23905cd96be36f717c55a0a2360aba1002aaf55a3699cce4a41f6e94acc2fbe511a93c5cbe8f8e68386995a76cad67620ebb66ba9283e6080ab567
2017-03-03Define 7200 second timestamp window constantRussell Yanofsky
2017-03-03Merge #8808: Do not shadow variables (gcc set)Wladimir J. van der Laan
ad1ae7a Check and enable -Wshadow by default. (Pavel Janík) 9de90bb Do not shadow variables (gcc set) (Pavel Janík) Tree-SHA512: 9517feb423dc8ddd63896016b25324673bfbe0bffa97f22996f59d7a3fcbdc2ebf2e43ac02bc067546f54e293e9b2f2514be145f867321e9031f895c063d9fb8
2017-01-12Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.Gregory Maxwell
In spite of the name FindLatestBefore used std::lower_bound to try to find the earliest block with a nTime greater or equal to the the requested value. But lower_bound uses bisection and requires the input to be ordered with respect to the comparison operation. Block times are not well ordered. I don't know what lower_bound is permitted to do when the data is not sufficiently ordered, but it's probably not good. (I could construct an implementation which would infinite loop...) To resolve the issue this commit introduces a maximum-so-far to the block indexes and searches that. For clarity the function is renamed to reflect what it actually does. An issue that remains is that there is no grace period in importmulti: If a address is created at time T and a send is immediately broadcast and included by a miner with a slow clock there may not yet have been any block with at least time T. The normal rescan has a grace period of 7200 seconds, but importmulti does not.
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-12-05Do not shadow variables (gcc set)Pavel Janík
2016-11-07Get rid of nType and nVersionPieter Wuille
Remove the nType and nVersion as parameters to all serialization methods and functions. There is only one place where it's read and has an impact (in CAddress), and even there it does not impact any of the recursively invoked serializers. Instead, the few places that need nType or nVersion are changed to read it directly from the stream object, through GetType() and GetVersion() methods which are added to all stream classes.
2016-10-19Add importmulti rpc callPedro Branco
2016-10-18Merge #6996: Add preciousblock RPCWladimir J. van der Laan
5805ac8 Add preciousblock tests (Pieter Wuille) 5127c4f Add preciousblock RPC (Pieter Wuille)
2016-08-26Add preciousblock RPCPieter Wuille
Includes a bugfix by Luke-Jr.
2016-08-22[doc] Fix typos in comments, doxygen: Fix comment syntaxMarcoFalke
2016-06-22Add rewind logic to deal with post-fork software updatesPieter Wuille
Includes logic for dealing with pruning by Suhas Daftuar.
2016-05-06Merge #7815: Break circular dependency main ↔ txdbWladimir J. van der Laan
99e7075 Break circular dependency main ↔ txdb (Wladimir J. van der Laan)
2016-04-28chain: define enum used as bit field as uint32_tWladimir J. van der Laan
Bitwise logic combined with `<` with undefined signedness will potentially results in undefined behavior. Fix this by defining the type as a c++11 typed enum. Fixes #6017.
2016-04-15Break circular dependency main ↔ txdbWladimir J. van der Laan
Break the circular dependency between main and txdb by: - Moving `CBlockFileInfo` from `main.h` to `chain.h`. I think this makes sense, as the other block-file stuff is there too. - Moving `CDiskTxPos` from `main.h` to `txdb.h`. This type seems specific to txdb. - Pass a functor `insertBlockIndex` to `LoadBlockIndexGuts`. This leaves it up to the caller how to insert block indices.
2016-03-15BIP9 ImplementationPieter Wuille
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and based on code by Jorge Timon.
2016-02-02Merge #7311: MOVEONLY: Move non-consensus functions out of powWladimir J. van der Laan
e867561 MOVEONLY: non-consensus: from pow to chain: (Jorge Timón)
2016-01-12MOVEONLY: non-consensus: from pow to chain:Jorge Timón
- GetBlockProof - GetBlockProofEquivalentTime
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-05-02Non-grammatical language improvementsLuke Dashjr
2015-02-05Add more information to errors in ReadBlockFromDiskWladimir J. van der Laan
A lot of times, disk corruption problems appear here. To facilitate debugging and troubleshooting, add position information to the error messages.
2015-01-05Use arith_uint256 where necessaryWladimir J. van der Laan
Also add conversion from/to uint256 where needed.
2015-01-05Replace direct use of 0 with SetNull and IsNullWladimir J. van der Laan
Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256().
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60