aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-06-07Cache full script execution results in addition to signaturesMatt Corallo
This adds a new CuckooCache in validation, caching whether all of a transaction's scripts were valid with a given set of script flags. Unlike previous attempts at caching an entire transaction's validity, which have nearly universally introduced consensus failures, this only caches the validity of a transaction's scriptSigs. As these are pure functions of the transaction and data it commits to, this should be much safer. This is somewhat duplicative with the sigcache, as entries in the new cache will also have several entries in the sigcache. However, the sigcache is kept both as ATMP relies on it and because it prevents malleability-based DoS attacks on the new higher-level cache. Instead, the -sigcachesize option is re-used - cutting the sigcache size in half and using the newly freed memory for the script execution cache. Transactions which match the script execution cache never even have entries in the script check thread's workqueue created. Note that the cache is indexed only on the script execution flags and the transaction's witness hash. While this is sufficient to make the CScriptCheck() calls pure functions, this introduces dependancies on the mempool calculating things such as the PrecomputedTransactionData object, filling the CCoinsViewCache, etc in the exact same way as ConnectBlock. I belive this is a reasonable assumption, but should be noted carefully. In a rather naive benchmark (reindex-chainstate up to block 284k with cuckoocache always returning true for contains(), -assumevalid=0 and a very large dbcache), this connected blocks ~1.7x faster.
2017-06-07Pull script verify flags calculation out of ConnectBlockMatt Corallo
2017-06-06Merge #10331: Share config between util and functional testsMarcoFalke
8ad5bde Merge bctest.py into bitcoin-util-test.py (John Newbery) 95836c5 Use shared config file for functional and util tests (John Newbery) 89fcd35 Use an .ini config file for environment vars in bitcoin-util-test.py (John Newbery) e9265df Change help_text in bitcoin-util-test.py to a docstring. (John Newbery) ce58e93 Change bitcoin-util-test.py to use Python3 (John Newbery) Tree-SHA512: 66dab0b4a8546aee0dfaef134a165f1447aff4c0ec335754bbc7d9e55909721c62f09cdbf4b22d02ac1fcd5a9b66780f91e1cc4d8687fae7288cc9072a23a78f
2017-06-06Merge #10522: [wallet] Remove unused variablesMarcoFalke
a8c09af Remove unused variables (practicalswift) Tree-SHA512: 34807dc3a0471c83b086f430b66465602c8f6a3a158b54ace2ec8afb746f1f5907f7dfcde5a4bad4041df9721ec46b61681b2dbf89725c9c8c4c5ad0ca99f78f
2017-06-06Merge #10538: [trivial] Fix typo: "occurrences" (misspelled as "occurrances")MarcoFalke
b083db6 [trivial] Fix typo: "occurrences" (misspelled as "occurrances") (practicalswift) Tree-SHA512: 5141526dbbbbe797ef103fcbdc0a1318648214973214607e35cc0e99abfc4dd547e3ef15fe21976c53a78b03dff140fe76e5c92a0f7e7d2b08081215983a8616
2017-06-06Make functions in validation.cpp static and pass chainparamsMario Dian
Fix bugs as per PR comment Change bool static to static bool
2017-06-06Merge #9909: tests: Add FindEarliestAtLeast test for edge casesWladimir J. van der Laan
cf66f04 Add FindEarliestAtLeast test for edge cases (Russell Yanofsky) Tree-SHA512: bed2e9b2eefe0014414f1be8f0ba236b1dcc6744a670ffa546100c62817dd06a117cc62cdff80c4988d2b374cae9a57f2bb135fc582ffb51ca2d34ab07bb3fe0
2017-06-06Merge #10252: RPC/Mining: Restore API compatibility for prioritisetransactionWladimir J. van der Laan
870824e RPC/Mining: Restore API compatibility for prioritisetransaction (Luke Dashjr) Tree-SHA512: eb507500dc5ba8d17521f34f3d6eae45aa9259c38d15a75dc3e3ad45774ffb53db943be1720a97e6cd5f08e7832801e27ffb636da081a58955018b6f8f9d8fba
2017-06-06[trivial] Fix typo: "occurrences" (misspelled as "occurrances")practicalswift
Typo introduced in 000391132608343c66488d62625c714814959bc9: $ git blame src/coins.cpp | grep occurrances 00039113 (2017-04-25 11:29:29 -0700 89) // deal with the pre-BIP30 occurrances of duplicate coinbase transactions.
2017-06-06Merge #10345: [P2P] Timeout for headers syncWladimir J. van der Laan
76f7481 Add timeout for headers sync (Suhas Daftuar) e265200 Delay parallel block download until chain has sufficient work (Suhas Daftuar) Tree-SHA512: e7f5468b7defe67d4d2d5c976bc129dba2b32b2ea52d3ff33b9cbff5c3b5b799be867653f1bcd354340d707d76dcadf2da4588abf6d6ec4a06672cdc5e1101eb
2017-06-06Merge #10426: Replace bytes_serialized with bogosizeWladimir J. van der Laan
8b22af3 Replace bytes_serialized with bogosize (Pieter Wuille) Tree-SHA512: e70a981bbb977329f9e324c45f9a1346ec9aacfbbad5474e608cdd1f852257502bb7db8003fd578260a609e45d1a9cf87ce96df9c4187d92d50f60a209e232ce
2017-06-06Merge #10463: Names: BIP9 vs versionbitsWladimir J. van der Laan
b463bc9 scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/ (Jorge Timón) 29c0719 Rename -bip9params to -vbparams (shaolinfry) Tree-SHA512: a8a2bf6e24a4a7fc82f784c78c0cd92472e9ba55ce3fb22dafef3eccdcfccb2da5a6078fbeec1a8a4b6ab1f1b226976c5aba964dd5e3d029a21b109a7c044374
2017-06-05Add timeout for headers syncSuhas Daftuar
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.
2017-06-05Replace bytes_serialized with bogosizePieter Wuille
2017-06-05Merge #9740: Add friendly output to dumpwalletWladimir J. van der Laan
164019d Add dumpwallet output test (aideca) 9f82134 Add friendly output to dumpwallet refs #9564 (aideca) Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
2017-06-05Merge #10403: Fix importmulti failure to return rescan errorsWladimir J. van der Laan
4d2d604 Fix importmulti failure to return rescan errors (Russell Yanofsky) Tree-SHA512: e5e6d6c5a2bb7230e1bcac1903a4b766cd57bf781fade50c6c9cd5713cd3e768db0987cfda9699b57a53d3a0a60951b96dce5283b3d3ec1f954162c439bc932b
2017-06-05Merge #10455: Simplify feebumper minimum fee code slightlyWladimir J. van der Laan
88b8f0b Simplify feebumper minimum fee code slightly (Russell Yanofsky) Tree-SHA512: 4465daef63936860d016a7fd7fd31ce62878d87cb943a90f321b07a40accdc5e7970d99de46b2bc924eb0b422144d6f01649855949395518790ecd05d300ee52
2017-06-05Merge #10422: Fix timestamp in fee estimate debug messageWladimir J. van der Laan
8d4f401 Fix timestamp in fee estimate debug message (Alex Morcos) Tree-SHA512: eb015ddbb9f52f0f84706a16e503d2894dceed4e796979858ca8bdd7f0ec15bf7646ca3f411b06ff099308c91ca498916778e6bd52db00365baaae1d2f4218f2
2017-06-05Merge #10514: Bugfix: missing == 0 after randrangeWladimir J. van der Laan
9aa215b Bugfixes: missing == 0 after randrange (Pieter Wuille) Tree-SHA512: 160657ac09553f23ad7a3966c753a30ba938ce6f7ccfd34a4ef0d05d73d712362f7eef97e44a96e37a181b8347caa9d8e1584cc4485f69674ab2de3d8a247373
2017-06-05rpc: Add listen address to incoming connections in `getpeerinfo`Wladimir J. van der Laan
This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures. The address is reported in `getpeerinfo`. This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.
2017-06-04Merge #10471: Denote functions CNode::GetRecvVersion() and ↵Pieter Wuille
CNode::GetRefCount() as const 5f672ca8c net: Denote some CNode functions const (Pavlos Antoniou) Tree-SHA512: f6d13d8002a4145fd87b34b35a739284e4a9b1af834bba109d324eccddb684eccb817553ba76102eb5b5819cab37f938b4ba74fdbda7c5386d00747b3024cd81
2017-06-03Remove unused variablespracticalswift
2017-06-02Merge #10500: Avoid CWalletTx copies in GetAddressBalances and ↵Pieter Wuille
GetAddressGroupings b9b814a38 Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupings (Russell Yanofsky) Tree-SHA512: 96a0612ca460ba1bfb3921f3aa348400fd3afa12c40f2ca1f3f04068b1574fe824d577e0123013d8898a4990084316dc1dfb541331849f0996ceff7f4eb25e6b
2017-06-02Bugfixes: missing == 0 after randrangePieter Wuille
2017-06-02Merge #10323: Update to latest libsecp256k1 masterWladimir J. van der Laan
e7c1b44 Squashed 'src/secp256k1/' changes from 8225239..84973d3 (Pieter Wuille) Tree-SHA512: 3e1ba6e6ad9d68170a1a60bd963f2dbaa8b0ae592cc562e6cd23b2c7653f0b8016e4c682681ae2fb3714106a41f8b89708e16e8f52a42ff3db59fc28262eea0b
2017-06-01Merge #10506: Fix bumpfee test after #10449Pieter Wuille
8906a9a0d Fix bumpfee test after #10449 (Russell Yanofsky) Tree-SHA512: 0838c7696499baf0fb5ee6edf0b081752d6c37578360a7f24a7e9c700598cbc14ff95826f2f5124cca805d2609470a052bc7309211874b13be7ac1ff9e911a34
2017-06-01Merge #10195: Switch chainstate db and cache to per-txout modelPieter Wuille
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-06-01scripted-diff: various renames for per-utxo consistencyPieter Wuille
Thanks to John Newberry for pointing these out. -BEGIN VERIFY SCRIPT- sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h -END VERIFY SCRIPT-
2017-06-01Rename CCoinsCacheEntry::coins to coinPieter Wuille
2017-06-01Merge CCoinsViewCache's GetOutputFor and AccessCoinPieter Wuille
They're doing the same thing now.
2017-06-01[MOVEONLY] Move old CCoins class to txdb.cppPieter Wuille
It's only used for upgrading from the old database anymore.
2017-06-01Upgrade from per-tx database to per-txoutPieter Wuille
2017-06-01Reduce reserved memory space for flushingPieter Wuille
As the maximum amount of data that can be pulled into the cache due to a block validation is much lower now (at most one CCoin entry per input and per output), reduce the conservative estimate used to determine flushing time.
2017-06-01Pack Coin more tightlyPieter Wuille
2017-06-01Remove unused CCoins methodsPieter Wuille
2017-06-01Extend coins_testsPieter Wuille
2017-06-01Switch CCoinsView and chainstate db from per-txid to per-txoutPieter Wuille
This patch makes several related changes: * Changes the CCoinsView virtual methods (GetCoins, HaveCoins, ...) to be COutPoint/Coin-based rather than txid/CCoins-based. * Changes the chainstate db to a new incompatible format that is also COutPoint/Coin based. * Implements reconstruction code for hash_serialized_2. * Adapts the coins_tests unit tests (thanks to Russell Yanofsky). A side effect of the new CCoinsView model is that we can no longer use the (unreliable) test for transaction outputs in the UTXO set to determine whether we already have a particular transaction.
2017-06-01Refactor GetUTXOStats in preparation for per-COutPoint iterationPieter Wuille
2017-06-01Replace CCoins-based CTxMemPool::pruneSpent with isSpentPieter Wuille
2017-06-01Remove ModifyCoins/ModifyNewCoinsPieter Wuille
2017-06-01Switch tests from ModifyCoins to AddCoin/SpendCoinPieter Wuille
2017-06-01Fix bumpfee test after #10449Russell Yanofsky
Failure reported by Jorge Timón <jtimon@jtimon.cc> https://github.com/bitcoin/bitcoin/pull/10449#issuecomment-305556569
2017-06-01Switch CScriptCheck to use Coin instead of CCoinsPieter Wuille
2017-06-01Only pass things committed to by tx's witness hash to CScriptCheckMatt Corallo
This clarifies a bit more the ways in which the new script execution cache could break consensus in the future if additional data from the CCoins object were to be used as a part of script execution. After this change, any such consensus breaks should be very visible to reviewers, hopefully ensuring no such changes can be made.
2017-06-01Switch from per-tx to per-txout CCoinsViewCache methods in some placesPieter Wuille
2017-06-01Introduce new per-txout CCoinsViewCache functionsPieter Wuille
The new functions are: * CCoinsViewCache::AddCoin: Add a single COutPoint/Coin pair. * CCoinsViewCache::SpendCoin: Remove a single COutPoint. * AddCoins: utility function that invokes CCoinsViewCache::AddCoin for each output in a CTransaction. * AccessByTxid: utility function that searches for any output with a given txid. * CCoinsViewCache::AccessCoin: retrieve the Coin for a COutPoint. * CCoinsViewCache::HaveCoins: check whether a non-empty Coin exists for a given COutPoint. The AddCoin and SpendCoin methods will eventually replace ModifyCoins and ModifyNewCoins, AddCoins will replace CCoins::FromTx, and the new AccessCoins and HaveCoins functions will replace their per-txid counterparts. Note that AccessCoin for now returns a copy of the Coin object. In a later commit it will be change to returning a const reference (which keeps working in all call sites).
2017-06-01Optimization: Coin&& to ApplyTxInUndoPieter Wuille
This avoids a prevector copy in ApplyTxInUndo.
2017-06-01Replace CTxInUndo with CoinPieter Wuille
The earlier CTxInUndo class now holds the same information as the Coin class. Instead of duplicating functionality, replace CTxInUndo with a serialization adapter for Coin.
2017-06-01Merge #10475: [RPC] getmempoolinfo mempoolminfee is a BTC/KB feerateWladimir J. van der Laan
f128f78 getmempool mempoolminfee is a BTC/KB feerate (Gregory Sanders) Tree-SHA512: 5b32ffc0d2ba7ca623d4ce450fb67855d17b4fa8c3ffb8570a63dc53b3d476d52b39ad6190ac4357dbf01f6b535fa187cd8c34175a16469e9b00097e3bf2e2bc
2017-06-01Avoid CWalletTx copies in GetAddressBalances and GetAddressGroupingsRussell Yanofsky