aboutsummaryrefslogtreecommitdiff
path: root/src/chain.h
Commit message (Collapse)AuthorAgeFilesLines
* Don't re-check AuxPoW when sending data to peersShibe2021-02-081-1/+1
| | | | | | Checking scrypt PoW is expensive and needless in this case. All block headers are already checked when they are accepted, and they will be checked again on the receiving end.
* Check only the base block version (#1411)Ross Nicoll2018-09-191-0/+6
| | | Check only the base block version when looking for unexpected version numbers
* Merge AuxPoW support from NamecoreRoss Nicoll2018-09-191-24/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes are as below: Wrap CBlockHeader::nVersion into a new class (CBlockVersion). This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID. Update getauxblock.py for new 'generate' RPC call. Add 'auxpow' to block JSON. Accept auxpow as PoW verification. Add unit tests for auxpow verification. Add check for memory-layout of CBlockVersion. Weaken auxpow chain ID checks for the testnet. Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks. Use this to disable the checks on testnet. Introduce CPureBlockHeader. Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two. Differentiate between uint256 and arith_uint256. This change was done upstream, modify the auxpow code. Add missing lock in auxpow_tests. Fix REST header check for auxpow headers. Those can be longer, thus take that into account. Also perform the check actually on an auxpow header. Correctly set the coinbase for getauxblock results. Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be. (BIP30 block height and COINBASE_FLAGS.) Implement getauxblock plus regression test. Turn auxpow test into FIXTURE test. This allows using of the Params() calls. Move CMerkleTx code to auxpow.cpp. Otherwise we get linker errors when building without wallet. Fix rebase with BIP66. Update the code to handle BIP66's nVersion=3. Enforce that auxpow parent blocks have no auxpow block version. This is for compatibility with namecoind. See also https://github.com/namecoin/namecoin/pull/199. Move auxpow-related parameters to Consensus::Params.
* Litecoin: Scrypt n=1024 Pow hash based upon Colin Percival's Tarnsnap (2009) ↵Warren Togami2018-09-191-0/+11
| | | | Modified by Artforz, coblee, pooler, wtogami, Nikolay Belikov, Adrian Gallagher
* Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.Gregory Maxwell2017-01-121-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Get rid of nType and nVersionPieter Wuille2016-11-071-4/+5
| | | | | | | | | | | 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.
* Add importmulti rpc callPedro Branco2016-10-191-0/+3
|
* Merge #6996: Add preciousblock RPCWladimir J. van der Laan2016-10-181-1/+1
|\ | | | | | | | | 5805ac8 Add preciousblock tests (Pieter Wuille) 5127c4f Add preciousblock RPC (Pieter Wuille)
| * Add preciousblock RPCPieter Wuille2016-08-261-1/+1
| | | | | | | | Includes a bugfix by Luke-Jr.
* | [doc] Fix typos in comments, doxygen: Fix comment syntaxMarcoFalke2016-08-221-5/+5
|/
* Add rewind logic to deal with post-fork software updatesPieter Wuille2016-06-221-0/+2
| | | | Includes logic for dealing with pruning by Suhas Daftuar.
* Merge #7815: Break circular dependency main ↔ txdbWladimir J. van der Laan2016-05-061-0/+54
|\ | | | | | | 99e7075 Break circular dependency main ↔ txdb (Wladimir J. van der Laan)
| * Break circular dependency main ↔ txdbWladimir J. van der Laan2016-04-151-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | chain: define enum used as bit field as uint32_tWladimir J. van der Laan2016-04-281-1/+1
|/ | | | | | | | 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.
* BIP9 ImplementationPieter Wuille2016-03-151-2/+0
| | | | | Inspired by former implementations by Eric Lombrozo and Rusty Russell, and based on code by Jorge Timon.
* Merge #7311: MOVEONLY: Move non-consensus functions out of powWladimir J. van der Laan2016-02-021-0/+4
|\ | | | | | | e867561 MOVEONLY: non-consensus: from pow to chain: (Jorge Timón)
| * MOVEONLY: non-consensus: from pow to chain:Jorge Timón2016-01-121-0/+4
| | | | | | | | | | - GetBlockProof - GetBlockProofEquivalentTime
* | Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|/
* Non-grammatical language improvementsLuke Dashjr2015-05-021-1/+1
|
* Add more information to errors in ReadBlockFromDiskWladimir J. van der Laan2015-02-051-0/+6
| | | | | | A lot of times, disk corruption problems appear here. To facilitate debugging and troubleshooting, add position information to the error messages.
* Use arith_uint256 where necessaryWladimir J. van der Laan2015-01-051-2/+3
| | | | Also add conversion from/to uint256 where needed.
* Replace direct use of 0 with SetNull and IsNullWladimir J. van der Laan2015-01-051-4/+4
| | | | | | Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256().
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Fix small typos in comments and error messagesPavel Janík2014-12-161-1/+1
| | | | | Rebased-From: 67b2d819cdf6181e7f016e5366ce7479830893bd Github-Pull: #5404
* Make IsSuperMajority a standalone functionPieter Wuille2014-12-111-8/+0
|
* Merge pull request #5367Wladimir J. van der Laan2014-12-111-1/+1
|\ | | | | | | 63d1ae5 Do all block index writes in a batch (Pieter Wuille)
| * Do all block index writes in a batchPieter Wuille2014-11-251-1/+1
| |
* | MOVEONLY: core/ -> primitives/Luke Dashjr2014-12-031-1/+1
|/
* Merge pull request #5170Wladimir J. van der Laan2014-11-211-5/+0
|\ | | | | | | | | 092b58d CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> GetBlockProof(CBlockIndex) (jtimon) 22c4272 MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h) (jtimon)
| * CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> ↵jtimon2014-10-291-5/+0
| | | | | | | | GetBlockProof(CBlockIndex)
* | Fix all header definesPavel Janík2014-11-031-3/+3
| |
* | Merge pull request #5142Wladimir J. van der Laan2014-10-301-36/+39
|\ \ | |/ |/| | | | | | | 02fe12d Update generate-seeds.py to produce doxygen compatible comments (Michael Ford) f2e03ff Update comments in chainparams to be doxygen compatible (Michael Ford) 2fdc335 Update comments in chain to be doxygen compatible (Michael Ford)
| * Update comments in chain to be doxygen compatibleMichael Ford2014-10-251-36/+39
| |
* | MOVEONLY: core.o -> core/block.ojtimon2014-10-271-1/+1
|/
* Merge pull request #4981Wladimir J. van der Laan2014-10-221-0/+1
|\ | | | | | | | | | | | | 85c579e script: add a slew of includes all around and drop includes from script.h (Cory Fields) db8eb54 script: move ToString and ValueString out of the header (Cory Fields) e9ca428 script: add ToByteVector() for converting anything with begin/end (Cory Fields) 066e2a1 script: move CScriptID to standard.h and add a ctor for creating them from CScripts (Cory Fields)
| * script: add a slew of includes all around and drop includes from script.hCory Fields2014-10-171-0/+1
| | | | | | | | Lots of files ended up with indirect includes from script.h.
* | Chain::SetTip return type to void21E142014-10-201-2/+2
| |
* | Headers-first synchronizationPieter Wuille2014-10-141-7/+25
|/ | | | | | | | | | | | | | | Many changes: * Do not use 'getblocks', but 'getheaders', and use it to build a headers tree. * Blocks are fetched in parallel from all available outbound peers, using a limited moving window. When one peer stalls the movement of the window, it is disconnected. * No more orphan blocks. At all. We only ever request a block for which we have verified the headers, and store it to disk immediately. This means that a disk-fill attack would require PoW. * Require protocol version 31800 for every peer (released in december 2010). * No more syncnode (we sync from everyone we can, though limited to 1 during initial *headers* sync). * Introduce some extra named constants, comments and asserts.
* cleanup license and header end comment in chain.cpp/.hPhilip Kaufmann2014-09-291-2/+2
|
* Move CBlockIndex, CChain and related code out of mainjtimon2014-09-081-0/+390