Commit Graph

106 Commits

Author SHA1 Message Date
Wladimir J. van der Laan
658479355e 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)
2018-01-21 12:48:32 +01:00
Wladimir J. van der Laan
88b9aa45de Merge #7871: Manual block file pruning.
afffeea fixup! Add pruneblockchain RPC to enable manual block file pruning. (Russell Yanofsky)
1fc4ec7 Add pruneblockchain RPC to enable manual block file pruning. (mrbandrews)
2018-01-21 12:48:32 +01:00
Pieter Wuille
0bd9056899 Merge #9138: Improve fee estimation
44b64b9 Fix edge case with stale fee estimates (Alex Morcos)
78ae62d Add clarifying comments to fee estimation (Alex Morcos)
5fe0f47 Add extra logging to processBlock in fee estimation. (Alex Morcos)
dc008c4 Add IsCurrentForFeeEstimatation (Alex Morcos)
ebafdca Pass pointers to existing CTxMemPoolEntries to fee estimation (Alex Morcos)
d825838 Always update fee estimates on new blocks. (Alex Morcos)
6f06b26 rename bool to validFeeEstimate (Alex Morcos)
84f7ab0 Remove member variable hadNoDependencies from CTxMemPoolEntry (Alex Morcos)
60ac00d Don't track transactions at all during IBD. (Alex Morcos)
4df4479 Remove extraneous LogPrint from fee estimation (Alex Morcos)
2018-01-18 07:33:45 +01:00
Wladimir J. van der Laan
5d3401c7e3 Merge #9312: Increase mempool expiry time to 2 weeks
5f0e27f Increase mempool expiry time to 2 weeks (Alex Morcos)
2018-01-18 07:33:44 +01:00
Wladimir J. van der Laan
8f423499dd Merge #9283: A few more CTransactionRef optimizations
91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
2018-01-18 07:33:43 +01:00
Wladimir J. van der Laan
dcc9dffae9 Merge #9236: Fix races for strMiscWarning and fLargeWork*Found, make QT runawayException use GetWarnings
749be01 Move GetWarnings() into its own file. (Gregory Maxwell)
e3ba0ef Eliminate data races for strMiscWarning and fLargeWork*Found. (Gregory Maxwell)
c63198f Make QT runawayException call GetWarnings instead of directly access strMiscWarning. (Gregory Maxwell)
2018-01-18 07:31:22 +01:00
Wladimir J. van der Laan
e34afa1067 Merge #9273: Remove unused CDiskBlockPos* argument from ProcessNewBlock
a13fa4c Remove unused CDiskBlockPos* argument from ProcessNewBlock (Matt Corallo)
2018-01-18 07:31:22 +01:00
Wladimir J. van der Laan
b5389c09b3 Merge #9014: Fix block-connection performance regression
dd0df81 Document ConnectBlock connectTrace postconditions (Matt Corallo)
2d6e561 Switch pblock in ProcessNewBlock to a shared_ptr (Matt Corallo)
2736c44 Make the optional pblock in ActivateBestChain a shared_ptr (Matt Corallo)
ae4db44 Create a shared_ptr for the block we're connecting in ActivateBCS (Matt Corallo)
fd9d890 Keep blocks as shared_ptrs, instead of copying txn in ConnectTip (Matt Corallo)
6fdd43b Add struct to track block-connect-time-generated info for callbacks (Matt Corallo)
2018-01-17 17:31:11 +01:00
Wladimir J. van der Laan
525c049316 Merge #8580: Make CTransaction actually immutable
81e3228 Make CTransaction actually immutable (Pieter Wuille)
42fd8de Make DecodeHexTx return a CMutableTransaction (Pieter Wuille)
c3f5673 Make CWalletTx store a CTransactionRef instead of inheriting (Pieter Wuille)
a188353 Switch GetTransaction to returning a CTransactionRef (Pieter Wuille)
2018-01-17 17:30:38 +01:00
Alexander Block
b2fb586dec Add missing comments to ProcessNewBlock and ProcessNewBlockHeaders
Lost while backporting #9183
2018-01-17 17:30:38 +01:00
Wladimir J. van der Laan
ab9bce2c3a Merge #9225: Fix some benign races
dfed983 Fix unlocked access to vNodes.size() (Matt Corallo)
3033522 Remove double brackets in addrman (Matt Corallo)
dbfaade Fix AddrMan locking (Matt Corallo)
047ea10 Make fImporting an std::atomic (Matt Corallo)
42071ca Make fDisconnect an std::atomic (Matt Corallo)
2018-01-17 17:27:24 +01:00
Wladimir J. van der Laan
726dd1f8a3 Merge #9179: Set DEFAULT_LIMITFREERELAY = 0 kB/minute
fa7cc5a Set DEFAULT_LIMITFREERELAY = 0 kB/minute (MarcoFalke)
2018-01-15 06:14:16 +01:00
Wladimir J. van der Laan
a9aa477daf Merge #9049: Remove duplicatable duplicate-input check from CheckTransaction
e2b3fb3 Optimize vInOutPoints insertion a bit (Matt Corallo)
eecffe5 Remove redundant duplicate-input check from CheckTransaction (Matt Corallo)
b2e178a Add deserialize + CheckBlock benchmarks, and a full block hex (Matt Corallo)
2018-01-15 06:14:15 +01:00
Wladimir J. van der Laan
2999d097f6 Merge #9013: Trivial: Explicitly pass const CChainParams& to LoadBlockIndexDB()
d0b01f3 Explicitly pass const CChainParams& to LoadBlockIndexDB() (Geoffrey Tsui)
2018-01-13 13:44:39 +01:00
Wladimir J. van der Laan
0a0e60c1fb Merge #8448: Store mempool and prioritization data to disk
582068a Add mempool.dat to doc/files.md (Pieter Wuille)
3f78562 Add DumpMempool and LoadMempool (Pieter Wuille)
ced7c94 Add AcceptToMemoryPoolWithTime function (Pieter Wuille)
c3efb58 Add feedelta to TxMempoolInfo (Pieter Wuille)
2018-01-13 13:44:38 +01:00
Wladimir J. van der Laan
dc9556a890 Merge #7948: RPC: augment getblockchaininfo bip9_softforks data
fc14609 RPC: augment getblockchaininfo bip9_softforks data (mruddy)
2018-01-13 13:44:37 +01:00
Wladimir J. van der Laan
6e871c0c2e Merge #6996: Add preciousblock RPC
5805ac8 Add preciousblock tests (Pieter Wuille)
5127c4f Add preciousblock RPC (Pieter Wuille)
2018-01-12 09:58:15 +01:00
Wladimir J. van der Laan
f6658c07f3 Merge #8611: Reduce default number of blocks to check at startup
203f212 Reduce default number of blocks to check at startup (Pieter Wuille)
2018-01-09 14:16:37 +01:00
Pieter Wuille
aa6c37919b Merge #8413: Trivial: pass Consensus::Params& instead of CChainParams& in ContextualCheckBlock
c8664ee Trivial: pass Consensus::Params& instead of CChainParams& in ContextualCheckBlock (Jorge Timón)
2018-01-08 18:04:55 +01:00
Pieter Wuille
60668fb93d Merge #8346: Mempool: Use Consensus::CheckTxInputs direclty over main::CheckInputs
a6cc299 Mempool: Use Consensus::CheckTxInputs direclty over main::CheckInputs (Jorge Timón)
2018-01-08 18:04:55 +01:00
Wladimir J. van der Laan
9a91ddb417 Merge #8347: Trivial: Make CBlockIndex param const in ContextualCheckBlockHeader and ContextualCheckBlock
6f3d616 Trivial: Make CBlockIndex param const in ContextualCheckBlockHeader and ContextualCheckBlock (Jorge Timón)
2018-01-08 18:04:55 +01:00
Wladimir J. van der Laan
bc257c1a08 Merge #8305: Improve handling of unconnecting headers
e91cf4b Add test for handling of unconnecting headers (Suhas Daftuar)
96fa953 Improve handling of unconnecting headers (Suhas Daftuar)
2017-12-28 11:44:59 +01:00
Wladimir J. van der Laan
808936cc30 Merge #8179: Evict orphans which are included or precluded by accepted blocks.
54326a6 Increase maximum orphan size to 100,000 bytes. (Gregory Maxwell)
8c99d1b Treat orphans as implicit inv for parents, discard when parents rejected. (Gregory Maxwell)
11cc143 Adds an expiration time for orphan tx. (Gregory Maxwell)
db0ffe8 This eliminates the primary leak that causes the orphan map to  always grow to its maximum size. (Gregory Maxwell)
1b0bcc5 Track orphan by prev COutPoint rather than prev hash (Pieter Wuille)
2017-12-28 11:44:59 +01:00
Alexander Block
0c61226347 Also revert BLOCK_DOWNLOAD_TIMEOUT_PER_PEER to 500000
Same reason as for reverting BLOCK_DOWNLOAD_TIMEOUT_BASE
2017-12-27 14:07:52 +01:00
Alexander Block
49f9d613b0 Revert to BLOCK_DOWNLOAD_TIMEOUT_BASE = 1000000
This value is in "millionths of the block interval" and in Bitcoin it's set
to exactly 1000000, meaning one full block interval. It still has to be
1000000 for Dash, even though the block intervall is less.

This fixes test failures in p2p-fullblocktest.py when large reorgs are
tested. These take quite some time and did timeout.
2017-12-22 19:35:34 +01:00
Pieter Wuille
fefd0ace3e Merge #8077: Consensus: Decouple from chainparams.o and timedata.o
ee9f4a5 Consensus: Decouple from chainparams.o and timedata.o (Jorge Timón)
2017-12-22 16:33:04 +01:00
Pieter Wuille
7b25879463 Merge #8059: Remove unneeded feerate param from RelayTransaction/AcceptToMemoryPool.
d87b198 Remove unneeded feerate param from RelayTransaction/AcceptToMemoryPool. (Gregory Maxwell)
2017-12-21 18:50:13 +01:00
Wladimir J. van der Laan
3dbae2d321 Merge #8019: Remove state arg from ReconsiderBlock, rename to ResetBlockFailureFlags
657e07e Rename ReconsiderBlock func to reflect real behavior (instagibbs)
addb9d2 Remove state arg from ReconsiderBlock (instagibbs)
2017-12-21 18:50:13 +01:00
Wladimir J. van der Laan
5222e9377d Merge #7976: Remove obsolete reference to CValidationState from UpdateCoins.
c8b9248 Remove obsolete reference to CValidationState from UpdateCoins. (21E14)
2017-12-21 17:31:57 +01:00
Wladimir J. van der Laan
5d8e94a26f Merge #7840: Several performance and privacy improvements to inv/mempool handling
b559914 Move bloom and feerate filtering to just prior to tx sending. (Gregory Maxwell)
4578215 Return mempool queries in dependency order (Pieter Wuille)
ed70683 Handle mempool requests in send loop, subject to trickle (Pieter Wuille)
dc13dcd Split up and optimize transaction and block inv queues (Pieter Wuille)
f2d3ba7 Eliminate TX trickle bypass, sort TX invs for privacy and priority. (Gregory Maxwell)
2017-12-21 17:30:51 +01:00
Wladimir J. van der Laan
5cf744532b Merge #7916: Explicitly pass CChainParams& to DisconnectTip()
176869f Explicitly pass CChainParams to ConnectBlock (face)
d0a6353 Pass CChainParams to DisconnectTip() (face)
764d237 Globals: Explicitly pass const CChainParams& to UpdateTip() (Jorge Timón)
2017-12-20 17:25:03 +01:00
Wladimir J. van der Laan
11ac70af9e Merge #7542: Implement "feefilter" P2P message
0371797 modify release-notes.md and bips.md (Alex Morcos)
b536a6f Add p2p test for feefilter (Alex Morcos)
5fa66e4 Create SingleNodeConnCB class for RPC tests (Alex Morcos)
9e072a6 Implement "feefilter" P2P message. (Alex Morcos)
2017-12-19 13:18:30 +01:00
Wladimir J. van der Laan
f4d30a6452 Merge #7708: De-neuter NODE_BLOOM
c90036f Always disconnect old nodes which request filtered connections. (Patrick Strateman)
2017-12-19 12:55:49 +01:00
Wladimir J. van der Laan
97c7da4b7a Merge #7509: Common argument defaults for NODE_BLOOM stuff and -wallet
1fb91b3 Common argument defaults for NODE_BLOOM stuff and -wallet (Luke Dashjr)
2017-12-11 08:30:26 +01:00
Wladimir J. van der Laan
a3d1e5eda9 Merge #7070: Move maxTxFee out of mempool
fad6244 ATMP: make nAbsurdFee const (MarcoFalke)
fa762d0 [wallet.h] Remove main.h include (MarcoFalke)
fa79db2 Move maxTxFee out of mempool (MarcoFalke)
2017-12-11 08:30:26 +01:00
Wladimir J. van der Laan
0f8ce56883 Merge #7444: Improve block validity/ConnectBlock() comments
2f19905 Improve block validity/ConnectBlock() comments (Peter Todd)
2017-12-11 08:08:49 +01:00
Wladimir J. van der Laan
0afbd1c3de Merge #7084: mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee
fa1193e [doxygen] Actually display comment (MarcoFalke)
fa331db mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee (MarcoFalke)
2017-12-11 08:08:49 +01:00
Wladimir J. van der Laan
2474fd0aea Merge pull request #7208
64360f1 Make max tip age an option instead of chainparam (Wladimir J. van der Laan)
2017-12-10 00:04:02 +01:00
UdjinM6
3028af19f1
post-DIP0001 cleanup (#1763)
* post-DIP0001 cleanup

also fixes tests

* bump nMinimumChainWork and defaultAssumeValid
2017-12-07 12:43:23 +03:00
UdjinM6
c166ed39b0
Allow compilation with --disable-wallet (#1733)
* Allow compilation with `--disable-wallet`

* fix remaining references

* Drop wallet references/include in CActiveMasternode and fix other files affected by this change

* Wrap privatesend-client.h include with ifdef/endif and fix other files affected by this change

* Re-enable Travis build with no wallet

reverts 267e57877b
2017-12-01 21:53:34 +03:00
Wladimir J. van der Laan
4f807422fa Merge #10550: Don't return stale data from CCoinsViewCache::Cursor()
3ff1fa8 Use override keyword on CCoinsView overrides (Russell Yanofsky)
24e44c3 Don't return stale data from CCoinsViewCache::Cursor() (Russell Yanofsky)

Tree-SHA512: 08699dae0925ffb9c018f02612ac6b7eaf73ec331e2f4f934f1fe25a2ce120735fa38596926e924897c203f7470e99f0a99cf70d2ce31ff428b105e16583a861
2017-10-31 21:19:11 +01:00
Alexander Block
9ad56fe18a Dash related fixes for per-utxo DB 2017-10-31 21:19:11 +01:00
Pieter Wuille
c81394b975 Merge #10195: Switch chainstate db and cache to per-txout model
589827975 scripted-diff: various renames for per-utxo consistency (Pieter Wuille)
a5e02bc7f Increase travis unit test timeout (Pieter Wuille)
73de2c1ff Rename CCoinsCacheEntry::coins to coin (Pieter Wuille)
119e552f7 Merge CCoinsViewCache's GetOutputFor and AccessCoin (Pieter Wuille)
580b02309 [MOVEONLY] Move old CCoins class to txdb.cpp (Pieter Wuille)
8b25d2c0c Upgrade from per-tx database to per-txout (Pieter Wuille)
b2af357f3 Reduce reserved memory space for flushing (Pieter Wuille)
41aa5b79a Pack Coin more tightly (Pieter Wuille)
97072d668 Remove unused CCoins methods (Pieter Wuille)
ce23efaa5 Extend coins_tests (Pieter Wuille)
508307968 Switch CCoinsView and chainstate db from per-txid to per-txout (Pieter Wuille)
4ec0d9e79 Refactor GetUTXOStats in preparation for per-COutPoint iteration (Pieter Wuille)
13870b56f Replace CCoins-based CTxMemPool::pruneSpent with isSpent (Pieter Wuille)
05293f3cb Remove ModifyCoins/ModifyNewCoins (Pieter Wuille)
961e48397 Switch tests from ModifyCoins to AddCoin/SpendCoin (Pieter Wuille)
8b3868c1b Switch CScriptCheck to use Coin instead of CCoins (Pieter Wuille)
c87b957a3 Only pass things committed to by tx's witness hash to CScriptCheck (Matt Corallo)
f68cdfe92 Switch from per-tx to per-txout CCoinsViewCache methods in some places (Pieter Wuille)
000391132 Introduce new per-txout CCoinsViewCache functions (Pieter Wuille)
bd83111a0 Optimization: Coin&& to ApplyTxInUndo (Pieter Wuille)
cb2c7fdac Replace CTxInUndo with Coin (Pieter Wuille)
422634e2f Introduce Coin, a single unspent output (Pieter Wuille)
7d991b55d Store/allow tx metadata in all undo records (Pieter Wuille)
c3aa0c119 Report on-disk size in gettxoutsetinfo (Pieter Wuille)
d34242430 Remove/ignore tx version in utxo and undo (Pieter Wuille)
7e0032290 Add specialization of SipHash for 256 + 32 bit data (Pieter Wuille)
e484652fc Introduce CHashVerifier to hash read data (Pieter Wuille)
f54580e7e error() in disconnect for disk corruption, not inconsistency (Pieter Wuille)
e66dbde6d Add SizeEstimate to CDBBatch (Pieter Wuille)

Tree-SHA512: ce1fb1e40c77d38915cd02189fab7a8b125c7f44d425c85579d872c3bede3a437760997907c99d7b3017ced1c2de54b2ac7223d99d83a6658fe5ef61edef1de3
2017-10-31 21:19:11 +01:00
Matt Corallo
567043d360 Make DisconnectBlock and ConnectBlock static in validation.cpp 2017-10-24 13:54:00 +02:00
Alexander Block
02a6cef94d Move index structures into spentindex.h
txdb.h does not include validation.h anymore, so we need these structs somewhere else
2017-10-19 10:51:23 +02:00
Wladimir J. van der Laan
abaf524f0c Merge #7815: Break circular dependency main ↔ txdb
99e7075 Break circular dependency main ↔ txdb (Wladimir J. van der Laan)
2017-10-19 10:51:12 +02:00
UdjinM6
d286198728 fix: The idea behind fDIP0001LockedInAtTip was to indicate that it WAS locked in, not that it IS locked in (#1666) 2017-10-04 22:35:09 +03:00
UdjinM6
25fa44d5a9 fix DIP0001 implementation (#1639)
According to DIP0001 description we should be using payment queue to select current masternode:
>As a block is mined the version number is determined by the miner who mined it and the masternode that is selected for that block.
>...
>The selection of a round consisting of 4032 blocks is made based on masternodes not being randomly selected, rather they are in a queue.

https://github.com/dashpay/dips/blob/master/dip-0001.md
2017-09-20 23:31:23 +03:00
UdjinM6
8f850c60fa Lower tx fees 10x (#1632)
* Lower tx fees 10x

* add DEFAULT_DIP0001_*FEE constants
2017-09-17 19:00:44 +03:00
UdjinM6
e22453c902 fix fDIP0001* flags initialization (#1625) 2017-09-15 21:08:03 +03:00
UdjinM6
d7a8489f31 Fix masternode score/rank calculations (#1620)
* fix CMasternode::CalculateScore, new mn score algo activation is triggered by DIP0001 lock-in

* unify rank calculation, base it on full mn vector rather than using active mns only

* bump CMasternodeMan::SERIALIZATION_VERSION_STRING

* unify rank calculations even further

* fix (partially revert previous one)
2017-09-14 16:58:29 +03:00
Ilya Savinov
6a6b31b74d Dip0001-related adjustments (inc. constants) (#1621)
* block size related constants adjusted; other minor fixes

* revert constants related to storing blocks on disk

* move AssertLockHeld to a separate PR
2017-09-14 14:42:37 +03:00
UdjinM6
cd262bf641 DIP0001 implementation (#1594)
* DIP0001 implementation

* add option in ComputeBlockVersion to assume that masternode is upgraded (and skip rank calculation)

* fix mainnet DIP0001 nTimeout

* schedule DIP0001 testnet activation start for Sep 18th, 2017 (bump timeout too)
2017-09-11 17:13:30 +03:00
UdjinM6
23582aea45 add/use GetUTXO[Coins/Confirmations] helpers instead of GetInputAge[IX] (#1578)
(also move IS confirmations calculation helper to CInstantSend)
2017-08-25 15:56:48 +03:00
Alexander Block
ccee103a0e Backport "assumed valid blocks" feature from Bitcoin 0.13 (#1582)
* IBD check uses minimumchain work instead of checkpoints.

This introduces a 'minimum chain work' chainparam which is intended
 to be the known amount of work in the chain for the network at the
 time of software release.  If you don't have this much work, you're
 not yet caught up.

This is used instead of the count of blocks test from checkpoints.

This criteria is trivial to keep updated as there is no element of
subjectivity, trust, or position dependence to it. It is also a more
reliable metric of sync status than a block count.

* Remove GetTotalBlocksEstimate and checkpoint tests that test nothing.

GetTotalBlocksEstimate is no longer used and it was the only thing
 the checkpoint tests were testing.

Since checkpoints are on their way out it makes more sense to remove
 the test file than to cook up a new pointless test.

# Conflicts:
#	src/Makefile.test.include
#	src/test/Checkpoints_tests.cpp

* IsInitialBlockDownload no longer uses header-only timestamps.

This avoids a corner case (mostly visible on testnet) where bogus
 headers can keep nodes in IsInitialBlockDownload.

* Delay parallel block download until chain has sufficient work

nMinimumChainWork is an anti-DoS threshold; wait until we have a proposed
tip with more work than that before downloading blocks towards that tip.

* Add timeout for headers sync

At startup, we choose one peer to serve us the headers chain, until
our best header is close to caught up.  Disconnect this peer if more
than 15 minutes + 1ms/expected_header passes and our best header
is still more than 1 day away from current time.

* 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.

* Add consensusParams to FindNextBlocksToDownload

* Adjust check in headers timeout logic to align with 144 blocks in Dash
2017-08-23 17:21:08 +03:00
Oleg Girko
df6d458b85 Backport Bitcoin PR#9260: Mrs Peacock in The Library with The Candlestick (killed main.{h,cpp}) (#1566)
* Remove orphan state wipe from UnloadBlockIndex.

As orphan state is now "network state", like in
d6ea737be1,

UnloadBlockIndex is only used during init if we end up reindexing
to clear our block state so that we can start over. However, at
that time no connections have been brought up as CConnman hasn't
been started yet, so all of the network processing state logic is
empty when its called.

* Move network-msg-processing code out of main to its own file

* Rename the remaining main.{h,cpp} to validation.{h,cpp}
2017-08-09 03:19:06 +03:00