Commit graph

90 commits

Author SHA1 Message Date
Patrick Lodder 0c600d7f9d
Fixate BIP65 softfork heights
- Re-introduce Params.BIP65Height
- Fixate block 1854705 for testnet
- Fixate block 3464751 for mainnet
- Fixate block 1351 for regtest
- Stop using IsSuperMajority() in validation for BIP65
- Simplify RPC SoftForkMajorityDesc
2021-02-13 17:24:55 +01:00
Daniel Edgecumbe 59dcceea58
[backport] [rpc] getblockchaininfo: add size_on_disk, prune_target_size, automatic_pruning
Fix pruneheight help text.
Move fPruneMode block to match output ordering with help text.
Add functional tests for new fields in getblockchaininfo.

Rebase-from: bitcoin#b7dfc6c4
2020-07-24 18:45:39 +02:00
Ross Nicoll 148a2aca05 Introduce basic Dogecoin branding 2019-03-25 05:36:11 +00:00
Ross Nicoll 41c868f47e Re-introduce alert functionality (#1470)
Re-introduce alert functionality removed from Bitcoin upstream
2018-09-19 22:11:47 +01:00
Ross Nicoll 9c3a11b248 Clean up RPC tests (#1465)
* Enable full block tests
* Fix invalidblocktest
* Move watch only address funding to immediately before it's used, so node 0 doesn't spend the output before it checks it later.
* Fix `fundrawtransaction` tests and sanitize fee calculation at the same time
* Correct resolution of chain parameters when validating tx inputs, especially from previous coinbase transactions
* Set block versions on full block tests so that the generated blocks are AuxPoW compatible
2018-09-19 22:11:47 +01:00
Ross Nicoll 2860c4bc31 Enforce minor Dogecoin parameters (#1427)
* Minimum number of blocks and blockchain size are increased for pruning. In comparison to Bitcoin this uses 24 hours as a minimum, rather than 48, although given blocks are rarely full this likely reflects a lot longer in reality.
* Multiply fork detection parameters by 5. The wall clock time elapsed for "long" forks is therefore half that of Bitcoin, but IMHO those figures are excessive for a chain with 1 minute block times.
* BIP16 and BIP30 have both been enabled on Dogecoin since inception and should not be conditional.
2018-09-19 22:11:47 +01:00
Ross Nicoll 493f02ba2a Always use parameters at block 0 to get genesis block hash (#1416)
This doesn't actually change behaviour, but stylistically is more correct.
2018-09-19 21:09:16 +01:00
Ross Nicoll 7b81f4de0a Move COINBASE_MATURITY to the consensus parameters (#1426) 2018-09-19 21:09:16 +01:00
Ross Nicoll ec40df46b5 Check only the base block version (#1411)
Check only the base block version when looking for unexpected version numbers
2018-09-19 21:09:16 +01:00
Ross Nicoll 18850d359b Add Dogecoin current fee calculation logic (#1413)
Introduces 1 COIN/kb fees, rounded up to the next 1 COIN.
2018-09-19 21:09:16 +01:00
Ross Nicoll 1be681a1b9 Modify chain consensus parameters to be height aware (#1396)
* Modify chain consensus parameters to be height aware
* Correct implementation of simplified rewards in parameters
* Correct max money
* Use base block version in IsSuperMajority() instead of full version
* Correct mining of blocks in AuxPoW tests
* Add in missing pre-AuxPoW consensus checks
2018-09-19 19:24:06 +01:00
Ross Nicoll a89d54c4b2 Change BIP65/66 enforcement to match Dogecoin (#1403)
* Introduce first estimates at BIP lock-in blocks

* Introduce Dogecoin BIP parameters

* Re-introduce supermajority rules for BIP65

* Add BIP65 supermajority rules

* Tighten v3 block constraints

* Don't enforce coinbase in v2 blocks

* Correct testnet majority params

* Change to using base version when checking supermajority
2018-09-19 19:23:29 +01:00
Ross Nicoll bc8cca4896 Merge AuxPoW support from Namecore
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.
2018-09-19 19:22:45 +01:00
Warren Togami b506efbe74 Litecoin: Scrypt n=1024 Pow hash based upon Colin Percival's Tarnsnap (2009) Modified by Artforz, coblee, pooler, wtogami, Nikolay Belikov, Adrian Gallagher 2018-09-19 19:21:49 +01:00
Ross Nicoll 8c0468c2d2 Add Dogecoin block subsidy calculations. 2018-09-19 19:21:49 +01:00
Ross Nicoll 64af132fdb Replace consensus values with Dogecoin equivalents
* Replace chain parameters with Dogecoin values
* Update maximum coins to match Dogecoin
* Disable version 2 block requirement
* Update coinbase maturity to match Dogecoin
2018-09-19 19:21:48 +01:00
Suhas Daftuar 52965fbaef
Fix crash bug with duplicate inputs within a transaction
Introduced by #9049

Github-Pull: #14247

Tree-SHA512: 54ccf896e4c816ba8532644affc984a091ed801d8387bb01a836953c9ec4a345359d98fb58dd5f929617afd42bce0cc40293fecf943a1584207c82dd78da0ea5
2018-09-18 13:05:49 +02:00
Alex Morcos 0e5133cb2e
Make threshold for flushing more conservative.
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.

Github-Pull: #10133
Rebased-From: 1b55e07b7a
2017-04-05 08:23:02 +02:00
Alex Morcos ab864d3e49
Make pcoinsTip memory calculations consistent
Since we are more accurately measuring pcoinsTip peak usage at twice the current in dynamic usage, it makes sense to double the default (this will lead to the same effective usage and peak usage as previously).
We should also double the buffer used to avoid flushing if above 90% but still sufficient space remaining.

Github-Pull: #10133
Rebased-From: 5b95a190e8
2017-04-05 08:23:01 +02:00
Gregory Maxwell 2fea10ad03
Make GetWitnessCommitmentIndex callable on blocks without a coinbase txn.
This isn't actually needed anywhere, but it's less brittle.

Github-Pull: #10146
Rebased-From: ada0caa165
2017-04-04 09:01:03 +02:00
Pieter Wuille 0b5e162b84
Compensate for memory peak at flush time
Github-Pull: #10126
Rebased-From: 7228ce853d
2017-03-31 12:07:18 +02:00
Russell Yanofsky 9072395e5f
Return errors from importmulti if complete rescans are not successful
Github-Pull: #9773
Rebased-From: e2e2f4c856
2017-02-22 12:45:43 +01:00
Pavel Janík 3972a8efb2
Read/write mempool.dat as a binary.
mempool.dat is a binary file and thus it should be read/written as such.

Fixes #9810.

Github-Pull: #9813
Rebased-From: 171fc91f06
2017-02-21 12:35:38 +01:00
Suhas Daftuar ba803efb68 Harden against mistakes handling invalid blocks
Fixes a bug in AcceptBlock() in invoking CheckBlock() with incorrect
arguments, and restores a call to CheckBlock() from ProcessNewBlock()
as belt-and-suspenders.

Updates the (overspecified) tests to match behavior.
2017-02-15 08:17:57 -05:00
MarcoFalke 668de70be0
Merge #9644: [refactor] Remove using namespace <xxx> from src/
b7b48c8 Refactor: Remove using namespace <xxx> from src/*.cpp. (Karl-Johan Alm)
2017-01-30 13:13:20 +01:00
Wladimir J. van der Laan d2c9e4d422
Merge #9615: Wallet incremental fee
4b189c1 Change bumpfee result value from 'oldfee' to 'origfee'. (Alex Morcos)
0c0c63f Introduce WALLET_INCREMENTAL_RELAY_FEE (Alex Morcos)
e8021ec Use CWallet::GetMinimumFee in bumpfee (Alex Morcos)
ae9719a Refactor GetMinimumFee to give option of providing targetFee (Alex Morcos)
fe8e8ef [rpc] Add incremental relay fee to getnetworkinfo (Alex Morcos)
6b331e6 Fix to have miner test aware of new separate block min tx fee (Alex Morcos)
de6400d Fix missing use of dustRelayFee (Alex Morcos)
5b15870 Use incrementalRelayFee for BIP 125 replacement (Alex Morcos)
2017-01-30 10:38:56 +01:00
Karl-Johan Alm b7b48c8bbd Refactor: Remove using namespace <xxx> from src/*.cpp. 2017-01-27 18:13:20 +09:00
Wladimir J. van der Laan 9b4d2673b7
Merge #9519: Exclude RBF replacement txs from fee estimation
de1ae32 Exclude RBF txs from fee estimation (Alex Morcos)
2017-01-26 10:53:14 +01:00
John Newbery ac9a84679a [Trivial] fix logging typo in FlushStateToDisk() 2017-01-24 12:08:07 -05:00
Alex Morcos 4afbde6028 Introduce MemPoolConflictRemovalTracker
Analogue to ConnectTrace that tracks transactions that have been removed from the mempool due to conflicts and then passes them through SyncTransaction at the end of its scope.
2017-01-23 15:43:22 -05:00
Wladimir J. van der Laan ff25c32392 mempool: add notification for added/removed entries
Add notification signals to make it possible to subscribe to mempool
changes:

- NotifyEntryAdded(CTransactionRef)>
- NotifyEntryRemoved(CTransactionRef, MemPoolRemovalReason)>

Also add a mempool removal reason enumeration, which is passed to the
removed notification based on why the transaction was removed from
the mempool.
2017-01-23 15:43:22 -05:00
Pieter Wuille 71148b8947
Merge #9596: [bugfix] save feeDelta instead of priorityDelta in DumpMempool
bd92f24 [bugfix] save feeDelta instead of priorityDelta in DumpMempool (Alex Morcos)
2017-01-23 10:42:36 -08:00
Wladimir J. van der Laan 7884956414
Merge #9511: Don't overwrite validation state with corruption check
116419e Don't overwrite validation state with corruption check (Alex Morcos)
2017-01-23 13:18:16 +01:00
Alex Morcos de1ae324bf Exclude RBF txs from fee estimation 2017-01-20 15:04:16 -05:00
Alex Morcos bd92f2481c [bugfix] save feeDelta instead of priorityDelta in DumpMempool 2017-01-19 23:45:02 -05:00
Alex Morcos 5b158707f2 Use incrementalRelayFee for BIP 125 replacement 2017-01-19 20:31:29 -05:00
Matt Corallo 989989354b Move wallet callbacks into cs_main (this effectively reverts #7946) 2017-01-19 11:31:05 -05:00
Wladimir J. van der Laan 9c9af5ab2d
Merge #9499: Use recent-rejects, orphans, and recently-replaced txn for compact-block-reconstruction
c594580 Add braces around AddToCompactExtraTransactions (Matt Corallo)
1ccfe9b Clarify comment about mempool/extra conflicts (Matt Corallo)
fac4c78 Make PartiallyDownloadedBlock::InitData's second param const (Matt Corallo)
b55b416 Add extra_count lower bound to compact reconstruction debug print (Matt Corallo)
863edb4 Consider all (<100k memusage) txn for compact-block-extra-txn cache (Matt Corallo)
7f8c8ca Consider all orphan txn for compact-block-extra-txn cache (Matt Corallo)
93380c5 Use replaced transactions in compact block reconstruction (Matt Corallo)
1531652 Keep shared_ptrs to recently-replaced txn for compact blocks (Matt Corallo)
edded80 Make ATMP optionally return the CTransactionRefs it replaced (Matt Corallo)
c735540 Move ORPHAN constants from validation.h to net_processing.h (Matt Corallo)
2017-01-19 09:03:46 +01:00
Pieter Wuille 812714fd80
Merge #9484: Introduce assumevalid setting to skip validation presumed valid scripts.
7b5e3fe Add assumevalid testcase (John Newbery)
e440ac7 Introduce assumevalid setting to skip presumed valid scripts. (Gregory Maxwell)
2017-01-16 14:07:30 -08:00
Pieter Wuille e126d0c12c
Merge #9490: Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
4b06e41 Add unit test for FindEarliestAtLeast (Suhas Daftuar)
997a98a Replace FindLatestBefore used by importmuti with FindEarliestAtLeast. (Gregory Maxwell)
2017-01-13 16:06:05 -08:00
Pieter Wuille 3908fc4728
Merge #9375: Relay compact block messages prior to full block connection
02ee4eb Make most_recent_compact_block a pointer to a const (Matt Corallo)
73666ad Add comment to describe callers to ActivateBestChain (Matt Corallo)
962f7f0 Call ActivateBestChain without cs_main/with most_recent_block (Matt Corallo)
0df777d Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders (Matt Corallo)
c1ae4fc Avoid holding cs_most_recent_block while calling ReadBlockFromDisk (Matt Corallo)
9eb67f5 Ensure we meet the BIP 152 old-relay-types response requirements (Matt Corallo)
5749a85 Cache most-recently-connected compact block (Matt Corallo)
9eaec08 Cache most-recently-announced block's shared_ptr (Matt Corallo)
c802092 Relay compact block messages prior to full block connection (Matt Corallo)
6987219 Add a CValidationInterface::NewPoWValidBlock callback (Matt Corallo)
180586f Call AcceptBlock with the block's shared_ptr instead of CBlock& (Matt Corallo)
8baaba6 [qa] Avoid race in preciousblock test. (Matt Corallo)
9a0b2f4 [qa] Make compact blocks test construction using fetch methods (Matt Corallo)
8017547 Make CBlockIndex*es in net_processing const (Matt Corallo)
2017-01-13 14:52:26 -08:00
Gregory Maxwell e440ac7ef3 Introduce assumevalid setting to skip presumed valid scripts.
This disentangles the script validation skipping from checkpoints.

A new option is introduced "assumevalid" which specifies a block whos
 ancestors we assume all have valid scriptsigs and so we do not check
 them when they are also burried under the best header by two weeks
 worth of work.

Unlike checkpoints this has no influence on consensus unless you set
 it to a block with an invalid history.  Because of this it can be
 easily be updated without risk of influencing the network consensus.

This results in a massive IBD speedup.

This approach was independently recommended by Peter Todd and Luke-Jr
 since POW based signature skipping (see PR#9180) does not have the
 verifiable properties of a specific hash and may create bad incentives.

The downside is that, like checkpoints, the defaults bitrot and older
 releases will sync slower.  On the plus side users can provide their
 own value here, and if they set it to something crazy all that will
 happen is more time will be spend validating signatures.

Checkblocks and checklevel are also moved to the hidden debug options:
 Especially now that checkblocks has a low default there is little need
 to change these settings, and users frequently misunderstand them as
 influencing security or IBD speed.  By hiding them we offset the
 space added by this new option.
2017-01-13 15:42:24 +00:00
Matt Corallo 73666ad059 Add comment to describe callers to ActivateBestChain 2017-01-12 12:15:17 -08:00
Gregory Maxwell 997a98a674 Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
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.
2017-01-12 14:21:43 +00:00
Wladimir J. van der Laan fac0f30482
Merge #9472: Disentangle progress estimation from checkpoints and update it
df36371 Update estimated transaction count data (Pieter Wuille)
e356d9a Shorten variable names and switch to tx/s (Pieter Wuille)
6dd8116 Remove SIGCHECK_VERIFICATION_FACTOR (Pieter Wuille)
3641141 Move tx estimation data out of CCheckPointData (Pieter Wuille)
a4bac66 [MOVEONLY] Move progress estimation out of checkpoints (Pieter Wuille)
2017-01-12 12:13:14 +01:00
Matt Corallo 0df777db6d Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders 2017-01-11 14:47:52 -08:00
Pieter Wuille e356d9a758 Shorten variable names and switch to tx/s 2017-01-11 08:21:37 -08:00
Alex Morcos 116419e58d Don't overwrite validation state with corruption check
AcceptToMemoryPool has several classes of return false statements.
- return state.Invalid or state.DoS directly itself
- return false and set fMissingInputs (state is valid)
- return false and state is set by failed CheckTransaction
- return false and state is set by failed CheckInputs.

This commit patches the last case where the state variable was reused for additional calls to CheckInputs to identify witness stripping as cause of validation failure.  After this commit, it should be the case that if !fMissingInputs, state is always Invalid if AcceptToMemoryPool returns false.
2017-01-10 16:53:10 -05:00
mrbandrews 1fc4ec7bf2 Add pruneblockchain RPC to enable manual block file pruning. 2017-01-10 08:14:50 -05:00
Matt Corallo edded808fc Make ATMP optionally return the CTransactionRefs it replaced 2017-01-09 14:15:18 -05:00