aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-01-15Merge #12118: Sort mempool by min(feerate, ancestor_feerate)Wladimir J. van der Laan
0a22a52 Use mempool's ancestor sort in transaction selection (Suhas Daftuar) 7abfa53 Add test for new ancestor feerate sort behavior (Suhas Daftuar) 9a51319 Sort mempool by min(feerate, ancestor_feerate) (Suhas Daftuar) 6773f92 Refactor CompareTxMemPoolEntryByDescendantScore (Suhas Daftuar) Pull request description: This more closely approximates the desirability of a given transaction for mining, and should result in less re-sorting when transactions get removed from the mempool after being mined. I measured this as approximately a 5% speedup in removeForBlock. Tree-SHA512: ffa36b567c5dfe3e8908c545a459b6a5ec0de26e7dc81b1050dd235cac9046564b4409a3f8c5ba97bd8b30526e8fec8f78480a912e317979467f32305c3dd37b
2018-01-15Merge #12127: Remove unused mempool indexWladimir J. van der Laan
8e617e3 Remove unused mempool index (Suhas Daftuar) Pull request description: We haven't used the "mining_score" index since 0.12, so remove it. Tree-SHA512: ae37b8663194986eaeecfc2bbeca7ecb4ae6f0d8384515fa218cbc939a580d4b9f7f997c5297c3f1b3c3a0651edb092f373ac9a4808aaec30d38cb99d5f3ed70
2018-01-13Use mempool's ancestor sort in transaction selectionSuhas Daftuar
Transaction selection for mining tracks ancestor feerates that are modified based on transactions that have already been selected. This commit de-duplicates the code so that the ancestor feerate sorting used by the mempool can also be directly applied to the miner.
2018-01-12Add test for new ancestor feerate sort behaviorSuhas Daftuar
2018-01-12Trivial: Fix #include sys/fcntl.h to just fcntl.h (without sys/)Jan Sarenik
http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html http://man7.org/linux/man-pages/man2/fcntl.2.html
2018-01-11Merge #12082: Adding test case for SINGLE|ANYONECANPAY hash type in ↵MarcoFalke
tx_valid.json 18be3ab139 Adding test case for SINGLE|ANYONECANPAY hash type in tx_valid.json (Chris Stewart) Pull request description: We are missing a test vector for SINGLE|ANYONECANPAY inside of tx_valid.json. This addresses the issue #12060 Tree-SHA512: e3526113477dbf575c4a844cf489dcfa2c037c6d928af6f97413edc1a8d29cdf2143da96471cdfd3de08bf5ed178117ed67926fd70fd42ca391ac0bb0d08f3fd
2018-01-11Fix ListCoins test failure due to unset g_address_type, g_change_typeRussell Yanofsky
New global variables were introduced in #11403 and not setting them causes: test_bitcoin: wallet/wallet.cpp:4199: CTxDestination GetDestinationForKey(const CPubKey&, OutputType): Assertion `false' failed. unknown location(0): fatal error in "ListCoins": signal: SIGABRT (application abort requested) It's possible to reproduce the failure reliably by running: src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ListCoins Failures happen nondeterministically because boost test framework doesn't run tests in a specified order, and tests that run previously can set the global variables and mask the bug.
2018-01-10Merge #11403: SegWit wallet supportJonas Schnelli
b224a47a1 Add address_types test (Pieter Wuille) 7ee54fd7c Support downgrading after recovered keypool witness keys (Pieter Wuille) 940a21932 SegWit wallet support (Pieter Wuille) f37c64e47 Implicitly know about P2WPKH redeemscripts (Pieter Wuille) 57273f2b3 [test] Serialize CTransaction with witness by default (Pieter Wuille) cf2c0b6f5 Support P2WPKH and P2SH-P2WPKH in dumpprivkey (Pieter Wuille) 37c03d3e0 Support P2WPKH addresses in create/addmultisig (Pieter Wuille) 3eaa003c8 Extend validateaddress information for P2SH-embedded witness (Pieter Wuille) 30a27dc5b Expose method to find key for a single-key destination (Pieter Wuille) 985c79552 Improve witness destination types and use them more (Pieter Wuille) cbe197470 [refactor] GetAccount{PubKey,Address} -> GetAccountDestination (Pieter Wuille) 0c8ea6380 Abstract out IsSolvable from Witnessifier (Pieter Wuille) Pull request description: This implements a minimum viable implementation of SegWit wallet support, based on top of #11389, and includes part of the functionality from #11089. Two new configuration options are added: * `-addresstype`, with options `legacy`, `p2sh`, and `bech32`. It controls what kind of addresses are produced by `getnewaddress`, `getaccountaddress`, and `createmultisigaddress`. * `-changetype`, with the same options, and by default equal to `-addresstype`, that controls what kind of change is used. All wallet private and public keys can be used for any type of address. Support for address types dependent on different derivation paths will need a major overhaul of how our internal detection of outputs work. I expect that that will happen for a next major version. The above also applies to imported keys, as having a distinction there but not for normal operations is a disaster for testing, and probably for comprehension of users. This has some ugly effects, like needing to associate the provided label to `importprivkey` with each style address for the corresponding key. To deal with witness outputs requiring a corresponding redeemscript in wallet, three approaches are used: * All SegWit addresses created through `getnewaddress` or multisig RPCs explicitly get their redeemscripts added to the wallet file. This means that downgrading after creating a witness address will work, as long as the wallet file is up to date. * All SegWit keys in the wallet get an _implicit_ redeemscript added, without it being written to the file. This means recovery of an old backup will work, as long as you use new software. * All keypool keys that are seen used in transactions explicitly get their redeemscripts added to the wallet files. This means that downgrading after recovering from a backup that includes a witness address will work. These approaches correspond to solutions 3a, 1a, and 5a respectively from https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2. As argued there, there is no full solution for dealing with the case where you both downgrade and restore a backup, so that's also not implemented. `dumpwallet`, `importwallet`, `importmulti`, `signmessage` and `verifymessage` don't work with SegWit addresses yet. They're remaining TODOs, for this PR or a follow-up. Because of that, several tests unexpectedly run with `-addresstype=legacy` for now. Tree-SHA512: d425dbe517c0422061ab8dacdc3a6ae47da071450932ed992c79559d922dff7b2574a31a8c94feccd3761c1dffb6422c50055e6dca8e3cf94a169bc95e39e959
2018-01-09Support downgrading after recovered keypool witness keysPieter Wuille
2018-01-09SegWit wallet supportPieter Wuille
This introduces two command line flags (-addresstype and -changetype) which control the type of addresses/outputs created by the GUI and RPCs. Certain RPCs allow overriding these (`getnewaddress` and `getrawchangeaddress`). Supported types are "legacy" (P2PKH and P2SH-multisig), "p2sh-segwit" (P2SH-P2WPKH and P2SH-P2WSH-multisig), and "bech32" (P2WPKH and P2WSH-multisig). A few utility functions are added to the wallet to construct different address type and to add the necessary entries to the wallet file to be compatible with earlier versions (see `CWallet::LearnRelatedScripts`, `GetDestinationForKey`, `GetAllDestinationsForKey`, `CWallet::AddAndGetDestinationForScript`).
2018-01-09Implicitly know about P2WPKH redeemscriptsPieter Wuille
Make CKeyStore automatically known about the redeemscripts necessary for P2SH-P2WPKH (and due to the extra checks in IsMine, also P2WPKH) spending.
2018-01-09Support P2WPKH and P2SH-P2WPKH in dumpprivkeyPieter Wuille
2018-01-09Support P2WPKH addresses in create/addmultisigPieter Wuille
2018-01-09Sort mempool by min(feerate, ancestor_feerate)Suhas Daftuar
This more closely approximates the desirability of a given transaction for mining.
2018-01-09Refactor CompareTxMemPoolEntryByDescendantScoreSuhas Daftuar
2018-01-09Remove unused mempool indexSuhas Daftuar
2018-01-06Merge #10677: RPC Docs: addmultisigaddress is intended for non-watchonly ↵Pieter Wuille
addresses 73041c3c99 RPC Docs: addmultisigaddress is intended for non-watchonly addresses (Gregory Sanders) Pull request description: Spent a couple hours debugging why my p2sh watchonly funds were not appearing in various accounting calls when address was imported via `addmultisigaddress`. Tree-SHA512: 0673e276e5ca8cdc4c9357bd835a29bd5a994520a78179600944932c700917142930288bf179f5e89b0874beaf1a88bd70129f3a297a46df42a10bab847017bb
2018-01-04Replaces numbered place marker %2 with %1.251
Replaces numbered place marker %2 with %1, because the QString::arg() member function is called once on the string used to create the QString object.
2018-01-04Merge #11997: [tests] util_tests.cpp: actually check ignored argsMarcoFalke
c99a3c32c8 [tests] util_tests.cpp: actually check ignored args (Anthony Towns) Pull request description: An array with 7 elements was setup for checking argument parsing, but was passed to ParseParamaeters with argc=5, meaning the interpretation of the last two arguments was never actually checked. Tree-SHA512: 7b81fde49742e524f1bb67e2ec084f5909ae36125f237f0210df4587c62e5a5a8f277f13543f0a85ad145c4bb80d62339a7d50d7ed41659df318c8198ea7f428
2018-01-04Merge #12001: [RPC] Adding ::minRelayTxFee amount to getmempoolinfo and ↵Wladimir J. van der Laan
updating help aad3090 [rpc] Adding ::minRelayTxFee amount to getmempoolinfo and updating mempoolminfee help description (Jeff Rade) Pull request description: These are RPC document changes from #11475 which is now merged. Took into consideration comments from #11475 and #6941 for this PR. Biggest change here is when calling `getmempoolinfo`, will now show the `minrelaytxfee` in the JSON reponse (see below): ``` $ bitcoin-cli getmempoolinfo { "size": 50, "bytes": 13102, "usage": 70480, "maxmempool": 300000000, "mempoolminfee": 0.00001000, "minrelaytxfee": 0.00001000 } ``` Fixes #8953 Tree-SHA512: 5ca583961365ee1cfe6e0d19afb0b41d542e179efee3b3c5f3fcf7d3ebca9cc3eedfd1434a0da40c5eed84fba98b35646fda201e6e61c689b58bee9cbea44b9e
2018-01-03Merge #12035: [qt] change µBTC to bitsJonas Schnelli
ebcee1de2 bips: add bip176 (Bits Denomination) (William Casarin) 275b2eeed [qt] change µBTC to bits (William Casarin) Pull request description: Now that we have bip176, change "µBTC" to the more colloquial "bits" Tree-SHA512: eba5e5f89c392728a4f0a3bd81a9779a117b8d72a490390fd031d4e7cc56c2bfee0016aba7ef9535903e8cf2262ce46497283424e378906d0e3bf5b0d2d981c7
2018-01-03Merge #12074: [qt] Optimizes boolean expression model && model->haveWatchOnly()Jonas Schnelli
6dda059bd [qt] Simplifies boolean expression model && model->haveWatchOnly() (251) Pull request description: This PR optimizes the boolean expression `model && model->haveWatchOnly()` to `model->haveWatchOnly()`. The boolean expression can be optimized because the method `TransactionView::exportClicked` already guards against a potential dereferenced null pointer by returning early if `model` is null. https://github.com/bitcoin/bitcoin/blob/63a4dc10876bfc61c2e87d35dcf17da2f0f8c316/src/qt/transactionview.cpp#L351-L353 Tree-SHA512: 8bdd0d05bf879745fa39d3ca7524471720ae08ceee9427d5a08776e7b56d18542ae87a6991cd6779e232305f504fdfc77223702b72ecbe231f5f5e98453456dd
2018-01-03Adding test case for SINGLE|ANYONECANPAY hash type in tx_valid.jsonChris Stewart
2018-01-04[tests] util_tests.cpp: actually check ignored argsAnthony Towns
An array with 7 elements was setup for checking argument parsing, but was passed to ParseParamaeters with argc=5, meaning the interpretation of the last two arguments was never actually checked.
2018-01-03Extend validateaddress information for P2SH-embedded witnessPieter Wuille
This adds new fields 'pubkeys' and 'embedded' to the RPC's output, and improves the documentation for previously added 'witness_version' and 'witness_program' fields.
2018-01-03Expose method to find key for a single-key destinationPieter Wuille
2018-01-03Improve witness destination types and use them morePieter Wuille
2018-01-03[refactor] GetAccount{PubKey,Address} -> GetAccountDestinationPieter Wuille
2018-01-03Merge #12062: Increment MIT Licence copyright header year on files modified ↵Wladimir J. van der Laan
in 2017 595a7ba Increment MIT Licence copyright header year on files modified in 2017 (Akira Takizawa) Pull request description: Edited via: $ contrib/devtools/copyright_header.py update . ps) It is the same commit as #9450 Tree-SHA512: 274bfcd6cf2914315ed52f6db773a68800ce9d6bd225a3142654483f0bbc3fd865009e62f9d954f65765d038c626e55d2a64e37e16843809adc2f67abe659b6d
2018-01-03Abstract out IsSolvable from WitnessifierPieter Wuille
2018-01-02Fixes issue #12067 `sendmany` curl example is wrong.251
This commit removes the escaped backslash and quote characters from the keys in the JSON object to make it a plain JSON object.
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2018-01-02[qt] Simplifies boolean expression model && model->haveWatchOnly()251
The boolean expression model && model->haveWatchOnly() can be simplified to model->haveWatchOnly(), because if (!model || !model->getOptionsModel()) { return; } guards against a potential dereferenced null pointer.
2017-12-29[rpc] Adding ::minRelayTxFee amount to getmempoolinfo and updating ↵Jeff Rade
mempoolminfee help description
2017-12-29Merge #11824: Block ActivateBestChain to empty validationinterface queuePieter Wuille
97d2b09c12 Add helper to wait for validation interface queue to catch up (Matt Corallo) 36137497f1 Block ActivateBestChain to empty validationinterface queue (Matt Corallo) 5a933cefcc Add an interface to get the queue depth out of CValidationInterface (Matt Corallo) a99b76f269 Require no cs_main lock for ProcessNewBlock/ActivateBestChain (Matt Corallo) a734896038 Avoid cs_main in net_processing ActivateBestChain calls (Matt Corallo) 66aa1d58a1 Refactor ProcessGetData in anticipation of avoiding cs_main for ABC (Matt Corallo) 818075adac Create new mutex for orphans, no cs_main in PLV::BlockConnected (Matt Corallo) Pull request description: This should fix #11822. It ended up bigger than I hoped for, but its not too gnarly. Note that " Require no cs_main lock for ProcessNewBlock/ActivateBestChain" is mostly pure code-movement. Tree-SHA512: 1127688545926f6099449dca6a4e6609eefc3abbd72f1c66e03d32bd8c7b31e82097d8307822cfd1dec0321703579cfdd82069cab6e17b1024e75eac694122cb
2017-12-28[qt] change µBTC to bitsWilliam Casarin
* Now that we have bip176, change "µBTC" to the more colloquial "bits" * We retain the `µBTC (bits)` description in dropdowns and status bars. The more concise "bits" is used when appended to numbers. Signed-off-by: William Casarin <jb55@jb55.com>
2017-12-26Add helper to wait for validation interface queue to catch upMatt Corallo
2017-12-26Block ActivateBestChain to empty validationinterface queueMatt Corallo
2017-12-26Add an interface to get the queue depth out of CValidationInterfaceMatt Corallo
2017-12-26Require no cs_main lock for ProcessNewBlock/ActivateBestChainMatt Corallo
This requires the removal of some very liberal (incorrect) cs_mains sprinkled in some tests. It adds some chainActive.Tip() races, but the tests are all single-threaded anyway.
2017-12-24Avoid cs_main in net_processing ActivateBestChain callsMatt Corallo
2017-12-24Refactor ProcessGetData in anticipation of avoiding cs_main for ABCMatt Corallo
2017-12-23Merge #11517: Tests: Improve benchmark precisionWladimir J. van der Laan
760af84 Removed CCheckQueueSpeed benchmark (Martin Ankerl) 00721e6 Improved microbenchmarking with multiple features. (Martin Ankerl) Pull request description: The benchmark's KeepRunning() used to make a function call for each call, inflating measurement times for short running code. This change inlines the critical code that is executed each run and moves the slow timer updates into a new function. This change increases the average runtime for Trig from 0.000000082339208 sec to 0.000000080948591. Tree-SHA512: 36b3bc55fc9b1d4cbf526b7103af6af18e9783e6b8f3ad3adbd09fac0bf9401cfefad58fd1e6fa2615d3c4e677998f912f3323d61d7b00b1c660d581c257d577
2017-12-23Merge #11748: [Tests] Adding unit tests for GetDifficulty in blockchain.cpp.Wladimir J. van der Laan
3e1ee31 [Tests] Adding unit tests for GetDifficulty in blockchain.cpp. (sean) Pull request description: blockchain.cpp has low unit test coverage. This commit is intended to start improving its code coverage to reasonable levels. One or more follow up commits will complete the task that this commit is starting (though the usefulness of this commit is not dependent upon later commits). Note that these tests were not written based upon a specification of how GetDifficulty *should* work, but rather how it actually *does* work. As a result, if there are any bugs in the current GetDifficulty implementation, these unit tests serve to lock them in rather than expose them. -- Why has blockchain.cpp been modified if this is a unit testing change? Since the existing GetDifficulty function relies on a global variable, chainActive, it was not suitable for unit testing purposes. Both the existing GetDifficulty function and the unit tests now call through to a new, more modular version of GetDifficulty that can work on any chain, not just chainActive. -- Why does blockchain_tests.cpp directly include blockchain.cpp instead of blockchain.h? While the new GetDifficulty function's signature is arguably better than the old one's, it still isn't great, and doesn't seem to warrant inclusion as part of the blockchain.h API, especially since only test code is directly using it. If a better way of exposing the new GetDifficulty function to unit tests exists, please mention it and the commit will be updated accordingly. -- Why is the test fixture named blockchain_difficulty_tests rather than blockchain_tests? The Bitcoin Core policy for naming unit test files is to match the the file under test ("blockchain" becomes "blockchain_tests"). While this commit complies with that, blockchain.cpp is a massive file, such that having all of the unit tests in one file will tend towards disorder. Since there will be a lot more tests added to this file, the intention is to divide up different types of tests into different test fixtures within the same file. Tree-SHA512: a7dda9c2a9414d4819b4d2911f5637891dc19cecbecfc1463846161d2a78793151927a5ab911c69a5d3013f7668e75a1d78a65667cb9d83910cda439cbe84d62
2017-12-23Removed CCheckQueueSpeed benchmarkMartin Ankerl
This benchmark's runtime was rather unpredictive on different machines, not really a useful benchmark.
2017-12-23Improved microbenchmarking with multiple features.Martin Ankerl
* inline performance critical code * Average runtime is specified and used to calculate iterations. * Console: show median of multiple runs * plot: show box plot * filter benchmarks * specify scaling factor * ignore src/test and src/bench in command line check script * number of iterations instead of time * Replaced runtime in BENCHMARK makro number of iterations. * Added -? to bench_bitcoin * Benchmark plotly.js URL, width, height can be customized * Fixed incorrect precision warning
2017-12-23Merge #11475: [rpc] mempoolinfo should take ::minRelayTxFee into accountWladimir J. van der Laan
149dffd [rpc] mempoolinfo should take ::minRelayTxFee into account (Cristian Mircea Messel) Pull request description: Fixes #6941 following https://github.com/bitcoin/bitcoin/pull/11410#issuecomment-332991078 's suggestion This takes care of the mentioned ticket without changing the behavior of https://github.com/bitcoin/bitcoin/pull/11410/files#diff-24efdb00bfbe56b140fb006b562cc70bL629 By modifying https://github.com/bitcoin/bitcoin/blob/5a9da37fb3f4b53f556e1d46509b94dc3c661d75/src/txmempool.cpp#L984 the syncing mempools becomes problematic as per https://github.com/bitcoin/bitcoin/pull/11410#issuecomment-333868390 ~~Same code causes different tests to fail: https://travis-ci.org/bitcoin/bitcoin/jobs/286128241 https://travis-ci.org/bitcoin/bitcoin/jobs/286128241 . I can't reproduce the problems locally, am I doing something wrong?~~ travis sometimes fails unexpectedly Tree-SHA512: fd81628da6a3eff51bd09e5342d781bac0710f79d6b330b1df3662756ecaceb2e1682bf9768b5f8edbcba6479a3223dfa6604d37c9e9d37d00d077172da4f6ea
2017-12-22Merge #11605: [Wallet] Enable RBF by default in QTWladimir J. van der Laan
5cbbbd7 [Wallet] Use RBF by default in QT only (Sjors Provoost) Pull request description: ~If there are no objections, this would supersede #11556.~ Enabling RBF by default avoids the need to explain all possible use cases of RBF. This PR does not change the default RPC wallet behavior, as this could break implementations that depend on it and it's not clear what happens when automated services suddenly switch on RBF on a large scale. After trying various approaches, we settled on just having QT ignore `-walletrbf`. Send screen: <img width="388" alt="send" src="https://user-images.githubusercontent.com/10217/34251097-329c8dee-e63f-11e7-9e14-d7f55d2b52cc.png"> Confirmation screen by default (with RBF): <img width="429" alt="rbf yes" src="https://user-images.githubusercontent.com/10217/32442799-f50d54aa-c2fc-11e7-9392-96339d0f1f74.png"> Confirmation screen without RBF: <img width="431" alt="rf no" src="https://user-images.githubusercontent.com/10217/32442793-ef30bc34-c2fc-11e7-8ca2-e86a97175278.png"> Tree-SHA512: 53efb5d277144478143e69dcae8112c1b9c2beb981fdd0fe778592e5f7d5bf838f73d48052ead874586a75b944e8af469b25e5f376c135cf48cc3598e77f5891
2017-12-22[Wallet] Use RBF by default in QT onlySjors Provoost
GUI wallet uses RBF by default, regardless of -walletrbf. RPC and debug console in the GUI remain unchanged; they don't use RBF by default, unless launched with -walletrbf=1.
2017-12-21Merge #11667: Add scripts to dumpwallet RPCWladimir J. van der Laan
656fde5 Add script birthtime metadata to dump and import wallet (MeshCollider) 1bab9b2 Add script dump note to RPC help text and release notes (MeshCollider) 68c1e00 Add test for importwallet (MeshCollider) 9e1184d Add dumpwallet scripts test (MeshCollider) ef0c730 Add scripts to importwallet RPC (MeshCollider) b702ae8 Add CScripts to dumpwallet RPC (MeshCollider) cdc260a Add GetCScripts to CBasicKeyStore (MeshCollider) Pull request description: As discussed in https://github.com/bitcoin/bitcoin/pull/11289#issuecomment-334600457, adds the CScripts from the wallet to the `dumpwallet` RPC and then allows them to be imported with the `importwallet` RPC. Includes a basic test, and modifies the helptext of the dumpwallet RPC. Notes: - Reviewers: use `?w=1` to avoid the indentation-only change in commit `Add scripts to importwallet RPC ` - currently the scripts are followed with `# addr=` comments just as the other keys are, unsure if this might confuse users into thinking all the scripts are for valid P2SH addresses though, but I don't think that should be an issue. - there are no birthtimes for scripts, so script imports don't affect rescans - `importwallet` imports the CScripts but I'm not sure how to approach specifying whether scripts are for P2SH addresses, BIP173 addresses, etc. whether that matters or not. Otherwise the RPC helptext might just need modification. Fixes #11715 Tree-SHA512: 36c55837b3a58b9d3499d4c0c2ae82153d62aa71919e751574651b63a1d2b8ecc83796db4553cc65dad9b5341c3a42ae2fcf4d62598c30af267f8e1461ba8272