Commit Graph

10518 Commits

Author SHA1 Message Date
Wladimir J. van der Laan d473e6ddc5
Merge #11448: [gui] reset addrProxy/addrSeparateProxyTor if colon char missing
ce2418f [gui] reset addrProxy/addrSeparateProxyTor if colon char missing (Cristian Mircea Messel)

Pull request description:

  If addrProxy or addrSeparateProxyTor do not have a colon in the string
  somewhere in the QSettings storage, then attempting to open the options
  dialog will cause the entire program to crash.

  Fixes #11209

Tree-SHA512: 2d9e6987cf05af3f41033290b61d00920f7fe4a65bea7efd96ed417a8ca7866d248f091e09947cc8aad3a6a4aa8b7777211cfff7f379a62188be50df2c46d4b2
2017-10-09 16:10:32 +02:00
practicalswift 68feb49105 Use nullptr instead of NULL 2017-10-09 14:26:53 +02:00
Dusty Williams aa57590d7c Update importprivkey named args documentation
Fixes #11462. Updated documentation for importprivkey function to use the correct name for the first argument.
Also updates a call to importprivkey to use named args in functional test.
2017-10-09 07:40:42 -04:00
practicalswift c6b07fddcf Fix a vs. an typo 2017-10-09 10:37:40 +02:00
Jonas Schnelli dd9bb253c3
Fix code style in keystore.cpp/crypter.cpp 2017-10-06 20:56:43 -07:00
Wladimir J. van der Laan 17f2acedbe
Merge #9572: Skip witness sighash cache for non-segwit transactions
0da49b5 Skip precompute sighash for transactions without witness (Johnson Lau)

Pull request description:

  This saves unnecessary hash caching for non-segwit transactions, but I am not sure if the difference is noticeable.

Tree-SHA512: 5cd733a729a52a45781510b3572b26e76837a94155caa14311c6d23a27a12e9613ff278dfc2592e21f640202782f22c5ad00fca85c4de5efacaa617c48ccb08d
2017-10-05 19:49:42 +02:00
Wladimir J. van der Laan 9e8ef9d991
Merge #10440: [tests] Add libFuzzer support
f3ba869 [tests] Add libFuzzer support. (practicalswift)

Pull request description:

  Add `libFuzzer` support.

  As discussed in [issue #10364](https://github.com/bitcoin/bitcoin/issues/10364#issuecomment-300000902).

  See http://llvm.org/docs/LibFuzzer.html#fuzzer-usage for usage instructions.

Tree-SHA512: 32562a3a43eb07e79989d55eeb0bfe94e2cff060da8ff0cb50c2f838ef19f2fd583a3dc89074a6442bd3e395185d309371325ed9a0ef50065431d5ea7f099772
2017-10-05 18:07:50 +02:00
MarcoFalke e93fff1463
Merge #11107: Fix races in AppInitMain and others with lock and atomic bools
c626dcb50 Make fUseCrypto atomic (MeshCollider)
731065b11 Consistent parameter names in txdb.h (MeshCollider)
35aeabec6 Make fReindex atomic to avoid race (MeshCollider)
58d91af59 Fix race for mapBlockIndex in AppInitMain (MeshCollider)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/11106

  Also makes fReindex atomic as suggested in @TheBlueMatt comment below, and makes fUseCrypto atomic as suggested in 10916

  d291e7635b just renames the parameters in the txdb header file to make them consistent with those used in the cpp file, noticed it when looking for uses of fReindex

Tree-SHA512: b378aa7289fd505b76565cd4d48dcdc04ac5540283ea1c80442170b0f13cb6df771b1a94dd54b7fec3478a7b4668c224ec9d795f16937782724c5d020edd3a42
2017-10-05 15:03:36 +02:00
Jonas Schnelli 208fda69b3
CCrypter: move relevant implementation out of the header 2017-10-04 20:32:09 -07:00
Jonas Schnelli 3155fd23f2
CKeystore: move relevant implementation out of the header 2017-10-04 20:32:04 -07:00
Wladimir J. van der Laan 167cef8082
Merge #11435: build: Make "make clean" remove all files created when running "make check"
f35d033 build: Make "make clean" remove all files created when running "make check" (practicalswift)

Pull request description:

  Make `make clean` remove all files created when running `make check`. More specifically: remove also `obj/build.h` and `bench/data/block413567.raw.h` as part of `make clean`.

  Before this patch:

  ```bash
  $ git clone https://github.com/bitcoin/bitcoin.git
  $ cd bitcoin/
  $ ./autogen.sh
  $ ./configure
  $ cp -r ../bitcoin ../bitcoin-before-make
  $ make check
  $ make clean
  $ cp -r ../bitcoin ../bitcoin-after-make-and-make-clean
  $ cd ..
  $ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
  Only in bitcoin-after-make-and-make-clean/src/bench/data: block413567.raw.h
  Only in bitcoin-after-make-and-make-clean/src/obj: build.h
  $
  ```

  After this patch:

  ```bash
  $ git clone https://github.com/bitcoin/bitcoin.git
  $ cd bitcoin/
  $ ./autogen.sh
  $ ./configure
  $ cp -r ../bitcoin ../bitcoin-before-make
  $ make check
  $ make clean
  $ cp -r ../bitcoin ../bitcoin-after-make-and-make-clean
  $ cd ..
  $ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
  $
  ```

Tree-SHA512: 953e8423485ffd415f0ade6abe0b4c407454f67c332140ef019d89db425bb4a831327b3f634b8d69b17325dcfc6e3ac72dc2ba1ce5462158eecc3c05645e93ba
2017-10-04 15:35:41 +02:00
Wladimir J. van der Laan 74123eabdd
Merge #11440: Fix validationinterface build on super old boost/clang
96c2ce9 Fix validationinterface build on super old boost/clang (Matt Corallo)

Pull request description:

  This should fix all the non-dependancy issues for termux builds.
  See Github issue #11388.

Tree-SHA512: ff0918fa76a6d4639a6c5b5e045ef053ce1d93eb0b1fe94c5fdfcc4d5e54e1118eeb09676ffd8f6d1acd630a63656944c6274ee3dbd7c09b7129c30647dbf4f9
2017-10-04 15:02:41 +02:00
Wladimir J. van der Laan 7f11ef2608
Merge #9937: rpc: Prevent `dumpwallet` from overwriting files
0cd9273 rpc: Prevent `dumpwallet` from overwriting files (Wladimir J. van der Laan)

Pull request description:

  Prevent arbitrary files from being overwritten by `dumpwallet`. There have been reports that users have overwritten wallet files this way. It may also avoid other security issues.

  Fixes #9934. Adds mention to release notes and adds a test.

Tree-SHA512: 268c98636d40924d793b55a685a0b419bafd834ad369edaec08227ebe26ed4470ddea73008d1c4beb10ea445db1b0bb8e3546ba8fc2d1a411ebd4a0de8ce9120
2017-10-04 15:01:24 +02:00
practicalswift f35d033369 build: Make "make clean" remove all files created when running "make check"
More specifically: remove also obj/build.h and bench/data/block413567.raw.h.

Before this patch:

```
$ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
Only in bitcoin-after-make-and-make-clean/src/bench/data: block413567.raw.h
Only in bitcoin-after-make-and-make-clean/src/obj: build.h
$
```

After this patch:

```
$ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
$
```
2017-10-04 14:54:41 +02:00
Wladimir J. van der Laan a1f7f18709
Merge #10939: [init] Check non-emptiness of -blocknotify command prior to executing
cffe85f Skip sys::system(...) call in case of empty command (practicalswift)
6fb8f5f Check that -blocknotify command is non-empty before executing (practicalswift)

Pull request description:

  Check that `-blocknotify` command is non-empty before executing.

  To make the `BlockNotifyCallback(...)` (`-blocknotify`) behaviour consistent with that of:
  * `AlertNotify(...)` (`-alertnotify`)
  * `AddToWallet(...)` (`-walletnotify`)

Tree-SHA512: 18272166793a5a8b9cc2a727bfbcea53d38c329a55bc975c02db601329d608a61c20e026ce4b616193ecd3810dca4d3e2cb3bf773898a51872008a8dba96763e
2017-10-04 14:54:09 +02:00
Wladimir J. van der Laan e12522dfda
Merge #11406: Add state message print to AcceptBlock failure message.
6643b80 Add state message print to AcceptBlock failure message. (Matt Corallo)

Pull request description:

  This should make it easier to debug issues where the CheckBlock at
  the top of ProcessNewBlock fails (which does not print, in contrast
  to AcceptBlock, which always prints).

  This was motivated by #11371 which appears to be exactly such a case, and is not debuggable from the information provided. Not sure how much this would have helped in that case, but it is kinda weird that we can reject a block without ever printing why.

Tree-SHA512: 7a1c2c76080b810212da885c38e091609e409c62918cc326bb36a1096e09b2ae7e26fd4bdaefd79863d2894e2823e463005700a524940f177a59ef09f589b2f1
2017-10-04 14:35:43 +02:00
MarcoFalke 9ccafb1d7b
Merge #11421: Merge current secp256k1 subtree
fd86f998f Squashed 'src/secp256k1/' changes from 84973d393..0b7024185 (MarcoFalke)

Pull request description:

  The subtree should now match upstream again. Check with:

  ```sh
  ./contrib/devtools/git-subtree-check.sh src/secp256k1
  ```

  The changes are only documentation/refactoring related.

Tree-SHA512: 43e8a95bcbfefef9e19ec38a92d2d57fdd4a16ddf726e036d36a0d806eb6f35b45b40ee69f980430e107895ec8725b5de4e36456b026214675e0b19630bb6fe9
2017-10-04 12:35:15 +02:00
Cristian Mircea Messel ce2418fa4c [gui] reset addrProxy/addrSeparateProxyTor if colon char missing
If addrProxy or addrSeparateProxyTor do not have a colon in the string
somewhere in the QSettings storage, then attempting to open the options
dialog will cause the entire program to crash.
2017-10-04 01:09:12 +03:00
MarcoFalke b4a509a3f8
Merge #11433: qa: Restore bitcoin-util-test py2 compatibility
fafff1220 qa: Restore bitcoin-util-test py2 compatibility (MarcoFalke)

Pull request description:

  Currently `./configure && make check` will look for python3, then python2. As long as we support python2 (and use it as fallback), `make check` should run fine with both python2 and python3.

  Fixes #11352 by @Zenitur

Tree-SHA512: a335ebdd224328d6f924fe52a9b97de196926476c9ee04ce3280743ea93bcae355eb2d5d4bed4050c01b2e904105595eac7db2eaa9307207581caa0a98ebcc0b
2017-10-03 21:25:00 +02:00
Russell Yanofsky edafc718ad Fix uninitialized URI in batch RPC requests
This fixes "Wallet file not specified" errors when making batch wallet RPC
calls with more than one wallet loaded. This issue was reported by
NicolasDorier <nicolas.dorier@gmail.com>
https://github.com/bitcoin/bitcoin/issues/11257

Request URI is not used for anything except multiwallet request dispatching, so
this change has no other effects.

Fixes #11257
2017-10-03 15:25:00 -04:00
Jim Posen a2be3b66b5 [net] Ignore getheaders requests for very old side blocks
Sending a getheaders message with an empty locator and a stop hash
is a request for a single header by hash. The node will respond with
headers for blocks not in the main chain as well as those in the main
chain. To avoid fingerprinting, the node should, however, ignore
requests for headers on side branches that are too old.
2017-10-03 10:28:00 -07:00
MarcoFalke dbc4ae0396
Merge #11293: Deduplicate CMerkleBlock construction code, add test coverage
46ce223d1 Add tests for CMerkleBlock usage with txids specified (James O'Beirne)
5ab586f90 Consolidate CMerkleBlock constructor into a single method (James O'Beirne)

Pull request description:

  What started as a simple task to add test coverage ended up giving way to a light refactoring. This consolidates the mostly-identical `CMerkleBlock` constructors into one (using C++11 constructor delegation) and adds coverage for the by-txids construction case.

  ### Before

  ![selection_006](https://user-images.githubusercontent.com/73197/30242104-0f381fe4-9545-11e7-9617-83b87fce0456.png)

  ### After

  ![selection_008](https://user-images.githubusercontent.com/73197/30242107-1425dfaa-9545-11e7-9e6b-2c3432517dd1.png)

Tree-SHA512: eed84ed3e8bfc43473077b575c8252759a857e37275e4b36ca7cc2c17a65895e5f494bfd9d4aeab09fc6e98fc6a9c641ac7ecc0ddbeefe01a9e4308e7909e529
2017-10-03 14:27:39 +02:00
Matt Corallo 96c2ce9d34 Fix validationinterface build on super old boost/clang
This should fix all the non-dependancy issues for termux builds.
See Github issue #11388.
2017-10-02 18:24:59 -04:00
MarcoFalke f199b8a33d
Merge #11365: [Tests] Add Qt GUI tests to Overview and ReceiveCoin Page
634e38ca7 [Tests] Add Qt GUI tests to Overview and ReceiveCoin Page (Anditto Heristyo)

Pull request description:

  I've added some Qt wallet tests based on #9974, namely the input & buttons on ReceiveCoin.

Tree-SHA512: f4223827145e35c2abee83a6ca777498bebcff3825fece10fbb1dbfd1f6bb017d3f2c0521662854b4407cdeee9c6a527269ab9cc28e0dc85c11b668155fcd195
2017-10-02 21:19:43 +02:00
practicalswift 76fed838f3 Avoid NULL pointer dereference when _walletModel is NULL (which is valid) 2017-10-02 17:20:08 +02:00
practicalswift 4971a9a3c9 Use two boolean literals instead of re-using variable 2017-10-02 15:47:44 +02:00
practicalswift b5fb33943f Remove duplicate uriParts.size() > 0 check 2017-10-02 15:47:44 +02:00
practicalswift 7466991670 Remove redundant check (!ecc is always true) 2017-10-02 15:47:43 +02:00
practicalswift 55224af6bd Remove redundant NULL checks after new 2017-10-02 15:47:43 +02:00
Wladimir J. van der Laan 90926db238
Merge #11021: [rpc] fix getchaintxstats()
07704c1 Add some tests for getchaintxstats (Akio Nakamura)
3336676 Fix getchaintxstats() (Akio Nakamura)

Pull request description:

  1. calculate nblocks more adaptive.
    -> set default nblocks to min (blocks for 1 month, target block's height - 1)
    -> before PR: if not specify nblocks-parameter, illegal parameter error will happen when target block height is below nblocks.
  2. correct error message.
    -> nblocks accepts [1 .. block's height -1] . so add a word "-1".
  3. add check 0-divide.
    -> if nTimeDiff = 0 then use UniValue(UniValue::VNULL) and returns {... "txrate": null} .
    -> before PR: if nTimeDiff = 0 then returns {... "txrate":} and bitcoin-cli cannot handle the response.

Tree-SHA512: e1962ce7bb05a5bc7dec03eb04a8e7578f50fdb68927fcfc0a2232905ef4d679293eee148ebe0866682d209a8c458d21fbe71715e7311adb81f37089aae1ed93
2017-10-02 15:22:41 +02:00
Wladimir J. van der Laan 339da9ca41
Merge #11411: script: Change SignatureHash input index check to an assert.
5ddf560 script: Change SignatureHash input index check to an assert. (Jim Posen)

Pull request description:

  In the SignatureHash function, the input index must refer to a valid index. This is not enforced equally in the segwit/non-segwit branches and should be an assertion rather than returning a error hash.

Tree-SHA512: a775fc9e9bd9835c0ab36368aa45ab3d53e38f31fd4d2b8684a77ee6028c854c363df038681a59358b30138957573ad63b71d4a722c16e0830fb4fa72669ef39
2017-10-02 15:10:40 +02:00
Wladimir J. van der Laan c5c77bdcc6
Merge #11193: [Qt] Terminate string *pszExePath after readlink and without using memset
3a4401a [Qt] Terminate string *pszExePath after readlink and without using memset (practicalswift)

Pull request description:

  Terminate string `*pszExePath` after `readlink` and before passing to operator `<<`.

  * `ssize_t readlink(const char *pathname, char *buf, size_t bufsiz)` does not append a null byte to `buf`.
  * Operator `<<` expects a null-terminated string.

Tree-SHA512: fc18844bb23059fead8db0cb9b4b4ba6188f58e3f19ab4719c2737cc5dd6df23ae7d4804ef2820d39b334204a48ee3de1d202c272bcd156e60761af2fcb9349d
2017-10-02 15:04:43 +02:00
Wladimir J. van der Laan 058c0f996b
Merge #11432: Remove unused fTry from push_lock
92848e5 Remove unused fTry from push_lock (João Barbosa)

Pull request description:

  After #9674 (618ee92) the `fTry` argument in `push_lock` is no longer needed.

Tree-SHA512: a461f2ca9e590a9dfcc7814d9852d85f03712cb4735176b8b2db0e8dc731597c2a515650998ca7d53cf5a0c48b408a974a0704897036c6ed74788fc24c5e73ae
2017-10-02 14:54:49 +02:00
Wladimir J. van der Laan 10bee0dd4f
Merge #11284: Fix invalid memory access in CScript::operator+= (guidovranken, ajtowns)
d601f16 Fix invalid memory access in CScript::operator+= (Anthony Towns)

Pull request description:

  This is a fix for #11114 -- invoking "s += s" gets turned into "s.insert(s.end(), s.begin(), s.end())" which can result in an invalid memory access is s.capacity() < 2*s.size() (because s gets resized and possibly moved, so s.begin() and s.end() become invalid references when reading the values to be appended).

  The fix is straightforward: reserve enough space in advance, so that insert() doesn't need to resize and thus its arguments remain valid.

  A simple test case is added as well; though you probably need to run it via valgrind to actually catch the problem when it's not fixed...

Tree-SHA512: 4720d0c17463fdc43b344c45fe603423d20b30d48da1b9d85eeedc505d7f34db1ed5495ef1556459ae962a94717e3c6e8fc441763771901efea210d01322b7ef
2017-10-02 14:46:47 +02:00
Wladimir J. van der Laan c641ccac5b
Merge #11422: qa: Verify DBWrapper iterators are taking snapshots
bb8376b Verify DBWrapper iterators are taking snapshots (Matt Corallo)

Pull request description:

  The LevelDB docs seem to indicate that an iterator will not take
  snapshots (even providing instructions on how to do so yourself).
  In several of the places we use them, we assume snapshots to have
  been taken.

  In order to make sure LevelDB doesn't change out from under us
  (and to prevent the next person who reads the docs from having the
  same fright I did), verify that snapshots are taken in our tests.

Tree-SHA512: 54f24dabc294962e9c20882f61809604421a661208d1568bb107102248603e8e7c12e929ccb0812a73d4e4f23fea61f1b48e7cc24da5a7260f1d14d89ba88cd6
2017-10-02 14:40:48 +02:00
MarcoFalke fafff1220c qa: Restore bitcoin-util-test py2 compatibility 2017-10-01 11:22:07 +02:00
João Barbosa 92848e5058 Remove unused fTry from push_lock 2017-09-30 22:43:55 +01:00
Matt Corallo bb8376bbc3 Verify DBWrapper iterators are taking snapshots
The LevelDB docs seem to indicate that an iterator will not take
snapshots (even providing instructions on how to do so yourself).
In several of the places we use them, we assume snapshots to have
been taken.

In order to make sure LevelDB doesn't change out from under us
(and to prevent the next person who reads the docs from having the
same fright I did), verify that snapshots are taken in our tests.
2017-09-30 14:17:51 -04:00
MarcoFalke e542728cde
Merge #11303: Fix estimatesmartfee rounding display issue
1789e4675 Force explicit double -> int conversion for CFeeRate constructor (Matt Corallo)
53a6590f4 Make float <-> int casts explicit outside of test, qt, CFeeRate (Matt Corallo)
0b1b9148c Remove countMaskInv caching in bench framework (Matt Corallo)

Pull request description:

  This fixes an issue where estimatesmartfee which matches at the min relay fee will return 999 sat/byte instead of 1000 sat/byte due to a float rounding issue. I went ahead and made all float <-> int conversion outside of test/qt explicit (test only had one or two more, Qt had quite a few, including many in the Qt headers themselves) and added overloads to CFeeRate to force callers to do an explicit round themselves. Easy to test with -Wfloat-conversion.

Tree-SHA512: 66087b08e5dfca67506da54ae057c2f9d86184415e8fa4fa0199e38839e06a3ce96c836fcb7593b7d960065f5240c594ff3a0cfa14333ac528421f5aeac835c9
2017-09-30 18:07:55 +02:00
Pieter Wuille 38c201f47c
Merge #11418: Add error string for CLEANSTACK script violation
cee28fbc3 Add error string for CLEANSTACK script violation, preventing an "unknown error" if the CLEANSTACK error condition is set. (Mark Friedenbach)

Pull request description:

  This prevents an unhelpful "unknown error" from being printed in test logs if the CLEANSTACK error condition is set.

Tree-SHA512: cd6764e930184aef3d662e40c67f2ea8aea8552a26d33a567d0315a19d707a82aa2afad9f48ecbb731aa5b77fbbfbd7a6a3a989fdb1424a1181350052ff2a9b5
2017-09-29 15:05:42 -07:00
Daniel Edgecumbe b7dfc6c4b8 [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.
2017-09-29 19:40:50 +01:00
MarcoFalke 999968e416 Bump secp256k1 subtree 2017-09-29 16:02:39 +02:00
MarcoFalke fd86f998fc Squashed 'src/secp256k1/' changes from 84973d393..0b7024185
0b7024185 Merge #474: Fix header guards using reserved identifiers
ab1f89f00 Merge #478: Fixed multiple typos
8c7ea22d5 Fixed multiple typos
abe2d3e84 Fix header guards using reserved identifiers
f532bdc9f Merge #459: Add pubkey prefix constants to include/secp256k1.h
cac7c5559 Merge #470: Fix wnaf_const documentation
768514bac Fix wnaf_const documentation with respect to return value and number of words set
b8c26a399 Merge #458: Fix typo in API documentation
817fb2013 Merge #440: Fix typos
12230f90e Merge #468: Remove redundant conditional expression
2e1ccdca0 Remove redundant conditional expression
bc61b91ac add pubkey prefix constants to include/secp256k1.h
b0452e664 Fix typo in API documentation
4c0f32ed5 Fix typo: "Agressive" → "Aggressive"
73aca8364 Fix typo: "exectured" → "executed"

git-subtree-dir: src/secp256k1
git-subtree-split: 0b7024185045a49a1a6a4c5615bf31c94f63d9c4
2017-09-29 16:00:20 +02:00
MarcoFalke 93d20a734d
Merge #11309: Minor cleanups for AcceptToMemoryPool
bf64c3cb3 Ignore transactions added to mempool during a reorg for fee estimation purposes. (Alex Morcos)
04f78ab5b Do not reject based on mempool min fee when bypass_limits is set. (Alex Morcos)
fd849e1b0 Change AcceptToMemoryPool function signature (Alex Morcos)

Pull request description:

  First commit just removes default arguments from `AcceptToMemoryPool` and consolidates two arguments, it does not change behavior.

  Second commit finally fixes the fact that we're not meant to reject based on mempool min fee when adding a transaction from a disconnected block during a reorg as mentioned [here](https://github.com/bitcoin/bitcoin/pull/9602#issue-202197849)

  Third commit makes fee estimation ignore transactions added from a disconnected block during a reorg. I think this was another source of fee estimates returning estimates below 1000 sat/kB as in #11303.

Tree-SHA512: 30925ca8b341915bb214f1d2590b36b7931f2e125b7660150e38ae70338f00db5aa7f1608546dddb181446924177eb7cf62ea8bd2583068acc074d6c3f86bc0c
2017-09-29 15:07:57 +02:00
MarcoFalke faaeeb0d3e Bump univalue and fix json formatting in tests
This merge commit bumps the univalue subtree and also updates the whitespace
for some failing tests.
2017-09-29 14:35:46 +02:00
Mark Friedenbach cee28fbc3f Add error string for CLEANSTACK script violation, preventing an "unknown error" if the CLEANSTACK error condition is set. 2017-09-29 01:48:43 -07:00
Wladimir J. van der Laan 0ec9c91623
Merge #11417: Correct typo in comments
6f33d8c Correct typo in comments (Johnson Lau)

Pull request description:

  I think this is a search and replace mistake

Tree-SHA512: a83e081b817f1607496bfdcee47593d45d75cbe72effe944cdb5494b49a341eeeebdeb954f6db59dfa1ddfa350a117a4b26c754725a3459be78f2a1a093c6fde
2017-09-29 10:20:31 +02:00
Wladimir J. van der Laan aa624b61c9
Merge #11167: Full BIP173 (Bech32) support
8213838 [Qt] tolerate BIP173/bech32 addresses during input validation (Jonas Schnelli)
06eaca6 [RPC] Wallet: test importing of native witness scripts (NicolasDorier)
fd0041a Use BIP173 addresses in segwit.py test (Pieter Wuille)
e278f12 Support BIP173 in addwitnessaddress (Pieter Wuille)
c091b99 Implement BIP173 addresses and tests (Pieter Wuille)
bd355b8 Add regtest testing to base58_tests (Pieter Wuille)
6565c55 Convert base58_tests from type/payload to scriptPubKey comparison (Pieter Wuille)
8fd2267 Import Bech32 C++ reference code & tests (Pieter Wuille)
1e46ebd Implement {Encode,Decode}Destination without CBitcoinAddress (Pieter Wuille)

Pull request description:

  Builds on top of #11117.

  This adds support for:
  * Creating BIP173 addresses for testing (through `addwitnessaddress`, though by default it still produces P2SH versions)
  * Sending to BIP173 addresses (including non-v0 ones)
  * Analysing BIP173 addresses (through `validateaddress`)

  It includes a reformatted version of the [C++ Bech32 reference code](https://github.com/sipa/bech32/tree/master/ref/c%2B%2B) and an independent implementation of the address encoding/decoding logic (integrated with CTxDestination). All BIP173 test vectors are included.

  Not included (and intended for other PRs):
  * Full wallet support for SegWit (which would include automatically adding witness scripts to the wallet during automatic keypool topup, SegWit change outputs, ...) [see #11403]
  * Splitting base58.cpp and tests/base58_tests.cpp up into base58-specific code, and "address encoding"-code [see #11372]
  * Error locating in UI for BIP173 addresses.

Tree-SHA512: 238031185fd07f3ac873c586043970cc2db91bf7735c3c168cb33a3db39a7bda81d4891b649685bb17ef90dc63af0328e7705d8cd3e8dafd6c4d3c08fb230341
2017-09-29 10:18:45 +02:00
Johnson Lau 6f33d8c791 Correct typo in comments 2017-09-29 14:50:30 +08:00
Jonas Schnelli 8213838db2 [Qt] tolerate BIP173/bech32 addresses during input validation
This eases the during-type validation to allow Bech32 chars.
Once the focus has been lost, the address will be properly verified through IsValidDestinationString
2017-09-28 17:29:04 -07:00
Pieter Wuille e278f12ca7 Support BIP173 in addwitnessaddress 2017-09-28 16:24:33 -07:00
Pieter Wuille c091b99379 Implement BIP173 addresses and tests 2017-09-28 16:24:30 -07:00
Pieter Wuille bd355b8db9 Add regtest testing to base58_tests 2017-09-28 16:04:11 -07:00
Pieter Wuille 6565c5501c Convert base58_tests from type/payload to scriptPubKey comparison 2017-09-28 16:04:11 -07:00
Pieter Wuille 8fd2267053 Import Bech32 C++ reference code & tests
This includes a reformatted version of the Bech32 reference code
(see https://github.com/sipa/bech32/tree/master/ref/c%2B%2B), with
extra documentation.
2017-09-28 16:02:16 -07:00
Wladimir J. van der Laan 9d31ed2e69
Merge #10663: net: split resolve out of connect
b887676 net: remove now-unused functions (Cory Fields)
45fd754 net: remove now-superfluous numeric resolve (Cory Fields)
2416dd7 net: separate resolving and conecting (Cory Fields)

Pull request description:

  This is a greatly simplified version of #10285, which only aims to address async resolving.

  It essentially breaks up two wrapper functions for things only used in one place (ConnectSocketDirectly/ConnectThroughProxy) in favor of calling them directly. This allows us to fully handle resolves before attempting a connection, as is necessary for async connections.

  As a bonus, I believe the logic is now much easier to follow than before.

Tree-SHA512: f03f618107379edf3efe2a9f3e3677e8f075017ab140a0b4fdc3b8263e6beff148d55256263ab10bc2125ef089ca68e0d8e865beeae176f1eca544e769c976d3
2017-09-28 17:05:47 +02:00
Wladimir J. van der Laan 9a8e9167f2
Merge #10858: [RPC] Add "errors" field to getblockchaininfo and unify "errors" field in get*info RPCs
395cef7 Change getmininginfo errors field to warnings (Andrew Chow)
8502b20 Unify help text for GetWarnings output in get*info RPCs (Andrew Chow)
f77f0e4 Add warnings field to getblockchaininfo (Andrew Chow)

Pull request description:

  The `getblockchaininfo` output does not contain the `errors` field which the `getinfo`, `getmininginfo`, and `getnetworkinfo` RPCs have. It should have it as the errors pertain to the blockchain. This PR adds that field.

  This PR also unifies the help text for the `errors` field and its output position so that all of the `get*info` commands are consistent.

  `getnetworkinfo`'s `errors` field is named `warnings`. I did not change this even though it is inconsistent since this naming has been in use for a long time.

Tree-SHA512: 385ab6acfee67fc8816f4d51ab2bd7a623264c7973906dfbab0a171f199e9db16fde19093a5bc3dfbdd4ff5f19d2186b646eb6b3bae0a4d7c9add43650a4a9d9
2017-09-28 16:39:15 +02:00
Wladimir J. van der Laan c9a4aa8a0e
Merge #10871: Handle getinfo in bitcoin-cli w/ -getinfo (revival of #8843)
5e69a43 Add test for bitcoin-cli -getinfo (John Newbery)
3826253 rpc: Handle `getinfo` locally in bitcoin-cli w/ `-getinfo` (Wladimir J. van der Laan)

Pull request description:

  Since @laanwj doesn't want to maintain these changes anymore, I will.

  This PR is a revival of #8843. I have addressed @jnewbery's comments.

  Regarding atomicity, I don't think that is a concern here. This is explicitly a new API and those who use it will know that this is different and that it is not atomic.

Tree-SHA512: 9664ed13a5557bda8c43f34d6527669a641f260b7830e592409b28c845258fc7e0fdd85dd42bfa88c103fea3ecdfede5f81e3d91870e2accba81c6d6de6b21ff
2017-09-28 08:33:36 +02:00
Jonas Schnelli d90a00eabe
Merge #11397: net: Improve and document SOCKS code
22f816ef4 net: Improve and document SOCKS code (Wladimir J. van der Laan)

Pull request description:

  Make the SOCKS code more consistent, and document the constants used.

Tree-SHA512: 1bb04fcd6aacb6bfd2c54989d8298c892036466a895efb88be36fbace041af67c964ae0f5fb76c96f813f20a040109de4e0aac49a20844640e4d7633fcb22f25
2017-09-27 20:09:59 -07:00
Jim Posen 5ddf56045a script: Change SignatureHash input index check to an assert.
In the SignatureHash function, the input index must refer to a valid
index. This is not enforced equally in the segwit/non-segwit branches
and should be an assertion rather than returning a error hash.
2017-09-27 19:49:18 -07:00
Wladimir J. van der Laan 382625318d rpc: Handle `getinfo` locally in bitcoin-cli w/ `-getinfo`
This adds the infrastructure `BaseRequestHandler` class that takes care
of converting bitcoin-cli arguments into a JSON-RPC request object, and
converting the reply into a JSON object that can be shown as result.

This is subsequently used to handle the `-getinfo` option, which sends
a JSON-RPC batch request to the RPC server with
`["getnetworkinfo", "getblockchaininfo", "getwalletinfo"]`,
and after reply combines the result into what looks like a `getinfo`
result.

There have been some requests for a client-side `getinfo` and this
is my PoC of how to do it. If this is considered a good idea
some of the logic could be moved up to rpcclient.cpp and
used in the GUI console as well.

Extra-Author: Andrew Chow <achow101@gmail.com>
2017-09-27 21:53:07 -04:00
Andrew Chow 395cef7601 Change getmininginfo errors field to warnings
Changes the errors field to warnings. To maintain compatibility,
the errors field is deprecated and enabled by starting bitcoind with
-deprecatedrpc=getmininginfo
2017-09-27 11:27:26 -04:00
Andrew Chow 8502b20852 Unify help text for GetWarnings output in get*info RPCs 2017-09-27 11:27:26 -04:00
Andrew Chow f77f0e4825 Add warnings field to getblockchaininfo 2017-09-27 11:27:26 -04:00
MarcoFalke ef8340d25f
Merge #11031: [rpc] deprecate estimatefee
048e0c3e2 [rpc] [tests] Add deprecated RPC test (Cristian Mircea Messel)
d4cdbd6fb [rpc] Deprecate estimatefee RPC (John Newbery)

Pull request description:

  Deprecates estimatefee in v0.16, for final removal in v0.17.

  This commit introduces a phased removal of RPC methods. RPC method is
  disabled by default in version x, but can be enabled by using the
  `-deprecatedrpc=<methodname>` argument. RPC method is removed entirely in version
  (x+1).

  This gives users fair warning that an RPC is to be removed, and time to change client software if necessary. Deprecation warnings in RPC return values or release notes are easily ignored.

  This is a more generic version of the approach I tried to use in #10841, which too late to make it into v0.15.

Tree-SHA512: 9695a600e84b812974387333e4a6805d18972da30befb754e9e4da77cd9815d00c5cc2ee0b0350bdbbdb5fdc6ba47789f8b2c6f5b15c8cd5a1deefcc4832da30
2017-09-27 14:38:13 +02:00
MarcoFalke 69c7ecef40
Merge #11408: Trivial: Fix parameter name typo in ErasePurpose walletdb method
603efe9fc Fix parameter name typo in ErasePurpose walletdb method. (Pierre Rochard)

Pull request description:

  The header file has the correct method signature and the one usage in CWallet::DelAddressBook is correctly passing in EncodeDestination(address)

Tree-SHA512: ee0808a74111fd23a1c47ba5ab51de151fdd33a01d92895671e562ac184cbcb33180a3ff26c22e5717595592097b9fa33deca9878d89ce8d34687f09cfadfcf0
2017-09-27 14:23:39 +02:00
Pierre Rochard 603efe9fc4 Fix parameter name typo in ErasePurpose walletdb method. 2017-09-26 18:02:09 -04:00
Jonas Schnelli 2505c5c0a9
Merge #11015: [Qt] Add delay before filtering transactions
7b137aced [Qt] Add delay before filtering transactions Fixes 3141 (Lucas Betschart)

Pull request description:

  As discussed in https://github.com/bitcoin/bitcoin/issues/3141.

  This adds a QTimer pause of 200ms before start to filter so it should be possible to filter big data sets easier.

Tree-SHA512: ee599367794eac2c5b8bc7ecac47f44295e40c0ff543ff2f2c4860590f917b59b1cfb273fa564e6eb4c44016c0ef412d49f1a8f1b36b07e034022f51bb76653c
2017-09-26 15:59:08 -06:00
Matt Corallo 6643b80d1c Add state message print to AcceptBlock failure message.
This should make it easier to debug issues where the CheckBlock at
the top of ProcessNewBlock fails (which does not print, in contrast
to AcceptBlock, which always prints).
2017-09-26 16:23:41 -04:00
John Newbery d4cdbd6fb6 [rpc] Deprecate estimatefee RPC
Deprecate estimatefee in v0.16, for final removal in v0.17.

This commit introduces a phased removal of RPC methods. RPC method is
disabled by default in version x, but can be enabled by using the
`-deprecatedrpc=<method>` argument. RPC method is removed entirely in
version (x+1).
2017-09-26 12:17:19 -04:00
Wladimir J. van der Laan dc597bb895
Merge #11225: wallet: update stored witness in AddToWallet
d01a968 wallet: update stored witness in AddToWallet (Suhas Daftuar)

Pull request description:

  Replace witness-stripped wallet transactions with full transactions;
  this can happen when upgrading from a pre-segwit wallet to a segwit-
  aware wallet.

Tree-SHA512: a348b16b38ae738fa75cf7d3ff50ebd0d0071d5d6061c9a10dc3325fc34f6bc96a67aea21fde460ca20f6178768ee0af04d6d8785b35647f436a9083c4270b07
2017-09-26 16:24:28 +02:00
Wladimir J. van der Laan 0f8e09599d
Merge #11288: More user-friendly error message when partially signing
df10edf More user-friendly error message when partially signing (MeshCollider)

Pull request description:

  When partially signing a transaction using `signrawtransaction`, if the wallet doesn't have access to a key, it will output a scary error message `"error": "Operation not valid with the current stack size"`, yet it will partially sign the transaction anyway. This puts a lot of users off, because they don't realise the signing actually succeeded for some inputs. This catches that specific error when signing, and outputs a friendlier message which says `Unable to sign input, invalid stack size (possibly missing key)`.

  This is the best way I could think of to fix the issue, but please let me know if you come up with a better way to do it :)

  Fixes https://github.com/bitcoin/bitcoin/issues/9988

Tree-SHA512: 65e1d4a49caa4202e1357b0b3f42329d76456c7b4286d63232226e03267809027b0c44e0faaa1da8b86c9ad677e3a3d655698a24fc870d6a661203c9f56ef95b
2017-09-26 16:16:50 +02:00
Wladimir J. van der Laan 0cd9273fd9 rpc: Prevent `dumpwallet` from overwriting files
Prevent arbitrary files from being overwritten. There have been reports
that users have overwritten wallet files this way. It may also avoid
other security issues.

Fixes #9934. Adds mention to release notes and adds a test.
2017-09-26 16:12:47 +02:00
Wladimir J. van der Laan 22f816ef4d net: Improve and document SOCKS code
Make the SOCKS code more consistent, and document the constants used.
2017-09-26 16:00:14 +02:00
Wladimir J. van der Laan 67879b7c44
Merge #11377: Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds
28d4542 Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds (Matt Corallo)

Pull request description:

  Does what it says on the tin.

Tree-SHA512: 324b8da8a9f9a35d3ade74f6c587f981894a085dfea9d64f78de745d5e6ec05c3a7bced487e9aad9c8a48151cd14969a0806f30f80b621edfce0da082fe6f4be
2017-09-26 12:27:37 +02:00
Wladimir J. van der Laan 8cf88b4aae
Merge #11335: Replace save|restoreWindowGeometry with Qt functions
13baf72 Replace save|restoreWindowGeometry with Qt functions (MeshCollider)

Pull request description:

  Alternative to https://github.com/bitcoin/bitcoin/pull/11208, closes https://github.com/bitcoin/bitcoin/issues/11207

  According to the [Qt documentation](https://doc.qt.io/qt-4.8/qwidget.html#restoreGeometry), restoreGeometry does all the checks we need, so it would be better to rely on them instead of doing it ourselves.

  ~Haven't tested this properly yet, hence the WIP.~
  Gives expected behavior exactly as the other system apps do based on my tests. Only potential issue is the case when the GUI is almost entirely offscreen with only a single strip of pixels, its not really possible to see the GUI, but if you know it's there you can bring it back onscreen with just the mouse. And that's exactly how notepad behaves on Windows so I don't think its a real issue.

  This also gives much better behavior when closing a maximized window, currently (0.15.0 release) a maximized window will save the window size on close, and then reopen as a not-maximized but still that size, which is really annoying. This reopens as maximized.

  Gitian build here: https://bitcoin.jonasschnelli.ch/build/305

Tree-SHA512: a8bde14793b4316192df1fa2eaaeb32b44d5ebc5219c35252379840056cd737a9fd162625fd715987f275fec8375334ec1ec328dbc671563f084c611a938985c
2017-09-25 13:16:56 +02:00
Pieter Wuille 1e46ebdf86 Implement {Encode,Decode}Destination without CBitcoinAddress 2017-09-23 14:45:01 -07:00
Wladimir J. van der Laan 10a20bf770
Merge #11338: qt: Backup former GUI settings on `-resetguisettings`
723aa1b qt: Backup former GUI settings on `-resetguisettings` (Wladimir J. van der Laan)

Pull request description:

  Writes the GUI settings to `guisettings.bak` in the data directory before wiping them. This can be used to retroactively troubleshoot issues (e.g. #11262) where `-resetguisettings` solves the problem.
  (as discussed in yesterday's IRC meeting)

Tree-SHA512: c64f5052d992eb02057ba285435f143c42d0cc456144a4c565e1c87be833737f9df750d0aee10810f85047c820d9b4f9f22fd94a6f09f4b28a9cf41b63a56586
2017-09-23 09:40:28 +02:00
Wladimir J. van der Laan 723aa1b875 qt: Backup former GUI settings on `-resetguisettings`
Writes the GUI settings to `guisettings.bak` in the data directory
before wiping them. This can be used to retroactively troubleshoot
issues (e.g. #11262) where `-resetguisettings` solves the problem.
2017-09-23 09:34:53 +02:00
Pieter Wuille aeed345c9b
Merge #10953: [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck
3a131b724 Rename out to m_tx_out in CScriptCheck (Johnson Lau)
e91211878 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau)

Pull request description:

  This simplifies CScriptCheck by combining scriptPubKey and amount

Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
2017-09-22 16:17:44 -07:00
Pieter Wuille c6223b3daa
Merge #11362: Remove nBlockMaxSize from miner opt struct as it is no longer used.
22fd04beb Remove nBlockMaxSize from miner opt struct as it is no longer used. (Gregory Maxwell)

Pull request description:

Tree-SHA512: f7a0fa380b4173120f33f96de90581cb57b8bd7af50996f0c726845acff7b92bb1212b924495ef89645624239d2b60d19c1cee2a13139b00e917154a33f7da4c
2017-09-22 16:09:05 -07:00
Pieter Wuille 8776787108
Merge #11301: add m_added_nodes to connman options
35e5c2269 remove unused IsArgSet check (Marko Bencun)
605918272 add m_added_nodes to connman options (Marko Bencun)

Pull request description:

Tree-SHA512: ca4527a964dcda816b32d335e7fe4d0d8a668a83fbc5e4707ee452d00a7089fa59a88c9f2b1ecdf50e673f2a63fc364b23979e0153f91136525eceec10c2ede2
2017-09-22 16:05:50 -07:00
Pieter Wuille 46c90437f9 Remove some unused functions and methods
In the case of CKey's destructor, it seems to have been an oversight in
f4d1fc259 not to delete it. At this point, it results in the move
constructors/assignment operators for CKey being deleted, which may have
a performance impact.
2017-09-21 23:40:33 -07:00
Johnson Lau 3a131b7244 Rename out to m_tx_out in CScriptCheck 2017-09-22 14:27:03 +08:00
Pieter Wuille 6c4fecfaf7
Merge #11351: Refactor: Modernize disallowed copy constructors/assignment
2a07f878a Refactor: Modernize disallowed copy constructors/assignment (Dan Raviv)

Pull request description:

  Use C++11's better capability of expressing an interface of a non-copyable class by publicly deleting its copy ctor and assignment operator instead of just declaring them private.

Tree-SHA512: 878f446be5a136bb2a90643aaeaca62948b575e6ef71ccc5b4b8f373e66f36ced00665128f36504e0ccfee639863d969329c4276154ef9f2a9de9137f0801e01
2017-09-21 22:43:32 -07:00
Wladimir J. van der Laan 49f3d57eeb
Merge #11116: [script] Unit tests for script/standard and IsMine functions.
7a1e873 [script] Unit tests for IsMine (Jim Posen)
d7afe2d [script] Unit tests for script/standard functions (Jim Posen)

Pull request description:

  Simply adding unit test coverage.

Tree-SHA512: aaf16b1b07b6d43c884a67f4fd5f83c31bf2c560f78798036d7aa37a3efe71a7ca3c82c4b3ba1f3119bcbe3b78013e64bb0020fe57ebc69aea1cb54943881959
2017-09-21 22:16:05 +02:00
Jim Posen 7a1e873b27 [script] Unit tests for IsMine
Does not test watch-only addresses.
2017-09-21 12:24:23 -07:00
Jim Posen d7afe2d157 [script] Unit tests for script/standard functions 2017-09-21 12:24:20 -07:00
MeshCollider 13baf7217b Replace save|restoreWindowGeometry with Qt functions 2017-09-21 22:34:58 +12:00
James O'Beirne 46ce223d15 Add tests for CMerkleBlock usage with txids specified 2017-09-20 20:36:10 -07:00
James O'Beirne 5ab586f90b Consolidate CMerkleBlock constructor into a single method
Incorporates feedback suggested by @sipa, @promag, @TheBlueMatt.
2017-09-20 20:35:54 -07:00
Matt Corallo 28d4542a0a Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds 2017-09-20 23:29:59 -04:00
Pieter Wuille 98212745c8
Merge #10888: range-based loops and const qualifications in net.cpp
05cae8aef range-based loops and const qualifications in net.cpp (Marko Bencun)

Pull request description:

  Plus a use of std::copy() instead of manual copying.

  (The loop on line 117 is already done in #10493).

Tree-SHA512: d9839e330c71bb9781a4efa81ee353c9e3fd8a93c2120a309f7a0e516b119dd7abe0f0988546797801258b867a29581978515c05dda9e5b23097e15f705139b4
2017-09-20 16:46:59 -07:00
Jorge Timón 4e955c58e1
Near-Bugfix: Reestablish consensus check removed in 8d7849b
in 8d7849b6db

This can potentially prevent an overflow that could at least in theory
allow the creation of money.
2017-09-20 23:26:02 +02:00
Jorge Timón 3e8c91629e
Introduce CheckInputsAndUpdateCoins static wrapper in txmempool.cpp 2017-09-20 23:25:56 +02:00
Jorge Timón 832e0744cb
Optimization: Minimize the number of times it is checked that no money is created
by individual transactions to 2 places (but call only once in each):

- ConnectBlock ( before calculated fees per txs twice )
- AcceptToMemoryPoolWorker ( before called CheckTxInputs 4 times and calculated
   fees per tx one extra time )

Also call tx.GetValueOut() only once per call of CheckTxInputs (instead of 2)
2017-09-20 23:25:52 +02:00
Wladimir J. van der Laan 551d7bf604
Merge #11132: Document assumptions that are being made to avoid NULL pointer dereferences
fdc3293 Document assumptions that are being made to avoid NULL pointer dereferences (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made avoid `NULL` pointer dereferences.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential `NULL` pointer dereferences are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: b424328195e2680e1e4ec546298f718c49e5ad182147dc004de580693db1b50eec4065e1c4f232bdb302baa12954265a50ba21cb5ba4ff30248535b2de778672
2017-09-20 19:07:40 +02:00
Wladimir J. van der Laan 44313d8250
Merge #11334: qt: Remove custom fee radio group and remove nCustomFeeRadio setting
e53fa4a Remove custom fee radio group (Andrew Chow)

Pull request description:

  Removes the extraneous custom fee radio group and its single radio button. The radio button is replaced with a label that has the radio button's text.

  Continuation of #11332

Tree-SHA512: b47b675f900ee4e2f4823203a42bb697f707ba67a8504d730c53d4dae511d0ed03226af34efd7ea45570c6111f8b3b6c39ac28f1b5c090de225903442ad4159a
2017-09-20 18:31:40 +02:00
Wladimir J. van der Laan 4f7e37e26c
Merge #11307: wallet: Display non-HD error on first run
fadf31e wallet: Display non-HD error on first run (MarcoFalke)

Pull request description:

  On current master a fresh wallet created with `-usehd=0` is silently created as HD wallet.
  An error should be displayed on the first run.

  Also, this restores a test that was removed in c22a53c

  Fixes: #11313

Tree-SHA512: 226a4129984324f88a431c7e2726383f6841711f0227d8e9f5b4f89d4bb9f2b8e922e6cf0a6f91d6efa747d139543a236b9f29326fc5d1e5d6f1dea2465d9b85
2017-09-19 17:46:05 +02:00
Anditto Heristyo 634e38ca71 [Tests] Add Qt GUI tests to Overview and ReceiveCoin Page 2017-09-19 18:27:03 +09:00
Gregory Maxwell 22fd04beb9 Remove nBlockMaxSize from miner opt struct as it is no longer used. 2017-09-18 23:40:38 +00:00
Cory Fields b887676e1b net: remove now-unused functions 2017-09-18 13:47:47 -04:00
Cory Fields 45fd75453e net: remove now-superfluous numeric resolve
This was added in order to help OpenNetworkConnection avoid creating a
connection that it would end up aborting. It was necessary because resolving
was done as part of the connection process.

Now that resolving is separated from connecting, this case is detected before
the connection is attempted.
2017-09-18 13:47:47 -04:00
Cory Fields 2416dd7cc9 net: separate resolving and conecting
ConnectSocketByName handled resolves as necessary, obscuring the connection
process. With them separated, each can be handled asynchronously.

Also, since proxies must be considered now anyway, go ahead and eliminate the
ConnectSocket wrapper and use ConnectSocketDirectly... directly.
2017-09-18 13:47:47 -04:00
MarcoFalke d6d2c8503c
Merge #11340: Trivial: Fix validation comments
a0b4c2461 Trivial: Fix validation comments (Dan Raviv)

Pull request description:

  - Move comment about transaction/block weight calculation so it applies not only to the GetBlockWeight function but also to GetTransactionWeight
  - Fix comment in validation.cpp referencing future deployment of BIP113. It has already been deployed.
  - The doc comment for BLOCK_DOWNLOAD_WINDOW wasn't updated since pruning was introduced, so it still refers to pruning as something that might happen in the future. A larger BLOCK_DOWNLOAD_WINDOW window would now, indeed, make pruning harder.

Tree-SHA512: ff86ff02c993e8317b9a0decfe5f5b6aae77b7d50e2b253ed73eb553348142bfc30cfeda15fae91907bab8f920e0ea7c52714f4cc7f33a9d6a777f708e2c99ba
2017-09-18 11:32:58 +02:00
Lucas Betschart 7b137acedd [Qt] Add delay before filtering transactions
Fixes 3141
2017-09-18 10:54:26 +02:00
Dan Raviv 5b9748f979 Small refactor of CCoinsViewCache::BatchWrite()
std::unordered_map::erase( const_iterator pos ) returns an iterator to the element following the removed one. Use that to optimize (probably minor-performance-wise, and definitely code-structure-wise) the implementation of CCoinsViewCache::BatchWrite().
2017-09-16 18:47:19 +03:00
Dan Raviv 2a07f878a8 Refactor: Modernize disallowed copy constructors/assignment
Use C++11's better capability of expressing an interface of a non-copyable class by publicly deleting its copy ctor and assignment operator instead of just declaring them private.
2017-09-16 13:06:05 +03:00
Wladimir J. van der Laan e278f86c53
Merge #11196: Switch memory_cleanse implementation to BoringSSL's to ensure memory clearing even with -lto
1444c2e Switch memory_cleanse implementation to BoringSSL's to ensure memory clearing even with link-time optimization. (Adam Langley)

Pull request description:

  The implementation we currently use from OpenSSL prevents the compiler from optimizing away clensing operations on blocks of memory that are about to be released, but this protection is not extended to link-time optimization. This commit copies the solution cooked up by Google compiler engineers which uses inline assembly directives to instruct the compiler not to optimize out the call under any circumstances. As the code is in-lined, this has the added advantage of removing one more OpenSSL dependency.

  Regarding license compatibility, Google's contributions to BoringSSL library, including this code, is made available under the ISC license, which is MIT compatible.

  BoringSSL git commit: ad1907fe73334d6c696c8539646c21b11178f20f

Tree-SHA512: 8134998663c1501e3ce48fbbd6ab41de981f0855e3f4d25d2e86ff8056c917d82c751c88e9c39660319ebfbc8283dce594c3e4fc7f87080a212a2cdba57ea511
2017-09-16 07:40:45 +02:00
Andrew Chow e53fa4a1ca Remove custom fee radio group
Removes the extraneous custom fee radio group and its single radio
button. The radio button is replaced with a label that has the
radio button's text.
2017-09-15 09:47:12 -04:00
Dan Raviv a0b4c24617 Trivial: Fix validation comments
- Move comment about transaction/block weight calculation so it applies not only to the GetBlockWeight function but also to GetTransactionWeight
- Fix comment in validation.cpp referencing future deployment of BIP113. It has already been deployed.
- The doc comment for BLOCK_DOWNLOAD_WINDOW wasn't updated since pruning was introduced, so it still refers to pruning as something that might happen in the future. A larger BLOCK_DOWNLOAD_WINDOW window would now, indeed, make pruning harder.
2017-09-15 14:07:41 +03:00
Wladimir J. van der Laan 09627b1dd4
Merge #11332: Fix possible crash with invalid nCustomFeeRadio in QSettings (achow101, TheBlueMatt)
cdaf3a1 Fix Qt 0.14.2->0.15.0 segfault if "total at least" is selected (Matt Corallo)

Pull request description:

  `QButtonGroup->button()` may return a nullptr.
  Accessing the object directly with `setChecked` seems fragile.

  This is a simple fix to ensure to never call a button out of bounds (nullptr).

  There are probably other places where a sanity check for `QSettings` are required.

  Found by @achow101.
  Code by @TheBlueMatt.

Tree-SHA512: a1b5d6636382a4e20c4e66ef82de19e6daa8b1b5f21b0f2bc5f51cfb6b37797045c7e29ebead8088ee2b990ed12c549c217cae6aad7566319599d086d526f6dc
2017-09-15 09:55:23 +02:00
Matt Corallo cdaf3a1f9e
Fix Qt 0.14.2->0.15.0 segfault if "total at least" is selected
A button was removed, so now button(1) is nullptr
2017-09-14 13:34:22 -07:00
danra dc2f737ae3 Trivial: Fix comments for DEFAULT_WHITELIST[FORCE]RELAY 2017-09-14 20:23:26 +03:00
MeshCollider 77939f27f7 Fix uninitialized g_connman crash in Shutdown() 2017-09-14 16:47:10 +12:00
CryptAxe d052e3847c [qt] Add use available balance in send coins dialog 2017-09-13 01:24:07 +01:00
MarcoFalke ce829855cf
Merge #10691: Trivial: Properly comment about shutdown process in init.cpp file.
581c41157 Properly comment about shutdown process in init.cpp file (Kyuntae Ethan Kim)

Pull request description:

Tree-SHA512: 8aaf739ca5eb2cf6f777b69a0d65f391ba311a33d2e23abc4d3008f90c6ef9da79d0683845abfc08978309f43409f0a7021663f8c564e157224c1dbe15138158
2017-09-12 21:08:06 +02:00
MarcoFalke c377feaad8
Merge #11267: rpc: update cli for estimate*fee argument rename
5acd82de9 rpc: make estimatesmartfee argument naming consistent with documentation (Wladimir J. van der Laan)
24697c40e rpc: update cli for estimatefee argument rename (Wladimir J. van der Laan)

Pull request description:

  The first argument of `estimaterawfee` was renamed from `nblocks` to `conf_target` in 06bcdb8da6. Update the client-side table as well.
  This makes #10753 pass again.

Tree-SHA512: 107c0072a45e0f4e083dc803d534973e6bd4c005e62337a867815d7c98ab1c21d97b7a495c32763883975cbbb001b80003001a6709b7d9bdd81ce4d441b667be
2017-09-12 19:31:30 +02:00
Alex Morcos bf64c3cb34 Ignore transactions added to mempool during a reorg for fee estimation purposes. 2017-09-12 12:40:06 -04:00
Alex Morcos 04f78ab5b9 Do not reject based on mempool min fee when bypass_limits is set.
This should have always been the case, but we will correctly trim to size after
a reorg which is when bypass_limits is set.
2017-09-12 12:35:35 -04:00
Alex Morcos fd849e1b03 Change AcceptToMemoryPool function signature
Combine fLimitFree and fOverrideMempoolLimit into a single boolean:
bypass_limits.  This is used to indicate that mempool limiting based on feerate
should be bypassed.  It is used when readding transactions from a reorg and then
the mempool is trimmed to size after all transactions are added and they can be
evaluated in the context of their descendants. No changes to behavior.
2017-09-12 12:30:26 -04:00
MarcoFalke fadf31ef02 wallet: Display non-HD error on first run 2017-09-12 12:40:41 +02:00
Marko Bencun 05cae8aefd range-based loops and const qualifications in net.cpp
Plus a use of std::copy() instead of manual copying.
2017-09-12 09:11:22 +02:00
Pieter Wuille b9bceaf1c0
Merge #11252: [P2P] When clearing addrman clear mapInfo and mapAddr.
b86a42077 when clearing addrman clear mapInfo and mapAddr (Gregory Sanders)

Pull request description:

  Power failure on my machine resulted in a corrupted addrman that would hit bad assertions when trying to serialize the "cleared" addrman to disk: 6866b4912b/src/addrman.h (L320)

Tree-SHA512: 07ca8b6cbd88407e5f3f0dccb346ae31bd1392f4210b2d5c5647c853986bfec95cf70240b92bafdc61b90e452a5d8315962738d10c10c2b53fdabff10503d05a
2017-09-11 15:33:20 -07:00
Matt Corallo 1789e4675b Force explicit double -> int conversion for CFeeRate constructor
This resolves an issue where estimatesmartfee would return 999
sat/byte instead of 1000, due to floating point loss of precision

Thanks to sipa for suggesting is_integral.
2017-09-11 18:07:52 -04:00
Matt Corallo 53a6590f49 Make float <-> int casts explicit outside of test, qt, CFeeRate 2017-09-11 15:51:37 -04:00
Matt Corallo 0b1b9148cd Remove countMaskInv caching in bench framework
We were saving a div by caching the inverse as a float, but this
ended up requiring a int -> float -> int conversion, which takes
almost as much time as the difference between float mul and div.

There are lots of other more pressing issues with the bench
framework which probably require simply removing the adaptive
iteration count stuff anyway.
2017-09-11 15:51:36 -04:00
Matt Corallo 3dc263c9b9 Use a sensible default for blockmaxweight
No sensible user will ever keep the default settings here, so not
having sensible defaults only serves to screw users who are
paying less attention, which makes for terrible defaults.
2017-09-11 15:51:26 -04:00
Matt Corallo ba206d2c63 Deprecate confusing blockmaxsize, fix getmininginfo output
* This removes block-size-limiting code in favor of GBT clients
  doing the limiting themselves (if at all).
* -blockmaxsize is deprecated and only used to calculate an implied
  blockmaxweight, addressing confusion from multiple users.
* getmininginfo's currentblocksize return value was returning
  garbage values, and has been removed, also removing a
  GetSerializeSize call in some block generation inner loops and
  potentially addressing some performance edge cases.
2017-09-11 15:51:25 -04:00
Wladimir J. van der Laan 31e72b284e
Merge #11268: [macOS] remove Growl support, remove unused code
f151f5f50 [macOS] remove Growl support, remove unused code (Jonas Schnelli)

Pull request description:

  There is no longer a reason to support Growl.
  A) It went to pay-ware since a couple of years
  B) Since OSX 10.8, the operating system has its own modal notification options (Notification Center).

  This PR removes support for Growl.
  OSX notification centre is still supported after this PR.

Tree-SHA512: eee18098d7354c4e98f927bca9963d4843ff6bceee74795f73a66c27eed33efaac00ec2cabde8807efcbc936b16ab712249006fa13f5a3f55e4d44d163f5f9a0
2017-09-11 21:42:43 +02:00
Marko Bencun 35e5c2269c remove unused IsArgSet check
Forgotten in 506b700dcb
2017-09-11 16:17:47 +02:00
Marko Bencun 605918272c add m_added_nodes to connman options 2017-09-11 16:17:01 +02:00
MeshCollider df10edfd03 More user-friendly error message when partially signing 2017-09-11 22:15:44 +12:00
Anthony Towns d601f16621 Fix invalid memory access in CScript::operator+= 2017-09-11 13:40:31 +10:00
MeshCollider c626dcb50e Make fUseCrypto atomic 2017-09-10 11:29:08 +12:00
Wladimir J. van der Laan c22a53cd63
Merge #11250: Bump wallet version to 159900 and remove the `usehd` option
713a92073 Remove usehd option and warn when it is used (Andrew Chow)
d4c18f733 Bump wallet version number to 159900 (Andrew Chow)

Pull request description:

  Bump the wallet version number to 159900 so that new wallets made without a default key will no longer work on previous versions at all. Also remove the `usehd` option to avoid weird interaction with wallet version numbers and HD-ness of wallets.

Tree-SHA512: dd7965505bfad6a926c79afd423236f509229a398a8398076f8d57d90a5974243f9459a61225c4daee560c796f427445c9e55a3ad528a3a97a9123ca6a1269ab
2017-09-08 02:28:12 +02:00
Wladimir J. van der Laan 5acd82de9a rpc: make estimatesmartfee argument naming consistent with documentation
Part of this was a reversion in ec6902d0ea.
2017-09-08 01:55:59 +02:00
Wladimir J. van der Laan 24697c40ee rpc: update cli for estimatefee argument rename
The first argument of estimatesmartfee was renamed from nblocks to
conf_target in 06bcdb8da6. Update the
client-side table as well.
2017-09-08 01:55:59 +02:00
Andrew Chow 713a92073b Remove usehd option and warn when it is used
Removed the -usehd option so wallets cannot be made to be non-hd
anymore. A warning will be displayed when the option is set.
2017-09-07 16:37:44 -07:00
Andrew Chow d4c18f7330 Bump wallet version number to 159900 2017-09-07 16:37:07 -07:00
MarcoFalke 791a0e6dda
Merge #10767: [wallet] Clarify wallet initialization / destruction interface
5d2a3995e [trivial] fixup comment for VerifyWallets() (John Newbery)
43b0e81d0 [wallet] Add StartWallets() function to wallet/init.cpp (John Newbery)
290f3c56d [wallet] Add RegisterWalletRPC() function to wallet/init.cpp (John Newbery)
062d63102 [wallet] Add CloseWallets() function to wallet/init.cpp (John Newbery)
77fe07c15 [wallet] Add StopWallets() function to wallet/init.cpp (John Newbery)
2da5eafa4 [wallet] Add FlushWallets() function to wallet/init.cpp (John Newbery)
1b9cee66e [wallet] Rename WalletVerify() to VerifyWallets() (John Newbery)
9c76ba18c [wallet] Rename InitLoadWallet() to OpenWallets() (John Newbery)

Pull request description:

  Apologies for the mostly code move only PR. This is a pre-req for both #10740 and #10762

  All wallet component initialization/destruction functions are now in their own `wallet/init.cpp` translation unit and are no longer static functions on the CWallet class. The bitcoin_server also no longer has any knowledge that there are multiple wallets in vpwallet.

  There should be no changes in behavior from this PR.

Tree-SHA512: 7c260eb094f2fa1a88d803769ba60935810968a7309f731135e4b17623b97f18c03bbcd293c942093d1efce62c6c978f9ff484d54dc9a60bc2fcb5af2d160fcd
2017-09-07 16:35:52 -07:00
John Newbery 5d2a3995e7 [trivial] fixup comment for VerifyWallets() 2017-09-07 16:22:11 -07:00
John Newbery 43b0e81d0f [wallet] Add StartWallets() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
John Newbery 290f3c56d9 [wallet] Add RegisterWalletRPC() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
John Newbery 062d63102e [wallet] Add CloseWallets() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
John Newbery 77fe07c159 [wallet] Add StopWallets() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
John Newbery 2da5eafa47 [wallet] Add FlushWallets() function to wallet/init.cpp 2017-09-07 16:21:26 -07:00
John Newbery 1b9cee66e1 [wallet] Rename WalletVerify() to VerifyWallets()
This function can now verify multiple wallets.
2017-09-07 16:21:09 -07:00
John Newbery 9c76ba18cd [wallet] Rename InitLoadWallet() to OpenWallets()
Rationale:
- this init function can now open multiple wallets (hence
  Wallet->Wallets)
- This is named as the antonym to CloseWallets(), which carries out the
  opposite action.
2017-09-07 16:19:17 -07:00
Wladimir J. van der Laan efb4383ef6
Merge #10793: Changing &var[0] to var.data()
592404f03 Changing &vec[0] to vec.data(), what 9804 missed (MeshCollider)

Pull request description:

  This just continues the work of https://github.com/bitcoin/bitcoin/pull/9804

  Modifies a lot of `&vector[]`'s to `vector.data()`'s across all the files including tests, just the stuff that 9804 missed

Tree-SHA512: dd1a9dffb999dea4fba78dcc91fe02f90250db86f5c74948e1ff3e8b4036b2154b600555eaa04dece5368920aae3513bc36425dc96e4319ca1041b0928a6b656
2017-09-08 01:16:54 +02:00
Wladimir J. van der Laan 723e580657
Merge #10756: net processing: swap out signals for an interface class
2525b972a net: stop both net/net_processing before destroying them (Cory Fields)
80e2e9d0c net: drop unused connman param (Cory Fields)
8ad663c1f net: use an interface class rather than signals for message processing (Cory Fields)
28f11e940 net: pass CConnman via pointer rather than reference (Cory Fields)

Pull request description:

  See individual commits.
  Benefits:
  - Allows us to begin moving stuff out of CNode and into CNodeState (after #10652 and follow-ups)
  - Drops boost dependency and overhead
  - Drops global signal registration
  - Friendlier backtraces

Tree-SHA512: af2038c959dbec25f0c90c74c88dc6a630e6b9e984adf52aceadd6954aa463b6aadfccf979c2459a9f3354326b5077ee02048128eda2a649236fadb595b66ee3
2017-09-08 01:01:12 +02:00
MeshCollider 592404f03f Changing &vec[0] to vec.data(), what 9804 missed 2017-09-08 10:36:26 +12:00
Wladimir J. van der Laan e6ab88a452
Merge #10916: add missing lock to crypter GetKeys()
fe09b0197 add missing lock to crypter GetKeys() (Marko Bencun)
5cb3da04b keystore GetKeys(): return result instead of writing to reference (Marko Bencun)

Pull request description:

  Issue: #10905

  First commit makes GetKeys() return the result instead of writing to a reference to remove some useless lines.

Tree-SHA512: bb51255b5a6cf5488c3d5dee89f539d41f0717f018441d120047f877e0a705a133fb3b7a97d1cf8f73b5d2ed93dd2dbdfcd6f394e40105af2a12e01d397cb402
2017-09-07 22:04:18 +02:00
Wladimir J. van der Laan 2f0d3e604a
Merge #11232: Ensure that data types are consistent
061297f0a Ensure that data types are consistent (jjz)

Pull request description:

  1. nStatus of CBlockIndex  is consistent with the definition of Enum(BlockStatus)
  2. The BlockHeader is consistent with the type of variable defined in CBlockHeader

Tree-SHA512: 3d4a55c62d3e17b9c83807eae153db4fcfcd8477c9413a45dedfa157563e77b775a66974648d28c9d44ac45a5705eef83b31a8a3b44316dc9814b85526a9d034
2017-09-07 21:09:00 +02:00
Wladimir J. van der Laan e7f125562f
Merge #11237: qt: Fixing division by zero in time remaining
c8d38abd6 Refactor tipUpdate as per style guide (MeshCollider)
3b69a08c5 Fix division by zero in time remaining (MeshCollider)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/10291, https://github.com/bitcoin/bitcoin/issues/11265

  progressDelta may be 0 (or even negative according to 11265), this checks for that and prints unknown if it is, because we cannot calculate an estimate for the time remaining (would be infinite or negative).

Tree-SHA512: bc5708e5ed6e4670d008219558c5fbb25709bd99a32c98ec39bb74f94a0b7fa058f3d03389ccdd39e6723e6b5b48e34b13ceee7c051c2db631e51d8ec3e1d68c
2017-09-07 21:05:47 +02:00
Cory Fields 2525b972af net: stop both net/net_processing before destroying them
This should avoid either attempting to use an invalid reference/pointer to the
other.
2017-09-07 14:26:23 -04:00
donaloconnor 203a4aa31e Fix CTxMemPoolEntry::UpdateAncestorState: modifySigOps param type int -> int64_t 2017-09-07 19:13:01 +01:00
Jonas Schnelli f151f5f50f
[macOS] remove Growl support, remove unused code 2017-09-07 10:11:44 -07:00
Jonas Schnelli a3624ddb1a
Merge #11156: Fix memory leaks in qt/guiutil.cpp
9b348ff9e Fix memory leaks in qt/guiutil.cpp (Dan Raviv)

Pull request description:

  on macOS:
  `listSnapshot` was leaking in `findStartupItemInList()`
  `bitcoinAppUrl` was leaking in `[Get|Set]StartOnSystemStartup()`

Tree-SHA512: dd49e1166336cf4f20035d21930f2f99f21f1d9f91a1101b1434a23dd0b92d402ac7efb177473c758d8af1dbab8d8750485583231c5b5854203d2493f0b43e73
2017-09-07 10:02:27 -07:00
Jonas Schnelli ea729d55b4
Merge #10770: Drop upgrade-cancel callback registration for a generic "cancelable"
ee4d1493e Drop upgrade-cancel callback registration for a generic "resumeable" (Matt Corallo)

Pull request description:

  Instead of passing a StartShutdown reference all the way up from
  txdb, give ShowProgress a "cancelable" boolean, as StartShutdown
  is pretty much always what you'll want to use to cancel. Use the
  same boolean to allow cancel during initial block verification.

Tree-SHA512: 515817aaa4b9e3e856200e00be9c2d44ecfa2d4f288fe3e02116105fe85de2650c13076ee7e45396ec1ce6ab45e53b0477cddda7cfdee5b3bd0589cb81a4c346
2017-09-07 09:21:04 -07:00
Jonas Schnelli 9c8f3655cc
Merge #10911: [qt] Fix typo and access key in optionsdialog.ui
d2be7b25b Typo in optionsdialog.ui Tooltip displayed ampersand incorrectly, &amp; should be in text. (James Evans)

Pull request description:

  Tooltip displayed ampersand incorrectly, &amp; should be in text property rather than tooltip so that access key is correctly displayed for accessibility.

Tree-SHA512: 331848207317d37d4d9db40119d0b7ae9a276d06cd1b057cd0e87d508e1aa769b785246ca30ca9156db632798ec9f68ba8bf78cf42904267b4187bd27cfced35
2017-09-07 09:01:23 -07:00
James Evans d2be7b25b5
Typo in optionsdialog.ui
Tooltip displayed ampersand incorrectly, &amp; should be in text.
2017-09-07 08:55:58 -07:00
jjz 061297f0ac Ensure that data types are consistent
1. nStatus of CBlockIndex  is consistent with the definition of Enum(BlockStatus)

2. The BlockHeader is consistent with the type of variable defined in CBlockHeader
2017-09-07 11:17:35 +08:00
MarcoFalke 2a56baf395
Merge #10682: Trivial: Move the AreInputsStandard documentation next to its implementation
ca67ddf0b Move the AreInputsStandard documentation next to its implementation (esneider)

Pull request description:

  The documentation (and rationale) for `AreInputsStandard` somehow got separated from its implementation, and creates a bit of confusion: it's in the middle of the file, next to the implementation of `IsStandard`, which actually checks the "standardness" of outputs, not inputs.

Tree-SHA512: 71281cbcbc5a5701cc11e812a3e90669dda3d92dc2176b512b7832d79b08b34307999c984516bb0c56b01db9b03a12ee4755f662efc1158f4e126de5ca421999
2017-09-06 18:12:53 -07:00
Jorge Timón 3f0ee3e501
Proper indentation for CheckTxInputs and other minor fixes 2017-09-07 02:44:38 +02:00
MeshCollider 731065b114 Consistent parameter names in txdb.h 2017-09-07 12:00:35 +12:00
MeshCollider 35aeabec62 Make fReindex atomic to avoid race 2017-09-07 12:00:30 +12:00
MeshCollider 58d91af59e Fix race for mapBlockIndex in AppInitMain 2017-09-07 12:00:25 +12:00
João Barbosa 7696841329 Fix style in -stdin and -stdinrpcpass handling 2017-09-07 00:35:28 +01:00
Cory Fields 80e2e9d0ce net: drop unused connman param
The copy in PeerLogicValidation can be used instead.
2017-09-06 19:32:04 -04:00
Cory Fields 8ad663c1fa net: use an interface class rather than signals for message processing
Drop boost signals in favor of a stateful class. This will allow the message
processing loop to actually move to net_processing in a future step.
2017-09-06 19:32:04 -04:00
Wladimir J. van der Laan 66a5b419ef
Merge #10838: (finally) remove getinfo
aece8a463 (finally) remove getinfo in favor of more module-specific infos (Matt Corallo)

Pull request description:

  I see no reason not to have done this in 0.13, let alone for 0.15.

Tree-SHA512: ed3e36f99e9cb90304089e5957ddfbf74141e3e77d850e498e9e45dd8bc1deb9fe36b3fec4c43243023268670a45808de3c23d660df76fa27db6688814c464a5
2017-09-07 01:31:52 +02:00
Matt Corallo aece8a4637 (finally) remove getinfo in favor of more module-specific infos 2017-09-06 16:10:04 -07:00
Cory Fields 28f11e9406 net: pass CConnman via pointer rather than reference
There are a few too many edge-cases here to make this a scripted diff.

The following commits will move a few functions into PeerLogicValidation, where
the local connman instance can be used. This change prepares for that usage.
2017-09-06 19:03:39 -04:00
João Barbosa 86e6dd4b63 Remove duplicate destination decoding 2017-09-06 23:48:35 +01:00
João Barbosa 8d0041e607 Remove unused GetKeyID and IsScript methods from CBitcoinAddress 2017-09-06 23:48:35 +01:00
Wladimir J. van der Laan bcc8a620ea
Merge #11219: [docs] explain how to recompile a modified unit test
478d4fb79 [docs] explain how to recompile only what bitcoind tests need (Sjors Provoost)

Pull request description:

  It was not obvious to me to run `make` inside the test directory, especially because `make src/test` and `make src/test/test_bitcoin` result in `make: Nothing to be done for ...`.

Tree-SHA512: 5fe66c45c50af42d4fed42e3008b1dc4de7ea448f5265a34f4b2f355aa4a48a8187918a49fc9f82e8dd9706bc72c59d0fd67d86057fd816eb317832e46ada7ba
2017-09-07 00:44:20 +02:00
Wladimir J. van der Laan 6acdb1fab7
Merge #11238: Add assertions before potential null deferences
c00199244 Fix potential null dereferences (MeshCollider)

Pull request description:

  Picked up by the static analyzer [Facebook Infer](http://fbinfer.com/) which I was playing around with for another research project. Just adding some asserts before dereferencing potentially null pointers.

Tree-SHA512: 9c01dab2d21bce75c7c7ef867236654ab538318a1fb39f96f09cdd2382a05be1a6b2db0a1169a94168864e82ffeae0686a383db6eba799742bdd89c37ac74397
2017-09-06 23:54:06 +02:00
MarcoFalke bc561b4b7d
Merge #11099: [RPC][mempool]: Add savemempool RPC
1aa97ee08 Add savemempool RPC (Lawrence Nahum)
467cbbcbf Add return value to DumpMempool (Lawrence Nahum)

Pull request description:

  Adds a simple parameterless rpc command to dump the mempool.

  Rationale:

  Sometimes there can be a crash for whatever reason (bug, power loss, etc) causing the mempool.dat file to not be saved.

  This change allows to script/cron the rpc call to have more regular saves to the file as well as cli/ad-hoc.

  This should solve issue https://github.com/bitcoin/bitcoin/issues/11086

Tree-SHA512: e856ae9777425a4521279c9b58e69285d8e374790bebefd3284cf91931eac0e456f86224f427a087a01bf70440bf6e439fa02c8a34940eb1046ae473e98b6aaa
2017-09-06 13:49:25 -07:00
Adam Langley 1444c2e7d0 Switch memory_cleanse implementation to BoringSSL's to ensure memory clearing even with link-time optimization.
The implementation we currently use from OpenSSL prevents the compiler from optimizing away clensing operations on blocks of memory that are about to be released, but this protection is not extended to link-time optimization. This commit copies the solution cooked up by Google compiler engineers which uses inline assembly directives to instruct the compiler not to optimize out the call under any circumstances. As the code is in-lined, this has the added advantage of removing one more OpenSSL dependency.

Regarding license compatibility, Google's contributions to BoringSSL library, including this code, is made available under the ISC license, which is MIT compatible.

BoringSSL git commit: ad1907fe73334d6c696c8539646c21b11178f20f
2017-09-06 13:46:11 -07:00
Wladimir J. van der Laan 961901f77e
Merge #11117: Prepare for non-Base58 addresses
864cd2787 Move CBitcoinAddress to base58.cpp (Pieter Wuille)
5c8ff0d44 Introduce wrappers around CBitcoinAddress (Pieter Wuille)

Pull request description:

  This patch removes the need for the intermediary Base58 type `CBitcoinAddress`, by providing {`Encode`,`Decode`,`IsValid`}`Destination` functions that directly operate on the conversion between `std::string`s and `CTxDestination`.

  As a side, it also fixes a number of indentation issues, and removes probably several unnecessary implicit `CTxDestination`<->`CBitcoinAddress` conversions.

  This change is far from complete. In follow-ups I'd like to:
  * Split off the specific address and key encoding logic from base58.h, and move it to a address.h or so.
  * Replace `CTxDestination` with a non-`boost::variant` version (which can be more efficient as `boost::variant` allocates everything on the heap, and remove the need for `boost::get<...>` and `IsValidDestination` calls everywhere).
  * Do the same for `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey`.

  However, I've tried to keep this patch to be minimally invasive, but still enough to support non-Base58 addresses. Perhaps a smaller patch is possible to hack Bech32 support into `CBitcoinAddress`, but I would consider that a move in the wrong direction.

Tree-SHA512: c2c77ffb57caeadf2429b1c2562ce60e8c7be8aa9f8e51b591f354b6b441162625b2efe14c023a1ae485cf2ed417263afa35c892891dfaa7844e7fbabccab85e
2017-09-06 22:31:02 +02:00
Pieter Wuille 864cd27874 Move CBitcoinAddress to base58.cpp 2017-09-06 13:07:45 -07:00
Pieter Wuille 5c8ff0d448 Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
2017-09-06 13:07:45 -07:00
Wladimir J. van der Laan 39ae41389a
Merge #10845: Remove unreachable code
41bf1598f Remove unreachable code (practicalswift)

Pull request description:

  Remove unreachable code.

Tree-SHA512: 2ae94035f693b1ac73b1587eafcc646602a185f6d2b8a24a05939b43235b331c9e6f369ad2e8208624a47c920e989413c6a89ab9b608add5b7be4ebefae2a796
2017-09-06 21:44:18 +02:00
Wladimir J. van der Laan d745b4cf7b
Merge #11203: rpc: add wtxid to mempool entry output
617c459c6 qa: rpc test for wtxid in mempool entry (Suhas Daftuar)
7e5d5965d RPC: add wtxid to mempool entry output (Suhas Daftuar)

Pull request description:

  We already cache this information in the mempool, so including it in the output of rpc calls is basically free.

Tree-SHA512: 2757e1bfca028103937e4b76ce1a5d805846bad5d3d9dd631dcc5f87721bcc0e9d19e437e02053ef1dd3b38b503f0fca8c0b8492cac37dfbd70256a3665f704c
2017-09-06 20:57:18 +02:00
Wladimir J. van der Laan 59e17899a7
Merge #8330: Structure Packing Optimizations in C{,Mutable}Transaction
37495e0d8 Reorder C{,Mutable}Transaction for better packing (Jeremy Rubin)

Pull request description:

  These commits revise the layout of a few key classes to eliminate padding, eliminating useless memory overhead.

  -This reduces CTransaction from 96 bytes to 88 bytes

Tree-SHA512: 91d1fec363edebbb1f1a5b98142c767511e99d3be857148a76e31cc512c9ab3d153083fa6b46b6407974d3b88de984b436c33e8606fbb2b273d74c825195aa17
2017-09-06 20:14:52 +02:00
Wladimir J. van der Laan 5368614aa1
Merge #11210: Stop test_bitcoin-qt touching ~/.bitcoin
dea086f49 Stop test_bitcoin-qt touching ~/.bitcoin (MeshCollider)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/11192

  The directory remains unused, but this stops the tests touching ~/.bitcoin at all (namely creating it if it doesn't exist)

Tree-SHA512: e59ad6b83dbc5ea2fb2761994c09933721d29668b0eef09b9d938a4ee1c67871c5125c57483ee0ea25f2385e308d275d86bcb9087dd4d502923013b4f3dbac82
2017-09-06 19:19:01 +02:00
Wladimir J. van der Laan 815fe62421
Merge #10357: Allow setting nMinimumChainWork on command line
eac64bb7a [qa] Test nMinimumChainWork (Suhas Daftuar)
0311836f6 Allow setting nMinimumChainWork on command line (Suhas Daftuar)

Pull request description:

  As discussed briefly here: https://botbot.me/freenode/bitcoin-core-dev/2017-02-28/?msg=81712308&page=4

  This adds a hidden command line option for setting `nMinimumChainWork`, which allows us to test this parameter in our functional tests, as well as allowing for niche use cases like syncing nodes that are otherwise disconnected from the network.

  See also #10345, which proposes a new use of `nMinimumChainWork`.

Tree-SHA512: fe4d8f4f289697615c98d8760f1cc74c076110310ea0b5b875fcab78c127da9195b4eb84148aebacc7606c246e5773d3f13bd5d9559d0a8bffac20a3a28c62df
2017-09-06 19:00:57 +02:00
practicalswift fdc329376c Document assumptions that are being made to avoid NULL pointer dereferences 2017-09-06 10:45:37 +02:00
Sjors Provoost 478d4fb79c [docs] explain how to recompile only what bitcoind tests need
`make` rebuilds the entire project. This is quite slow if e.g. you're making changes to one file and only wish to run the bitcoind tests.

This commit adds an instruction to run `make -C src/test` (as opposed to `make src/test` and `make src/test/test_bitcoin`).
2017-09-06 10:07:31 +02:00
Lawrence Nahum 1aa97ee088
Add savemempool RPC 2017-09-06 09:44:36 +02:00
Lawrence Nahum 467cbbcbfc
Add return value to DumpMempool 2017-09-06 09:25:00 +02:00
practicalswift 3a4401a6b8 [Qt] Terminate string *pszExePath after readlink and without using memset 2017-09-06 09:06:47 +02:00
Gregory Sanders b86a42077a when clearing addrman clear mapInfo and mapAddr 2017-09-05 17:32:06 -07:00
Wladimir J. van der Laan 6866b4912b
Merge #10596: Add vConnect to CConnman::Options
352d582ba Add vConnect to CConnman::Options (Marko Bencun)

Pull request description:

  Split the "-connect" argument parsing out of CConnman and put it into
  AppInitMain().

Tree-SHA512: f2d3efc4e2c5808ff98696ea20dd96df599bc472ed5afc9c3eea305d94c36a6ab50c632aa05396c7c34d1917d91b1e7ccd725656ff2631e2a36d9eac477455dc
2017-09-06 02:03:48 +02:00
Wladimir J. van der Laan 28485c783d
Merge #10825: net: set regtest JSON-RPC port to 18443 to avoid conflict with testnet 18332
ce3baa193 changed regtest RPCport to 18443 to avoid conflict with testnet 18332 (Ferdinando M. Ametrano)

Pull request description:

  using the same JSON-RPC default port for both testnet and regtest prevents running both at the same time on the same machine. Since RPCport=P2Pport-1 for both mainnet and testnet, and regtest P2Pport being 18444, 18443 is proposed for regtest RPCport

  Documentation has been updated (or created where missing); manpages doc/man/bitcoin*.1 could include information for regtest too

Tree-SHA512: d42185f7ef54dc918ece19b543c8681d08bb9c5a971394e21f2d9a1091734b091b08df69fab622c207b46f402cf9323ded5b7a33fbd0af722388930169124e7f
2017-09-06 01:18:35 +02:00
MarcoFalke a31e9ad4f0
Merge #11247: qt: Use IsMine to validate custom change address
a1ea1cfbd qt: Use IsMine to validate custom change address (Chris Moore)

Pull request description:

  Fixes #11137
  Closes #11184 (which was accidentally opened against 0.15 branch)

Tree-SHA512: a20a59b4f36c1471a9c84bcc7c69048576d1f413104c299a7ed9ba221f28eddf93d727fca2926420ea5d0dd9aba582924f26a5acd44d995039b7202c73eb53bc
2017-09-05 16:00:37 -07:00
MeshCollider c8d38abd65 Refactor tipUpdate as per style guide 2017-09-06 10:50:05 +12:00
MeshCollider 3b69a08c53 Fix division by zero in time remaining 2017-09-06 10:49:36 +12:00
Chris Moore a1ea1cfbd8 qt: Use IsMine to validate custom change address
(cherry picked from commit c41224dfd51c896341bbf2fa23e160bf5ffe27c3)
2017-09-05 15:22:28 -07:00