Commit graph

12948 commits

Author SHA1 Message Date
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
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
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