Commit graph

10144 commits

Author SHA1 Message Date
Lawrence Nahum 1aa97ee088
Add savemempool RPC 2017-09-06 09:44:36 +02:00
Lawrence Nahum 467cbbcbfc
Add return value to DumpMempool 2017-09-06 09:25:00 +02:00
Wladimir J. van der Laan 6866b4912b
Merge #10596: Add vConnect to CConnman::Options
352d582ba Add vConnect to CConnman::Options (Marko Bencun)

Pull request description:

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

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

Pull request description:

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

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

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

Pull request description:

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

Tree-SHA512: a20a59b4f36c1471a9c84bcc7c69048576d1f413104c299a7ed9ba221f28eddf93d727fca2926420ea5d0dd9aba582924f26a5acd44d995039b7202c73eb53bc
2017-09-05 16:00:37 -07:00
Chris Moore a1ea1cfbd8 qt: Use IsMine to validate custom change address
(cherry picked from commit c41224dfd51c896341bbf2fa23e160bf5ffe27c3)
2017-09-05 15:22:28 -07:00
MarcoFalke 4eb1f39d42
Merge #11173: RPC: Fix currency unit string in the help text
47ba2c312 Fix currency/fee-rate unit string in the help text (Akio Nakamura)

Pull request description:

  1. The RPC help text should use the constant `CURRENCY_UNIT` defined in `policy/feerate.cpp` instead of the literal `'BTC'`.
    In the following 2 RPC commands, `'BTC'` is written directly in the help text.
    This commit changes them to use that constant.
       1) `estimatesmartfee`
       2) `estimaterawfee`

  2. Some RPC command use `'satoshis'` as the unit.
    It should be written as `'satoshis'` instead of `'Satoshis'` in the RPC help text.
    So, this commit fixes this typo in `getblocktemplate`.

Tree-SHA512: d0bd1cd90560e59bf456b076b958a2a1c998f85a7e65aeb6b2abcaba18919a3ae62f7c3909210461084c1a3275a35b6ba3ea3ec8f5cce33702ffe383c9e84bce
2017-09-05 14:46:05 -07:00
Wladimir J. van der Laan 001041df81
Merge #11234: Remove redundant testutil.cpp|h files
d1138e362 Remove redundant testutil files (MeshCollider)

Pull request description:

  The only function in testutil.cpp, `GetTempPath()` simply called `fs::temp_directory_path()` directly. This just tidies things up by removing that redundant function and the file containing it

  I can understand wanting a general util file for tests to use, but if there's nothing in it, we might as well remove it, it can always be added back later when it's put to use.

Tree-SHA512: b923f99acf33328743755368a1aa90f5da4a7d5f61b163a4b0b894275c98db80a91edf8f051fbfb4893d970fda5a9078aae78a2672867ff521c4ca4b653c71c0
2017-09-05 23:21:19 +02:00
Wladimir J. van der Laan 3aa60b7ff9
Merge #11143: Fix include path for bitcoin-config.h
5abb93f0e Fix include path for bitcoin-config.h in crypto/common.h (danra)

Pull request description:

  All the other files in the repo which include bitcoin-config.h do so with the appropriate subfolder prefixed: config/bitcoin-config.h
  The header should be included with the appropriate subfolder here as well.

Tree-SHA512: abda23a9cf251553f90afe0ee1866de46ed579471f4139737239a4f9334ca817d985deac6336740898718775d1264c0b80cb348668b10a9cae970895f2de37b8
2017-09-05 23:15:55 +02:00
Wladimir J. van der Laan 38a54a50fa
Merge #11164: Fix boost headers included as user instead of system headers
5ac072caa Fix boost headers included as user instead of system headers (Dan Raviv)

Pull request description:

  In most of the project, boost headers are included as system headers.
  Fix the few inconsistent places where they aren't.

Tree-SHA512: 280af33a7bdc9d68a15b729fa88e1e7627e20a054b8d52a12cc5350c1ac9e9c90fb09f0aa97a00960969f75bcf3403dc52b834c94448b814efa63bfaf3b82663
2017-09-05 22:27:17 +02:00
Wladimir J. van der Laan df8c72237a
Merge #11176: build: Rename --enable-experimental-asm to --enable-asm and enable by default
538cc0ca8 build: Mention use of asm in summary (Wladimir J. van der Laan)
ce5381e7f build: Rename --enable-experimental-asm to --enable-asm and enable by default (Wladimir J. van der Laan)

Pull request description:

  Now that 0.15 is branched off, enable assembler SHA256 optimizations by default, but still allow disabling them, for example if something goes wrong with auto-detection on a platform.

  Also add mention of the use of asm in the configure summary.

Tree-SHA512: cd20c497f65edd6b1e8b2cc3dfe82be11fcf4777543c830ccdec6c10f25eab4576b0f2953f3957736d7e04deaa4efca777aa84b12bb1cecb40c258e86c120ec8
2017-09-05 22:14:16 +02:00
Wladimir J. van der Laan e0e3cbbf08
Merge #11179: rpc: Push down safe mode checks
ec6902d0e rpc: Push down safe mode checks (Andrew Chow)

Pull request description:

  This contains most of the changes of #10563 "remove safe mode" by @achow101, but doesn't remove the safe mode yet, but put an `ObserveSafeMode()` check in (all 23) individual calls which used to have okSafeMode=false.

  This cleans up the ugly "okSafeMode" flag from the dispatch tables, which is not a concern for the RPC server.

  Extra-author: Wladimir J. van der Laan <laanwj@gmail.com>

Tree-SHA512: eee0f251fe2f38f122e7391e3c4e98d6a1e2757f3b718d6b560ad835ae94f11490865a0aef893e90b5fe298165932c8dd8298224173ac2677a5245cd532bac6e
2017-09-05 18:57:42 +02:00
MeshCollider d1138e3620 Remove redundant testutil files 2017-09-05 15:02:17 +12:00
Akio Nakamura 47ba2c312a Fix currency/fee-rate unit string in the help text
1. The RPC help text should use the constant CURRENCY_UNIT defined in
  policy/feerate.cpp instead of the literal 'BTC'. In the following
  2 RPC commands, 'BTC' is written directly in the help text.
    1) estimatesmartfee
    2) estimaterawfee
  And also, for these help strings, the notation
  'fee-per-kilobyte (in BTC)' is somewhat ambiguous.

  To write more precisely, this commit changes to 'fee rate in BTC/kB'
  with using the constant CURRENCY_UNIT.

2. Some RPC command use 'satoshis' as the unit. It should be written
  as 'satoshis' instead of 'Satoshis' in the RPC help text.

  So, this commit fixes this typo in getblocktemplate.

3. The phrase that '... feerate (BTC per KB) ...'  is used to explain
  the fee rate in the help text of following 2 RPC commands.
    1) getmempoolinfo
    2) fundrawtransaction
  But they are different from other similar help text of the RPCs.
  And also, 'KB' implies Kibibyte (2^10 byte).

  To unify and to clarify, this commit changes these phrase to
  '... fee rate in BTC/kB ...'.
  (BTC references the constant 'CURRENCY_UNIT')
2017-09-05 10:07:55 +09:00
MarcoFalke 50fae68d41
Merge #10701: Remove the virtual specifier for functions with the override specifier
1bcd44223 Remove the virtual specifier for functions with the override specifier (practicalswift)

Pull request description:

  Remove the `virtual` specifier for functions with the `override` specifier.

  `override` implies that the function is virtual (in addition - of course - to guaranteeing that the function is overriding a virtual function from a base class).

Tree-SHA512: 2e83e1b3651f55f8f2645282114ab087ad3a0be8826f26ee5c2064d0952f677290b97261398c1d524ec7f87bbbfdbeefc141180f6099c8bbfa4c59a14f7fa755
2017-09-04 18:06:44 -07:00
MarcoFalke ce665863b1
Merge #11198: [Qt] Fix display of package name on 'open config file' tooltip
14ccd4d8d [Qt] Fix display of package name on 'open config file' tooltip (Daniel Edgecumbe)

Pull request description:

  This patch addresses https://github.com/bitcoin/bitcoin/issues/11197.

Tree-SHA512: b826fa2eb69f2c8054d2e84614e067bb00d2176701992dadfea01c2ad63d29015acdb76c5b874f5f6bda52b1f05e3ccfa1b67a4ee2f1e0c26496d1ff1718f325
2017-09-02 11:38:51 +02:00
Utsav Gupta dc334fe749 Update hmac_sha256.h
Fixed a typo
2017-09-02 09:59:48 +05:30
danra 5abb93f0ee Fix include path for bitcoin-config.h in crypto/common.h
All the other files in the repo which include bitcoin-config.h do so with the appropriate subfolder prefixed: config/bitcoin-config.h
The header should be included with the appropriate subfolder here as well.

This canonicalization also allows getting rid of a bit of extra configuration in Makefile.am.
2017-08-31 21:30:41 +03:00
Daniel Edgecumbe 14ccd4d8d1 [Qt] Fix display of package name on 'open config file' tooltip 2017-08-30 19:43:51 +01:00
MarcoFalke d81dccf191
Merge #10777: [tests] Avoid redundant assignments. Remove unused variables
49eb0916d [tests] Avoid redundant assignments. Remove unused variables. (practicalswift)

Pull request description:

  * Remove unused variables.
  * Avoid redundant assignments.

Tree-SHA512: 74dd59680c785c601982a791648bc5d9b04e2b4509119e05f2e402b94998f5bbcbdea1f82d05e5f431fe06642e8db7c346fa8bc4c11f8cdcc554bc70d735534c
2017-08-30 16:57:15 +02:00
Andrew Chow ec6902d0ea rpc: Push down safe mode checks
This contains most of the changes of 10563 "remove safe mode", but doesn't
remove the safe mode yet, but put an `ObserveSafeMode()` check in
individual calls with okSafeMode=false.

This cleans up the ugly "okSafeMode" flag from the dispatch tables,
which is not a concern for the RPC server.

Extra-author: Wladimir J. van der Laan <laanwj@gmail.com>
2017-08-29 10:09:41 +02:00
MarcoFalke 91e49c51f1
Merge #10859: RPC: gettxout: Slightly improve doc and tests
6d2d2eb49 RPC: gettxout: Slightly improve doc and tests (Jorge Timón)

Pull request description:

  Slightly related to https://github.com/bitcoin/bitcoin/pull/10822 in the sense that I felt the documentation and testing wasn't as good as it could be while writing it.

  Ping @sipa since we discussed this on IRC.

Tree-SHA512: a0b3ffdac65245a0429e772fc2d8bcc1e829b02c70fb2af6ee0b7578cae46683f6c51a824b4d703d4dc3f99b6f03a658d6bbc818bf32981516f24124249a211d
2017-08-28 15:45:45 -08:00
Jorge Timón 6d2d2eb493
RPC: gettxout: Slightly improve doc and tests 2017-08-29 00:57:28 +02:00
Wladimir J. van der Laan cee4fe1d53
Merge #11144: Move local include to before system includes
eefc2f3 Move local include to before system includes (danra)

Pull request description:

  Prevents accidental missing includes and hidden dependencies in the local file.

Tree-SHA512: 466b9dd53c596980fdbcccf1dfd8f34eb7ec5b32323ccb635e5705efcedc81af8fbe155ac57b9a2fc5c1f516489e940d1762b3508ded1fb54e187219bb9f75e6
2017-08-28 17:57:44 +02:00
Wladimir J. van der Laan f088a1bb39
Merge #10303: [bench] Include ms/blk stats in Connect* benchmarks.
a473eff [bench] Replace 0.00(000)1 with MICRO/MILLI #defines in validation.cpp. (Karl-Johan Alm)
5f850b0 [bench] Include ms/blk stats in Connect* benchmarks. (Karl-Johan Alm)

Pull request description:

  Display the average per block runtime for the various benchmarked times in the block connect functions to give an overview of long(er) term time distribution statistics.

Tree-SHA512: 3d6f24f6b9e3dbb448a647e2cda8e7b90ad6a16d4821f49f426a8e1ebc3ce5a0cf0a8cde82213e293affba441615702dfe50822c8c818e282af03bfe383d83e0
2017-08-28 12:13:35 +02:00
Wladimir J. van der Laan ce5381e7fe build: Rename --enable-experimental-asm to --enable-asm and enable by default
Now that 0.15 is branched off, enable assembler SHA256 optimizations by default.
2017-08-28 11:06:11 +02:00
Wladimir J. van der Laan df91e11ae1
Merge #11126: Acquire cs_main lock before cs_wallet during wallet initialization
de9a1db Acquire cs_main lock before cs_wallet during wallet initialization (Russell Yanofsky)

Pull request description:

  `CWallet::MarkConflicted` may acquire the `cs_main` lock after `CWalletDB::LoadWallet` acquires the `cs_wallet` lock during wallet initialization. (`CWalletDB::LoadWallet` calls `ReadKeyValue` which calls `CWallet::LoadToWallet` which calls `CWallet::MarkConflicted`). This is the opposite order that `cs_main` and `cs_wallet` locks are acquired in the rest of the code, and so leads to `POTENTIAL DEADLOCK DETECTED` errors if bitcoin is built with `-DDEBUG_LOCKORDER`.

  This commit changes `CWallet::LoadWallet` (which calls `CWalletDB::LoadWallet`) to acquire both locks in the standard order.

  Error was reported by @luke-jr in https://botbot.me/freenode/bitcoin-core-dev/msg/90244330/

Tree-SHA512: 353fe21bc0a4a2828b41876897001a3c414d4b115ee7430925bd391d8bc396fca81661145d00996c1ba1a01516d9acf8b89fb5c3da27092f5f3aa7e37ef26ffa
2017-08-28 10:56:41 +02:00
Wladimir J. van der Laan 9c833f471c
Merge #11145: Fix rounding bug in calculation of minimum change
6af49dd Output a bit more information for fee calculation report. (Alex Morcos)
a54c7b9 Fix rounding errors in calculation of minimum change size (Alex Morcos)

Pull request description:

  Thanks to @juscamarena for reporting this.

  Please backport to 0.15.

  There was a potential rounding error where the fee for the change added to the fee for the original tx could be less than the fee for the tx including change.

  This is fixed in the first commit.  The second commit adds one more snippet of information in the fee calculation report.  I actually realized that there is more information that would be nice to report, but we can add that post 0.15.

  An open question is whether we should be returning failure if the test in line 2885 is hit or just resetting pick_new_inputs and continuing.  Originally I made it a failure to avoid any possible infinite loops.  But the case hit here is an example of where that logic possibly backfired.

Tree-SHA512: efe049781acc1f6a8ad429a689359ac6f7b7c44cdfc9578a866dff4a2f6596e8de474a89d25c704f31ef4f8c89af770e98b75ef06c25419d5a6dfc87247bf274
2017-08-28 10:06:00 +02:00
Wladimir J. van der Laan 745bbdc189
Merge #11161: Remove redundant explicitly defined copy ctors
b426e24 Remove redundant explicitly defined copy ctors (Dan Raviv)

Pull request description:

  CFeeRate and CTxMemPoolEntry have explicitly defined copy ctors which has the same functionality as the implicit default copy ctors which would have been generated otherwise.

  Besides being redundant, it violates the rule of three (see https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming) ).
  (Of course, the rule of three doesn't -really- cause a resource management issue here, but the reason for that is exactly that there is no need for an explicit copy ctor in the first place since no resources are being managed).

Tree-SHA512: c9294ebf5d955d230b44c6f0d20822975d44a34471a717d656f8b17181bcd2827f47ba897edf5accd650f5998c58aadc8ab3c91a3f556f1f6de36830ed4069ce
2017-08-28 09:43:49 +02:00
Wladimir J. van der Laan 298251161c
Merge #11138: Compat: Simplify bswap_16 implementation
e40fa98 Simplify bswap_16 implementation (danra)

Pull request description:

  Simplify bswap_16 implementation on platforms which don't already have it defined.
  This has no effect on the generated assembly; it just simplifies the source code.

Tree-SHA512: 1c6ac1d187a2751da75256d12b6b890160d15246dd2c2b6a56748ec43482e3a5a3323be2910f07b42d3dc243a568c7412c26eaa036efec764436e988abd1c3f1
2017-08-28 09:41:57 +02:00
Wladimir J. van der Laan c7229ac36e
Merge #11131: rpc: Write authcookie atomically
82dd719 rpc: Write authcookie atomically (Wladimir J. van der Laan)

Pull request description:

  Use POSIX rename atomicity at the `bitcoind` side to create a working
  cookie atomically:

  - Write `.cookie.tmp`, close file
  - Rename `.cookie.tmp` to `.cookie`

  This avoids clients reading invalid/partial cookies as in #11129. As such, this is an alternative to that PR.

Tree-SHA512: 47fcc1ed2ff3d8fed4b7441e4939f29cc99b57b7a035673c3b55a124a2e49c8a904637a6ff700dd13a184be8c0255707d74781f8e626314916418954e2467e03
2017-08-28 09:40:15 +02:00
Wladimir J. van der Laan 5b8af7b879
Merge #11169: [GUI] Make tabs toolbar no longer have a context menu
e254830 Make tabs toolbar no longer have a context menu (Andrew Chow)

Pull request description:

  Adds a contextMenuPolicy of Qt::PreventContextMenu to prevent the tabs toolbar from showing a context menu that allows it to be hidden.

  Fixes #11168

Tree-SHA512: 8900b3c1a891ead3c9a20dc365b436fa75f97dbe0dfa7e20ee26fd9d09f3fee6eda286b0c075ed89fe1361608ecbdd87c744e37d97a3fba62493a86dedda867b
2017-08-28 09:35:06 +02:00
Dan Raviv b426e24678 Remove redundant explicitly defined copy ctors
CFeeRate and CTxMemPoolEntry have explicitly defined copy ctors which has the same functionality as the implicit default copy ctors which would have been generated otherwise.

Besides being redundant, it violates the rule of three (see https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming) ).
(Of course, the rule of three doesn't -really- cause a resource management issue here, but the reason for that is exactly that there is no need for an explicit copy ctor in the first place since no resources are being managed).
CFeeRate has an explicitly defined copy ctor which has the same functionality as the implicit default copy ctor which would h
ave been generated otherwise.
2017-08-28 01:29:48 +03:00
MarcoFalke ede386c219
Merge #11160: Improve versionbits_computeblockversion test code consistency
946638d0a Improve versionbits_computeblockversion test code consistency (danra)

Pull request description:

  In this test, `nTime` is used for all the calls to `Mine()`, each time being set to the correct time beforehand, except for in the last few calls to `Mine()` where `nStartTime` is used directly, even though `nTime` is still set to `nStartTime` beforehand. `nTime` just remains unused for these last few calls to `Mine()`.

  Changed the last few calls to `Mine()` to use `nTime` instead, improving consistency. This also fixes an unused value static analyzer warning about `nTime` being set to a value which is never used.

Tree-SHA512: f17cf1d29fd7097d53c0135d6357ee50943bd81b5ce0be785a37b85d34b5127cd6cc17ef844b519e19c33f2d96f7ababee643b9fba7afb031f444b2cfaeedbfd
2017-08-27 18:23:41 -04:00
MarcoFalke a084767b40
Merge #11155: Trivial: Documentation fixes for CVectorWriter ctors
37c4362f2 Trivial: Documentation fixes for CVectorWriter ctors (danra)

Pull request description:

Tree-SHA512: 13aef27f6b38dc276db6616d13e243a5413acf3a3ece5a52578c07b97a5bc9da337e7e230fcdb91727ec88b199844fd9aa3a88e7d96c911c119c91070a892ba1
2017-08-27 18:17:02 -04:00
danra 946638d0a0 Improve versionbits_computeblockversion test code consistency
In this test, `nTime` is used for all the calls to `Mine()`, each time being set to the correct time beforehand, except for in the last few calls to `Mine()` where `nStartTime` is used directly, even though `nTime` is still set to `nStartTime` beforehand. `nTime` just remains unused for these last few calls to `Mine()`.

Changed the last few calls to `Mine()` to use `nTime` instead, improving consistency. This also fixes an unused value static analyzer warning about `nTime` being set to a value which is never used.
2017-08-28 00:03:18 +03:00
Andrew Chow e2548302f4 Make tabs toolbar no longer have a context menu
Adds a contextMenuPolicy of Qt::PreventContextMenu to prevent the
tabs toolbar from showing a context menu that allows it to be
hidden.
2017-08-27 01:08:19 -04:00
Dan Raviv 5ac072caa2 Fix boost headers included as user instead of system headers
In most of the project, boost headers are included as system headers.
Fix the few inconsistent places where they aren't.
2017-08-26 21:09:00 +03:00
Wladimir J. van der Laan 7fd49d01dc
Merge #11151: Fix header guards using reserved identifiers
bc70ab5 Fix header guards using reserved identifiers (Dan Raviv)

Pull request description:

  Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.

Tree-SHA512: 32b45e0aef6f6325bc3cbdea399532437490b753621149374df27e1c1eed6739ad1a09ae368e888cab8d01fb757f1b190c45a0854d2861de39a9296f17e29d9e
2017-08-26 12:59:22 +02:00
danra 37c4362f22 Trivial: Documentation fixes for CVectorWriter ctors 2017-08-26 13:20:36 +03:00
Dan Raviv bc70ab5dff Fix header guards using reserved identifiers
Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.
2017-08-26 02:56:53 +03:00
Alex Morcos 6af49dddea Output a bit more information for fee calculation report. 2017-08-25 14:59:36 -05:00
Alex Morcos a54c7b94f8 Fix rounding errors in calculation of minimum change size 2017-08-25 14:59:35 -05:00
Wladimir J. van der Laan 07c92b98e2
Merge #10976: [MOVEONLY] Move some static functions out of wallet.h/cpp
f01103c MOVEONLY: Init functions wallet/wallet.cpp -> wallet/init.cpp (Russell Yanofsky)
e7fe320 MOVEONLY: Fee functions wallet/wallet.cpp -> wallet/fees.cpp (Russell Yanofsky)
d97fe20 Move some static functions out of wallet.h/cpp (Russell Yanofsky)

Pull request description:

  This just moves some static wallet fee and init functions out of `wallet/wallet.cpp` and into new `wallet/fees.cpp` and `wallet/init.cpp` source files. There is one commit updating declarations and callers, followed by two MOVEONLY commits actually moving the function bodies.

  This change is desirable because wallet.h/cpp are monolithic and hard to navigate, so pulling things out and grouping together pieces of related functionality should improve the organization.

  Another motivation is the wallet process separation work in https://github.com/bitcoin/bitcoin/pull/10973, where (at least initially) parameter parsing and fee estimation are still done in the main process rather than the wallet process, and having functions that run in different processes scrambled up throughout wallet.cpp is unnecessarily confusing.

Tree-SHA512: 6e6982ff82b2ab4e681c043907e2b1801ceb9513394730070f16c46ad338278a863f5b3759aa13db76a259b268b1c919c81f4e339f0796a3cfb990161e8c316d
2017-08-25 21:30:42 +02:00
danra eefc2f36f3 Move local include to before system includes
Prevents accidental missing includes and hidden dependencies in the local file.
2017-08-25 22:13:07 +03:00
danra e40fa987e4 Simplify bswap_16 implementation
Simplify bswap_16 implementation on platforms which don't already have it defined.
This has no effect on the generated assembly; it just simplifies the source code.
2017-08-25 19:23:02 +03:00
Wladimir J. van der Laan 82dd7195e1 rpc: Write authcookie atomically
Use POSIX rename atomicity at the `bitcoind` side to create a working
cookie atomically:

- Write `.cookie.tmp`, close file
- Rename `.cookie.tmp` to `.cookie`

This avoids clients reading invalid/partial cookies as in #11129.
2017-08-25 15:37:24 +02:00
MarcoFalke 3f726c99f8
Merge #11112: [developer-notes] By default, declare single-argument constructors "explicit"
f1708ef89 Add recommendation: By default, declare single-argument constructors `explicit` (practicalswift)

Pull request description:

  This is a follow-up to the now merged #10969.

  Add recommendation:

  > By default, declare single-argument constructors `explicit`.
  >
  > - *Rationale*: This is a precaution to avoid unintended conversions that might arise when single-argument constructors are used as implicit conversion functions.
  >

Tree-SHA512: 1ceb1008a7863ebd0f09ba9c06b4e28b3b03265d7381f9d0c8bd4be1663d5d0392de0ecd811027aa27c0d962723674b245b3c165a437942a776f3525db39d36b
2017-08-24 20:59:26 -04:00
MarcoFalke 77fc469fc7
Merge #11108: Changing -txindex requires -reindex, not -reindex-chainstate
cd0ea4874 Changing -txindex requires -reindex, not -reindex-chainstate (Matt Corallo)

Pull request description:

  If there's an 0.15.0rc3, this should go in it.

Tree-SHA512: 857e77f0af9c055a3d1d91f37474ee9e06d6bc8c5ed21b29201b6c386801e7041523949076cdf0daa4d357a5175ce49394d85a1bedfbf13f3e577bdb6da1d6ce
2017-08-24 17:31:05 -04:00
Russell Yanofsky de9a1db2ed Acquire cs_main lock before cs_wallet during wallet initialization
CWallet::MarkConflicted may acquire the cs_main lock after
CWalletDB::LoadWallet acquires the cs_wallet lock during wallet initialization.
(CWalletDB::LoadWallet calls ReadKeyValue which calls CWallet::LoadToWallet
which calls CWallet::MarkConflicted). This is the opposite order that cs_main
and cs_wallet locks are acquired in the rest of the code, and so leads to
POTENTIAL DEADLOCK DETECTED errors if bitcoin is built with -DDEBUG_LOCKORDER.

This commit changes CWallet::LoadWallet (which calls CWalletDB::LoadWallet) to
acquire both locks in the standard order. It also fixes some tests that were
acquiring wallet and main locks out of order and failed with the new locking in
CWallet::LoadWallet.

Error was reported by Luke Dashjr <luke-jr@utopios.org> in
https://botbot.me/freenode/bitcoin-core-dev/msg/90244330/
2017-08-24 14:12:21 -04:00