Commit graph

13356 commits

Author SHA1 Message Date
Chun Kuan Lee 0164b0f5cf build: Remove WINVER pre define in Makefile.leveldb.inlcude 2019-01-26 09:28:48 +08:00
MarcoFalke fab4bed68a
[test] fuzz: make test_one_input return void
The return value is always 0 and not used, so might as well return void
2019-01-25 19:05:07 -05:00
Ben Woosley 70e7cee960
Trivial: Doxygenize existing CBufferedFile and VectorReader comments 2019-01-25 12:32:37 -08:00
MarcoFalke faa1522e5e
RPCHelpMan: Pass through Result and Examples 2019-01-25 14:16:07 -05:00
Pieter Wuille 11e0fd8d66 Descriptor expansions only need pubkey entries for PKH/WPKH 2019-01-25 10:39:06 -08:00
MarcoFalke d14ef5721f
Merge #15233: Prevent mutex lock fail even if --enable-debug
b09dab0f2d Prevent mutex lock fail even if --enable-debug (Akio Nakamura)

Pull request description:

  This PR intends to resolve #15227.

  ```configure --enable-debug```  enables ```#ifdef DEBUG_LOCKORDER```.

  Then ```lockdata``` (in sync.cpp) will be initialized same as other static objects.

  But unfortunately, ```lockdata.push_lock()``` was called before its initialization (via initializing ```signatureCache``` which is declared in ```script/sigcache.cpp```) on macOS.

  This PR apply the "Construct On First Use Idiom" to ```lockdata``` to prevent it.

  edited --- fix typo.

Tree-SHA512: 59df99ef78a335b1b7ebed7207d4719ea4412900eea38739f6e8eaaba1f594e1950044851659ce83f4f69813fc96978244bd176676e1aa2277c813ede832e6fb
2019-01-25 01:11:24 -05:00
Akio Nakamura b09dab0f2d Prevent mutex lock fail even if --enable-debug
This PR intends to resolve #15227.

"configure --debug-enabled" enables "#ifdef DEBUG_LOCKORDER".
Then "lockdata" (in sync.cpp) will be initialized same as other
static objects.

But unfortunately, lockdata.push_lock() was called before its
initialization (via initializing signatureCache which is declared
in script/sigcache.cpp) on macOS.

This PR apply the "Construct On First Use Idiom" to "lockdata"
to prevent it.
2019-01-25 13:21:59 +09:00
Ben Woosley 9431e1b915
Trivial: fixup a few doxygen comments
These were not declared properly, so their results are not properly
processed. E.g.:
https://dev.visucore.com/bitcoin/doxygen/rpcdump_8cpp.html#a994c8748aaa60fbb78009ff8a0638dea
https://dev.visucore.com/bitcoin/doxygen/coins_8cpp.html#aa03af24ef3570144b045f4fca7a0d603
https://dev.visucore.com/bitcoin/doxygen/wallet_2wallet_8cpp.html#a5c2a7725ff8796f03471f844ecded3d9
2019-01-24 19:47:07 -08:00
Ben Woosley d0522ec94e
Drop defunct Windows compat fixes
"The AI_ADDRCONFIG flag is defined on the Windows SDK for Windows Vista
and later. The AI_ADDRCONFIG flag is supported on Windows Vista and
later."
https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo

However, the version of MinGW we use on Travis is not current and does
not carry the relevant definition, as such I defined it in compat.
https://github.com/wine-mirror/wine/blob/master/include/ws2tcpip.h

Testing confirms that the PROTECTION_LEVEL_UNRESTRICTED,
IPV6_PROTECTION_LEVEL, PROCESS_DEP_ENABLE, AI_ADDRCONFIG, are now
supported by the version of Windows that we test against, so can be
removed.
https://travis-ci.org/bitcoin/bitcoin/jobs/483255439
https://travis-ci.org/Empact/bitcoin/jobs/484123087
2019-01-24 15:58:49 -08:00
Wladimir J. van der Laan 72bd4ab867
Merge #15193: Default -whitelistforcerelay to off
a36d97d866 Default -whitelistforcerelay to off (Suhas Daftuar)

Pull request description:

  No one seems to use this "feature", and at any rate the behavior of relaying transactions when they violate local policy is error-prone, if we ever consider changing the ban behavior of our software from one version to the next.

  Defaulting this to off means that users who use -whitelist won't be unexpectedly surprised by this interaction.  If anyone is still relying on this feature, it can still be explicitly turned on.

Tree-SHA512: 52650ad464a728d1648f496751e3f713077ea3a1de7278ed03531b2e8723e63cf2f6f41b56c98c0f73ffa22c36e01d9170b409ab452c737aca35b7ecd7a6b448
2019-01-24 15:25:17 +01:00
Andrew Chow 2bc4c3eaf9 Notify the GUI that the keypool has changed to set the receive button
Whenever the keypool changes (new keys generated, new seed set,
keypool runs out, etc.), notify the GUI that the keypool has changed. The
receive button can then be enabled and disabled as necessary.
2019-01-23 15:18:03 -05:00
Chun Kuan Lee d8a2992067 windows: Call SetProcessDEPPolicy directly 2019-01-23 21:37:44 +08:00
Chun Kuan Lee 1bd9ffdd44 windows: Set _WIN32_WINNT to 0x0601 (Windows 7)
Also remove all defines in many places and define it in configure stage to keep consistency.
2019-01-23 16:28:27 +08:00
Jonas Schnelli 82cf6813a4
Merge #14353: REST: add blockhash call, fetch blockhash by height
42ff30ec6 [Docs] add short documentation for /rest/blockhashbyheight (Jonas Schnelli)
579d418f7 [QA] add rest tests for /rest/blockhashbyheight/<HEIGHT>.<FORMAT> (Jonas Schnelli)
eb9ef04c4 REST: add "blockhashbyheight" call, fetch blockhash by height (Jonas Schnelli)

Pull request description:

  Completes the REST interface for trivial block exploring by adding a call that allows to fetch the blockhash in the main chain by a given height.

Tree-SHA512: 94be9e56718f857279b11cc16dfa8d04f3b5a762e87ae54281b4d87247c71c844895f4944d5a47f09056bf851f4c4761ac4fbdbaaee957265d14de5c1c73e8d2
2019-01-22 19:59:02 -10:00
Wladimir J. van der Laan 94167e2b5b
Merge #15208: Qt: remove macOS launch-at-startup when compiled with > macOS 10.11, fix memory missmanagement
da6011826a Fix macOS launch-at-startup memory issue (Jonas Schnelli)
516437a1b7 Qt: remove macOS launch-at-startup option when compiled with > macOS 10.11 (Jonas Schnelli)

Pull request description:

  The launch-at-startup API Bitcoin Core uses on macOS where removed in macOS 10.11 leading to a segmentation-fault due to the weak-linking when not actively compiled against SDK 10.11 (`-mmacosx-version-min=10.11`)

  This PR removes the launch-at-startup feature on macOS when compiled with macOS min version > 10.11 (the default is always the macOS version you compile on).

  **The depends built binaries (Gitian) are not affected since we are building with min macOS 10.10.**

  Users self compiling on macOS > 10.11 can re-enable the feature by compiling with min version <= 10.11 (`CXXFLAGS="-mmacosx-version-min=10.11" CFLAGS="-mmacosx-version-min=10.11" ./configure`)

  **Isn't there a new API from Apple?**
  Yes, [there is](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html).
  It will require to create a helper application which needs to be embedded in the .app folder (needs code signing as well). Developers willing to go down that rabbit hole are welcome.

  Fixes #15142

Tree-SHA512: fa9cc4e39d5a2d2559919b7e22b7766f5e0269a361719294d4a4a2df2fd9d955e5b23b5907e68023fdeee297f652f844f3c447904bf18f9c1145348ad101c432
2019-01-22 22:53:17 +01:00
Gregory Maxwell 0297be61ac Allow connections from misbehavior banned peers.
This allows incoming connections from peers which are only banned
 due to an automatic misbehavior ban if doing so won't fill inbound.

These peers are preferred for eviction when inbound fills, but may
 still be kept if they fall into the protected classes.  This
 eviction preference lasts the entire life of the connection even
 if the ban expires.

If they misbehave again they'll still get disconnected.

The main purpose of banning on misbehavior is to prevent our
 connections from being wasted on unhelpful peers such as ones
 running incompatible consensus rules.  For inbound peers this
 can be better accomplished with eviction preferences.

A secondary purpose was to reduce resource waste from repeated
 abuse but virtually any attacker can get a nearly unlimited
 supply of addresses, so disconnection is about the best we can
 do.
2019-01-22 21:10:48 +00:00
Suhas Daftuar a36d97d866 Default -whitelistforcerelay to off 2019-01-22 12:18:45 -05:00
Jonas Schnelli da6011826a
Fix macOS launch-at-startup memory issue 2019-01-21 22:43:03 -10:00
Jonas Schnelli 516437a1b7
Qt: remove macOS launch-at-startup option when compiled with > macOS 10.11 2019-01-21 22:42:51 -10:00
Andrew Chow 14bcdbe09c Check for more than private keys disabled to show receive button 2019-01-21 19:39:01 -05:00
Jonas Schnelli eb9ef04c4e
REST: add "blockhashbyheight" call, fetch blockhash by height 2019-01-21 11:54:54 -10:00
Wladimir J. van der Laan f0c9e1c22b
Merge #14906: refactor: Make explicit CMutableTransaction -> CTransaction conversion.
b301950df3  Made expicit constructor CTransaction(const CMutableTransaction &tx). (lucash-dev)
faf29dd019  Minimal changes to comply with explicit CMutableTransaction -> CTranaction conversion. (lucash-dev)

Pull request description:

  This PR is re-submission of #14156, which was automatically closed by github (glitch?)

  Original description:

  This PR makes explicit the now implicit conversion constructor `CTransaction(const CMutableTransaction&)` in `transaction.h`.
  Minimal changes were made elsewhere to make the code compilable. I'll follow up with other PRs to address individually refactoring functions that should have a `CMutableTransaction` version, or where a `CTransaction` should be reused.

  The rationale for this change is:

   - Conversion constructors should not be explicit unless there's a strong reason for it (in the opinion of, for example, https://google.github.io/styleguide/cppguide.html, and https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion. Let me know your take on this).
   - This particular conversion is very costly -- it implies a serialization plus hash of the transaction.
   - Even though `CTransaction` and `CMutableTransaction` represent the same data, they have very different use cases and performance properties.
   - Making it explicit allows for easier reasoning of performance trade-offs.
   - There has been previous performance issues caused by unneeded use of this implicit conversion.
   - This PR creates a map for places to look for possible refactoring and performance gains (this benefit still holds if the PR is not merged).

Tree-SHA512: 2427462e7211b5ffc7299dae17339d27f8c43266e0895690fda49a83c72751bd2489d4471b3993075a18f3fef25d741243e5010b2f49aeef4a9688b30b6d0631
2019-01-21 20:28:56 +01:00
Wladimir J. van der Laan 6e6b3b944d
Merge #14955: Switch all RNG code to the built-in PRNG
223de8d94d Document RNG design in random.h (Pieter Wuille)
f2e60ca985 Use secure allocator for RNG state (Pieter Wuille)
cddb31bb0a Encapsulate RNGState better (Pieter Wuille)
152146e782 DRY: Implement GetRand using FastRandomContext::randrange (Pieter Wuille)
a1f252eda8 Sprinkle some sweet noexcepts over the RNG code (Pieter Wuille)
4ea8e50837 Remove hwrand_initialized. (Pieter Wuille)
9d7032e4f0 Switch all RNG code to the built-in PRNG. (Pieter Wuille)
16e40a8b56 Integrate util/system's CInit into RNGState (Pieter Wuille)
2ccc3d3aa3 Abstract out seeding/extracting entropy into RNGState::MixExtract (Pieter Wuille)
aae8b9bf0f Add thread safety annotations to RNG state (Pieter Wuille)
d3f54d1c82 Rename some hardware RNG related functions (Pieter Wuille)
05fde14e3a Automatically initialize RNG on first use. (Pieter Wuille)
2d1cc50939 Don't log RandAddSeedPerfmon details (Pieter Wuille)
6a57ca91da Use FRC::randbytes instead of reading >32 bytes from RNG (Pieter Wuille)

Pull request description:

  This does not remove OpenSSL, but makes our own PRNG the 'main' one; for GetStrongRandBytes, the OpenSSL RNG is still used (indirectly, by feeding its output into our PRNG state).

  It includes a few policy changes (regarding what entropy is seeded when).

  Before this PR:
  * GetRand*:
    * OpenSSL
  * GetStrongRand*:
    * CPU cycle counter
    * Perfmon data (on Windows, once 10 min)
    * /dev/urandom (or equivalent)
    * rdrand (if available)
  * From scheduler when idle:
    * CPU cycle counter before and after 1ms sleep
  * At startup:
    * CPU cycle counter before and after 1ms sleep

  After this PR:
  * GetRand*:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter
  * GetStrongRand*:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter
    * /dev/urandom (or equivalent)
    * OpenSSL
    * CPU cycle counter again
  * From scheduler when idle:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter before and after 1ms sleep
    * Perfmon data (on Windows, once every 10 min)
  * At startup:
    * Stack pointer (which indirectly identifies thread and some call stack information)
    * rdrand (if available)
    * CPU cycle counter
    * /dev/urandom (or equivalent)
    * OpenSSL
    * CPU cycle counter again
    * Perfmon data (on Windows, once every 10 min)

  The interface of random.h is also simplified, and documentation is added.

  This implements most of #14623.

Tree-SHA512: 0120e19bd4ce80a509b5c180a4f29497d299ce8242e25755880851344b825bc2d64a222bc245e659562fb5463fb7c70fbfcf003616be4dc59d0ed6534f93dd20
2019-01-21 19:46:45 +01:00
Wladimir J. van der Laan ace87ea2b0
Merge #14970: [net] add dnsseed.emzy.de to DNS seeds
de7266fc3c [net] add dnsseed.emzy.de to DNS seeds (Stephan Oeste)

Pull request description:

  ACK https://github.com/bitcoin/bitcoin/blob/master/doc/dnsseed-policy.md

  I'm willing to keep it up and running, unless something bad happens.
  I have 15+ years experience running dns servers.

  About my setup:

  - the server may change over time, but the service will be up all the time
  - running [sipa/bitcoin-seeder](https://github.com/sipa/bitcoin-seeder) with default settings (and the non-root port redirect)

Tree-SHA512: 7abc975c148cc738d045c79d5bdb8d9926da41bb8dde66c21e954652b3c72a7aa2526af0c3c4fb8c234d3deaed5563542defe8a5137188d65ad7201b6b1d80eb
2019-01-21 19:16:45 +01:00
Wladimir J. van der Laan 5baa9092c4
Merge #14605: Return of the Banman
18185b57c3 scripted-diff: batch-recase BanMan variables (Carl Dong)
c2e04d37f3 banman: Add, use CBanEntry ctor that takes ban reason (Carl Dong)
1ffa4ce27d banman: reformulate nBanUtil calculation (Carl Dong)
daae598feb banman: add thread annotations and mark members const where possible (Cory Fields)
84fc3fbd03 scripted-diff: batch-rename BanMan members (Cory Fields)
af3503d903 net: move BanMan to its own files (Cory Fields)
d0469b2e93 banman: pass in default ban time as a parameter (Cory Fields)
2e56702ece banman: pass the banfile path in (Cory Fields)
4c0d961eb0 banman: create and split out banman (Cory Fields)
83c1ea2e5e net: split up addresses/ban dumps in preparation for moving them (Cory Fields)
136bd7926c tests: remove member connman/peerLogic in TestingSetup (Cory Fields)
7cc2b9f678 net: Break disconnecting out of Ban() (Cory Fields)

Pull request description:

  **Old English à la Beowulf**
  ```
  Banman wæs bréme    --blaéd wíde sprang--
  Connmanes eafera    Coreum in.
  aéglaéca            léodum forstandan
  Swá bealdode        bearn Connmanes
  guma gúðum cúð      gódum daédum·
  dréah æfter dóme·   nealles druncne slóg
  ```

  **Modern English Translation**
  ```
  Banman was famed              --his renown spread wide--
  Conman's hier,                in Core-land.
  against the evil creature     defend the people
  Thus he was bold,             the son of Connman
  man famed in war,             for good deeds;
  he led his life for glory,    never, having drunk, slew
  ```

  --

  With @theuni's blessing, here is Banman, rebased. Original PR: https://github.com/bitcoin/bitcoin/pull/11457

  --

  Followup PRs:
  1. Give `CNode` a `Disconnect` method ([source](https://github.com/bitcoin/bitcoin/pull/14605#discussion_r248065847))
  2. Add a comment to `std::atomic_bool fDisconnect` in `net.h` that setting this to true will cause the node to be disconnected the next time `DisconnectNodes()` runs ([source](https://github.com/bitcoin/bitcoin/pull/14605#discussion_r248384309))

Tree-SHA512: 9c207edbf577415c22c9811113e393322d936a843d4ff265186728152a67c057779ac4d4f27b895de9729f7a53e870f828b9ebc8bcdab757520c2aebe1e9be35
2019-01-21 18:58:52 +01:00
Wladimir J. van der Laan 0f1576ab32
Merge #15167: qt: Fix wallet selector size adjustment
ca91661adf Fix wallet selector size adjustment (Hennadii Stepanov)

Pull request description:

  This PR sets `QComboBox::AdjustToContents` instead of default `QComboBox::AdjustToContentsOnFirstShow` for wallet selectors.

  Before (in master):
  ![screenshot from 2019-01-14 20-47-22](https://user-images.githubusercontent.com/32963518/51133771-83d00d80-183e-11e9-812c-3a1119fa766e.png)

  After (with this PR):
  ![screenshot from 2019-01-14 20-48-43](https://user-images.githubusercontent.com/32963518/51133788-90546600-183e-11e9-8394-eb62a998b90f.png)

Tree-SHA512: c23ac91905bb31aaa32f2fccc02b01f5707d8b094020fe6a75a9e099e78f9191670474920234a01c46480f67d3d311f44ff46f1f4202cd50a4a6d4d09a8342ce
2019-01-21 17:40:33 +01:00
Wladimir J. van der Laan 6be52d6f7e
Merge #15213: doc: Remove errant paste from walletcreatefundedpsbt for nLocktime replaceable
85f0ca95f3 Remove errant past from walletcreatefundedpsbt for nLocktime replaceability (Gregory Sanders)

Pull request description:

  nLockTime has no bearing on bip125

Tree-SHA512: cb123242ee7e1eeff10dbfcab8e57f9aa88590e2da6794343a90a18472a97f23ce7c6bbc55b88163e007fe38c5d8ee5b749cc4ce2bf145f560e084d61b568159
2019-01-21 17:26:30 +01:00
Wladimir J. van der Laan 1522079d54
Merge #15209: zmq: log outbound message high water mark when reusing socket
f1dc6932e9 zmq: log outbound message high water mark when reusing socket (fanquake)

Pull request description:

  Running master with `src/bitcoind -zmqpubhashblockhwm=12345 -zmqpubrawtx=tcp://127.0.0.1:28332 -zmqpubhashtxhwm=5000 -zmqpubrawblock=tcp://127.0.0.1:28332 -zmqpubhashtx=tcp://127.0.0.1:28332 -zmqpubhashblock=tcp://127.0.0.1:28332 -debug=zmq`:
  ```
  2019-01-19T14:11:01Z zmq: version 4.3.1
  2019-01-19T14:11:01Z zmq: Initialize notification interface
  2019-01-19T14:11:01Z zmq: Outbound message high water mark for pubhashblock at tcp://127.0.0.1:28332 is 12345
  2019-01-19T14:11:01Z zmq: Notifier pubhashblock ready (address = tcp://127.0.0.1:28332)
  2019-01-19T14:11:01Z zmq: Reusing socket for address tcp://127.0.0.1:28332
  2019-01-19T14:11:01Z zmq: Notifier pubhashtx ready (address = tcp://127.0.0.1:28332)
  2019-01-19T14:11:01Z zmq: Reusing socket for address tcp://127.0.0.1:28332
  2019-01-19T14:11:01Z zmq: Notifier pubrawblock ready (address = tcp://127.0.0.1:28332)
  2019-01-19T14:11:01Z zmq: Reusing socket for address tcp://127.0.0.1:28332
  2019-01-19T14:11:01Z zmq: Notifier pubrawtx ready (address = tcp://127.0.0.1:28332)
  ```

  This PR:
  ```
  2019-01-19T14:06:57Z zmq: version 4.3.1
  2019-01-19T14:06:57Z zmq: Initialize notification interface
  2019-01-19T14:06:57Z zmq: Outbound message high water mark for pubhashblock at tcp://127.0.0.1:28332 is 12345
  2019-01-19T14:06:57Z zmq: Notifier pubhashblock ready (address = tcp://127.0.0.1:28332)
  2019-01-19T14:06:57Z zmq: Reusing socket for address tcp://127.0.0.1:28332
  2019-01-19T14:06:57Z zmq: Outbound message high water mark for pubhashtx at tcp://127.0.0.1:28332 is 5000
  2019-01-19T14:06:57Z zmq: Notifier pubhashtx ready (address = tcp://127.0.0.1:28332)
  2019-01-19T14:06:57Z zmq: Reusing socket for address tcp://127.0.0.1:28332
  2019-01-19T14:06:57Z zmq: Outbound message high water mark for pubrawblock at tcp://127.0.0.1:28332 is 1000
  2019-01-19T14:06:57Z zmq: Notifier pubrawblock ready (address = tcp://127.0.0.1:28332)
  2019-01-19T14:06:57Z zmq: Reusing socket for address tcp://127.0.0.1:28332
  2019-01-19T14:06:57Z zmq: Outbound message high water mark for pubrawtx at tcp://127.0.0.1:28332 is 1000
  2019-01-19T14:06:57Z zmq: Notifier pubrawtx ready (address = tcp://127.0.0.1:28332)
  ```

Tree-SHA512: 6915184d8a0f4764f1cc76dce0099eed411a123d7a4bc8cee1664bb5a233a8119ddd2c78ad980c6e1d9f6dadaba48800ee6bc57de906d4e1b4108df745f1458e
2019-01-21 17:20:32 +01:00
Wladimir J. van der Laan 7455ca2ae6
Merge #15210: gui: Fix window title update
1ed425ea17 gui: Fix window title update (João Barbosa)

Pull request description:

  Removes trailing `-` from window title when running on mainnet.

  Reported by @Sjors in https://github.com/bitcoin/bitcoin/pull/15149#issuecomment-455787938.

Tree-SHA512: 22f13c361496720f30a4926d928851ed74456c0d70bd313b0ebaca91a9ebfde96991091ac3d1b094f33d3ce9afafd709eb1917f00d96fa3ca69751b6b14e1d2b
2019-01-21 16:49:27 +01:00
Wladimir J. van der Laan 978682b9dc
Merge #15194: Add comment describing fDisconnect behavior
5b4283cb81 Add comment describing fDisconnect behavior (Carl Dong)

Pull request description:

  Motivated by @Sjors here: https://github.com/bitcoin/bitcoin/pull/14605#discussion_r248384309

Tree-SHA512: 8fc52eb4d3b5651c19c49b47fad75e8fb939cf524ada647e88d8d5aad7726052d94e500c1ebdb2a41b67bc4669ee61ff151a5cff81a52c68c900da562ef21751
2019-01-20 16:11:41 +01:00
Gregory Sanders 85f0ca95f3 Remove errant past from walletcreatefundedpsbt for nLocktime replaceability 2019-01-19 22:32:59 -05:00
João Barbosa 1ed425ea17 gui: Fix window title update 2019-01-19 21:17:51 +00:00
practicalswift eea02be70e Add locking annotation for vNodes. vNodes is guarded by cs_vNodes. 2019-01-19 18:23:53 +01:00
fanquake f1dc6932e9
zmq: log outbound message high water mark when reusing socket 2019-01-19 22:06:14 +08:00
Wladimir J. van der Laan fe60ee96e9
Merge #15186: rpc: remove duplicate solvable field from getaddressinfo
a2a6c8f453 rpc: remove duplicate solvable field from getaddressinfo (fanquake)

Pull request description:

  Also added optional to `iscompressed`.

Tree-SHA512: 28442a9dbfb2a9992b9b57142fa13d374d39444f04ae63460cb6330d896160cfd4b9651a3e231893eac3142ce55eff597a54cbafd3b57ffa46d3711c64044acb
2019-01-19 14:52:33 +01:00
Wladimir J. van der Laan 3b59fa2ce8
Merge #15178: qt: Improve "help-console" message
979bc0c206 Improve "help-console" message (Hennadii Stepanov)

Pull request description:

  Added a note that results can be queried in the parenthesized syntax as it does not work in the standard syntax.

  Deprecated (since #8704) boolean `verbose` replaced with numerical `verbosity` in `getblock` examples.

  Current master (acec9e45c6):
  ![screenshot from 2019-01-16 13-40-10](https://user-images.githubusercontent.com/32963518/51248127-d96bfd80-1997-11e9-83d3-47cf157e2f8d.png)

  Master + this PR:
  ![screenshot from 2019-01-16 14-00-39](https://user-images.githubusercontent.com/32963518/51248137-e852b000-1997-11e9-94dc-e9c949690beb.png)

Tree-SHA512: 663e359ed117306f789fdefcae298194fdd6f5477c87912740e1683323974a333dcca13f17bb2c0aa66639ab7658bd53e535ae8fe671ea5fc557a3db4b192908
2019-01-19 14:50:31 +01:00
Jonas Schnelli 63144335be
Merge #15101: gui: Add WalletController
0dd9bdefa gui: Refactor to use WalletController (João Barbosa)
8fa271f08 gui: Add WalletController (João Barbosa)
cefb399e2 gui: Use AutoConnection for WalletModel::unload signal (João Barbosa)

Pull request description:

  This PR is a subset of the work done in the context of #13100. This change consists in extracting from the application class the code that manages the wallet models.

  The role of the `WalletController` instance is to coordinate wallet operations and the window.

Tree-SHA512: 6a824054376730eb7d16c643dd2003f5f60778e8ad3af707b82bc12c48438db179ca4446316b28fb17b206f4b9aba8998419aab8c5dd1f7c32467015732b5094
2019-01-18 10:21:08 -10:00
fanquake a2a6c8f453
rpc: remove duplicate solvable field from getaddressinfo 2019-01-18 13:59:11 +08:00
João Barbosa 0dd9bdefa1 gui: Refactor to use WalletController 2019-01-18 00:34:51 +00:00
João Barbosa 8fa271f089 gui: Add WalletController 2019-01-18 00:34:47 +00:00
João Barbosa cefb399e21 gui: Use AutoConnection for WalletModel::unload signal 2019-01-18 00:27:34 +00:00
Carl Dong 5b4283cb81 Add comment describing fDisconnect behavior 2019-01-17 18:27:13 -05:00
Jonas Schnelli cd42553b11
Merge #15040: qt: Add workaround for QProgressDialog bug on macOS
7c572c488 Add workaround for QProgressDialog bug on macOS (Hennadii Stepanov)

Pull request description:

  Fix #15016.

  Refs:
  - [QTBUG-65750: QProgressDialog too small width at larger font size on Mac](https://bugreports.qt.io/browse/QTBUG-65750)
  - [QTBUG-70357: QProgressDialog is too narrow to fit the text of its label](https://bugreports.qt.io/browse/QTBUG-70357)

  With this PR:
  ![screenshot from 2018-12-26 22-01-30](https://user-images.githubusercontent.com/32963518/50456571-1aa35b80-095e-11e9-8442-c285555f2bee.png)

Tree-SHA512: dde668dfa7d2144973c0e868aea7fdb7d90f78584836d024ffefb8df4a709d6842fa3601954759b4462856a80e81df15b861ea39506599230a16928b621d9f8f
2019-01-17 11:17:06 -10:00
Wladimir J. van der Laan 7ee604487f
Merge #14250: qt: Remove redundant stopThread() and stopExecutor() signals
24313fbf7e Remove redundant stopExecutor() signal (Hennadii Stepanov)
1c0e0a5e38 Remove redundant stopThread() signal (Hennadii Stepanov)

Pull request description:

  The `QThread::finished` signal do this work.

Tree-SHA512: 1afce23d30232276d50c3af5af79d83b88e390a2b71f7df585cc1079585d330447d179bbc34c0a89599beb2da035dfd5b9ce23238171490825cabc3a19ae6e67
2019-01-17 14:40:26 +01:00
Pieter Wuille 223de8d94d Document RNG design in random.h 2019-01-16 16:35:54 -08:00
Pieter Wuille f2e60ca985 Use secure allocator for RNG state 2019-01-16 16:34:57 -08:00
Pieter Wuille cddb31bb0a Encapsulate RNGState better 2019-01-16 16:34:57 -08:00
Pieter Wuille 152146e782 DRY: Implement GetRand using FastRandomContext::randrange 2019-01-16 16:34:57 -08:00
Pieter Wuille a1f252eda8 Sprinkle some sweet noexcepts over the RNG code 2019-01-16 16:34:56 -08:00
Pieter Wuille 4ea8e50837 Remove hwrand_initialized.
All access to hwrand is now gated by GetRNGState, which initializes the hwrand code.
2019-01-16 16:34:56 -08:00
Pieter Wuille 9d7032e4f0 Switch all RNG code to the built-in PRNG.
It includes the following policy changes:
* All GetRand* functions seed the stack pointer and rdrand result
  (in addition to the performance counter)
* The periodic entropy added by the idle scheduler now seeds stack pointer,
  rdrand and perfmon data (once every 10 minutes) in addition to
  just a sleep timing.
* The entropy added when calling GetStrongRandBytes no longer includes
  the once-per-10-minutes perfmon data on windows (it is moved to the
  idle scheduler instead, where latency matters less).

Other changes:
* OpenSSL is no longer seeded directly anywhere. Instead, any generated
  randomness through our own RNG is fed back to OpenSSL (after an
  additional hashing step to prevent leaking our RNG state).
* Seeding that was previously done directly in RandAddSeedSleep is now
  moved to SeedSleep(), which is indirectly invoked through ProcRand
  from RandAddSeedSleep.
* Seeding that was previously done directly in GetStrongRandBytes()
  is now moved to SeedSlow(), which is indirectly invoked through
  ProcRand from GetStrongRandBytes().
2019-01-16 16:34:56 -08:00
Pieter Wuille 16e40a8b56 Integrate util/system's CInit into RNGState
This guarantees that OpenSSL is initialized properly whenever randomness
is used, even when that randomness is invoked from global constructors.

Note that this patch uses Mutex directly, rather than CCriticalSection.
This is because the lock-detection code is not necessarily initialized
during global constructors.
2019-01-16 16:33:08 -08:00
Pieter Wuille 2ccc3d3aa3 Abstract out seeding/extracting entropy into RNGState::MixExtract 2019-01-16 16:31:37 -08:00
Pieter Wuille aae8b9bf0f Add thread safety annotations to RNG state 2019-01-16 16:31:34 -08:00
Pieter Wuille d3f54d1c82 Rename some hardware RNG related functions 2019-01-16 15:46:31 -08:00
Pieter Wuille 05fde14e3a Automatically initialize RNG on first use. 2019-01-16 15:46:27 -08:00
Pieter Wuille 2d1cc50939 Don't log RandAddSeedPerfmon details
These are hard to deal with, as in a follow-up this function can get
called before the logging infrastructure is initialized.
2019-01-16 15:08:03 -08:00
Carl Dong 18185b57c3 scripted-diff: batch-recase BanMan variables
-BEGIN VERIFY SCRIPT-
sed -i "s/banMap/banmap/g" src/banman.h src/banman.cpp
sed -i "s/netAddr/net_addr/g" src/banman.h src/banman.cpp
sed -i "s/sinceUnixEpoch/since_unix_epoch/g" src/banman.h src/banman.cpp
sed -i "s/bantimeoffset/ban_time_offset/g" src/banman.h src/banman.cpp
sed -i "s/subNet/sub_net/g" src/banman.h src/banman.cpp
sed -i "s/banReason/ban_reason/g" src/banman.h src/banman.cpp
sed -i "s/notifyUI/notify_ui/g" src/banman.h src/banman.cpp
sed -i "s/banEntry/ban_entry/g" src/banman.h src/banman.cpp
sed -i "s/nStart/n_start/g" src/banman.h src/banman.cpp
-END VERIFY SCRIPT-
2019-01-16 13:54:18 -05:00
Carl Dong c2e04d37f3 banman: Add, use CBanEntry ctor that takes ban reason 2019-01-16 13:54:18 -05:00
Carl Dong 1ffa4ce27d banman: reformulate nBanUtil calculation
Avoid reassigning parameters.
2019-01-16 13:54:18 -05:00
Cory Fields daae598feb banman: add thread annotations and mark members const where possible
Also remove misleading comment. ClearBanned is used by rpc as well.
2019-01-16 13:54:18 -05:00
Cory Fields 84fc3fbd03 scripted-diff: batch-rename BanMan members
-BEGIN VERIFY SCRIPT-
sed -i "s/clientInterface/m_client_interface/g" src/banman.h src/banman.cpp
sed -i "s/setBannedIsDirty/m_is_dirty/g" src/banman.h src/banman.cpp
sed -i "s/cs_setBanned/m_cs_banned/g" src/banman.h src/banman.cpp
sed -i "s/setBanned/m_banned/g" src/banman.h src/banman.cpp
-END VERIFY SCRIPT-
2019-01-16 13:54:18 -05:00
Cory Fields af3503d903 net: move BanMan to its own files 2019-01-16 13:54:18 -05:00
Cory Fields d0469b2e93 banman: pass in default ban time as a parameter
Removes the dependency on arg parsing.
2019-01-16 13:54:18 -05:00
Cory Fields 2e56702ece banman: pass the banfile path in
There's no need to hard-code the path here. Passing it in means that there are
no ordering concerns wrt establishing the datadir.
2019-01-16 13:54:18 -05:00
Cory Fields 4c0d961eb0 banman: create and split out banman
Some say he has always been.
2019-01-16 13:54:18 -05:00
Cory Fields 83c1ea2e5e net: split up addresses/ban dumps in preparation for moving them 2019-01-16 13:54:18 -05:00
Wladimir J. van der Laan fcb6694a99
Merge #14839: [rebase] threads: fix unitialized members in sched_param
89282379ba threads: fix unitialized members in sched_param (Cory Fields)

Pull request description:

  Rebased theuni's #14342.

  Building with gcc 8.2 against musl libc, which apparently has more attributes available in its sched_param. The following warnings were produced:

      warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
      warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

  Since the current thread may have interesting non-zero values for these fields, we want to be sure to only change the intended one. Query and modify the current sched_param rather than starting from a zeroed one.

Tree-SHA512: a0bedbcf0130b3ee8261bb704e4bf6c9b760ad377c8a28c258765d54e54462b76707efc188b936b0a635cdd2bdf6b3b9298ab06ba361dc4806150b670d9702a3
2019-01-16 17:09:12 +01:00
Cory Fields 136bd7926c tests: remove member connman/peerLogic in TestingSetup 2019-01-16 11:04:14 -05:00
Cory Fields 7cc2b9f678 net: Break disconnecting out of Ban()
These are separate events which need to be carried out by separate subsystems.

This also cleans up some whitespace and tabs in qt to avoid getting flagged by
the linter.

Current behavior is preserved.
2019-01-16 11:04:05 -05:00
Wladimir J. van der Laan f71c2ea662
Merge #15122: [RPC] Expand help text for importmulti changes
b745e149c2 [docs] Expand help text for importmulti changes (John Newbery)

Pull request description:

  Expands the RPC help text for changes to the importmulti RPC method.

Tree-SHA512: e90e5abf66bba3863e7519b5f79c26d18a4d624e6e7878293bdd4ebb57f1a01c67de52e4a5621901a8cb87fb3516264b3b1a826997c7c3c17b11216f1f1a3db0
2019-01-16 16:15:17 +01:00
Wladimir J. van der Laan d44b01f028
Merge #14268: Introduce SafeDbt to handle Dbt with free or memory_cleanse raii-style
4a86a0acd9 Make SafeDbt DB_DBT_MALLOC on default initialization (Ben Woosley)
1a9f9f7e5e Introduce SafeDbt to handle DB_DBT_MALLOC raii-style (Ben Woosley)
951a44e9cd Drop unused setRange arg to BerkeleyBatch::ReadAtCursor (Ben Woosley)

Pull request description:

  This provides additional exception-safety and case handling for the proper
  freeing of the associated buffers.

Tree-SHA512: a038d728290cdb3905e7d881608052a6675b6425729ceaf7cfe69a6e91c2ee293cdb01e4b695a20963459ffdd9d4a1f9a08b3c07b1b5ba1aa8590a8149f686db
2019-01-16 14:56:21 +01:00
Wladimir J. van der Laan 19c60ca497
Merge #14151: windows: Fix remaining compiler warnings (MSVC)
b9dafe7d9f Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. (practicalswift)

Pull request description:

  Fix remaining compiler warnings (MSVC).

  Before:

  ```
  $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo
  …\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch
  …\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size
  …\boost\test\tools\old\impl.hpp(107): warning C4805: '==': unsafe mix of type 'const Left' and type 'const Right' in operation
  …\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
  …\test\script_tests.cpp(188): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation
  …\test\script_tests.cpp(190): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation
  …\test\script_tests.cpp(191): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation
  $
  ```

  After:

  ```
  $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715;C4805 /nologo
  $
  ```

Tree-SHA512: 5b30334d3804e869779e77dad75a799e8e5e7eb2e08634cd40035cce140edd623cbb6c8b5806d2158c3df97888d3ea9ff4b8b6a5a83de3fe2cb361e29588c115
2019-01-16 13:50:37 +01:00
Wladimir J. van der Laan 64ee94356f
Merge #14409: utils and libraries: Make 'blocksdir' always net specific
e4a0c3547e Improve blocksdir functional test. (Hennadii Stepanov)
c3f1821ac7 Make blockdir always net specific (Hennadii Stepanov)

Pull request description:

  The blocks directory is net specific by definition.

  Also this prevents the side effect of calling `GetBlocksDir(false)` in the non-mainnet environment.
  Currently a new node creates an unused `blocks\` directory in the root of the data directory when `-testnet` or `-regtest` is specified.

  Refs:
  - #12653
  - https://github.com/bitcoin/bitcoin/pull/12653#discussion_r174784834 by @laanwj
  - https://github.com/bitcoin/bitcoin/issues/14595#issuecomment-436011186

Tree-SHA512: c9957a68a4a200ebd2010823a56db7e61563afedcb7c9828e86b13f3af2990e07854b622c1f3374756f94574acb3ea32de7d2a399eef6c0623f0e11265155627
2019-01-16 13:40:27 +01:00
Hennadii Stepanov 979bc0c206
Improve "help-console" message
Added a note that results can be queried in the parenthesized syntax.
Deprecated boolean `verbose` replaced with numerical `verbosity` in
`getblock` examples.
2019-01-16 13:50:06 +02:00
Wladimir J. van der Laan acec9e45c6
Merge #15136: qt: "Peers" tab overhaul
3537c8345c Do not deselect peer when switching away from tab (Hennadii Stepanov)
b0037c5190 Improve Peers tab layout (Hennadii Stepanov)

Pull request description:

  This is an alternative to #14798.

  The "Peers" tab of the "Debug" window improved to address comments https://github.com/bitcoin/bitcoin/pull/6209#issuecomment-108072605 (by @jonasschnelli) and https://github.com/bitcoin/bitcoin/pull/14798#issuecomment-441618268 (by @promag).

  This allows to keep the peer selection while navigating to other places and effectively reverts e059726811.

  Screenshots with this PR:
  ![screenshot from 2019-01-09 22-01-36](https://user-images.githubusercontent.com/32963518/50927352-2e6fb700-1460-11e9-9173-582348210492.png)
  ![screenshot from 2019-01-09 22-02-11](https://user-images.githubusercontent.com/32963518/50927354-329bd480-1460-11e9-9926-d0eb0f026a35.png)
  ![screenshot from 2019-01-09 22-02-37](https://user-images.githubusercontent.com/32963518/50927358-3596c500-1460-11e9-864d-c8704451f3d9.png)

Tree-SHA512: 3d086007f6d72930bc2fc3c395175adda0f1a7722de3842bc246ee4f3bfc5ebda4b9a626fb68a7ee8663a88d0842deb37c0c460ad84cc58e22f138acf8bc71ea
2019-01-16 12:38:27 +01:00
John Newbery b745e149c2 [docs] Expand help text for importmulti changes 2019-01-15 17:24:46 -05:00
practicalswift b9dafe7d9f Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. 2019-01-15 20:15:26 +01:00
Jonas Schnelli c7c84209bb
Merge #15149: gui: Show current wallet name in window title
fe7048b39 gui: Show current wallet name in window title (João Barbosa)
8a7926112 gui: Keep network style in BitcoinGUI (João Barbosa)
f411c8b35 gui: Remove unused return type in some BitcoinGUI methods (João Barbosa)

Pull request description:

  <img width="876" alt="screenshot 2019-01-11 at 23 58 26" src="https://user-images.githubusercontent.com/3534524/51065458-d7ebaf80-15fc-11e9-9162-e37e9a10d448.png">

Tree-SHA512: 5c43f615834983bc1c5045e07c6e119044dd78ca947fd2679d302b519d5ce1d08d29ca00b1c11e88c4bbc4d56f2e6f4a8adc42084f3503e751e642e8a13112dc
2019-01-15 09:01:53 -10:00
MarcoFalke 82ffd4d918
Merge #14963: mempool, validation: Explain cs_main locking semantics
fa5e373365 validation: Add cs_main locking annotations (MarcoFalke)
fa5c346c5a doc: Add comment to cs_main and mempool::cs (MarcoFalke)
fafe941bdd test: Add missing validation locks (MarcoFalke)
fac4558462 sync: Add RecursiveMutex type alias (MarcoFalke)

Pull request description:

  Both the chain state and the transaction pool are validation specific, but access to them is protected by two locks. The two locks have the following semantics:

  * Writing to the chain state or adding transactions to the transaction pool -> Take both `cs_main` and `mempool::cs`
  * Reading either or removing transactions from the the transaction pool -> Take only the appropriate lock

Tree-SHA512: 6f6e612ffc391904c6434a79a4f3f8de1b928bf0a3e3434b73561037b395e2b40a70a5a4bd8472dd230e9eacc8e5d5374c904a3c509910cf3971dd7ff59a626c
2019-01-15 13:42:05 -05:00
Russell Yanofsky 44de1561aa Remove remaining chainActive references from CWallet
This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky db21f02648 Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis
Only change in behavior is "Rescan started from block <height>" message
replaced by "Rescan started from block <hash>" message in
ScanForWalletTransactions.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky 2ffb07929e Add findFork and findBlock to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code

This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky d93c4c1d6e Add time methods to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code

This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 08:42:00 -08:00
Russell Yanofsky 700c42b85d Add height, depth, and hash methods to the Chain interface
And use them to remove uses of chainActive and mapBlockIndex in wallet code

This commit does not change behavior.

Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
2019-01-15 12:42:00 -04:00
Wladimir J. van der Laan e8ad580f51
Merge #14556: qt: fix confirmed transaction labeled "open" (#13299)
fb3ce75807 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix #13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: #1026).

  This PR makes the wallet mark a transaction "Unconfirmed" instead of misleading "Open for NNN more blocks" when syncing after a period of being offline.

  Before this PR (with the issue):
  ![screenshot from 2018-12-12 15-56-23](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
2019-01-15 17:39:19 +01:00
João Barbosa fe7048b39b gui: Show current wallet name in window title 2019-01-15 16:23:55 +00:00
João Barbosa 8a79261124 gui: Keep network style in BitcoinGUI 2019-01-15 16:23:55 +00:00
João Barbosa f411c8b35b gui: Remove unused return type in some BitcoinGUI methods 2019-01-15 14:31:22 +00:00
Wladimir J. van der Laan a5daf70ffb
Merge #14594: qt: Fix minimized window bug on Linux
a88640e123 Fix minimized window bug on Linux (Hennadii Stepanov)

Pull request description:

  Fix #14591

  On some Linux systems the minimized to the taskbar (iconified) main window cannot be restored properly using actions from the systray icon menu when `QSystemTrayIcon::contextMenu()` is a child of the main window.

Tree-SHA512: 05c9f724fc2278d45dac6fe72b09859f12b5d71f54659bb779403c8cd81b55e610fb7b5aa912ac273d3cd19bf953b0405bbc6451feb00d1827c95dd9f0876aa4
2019-01-15 15:27:10 +01:00
Wladimir J. van der Laan 1b6fc30530
Merge #14941: rpc: Make unloadwallet wait for complete wallet unload
645e905c32 doc: Add release notes for unloadwallet change to synchronous call (João Barbosa)
c37851de57 rpc: Make unloadwallet wait for complete wallet unload (João Barbosa)

Pull request description:

  Currently the `unloadwallet` RPC is asynchronous, it only signals the intent to unload the wallet and then returns the response to the client. The actual unload can happen later and the client has no way to be notified of that.

  This PR makes the `unloadwallet` RPC synchronous, meaning that it blocks until the wallet is fully unloaded.

  Replaces #14919, fixes #14917.

Tree-SHA512: ad88b980e2f3652809a58f904afbfe020299f3aa6a517f495ba943b8d54d4520f6e70074d6749be8f5967065c0f476e0faedcde64c8b4899e5f99c70f0fd6534
2019-01-15 14:38:23 +01:00
João Barbosa c37851de57 rpc: Make unloadwallet wait for complete wallet unload 2019-01-15 00:01:00 +00:00
Hennadii Stepanov 7c572c488d
Add workaround for QProgressDialog bug on macOS
See: QTBUG-65750, QTBUG-70357.
2019-01-15 01:28:00 +02:00
Hennadii Stepanov ca91661adf
Fix wallet selector size adjustment 2019-01-14 20:49:19 +02:00
Wladimir J. van der Laan cf0c67b62c
Merge #14982: rpc: Add getrpcinfo command
a0ac15459a doc: Add getrpcinfo release notes (João Barbosa)
251a91c1bf qa: Add tests for getrpcinfo (João Barbosa)
d0730f5ce4 rpc: Add getrpcinfo command (João Barbosa)
068a8fc05f rpc: Track active commands (João Barbosa)
bf4383277d rpc: Remove unused PreCommand signal (João Barbosa)

Pull request description:

  The new `getrpcinfo` command exposes details of the RPC interface. The details can be configuration properties or runtime values/stats.

  This can be particular useful to coordinate concurrent functional tests (see #14958 from where this was extracted).

Tree-SHA512: 7292cb6087f4c429973d991aa2b53ffa1327d5a213df7d6ba5fc69b01b2e1a411f6d1609fed9234896293317dab05f65064da48b8f2b4a998eba532591d31882
2019-01-14 18:07:15 +01:00
Wladimir J. van der Laan 76335298f4
Merge #15114: Qt: Replace remaining 0 with nullptr
3a0e76fc12 Replace remaining 0 with nullptr in Qt code (Ben Woosley)
9096276e0b Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant) (practicalswift)

Pull request description:

  This corrects all violations of `-Wzero-as-null-pointer-constant` identified in the Qt codebase.

  These changes are extracted from #15112 as suggested by @MarcoFalke to ease review. This is in service of enabling `-Wzero-as-null-pointer-constant`, which should eliminate this as a concern going forward.

  Note there are 2 non-Qt changes: `src/test/allocator_tests.cpp` and `src/wallet/db.cpp`.

Tree-SHA512: 206bd668802147ba42bc413c2d7d259cb59aca9ec1da74a6bf2ca3932e60ae492faacbc61bcee0fd6b4b49a4d59d075b7e5404f0526b36c47718f9b0587e7768
2019-01-14 15:21:32 +01:00
Wladimir J. van der Laan 070eaf7fe5
Merge #15144: [refactor] CNode: Use C++11 default member initializers
fac2f5ecae Use C++11 default member initializers (MarcoFalke)

Pull request description:

  The second and last change on this topic (c.f. #15109). Split up because the diff would otherwise interleave, making review harder than necessary.

  This is not a stylistic change, but a change that avoids bugs such as:

  *  fix uninitialized read when stringifying an addrLocal #14728
  *  qt: Initialize members in WalletModel #12426
  *  net: correctly initialize nMinPingUsecTime #6636
  * ...

Tree-SHA512: 547ae72b87aeaed5890eb5fdcff612bfc93354632b238d89e1e1c0487187f39609bcdc537ef21345e0aea8cfcf1ea48da432d672c5386dd87cf58742446a86b1
2019-01-14 14:48:51 +01:00
Wladimir J. van der Laan 43a79d22c1
Merge #15138: Drop IsLimited in favor of IsReachable
d6b076c17b Drop IsLimited in favor of IsReachable (Ben Woosley)

Pull request description:

  These two methods have had the same meaning, but inverted, since
  110b62f069. Having one name for a single
  concept simplifies the code.

  This is a follow-up to #15051.
  /cc #7553

Tree-SHA512: 347ceb9e2a55ea06f4c01226411c7bbcade09dd82130e4c59d0824ecefd960875938022edbe5d4bfdf12b0552c9b4cb78b09a688284d707119571daf4eb371b4
2019-01-14 14:30:51 +01:00
Ben Woosley d6b076c17b
Drop IsLimited in favor of IsReachable
These two methods have had the same meaning, but inverted, since
110b62f069. Having one name for a single
concept simplifies the code.
2019-01-13 22:50:36 -08:00
Pieter Wuille 6a57ca91da Use FRC::randbytes instead of reading >32 bytes from RNG
There was only one place in the codebase where we're directly reading >32 bytes from
the RNG. One possibility would be to make the built-in RNG support large reads, but
using FastRandomContext lets us reuse code better.

There is no change in behavior here, because the FastRandomContext constructor
uses GetRandBytes internally.
2019-01-13 09:53:47 -08:00
Ben Woosley 3a0e76fc12
Replace remaining 0 with nullptr in Qt code
Also used type-appropriate enum values such as Qt::NoItemFlags in
some cases.

All cases identified via -Wzero-as-null-pointer-constant
2019-01-13 03:25:14 -08:00
practicalswift 9096276e0b
Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant)
Qt-only changes.
2019-01-13 03:25:14 -08:00
Jonas Schnelli 84d0fdce11
Merge #13216: [Qt] implements concept for different disk sizes on intro
9d0e52834 implements different disk sizes for different networks on intro (marcoagner)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/13213.
  Mostly, I layed out the concept to open the PR for refinement and getting feedback if the approach is okay. Changes are expected.

  Two points:
  - The values for both new consts `TESTNET_BLOCK_CHAIN_SIZE` and `TESTNET_CHAIN_STATE_SIZE` is certainly not optimal; I just checked the size of my testnet3 related dirs and set them to little bit higher values. Which values should be used?
  - Should we do something like this to regtest? Or these "niceties" do not matter when on regtest?

  Thanks!

Tree-SHA512: 8ae87a29fa8356b899e7a823c76cde793d9126b4ee59554d7a2a8edb088fe42a19976b34c06c2fd4a98a727e1e4971dd983f42b6093ea6caa255b45004e22bb4
2019-01-11 14:33:24 -10:00
MarcoFalke fac2f5ecae
Use C++11 default member initializers 2019-01-10 14:55:45 -05:00
MarcoFalke 68dddccdaa
Merge #15139: util: Remove [U](BEGIN|END) macros
332b3dd7c1 util: Make ToLower and ToUpper take a char (Wladimir J. van der Laan)
edb5bb3500 util: remove unused [U](BEGIN|END) macros (Wladimir J. van der Laan)
7fa238c701 Replace use of BEGIN and END macros on uint256 (Wladimir J. van der Laan)

Pull request description:

  Two cleanups in `util/strencodings.h`:

  - Remove `[U](BEGIN|END)` macros — The only use of these was in the Merkle tree code with `uint256` which has its own `begin` and `end` methods which are better.
  - Make ToLower and ToUpper take a char — Unfortunately, `std::string` elements are (bare) chars. As these are the most likely type to be passed to these functions, make them use char instead of unsigned char. This avoids some casts.

Tree-SHA512: 96c8292e1b588d3d7fde95c2e98ad4e7eb75e7baab40a8e8e8209d4e8e7a1bd3b6846601d20976be34a9daabefc50cbc23f3b04200af17d0dfc857c4ec42aca7
2019-01-10 12:09:25 -05:00
Wladimir J. van der Laan cebe910718
Merge #15039: wallet: Avoid leaking nLockTime fingerprint when anti-fee-sniping
fa48baf23e wallet: Avoid leaking locktime fingerprint when anti-fee-sniping (MarcoFalke)
453803adc9 [test] wallet_txn_clone: Correctly clone txin sequence (MarcoFalke)

Pull request description:

  The wallet sets the locktime to the current height of our active chain. This is fine, as long as our node is connected to other nodes. However, when we fall back and get stuck at a particular height (e.g. taking the wallet offline), the same (potentially unique) locktime is used for all transactions. This makes it easier for passive observers to cluster transactions by wallet.

  For reference, I visualized "locktime-reuse" with the data:
  * blocks 545k-555k (both inclusive)
  * locktimes<=60k
  * excluding coinbase txs

  ![distribution of height-based tx locktimes used at least twice](https://user-images.githubusercontent.com/6399679/50446163-b8256d80-0913-11e9-9832-40b76052b2b9.png)

Tree-SHA512: 2af259dd8f9f863312e2732d80ca8ba6a20c8d6d1c486b10a48479e1c85ccf13b0c38723740ebadde0f28d321cd9c133ad3e5d1e925472eb27681143bda2d0e7
2019-01-10 15:56:54 +01:00
Wladimir J. van der Laan 332b3dd7c1 util: Make ToLower and ToUpper take a char
Unfortunately, `std::string` elements are (bare) chars. As these
are the most likely type to be passed to these functions, make them use
char instead of unsigned char. This avoids some casts.
2019-01-10 02:51:14 +01:00
Wladimir J. van der Laan edb5bb3500 util: remove unused [U](BEGIN|END) macros 2019-01-10 01:58:33 +01:00
Wladimir J. van der Laan 7fa238c701 Replace use of BEGIN and END macros on uint256
Replace use of `BEGIN` and `END` macros on uint256 with `begin()` and
`end()` methods in the Merkle tree code.
2019-01-10 01:58:33 +01:00
Hennadii Stepanov 24313fbf7e
Remove redundant stopExecutor() signal 2019-01-10 01:21:25 +02:00
Hennadii Stepanov 1c0e0a5e38
Remove redundant stopThread() signal 2019-01-10 01:21:18 +02:00
Hennadii Stepanov 3537c8345c
Do not deselect peer when switching away from tab
Effectevely reverts e059726811 commit.
2019-01-09 22:30:25 +02:00
Hennadii Stepanov b0037c5190
Improve Peers tab layout
Using the QSplitter and QScrollArea classes.
2019-01-09 22:26:20 +02:00
Wladimir J. van der Laan 0ed279cb4e
Merge #14517: qt: Fix start with the -min option
93009618b6 Fix start with the `-min` option (Hennadii Stepanov)

Pull request description:

  From IRC:

  > 2018-10-17T12:36:38  \<Drakon\> The option to minimize to system tray instead of the taskbar ist available, but doesn't have an effect if it is started with the -min option. If I start it via that option, I have to click on the program symbil on the taskbar and then minimize it again in order to get it minimized to system tray.
  > 2018-10-17T12:37:28  \<Drakon\> That's annoying.
  > 2018-10-17T13:51:19  \<wumpus\> can you open an issue for that please? https://github.com/bitcoin/bitcoin/issues/new
  > 2018-10-17T13:53:24  \<wumpus\> (if there isn't one yet-)

  This PR fixes this bug.

Tree-SHA512: c5a5521287b49b13859edc7c6bd1cd07cac14b84740450181dce00bf2781fc3dfc84476794baa16b0e26a2d004164617afdb61f829e629569703c5bcc45e2a4e
2019-01-09 19:44:43 +01:00
Wladimir J. van der Laan 62f3977f60
Merge #14599: Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...)
8931a95bec Include util/strencodings.h which is required for IsSpace(...) (practicalswift)
7c9f790761 Update KNOWN_VIOLATIONS: Remove fixed violations (practicalswift)
587924f000 Use IsSpace(...) instead of boost::is_space (practicalswift)
c5fd143edb Use ToLower(...) instead of std::tolower (practicalswift)
e70cc8983c Use IsDigit(...) instead of std::isdigit (practicalswift)

Pull request description:

  * Use `ToLower(...)` instead of `std::tolower`. `std::tolower` is locale dependent.
  * Use `IsDigit(...)` instead of `std::isdigit`. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than `[0-9]` as digits.
  * Update `KNOWN_VIOLATIONS`: Remove fixed violations.
  * ~~Replace use of locale dependent Boost trim (`boost::trim`) with locale independent `TrimString`.~~
  * Use` IsSpace(...)` instead of `boost::is_space`

Tree-SHA512: defed016136b530b723fa185afdbd00410925a748856ba3afa4cee60f61a67617e30f304f2b9991a67b5fe075d9624f051e14342aee176f45fbc024d59e1aa82
2019-01-09 18:17:17 +01:00
Wladimir J. van der Laan 854ca855ab
Merge #15051: Tests: IsReachable is the inverse of IsLimited (DRY). Includes unit tests
6dc4593db1 IsReachable is the inverse of IsLimited (DRY). Includes unit tests (marcaiaf)

Pull request description:

  IsReachable is the inverse of IsLimited, but the implementation is duplicated (DRY)

  - Changed the implementation accordingly.
  - Added unit tests to document behavior and relationship
  - My modification in net.cpp  applies only to IsReachable.
  - Applied clang-format-diffpy

  Created new pull request to avoid the mess with:
  https://github.com/bitcoin/bitcoin/pull/15044

  Checked with supposedly conflicting PRs mentioned in the old PR. No conflicts with the specific changes in this PR.

Tree-SHA512: b132dec6cc2c788ebe4f63f228d78f441614e156743b17adebc990de0180a5872874d2724c86eeaa470b4521918bd137b0e33ebcaae77c5efc1f0d56104f6c87
2019-01-09 17:12:54 +01:00
Wladimir J. van der Laan 699d0bd9fe
Merge #15117: Fix invalid memory write in case of failing mmap(...) in PosixLockedPageAllocator::AllocateLocked
ca126d490b Fix out-of-bounds write in case of failing mmap(...) in PosixLockedPageAllocator::AllocateLocked (practicalswift)

Pull request description:

  `mmap(...)` returns `MAP_FAILED` (`(void *) -1`) in case of allocation failure.

  `PosixLockedPageAllocator::AllocateLocked(...)` did not check for allocation failures prior to this PR.

  Instead the invalid memory address `(void *) -1` (`0xffffffffffffffff`) was passed to the caller as if it was a valid address.

  After some operations the address is wrapped around from `0xffffffffffffffff` to `0x00000003ffdf` (`0xffffffffffffffff + 262112 == 0x00000003ffdf`);

  The resulting address `0x00000003ffdf` is then written to.

  Before this patch (with failing `mmap` call):

  ```
  $ src/bitcoind
  …
  2019-01-06T16:28:14Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
  2019-01-06T16:28:14Z Using RdRand as an additional entropy source
  Segmentation fault (core dumped)
  ```

  Before this patch (under `valgrind` with failing `mmap` call):

  ```
  $ valgrind src/bitcoind
  …
  2019-01-06T16:28:51Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
  ==17812== Invalid write of size 1
  ==17812==    at 0x500B7E: void __gnu_cxx::new_allocator<unsigned char>::construct<unsigned char>(unsigned char*) (new_allocator.h:136)
  ==17812==    by 0x500B52: _ZNSt16allocator_traitsI16secure_allocatorIhEE12_S_constructIhJEEENSt9enable_ifIXsr6__and_INS2_18__construct_helperIT_JDpT0_EE4typeEEE5valueEvE4typeERS1_PS6_DpOS7_ (alloc_traits.h:243)
  ==17812==    by 0x500B22: _ZNSt16allocator_traitsI16secure_allocatorIhEE9constructIhJEEEDTcl12_S_constructfp_fp0_spclsr3stdE7forwardIT0_Efp1_EEERS1_PT_DpOS4_ (alloc_traits.h:344)
  ==17812==    by 0x500982: unsigned char* std::__uninitialized_default_n_a<unsigned char*, unsigned long, secure_allocator<unsigned char> >(unsigned char*, unsigned long, secure_allocator<unsigned char>&) (stl_uninitialized.h:631)
  ==17812==    by 0x60BFC2: std::vector<unsigned char, secure_allocator<unsigned char> >::_M_default_initialize(unsigned long) (stl_vector.h:1347)
  ==17812==    by 0x60BD86: std::vector<unsigned char, secure_allocator<unsigned char> >::vector(unsigned long, secure_allocator<unsigned char> const&) (stl_vector.h:285)
  ==17812==    by 0x60BB55: ECC_Start() (key.cpp:351)
  ==17812==    by 0x16AC90: AppInitSanityChecks() (init.cpp:1162)
  ==17812==    by 0x15BAC9: AppInit(int, char**) (bitcoind.cpp:138)
  ==17812==    by 0x15B6C8: main (bitcoind.cpp:201)
  ==17812==  Address 0x3ffdf is not stack'd, malloc'd or (recently) free'd
  …
  Segmentation fault (core dumped)
  ```

  After this patch (with failing `mmap` call):

  ```
  $ src/bitcoind
  …
  2019-01-06T15:50:18Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
  2019-01-06T15:50:18Z Using RdRand as an additional entropy source
  2019-01-06T15:50:18Z

  ************************
  EXCEPTION: St9bad_alloc
  std::bad_alloc
  bitcoin in AppInit()

  ************************
  EXCEPTION: St9bad_alloc
  std::bad_alloc
  bitcoin in AppInit()

  2019-01-06T15:50:18Z Shutdown: In progress...
  2019-01-06T15:50:18Z Shutdown: done
  ```

  To simulate the failing `mmap` call apply the following to `master`:

  ```diff
  diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp
  index 8d577cf52..ce79e569b 100644
  --- a/src/support/lockedpool.cpp
  +++ b/src/support/lockedpool.cpp
  @@ -247,7 +247,8 @@ void *PosixLockedPageAllocator::AllocateLocked(size_t len, bool *lockingSuccess)
   {
       void *addr;
       len = align_up(len, page_size);
  -    addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
  +    // addr = mmap(nullptr, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
  +    addr = MAP_FAILED;
       if (addr) {
           *lockingSuccess = mlock(addr, len) == 0;
       }
  ```

Tree-SHA512: 66947f5fc0fbb19afb3e1edbd51df07df9d16b77018cff3d48d30f378a53d6a0dc62bc36622b3966b7e374e61edbcca114ef4ac8ae8d725022c1a597edcbf7c7
2019-01-09 15:58:13 +01:00
Wladimir J. van der Laan 195d28fecb
Merge #15124: Fail AppInitMain if either disk space check fails
ba8c8b2227 Fail if either disk space check fails (Ben Woosley)

Pull request description:

  Rather than both.

  Introduced in 386a6b62a8, #12653

Tree-SHA512: 24765dd3c62b742c491d7d9a751917c2ce6f3819a8764a7725ce84910ef69bffca07f4c0dfbeed8c4f978a12c4b04a2ac3b8c2ff59602330a8a3e8a68878c41b
2019-01-09 15:31:51 +01:00
Wladimir J. van der Laan ff7f7364d6
Merge #15087: Error if rpcpassword contains hash in conf sections
8cff83124b Error if rpcpassword contains hash in conf sections (MeshCollider)

Pull request description:

  Fixes #15075

Tree-SHA512: 08ba2a2e9a7ea228fc0e0ff9aa76da1fecbe079e3b388304a28b6399e338a4b3a38b03ab03aca880e75f14a8d2ba75ceb31a385d7989cd66db5193a79f32c4e5
2019-01-09 15:08:26 +01:00
Wladimir J. van der Laan 3f12515199
Merge #15109: refactor: Use C++11 default member initializers
fa2510d5c1 Use C++11 default member initializers (MarcoFalke)

Pull request description:

  Changes:
  * Remove unused constructors that leave some members uninitialized
  * Remove manual initialization in each constructor and prefer C++11 default member initializers

  This is not a stylistic change, but a change that avoids bugs such as:

  *  fix uninitialized read when stringifying an addrLocal #14728
  *  qt: Initialize members in WalletModel #12426
  *  net: correctly initialize nMinPingUsecTime #6636
  * ...

Tree-SHA512: 0f896f3b9fcc464d5fc7525f7c86343ef9ce9fb13425fbc68e9a9728fd8710c2b4e2fd039ee08279ea41ff20fd92b7185cf5cca95a0bcb6a5340a1e6f03cae6b
2019-01-09 15:04:36 +01:00
Wladimir J. van der Laan e12a480e40
Merge #14085: index: Fix for indexers skipping genesis block.
ed12d5df1b index: Fix for indexers skipping genesis block. (Jim Posen)

Pull request description:

  This fixes a bug where indexers would skip processing of the genesis block. Preserves the current behavior of omitting genesis block transaction from the index.

Tree-SHA512: 092fd3d629bf1ef279566217c668cc913a8b8e012d811d0e544231894c49a0c0c179537ac4727c39b9bf407479541745d79c4e118db6f0795a2b848d0fe62cbf
2019-01-09 14:48:11 +01:00
MarcoFalke fdbe7f41c0
Merge #11625: Add BitcoinApplication & RPCConsole tests
7e4bd19785 Add BitcoinApplication & RPCConsole tests (Russell Yanofsky)
ca20b65cc0 Move BitcoinApplication to header so it can be tested (Russell Yanofsky)

Pull request description:

  Add test coverage for Qt initialization code & basic RPC console functionality

  Motivation for this change was a bug in #11603 which existing tests failed to catch.

Tree-SHA512: f66546ffc84b8e07679c66a73b265023fbf6a0cb8f24f1606a5fcae2dd3b4dc7b2c6d26c69dedcec53398a26ef17c4d5fb28c055698fa6e45e89aa2995cefe2f
2019-01-09 14:40:38 +01:00
Ben Woosley ba8c8b2227
Fail if either disk space check fails
Rather than both.

Introduced in 386a6b62a8
2019-01-09 02:26:59 -08:00
MeshCollider 8cff83124b Error if rpcpassword contains hash in conf sections 2019-01-09 17:32:35 +13:00
Wladimir J. van der Laan c6806ee869
Merge #15059: test: Add basic test for BIP34
fab17e8272 test: Add basic test for BIP34 (MarcoFalke)

Pull request description:

  BIP34 was disabled for testing, which explains why it had no test.

  Fix that by enabling it and adding a test.

Tree-SHA512: 9cb5702d474117ce6420226eb93ee09d6fb5fc856fabc8b67abe56a088cd727674e0e5462000e1afa83b911374036f90abdbdde56a8c236a75572ed47e10a00f
2019-01-08 15:53:39 +01:00
Wladimir J. van der Laan 29a9f07743
Merge #12153: Avoid permanent cs_main lock in getblockheader
f12e1d0b51 rpc: Avoid permanent cs_main lock in getblockheader (João Barbosa)

Pull request description:

  This PR reduces the `cs_main` lock scope in `getblockheader` RPC.

Tree-SHA512: bc51f80e15d1b32d3c7886836457f9929706b6aad9841dafce31ffca444281471b21b56192bb50de774184b9377412f815ad8d3d2439049a7e64d2e59c415767
2019-01-08 13:53:35 +01:00
Wladimir J. van der Laan 1973257da0
Merge #15057: [rpc] Correct reconsiderblock help text, add test
fa38d3df69 [rpc] Correct reconsiderblock help text, add test (MarcoFalke)

Pull request description:

  Rework documentation and test to match the implementation

Tree-SHA512: d0adef6b054a341bcc1cb87783a4e4cf9be124ba6812e1ac88246a5e01b2861a8071b12dba880b2b428c37da3fa860bfec3fe3e5fbb7c28696872113faa84a9f
2019-01-07 15:56:11 +01:00
Wladimir J. van der Laan fcc618d508
Merge #15078: rpc: Document bytessent_per_msg and bytesrecv_per_msg
fab3f14678 rpc: Document bytessent_per_msg and bytesrecv_per_msg (MarcoFalke)

Pull request description:

Tree-SHA512: 11af7502933b3dae203d90e36b35019e0ebe67ee09aa77360a27547487bd2b6bcaa18c5f60bc21966291d2ccf44dfedebf40103c4db70a359400f535a66abb23
2019-01-07 15:42:35 +01:00
MarcoFalke 295a1ad522
Merge #15102: test: Run invalid_txs.InputMissing test in feature_block
fac4e731a8 test: Run invalid_txs.InputMissing test in feature_block (MarcoFalke)

Pull request description:

Tree-SHA512: 24c3f519ba0cf417b66e0df6f5ddc0430e3f419af4705a9c85096da47ff4d8f51487d65b68f3f993800003b3f936d95d8a0bade846e1b45f95b2bdbecc9ebab7
2019-01-07 12:59:17 +01:00
practicalswift ca126d490b Fix out-of-bounds write in case of failing mmap(...) in PosixLockedPageAllocator::AllocateLocked 2019-01-06 17:45:53 +01:00
Wladimir J. van der Laan 9c71998771
Merge #14784: qt: Use WalletModel* instead of the wallet name as map key
91b0c5b096 qt: Use WalletModel* instead of wallet name in console window (João Barbosa)
b2ce86c3ad qt: Use WalletModel* instead of wallet name in main window (João Barbosa)
d2a1adffeb qt: Factor out WalletModel::getDisplayName() (João Barbosa)

Pull request description:

  This a small refactor that doesn't change behavior. This is also necessary if in the future we allow renaming wallets.

Tree-SHA512: 1820d0ff28e84b1d862097f1f55b52f94520fa50c9b1939d235a448a48159748c3bbf99b19e4cb1ff4f91efc008c0971b4c25a91f645f9d43792c8aeaa93cf9e
2019-01-05 16:20:01 +01:00
MarcoFalke fa2510d5c1
Use C++11 default member initializers 2019-01-05 16:16:37 +01:00
MarcoFalke 88bbcdc4e9
Merge #14357: streams: Fix broken streams_vector_reader test. Remove unused seek(size_t).
4f4993fe2a Remove UBSan suppression (practicalswift)
958e1a307e streams: Remove unused seek(size_t) (practicalswift)

Pull request description:

  Fix broken `streams_vector_reader` test. Remove unused `seek(size_t)`.

  Before this change the test `streams_vector_reader` triggered an unintended unsigned integer wraparound. It tried so seek using a negative value in `reader.seek(-6)`.

  Changes in this PR:
  * Fix broken `VectorReader::seek(size_t)` test case
  * Remove unused `seek(size_t)`

Tree-SHA512: 6c6affd680626363eef9e496748f2f86a522325abab9d6b13161f41125cdc29ceb36c2c1509c90b8ff108d606df7629e55e094cc2b6253b05a892b81ce176b71
2019-01-05 15:06:43 +01:00
MarcoFalke fac4e731a8
test: Run invalid_txs.InputMissing test in feature_block 2019-01-05 14:51:25 +01:00
MarcoFalke fe5a70b9fe
Merge #15099: tests: Use std::vector API for construction of test data
6b25f29a91 Use std::vector API for construction of test data. (Daniel Kraft)

Pull request description:

  For constructing test scripts, use `std::vector` and, in particular, `std::vector::insert` to insert 20 zero bytes rather than listing the full array of bytes explicitly.  This makes the code easier to read and makes it immediately obvious what the structure of the data is, without having to count the zeros to understand it.

  Of course, that is a matter of taste - so if you disagree that the change makes the code easier to read, let me know.

  This has been split out of #14752.

Tree-SHA512: af82d447f0077259049f1da2d6f86a6c29723c6e17bd342e9a9ecf37b13bddff40643af95c8b3a3260765a5591713d31ca8a45a5a0c20a12c139aee53ea150da
2019-01-05 00:53:13 +01:00
Jonas Schnelli e8db6b8044
Qt: Fix update headers-count 2019-01-04 08:52:27 -10:00
Jonas Schnelli 7bb45e4b7a
Qt: update header count regardless of update delay 2019-01-04 08:52:22 -10:00
Hennadii Stepanov a88640e123
Fix minimized window bug on Linux
On some Linux systems the minimized to the taskbar (iconified) main
window cannot be restored properly using actions from the systray icon
menu when QSystemTrayIcon::contextMenu() is a child of the main window.
2019-01-04 20:01:20 +02:00
João Barbosa 91b0c5b096 qt: Use WalletModel* instead of wallet name in console window 2019-01-04 15:24:00 +00:00
João Barbosa b2ce86c3ad qt: Use WalletModel* instead of wallet name in main window 2019-01-04 15:22:13 +00:00
João Barbosa d2a1adffeb qt: Factor out WalletModel::getDisplayName() 2019-01-04 15:22:13 +00:00
João Barbosa f12e1d0b51 rpc: Avoid permanent cs_main lock in getblockheader 2019-01-04 14:58:48 +00:00
Russell Yanofsky 7e4bd19785 Add BitcoinApplication & RPCConsole tests
Add test coverage for Qt initialization code & basic RPC console functionality.
2019-01-04 06:31:07 -05:00
MarcoFalke f7e182a973
Merge #12151: rpc: Remove cs_main lock from blockToJSON and blockheaderToJSON
b9f226b41f rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSON (João Barbosa)
343b98cbcd rpc: Specify chain tip instead of chain in GetDifficulty (João Barbosa)
54dc13b6a2 rpc: Fix SoftForkMajorityDesc and SoftForkDesc signatures (João Barbosa)

Pull request description:

  Motivated by https://github.com/bitcoin/bitcoin/pull/11913#discussion_r157798157, this pull makes `blockToJSON` and `blockheaderToJSON` free of `cs_main` locks.

  Locking `cs_main` was required to access `chainActive` in order to check if the block was in the chain and to retrieve the next block index.

  With the this approach, `CBlockIndex::GetAncestor()` is used in a way to check if the block belongs to the specified chain tip and, at the same time, get the next block index.

Tree-SHA512: a6720ace0182c19033bbed1a404f729d793574db8ab16e0966ffe412145611e32c30aaab02975d225df6d439d7b9ef2070e732b16137a902b0293c8cddfeb85f
2019-01-04 12:31:07 +01:00
Russell Yanofsky ca20b65cc0 Move BitcoinApplication to header so it can be tested
Move-only commit, no code changes
2019-01-04 07:31:07 -04:00
MarcoFalke 5b6b371c77
Merge #14855: test: Correct ineffectual WithOrVersion from transactions_tests
75778a0724 test: Correct ineffectual WithOrVersion from transactions_tests (Ben Woosley)

Pull request description:

  `WithOrVersion` uses `|` to combine the versions, and `|` with 0 is a no-op.

  NicolasDorier / sipa do you recall why the version is being overridden here?

  Introduced in ab48c5e721
  Last updated 81e3228fcb

Tree-SHA512: 2aea925497bab2da973f17752410a6759d67181a57c3b12a685d184fbfcca2984c45b702ab0bd641d75e086696a0424f1bf77c5578ca765d6882dc03b42d5f9a
2019-01-04 12:20:35 +01:00
MarcoFalke 9c64278e1a
Merge #13910: Log progress while verifying blocks at level 4
e58985c916 Log progress while verifying blocks at level 4. (Daniel Kraft)

Pull request description:

  When verifying blocks at startup, the progress is printed in 10% increments to logs.  When `-checklevel=4`, however, the second half of the verification (connecting the blocks again) does not log the progress anymore.  (It is still computed and shown in the UI, but not printed to logs.)

  This change makes the behaviour consistent, by adding the missing progress logging also for level-4 checks.

Tree-SHA512: 6a4c5914726fc1a1337de0c5130b20d4edf4e2feeb0aa0449d2ce422b2d8c41e56ede94163a02044d9a28ac4dc6624b1ad611da93ce5792ff32ad9fb1f0ea1e0
2019-01-04 11:58:52 +01:00
Wladimir J. van der Laan f51aeac5ad
Merge #15007: qt: Notificator class refactoring
698d0f882a Remove misplaced Q_UNUSED and others enhancements (Hennadii Stepanov)

Pull request description:

  This PR:
  - removes misplaced `Q_UNUSED(cls)`; `cls` is actually used:
  eb7daf4d60/src/qt/notificator.cpp (L188)

  - removes unused parameters in functions `notifySystray()` and `notifyMacUserNotificationCenter()`

  - improves comments

Tree-SHA512: 78c0713f2a968b471dae422e9a5a0959018923e0d24ed595921001a9895ffb6ceb0311c63e4264fdff470b021a8b8df0f6972c630a051dafed06281880acc261
2019-01-04 10:31:27 +01:00
Wladimir J. van der Laan d3dc6d8794
Merge #15085: gui: Fix incorrect application name when passing -regtest
cc341adbbb gui: Fix for Incorrect application name when passing -regtest (Ben Carman)

Pull request description:

  Changes the application name to `Bitcoin-Qt-regtest` when instead of `Bitcoin-Qt-testnet`

  Fixes #15079

Tree-SHA512: 42ce3bea0bc3ff358708b9715f8d07c3a93e11fc4fe1a1425996ac70fd06ec8e5b186c5bbb254a7a189678ccbef3109174ca1f72c2c40c360927ec5da7315d8d
2019-01-04 10:25:53 +01:00
Daniel Kraft 6b25f29a91 Use std::vector API for construction of test data.
For constructing test scripts, use std::vector and, in particular,
std::vector::insert to insert 20 zero bytes rather than listing the full
array of bytes explicitly.  This makes the code easier to read and makes
it immediately obvious what the structure of the data is, without having
to count the zeros to understand it.
2019-01-04 08:11:44 +01:00
Ben Woosley 75778a0724
test: Correct ineffectual WithOrVersion from transactions_tests
WithOrVersion uses | to combine the versions, and | with 0 is a no-op.

Instead I run it with PROTOCOL_VERSION and 0 separately, as the original
code only tested PROTOCOL_VERSION but apparently only intended to test
version 0.

Introduced in ab48c5e721
Last updated 81e3228fcb
2019-01-03 09:10:27 -08:00
Wladimir J. van der Laan d1effa11ad
Merge #14375: qt: Correct misleading "overridden options" label
7514361254 Correct misleading "overridden options" label (Hennadii Stepanov)

Pull request description:

  Refs: #3867, #8165.

Tree-SHA512: da3b13a0560654053aeff22a15031ae59a3136abc941f3959440c2d250add7de7ca837c96d721eed69b2cac21d340e1895a186f69383ab82a41fc1e0ee789e5c
2019-01-03 16:33:16 +01:00
MarcoFalke fab3f14678
rpc: Document bytessent_per_msg and bytesrecv_per_msg 2019-01-03 15:49:24 +01:00
Ben Carman cc341adbbb gui: Fix for Incorrect application name when passing -regtest 2019-01-03 01:04:26 -06:00
Hennadii Stepanov fb3ce75807
Don't label transactions "Open" while catching up
Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled,
the checking `wtx.is_final` is meaningless until the syncing has
completed.
2019-01-03 00:10:24 +02:00
MarcoFalke fb52d0684e
Merge #15000: qt: Fix broken notificator on GNOME
c8d9d9093b Fix broken notificator on GNOME (Hennadii Stepanov)

Pull request description:

  Fix #14994; that bug was introduced in #14228 (that was my fault).

  ~Also this commit explicit separates~ There are two functions of the tray icon:
   - a system tray widget (`QSystemTrayIcon::isSystemTrayAvailable() == true`)
   - a high-level notificator via balloon messages (`QSystemTrayIcon::supportsMessages() == true`)

  ~These properties are mutually independent,~ e.g., on Fedora 29 + GNOME:
  ```
  QSystemTrayIcon::isSystemTrayAvailable() == false;
  QSystemTrayIcon::supportsMessages() == true;
  ```

  UPDATE:

  `supportsMessages()` makes no sense without `isSystemTrayAvailable()`: `QSystemTrayIcon::showMessage()` just not working on Fedora 29 + GNOME.

Tree-SHA512: 3e75ed2dfcef112bd64b8c329227ae68ba57f3be55769629f4eb3b1c52ef1f33db635f00bb5fd57c25f73a692971d6a847ea14c525f41c594fddde6e970a8ad8
2019-01-02 17:16:53 +01:00
João Barbosa d0730f5ce4 rpc: Add getrpcinfo command 2019-01-02 12:47:32 +00:00
João Barbosa 068a8fc05f rpc: Track active commands 2019-01-02 12:34:58 +00:00
Wladimir J. van der Laan 62cf608e93
Merge #14336: net: implement poll
4927bf2f25 Increase maxconnections limit when using poll. (Patrick Strateman)
11cc491a28 Implement poll() on systems which support it properly. (Patrick Strateman)
28211a4bc9 Move SocketEvents logic to private method. (Patrick Strateman)
7e403c0ae7 Move GenerateSelectSet logic to private method. (Patrick Strateman)
1e6afd0dbc Introduce and use constant SELECT_TIMEOUT_MILLISECONDS. (Patrick Strateman)

Pull request description:

  Implement poll() on systems which support it properly.

  This eliminates the restriction on maximum socket descriptor number.

Tree-SHA512: b945cd9294afdafcce96d547f67679d5cdd684cf257904a239cd1248de3b5e093b8d6d28d8d1b7cc923dc0b2b5723faef9bc9bf118a9ce1bdcf357c2323f5573
2019-01-02 13:14:45 +01:00
MarcoFalke fa38d3df69
[rpc] Correct reconsiderblock help text, add test 2019-01-01 18:02:12 +01:00
MarcoFalke e756eca9e8
Merge #15054: Update copyright headers to 2018
1a49a0e310 Bump manpages (DrahtBot)
06ba77973e Update copyright headers to 2018 (DrahtBot)

Pull request description:

  * `./contrib/devtools/copyright_header.py update ./`
  * `./contrib/devtools/gen-manpages.sh`

Tree-SHA512: ca0dc5e97f4c33814d4ccd17769bbf2d23a99a71d62534fe1064fedfe47de3b5c30caf9b6deb0d70bf125e08c7ae6335ac4fcded918049d6b63b13b319d798e3
2018-12-31 12:24:27 +01:00
MarcoFalke fab17e8272
test: Add basic test for BIP34 2018-12-29 19:39:37 +01:00
MarcoFalke cbb91cd0ec
Merge #13743: refactor: Replace boost::bind with std::bind
cb53b825c2 scripted-diff: Replace boost::bind with std::bind (Chun Kuan Lee)
2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform (Chun Kuan Lee)

Pull request description:

  Replace boost::bind with std::bind

  - In `src/rpc/server.cpp`, replace `std::transform` with simple loop.
  - In `src/validation.cpp`, store the `boost::signals2::connection` object and use it to disconnect.
  - In `src/validationinterface.cpp`, use 2 map to store the `boost::signals2::scoped_connection` object.

Tree-SHA512: 6653cbe00036fecfc495340618efcba6d7be0227c752b37b81a27184433330f817e8de9257774e9b35828026cb55f11ee7f17d6c388aebe22c4a3df13b5092f0
2018-12-29 14:14:26 +01:00
DrahtBot 06ba77973e Update copyright headers to 2018 2018-12-29 10:15:01 +01:00
MarcoFalke 3c9b98bd6e
Merge #14966: docs: fix testmempoolaccept CLI syntax
b74a52192b fix testmempoolaccept CLI syntax (1Il1)

Pull request description:

  `testmempoolaccept "hexstring"` will give a "JSON parse error". The correct syntax is `testmempoolaccept \[\"hexstring\"\]` (but seems escaping is not displayed in other areas so leaving backspaces out).

Tree-SHA512: ad755147d6db0bd3f2d8481517dab29df755a32b28a3bdb4553b1fddd1940850450d1e9a6c3bd04e4e3faa7bc09aadfd3412b4cd65e61d61ea34452831597967
2018-12-29 09:58:14 +01:00
marcaiaf 6dc4593db1 IsReachable is the inverse of IsLimited (DRY). Includes unit tests 2018-12-28 16:20:30 +01:00
MarcoFalke ea0b1990d1
Merge #14981: rpc: Clarifying RPC getrawtransaction's time help text
84104c781a clarifying getrawtransaction[time] get help text (Ben Carman)

Pull request description:

  #12339

  The `time` and `blocktime` entries have the same value so they should have the same help text as well

Tree-SHA512: 1e9a94678eec8501c761f16bf3d8e269d68620596d1fdd31a32989a1b53be5a8097ece8bfabe99979e658dec82237e37d8194ae2acd7c1deef7501ee701667fb
2018-12-28 12:19:26 +01:00
MarcoFalke fa48baf23e
wallet: Avoid leaking locktime fingerprint when anti-fee-sniping 2018-12-27 13:03:10 +01:00
MeshCollider f8a3ab3b29
Merge #14565: Overhaul importmulti logic
eacff95de Add release notes (Pieter Wuille)
bdacbda25 Overhaul importmulti logic (Pieter Wuille)

Pull request description:

  This is an alternative to #14558 (it will warn when fields are being ignored). In addition:
  * It makes sure no changes to the wallet are made when an error in the input exists.
  * It validates all arguments, and will fail if anything fails to parse.
  * Adds a whole bunch of sanity checks

Tree-SHA512: fdee0b6aca8c643663f0bc295a7c1d69c1960951493b06abf32c58977f3e565f75918dbd0402dde36e508dc746c9310a968a0ebbacccc385a57ac2a68b49c1d0
2018-12-24 23:26:17 +13:00
MarcoFalke e2dfeb0146
Merge #13930: doc: Better explain GetAncestor check for m_failed_blocks in AcceptBlockHeader
66e15e8f97 Explain GetAncestor check for m_failed_blocks in AcceptBlockHeader (Sjors Provoost)

Pull request description:

  Salvaged (but slightly modified) from #12138, the comment there was really helpful to wrap my head around that part of the code.

  In addition, a naive reader like yours truly will first think `IsValid(BLOCK_VALID_SCRIPTS)` means the previous block was invalid. But IIUC that's not what  it means. Instead, it means the block hasn't been checked for validity at the `BLOCK_VALID_SCRIPTS` level yet. So in that case the existing text "previous block index isn't valid" is wrong.

Tree-SHA512: 442a319a83290d94697fdf51376463b70454e0f3909d4a45594ddc2e7c26cd19dc703808385a25e26d6d2dddab0aa35ca41722f2e65ee6fe57bbaf62652d3ec8
2018-12-22 21:40:07 +01:00
MarcoFalke 1ac7d599f9
Merge #13128: policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator
dae1423e5a Add locking annotations to feeStats, shortStats and longStats (practicalswift)
764e42fee2 scripted-diff: Rename from cs_feeEstimator to m_cs_fee_estimator (practicalswift)
9a789d4dc6 policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator (practicalswift)

Pull request description:

  * Add Clang thread safety annotations for variables guarded by `cs_feeEstimator`
  * ~~Add missing `cs_feeEstimator` locks~~

Tree-SHA512: 24b1d876ad53524ee8989b9658ac1a1b2766ebb3b27a1f84601d207e74d090e33738b814afac2a1f5bcd37565abcb361c6e5adae212840ff1ca32c3c42953391
2018-12-22 17:11:47 +01:00
MarcoFalke fa5e373365
validation: Add cs_main locking annotations 2018-12-22 15:23:03 +01:00
MarcoFalke a4564b9b07
Merge #14172: Refactor and add tests for BlockFilter construction
e4ed8ce2c8 blockfilter: Remove default clause in switch statement. (Jim Posen)
c30620983d blockfilter: Additional constructors for BlockFilter. (Jim Posen)
20b812993a blockfilter: Refactor GCS params into struct. (Jim Posen)

Pull request description:

  These commits have been split out of #14121 because they are fairly independent and that PR is very large.

Tree-SHA512: b9643b159e114df50a295f433e807afe6082db55a2a3a17401c1509b850c71bf5011ab3638863b46663709726be4445be6fde1dec514aec7696135497a9f0183
2018-12-22 14:16:38 +01:00
Jim Posen e4ed8ce2c8 blockfilter: Remove default clause in switch statement.
Now the compiler will warn if not all enums are handled in the
switch.
2018-12-21 23:53:29 -06:00
MarcoFalke feda41e0a7
Merge #14811: Mining: Enforce that segwit option must be set in GBT
d2ce315fbf [docs] add release note for change to GBT (John Newbery)
0025c9eae4 [mining] segwit option must be set in GBT (John Newbery)

Pull request description:

  Calling getblocktemplate without the segwit rule specified is most
  likely a client error, since it results in lower fees for the miner.
  Prevent this client error by failing getblocktemplate if called without
  the segwit rule specified.

  Of the previous 1000 blocks (measured at block [551591 (hash 0x...173c811)](https://blockstream.info/block/000000000000000000173c811e79858808abc3216af607035973f002bef60a7a)), 991 included segwit transactions.

Tree-SHA512: 7933b073d72683c9ab9318db46a085ec19a56a14937945c73f783ac7656887619a86b74db0bdfcb8121df44f63a1d6a6fb19e98505b2a26a6a8a6e768e442fee
2018-12-21 13:46:06 +01:00
MarcoFalke 86e0a33f5c
Merge #14653: rpcwallet: Add missing transaction categories to rpc helptexts
f3f6dde56e Test coinbase category in wallet rpcs (andrewtoth)
e982f0b682 Add all category options to wallet rpc help (andrewtoth)

Pull request description:

  The current helptext for `listtransactions`, `listsinceblock` and `gettransaction` only list two of the five possible options for `category`. This incorrectly implies that these are the only two options, and can cause problems if the other three options aren't accounted for. Also, some of the documentation is incorrect when specifying which options are returned for which categories.

  This PR updates the helptext for these RPCs and adds a functional regression test for the cases when the other three categories are returned.

Tree-SHA512: 67dd7ff6269a3b0f17f5d1a61b0ae1fb1f3778f05e1c440bfbb9b3a005c9c6d740abcace20f3d597cf2bd6779c494448690f13fab0bd2340f206213bc7890b51
2018-12-21 05:57:25 +13:00
Hennadii Stepanov 698d0f882a
Remove misplaced Q_UNUSED and others enhancements
Also this removes unused function parameters and improves comments.
2018-12-20 01:06:37 +02:00
MarcoFalke fa5c346c5a
doc: Add comment to cs_main and mempool::cs 2018-12-20 08:13:50 +13:00
Hennadii Stepanov c8d9d9093b
Fix broken notificator on GNOME
That bug was introduced in #14228.
2018-12-19 20:43:07 +02:00
Wladimir J. van der Laan cb52cee29d
Merge #14993: rpc: Fix data race (UB) in InterruptRPC()
6c10037f72 rpc: Fix data race (UB) in InterruptRPC() (practicalswift)

Pull request description:

  Fix data race (UB) in `InterruptRPC()`.

  Before:

  ```
  $ ./configure --with-sanitizers=thread
  $ make
  $ test/functional/test_runner.py feature_shutdown.py
  …
  SUMMARY: ThreadSanitizer: data race rpc/server.cpp:314 in InterruptRPC()
  …
  ALL                 | ✖ Failed  | 2 s (accumulated)
  ```

  After:

  ```
  $ ./configure --with-sanitizers=thread
  $ make
  $ test/functional/test_runner.py feature_shutdown.py
  …
  ALL                 | ✓ Passed  | 3 s (accumulated)
  ```

Tree-SHA512: b139ca1a0480258f8caa7730cabd7783a821d906630f51487750a6b15b7842675ed679747e1ff1bdade77d248807e9d77bae7bb88da54d1df84a179cd9b9b987
2018-12-19 16:03:34 +01:00
MarcoFalke f080c65a09
Merge #14875: RPCHelpMan: Support required arguments after optional ones
fa9a5bc1a0 RPCHelpMan: Support required arguments after optional ones (MarcoFalke)

Pull request description:

  There was a requirement that required arguments could not be positioned after an optional argument, but the deprecation of priority made the second argument to `prioritisetransaction` optional. So support that in `RPCHelpMan`.

  Also format all named arguments in the same way (without the wrapping `"` even for strings), since the extended description already mentions the type and it feels odd to special case strings.

Tree-SHA512: c125145afb4a63abc995aaf0a89489efc0f470a720727a1ca6ee0bfd2bcbc59e87c38128dd1e0cdf03dbb5b18e84867887c3dabf6ec8378e66cb1f4cecb9e407
2018-12-19 09:12:52 +13:00
MarcoFalke d4197812d4
Merge #14985: test: Remove thread_local from test_bitcoin
fa61202cae test: Add comment to g_insecure_rand_ctx (MarcoFalke)
fa0d3c4407 test: Undo thread_local g_insecure_rand_ctx (MarcoFalke)

Pull request description:

  `thread_local` seems to be highly controversial according to the discussion in #14953, so remove it again from the tests.

  Also remove boost::thread_group in the test that uses it, since I am touching it anyway.

Tree-SHA512: 977c1f597e3cfbd0e97d0b037d998fdbc701f62e9a2f57e02dbe1727b63ae8ff478dbd9d3d6dc4ffdfa23f2058b331f04949d51f23a8f55b41ecb75f088f1cbe
2018-12-19 07:40:53 +13:00
practicalswift 6c10037f72 rpc: Fix data race (UB) in InterruptRPC() 2018-12-18 18:52:12 +01:00
Jonas Schnelli e7b88ecbc9
Merge #14975: qt: Refactoring with QString::toNSString()
4d454dcb6 Refactoring with QString::toNSString (Hennadii Stepanov)

Pull request description:

  This PR makes `MacNotificationHandler::showNotification()` cleaner and more readable.
  The used `QString::toNSString()` function was introduced in Qt 5.2 which is minimum version now (#14725).

  The behavior of `MacNotificationHandler::showNotification()` has not been changed.

  cc: @jonasschnelli

Tree-SHA512: 940327a77746ee016415efd3b696ad8ec85dcf12bf3f62e55c9bdc1700415d81a8d03fbc79310982d37a4098786dcaef7cd9702db5498d59d8065447babc27f5
2018-12-17 19:53:51 -10:00
lucash-dev b301950df3 Made expicit constructor CTransaction(const CMutableTransaction &tx).
This makes the above constructor explicit. The rationale is that this conversion has very significant performance effects. Making it explicit makes it easier to reason about these performance trade-offs, and helps identify possible functions that need a CMutableTransaction version.
2018-12-17 21:02:42 -08:00
lucash-dev faf29dd019 Minimal changes to comply with explicit CMutableTransaction -> CTranaction conversion.
This commit makes the minimal changes necessary to fix compilation once CTransaction(const CMutableTransaction &tx) is made explicit. In each case an explicit call `CTransaction(...)` was added. Shouldn't affect behaviour or performance.
2018-12-17 21:02:42 -08:00
MeshCollider 27f5a295d7
Merge #14957: wallet: Initialize stop_block in CWallet::ScanForWalletTransactions
8b9171ccf wallet: Initialize stop_block to nullptr in CWallet::ScanForWalletTransactions (Ben Woosley)

Pull request description:

  Previously the argument would be untouched if the first block scan failed. This
  makes the behavior predictable, and consistent with the documentation.

Tree-SHA512: 3efadf9fd5e25ecd9450f32545f58e61a123ad883e921ef427b13e4782ffdd8ffe905c9ad3edc7e8f9e4953342cd72247bb4cc9eeaf9e5fd04291ac5c1bb5eec
2018-12-18 15:34:06 +13:00
Ben Woosley 8b9171ccf0
wallet: Initialize stop_block to nullptr in CWallet::ScanForWalletTransactions
Previously the argument would be untouched if the first block scan failed. This
makes the behavior predictable, and consistent with the documentation.
2018-12-17 13:07:12 -08:00
MarcoFalke fafe941bdd
test: Add missing validation locks 2018-12-17 14:27:29 -05:00
MarcoFalke fa61202cae
test: Add comment to g_insecure_rand_ctx 2018-12-17 13:13:02 -05:00
Ben Carman 84104c781a clarifying getrawtransaction[time] get help text 2018-12-17 11:04:40 -06:00
MarcoFalke fa0d3c4407
test: Undo thread_local g_insecure_rand_ctx 2018-12-17 10:37:09 -05:00
Jonas Schnelli 3e21b690d1
[Qt] Restore < Qt5.6 compatibility for addAction 2018-12-16 20:24:43 -10:00
Hennadii Stepanov 4d454dcb64
Refactoring with QString::toNSString
The behavior of MacNotificationHandler::showNotification() has not been
changed.
2018-12-16 20:29:56 +02:00
Wladimir J. van der Laan 3424171685
Merge #14969: tests: Fix cuckoocache_tests TSAN failure introduced in 14935.
d98a29ec40 Fix cuckoocache_tests TSAN failure introduced in #14935. Fixes #14967. (practicalswift)

Pull request description:

  Fix cuckoocache_tests TSAN failure introduced in #14935. Fixes #14967.

Tree-SHA512: aabbfa3ab41d9f498151a9b50a2a875fd51ed609bb54d89292114f59392aae57c85fdd5b7a04b589fbf598aaf736b425a6f62b12c806a1fa23bdd45d2d2accfb
2018-12-16 12:14:28 +01:00
Jonas Schnelli dba0f4c5c7
Merge #14573: qt: Add Window menu
95a5a9fcc qt: Remove ellipsis from sending/receiving addresses (João Barbosa)
a96c0df35 qt: Add Window menu (João Barbosa)
9ea38d022 qt: Allow to inspect RPCConsole tabs (João Barbosa)

Pull request description:

  Overall this PR does the following:
   - add top level menu Window
   - add Minimize and Zoom actions to Window menu
   - move Sending/Receiving address to Window
   - remove Help->Debug window
   - add one menu entry for each debug window tab

  This removes the access to address book from the File menu.

  With wallet support:
  <img width="522" alt="screenshot 2018-12-11 at 00 33 05" src="https://user-images.githubusercontent.com/3534524/49770451-5bec0800-fcdc-11e8-91d6-f8f850ead92d.png">

  Without wallet support:
  <img width="593" alt="screenshot 2018-12-11 at 12 55 21" src="https://user-images.githubusercontent.com/3534524/49802183-19f6ac80-fd44-11e8-9973-36fcfb4f129e.png">

Tree-SHA512: 4fb03702efe18df7bae33950e462940162abe634c55d0214b8920812127b763234cc9b73f27b3702502a37b6d49bdd6c50b7c8d9a3daea75cecb0136556dd1ea
2018-12-15 20:13:38 -10:00
Stephan Oeste de7266fc3c
[net] add dnsseed.emzy.de to DNS seeds 2018-12-15 16:23:46 +01:00
practicalswift d98a29ec40 Fix cuckoocache_tests TSAN failure introduced in #14935. Fixes #14967. 2018-12-15 16:14:36 +01:00
1Il1 b74a52192b
fix testmempoolaccept CLI syntax
`testmempoolaccept "hexstring"` will give a "JSON parse error". The correct syntax is `testmempoolaccept \[\"hexstring\"\]` (but seems escaping is not displayed in other areas so leaving backspaces out).
2018-12-15 11:12:31 +09:00
MarcoFalke fac4558462
sync: Add RecursiveMutex type alias 2018-12-14 16:26:13 -05:00
MarcoFalke 9133227298
Merge #14935: tests: Test for expected return values when calling functions returning a success code
c84c2b8c92 tests: Test for expected return values when calling functions returning a success code (practicalswift)

Pull request description:

  Test for expected return values when calling functions returning a success code (instead of discarding the return values).

  **Note to reviewers:** The following commands can be used to verify that the only text fragments added in this PR are `BOOST_CHECK(`, `!` and `)` :

  ```
  $ git diff HEAD~1 | grep -E '^[\-][^\-]' | cut -b2- > before.txt
  $ git diff HEAD~1 | grep -E '^[\+][^\+]' | cut -b2- > after.txt
  $ cat after.txt | sed 's/BOOST_CHECK(//g' | sed 's/));/);/g' | tr -d '!' > after-sed.txt
  $ diff -u before.txt after-sed.txt
  $
  ```

Tree-SHA512: ff0863ef2046a2eda3c44e9c6b9aedfe167881f2fa58db29fef859416831233ef6502a3a11fd2322bc1a924db83df8d4a5c5879298007f2a7b085e2a7286af70
2018-12-14 14:21:23 -05:00
João Barbosa bf4383277d rpc: Remove unused PreCommand signal 2018-12-14 15:54:50 +00:00
MeshCollider 7a30e0f6c5
Merge #14821: Replace CAffectedKeysVisitor with descriptor based logic
0e75f44a0 Replace CAffectedKeysVisitor with descriptor based logic (Pieter Wuille)

Pull request description:

  It seems we don't need a custom visitor pattern anymore to find what keys are affected by a script. Instead, infer the descriptor, and see which keys it expands to.

Tree-SHA512: 8a52f61fb74e8ebfd8d02e759629e423ced6bd7d9a9ee7c4bdd2cca8465bc27b951cc69c8d835244a611ba55c6d22f83b81acef05487cb988c88c0951b797699
2018-12-14 14:21:29 +13:00
Pieter Wuille 7257353b93 Select orphan transaction uniformly for eviction
The previous code was biased towards evicting transactions whose txid has
a larger gap (lexicographically) with the previous txid in the orphan pool.
2018-12-13 13:46:33 -08:00
MarcoFalke faead93c6c
test: Make g_insecure_rand_ctx thread_local 2018-12-13 14:32:44 -05:00
Wladimir J. van der Laan 20c54eef6e
Merge #14834: validation: assert that pindexPrev is non-null when required
fbaaf782ce validation: assert that pindexPrev is non-null when required (Karl-Johan Alm)

Pull request description:

  In `ContextualCheckBlock`, we are checking if `pindexPrev == nullptr` conditionally at the start, but then assume it is non-`null` later. This removes the latter assumption.

Tree-SHA512: 95f1e9dc839b2cc0e099d155e6180634ece8c6760d00b53e7d27128762e64c92e82d98a5f4a5786b48a4851b17cdbb4b667d3b6a99adb651256e2032de67d05c
2018-12-13 14:37:43 +01:00
Wladimir J. van der Laan 57c9556095
Merge #14940: test: Add test for truncated pushdata script
fa694f706c test: Add tests for truncated scripts (MarcoFalke)

Pull request description:

  Previously not covered by any test

Tree-SHA512: 9f99659bdf3947271074938456a2fe64f5b39fc868e9aa474cec199a536ae5d7428f1cfa7f361936b71b09ee4c426261e6b25668fa77b8416b30dbe4ddb357f0
2018-12-13 14:02:49 +01:00
Wladimir J. van der Laan 378fdfabba
Merge #14624: Some simple improvements to the RNG code
e414486d56 Do not permit copying FastRandomContexts (Pieter Wuille)
022cf47dd7 Simplify testing RNG code (Pieter Wuille)
fd3e7973ff Make unit tests use the insecure_rand_ctx exclusively (Pieter Wuille)
8d98d42611 Bugfix: randbytes should seed when needed (non reachable issue) (Pieter Wuille)
273d02580a Use a FastRandomContext in LimitOrphanTxSize (Pieter Wuille)
3db746beb4 Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection (Pieter Wuille)
8098379be5 Use a local FastRandomContext in a few more places in net (Pieter Wuille)
9695f31d75 Make addrman use its local RNG exclusively (Pieter Wuille)

Pull request description:

  This improves a few minor issues with the RNG code:
  * Avoid calling `GetRand*()` functions (which currently invoke OpenSSL, later may switch to using our own RNG pool) inside loops in addrman, networking code, `KnapsackSolver`, and `LimitOrphanSize`
  * Fix a currently unreachable bug in `FastRandomContext::randbytes`.
  * Make a number of simplifications to the unit tests' randomness code (some tests unnecessarily used their own RNG or the OpenSSL one, instead of using the unit test specific `insecure_rand_ctx`).
  * As a precaution, make it illegal to copy a `FastRandomContext`.

Tree-SHA512: 084c70b533ea68ca7adc0186c39f0b3e0a5c0ae43a12c37286e5d42086e056a8cd026dde61b12c0a296dc80f87fdc87fe303b9e8e6161b460ac2086cf7615f9d
2018-12-13 13:58:20 +01:00
Wladimir J. van der Laan 9c477c990c
Merge #14741: doc: Indicate -rpcauth option password hashing alg
dcb70b1522 Indicate -rpcauth option password hashing alg (Carl Dong)

Pull request description:

  By indicating the password hashing algorithm, users of bitcoin distributions without the script in `share/rpcauth` and users who don't want to rely on said script can use alternative means to generate the password hash.

  Question for reviewers: perhaps we should also indicate that it is specifically a HMAC-SHA-256 of the _**UTF-8**_ encoding of their password?

Tree-SHA512: 86b546c2e78699fa253da0c1e76b21ef60e9b6a5778826ac5136e764d70e3213044cc05cdb4786ba27968781647c46e358a823bbc2db7d45d041d291ee03b83c
2018-12-13 13:29:26 +01:00
practicalswift c84c2b8c92 tests: Test for expected return values when calling functions returning a success code 2018-12-13 09:37:23 +01:00
Pieter Wuille bdacbda253 Overhaul importmulti logic
This introduces various changes to the importmulti logic:
* Instead of processing input and importing things at the same time, first
  process all input data and verify it, so no changes are made in case of
  an error.
* Verify that no superfluous information is provided (no keys or scripts
  that don't contribute to solvability in particular).
* Add way more sanity checks, by means of descending into all involved
  scripts.
2018-12-12 16:32:33 -08:00
Pieter Wuille e414486d56 Do not permit copying FastRandomContexts 2018-12-12 14:28:16 -08:00
Pieter Wuille 022cf47dd7 Simplify testing RNG code 2018-12-12 14:28:15 -08:00
Pieter Wuille fd3e7973ff Make unit tests use the insecure_rand_ctx exclusively 2018-12-12 14:22:12 -08:00
Pieter Wuille 8d98d42611 Bugfix: randbytes should seed when needed (non reachable issue) 2018-12-12 14:22:12 -08:00
Pieter Wuille 273d02580a Use a FastRandomContext in LimitOrphanTxSize 2018-12-12 14:22:12 -08:00
Pieter Wuille 3db746beb4 Introduce a Shuffle for FastRandomContext and use it in wallet and coinselection 2018-12-12 14:22:12 -08:00
Pieter Wuille 8098379be5 Use a local FastRandomContext in a few more places in net 2018-12-12 14:22:12 -08:00
Pieter Wuille 9695f31d75 Make addrman use its local RNG exclusively 2018-12-12 14:22:12 -08:00
MarcoFalke fa694f706c
test: Add tests for truncated scripts 2018-12-12 15:36:46 -05:00
MarcoFalke 6d0a14703e
Merge #14908: test: Removed implicit CTransaction constructor calls from tests and benchmarks.
8db0c3d42b Removed implicit CTransaction conversion from benchmaks (lucash-dev)
ed61abedb2 Removed implicit CTransaction constructor from tests (lucash-dev)

Pull request description:

  This PR was split from #14906 and is a prerequisite for it.
  It updates tests and benchmarks, removing all implicit calls to `CTransaction(CMutableTransaction&)` constructors. This will make possible making the constructor explicit in the next PR.
  The original rationale for making the constructor explicit:

   - Conversion constructors should not be explicit unless there's a strong reason for it (in the opinion of, for example, https://google.github.io/styleguide/cppguide.html, and https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion. Let me know your take on this).
   - This particular conversion is very costly -- it implies a serialization plus hash of the transaction.
   - Even though `CTransaction` and `CMutableTransaction` represent the same data, they have very different use cases and performance properties.
   - Making it explicit allows for easier reasoning of performance trade-offs.
   - There has been previous performance issues caused by unneeded use of this implicit conversion.
   - This PR creates a map for places to look for possible refactoring and performance gains (this benefit still holds if the PR is not merged).

Tree-SHA512: de8073aa6ff8a3153bcbe10818616677ecf9598e4978d8a0b4c39a262e71c36be5679cec08554c760d1f011ba6d37350318248eef15f6d9b86f9e4462b2de0d2
2018-12-12 14:30:24 -05:00
MeshCollider ed2a2cebd3
Merge #13076: Fix ScanForWalletTransactions to return an enum indicating scan result: success / failure / user_abort
bd3b0361d Add stop_block out arg to ScanForWalletTransactions (Ben Woosley)
3002d6cf3 Return a status enum from ScanForWalletTransactions (Ben Woosley)
bb24d6865 Make CWallet::ScanForWalletTransactions args and return value const (Ben Woosley)

Pull request description:

  Return the failed block as an out arg.

  Fixes #11450.

  /cc #12275

Tree-SHA512: 6a523e5425ebfe24e664a942ae21c797ccc1281c25b1bf8d02ad95c19dae343fd8051985ef11853474de7628fd6bed5f15190fbc087c3466ce6fdecab37d72a9
2018-12-12 18:00:42 +13:00
MeshCollider 3fff1ab817
Merge #14646: Add expansion cache functions to descriptors (unused for now)
26879509f Add comments to descriptor tests (Pieter Wuille)
82df4c64f Add descriptor expansion cache (Pieter Wuille)
1eda33aab [refactor] Combine the ToString and ToPrivateString implementations (Pieter Wuille)
24d3a7b3a [refactor] Use DescriptorImpl internally, permitting access to new methods (Pieter Wuille)
6be0fb4b3 [refactor] Add a base DescriptorImpl with most common logic (Pieter Wuille)

Pull request description:

  This patch modifies the internal `Descriptor` class to optionally construct and use an "expansion cache". Such a cache is a byte array that encodes all information necessary to expand a `Descriptor` a second time without access to private keys, and without the need to perform expensive BIP32 derivations. For all currently defined descriptors, the cache simply contains a concatenation of all public keys used.

  This is motivated by the goal of importing a descriptor into the wallet and using it as a replacement for the keypool, where it would be impossible to expand descriptors if they use hardened derivation.

Tree-SHA512: f531a0a82ec1eecc30b78ba8a31724d1249826b028cc3543ad32372e1aedd537f137ab03dbffc222c5df444d5865ecd5cec754c1ae1d4989b6e9baeaffade32a
2018-12-12 17:24:26 +13:00
lucash-dev 8db0c3d42b Removed implicit CTransaction conversion from benchmaks 2018-12-11 19:43:35 -08:00
lucash-dev ed61abedb2 Removed implicit CTransaction constructor from tests 2018-12-11 19:43:35 -08:00
João Barbosa 95a5a9fccb qt: Remove ellipsis from sending/receiving addresses
Considering https://stackoverflow.com/a/637708 the ellipsis in these
menu actions should be removed.
2018-12-11 13:15:35 +00:00
João Barbosa a96c0df35e qt: Add Window menu 2018-12-11 13:15:35 +00:00
João Barbosa 9ea38d0222 qt: Allow to inspect RPCConsole tabs 2018-12-11 13:15:35 +00:00
John Newbery 0025c9eae4 [mining] segwit option must be set in GBT
Calling getblocktemplate without the segwit rule specified is most
likely a client error, since it results in lower fees for the miner.
Prevent this client error by failing getblocktemplate if called without
the segwit rule specified.
2018-12-10 16:42:14 -05:00
MarcoFalke fa9a5bc1a0
RPCHelpMan: Support required arguments after optional ones 2018-12-10 14:08:20 -05:00
MarcoFalke 5f23460c7e
Merge #14877: rpc: Document default values for optional arguments
fa0c24c96e rpc: Document default values for optional arguments (MarcoFalke)

Pull request description:

Tree-SHA512: e1f5ea67d7ac67526ae87bffaeb308a9ad68632e161fe0148cd431a340bb7a30def18f1dbc7e98c6c1c269ac8942fd5d5334c85c48e4fb1cead70a42536b6eef
2018-12-10 14:02:21 -05:00
MarcoFalke 234b99b921
Merge #14885: rpc: Assert named arguments are unique in RPCHelpMan
e09a5875ca rpc: Assert named arguments are unique in RPCHelpMan (João Barbosa)

Pull request description:

  Prevents an obvious mistake.

Tree-SHA512: 32c24a1934b17ab6f0d5cd31bdf0388e93ee5156ccc1b4f78eb9fd7f1d4b27a4b978b594ff11812bc9f20987c9fc36bf4497ddaedf18cf6bcbea19c050571334
2018-12-10 10:26:39 -05:00
Wladimir J. van der Laan 0eb65aa902
Merge #14801: qt: Use window() instead of obsolete topLevelWidget()
0b4a5786bb Use window() instead of obsolete topLevelWidget() (Hennadii Stepanov)

Pull request description:

  `QWidget::topLevelWidget()` is obsolete since at least Qt 4.8.

  Refs:
  - https://doc-snapshots.qt.io/4.8/qwidget-obsolete.html#topLevelWidget
  - https://doc.qt.io/qt-5.9/qwidget-obsolete.html#topLevelWidget

Tree-SHA512: 45a79a3f11acd24bbf335603e60cb46545f4c9ce9b16280117676797a611c4422525abd39ad6784a7bc459926e3f5120b49a170403ff60ba4788d679862e3ff0
2018-12-09 16:53:55 +01:00
Cory Fields 89282379ba
threads: fix unitialized members in sched_param
Building with gcc 8.2 against musl libc, which apparently has more attributes
available in its sched_param. The following warnings were produced:

    warning: missing initializer for member 'sched_param::sched_ss_low_priority' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_repl_period' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_init_budget' [-Wmissing-field-initializers]
    warning: missing initializer for member 'sched_param::sched_ss_max_repl' [-Wmissing-field-initializers]

Since the current thread may have interesting non-zero values for these fields,
we want to be sure to only change the intended one. Query and modify the
current sched_param rather than starting from a zeroed one.
2018-12-09 21:08:48 +08:00
MarcoFalke fa0c24c96e
rpc: Document default values for optional arguments 2018-12-07 11:53:29 -05:00
João Barbosa e09a5875ca rpc: Assert named arguments are unique in RPCHelpMan 2018-12-07 16:26:38 +00:00
Wladimir J. van der Laan d38a2c1416
Merge #14890: rpc: Avoid creating non-standard raw transactions
fa4c8679ed rpc: Avoid creating non-standard raw transactions (MarcoFalke)

Pull request description:

  Multiple OP_RETURN outputs in a transaction are not standard and unlikely to be relayed, so avoid creating them.

  Apart from that, the logic was broken in that it duplicated the same hex-data for each data output: Closes #14868.

Tree-SHA512: b08d08062b5622e8a7b497e490ccaf53b06e844c863fda3bf3f932a98684a809e8341aeb98232059a795afb32d8770a6c5591a66f8e6ee372b672af245607887
2018-12-07 17:19:48 +01:00
Wladimir J. van der Laan 2b12268095
Merge #14854: qt: Cleanup SplashScreen class
7d1b60ce93 Cleanup SplashScreen class (Hennadii Stepanov)

Pull request description:

  Cleaning up after replacing the `QSplashScreen` base class with the `QWidget` class (#4941 by @laanwj).

  cc @jonasschnelli

Tree-SHA512: 72e2d67905d85247a11ae6a884f74f710f765adf20db7d1daf0927e6990687e836b486c4ff93bc6dabc3759ed667acfe1d69c8b94fae7181ab271a3fa7a0229a
2018-12-07 17:12:55 +01:00
Wladimir J. van der Laan b8b0b8ced7
Merge #14480: refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread
b7df96f456 refactor: Drop boost::this_thread::interruption_point and boost::thread_interrupted in main thread (Chun Kuan Lee)

Pull request description:

  This PR drops useless `boost::this_thread::interruption_point` and `boost::thread_interrupted` catch. They are only executed in main thread.

Tree-SHA512: a980d098c1a8238e4f0da9493731d7e69b9ca8e010103f442722d0d4cce471cc40a1fafd5f05535ad0e18899b6cf7563ee20e4025f7c7bc15182a0058c028922
2018-12-07 15:40:50 +01:00
Wladimir J. van der Laan f544e23556
Merge #14863: refactor: Add and use HaveTxsDownloaded() where appropriate
fa4fc8856b validation: Add and use HaveTxsDownloaded where appropriate (MarcoFalke)

Pull request description:

  `nChainTx` is an implementation detail that shouldn't be exposed without a wrapper that comes with appropriate documentation.

Tree-SHA512: 56ab7378c2ce97794498724c271f861de982de69099e90ec09632a26230ae6fded3c59668adb378bd64dcb8ef714769b970210977b88a53fc7550774ddba3d59
2018-12-07 14:59:30 +01:00
MarcoFalke fa4c8679ed
rpc: Avoid creating non-standard raw transactions 2018-12-06 16:56:58 -05:00
MarcoFalke f8456256c8
Merge #14783: gui: Fix boost::signals2::no_slots_error in early calls to InitWarning
6bbdb2077e squashme: connect thru node interface (João Barbosa)
a0f8df365d qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning (João Barbosa)

Pull request description:

  Adding the following to `bitcoin.conf`
  ```
  [xxx]
  disablewallet=1
  ```
  And running `bitcoin-qt` gives:
  ```
  libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::signals2::no_slots_error> >: boost::signals2::no_slots_error
  ```

  Fixes regression in #14708.

Tree-SHA512: 7c158376fad6ebcd80fc0dbe549d5b6e893fb82e7dc1e455825633d7f91b14dc34493487cab7642152e88f9eaf99bfa91988972d600e9fb289cf26afd64aff8a
2018-12-06 14:52:18 -05:00
Wladimir J. van der Laan a88bd3186d
Merge #14670: http: Fix HTTP server shutdown
28479f926f qa: Test bitcond shutdown (João Barbosa)
8d3f46ec39 http: Remove timeout to exit event loop (João Barbosa)
e98a9eede2 http: Remove unnecessary event_base_loopexit call (João Barbosa)
6b13580f4e http: Unlisten sockets after all workers quit (João Barbosa)
18e9685816 http: Send "Connection: close" header if shutdown is requested (João Barbosa)
02e1e4eff6 rpc: Add wait argument to stop (João Barbosa)

Pull request description:

  Fixes #11777. Reverts #11006. Replaces #13501.

  With this change the HTTP server will exit gracefully, meaning that all requests will finish processing and sending the response, even if this means to wait more than 2 seconds (current time allowed to exit the event loop).

  Another small change is that connections are accepted even when the server is stopping, but HTTP requests are rejected. This can be improved later, especially if chunked replies are implemented.

  Briefly, before this PR, this is the order or events when a request arrives (RPC `stop`):
   1. `bufferevent_disable(..., EV_READ)`
   2. `StartShutdown()`
   3. `evhttp_del_accept_socket(...)`
   4. `ThreadHTTP` terminates (event loop exits) because there are no active or pending events thanks to 1. and 3.
   5. client doesn't get the response thanks to 4.

  This can be verified by applying
  ```diff
       // Event loop will exit after current HTTP requests have been handled, so
       // this reply will get back to the client.
       StartShutdown();
  +    MilliSleep(2000);
       return "Bitcoin server stopping";
   }
  ```
  and checking the log output:
  ```
      Received a POST request for / from 127.0.0.1:62443
      ThreadRPCServer method=stop user=__cookie__
      Interrupting HTTP server
  **  Exited http event loop
      Interrupting HTTP RPC server
      Interrupting RPC
      tor: Thread interrupt
      Shutdown: In progress...
      torcontrol thread exit
      Stopping HTTP RPC server
      addcon thread exit
      opencon thread exit
      Unregistering HTTP handler for / (exactmatch 1)
      Unregistering HTTP handler for /wallet/ (exactmatch 0)
      Stopping RPC
      RPC stopped.
      Stopping HTTP server
      Waiting for HTTP worker threads to exit
      msghand thread exit
      net thread exit

      ... sleep 2 seconds ...

      Waiting for HTTP event thread to exit
      Stopped HTTP server
  ```

  For this reason point 3. is moved right after all HTTP workers quit. In that moment HTTP replies are queued in the event loop which keeps spinning util all connections are closed. In order to trigger the server side close with keep alive connections (implicit in HTTP/1.1) the header `Connection: close` is sent if shutdown was requested. This can be tested by
  ```
  bitcoind -regtest
  nc localhost 18443
  POST / HTTP/1.1
  Authorization: Basic ...
  Content-Type: application/json
  Content-Length: 44

  {"jsonrpc": "2.0","method":"stop","id":123}
  ```

  Summing up, this PR:
   - removes explicit event loop exit — event loop exits once there are no active or pending events
   - changes the moment the listening sockets are removed — explained above
   - sends header `Connection: close` on active requests when shutdown was requested which is relevant when it's a persistent connection (default in HTTP 1.1) — libevent is aware of this header and closes the connection gracefully
   - removes event loop explicit break after 2 seconds timeout

Tree-SHA512: 4dac1e86abe388697c1e2dedbf31fb36a394cfafe5e64eadbf6ed01d829542785a8c3b91d1ab680d3f03f912d14fc87176428041141441d25dcb6c98a1e069d8
2018-12-06 17:43:07 +01:00
Hennadii Stepanov 93009618b6
Fix start with the -min option
When GUI starts with the `-min` option, the `Minimize to tray instead of
the taskbar` option works as expected now.
2018-12-06 18:23:31 +02:00
Wladimir J. van der Laan 0936e2596b
Merge #14831: Scripts and tools: Use #!/usr/bin/env bash instead of #!/bin/bash.
688f665a5e Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes. (vim88)

Pull request description:

  As it was discussed in [#13510](https://github.com/bitcoin/bitcoin/pull/13510), it is better to use `#!/usr/bin/env bash` instead of `#!/bin/bash`.

Tree-SHA512: 25f71eb9a6a0cdc91568b5c6863205c5fe095f77a69e633503a2ac7805bd9013af8538e538c0c666ce96a28e3f43ce7a8df5f08d4ff007723bb588d85674f2da
2018-12-06 15:47:44 +01:00
Wladimir J. van der Laan 127b30cce8
Merge #14838: Use const in COutPoint class
cf4b0327ed Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1 (practicalswift)
6b82fc59eb Use const in COutPoint class (Hennadii Stepanov)

Pull request description:

  Refactoring:
  - all cases of using `(uint32_t) -1` in `COutPoint` class are replaced with const;
  - also all remaining instances of `(UNSIGNED)-1` transformed to `std::numeric_limits<UNSIGNED>::max()` (by @practicalswift).

Tree-SHA512: fc7fe9838b6e5136d8b97ea3d6f64c4aaa1215f4369832df432cab017396620bb6e30520a64180ceab6de222562ac11eab243a78dfa5a658ba018835a34caa19
2018-12-06 15:37:57 +01:00
practicalswift 8931a95bec Include util/strencodings.h which is required for IsSpace(...) 2018-12-06 12:12:15 +01:00
MarcoFalke e2c473ff75
Merge #14796: rpc: Pass argument descriptions to RPCHelpMan
fabca42c68 RPCHelpMan: Add space after colons in extended description (MarcoFalke)
fafd040f73 rpc: Add description to fundrawtransaction vout_index (MarcoFalke)
1db0096f61 rpc: Pass argument descriptions to RPCHelpMan (MarcoFalke)

Pull request description:

  This will normalize the type names and formatting for the rpc arguments

Tree-SHA512: 6ab344882f0fed36046ab4636cb2fa5d2479c6aae22666ca9a0d067edbb9eff8de98010ad97c8ce40ab532d15d1ae67120a561b0bf3da837090d7de427679f4f
2018-12-05 11:03:49 -05:00
MarcoFalke fabca42c68
RPCHelpMan: Add space after colons in extended description
Also, add doxygen comment to ToDescriptionString
2018-12-04 13:47:49 -05:00
practicalswift cf4b0327ed
Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1 2018-12-04 19:55:04 +02:00
MarcoFalke fafd040f73
rpc: Add description to fundrawtransaction vout_index 2018-12-04 12:06:13 -05:00
MarcoFalke fa4fc8856b
validation: Add and use HaveTxsDownloaded where appropriate 2018-12-04 10:51:56 -05:00
Wladimir J. van der Laan 86ff0413bb
Merge #14840: Remove duplicate libconsensus linking in test make
b14948e2e Remove duplicate libconsensus linking in test make (Amir Abrams)

Pull request description:

  `LIBBITCOIN_CONSENSUS` is linked twice in Makefile.test.include

Tree-SHA512: d4240e6f15f62ec1500021760af5155c6ce3898d1ca8da463ad85e2bff4435aa3b9204505ef889149509ae959d44dd845914671bc3d7df61e89aa3ab5e1aa751
2018-12-04 13:39:35 +01:00
Wladimir J. van der Laan 88445889f1
Merge #14733: P2P: Make peer timeout configurable, speed up very slow test and ensure correct code path tested.
48b37db50 make peertimeout a debug argument, remove error message translation (Zain Iqbal Allarakhia)
8042bbfbf p2p: allow p2ptimeout to be configurable, speed up slow test (Zain Iqbal Allarakhia)

Pull request description:

  **Summary:**

  1. _Primary_: Adds a `debug_only=true` flag for peertimeout, defaults to 60 sec., the current hard-coded setting.
  2. _Secondary_: Drastically speeds up `p2p_timeout.py` test.
  3. _Secondary_: Tests that the correct code path is being tested by adding log assertions to the test.

  **Rationale:**

  - P2P timeout was hard-coded: make it explicitly specified and configurable, instead of a magic number.
  - Addresses #13518; `p2p_timeout.py` takes 4 sec. to run instead of 61 sec.
  - Makes `p2p_timeout.py` more explicit. Previously, we relied on a comment to inform us of the timeout amount being tested. Now it is specified directly in the test via passing in the new arg; `-peertimeout=3`.
  - Opens us up to testing more P2P scenarios; oftentimes slow tests are the reason we don't test.

  **Locally verified changes:**

  _With Proposed Change (4.7 sec.):_
  ```
  $ time ./test/functional/p2p_timeouts.py
  2018-11-19T00:04:19.077000Z TestFramework (INFO): Initializing test directory /tmp/testhja7g2n7
  2018-11-19T00:04:23.479000Z TestFramework (INFO): Stopping nodes
  2018-11-19T00:04:23.683000Z TestFramework (INFO): Cleaning up /tmp/testhja7g2n7 on exit
  2018-11-19T00:04:23.683000Z TestFramework (INFO): Tests successful

  real    0m4.743s
  ```

  _Currently  on master (62.8 sec.):_
  ```
  $ time ./test/functional/p2p_timeouts.py
  2018-11-19T00:06:10.948000Z TestFramework (INFO): Initializing test directory /tmp/test6mo6k21h
  2018-11-19T00:07:13.376000Z TestFramework (INFO): Stopping nodes
  2018-11-19T00:07:13.631000Z TestFramework (INFO): Cleaning up /tmp/test6mo6k21h on exit
  2018-11-19T00:07:13.631000Z TestFramework (INFO): Tests successful

  real    1m2.836s
  ```

  _Error message demonstrated for new argument `-peertimeout`:_
  ```
  $ ./bitcoind -peertimeout=-5
  ...
  Error: peertimeout cannot be configured with a negative value.
  ```

Tree-SHA512: ff7a244ebea54c4059407bf4fb86465714e6a79cef5d2bcaa22cfe831a81761aaf597ba4d5172fc2ec12266f54712216fc41b5d24849e5d9dab39ba6f09e3a2a
2018-12-04 12:58:02 +01:00
Wladimir J. van der Laan c789add6fc
Merge #14760: Log env path in BerkeleyEnvironment::Flush
467461030 Log env path in BerkeleyEnvironment::Flush (João Barbosa)

Pull request description:

  With `bitcoind -regtest -wallet=w1 -wallet=w2 -debug`, before:

  ```
  BerkeleyEnvironment::Flush: Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              23ms
  BerkeleyEnvironment::Flush: Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              19ms
  ```

  After:
  ```
  BerkeleyEnvironment::Flush: [/Users/joao/Library/Application Support/Bitcoin/regtest/wallets/w1] Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              23ms
  BerkeleyEnvironment::Flush: [/Users/joao/Library/Application Support/Bitcoin/regtest/wallets/w2] Flush(true)
  BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
  BerkeleyEnvironment::Flush: wallet.dat checkpoint
  BerkeleyEnvironment::Flush: wallet.dat detach
  BerkeleyEnvironment::Flush: wallet.dat closed
  BerkeleyEnvironment::Flush: Flush(true) took              19ms
  ```

Tree-SHA512: f90b413cca5d2527324a264ce371dc8baba69f5b541f7d7f6238a8dd79398cbd3c67c0d7a8a0b69aec6c44d77ba26a079c2241427e3669ed22c7da0e4d60039e
2018-12-04 11:34:43 +01:00
Jonas Schnelli 64fc7c0c1b
Merge #14828: qt: Remove hidden columns in coin control dialog
1c28feb7d qt: Remove hidden columns in coin control dialog (João Barbosa)

Pull request description:

  Instead of having hidden columns, store the data in specific roles.

  Overlaps with #14817, fixes #11811.

Tree-SHA512: e86e9ca426b9146ac28997ca1920dbae6cc4e2e494ff94fe131d605cd6c013183fc5de10036c886a4d6dcae497ac4067de3791be0ef9c88f7ce9f57f7bd97422
2018-12-04 09:19:56 +01:00
Patrick Strateman 4927bf2f25 Increase maxconnections limit when using poll. 2018-12-03 14:25:55 -05:00
Patrick Strateman 11cc491a28 Implement poll() on systems which support it properly.
This eliminates the restriction on maximum socket descriptor number.
2018-12-03 14:25:51 -05:00
practicalswift dae1423e5a Add locking annotations to feeStats, shortStats and longStats 2018-12-03 00:14:33 +01:00
practicalswift 764e42fee2 scripted-diff: Rename from cs_feeEstimator to m_cs_fee_estimator
-BEGIN VERIFY SCRIPT-
sed -i 's/cs_feeEstimator/m_cs_fee_estimator/' src/policy/fees.cpp src/policy/fees.h
-END VERIFY SCRIPT-
2018-12-02 21:18:04 +01:00
practicalswift 9a789d4dc6 policy: Add Clang thread safety annotations for variables guarded by cs_feeEstimator 2018-12-02 21:18:04 +01:00
vim88 688f665a5e Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes. 2018-12-02 16:14:21 +02:00
Hennadii Stepanov 7d1b60ce93
Cleanup SplashScreen class
Cleaning up after replacing the QSplashScreen base class with the
QWidget class.
2018-12-02 01:26:28 +02:00
andrewtoth e982f0b682 Add all category options to wallet rpc help 2018-12-01 13:00:00 -05:00
Wladimir J. van der Laan ed12fd83ca
Merge #13966: gui: When private key is disabled, only show watch-only balance
82d6c5aad gui: Show watch-only eye instead of HD disabled (Chun Kuan Lee)
fe1ff5026 Hide spendable label if priveate key is disabled (Chun Kuan Lee)

Pull request description:

  If a wallet is in private key disabled mode, the spendable balance is always zero, it does not have to show on GUI. Show the watch-only balance at normal balance column if a wallet is in that mode.

  ![image](https://user-images.githubusercontent.com/11154118/45662527-dfaab400-bb34-11e8-98c8-c06ac5c0b08a.png)

Tree-SHA512: 8b535427d26d3f8e61081f50e4773bd25656be042d378fd34cf647e9a0065cb4dfb67a8ab9fb4fbf5f196390df8cb983ebf2f0fa8a6503b7c046c56bec87ba72
2018-12-01 12:24:33 +01:00
Wladimir J. van der Laan 5ab5341d13
Merge #14841: consensus: Move CheckBlock() call to critical section
c5ed6e73d Move CheckBlock() call to critical section (Hennadii Stepanov)

Pull request description:

  This is an alternative to #14803.

  Refs:
  - #14058
  - #14072
  - https://github.com/bitcoin/bitcoin/pull/14803#issuecomment-442233211 by @gmaxwell
  > It doesn't support multithreaded validation and there are lot of things that prevent that, which is why I was concerned. Why doesn't the lock on the block index or even cs main prevent concurrency here?

  - https://github.com/bitcoin/bitcoin/pull/14803#issuecomment-442237566 by @MarcoFalke

Tree-SHA512: 2152e97106e11da5763b2748234ecd2982daadab13a0da04215f4db60af802a44ab5700f32249137d122eb13fc2a02e0f2d561d364607d727d8c6ab879339afb
2018-12-01 10:27:49 +01:00
Patrick Strateman 28211a4bc9 Move SocketEvents logic to private method.
This separates the select() logic from the socket handling logic, setting up
for a switch to poll().
2018-11-30 18:02:51 -05:00
Patrick Strateman 7e403c0ae7 Move GenerateSelectSet logic to private method.
This separates the socket event collection logic from the logic
deciding which events we're interested in at all.
2018-11-30 18:02:51 -05:00
Patrick Strateman 1e6afd0dbc Introduce and use constant SELECT_TIMEOUT_MILLISECONDS. 2018-11-30 18:02:51 -05:00
Wladimir J. van der Laan 011c42c5bd
Merge #13258: uint256: Remove unnecessary crypto/common.h dependency
bf2e01097 uint256: Remove unnecessary crypto/common.h use (Karl-Johan Alm)

Pull request description:

  This is an alternative to #13242 which keeps the `ReadLE64` part, but moves the `crypto/common.h` dependency into `crypto/common.h` as a function outside of `uint256`.

  **Reason:** this change will remove dependencies for `uint256` to `crypto/common.h`, `compat/endian.h`, and `compat/byteswap.h`.

  This PR removes the need to update tests to be endian-aware/-independent, but keeps the (arguably dubious) `ReadLE64` part (which was only introduced to fix the tests, not for any functionality).

Tree-SHA512: 78b35123cdb185b3b3ec59aba5ca8a5db72624d147f2d6a5484ffa5ce626a72f782a01dc6893fc8f5619b03e2eae7b5a03b0df5d43460f3bda428e719e188aec
2018-11-30 18:48:58 +01:00
MarcoFalke 13a7454fbd
Merge #14380: fix assert crash when specified change output spend size is unknown
0fb2e69815 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change (Gregory Sanders)
b06483c96a Remove stale comment in CalculateMaximumSignedInputSize (Gregory Sanders)

Pull request description:

  This is triggered anytime a fundraw type call(psbt or legacy) is used with a change output address that the wallet doesn't know how to sign for.

  This regression was added in 6a34ff5335 since BnB coin selection actually cares about this.

  The fix is to assume the smallest typical spend, a P2SH-P2WPKH, which is calculated using a "prototype" dummy signature flow. Future work could generalize this infrastructure to get estimated sizes of inputs for a variety of types.

  I also removed a comment which I believe is stale and misleading.

Tree-SHA512: c7e2be189e524f81a7aa4454ad9370cefba715e3781f1e462c8bab77e4d27540191419029e3ebda11e3744c0703271e479dcd560d05e4d470048d9633e34da16
2018-11-30 10:49:49 -05:00
Hennadii Stepanov 6b82fc59eb
Use const in COutPoint class 2018-11-30 12:54:24 +02:00
Hennadii Stepanov c5ed6e73d3
Move CheckBlock() call to critical section
This prevents data race for CBlock::fChecked.
2018-11-30 12:40:57 +02:00
Zain Iqbal Allarakhia 48b37db50f make peertimeout a debug argument, remove error message translation 2018-11-29 13:05:41 -08:00
Amir Abrams b14948e2e0
Remove duplicate libconsensus linking in test make
LIBBITCOIN_CONSENSUS is linked twice in Makefile.test.include
2018-11-29 05:30:58 -06:00
João Barbosa 1c28feb7d0 qt: Remove hidden columns in coin control dialog 2018-11-29 07:58:40 +00:00
Karl-Johan Alm fbaaf782ce
validation: assert that pindexPrev is non-null when required 2018-11-29 14:15:39 +09:00
Zain Iqbal Allarakhia 8042bbfbf0 p2p: allow p2ptimeout to be configurable, speed up slow test 2018-11-28 16:41:15 -08:00
Pieter Wuille 26879509f1 Add comments to descriptor tests 2018-11-28 15:24:49 -08:00
Pieter Wuille 82df4c64ff Add descriptor expansion cache 2018-11-28 15:24:49 -08:00
Pieter Wuille 1eda33aabc [refactor] Combine the ToString and ToPrivateString implementations 2018-11-28 15:24:49 -08:00
Pieter Wuille 24d3a7b3a9 [refactor] Use DescriptorImpl internally, permitting access to new methods 2018-11-28 15:24:49 -08:00
Pieter Wuille 6be0fb4b3f [refactor] Add a base DescriptorImpl with most common logic 2018-11-28 15:16:17 -08:00
MarcoFalke 60b20c869f
Merge #14822: bench: Destroy wallet txs instead of leaking their memory
fa5cef0f78 bench: Destroy wallet txs instead of leaking their memory (MarcoFalke)

Pull request description:

  This should destroy the wallet txs when the benchmark ends to avoid having to hold them when the following benchmarks run.

Tree-SHA512: e2510946e6a47fad3ec5fb28d298df8ddc2e017455fcff777fa7bbc12d801c08739db6a7a7289509aaa881ccdc59dfff9bcb6772b48db2c457d3787081a46c06
2018-11-28 11:14:03 -05:00
practicalswift 4894133dc5 Add missing lock in CNode::copyStats(...) 2018-11-28 09:36:25 +01:00
practicalswift b312cd7707 Add missing locking annotations 2018-11-28 09:36:25 +01:00
MarcoFalke fa5cef0f78
bench: Destroy wallet txs instead of leaking their memory 2018-11-27 16:52:56 -05:00
Pieter Wuille 0e75f44a09 Replace CAffectedKeysVisitor with descriptor based logic 2018-11-27 12:23:49 -08:00
Pieter Wuille fdf146f329
Merge #14477: Add ability to convert solvability info to descriptor
109699dd33 Add release notes (Pieter Wuille)
b65326b562 Add matching descriptors to scantxoutset output + tests (Pieter Wuille)
16203d5df7 Add descriptors to listunspent and getaddressinfo + tests (Pieter Wuille)
9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable (Pieter Wuille)
225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others (Pieter Wuille)
4d78bd93b5 Add support for inferring descriptors from scripts (Pieter Wuille)

Pull request description:

  This PR adds functionality to convert a script to a descriptor, given a `SigningProvider` with the relevant information about public keys and redeemscripts/witnessscripts.

  The feature is exposed in `listunspent`, `getaddressinfo`, and `scantxoutset` whenever these calls are applied to solvable outputs/addresses.

  This is not very useful on its own, though when we add RPCs to import descriptors, or sign PSBTs using descriptors, these strings become a compact and standalone way of conveying everything necessary to sign an output (excluding private keys).

  Unit tests and rudimentary RPC tests are included (more relevant tests can be added once RPCs support descriptors).

  Fixes #14503.

Tree-SHA512: cb36b84a3e0200375b7e06a98c7e750cfaf95cf5de132cad59f7ec3cbd201f739427de0dc108f515be7aca203652089fbf5f24ed283d4553bddf23a3224ab31f
2018-11-27 12:22:41 -08:00
MarcoFalke 0fa3703c17
Merge #14820: test: Fix descriptor_tests not checking ToString output of public descriptors
c77f09230b Fix descriptor_tests not checking ToString output of public descriptors (Russell Yanofsky)

Pull request description:

  This fixes a minor test bug introduced in #13697 that I noticed while reviewing #14646

Tree-SHA512: efed91200cdff5f86ba5de3461ac00759d285e2905f6cb24cea15d3e23e0581ce5fc14b24a40db093f7ebd662ee1ee2cf67f8798bac1903a78298eda08909cfb
2018-11-27 15:09:59 -05:00
Russell Yanofsky c77f09230b Fix descriptor_tests not checking ToString output of public descriptors 2018-11-27 14:44:23 -05:00
MarcoFalke 1db0096f61 rpc: Pass argument descriptions to RPCHelpMan 2018-11-27 14:18:19 -05:00
MarcoFalke 8c119b2755
Merge #14813: qa: Add wallet_encryption error tests
fa739d4bd7 qa: Add wallet_encryption error tests (MarcoFalke)

Pull request description:

  The errors for empty passphrases are the help text of the RPC call, which is not very specific. Replace that with proper RPC errors and test them.

Tree-SHA512: 3137e0f8f2e42a1f8ab1eeb57c99052557725f6f85139ff48c24acc8f3cf4087802de5216f3ce97375b291d21bddb7cd1379a6f280166136a306a0c9663bbd42
2018-11-27 13:54:23 -05:00
MarcoFalke d491030076
Merge #14772: refactor: Convert comments to thread safety annotations
fa71eb5196 Convert comments to thread safety annotations (MarcoFalke)

Pull request description:

  Convert human-only-readable annotations to human-and-machine-readable annotations.

Tree-SHA512: 98a97b32b50e8ec816626ed853d56c9afb31065eb14f058cda8f22a16ddd2b0c02911f9e30478aa347f466891f972496d89a828eb6e4662fb712d7d9e7643d49
2018-11-27 12:43:37 -05:00
MarcoFalke fa739d4bd7
qa: Add wallet_encryption error tests 2018-11-26 16:12:13 -05:00
Pierre Rochard 14bc2a17dd Trivial: add doxygen-compatible comments relating to BerkeleyEnvironment 2018-11-26 12:20:35 -04:00
Pierre Rochard 88b1d956fe Tests: add unit tests for GetWalletEnv 2018-11-26 12:20:35 -04:00
Russell Yanofsky f1f4bb7345 Free BerkeleyEnvironment instances when not in use
Instead of adding BerkeleyEnvironment objects permanently to the g_dbenvs map,
use reference counted shared pointers and remove map entries when the last
BerkeleyEnvironment reference goes out of scope.

This change was requested by Matt Corallo <git@bluematt.me> and makes code that
sets up mock databases cleaner. The mock database environment will now go out
of scope and be reset on destruction so there is no need to call
BerkeleyEnvironment::Reset() during wallet construction to clear out prior
state.

This change does affect bitcoin behavior slightly. On startup, instead of same
wallet environments staying open throughout VerifyWallets() and OpenWallets()
calls, VerifyWallets() will open and close an environment once for each wallet,
and OpenWallets() will create its own environment(s) later.
2018-11-26 12:20:35 -04:00
Jameson Lopp 848077f94d
clarify RPC rawtransaction documentation 2018-11-26 09:58:29 -05:00
Hennadii Stepanov 0b4a5786bb
Use window() instead of obsolete topLevelWidget() 2018-11-25 11:32:59 +02:00
Ben Woosley 4a86a0acd9
Make SafeDbt DB_DBT_MALLOC on default initialization
If we're constructing the SafeDbt without provided data, it is always malloced,
so that is the case we expose.

Also run clang-format.
2018-11-24 21:05:48 -06:00
Jeremy Rubin e4eee7d09d Add Benchmark to test input de-duplication worst case
Fix nits

replace utiltime?
2018-11-25 10:53:20 +09:00
João Barbosa 6bbdb2077e squashme: connect thru node interface 2018-11-24 22:16:26 +00:00
Carl Dong dcb70b1522 Indicate -rpcauth option password hashing alg 2018-11-24 12:33:23 -08:00
João Barbosa 8d3f46ec39 http: Remove timeout to exit event loop
Let HTTP connections to timeout due to inactivity.
Let all remaning connections finish sending the response and close.
2018-11-23 16:54:22 +00:00
João Barbosa e98a9eede2 http: Remove unnecessary event_base_loopexit call
Let event base loop exit cleanly by processing all active and pending
events. The call is no longer necessary because closing persistent
connections is now properly handled.
2018-11-23 16:54:22 +00:00
João Barbosa 6b13580f4e http: Unlisten sockets after all workers quit
This (almost) move only ensures the event base loop doesn't exit before
HTTP worker threads exit. This way events registered by HTTP workers are
processed and not discarded.
2018-11-23 16:54:22 +00:00
João Barbosa 18e9685816 http: Send "Connection: close" header if shutdown is requested
Sending the header "Connection: close" makes libevent close persistent
connections (implicit with HTTP 1.1) which cleans the event base when
shutdown is requested.
2018-11-23 16:54:22 +00:00
João Barbosa 02e1e4eff6 rpc: Add wait argument to stop 2018-11-23 16:54:22 +00:00
practicalswift 958e1a307e streams: Remove unused seek(size_t) 2018-11-23 16:58:44 +01:00
Hennadii Stepanov 7514361254
Correct misleading "overridden options" label
Command-line options override values set in the configuration file and
configuration file options override values set in the GUI.
2018-11-23 15:40:16 +02:00
Wladimir J. van der Laan 59f05d1161
Merge #14521: qt, docs: Fix bitcoin-qt -version output formatting
60ae463a68 Fix `bitcoin-qt -version` output formatting (Hennadii Stepanov)

Pull request description:

  This PR makes command line output of `bitcoin-qt -version` formatted in the same way as `bitcoind -version` output.

  Before:
  ![screenshot from 2018-10-19 20-16-42](https://user-images.githubusercontent.com/32963518/47233718-434a2a80-d3dc-11e8-90d4-84dd23e8ac3b.png)

  After:
  ![screenshot from 2018-10-19 20-22-09](https://user-images.githubusercontent.com/32963518/47233888-b653a100-d3dc-11e8-9155-000b517a8e7b.png)

Tree-SHA512: fd8bd20e2108b9562bcbf6c094f950e867a5755994e8acc28b07e52fe73d04f783201c20bde47be2083ce89fb3ef9749f9c3757d479ad6c48ed09c633155f47e
2018-11-23 10:17:46 +01:00
Wladimir J. van der Laan 0595164dba
Merge #14678: [wallet] remove redundant KeyOriginInfo access, already done in CreateSig
b81a186056 GetPubKey: make sigdata const (Gregory Sanders)
f7beb95a1f remove redundant KeyOriginInfo access, already done in CreateSig (Gregory Sanders)

Pull request description:

  This redundancy is confusing as it looks like pubkeyhashes are special in some way based on where it's called.

Tree-SHA512: a980b7c774c6d69322945227a2b156489fb1991ebf57fe6f26096d5f8047f246a133debc241b05af67810f604b040079add3ab3d30d9e2928095905a2afe17eb
2018-11-23 10:13:03 +01:00
Wladimir J. van der Laan e3a1b74cdf
Merge #14448: doc: Clarify rpcwallet flag url change
0c69ff6171 clarify rpcwallet flag url change (Jordan Baczuk)

Pull request description:

  This adds clarification to the bitcoin-cli -rpcwallet flag in the help command. This will benefit users who want to utilize this feature without the cli, for example curl. It isn't readily apparent that this changes the url used in the RPC call.

Tree-SHA512: 6fc759f193f0a918884aab8ba4dc77ed9e89ee3840feeff737a754be758750590f5bd44b40f4810c3b82601e125e62e10360af45cb8e9d95be206ebeb9120ebf
2018-11-23 09:58:48 +01:00
Wladimir J. van der Laan 2479b779aa
Merge #14728: fix uninitialized read when stringifying an addrLocal
b7b36decaf fix uninitialized read when stringifying an addrLocal (Kaz Wesley)
8ebbef0169 add test demonstrating addrLocal UB (Kaz Wesley)

Pull request description:

  Reachable from either place where SetIP is used when all of:
  - our best-guess addrLocal for a peer is IPv4
  - the peer tells us it's reaching us at an IPv6 address
  - NET logging is enabled

  In that case, SetIP turns an IPv4 address into an IPv6 address without
  setting the scopeId, which is subsequently read in GetSockAddr during
  CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
  constructor initializes the scopeId field with something.

Tree-SHA512: 8f0159750995e08b985335ccf60a273ebd09003990bcf2c3838b550ed8dc2659552ac7611650e6dd8e29d786fe52ed57674f5880f2e18dc594a7a863134739e3
2018-11-23 09:53:20 +01:00
Wladimir J. van der Laan a0d86815cd
Merge #14726: Use RPCHelpMan for all RPCs
fa5e0452e8 rpc: Documentation fixups (MarcoFalke)
fa91e8eda5 Use RPCHelpMan for all RPCs (MarcoFalke)
fa520e72f7 lint: Must use RPCHelpMan to generate the RPC docs (MarcoFalke)

Pull request description:

  The resulting documentation should not change unless the type in the oneline-summary was previously incorrect. (E.g. string vs bool)

Tree-SHA512: 4ff355b6a53178f02781e97a7aca7ee1d0d97ff348b6bf5a01caa1c96904ee33c704465fae54c2cd7445097427fd04c71ad3779bb7a7ed886055ef36c1b5a1d0
2018-11-23 09:42:33 +01:00
João Barbosa a0f8df365d qt: Call noui_connect to prevent boost::signals2::no_slots_error in early calls to InitWarning 2018-11-22 17:41:01 +00:00
MarcoFalke 2a97f192ea
Merge #14771: test: Add BOOST_REQUIRE to getters returning optional
fa21ca09a8 test: Add BOOST_REQUIRE to getters returning optional (MarcoFalke)

Pull request description:

  Usually the returned value is already checked for equality, but for sanity we might as well require that the getter successfully returned.

Tree-SHA512: 0d613a9a721c61bd7a115ebc681a0890df09b8e5775f176ac18b3a586f2ca57bee0b5b816f5a7c314ff3ac6cbb2a4d9c434f8459e054a7c8a6934a75f0120c2a
2018-11-22 11:37:17 -05:00
Wladimir J. van der Laan e77a2258e4
Merge #14532: Never bind INADDR_ANY by default, and warn when doing so explicitly
27c44ef9c6 rpcbind: Warn about exposing RPC to untrusted networks (Luke Dashjr)
d6a1287481 CNetAddr: Add IsBindAny method to check for INADDR_ANY (Luke Dashjr)
3615003952 net: Always default rpcbind to localhost, never "all interfaces" (Luke Dashjr)

Pull request description:

  A disturbingly large number of listening nodes appear to be also exposing their RPC server to the public internet. To attempt to mitigate this:

  * Only ever bind localhost by default, even if `rpcallowip` is specified. (A warning is given if `rpcallowip` is specified without `rpcbind`, since it doesn't really make sense to do.)
  * Warn about exposing the RPC server to untrusted networks if the user explicitly binds to any INADDR_ANY address.
  * Include a warning about untrusted networks in the `--help` documentation for `rpcbind`.

Tree-SHA512: 755bbca3db416a31393672eccf6675a5ee4d1eb1812cba73ebb4ff8c6b855ecc5df4c692566e9aa7b0f7d4dce6fedb9c0e9f3c265b9663aca36c4a6ba5efdbd4
2018-11-22 10:53:16 +01:00
Wladimir J. van der Laan e736b67467
Merge #14715: Drop defunct prevector compat handling
69ca48717c Implement prevector::fill once (Ben Woosley)
7bad78c2c8 Drop defunct IS_TRIVIALLY_CONSTRUCTIBLE handling from prevector.h (Ben Woosley)

Pull request description:

  This is clean-up post #14651:
  * Use one implementation of `prevector::fill`, as it's possible now that the implementations are identical.
  * Only apply the `IS_TRIVIALLY_CONSTRUCTIBLE` handling to the bench file where it is used, and drop the now-unnecessary associated compat includes.

Tree-SHA512: 5930b3a17fccd39af10add40202ad97a297aebecc049af72ca920d0d55b3e4c3c30ce864c8a683355895f0196396d4ea56ba9f9637bdc7d16964cdf66c195485
2018-11-22 10:50:38 +01:00
Luke Dashjr 27c44ef9c6 rpcbind: Warn about exposing RPC to untrusted networks 2018-11-22 01:44:59 +00:00
Luke Dashjr d6a1287481 CNetAddr: Add IsBindAny method to check for INADDR_ANY 2018-11-22 01:44:59 +00:00
Luke Dashjr 3615003952 net: Always default rpcbind to localhost, never "all interfaces"
We don't support binding to untrusted networks, so avoid a default where that is typical
2018-11-22 01:44:59 +00:00
Wladimir J. van der Laan d7b0258ff0
Merge #14708: Warn unrecognised sections in the config file
3fb09b9889 Warn unrecognized sections in the config file (Akio Nakamura)

Pull request description:

  This PR intends to resolve #14702.

  In the config file, sections are specified by square bracket pair "[]"$,
  or included in the option name itself which separated by a period"(.)".

  Typicaly, [testnet] is not a correct section name and specified options
  in that section are ignored but user cannot recognize what is happen.

  So, add some log-warning messages if unrecognized section names are
  present in the config file after checking section only args.

  note: Currentry, followings are out of scope of this PR.
  1) Empty section name or option name can describe.
  e.g. [] , .a=b, =c
  2) Multiple period characters can exist in the section name and option name.
  e.g. [c.d.e], [..], f.g.h.i=j, ..=k

Tree-SHA512: 2cea02a0525feb40320613989a75cd7b7b1bd12158d5e6f3174ca77e6a25bb84425dd8812f62483df9fc482045c7b5402d69bc714430518b1847d055a2dc304b
2018-11-21 19:37:22 +01:00
MarcoFalke fa71eb5196
Convert comments to thread safety annotations 2018-11-20 20:29:16 -05:00
MarcoFalke fa21ca09a8
test: Add BOOST_REQUIRE to getters returning optional 2018-11-20 19:51:49 -05:00
Wladimir J. van der Laan afa506f6eb
Merge #14552: wallet: detecting duplicate wallet by comparing the db filename.
591203149f wallet: Create IsDatabaseLoaded function (Chun Kuan Lee)
15c93f075a wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. (Chun Kuan Lee)
c456fbd8df Refactor: Move m_db pointers into BerkeleyDatabase (Russell Yanofsky)

Pull request description:

  Fix #14538

  Fix crash attempting to load the same wallet with different path strings that resolve to the same absolute path. The primary check which prevents loading the same wallet twice is:

  6b8d0a2164/src/wallet/db.cpp (L44)

  But this check is skipped if both wallet paths resolve to the same absolute path, due to caching here:

  6b8d0a2164/src/wallet/db.cpp (L467)

  Meanwhile a secondary check for duplicate wallets is not reliable because it based on a literal comparison, instead of comparison using absolute paths:

  6b8d0a2164/src/wallet/wallet.cpp (L3853)

  This PR fixes the latter check to compare the absolute path of a new wallet being loaded to absolute paths of wallets already loaded, so there should no longer be any way to load the same wallet more than once.

Tree-SHA512: 2fa01811c160b57be3b76c6b4983556a04bbce71a3f8202429987ec020664a062e897deedcd9248bc04e9baaa2fc7b464e2595dcaeff2af0818387bf1fcdbf6f
2018-11-20 15:15:59 +01:00
Akio Nakamura 3fb09b9889 Warn unrecognized sections in the config file
In the config file, sections are specified by square bracket pair "[]"$,
or included in the option name itself which separated by a period"(.)".

Typicaly, [testnet] is not a correct section name and specified options
in that section are ignored but user cannot recognize what is happen.

So, add some log/stderr-warning messages if unrecognized section names
are present in the config file after checking section only args.
2018-11-20 18:28:16 +09:00
Karl-Johan Alm e816b341ab
revert removal of fstream.hpp header in fs.h
This is required for some architectures.
2018-11-20 14:41:12 +09:00
MarcoFalke 09f1d7fe72
Merge #14718: Remove unreferenced boost headers
c54e5a41c4 Remove unreferenced boost headers (Murray Nesbitt)

Pull request description:

  Building with clang (e.g. on FreeBSD) is very noisy due to `-Wthread-safety-analysis` warnings regarding boost. This change removes a number of unnecessary boost includes, and silences the rest of the warnings when building with clang. This allows more potentially interesting warnings to surface from the noise.

  Tested on FreeBSD 11.2

Tree-SHA512: 5e6a0623188b9be59aeae52866799aefb4c3c9ab5e569b07ee8d43fc92e0b5f1f76b96bb54c35c7043148df84641b4a96927fb71f6eb00460c20cd19cf250900
2018-11-19 13:50:16 -05:00
João Barbosa 4674610300 Log env path in BerkeleyEnvironment::Flush 2018-11-19 16:02:06 +00:00
Wladimir J. van der Laan 6d58a5c3b0
Merge #14685: fix a deserialization overflow edge case
b08af10fb2 disallow oversized CBlockHeaderAndShortTxIDs (Kaz Wesley)
6bed4b374d fix a deserialization overflow edge case (Kaz Wesley)
051faf7e9d add a test demonstrating an overflow in a deserialization edge case (Kaz Wesley)

Pull request description:

  A specially-constructed BlockTransactionsRequest can cause `offset` to wrap in deserialization. In the current code, there is not any way this could be dangerous; but disallowing it reduces the potential for future surprises.

Tree-SHA512: 1aaf7636e0801a905ed8807d0d1762132ac8b4421a600c35fb6d5e5033c6bfb587d8668cd9f48c7a08a2ae793a677b7649661e3ae248ab4f8499ab7b6ede483c
2018-11-18 10:15:18 +01:00
Murray Nesbitt c54e5a41c4 Remove unreferenced boost headers 2018-11-16 03:20:44 +00:00
Kaz Wesley b7b36decaf fix uninitialized read when stringifying an addrLocal
Reachable from either place where SetIP is used when our best-guess
addrLocal for a peer is IPv4, but the peer tells us it's reaching us at
an IPv6 address.

In that case, SetIP turns an IPv4 address into an IPv6 address without
setting the scopeId, which is subsequently read in GetSockAddr during
CNetAddr::ToStringIP and passed to getnameinfo. Fix by ensuring every
constructor initializes the scopeId field with something.
2018-11-15 13:47:53 -08:00
Kaz Wesley 8ebbef0169 add test demonstrating addrLocal UB 2018-11-15 13:47:53 -08:00
MarcoFalke 384967f311
Merge #13815: util: Add [[nodiscard]] to all {Decode,Parse}[...](...) functions returning bool
9cc0230cfc Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. (practicalswift)
579497e77a tests: Explicitly ignore the return value of DecodeBase58(...) (practicalswift)
145fe95ec7 tests: Check return value of ParseParameters(...) (practicalswift)
7c5bc2a523 miner: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse -blockmintxfee (practicalswift)

Pull request description:

  Changes in this PR:
  * ~~Add linter to make sure the return value of `Parse[...](...)` is checked~~
  * Add `__attribute__((warn_unused_result))` to all `{Decode,Parse}[...](...)` functions returning `bool`
  * Fix violations

  Context:
  * #13712: `wallet: Fix non-determinism in ParseHDKeypath(...). Avoid using an uninitialized variable in path calculation.` would have been prevented by this

Tree-SHA512: 41a97899f2d5a26584235fa02b1ebfb4faacd81ea97e927022955a658fa7e15d07a1443b4b7635151a43259a1adf8f2f4de3c1c75d7b5f09f0d5496463a1dae6
2018-11-15 14:39:37 -05:00
MarcoFalke fa5e0452e8
rpc: Documentation fixups 2018-11-15 12:19:11 -05:00
Pieter Wuille b65326b562 Add matching descriptors to scantxoutset output + tests 2018-11-14 14:21:42 -08:00
Pieter Wuille 16203d5df7 Add descriptors to listunspent and getaddressinfo + tests 2018-11-14 14:21:42 -08:00
MarcoFalke fa91e8eda5
Use RPCHelpMan for all RPCs 2018-11-14 15:33:15 -05:00
Ben Woosley 69ca48717c
Implement prevector::fill once
Now that the implementation is identical, we can use a default value to
distinguish them.
2018-11-14 12:19:28 -05:00
Ben Woosley 7bad78c2c8
Drop defunct IS_TRIVIALLY_CONSTRUCTIBLE handling from prevector.h
It's now only referenced from the bench, so leave it there. This allows us to
drop the associated includes as well.
2018-11-14 12:19:04 -05:00
MarcoFalke e74649e951
Merge #14411: [wallet] Restore ability to list incoming transactions by label
da427dbd48 Rename ListTransactions filter variable (Russell Yanofsky)
65b740f92b [wallet] Restore ability to list incoming transactions by label (Russell Yanofsky)

Pull request description:

  This change partially reverts #13075 and #14023.

  Fixes #14382

Tree-SHA512: 8c4e56104b3a45784cdc06bae8e5facdfff04fe3545b63a35e0ec2e440a41b79d84833ca4c4e728d8af7ebb8a519303a9eda7bee4bbfb92bd50c58587a33eb30
2018-11-14 11:59:41 -05:00
MarcoFalke c7366d2399
Merge #14478: Show error to user when corrupt wallet unlock fails
b4f6e58ca5 Better error message for user when corrupt wallet unlock fails (MeshCollider)

Pull request description:

  Mentioned here: https://github.com/bitcoin/bitcoin/issues/14461#issuecomment-429183503

  Current behavior is to assert(false) and crash, only info is printed in the log. This shows the message to the user before abort() instead.

Tree-SHA512: 526f9ed9262257fca55caf7153ab913ed958b13b079d2f01db797485614d8c375815a1554276e8cf73d3838104b2691a9cf85c8d097973127ae8de9e111446bf
2018-11-14 11:27:01 -05:00
Hennadii Stepanov 2bc3f114d0
Bump the minimum Qt version to 5.2 2018-11-14 01:32:51 +02:00
Russell Yanofsky da427dbd48 Rename ListTransactions filter variable
Suggested by MeshCollider <dobsonsa68@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/14411#discussion_r232134086
2018-11-13 16:49:23 -05:00
MarcoFalke 8c59bb85f9
Merge #14720: rpc: Correctly name arguments
fa0815c300 rpc: Correctly name arguments (Jon Layton)

Pull request description:

  Consistently use the same name to describe arguments in the documentation and add a test that uses the name.

  By splitting it up, the changes are easier to potentially backport and also make review easier when we switch to `RPCHelpMan`.

  The tests should pass with or without the changes in `src`.

  Partly stolen from #14459 (More RPC help description fixes by ch4ot1c)

Tree-SHA512: 1072992b1e93ac41006613523e54a0a8004f529fcb101eb9d74d91474abb0945a5a7539f249905151b904b87448f9efc0cacbd9e052fbe2ea9111e62f3e7249c
2018-11-13 16:49:23 -05:00
Russell Yanofsky 65b740f92b [wallet] Restore ability to list incoming transactions by label
This change partially reverts #13075 and #14023.

Fixes #14382
2018-11-13 17:49:23 -04:00
Kaz Wesley b08af10fb2 disallow oversized CBlockHeaderAndShortTxIDs
Otherwise we'd reply with a bogus BlockTransactionsRequest trying to
request indexes with overflowed deltas.
2018-11-13 12:41:41 -08:00
Wladimir J. van der Laan f617e05c38
Merge #14679: importmulti: Don't add internal addresses to address book
7afddfa8ce importmulti: Don't add internal addresses to address book (Gregory Sanders)

Pull request description:

  Currently anything imported with `internal` will not be treated as change since checking the address book is a primary test of this.

  Added basic tests of all combinations of arguments and change identification.

  Resolves https://github.com/bitcoin/bitcoin/issues/14662

Tree-SHA512: a1f08dc624a3fadee93cc5392d50c4796b0c5eedf38e295382f71570f2066d9e978ed6e3962084b902989863fe1273a8642d8fdb094a266d69de10622a4176b0
2018-11-13 21:34:23 +01:00
Kaz Wesley 6bed4b374d fix a deserialization overflow edge case
A specially-constructed BlockTransactionsRequest can overflow in
deserialization in a way that is currently harmless.
2018-11-13 12:14:34 -08:00
Kaz Wesley 051faf7e9d add a test demonstrating an overflow in a deserialization edge case
Also add a test that the highest legal index is accepted.
2018-11-13 12:14:08 -08:00
Jon Layton fa0815c300
rpc: Correctly name arguments 2018-11-13 14:24:40 -05:00
Ben Woosley bd3b0361d8
Add stop_block out arg to ScanForWalletTransactions
Accurately reports the last block successfully scanned, replacing a return of
the chain tip, which represented possibly inaccurated data in a race condition.
2018-11-13 12:51:16 -05:00
MarcoFalke c651265c93
Merge #14530: Use RPCHelpMan to generate RPC doc strings
fa483e13b3 rpc: Add RPCHelpMan for machine-generated help (MarcoFalke)
fa0d36f712 rpc: Include rpc/util.h where needed for RPCHelpMan (MarcoFalke)

Pull request description:

  This introduces a manager for the RPC help generation and demonstrates its use of it in some RPCs.

  It is the first non-exhaustive step toward #14378 and I will create pull requests for the next steps after this one is merged.

Tree-SHA512: 86f68322443ff01cd964aaf0ebe186be63fbebe4c47676cf7a622cc2b5305fd176bd57badfd1bbf788a036812253eb0dead74ecc3b30664c3e0d9392b2248054
2018-11-13 12:34:50 -05:00
Gregory Sanders b81a186056 GetPubKey: make sigdata const 2018-11-13 10:42:10 -05:00
Wladimir J. van der Laan c51e1516a9
Merge #14714: util.h: explicitly include required QString header
27154ce765 util.h: explicitly include required QString header (1Il1)

Pull request description:

  Alternative to #14713.

  Instead of depending on clang formatter to not reorder includes, another fix is to explicitly include the missing header file.

Tree-SHA512: f419ef2fd1dfd8da28160a94d187af78463fb398ef6aadd6c68ebf57e6d02380d93f5f370bf2d39e88dcbfeb252c3e5f245c0a157c7d0a64c38fc0f0c7004515
2018-11-13 14:52:03 +01:00
Wladimir J. van der Laan ce7fcc3569
Merge #14690: Throw error if CPubKey is invalid during PSBT keypath serialization
4e4de10f69 Throw error if CPubKey is invalid during PSBT keypath serialization (Gregory Sanders)

Pull request description:

  Related to https://github.com/bitcoin/bitcoin/pull/14689

  We should catch this error before attempting to deserialize it later.

Tree-SHA512: d2f3ea7f363818ac70c81ee988231b2bb50d055b6919f7bff3f27120c85a7048bfa183efae33e23e6b81d684bcb8bb81e5b209abb3acbcaff1d88014f4f1aa93
2018-11-13 13:44:09 +01:00
Jonas Schnelli 083f535470
Merge #14608: qt: Remove the "Pay only required fee..." checkbox
a16f44c04 qt: Remove "Pay only required fee" checkbox (Hennadii Stepanov)
8711cc0c7 qt: Improve BitcoinAmountField class (Hennadii Stepanov)

Pull request description:

  Ref #13280
  This PR removes the "Pay only the required fee..." checkbox from the custom transaction fee section in the "Send" tab. Instead, a minimum value will be enforced on the custom fee input box.

  All comments from #13280 are addressed.

  Before:
  ![screenshot from 2018-10-30 16-42-18](https://user-images.githubusercontent.com/32963518/47726622-866d8e80-dc63-11e8-8670-3f97ff0fa5da.png)

  After:
  ![screenshot from 2018-10-30 16-40-37](https://user-images.githubusercontent.com/32963518/47726633-8f5e6000-dc63-11e8-82cf-5b9ff4aae91d.png)

  cc: @promag @MarcoFalke @Sjors

Tree-SHA512: 073577d38d8353b10e8f36fb52e3c6e81dd45d25d84df9b9e4f78f452ff0bdbff3e225bdd6122b5a03839ffdcc2a2a08175f81c2541cf2d12918536abbfa3fd1
2018-11-13 15:44:11 +07:00
Jonas Schnelli b60f4e3f09
Merge #13381: RPC: creates possibility to preserve labels on importprivkey
a6b5ec18f rpc: creates possibility to preserve labels on importprivkey (marcoagner)

Pull request description:

  Closes #13087.

  As discussed in the issue, this is a feature request instead of a bug report since the behaviour was as intended (i.e. label with default: `''`). With this, the old behaviour is kept while the possibility to achieve the preservation of labels, as expected in the open issue, is added.

Tree-SHA512: b33be50e1e7f62f7ddfae953177ba0926e2d848961f9fac7501c2b513322c0cb95787745d07d137488267bad1104ecfdbe800c6747f94162eb07c976835c1386
2018-11-13 14:52:01 +07:00
1Il1 27154ce765
util.h: explicitly include required QString header 2018-11-13 16:49:34 +09:00
Ben Woosley 3002d6cf31
Return a status enum from ScanForWalletTransactions
Return the failed block as an out var.

This clarifies the outcome as the prior return value could
be null due to user abort or failure.
2018-11-13 00:04:13 -05:00
Ben Woosley bb24d68650
Make CWallet::ScanForWalletTransactions args and return value const 2018-11-13 00:01:14 -05:00
Ben Woosley 1a9f9f7e5e
Introduce SafeDbt to handle DB_DBT_MALLOC raii-style
This provides additional exception-safety and case handling for the proper
freeing of the associated buffers.
2018-11-12 18:43:52 -05:00
Gregory Sanders f7beb95a1f remove redundant KeyOriginInfo access, already done in CreateSig 2018-11-12 13:17:49 -05:00
Wladimir J. van der Laan 47ed24cf8a
Merge #14356: fix converttopsbt permitsigdata arg, add basic test
88a79cb436 fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders)

Pull request description:

  The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

  Resolves https://github.com/bitcoin/bitcoin/issues/14355

Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
2018-11-12 19:14:13 +01:00
Gregory Sanders 0fb2e69815 CreateTransaction: Assume minimum p2sh-p2wpkh spend size for unknown change 2018-11-12 13:12:09 -05:00
Gregory Sanders b06483c96a Remove stale comment in CalculateMaximumSignedInputSize 2018-11-12 13:10:54 -05:00
MarcoFalke fa483e13b3
rpc: Add RPCHelpMan for machine-generated help 2018-11-12 11:11:17 -05:00
Wladimir J. van der Laan 90c0b6aca2
Merge #14494: Error if # is used in rpcpassword in conf
0385109444 Add test for rpcpassword hash error (MeshCollider)
13fe258e91 Error if rpcpassword in conf contains a hash character (MeshCollider)

Pull request description:

  Fixes #13143 now #13482 was merged

Tree-SHA512: e7d00c8df1657f6b8d0eee1e06b9ce2b1b0a2de487377699382c1b057836e1571dac313ca878b5877c862f0461ba789a50b239d2a9f34accd8a6321f126e3d2a
2018-11-12 15:23:27 +01:00
Wladimir J. van der Laan 5cdfd72b17
Merge #14228: Qt: Enable system tray icon by default if available
ec1201a368 Don't use systray icon on inappropriate systems (Hennadii Stepanov)

Pull request description:

  Prevent a user from losing access to the main window by minimizing it to the tray on the systems which have not “system tray” or “notification area” available (e.g. GNOME 3.26+).

  Tested on Fedora 28 + GNOME 3.28.

Tree-SHA512: c2dc26ff31c38a882dbd7d1ff71af99f1ba38a04a1c8b7fe7b99b93e4c0719f2916c7db0e620806a36582402d18939c635e1913c276b452ecbf939936067407b
2018-11-12 15:08:06 +01:00
Wladimir J. van der Laan 48223256cf
Merge #14123: gui: Add GUIUtil::bringToFront
0a656f85a9 qt: All tray menu actions call showNormalIfMinimized (João Barbosa)
6fc21aca6d qt: Use GUIUtil::bringToFront where possible (João Barbosa)
5796671e1d qt: Add GUIUtil::bringToFront (João Barbosa)
6b1d2972bf Remove obj_c for macOS Dock icon menu (Hennadii Stepanov)
2464925e7b Use Qt signal for macOS Dock icon click event (Hennadii Stepanov)
53bb6be3f8 Remove obj_c for macOS Dock icon setting (Hennadii Stepanov)

Pull request description:

  The sequence `show -> raise -> activateWindow` is factored out to the new function `GUIUtil::bringToFront` where a macOS fix is added in order to fix #13829.

  Also included:
   - simplification of `BitcoinGUI::showNormalIfMinimized`
   - simplified some connections to `BitcoinGUI::showNormalIfMinimized`
   - added missing connections to `BitcoinGUI::showNormalIfMinimized`.

Tree-SHA512: a8e301aebc359aa353821e2af352ae356f44555724921b01da907e128653ef9dc55d8764a1bff72a579e5ff96df8a681f6804bfe83acba441da92fedff974a55
2018-11-12 14:52:35 +01:00
Wladimir J. van der Laan ae32806ea2
Merge #14651: Refactor: Fix compiler warning in prevector.h
76e13b586f warnings: Compiler warning on memset usage for non-trivial type (Lenny Maiorani)

Pull request description:

  Fixing warnings reported by GCC: memset of non-trivial type

Tree-SHA512: 357aeac60acfb922851daaf0bd8d4b81e377da7c9b31c2942b54cfdd4129dae61e577fc0a6aa430348cb07abd16ae32f986a64dbb2c1d90ec148f53e7451a229
2018-11-12 13:43:56 +01:00
Wladimir J. van der Laan edc715240c
Merge #12783: macOS: disable AppNap during sync
1e0f3c4499 macOS: disable AppNap during sync (Alexey Ivanov)

Pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315
2018-11-10 10:37:59 +01:00
Pieter Wuille 16e3b17578
Merge #14689: Require a public key to be retrieved when signing a P2PKH input
6b8d86ddb8 Require a public key to be retrieved when signing a P2PKH input (Andrew Chow)

Pull request description:

  If we do not have the public key for a P2PKH input, we should not continue to attempt to sign for it.

  This fixes a problem where a PSBT with a P2PKH output would include invalid BIP 32 derivation paths that are missing the public key.

Tree-SHA512: 850d5e74c06833da937d5bf0348bd134180be7167b6f9b9cecbf09f75e3543fbad60d0abbc0b9afdfa51ce165aa36168849f24a7c5abf1e75f37ce8f9a13d127
2018-11-09 20:14:28 -08:00
Pieter Wuille b30c62d4b9
Merge #14588: Refactor PSBT signing logic to enforce invariant and fix signing bug
e13fea975d Add regression test for PSBT signing bug #14473 (Glenn Willen)
565500508a Refactor PSBTInput signing to enforce invariant (Glenn Willen)
0f5bda2bd9 Simplify arguments to SignPSBTInput (Glenn Willen)
53e6fffb8f Add bool PSBTInputSigned (Glenn Willen)
65166d4cf8 New PartiallySignedTransaction constructor from CTransction (Glenn Willen)
4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT (Glenn Willen)
fe5d22bc67 More concise conversion of CDataStream to string (Glenn Willen)

Pull request description:

  As discussed in the comments on #14473, I think that bug was caused primarily by failure to adhere to the invariant that a PSBTInput always has exactly one of the two utxo fields present -- an invariant that is already enforced by PSBTInput::IsSane, but which we were temporarily suspending during signing.

  This refactor repairs the invariant, also fixing the bug. It also simplifies some other code, and removes redundant parameters from some related functions.

  fixes #14473

Tree-SHA512: cbad3428175e30f9b7bac3f600668dd1a8f9acde16b915d27a940a2fa6d5149d4fbe236d5808fd590fb20a032274c99e8cac34bef17f79a53fdf69a5948c0fd0
2018-11-09 19:43:09 -08:00
MeshCollider b4f6e58ca5 Better error message for user when corrupt wallet unlock fails 2018-11-10 15:07:20 +13:00
MarcoFalke fa0d36f712
rpc: Include rpc/util.h where needed for RPCHelpMan
Just a preparatory commit to add the header to the includes and run
clang-format to sort the include lists.

Splitting this up into a separate commit makes future scripted-diffs
easier.
2018-11-09 12:37:06 -05:00
MarcoFalke cbf00939b5
Merge #14437: Refactor: Start to separate wallet from node
081accb875 Pass chain locked variables where needed (Russell Yanofsky)
79d579f4e1 Remove uses of cs_main in wallet code (Russell Yanofsky)
ea961c3d72 Remove direct node->wallet calls in init.cpp (Russell Yanofsky)
8db11dd0b1 Pass chain and client variables where needed (Russell Yanofsky)
7e2e62cf7c Add skeleton chain and client classes (Russell Yanofsky)

Pull request description:

  This creates an incomplete [`Chain`](https://github.com/ryanofsky/bitcoin/blob/pr/wipc-sep/src/interfaces/chain.h) interface in [`src/interfaces/`](https://github.com/ryanofsky/bitcoin/tree/pr/wipc-sep/src/interfaces) and begins to update wallet code to use it.

  #10973 builds on this, changing the wallet to use the new interface to access chain state, instead of using CBlockIndex pointers and global variables like `chainActive`.

Tree-SHA512: 6ef05a4d8ebf57f2ad71835e4d970c9c59e34057e39e48cee76b887492c2fee907e3f6a74a9861e5a9f97cdc6823f4865ebc41ec556ab371ebca1b664c20dbea
2018-11-09 10:02:22 -05:00
MarcoFalke e70a19e713
Merge #14684: [doc] conf: Remove deprecated options from docs, Other cleanup
fa4da3c058 [doc] conf: Remove deprecated options from docs, Other cleanup (MarcoFalke)

Pull request description:

  Some dumb fixes, like removing the mention that free transactions are still a thing or that rpcuser/pass should be used (as opposed to rpcauth or rpc cookie).

  Combined with other fixes because I don't want to create 3 pull requests:
  * conf: Remove deprecated options from docs
  * Remove only mention of MIT/X11
  * Link to developer notes in README.md

Tree-SHA512: 9e45dc6c63037e7618cf3c871d7d9e65b66f1a952f91a6e623d97d90171e29bc40299a06029c4dc21a0f579e68021e3663186bd3a65e3ab333aff711f7dcb2bf
2018-11-08 12:56:40 -05:00
Gregory Sanders 4e4de10f69 Throw error if CPubKey is invalid during PSBT keypath serialization 2018-11-08 10:51:20 -05:00
Andrew Chow 6b8d86ddb8 Require a public key to be retrieved when signing a P2PKH input
If we do not have the public key for a P2PKH input, we should not
continue to attempt to sign for it.
2018-11-08 10:38:43 -05:00
Chun Kuan Lee 591203149f wallet: Create IsDatabaseLoaded function 2018-11-08 11:54:37 +08:00
Chun Kuan Lee 7a90b1b9d8 build: Fix windows build error if --disable-bip70 2018-11-08 05:03:14 +08:00
MarcoFalke 11e1ac3ae0
Merge #14436: doc: add comment explaining recentRejects-DoS behavior
b191c7dfb7 doc: add comment explaining recentRejects-DoS behavior (James O'Beirne)

Pull request description:

  When we receive invalid txs for the first time, we mark the sender as
  misbehaving. If we receive the same tx before a new block is seen, we *don't*
  punish the second sender (in the same way we do the original sender). It wasn't
  initially clear to me that this is intentional, so add a clarifying comment.

Tree-SHA512: d12c674db137ed3ad83e0b941bffe6ddcd2982238048742afa574a4235881f0e58cfc0a4a576a0503e74c5c5240c270b9520fa30221e8b43a371fb3e0b37066b
2018-11-07 14:59:35 -05:00
Gregory Sanders 7afddfa8ce importmulti: Don't add internal addresses to address book 2018-11-07 14:43:14 -05:00
MarcoFalke fa4da3c058
[doc] conf: Remove deprecated options from docs, Other cleanup
* conf: Remove deprecated options from docs
* Remove only mention of MIT/X11
* Link to developer notes in README.md
2018-11-07 13:30:03 -05:00
MarcoFalke e8d490f27e
Merge #14636: Avoid using numeric_limits for sequence numbers and lock times
535203075e Avoid using numeric_limits for sequence numbers and lock times (Russell Yanofsky)
bafb921507 Remove duplicated code (Hennadii Stepanov)
e4dc39b3bc Replace platform dependent type with proper const (Hennadii Stepanov)

Pull request description:

  Switches to named constants, because numeric_limits calls can be harder to read and less portable.

  Change was suggested by jamesob in https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620

  There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where `SignalsOptInRBF` and `MutateTxAddInput` functions would now work correctly.

Tree-SHA512: 3f5c6393c260551f65a0edfba55ef7eb3625232eec8d85b1457f26e144aa0b90c7ef5f44b2fd2f7d9be3c3bcb301030a9f5473c21b3bac566cc59b8c8780737c
2018-11-07 11:15:22 -05:00
Jim Posen c30620983d blockfilter: Additional constructors for BlockFilter. 2018-11-06 09:12:54 -08:00
Jim Posen 20b812993a blockfilter: Refactor GCS params into struct. 2018-11-06 09:12:54 -08:00
practicalswift 587924f000 Use IsSpace(...) instead of boost::is_space 2018-11-06 17:32:13 +01:00
practicalswift c5fd143edb Use ToLower(...) instead of std::tolower 2018-11-06 17:32:13 +01:00
practicalswift e70cc8983c Use IsDigit(...) instead of std::isdigit 2018-11-06 17:32:08 +01:00
Russell Yanofsky 081accb875 Pass chain locked variables where needed
This commit does not change behavior. All it does is pass new function
parameters.

It is easiest to review this change with:

    git log -p -n1 -U0 --word-diff-regex=.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 79d579f4e1 Remove uses of cs_main in wallet code
This commit does not change behavior.

It is easiest to review this change with:

    git log -p -n1 -U0
2018-11-06 11:44:40 -04:00
Russell Yanofsky ea961c3d72 Remove direct node->wallet calls in init.cpp
Route calls during node initialization and shutdown that would happen between a
node process and wallet processes through the serializable `Chain::Client`
interface, rather than `WalletInitInterface` which is now simpler and only
deals with early initialization and parameter interaction.

This commit mostly does not change behavior. The only change is that the
"Wallet disabled!" and "No wallet support compiled in!" messages are now logged
earlier during startup.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 8db11dd0b1 Pass chain and client variables where needed
This commit does not change behavior. All it does is pass new function
parameters.

It is easiest to review this change with:

    git log -p -n1 -U0 --word-diff-regex=.
2018-11-06 11:44:40 -04:00
Russell Yanofsky 7e2e62cf7c Add skeleton chain and client classes
This commit does not change behavior. It just adds new skeleton classes that
don't do anything and aren't instantiated yet.
2018-11-06 11:44:40 -04:00
Wladimir J. van der Laan 880bc728b4
Merge #14074: Use std::unordered_set instead of set in blockfilter interface
fef5adcc33 blockfilter: Use unordered_set instead of set in blockfilter. (Jim Posen)
4fb789e9b2 Extract CSipHasher to it's own file in crypto/ directory. (Jim Posen)

Pull request description:

  Use `std::unordered_set` (hash set) instead of `std::set` (tree set) in blockfilter interface, as suggested by @ryanofsky in #12254. This may result in a very minor speedup, but I haven't measured.

  This moves `CSipHasher` to it's own file `crypto/siphash.h`, so that it can be used in the libbitcoin_util library without including `hash.{h,cpp}`. I'm open to other suggestions on solving this issue if people would prefer to leave CSipHasher where it is.

Tree-SHA512: 593d1abda771e45f2860d5334272980d20df0b81925a402bb9ee875e17595c2517c0d8ac9c579218b84bbf66e15b49418241c1fe9f9265719bcd2377b0cd0d88
2018-11-06 15:36:20 +01:00
Chun Kuan Lee 15c93f075a wallet: Add trailing wallet.dat when detecting duplicate wallet if it's a directory. 2018-11-06 08:28:02 +08:00
Russell Yanofsky c456fbd8df Refactor: Move m_db pointers into BerkeleyDatabase
This is a refactoring change that doesn't affect behavior. The motivation
behind the change is give BerkeleyEnvironment objects access to
BerkeleyDatabase objects so it will be possible to simplify the duplicate
wallet check and more reliably avoid opening the same databases twice.
2018-11-06 08:28:02 +08:00
MeshCollider 13fe258e91 Error if rpcpassword in conf contains a hash character 2018-11-06 12:35:07 +13:00
Jim Posen fef5adcc33 blockfilter: Use unordered_set instead of set in blockfilter. 2018-11-05 09:30:56 -08:00
Jim Posen 4fb789e9b2 Extract CSipHasher to it's own file in crypto/ directory.
This is a move-only commit with the exception of changes to includes.
2018-11-05 09:25:15 -08:00
practicalswift 9cc0230cfc Add NODISCARD to all {Decode,Parse}[...](...) functions returning bool. Sort includes. 2018-11-05 17:03:11 +01:00
practicalswift 579497e77a tests: Explicitly ignore the return value of DecodeBase58(...) 2018-11-05 16:52:59 +01:00
practicalswift 145fe95ec7 tests: Check return value of ParseParameters(...) 2018-11-05 16:52:59 +01:00
practicalswift 7c5bc2a523 miner: Default to DEFAULT_BLOCK_MIN_TX_FEE if unable to parse -blockmintxfee 2018-11-05 16:52:59 +01:00
ken2812221 b6022149ec
trivial: Don't translate in help text 2018-11-05 23:23:28 +08:00
MarcoFalke 73a8408bc3
Merge #14092: tests: Dry run bench_bitcoin as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code
dfef0df840 tests: Dry run bench_bitcoin (-evals=1 -scaling=0: <1 second running time) as part "make check" to allow for quick identification of assertion/sanitizer failures in benchmarking code (practicalswift)
00c6306a61 Remove RUN_BENCH logic (practicalswift)

Pull request description:

  Dry run `bench_bitcoin` (`-evals=1 -scaling=0`: <1 second running time) as part `make check` to allow for quick identification of assertion/sanitizer failures or crashes in benchmarking code.

  This is already tested in Travis but it is nice to have it locally too. The cost is near zero.

Tree-SHA512: 1f51b86b34bf97f75785f2694891d80f1bfb3e050211e6f6c35d8d9bc80c75bdebaa5ebfa51855ac0cf76d8773c3026bc576f60d0227afb0e646d728b83abde7
2018-11-05 09:31:01 -05:00
Wladimir J. van der Laan dac2caa371
Merge #14060: ZMQ: add options to configure outbound message high water mark, aka SNDHWM
a4edb168b6 ZMQ: add options to configure outbound message high water mark, aka SNDHWM (mruddy)

Pull request description:

  ZMQ: add options to configure outbound message high water mark, aka SNDHWM

  This is my attempt at https://github.com/bitcoin/bitcoin/pull/13315

Tree-SHA512: a4cc3bcf179776899261a97c8c4f31f35d1d8950fd71a09a79c5c064879b38e600b26824c89c4091d941502ed5b0255390882f7d44baf9e6dc49d685a86e8edb
2018-11-05 13:45:41 +01:00
practicalswift ab8c6f24d2 Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986) 2018-11-05 13:27:04 +01:00
practicalswift 991248649b rpc: Make HTTP RPC debug logging more informative 2018-11-05 13:27:02 +01:00
Wladimir J. van der Laan 15a219ff8e
Merge #14628: Trivial: Rename misleading 'defaultPort' to 'rpc_port'
4ed730802f scripted-diff: Rename misleading 'defaultPort' to 'http_port' (Murray Nesbitt)

Pull request description:

  `defaultPort` in `HTTPBindAddresses()` is misleadingly named. `defaultPort ` suggests a constant, not something that might be overridden by `-rpcport`.

Tree-SHA512: f6ae8bdc2b4a4f503e44df9efdec32c854d2dede87714399f53791d50cce6bc41c46b01d1583cfc0e3e4777c244e1c74443fa39d9da50a45e53af265b74a17d1
2018-11-05 13:18:35 +01:00
Wladimir J. van der Laan 46eb2755d4
Merge #14350: Add WalletLocation class
65f3672f3b wallet: Refactor to use WalletLocation (João Barbosa)
01a4c095c8 wallet: Add WalletLocation utility class (João Barbosa)

Pull request description:

  Advantages of this change:
   - avoid resolving wallet absolute path and name repetitively and in multiple places;
   - avoid calling `GetWalletDir` in multiple places;
   - extract these details from the actual wallet implementation.

  The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory.

Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
2018-11-05 13:17:03 +01:00
Murray Nesbitt 4ed730802f scripted-diff: Rename misleading 'defaultPort' to 'http_port'
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\<defaultPort\>/http_port/g' src/httpserver.cpp
-END VERIFY SCRIPT-
2018-11-05 04:01:47 -08:00
Wladimir J. van der Laan 69d574ac6c
Merge #14554: qt: Remove unused adjustedTime parameter
04972fefd1 Remove unused `adjustedTime` parameter (Hennadii Stepanov)

Pull request description:

  After merging #13622 the `adjustedTime` parameter in the `updateStatus` function is unused.

Tree-SHA512: 1d0e03e7343f076ee0032fb721f8ba50571d579958001aab372a43e45b4de24c2bf3bd18c245071cbd69f61ef38182e19666c6f936d55c9085b73c848ba62626
2018-11-05 12:50:11 +01:00
Hennadii Stepanov 60ae463a68
Fix bitcoin-qt -version output formatting 2018-11-05 13:37:48 +02:00
Hennadii Stepanov c3f1821ac7
Make blockdir always net specific
The blocks directory is net specific by definition.

Also this prevents the side effect of calling GetBlocksDir(false) in the
non-mainnet environment.
2018-11-05 13:26:43 +02:00
João Barbosa 0a656f85a9 qt: All tray menu actions call showNormalIfMinimized 2018-11-05 11:21:50 +00:00
João Barbosa 6fc21aca6d qt: Use GUIUtil::bringToFront where possible 2018-11-05 11:21:50 +00:00
João Barbosa 5796671e1d qt: Add GUIUtil::bringToFront 2018-11-05 11:21:50 +00:00
Wladimir J. van der Laan bccb4d29a8
Merge #14555: Move util files to directory
2068f089c8 scripted-diff: Move util files to separate directory. (Jim Posen)

Pull request description:

  As discussed [here](https://github.com/bitcoin/bitcoin/pull/14074#issuecomment-429090584), this establishes a `util/` directory to introduce more organizational structure and have a clear place for new util files. It's really not scary to review, it's just one big scripted diff.

Tree-SHA512: 39cf15480d7d35e987b6088d52a857a2d5b1802e36c6b815eb42718d80cd95e669757af9bcc7c04426cd8523662cb1050b8da1e2377d3730672820ed298b894b
2018-11-05 11:34:29 +01:00
Jim Posen 2068f089c8 scripted-diff: Move util files to separate directory.
-BEGIN VERIFY SCRIPT-
mkdir -p src/util
git mv src/util.h src/util/system.h
git mv src/util.cpp src/util/system.cpp
git mv src/utilmemory.h src/util/memory.h
git mv src/utilmoneystr.h src/util/moneystr.h
git mv src/utilmoneystr.cpp src/util/moneystr.cpp
git mv src/utilstrencodings.h src/util/strencodings.h
git mv src/utilstrencodings.cpp src/util/strencodings.cpp
git mv src/utiltime.h src/util/time.h
git mv src/utiltime.cpp src/util/time.cpp

sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')

sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h

sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am

sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
-END VERIFY SCRIPT-
2018-11-04 22:46:07 -08:00
Lenny Maiorani 76e13b586f warnings: Compiler warning on memset usage for non-trivial type
Problem:
- IS_TRIVIALLY_CONSTRUCTIBLE macro does not work correctly resulting
  in `memset()` usage to set a non-trivial type to 0 when
  `nontrivial_t` is passed in from the tests.
- Warning reported by GCC when compiling with `--enable-werror`.

Solution:
- Use the standard algorithm `std::fill_n()` and let the compiler
  determine the optimal way of looping or using `memset()`.
2018-11-04 20:50:40 -07:00
MarcoFalke b74078868b
Merge #14410: rpcwallet: 'ischange' field for 'getaddressinfo' RPC
14a06525b2 tests: add test for 'getaddressinfo' RPC result 'ischange' field (whythat)
93d1aa9abc rpcwallet: add 'ischange' field to 'getaddressinfo' response (whythat)

Pull request description:

  Implementation of proposal in #14396.

  This introduces `CWallet::IsChange(CScript&)` method and replaces original `CWallet::IsChange(CTxOut&)` method with overloaded version that delegates to the new method with *txout*'s `scriptPubKey`. In this way `TODO` note from the original method can still be addressed in a single place.

Tree-SHA512: ef5dbc82d76b4b9b2fa6a70abc3385a677c55021f79e187ee2f392ee32bc6b406191f4129acae5c17b0206e72b6712e7e0cad574a4bbd966871c2e656c45e041
2018-11-04 17:23:11 -05:00
Hennadii Stepanov 6b1d2972bf
Remove obj_c for macOS Dock icon menu
Qt `setAsDockMenu()` does this work.
2018-11-04 02:42:18 +02:00
Hennadii Stepanov 2464925e7b
Use Qt signal for macOS Dock icon click event
This moves the Dock icon click reaction code to the common place and
allows some cleanup in obj_c code.

According to the Apple's docs `class_replaceMethod` behaves as
`class_addMethod`, if the method identified by name does not yet exist;
or as `method_setImplementation`, if it does exist.
2018-11-04 02:37:28 +02:00
Glenn Willen 565500508a Refactor PSBTInput signing to enforce invariant
Refactor the process of PSBTInput signing to enforce the invariant that
a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo,
never both.

This simplifies the logic of SignPSBTInput slightly, since it no longer
has to deal with the "both" case. When calling it, we now give it, in
order of preference: (1) whichever of the utxo fields was already
present in the PSBT we received, or (2) if neither, the
non_witness_utxo field, which is just a copy of the input transaction,
which we get from the wallet.

SignPSBTInput no longer has to remove one of the two fields; instead, it
will check if we have a witness signature, and if so, it will replace
the non_witness_utxo with the witness_utxo (which is smaller, as it is
just a copy of the output being spent.)

Add PSBTInput::IsSane checks in two more places, which checks for
both utxo fields being present; we will now give an RPC error early on
if we are supplied such a malformed PSBT to fill in.

Also add a check to FillPSBT, to avoid touching any input that is
already signed. (This is now redundant, since we should no longer
potentially harm an already-signed input, but it's harmless.)

fixes #14473
2018-11-01 12:14:21 -07:00
Glenn Willen 0f5bda2bd9 Simplify arguments to SignPSBTInput
Remove redundant arguments to SignPSBTInput -- since it needs several
bits of the PartiallySignedTransaction, pass in a reference instead of
doing it piecemeal. This saves us having to pass in both a PSBTInput and
its index, as well as having to pass in the CTransaction. Also avoid
redundantly passing the sighash_type, which is contained in the
PSBTInput already.
2018-11-01 12:11:24 -07:00
Glenn Willen 53e6fffb8f Add bool PSBTInputSigned
Refactor out a "PSBTInputSigned" function to check if a PSBT is signed,
for use in subsequent commits.

Also improve a related comment.
2018-11-01 12:11:24 -07:00
Glenn Willen 65166d4cf8 New PartiallySignedTransaction constructor from CTransction
New constructor that creates a PartiallySignedTransaction from a
CTransaction, automatically sizing the inputs and outputs vectors for
convenience.
2018-11-01 12:11:24 -07:00
Glenn Willen 4f3f5cb4b1 Remove redundant txConst parameter to FillPSBT 2018-11-01 12:11:24 -07:00
Glenn Willen fe5d22bc67 More concise conversion of CDataStream to string
Use .str() instead of .data() and .size() when converting CDataStream to
a string. Uses std::string, avoiding conversion to a C string.
2018-11-01 12:11:24 -07:00
Russell Yanofsky 535203075e Avoid using numeric_limits for sequence numbers and lock times
Switches to named constants, because numeric_limits calls can be harder to read
and less portable.

Change was suggested by James O'Beirne <james.obeirne@gmail.com> in
https://github.com/bitcoin/bitcoin/pull/10973#discussion_r213473620

There are no changes in behavior except on some platforms we don't support
(ILP64, IP16L32, I16LP32), where SignalsOptInRBF() and MutateTxAddInput()
functions would now work correctly.
2018-11-01 12:55:39 -04:00
Wladimir J. van der Laan 51e5ef3971
Merge #14377: check that a separator is found for psbt inputs, outputs, and global map
4fb3388db9 check that a separator is found for psbt inputs, outputs, and global map (Andrew Chow)

Pull request description:

  Currently it doesn't make sure that a separator was found so PSBTs missing a trailing separator would still pass. This fixes that and adds a test case for it.

  It really only makes sense to check for the separator for the output maps as if an input or global map was missing a separator, the fields following it would be interpreted as belonging to the previous input or global map. However I have added the check for those two anyways to be consistent.

Tree-SHA512: 50c0c08e201ba02494b369a4d36ddb73e6634eb5a4e4e201c4ef38fd2dbeea2c642b8a04d50c91615da61ecbfade37309e47431368f4b1064539c42015766b50
2018-11-01 17:55:39 +01:00
Hennadii Stepanov bafb921507 Remove duplicated code
The deleted LOC is a dup so far as
`std::numeric_limits<unsigned int>::min()` == 0
2018-11-01 19:55:39 +03:00
Hennadii Stepanov e4dc39b3bc Replace platform dependent type with proper const 2018-11-01 19:55:39 +03:00
Alexey Ivanov 1e0f3c4499
macOS: disable AppNap during sync
Signed-off-by: Alexey Ivanov <alexey.ivanes@gmail.com>
2018-11-01 18:22:06 +03:00
Wladimir J. van der Laan f6df989842
Merge #14197: [psbt] Convert non-witness UTXOs to witness if witness sig created
862d159d63 Add test for conversion from non-witness to witness UTXO (Pieter Wuille)
f8c1714634 Convert non-witness UTXOs to witness if witness sig created (Andrew Chow)

Pull request description:

  If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.

  Port of #14196 to master.

Tree-SHA512: 2235eeb008ffa48e821628032d689e4a83bff6c29b93fa050ab2ee492b0e67b3a30f29a680d4a0e574e05c3a2f9edf0005e161fbe25b7aef2acd034a2424e2f2
2018-11-01 16:09:38 +01:00
Hennadii Stepanov 53bb6be3f8
Remove obj_c for macOS Dock icon setting
Qt `setWindowIcon()` does this work.
2018-10-31 20:29:08 +02:00
Wladimir J. van der Laan b312579c69
Merge #14454: Add SegWit support to importmulti
c11875c590 Add segwit address tests for importmulti (MeshCollider)
201451b1ca Make getaddressinfo return solvability (MeshCollider)
1753d217ea Add release notes for importmulti segwit change (MeshCollider)
353c064596 Fix typo in test_framework/blocktools (MeshCollider)
f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup (MeshCollider)

Pull request description:

  Add support for segwit to importmulti, supports P2WSH, P2WPKH, P2SH-P2WPKH, P2SH-P2WSH. Adds a new `witnessscript` parameter which must be used for the witness scripts in the relevant situations.

  Also includes some tests for the various import types.

  ~Also makes the change in #14019 redundant, but cherry-picks the test from that PR to test the behavior (@achow101).~

  Fixes #12253, also addresses the second point in #12703, and fixes #14407

Tree-SHA512: 775a755c524d1c387a99acddd772f677d2073876b72403dcfb92c59f9b405ae13ceedcf4dbd2ee1d7a8db91c494f67ca137161032ee3a2071282eeb411be090a
2018-10-31 17:44:31 +01:00
Hennadii Stepanov a16f44c040
qt: Remove "Pay only required fee" checkbox
The custom fee input box now has a minimum value equal to the minimum
required fee. Before a value below the minimum fee could be entered
which was confusing since the minimum fee would still be paid even
though a lower amount was entered.
2018-10-30 16:31:57 +02:00
Hennadii Stepanov 8711cc0c78
qt: Improve BitcoinAmountField class
This adds functions for specifing a min/max value for a
BitcoinAmountField. These options only affect user input, so it's still
possible to use setValue to set values outside of the min/max range. The
existing value will not be changed when calling these functions even if
it's out of range. The min/max range will be reinforced when the field
loses focus.
This also adds `SetAllowEmpty` function which specifies if the field is
allowed to be left empty by the user. If set to false the field will be
set to the minimum allowed value if it's empty when focus is lost.
2018-10-30 14:58:25 +02:00
Luke Dashjr d8bf1071cf Bugfix: RPC: Add address_type named param for createmultisig 2018-10-28 22:42:36 +00:00
MarcoFalke f1e2f2a859
Merge #14585: refactor: remove usage of locale dependent std::isspace
15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) (practicalswift)

Pull request description:

  Don't rely on locale dependent function `std::isspace` in `base_blob<BITS>::SetHex(...)` (uint256), `DecodeBase58(...)`, `ParseMoney(...)` and `ParseHex(...)`.

  Rationale:

  ```
  $ uname -s
  Darwin
  $ cat poc.cpp
  #include <iostream>
  #include <locale>

  int main(void) {
      setlocale(LC_ALL, "");
      std::cout << std::isspace(133) << ' ' << std::isspace(154) << ' ' << std::isspace(160);
      std::cout << '\n';
  }
  $ clang++ -o poc poc.cpp
  $ ./poc
  1 0 1
  $ LC_ALL=en_US ./poc
  1 0 1
  $ LC_ALL=C ./poc
  0 0 0
  $ LC_ALL=ru_RU.KOI8-R ./poc # an "interesting" locale
  0 1 0
  ```

Tree-SHA512: 4eafb267342b8a777da6cca07c353afd1f90f3fc1d91e01f526f1b384a2b97c1da25b7bd7dfc300655182a4eaec6a4bea855a45723ab53c750a734b60e1e3c9f
2018-10-28 06:49:07 -04:00
Hennadii Stepanov 04972fefd1
Remove unused adjustedTime parameter
qt: After merging #13622 the `adjustedTime` is not used any more in
wallet related functions.
2018-10-28 09:04:10 +02:00
MarcoFalke efaf2d85e3
Merge #13783: validation: Pass tx pool reference into CheckSequenceLocks
fa511e8dad Pass tx pool reference into CheckSequenceLocks (MarcoFalke)

Pull request description:

  `CheckSequenceLocks` is called from ATMP and the member function `CTxMemPool::removeForReorg` without passing in the tx pool object that is used in those function's scope and instead using the global `::mempool` instance.

  This fix should be refactoring only, since currently there is only one (global) tx pool in normal operation. Though, it fixes hard to track down issues in future settings where more than one mempool exists at a time. (E.g. for tests, rpc or p2p tx relay purposes)

Tree-SHA512: f0804588c7d29bb6ff05ec14f22a16422b89ab31ae714f38cd07f811d7dc7907bfd14e799c4c1c3121144ff22711019bbe9212b39e2fd4531936a4119950fa49
2018-10-27 10:39:44 -04:00
practicalswift 15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) 2018-10-26 19:42:58 +02:00
Pieter Wuille 9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable 2018-10-26 10:21:05 -07:00
Pieter Wuille 225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others 2018-10-26 10:21:05 -07:00
Pieter Wuille 4d78bd93b5 Add support for inferring descriptors from scripts 2018-10-26 10:21:05 -07:00
MarcoFalke ae85c8d28b
Merge #14568: build: Fix Qt link order for Windows build
fbaccbf00c build: Fix Qt link order for Windows build (Chun Kuan Lee)

Pull request description:

  See https://github.com/bitcoin/bitcoin/pull/14451#issuecomment-432874893

Tree-SHA512: 819e68dc750297a74d04aa1ad3dae64072b66df718d36b950bd9430c9fca1771c611af934df23954f81b83bd89f96ea76c20cbf17db1364b988a6c34c43fb631
2018-10-26 07:46:31 -04:00
Wladimir J. van der Laan d50c996a14
Merge #14561: Remove fs::relative call and fix listwalletdir tests
ed2e18398b Remove fs::relative call and fix listwalletdir tests (João Barbosa)

Pull request description:

  The implementation of `fs::relative` resolves symlinks which is not intended
  in ListWalletDir. The replacement does what is required, and `listwalletdir` RPC
  tests are fixed accordingly.

  Also, `fs::recursive_directory_iterator` iteration is fixed to build with boost 1.47.

  Based on #14559

Tree-SHA512: 1da516226073f195285d10d9d9648c90cce0158c5d1eb9c31217bb4abb575cd37f07c00787c5a850554d6120bbc5a3cbc5cb47d4488b32ac6bcb52bc1882d600
2018-10-26 13:25:35 +02:00
Wladimir J. van der Laan 9d4541508b
Merge #14518: rpc: Always throw in getblockstats if -txindex is required
3be209d103 rpc: Always throw in getblockstats if -txindex is required (João Barbosa)

Pull request description:

  Previously blocks with only the coinbase transaction didn't cause
  the RPC error even if the requested stats required -txindex and
  it wasn't enabled.

  Fixes #14499.

Tree-SHA512: d3a6402889e3ce7199632e79eba66d7d471ff7de5c564d35312e2340cc6d84ef544a8172548fbc2eedf5e637b56dc57bbf7a9815ab798c7f226755f897fd8f3e
2018-10-26 13:21:17 +02:00
João Barbosa ed2e18398b Remove fs::relative call and fix listwalletdir tests
The implementation of fs::relative resolves symlinks which is not intended
in ListWalletDir. The replacement does what is required, and listwalletdir
tests are fixed accordingly.

Also, building with boost 1.47 required 2 changes:
 - replace fs::relative with an alternative implementation;
 - fix fs::recursive_directory_iterator iteration.
2018-10-25 15:33:56 +01:00
Chun Kuan Lee fbaccbf00c build: Fix Qt link order for Windows build 2018-10-25 20:14:48 +08:00
João Barbosa 65f3672f3b wallet: Refactor to use WalletLocation 2018-10-25 12:33:26 +01:00
João Barbosa 01a4c095c8 wallet: Add WalletLocation utility class 2018-10-25 11:53:17 +01:00
MeshCollider 201451b1ca Make getaddressinfo return solvability 2018-10-25 09:30:57 +13:00
MeshCollider f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup 2018-10-25 09:30:56 +13:00
Wladimir J. van der Laan 2b88f67e0b
Merge #14320: [bugfix] wallet: Fix duplicate fileid detection
4ea77320c5 tests: add test case for loading copied wallet twice (Chun Kuan Lee)
2d796faf62 wallet: Fix duplicate fileid (Chun Kuan Lee)

Pull request description:

  The implementation in current master can not detect if the file ID is duplicate with flushed `BerkeleyEnvironment`. This PR would store the file ID in a global variable `g_fileids` and release it when the `BerkeleyDatabase` close. So it won't have to rely on a `Db*`.

  Fix #14304

Tree-SHA512: 0632254b696bb4c671b5e2e5781e9012df54ba3c6ab0f919d9f6d31f374d3b0f8bd968b90b537884ac8c3d2906afdd58c2ce258666263464c7dbd636960b0e8f
2018-10-24 17:37:32 +02:00
Chun Kuan Lee 2d796faf62 wallet: Fix duplicate fileid 2018-10-24 23:08:16 +08:00
Wladimir J. van der Laan a74ed3a05b
Merge #14453: rpc: Fix wallet unload during walletpassphrase timeout
8907df9e02 qa: Ensure wallet unload during walletpassphrase timeout (João Barbosa)
321decffa1 rpc: Fix wallet unload during walletpassphrase timeout (João Barbosa)

Pull request description:

  Replaces the raw wallet pointer in the `RPCRunLater` callback with a `std::weak_ptr` to check if the wallet is not expired.

  To test:
  ```
  bitcoind -regtest
  bitcoin-cli -regtest encryptwallet foobar
  bitcoin-cli -regtest walletpassphrase foobar 5 && bitcoin-cli -regtest unloadwallet ""
  ```

  Fixes #14452.

Tree-SHA512: 311e839234f5fb7955ab5412a2cfc1903ee7132ea56a8ab992ede3614586834886bd65192b76531ae0aa3a526b38e70ca2e1cdbabe52995906ff97b49d93c268
2018-10-24 16:44:43 +02:00
Wladimir J. van der Laan 9886590116
Merge #14451: Add BIP70 deprecation warning and allow building GUI without BIP70 support
48439b3c10 Don't link SSL_LIBS with GUI unless BIP70 is enabled (James Hilliard)
fbb643d2a5 Add BIP70 deprecation warning (James Hilliard)
38b98507cd qt: cleanup: Move BIP70 functions together in paymentserver (Wladimir J. van der Laan)
9dcf6c0dfe build: Add --disable-bip70 configure option (Wladimir J. van der Laan)

Pull request description:

  This is based off of #11622 and adds a deprecation warning when a BIP70 URL is used.

  Rational:

  - BIP70 increases attack surface in multiple ways and is difficult for third party wallets to implement in a secure manner
  - Very few merchants use the standard BIP70 variant supported by Bitcoin Core
  - The one major payment processor that doesn't support BIP21 and currently uses a customized non-standard version of BIP70 has indicated that "Unfortunately the original BIP70 is not useful for us."

Tree-SHA512: 1e16ee8d2cdac9499f751ee7b50d058278150f9e38a87a47ddb5105dd0353cdedabe462903f54ead6209b249b249fe5e6a10d29631531be27400f2f69c25b9b9
2018-10-24 16:29:50 +02:00
Wladimir J. van der Laan 2e15fa16cd
Merge #12842: Prevent concurrent savemempool
585b47cfe1 rpc: Prevent concurrent savemempool (João Barbosa)

Pull request description:

  Follow up of #12172, this change prevents calling `savemempool` RPC concurrently.

Tree-SHA512: 4759a7107658a9794f5c6ab7e3e3002276abadd64996010be67a2791914d284db6fe0377c071a8d6a42387bfb0178f219b73aeec077ce5c4fe5c634a30b3e081
2018-10-24 15:20:33 +02:00
MarcoFalke 9dda5fdf64
Merge #14296: [wallet] Remove addwitnessaddress
2b91e42ece [docs] Add release note for removing getwitnessaddress (John Newbery)
ebec90ac97 [wallet] Remove deprecated addwitnessaddress RPC method (John Newbery)
07e3f585ab [test] Remove deprecated addwitnessaddress from feature_segwit.py (John Newbery)
82f2fa03a5 [test] Remove deprecated addwitnessaddress from wallet_bumpfee.py (John Newbery)
9d7ee187a3 [test] Remove deprecated addwitnessaddress from p2p_compactblocks.py (John Newbery)
3cf77f0b3e [tests] Remove deprecated addwitnessaddress call from wallet_dump.py (John Newbery)
bdefc9705d [tests] Remove deprecated addwitnessaddress call from feature_nulldummy (John Newbery)
67d7d67cf3 [test] Fix flake8 warnings in tests (John Newbery)

Pull request description:

  Fully removes the `addwitnessaddress` RPC method, which was deprecated in V0.17

Tree-SHA512: 8fa8a2a721a81262fbdedbe1cef031e6a07aa6abbc9760dbc62738fc4f688b44bd737d0f3cdb1aec046866a6395befbfecde0f34e76a99e11d3cf566cad1d0de
2018-10-24 08:09:48 -04:00
MarcoFalke e895fdc9fc
Merge #11634: wallet: Add missing cs_wallet/cs_KeyStore locks to wallet
69e7ee2dd8 Add GUARDED_BY(cs_wallet) for setExternalKeyPool, mapKeyMetadata, m_script_metadata and setLockedCoins (practicalswift)
37b2538c2d Add GUARDED_BY(cs_wallet) for encrypted_batch, nWalletMaxVersion, m_max_keypool_index and nOrderPosNext (practicalswift)
dee42927c9 wallet: Add Clang thread safety analysis annotations (practicalswift)
1c7e25db0c wallet: Add missing locks (practicalswift)

Pull request description:

  Add missing wallet locks:

  * Calling the function `GetConflicts(...)` requires holding the mutex `cs_wallet`
  * Calling the function `IsSpent(...)` requires holding the mutex `cs_wallet`
  * Accessing the variables `mapKeys` and `mapCryptedKeys` requires holding the mutex `cs_KeyStore`
  * Accessing the variable `nTimeFirstKey` requires holding the mutex `cs_wallet`
  * Accessing the variable `mapWallet` requires holding the mutex `cs_wallet`
  * Accessing the variable `nTimeFirstKey` requires holding the mutex `cs_wallet`

Tree-SHA512: 8a7b9a4e1f2147e77c04b817617a06304a2e2159148d3eb3514a3c09c41d77ef7e773df6e63880ad9acc026e00690f72d0c51f3f86279177f672d477423accca
2018-10-24 05:01:29 -04:00
MarcoFalke 5473e255f6
Merge #14444: Add compile time checking for cs_main locks which we assert at run time
0089905361 Add compile time checking for cs_main locks which we assert at run time (practicalswift)

Pull request description:

  Assert locking requirements at compile-time (`EXCLUSIVE_LOCKS_REQUIRED(foo)`) instead of at run-time (`AssertLockHeld(…)`).

Tree-SHA512: f4965ebf4bb5dbf5e7ed738cacf82c0f6cd55134fb968860bf84a84e29806485617f223910bb8c5461213f1829b0137c64ba1f6d6a2008b3cac3bb3a28df9324
2018-10-23 20:33:07 -04:00
MarcoFalke 94cf1ec948
Merge #14417: Fix listreceivedbyaddress not taking address as a string
d4d70eda33 Fix listreceivedbyaddress not taking address as a string (Eric Scrivner)

Pull request description:

  Fixes #14173. Add the patch in #14173 and include a regression test.

Tree-SHA512: 5a9794e0c43e90d18c899841afbaf15eb9129d7d2f6570fccf0a1793697fe170d224c3c3995b1a35c536fac19819042823d9e3bd23b019d0f03434499243d2f5
2018-10-23 19:04:10 -04:00
MarcoFalke 3668bb335c
Merge #14468: [wallet] Deprecate generate RPC method
ab9aca2bdf [rpc] add 'getnewaddress' hint to 'generatetoaddress' help text. (John Newbery)
c9f02955b2 [wallet] Deprecate the generate RPC method (John Newbery)
aab81720de [tests] Add generate method to TestNode (John Newbery)
c269209336 [tests] Small fixups before deprecating generate (John Newbery)

Pull request description:

  Deprecates the `generate` RPC method.

  For concept discussion, see #14299.

  Fixes #14299.

Tree-SHA512: 16a3b8b742932e4f0476c06b23de07a34d9d215b41d9272c1c9d1e39966b0c2406f17c5ab3cc568947620c08171ebe5eb74fd7ed4b62151363e305ee2937cc80
2018-10-23 18:15:21 -04:00
John Newbery ab9aca2bdf [rpc] add 'getnewaddress' hint to 'generatetoaddress' help text. 2018-10-23 08:32:00 -04:00
James Hilliard 48439b3c10 Don't link SSL_LIBS with GUI unless BIP70 is enabled 2018-10-22 04:10:40 -06:00
James Hilliard fbb643d2a5 Add BIP70 deprecation warning 2018-10-22 04:10:40 -06:00
Wladimir J. van der Laan 38b98507cd qt: cleanup: Move BIP70 functions together in paymentserver
Reduces the number of separate `#ifdefs` spans.
2018-10-22 04:03:17 -06:00
Pieter Wuille ff37459abc Add tests for key origin support 2018-10-20 20:29:02 -07:00
Pieter Wuille 2c6281f180 Add key origin support to descriptors 2018-10-20 20:29:02 -07:00
MarcoFalke 75795603dd
Merge #13909: validation: Pass chainparams in AcceptToMemoryPoolWorker(...)
97ddc6026b validation: Pass chainparams in AcceptToMemoryPoolWorker(...) (practicalswift)

Pull request description:

  Remove unused `CChainParams` argument in `AcceptToMemoryPoolWorker(...)`.

  After the merge of #13527 ("policy: Remove promiscuousmempoolflags") yesterday the `CChainParams` argument is no longer used in `AcceptToMemoryPoolWorker(...)`.

Tree-SHA512: f1bab4498b64f0ab5230b8172f860df8fa8a302e4ee7385be4ba9c65a37cbc3ef640df78348c477169b9414e5c6a160a0b6471a11f4bb27921500ec208ef5340
2018-10-20 21:17:53 -03:00
Wladimir J. van der Laan 96c409c919
Merge #14527: qa: Revert "Make qt wallet test compatible with qt4"
fadffae17f Revert "Make qt wallet test compatible with qt4" (MarcoFalke)

Pull request description:

  This removes the file added in #10098

Tree-SHA512: 4aa887ec02aec943f3d74f469c935acf57e43ddbea6f979bb37d3a14670571fa2276cf578e8978de92b5854d8b462f24e5e0addfb27b92fbedf90726eb5d985e
2018-10-20 14:02:02 +02:00
João Barbosa 585b47cfe1 rpc: Prevent concurrent savemempool 2018-10-20 11:12:20 +01:00
MarcoFalke fadffae17f
Revert "Make qt wallet test compatible with qt4"
This reverts commit e9a64615c8.
2018-10-20 05:34:53 -03:00
Pieter Wuille 91482e5bf2
Merge #14460: tests: Improve 'CAmount' tests
29ed2d64f6 Improve CAmount tests (Hennadii Stepanov)

Pull request description:

  This provides:
    - more `MoneyRange` tests;
    - new `CFeeRate` constructor tests with zero byte size;
    - explicit using of the `CAmount` type.

Tree-SHA512: ca0ad6ccb37909a2a5c11034dc07b316a84c32fb40c6f8b6cfc28ebec72a1de157f31d22e767ae80d70ed06d7296f23870cc5ed0689f34a754ae763d50e23d43
2018-10-19 19:23:43 -07:00
Pieter Wuille e754c6e331
Merge #14011: Disable wallet and address book Qt tests on macOS minimal platform
a3197c5294 Disable wallet and address book Qt tests on macOS minimal platform (Russell Yanofsky)

Pull request description:

  macOS minimal platform is frequently broken, and these are currently failing with Qt 5.11.1.

  The tests do pass when run on the full cocoa platform (with `test_bitcoin-qt -platform cocoa`).

  Stack trace from test crash: https://gist.github.com/ryanofsky/3401fb63c52d13d5585e7fc777361f1e

Tree-SHA512: a05644ef15d75ea7d7f85ea804c6a5fe78e4e7358b189cbab639d9f7dc46163a35f77f7a2b4ae2fd6be5b9fb22898386b4d88069d5ee8d5fdbd995157c6f0846
2018-10-19 19:14:07 -07:00
Pieter Wuille dc1e54206d
Merge #14474: bitcoin-tx: Use constant for n pubkeys check
1f01fe0257 bitcoin-tx: Use constant for n pubkeys check (Antoine Le Calvez)

Pull request description:

  Use the constant for the maximum number of public keys in a multisig script defined in script/script.h instead of hardcoding it.

Tree-SHA512: 83e6c46df907944d0d993159955e402784415536d61fdb5a5becba2b042e37ad2a291b27301c1b169416cb71c823a571d82257512cd4a64848a27a24c875fcc6
2018-10-19 19:02:41 -07:00
Pieter Wuille b2863c0685
Merge #14426: utils: Fix broken Windows filelock
369244f654 utils: Fix broken Windows filelock (Chun Kuan Lee)

Pull request description:

  Fix broken filelock on Windows, also add a test for this. It's a regression introduced by #13862.

Tree-SHA512: 15665b1930cf39ec71f3ab07def8e2897659f6fd4d2de749d63a5a8ec920e4a04282f12bc262f242b1b3d14d2dd9fa191ddbcf16a46fb927b5b2b14d9f6b5d01
2018-10-19 18:59:47 -07:00
Pieter Wuille b14db5abab
Merge #14513: Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG
bc60c615a5 Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG (practicalswift)

Pull request description:

  Avoid `1 << 31` (UB) in calculation of `SEQUENCE_LOCKTIME_DISABLE_FLAG`.

  Context: https://github.com/bitcoin/bitcoin/pull/14510#issuecomment-431153707

Tree-SHA512: bdb4a913c6a82ff1a455ba67d3351f6408ff4116574329361644b483fea96b801fdc5c5659233856b591cd3a46ec669d3b5b438553e4240d7099c560eae2e2ae
2018-10-19 18:52:42 -07:00
Chun Kuan Lee cb53b825c2 scripted-diff: Replace boost::bind with std::bind
-BEGIN VERIFY SCRIPT-
for j in $(seq 1 5)
do
    sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h')
done
sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h')
sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h')
sed -i '/boost\/bind/d' $(git grep --name-only boost/bind)
-END VERIFY SCRIPT-
2018-10-20 02:29:59 +08:00
Chun Kuan Lee 2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform 2018-10-20 02:29:35 +08:00
João Barbosa 3be209d103 rpc: Always throw in getblockstats if -txindex is required
Previously blocks with only the coinbase transaction didn't cause
the RPC error even if the requested stats required -txindex and
it wasn't enabled.
2018-10-19 15:28:41 +01:00
mruddy a4edb168b6 ZMQ: add options to configure outbound message high water mark, aka SNDHWM 2018-10-19 07:36:13 -04:00
Wladimir J. van der Laan 8eb2cd1dda
Merge #14291: wallet: Add ListWalletDir utility function
d56a068935 docs: Add release notes for listwalletdir RPC (João Barbosa)
0cb3cad166 qa: Add tests for listwalletdir RPC (João Barbosa)
cc3377360c rpc: Add listwalletdir RPC (João Barbosa)
d1b03b8e5f interfaces: Add getWalletDir and listWalletDir to Node (João Barbosa)
fc4db35bfd wallet: Add ListWalletDir utility (João Barbosa)

Pull request description:

  `ListWalletDir` returns all available wallets in the current wallet directory.

  Based on MeshCollider work in pull #11485.

Tree-SHA512: 5843e3dbd1e0449f55bb8ea7c241a536078ff6ffcaad88ce5fcf8963971d48c78600fbc4f44919523b8a92329d5d8a5f567a3e0ccb0270fdd27366e19603a716
2018-10-19 01:01:17 +02:00
João Barbosa 321decffa1 rpc: Fix wallet unload during walletpassphrase timeout 2018-10-18 23:33:36 +01:00
João Barbosa cc3377360c rpc: Add listwalletdir RPC 2018-10-18 23:26:06 +01:00
João Barbosa d1b03b8e5f interfaces: Add getWalletDir and listWalletDir to Node 2018-10-18 23:26:06 +01:00
João Barbosa fc4db35bfd wallet: Add ListWalletDir utility
ListWalletDir returns all available wallets in the current wallet directory.

Based on MeshCollider work in pull #11485.
2018-10-18 23:26:06 +01:00
John Newbery c9f02955b2 [wallet] Deprecate the generate RPC method 2018-10-18 17:46:48 -04:00
practicalswift bc60c615a5 Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_FLAG 2018-10-18 23:14:20 +02:00
Wladimir J. van der Laan 3715b2489e
Merge #14510: Avoid triggering undefined behaviour in base_uint<BITS>::bits()
96f6dc9fc5 Avoid triggering undefined behaviour in base_uint<BITS>::bits() (practicalswift)

Pull request description:

  Avoid triggering undefined behaviour in `base_uint<BITS>::bits()`.

  `1 << 31` is undefined behaviour in C++11.

  Given the reasonable assumption of `sizeof(int) * CHAR_BIT == 32`.

Tree-SHA512: 995fa38e71c8921873139ecf1b7dd54178555219af3be60d07290f379439ddd8479e3963c6f3cae8178efb61063a0f9add6cba82a5578d13888597b5bcd54f22
2018-10-18 22:55:44 +02:00
Chun Kuan Lee 369244f654 utils: Fix broken Windows filelock 2018-10-19 02:29:25 +08:00
Wladimir J. van der Laan fe23553edd
Merge #14374: qt: Add "Blocksdir" to Debug window
2ab9140c92 Add tooltips for both datadir and blocksdir (Hennadii Stepanov)
3045704502 Add "Blocksdir" to Debug window (Hennadii Stepanov)

Pull request description:

  To get the current `blocksdir` is valuable for debug purposes after
  merging #12653.

  ![screenshot from 2018-10-02 23-16-52](https://user-images.githubusercontent.com/32963518/46374770-2ef6f580-c69a-11e8-85c2-44a49fa36b28.png)

Tree-SHA512: a93f2c00ee19cf6acb499d3bd9bccf4be8ef01c53c44d917ad401aa4797db02cbccb71a9c24e05262ea09345e15f9299381367fdc6951f21dd3788a4a58d2132
2018-10-18 12:31:20 +02:00