Commit graph

11358 commits

Author SHA1 Message Date
João Barbosa 373aee26c3 wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets
With these new functions all vpwallets usage are removed
and vpwallets is now a static variable (no external linkage).
2018-04-18 22:07:33 +01:00
João Barbosa 6efd9644cf refactor: Drop CWalletRef typedef 2018-04-18 13:41:28 +01:00
Wladimir J. van der Laan 0d12570a80
Merge #13007: test: Fix dangling wallet pointer in vpwallets
d41a420 test: Fix dangling wallet pointer in vpwallets (João Barbosa)

Pull request description:

Tree-SHA512: 83e4ec571f1675b3dab6f7606f29d6fae495d998b4e5794ff14315943783d4518cfa66eba4113293e349eb74aa22a024b21272fdb29c212477edb4c09aec9fa7
2018-04-18 11:30:24 +02:00
Jonas Schnelli 3a8a4dc4a1
Merge #12791: Expose a transaction's weight via RPC
9e50c337c Note new weight field in release-notes. (Matt Corallo)
d0d9112b7 Test new weight field in p2p_segwit (Matt Corallo)
2874709a9 Expose a transaction's weight via RPC (Matt Corallo)

Pull request description:

  This seems like an obvious oversight.

Tree-SHA512: defd047de34fb06a31f589e1a4eef68fcae85095cc67b7c8fb434237bb40300d7f3f97e852d3e7226330e26b96943846b7baf6da0cfc79db8d56e9c1f7848ad9
2018-04-17 20:05:23 +02:00
João Barbosa d41a420562 test: Fix dangling wallet pointer in vpwallets 2018-04-17 18:28:54 +01:00
MarcoFalke 6b46288a08
Merge #12949: tests: Avoid copies of CTransaction
fae58eca93 tests: Avoid copies of CTransaction (MarcoFalke)

Pull request description:

  Avoid the copy (or move) constructor of `CTransaction` in test code, whereever a simple reference can be used instead.

Tree-SHA512: 8ef2077a277d6182996f4671722fdc01a90909ae7431c1e52604aab8ed028910615028caf9b4cb07a9b15fdc04939dea2209cc3189dde7d38271256d9fe1076c
2018-04-17 13:28:12 -04:00
MarcoFalke a63b4e3493
Merge #12982: Fix inconsistent namespace formatting guidelines
cd0e1e91dd Fix inconsistent namespace formatting guidelines (Russell Yanofsky)

Pull request description:

  Suggested formatting for namespaces in the developer guide is currently inconsistent. This commit updates the developer guide and clang-format configuration to consistently put "namespace" and opening/closing braces on the same line. Example:

  ```c++
  namespace boost {
  namespace signals2 {
  class connection;
  } // namespace signals2
  } // namespace boost
  ```

  Currently the [Source code organization](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#source-code-organization) section has an example like the one above, but the [Coding style](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style) section example and description put a newline between the opening "namespace foo" and brace (but oddly no newline between closing namespace and brace).

  Avoiding newlines before namespace opening braces makes nested declarations less verbose and also avoids asymmetry with closing braces. It's also a common style used in our own and other codebases:

  * https://google.github.io/styleguide/cppguide.html#Namespaces
  * https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
  * https://llvm.org/docs/CodingStandards.html#namespace-indentation

Tree-SHA512: 507259478e1a7f6f96db386dd04eb25aa04294f533503fdd82368cf809c3ceaa20204b2cb6ae65322eb27446e5934c1aa1ccb6240ead12aa06b314af76f68139
2018-04-17 13:22:36 -04:00
Wladimir J. van der Laan 58bbc55212
Merge #13004: Print to console by default when not run with -daemon
6a3b0d3 Print to console by default when not run with -daemon (Evan Klitzke)

Pull request description:

  Cherry-picked ef6fa1c38e1bd115d1cce155907023d79da379d8 from the "up for grabs" PR: "Smarter default behavior for -printtoconsole" (#12689).

  See previous review in #12689.

Tree-SHA512: 8923a89b9c8973286d53e960d3c464b1cd026cd5a5911ba62f9f972c83684417dc4004101815dfe987fc1e1baaec1fdd90748a0866bb5548e974d77b3135d43b
2018-04-17 17:07:35 +02:00
Wladimir J. van der Laan 39e0c65b29
Merge #12988: Hold cs_main while calling UpdatedBlockTip() signal
d86edd3 Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip (Jesse Cohen)

Pull request description:

  Resolves #12978

Tree-SHA512: 2aed09434cd8dbf541ea75462070b73ee87ff31409bede210f6999ffee4a37e32202a289efd37609485d4cbdfe134fe4660a10bfb41e8a8acdba7cd0b61b8780
2018-04-17 16:01:12 +02:00
Wladimir J. van der Laan 434150aef7
Merge #12977: Refactor g_wallet_init_interface to const reference
6ec78f1 wallet: Refactor g_wallet_init_interface to const reference (João Barbosa)
1936125 wallet: Make WalletInitInterface members const (João Barbosa)

Pull request description:

Tree-SHA512: c382156a38d4c6beaa6c48f911d7b314542b9500d88724b2b3029dae4491cb1e60e10628f6632d1366818ccf343f494650b3171593b5450149544ba198f49bb5
2018-04-17 15:58:13 +02:00
Evan Klitzke 6a3b0d3d1a Print to console by default when not run with -daemon
Printing to the debug log file can be disabled with -nodebulogfile
2018-04-17 09:58:05 +02:00
Jesse Cohen d86edd3d30 Hold cs_main while calling UpdatedBlockTip() and ui.NotifyBlockTip
Ensures that callbacks are invoked in the order in which the chain is updated
Resolves #12978
2018-04-16 18:03:21 -04:00
Wladimir J. van der Laan 4366f61cc9
Merge #11862: Network specific conf sections
c25321f Add config changes to release notes (Anthony Towns)
5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns)
005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns)
608415d [tests] Unit tests for network-specific config entries (Anthony Towns)
68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns)
d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns)
8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns)
30f9407 [tests] Unit tests for config file sections (Anthony Towns)
95eb66d ArgsManager: support config file sections (Anthony Towns)
4d34fcc ArgsManager: drop m_negated_args (Anthony Towns)
3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns)

Pull request description:

  The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file:

      <cfields> an alternative to that would be sections in a config file. and on the
                cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5.

  This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line.

  The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys.

  I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf:

      wallet=/secret/wallet.dat
      upnp=1

  and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified:

      upnp=1

      [main]
      wallet=/secret/wallet.dat

  For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance.

  I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have:

      maxmempool=200
      [regtest]
      maxmempool=100

  your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect...

  The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected.

  Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos

Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
2018-04-16 20:52:38 +02:00
Wladimir J. van der Laan 6df0c6cb41
Merge #12951: [doc] Fix comment in FindForkInGlobalIndex
0ef7b40 [doc] Fix comment in FindForkInGlobalIndex (James O'Beirne)

Pull request description:

  The comment erroneously implies that we're searching `chainActive` for the
  first block common to `locator`, but we're using the parameter `chain`.

Tree-SHA512: 42ba0fb378597820bdf1eaff1e3e284097baa312e7dd8448421c8c71aa91c353ea6c840860afcb7725f392431f3134d4feb271b96ab7058a62f84f48e468e714
2018-04-16 08:38:28 +02:00
okayplanet d1b828bb46
correcting the array name from pnSeeds6 to pnSeed6 2018-04-14 16:19:40 -07:00
Wladimir J. van der Laan dec61152d6
Merge #12973: Avoid std::locale/imbue madness in DateTimeStrFormat
1527015 Avoid std::locale/imbue in DateTimeStrFormat (Pieter Wuille)

Pull request description:

  And replace them with just hardcoded ISO8601 strings and `gmtime_r`.

  Pointed out by @laanwj here: https://github.com/bitcoin/bitcoin/pull/12970#issuecomment-380962488

Tree-SHA512: a459758b42ca56f8462115aefe8e6377c1319fce509ea64dbb767f3f087c9b848335954cb684e5896c38008847684045505a3e1559fb3e83b8e80e10b003d1e7
2018-04-14 18:32:55 +02:00
Russell Yanofsky cd0e1e91dd Fix inconsistent namespace formatting guidelines
Suggested formatting for namespaces in the developer guide is currently
inconsistent. This commit updates the developer guide and clang-format
configuration to consistently put "namespace" and opening/closing braces
on the same line. Example:

```c++
namespace boost {
namespace signals2 {
class connection;
} // namespace signals2
} // namespace boost
```

Currently the "Source code organization" section has an example like the one
above, but the "Coding style" section example and description put a newline
between the opening "namespace foo" and brace (but oddly no newline between
closing namespace and brace).

Avoiding newlines before namespace opening braces makes nested declarations
less verbose and also avoids asymmetry with closing braces. It's also a
common style used in other codebases:

* https://google.github.io/styleguide/cppguide.html#Namespaces
* https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Classes
* https://llvm.org/docs/CodingStandards.html#namespace-indentation
2018-04-13 15:37:20 -04:00
Matt Corallo 2874709a9f Expose a transaction's weight via RPC 2018-04-13 15:18:26 -04:00
Jonas Schnelli 5f2a39946f
Merge #11200: Allow for aborting rescans in the GUI
ae1d2b030 Give an error when rescan is aborted by the user (Andrew Chow)
69b01e6f8 Add cancel button to rescan progress dialog (Andrew Chow)

Pull request description:

  A cancel button is added to the `showProgress` dialog that is used only for rescans. When clicked, `AbortRescan` is called directly to cancel the rescan.

  Rescans triggered from the debug console will now be cancelable by clicking the cancel button.

  Rescans triggered by a command (e.g. `importmulti`) will now give an error indicating that the rescan was aborted by the user (either by the `abortrescan` command or by clicking cancel).

Tree-SHA512: 4bb14998766de686e2318fbc9805758eccf5dbe628a7257d072c9ae2fb4f61303a0876f49988d6e5eddb261969b8a307c81c0c2df0a42ae909a43d738af3dc1b
2018-04-13 20:51:59 +02:00
Wladimir J. van der Laan 23e7fe8be8
Merge #12569: net: Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s
cba2800 Increase signal-to-noise ratio in debug.log by adjusting log level when logging failed non-manual connect():s (practicalswift)

Pull request description:

  Increase signal-to-noise ratio in `debug.log` by adjusting log level when logging failed non-manual `connect()`:s.

  Before this patch:

  ```
  $ src/bitcoind -printtoconsole
  …
  2018-02-28 18:42:51 UpdateTip: new best=0000000000005448b10a219683d34b770a28044e1cc421032dea1a79ff548948 height=1286903 version=0x20000000 log2_work=69.791313 tx=17408546 date='2018-02-28 18:42:46' progress=1.000000 cache=0.0MiB(173txo)
  2018-02-28 18:37:52 connect() 10.11.21.34:18333 failed after select(): Connection refused (111)
  2018-02-28 18:43:22 connect() to 10.11.43.14:18333 failed after select(): Network is unreachable (101)
  2018-02-28 18:44:49 UpdateTip: new best=000000000000029a521ff2803e1441b09413b876accff5084a4cccf7747d798b height=1286904 version=0x20000000 log2_work=69.791345 tx=17408559 date='2018-02-28 18:44:51' progress=1.000000 cache=0.1MiB(502txo)
  2018-02-28 18:46:54 connect() to [2001:0:9d38:78ff:1234🔢1234:1234]:18333 failed: Network is unreachable (101)
  2018-02-28 18:48:56 connect() to [2001:0:9d38:6aff:1234🔢1234:1234]:18333 failed: Network is unreachable (101)
  2018-02-28 18:49:11 UpdateTip: new best=000000000000000206b79eb235e5dd907b6369de0e5d764330bf40ec0d460311 height=1286905 version=0x20000000 log2_work=69.791377 tx=17408577 date='2018-02-28 18:49:12' progress=1.000000 cache=1.0MiB(5245txo)
  ```

  After this patch:

  ```
  $ src/bitcoind -printtoconsole
  …
  2018-02-28 18:42:51 UpdateTip: new best=0000000000005448b10a219683d34b770a28044e1cc421032dea1a79ff548948 height=1286903 version=0x20000000 log2_work=69.791313 tx=17408546 date='2018-02-28 18:42:46' progress=1.000000 cache=0.0MiB(173txo)
  2018-02-28 18:44:49 UpdateTip: new best=000000000000029a521ff2803e1441b09413b876accff5084a4cccf7747d798b height=1286904 version=0x20000000 log2_work=69.791345 tx=17408559 date='2018-02-28 18:44:51' progress=1.000000 cache=0.1MiB(502txo)
  2018-02-28 18:49:11 UpdateTip: new best=000000000000000206b79eb235e5dd907b6369de0e5d764330bf40ec0d460311 height=1286905 version=0x20000000 log2_work=69.791377 tx=17408577 date='2018-02-28 18:49:12' progress=1.000000 cache=1.0MiB(5245txo)
  ```

  Please note that "manual `connect()`:s" (invoked via `-connect`, `-proxy` or `addnode`) are still reported at the default log level as these messages are likely to be relevant to end-users:

  ```
  $ src/bitcoind -printtoconsole -connect=127.0.0.1:1234
  …
  2018-02-28 18:31:13 connect() to 127.0.0.1:1234 failed after select(): Connection refused (111)

  $ src/bitcoind -printtoconsole -proxy=127.0.0.1:1234
  …
  2018-02-28 18:32:32 connect() to 127.0.0.1:1234 failed after select(): Connection refused (111)

  $ src/bitcoind -printtoconsole &
  $ src/bitcoin-cli addnode 127.0.0.1:1234 onetry
  …
  2018-02-28 18:33:40 connect() to 127.0.0.1:1234 failed after select(): Connection refused (111)
  ```

Tree-SHA512: 92e3c1e4b54ce8ccdd7ec31de147c8505710cd799ceb2bbc8576a086709967802403c9184df364b3cfa59bd98859f6ac8feb27fb09b9324194c6c47a042fc6d3
2018-04-13 19:25:18 +02:00
Wladimir J. van der Laan e625548e7c
Merge #12950: bitcoin-tx: Flatten for loop over one element
fa72f34 bitcoin-tx: Remove unused for loop (MarcoFalke)

Pull request description:

  This flattens out a for loop and gets rid of the then unused vector `txVariants`.

Tree-SHA512: 68081b313d846ce235a97a642c9d0097c3641350e819d6254001f332b053e41fa63ce49faca68120f5aaf5d5f4bfda104662eae781e2956d76a8915770344045
2018-04-13 17:15:15 +02:00
João Barbosa 6ec78f1461 wallet: Refactor g_wallet_init_interface to const reference 2018-04-13 14:07:21 +01:00
João Barbosa 1936125671 wallet: Make WalletInitInterface members const 2018-04-13 14:02:59 +01:00
Pieter Wuille 1527015681 Avoid std::locale/imbue in DateTimeStrFormat 2018-04-13 01:36:53 -07:00
Ben Woosley 8cbc5c4be4
Drop dead code CScript::Find
Last use removed in 922e8e2929 (2012!)
2018-04-12 18:57:23 -07:00
Pieter Wuille 5df84de583
Merge #12970: logging: bypass timestamp formatting when not logging
339730a6d8 logging: bypass timestamp formatting when not logging (Cory Fields)

Pull request description:

  As suggested by @laanwj on IRC:
  ```
  <cfields> whoa
  <cfields> Leaving test case "knapsack_solver_test"; testing time: 358694ms
  <cfields> i386 + old wine ^^
  <cfields> Leaving test case "knapsack_solver_test"; testing time: 6781ms
  <cfields> ^^ same, but with the LogPrint commented out
  ...
  <wumpus> if both log-to-file and log-to-console is disabled, it should probably bypass all logging
  ```
  Edit: The painful line commented out being the LogPrintf in CWallet::AddToWallet.

Tree-SHA512: bc6da67dcdf05e9164fff7a7e9980de897e6f1b0d3f6e1ebde2162cbcba7d54a6ec94283534eb5a1ebde7134533d7fe7e496aa35ea3128c567ed6483eae5212c
2018-04-12 18:35:26 -07:00
Pieter Wuille 4ba6da5574
Merge #12743: Fix csBestBlock/cvBlockChange waiting in rpc/mining
4a6c0e3dcf Modernize best block mutex/cv/hash variable naming (Pieter Wuille)
45dd135039 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille)

Pull request description:

  This is an alternative to #11694.

  It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it.

  Also rename the involved variable to modern guidelines, as there are very few uses.

Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
2018-04-12 18:25:44 -07:00
Cory Fields 339730a6d8 logging: bypass timestamp formatting when not logging
This leads to massive speedups under Wine.
2018-04-12 18:33:30 -04:00
Andrew Chow ae1d2b0308 Give an error when rescan is aborted by the user 2018-04-12 17:00:34 -04:00
Andrew Chow 69b01e6f8b Add cancel button to rescan progress dialog
Adds a cancel button to the rescan progress dialog. When it is clicked,
AbortRescan is called to abort a rescan
2018-04-12 17:00:30 -04:00
Wladimir J. van der Laan 8480d41e0f
Merge #12803: Make BaseSignatureCreator a pure interface
be67831 Make DummySignatureCreator a singleton (Pieter Wuille)
190b8d2 Make BaseSignatureCreator a pure interface (Pieter Wuille)

Pull request description:

  * Removes the `m_provider` field from `BaseSignatureCreator`. Instead both a `SigningProvider` (which provides keys and scripts) and a `BaseSignatureCreator` (which implements the transaction-specific (or other) signing logic) are passed into and down in `ProduceSignature`, making the two concepts orthogonal.
  * Makes `BaseSignatureCreator` a pure interface without constructor, making it easier to implement new derivations of it (for example for message signing).
  * As `DummySignatureCreator` now becomes a stateless object, turn it into a singleton `DUMMY_SIGNATURE_CREATOR`.

Tree-SHA512: 5f1f4512e4ea7d02a31df7b9ede55008efa716c5b74a2630ca1c2fc6599584d8bf5f5641487266127f4b3788033803539fbd22b03ef1219c83c10da2d3da3dcd
2018-04-12 22:55:56 +02:00
Wladimir J. van der Laan 39439e5ab4
Merge #12888: debug log number of unknown wallet records on load
72ec5b7 debug log number of unknown wallet records on load (Gregory Sanders)

Pull request description:

  This would have saved me some time during wallet debugging, with minimal logging clutter.

Tree-SHA512: e11a4d73a5b1d2bd73fe7b75b62fdfa127e21b8641c5b0c76f14ecd292ab374c0d4749f6bd99919b2b3e9cb00c3b5e8179386eb39ac656698306b3b545ee79f1
2018-04-12 09:17:45 +02:00
Wladimir J. van der Laan e561cf4fa8
Merge #12939: Extract consts for WITNESS_V0 hash sizes
3450a9b Extract consts for WITNESS_V0 hash sizes (Ben Woosley)

Pull request description:

Tree-SHA512: 57ba84dfa36aa61cabffce747388143cf1c8724dd2fc42aecf93748158b75dbe278b21a32483a100b8c303f6ad01d048da03b0a5c172175febbe70938ed4339d
2018-04-12 08:36:26 +02:00
James O'Beirne 0ef7b403d0 [doc] Fix comment in FindForkInGlobalIndex
The comment erroneously implies that we're searching `chainActive` for the
first block common to `locator`, but we're using the parameter `chain`.
2018-04-11 15:56:37 -04:00
MarcoFalke 7c06171b3d
Merge #12837: rpc: fix type mistmatch in listreceivedbyaddress
05c03d1249 rpc: fix type mistmatch in listreceivedbyaddress (joemphilips)

Pull request description:

  `txids` filed in return value is supposed be `string` but it was `numeric` in the help message

Tree-SHA512: 7d860994c2d1d9149b41fd7afefc1a44460eede5a023070fcc18b0a4a19a26c5eec5abd157038c15fe7d50a3390bdaf7a4823279129eb1458b0d3c6141a533ee
2018-04-11 15:32:55 -04:00
MarcoFalke fae58eca93
tests: Avoid copies of CTransaction 2018-04-11 14:59:53 -04:00
MarcoFalke fa72f34c64
bitcoin-tx: Remove unused for loop 2018-04-11 14:12:40 -04:00
Gregory Sanders 72ec5b7766 debug log number of unknown wallet records on load 2018-04-11 11:46:14 -04:00
Wladimir J. van der Laan 6d3de17a22
Merge #12925: wallet: Logprint the start of a rescan
cab0824 Logprint the start of a rescan (Jonas Schnelli)

Pull request description:

  Right now, there is no log entry when a rescan starts which is confusing especially when a "still rescanning" log entry appears after the log-update timeout of 60s or when user manually aborts the rescan.

  This PR adds a log entry when a rescan starts.

Tree-SHA512: 8712605af6fd60950bf3904cfb586da6022e44b3da6f3155fe4f02aae16df6044bc504b3d48945ea6d7fe768f0c6cb3282a2e2251d14bf3b7f1dcbd12568b05e
2018-04-11 16:21:10 +02:00
Wladimir J. van der Laan fefb817009
Merge #12942: rpc: Drop redundant testing of signrawtransaction prevtxs args
459ea58 rpc: Drop redundant testing of signrawtransaction prevtxs args (Ben Woosley)

Pull request description:

  These other types are already tested on line 736.

Tree-SHA512: 2efe777c8a63c69ffe0fafcb2f37f134d324a8bc9525510f1079d2215535b511d6308e5e6eec702a3444f87701236c5e7a22f10bb24e5a454010ef421e5ae900
2018-04-11 15:57:41 +02:00
Wladimir J. van der Laan 1b5723ee57
Merge #11617: Avoid lock: Call FlushStateToDisk(...) regardless of fCheckForPruning
0000d8f Document how FlushStateMode::NONE is handled (practicalswift)
2311c7c Call FlushStateToDisk(...) regardless of fCheckForPruning (practicalswift)

Pull request description:

  FlushStateToDisk(...) won't do anything besides check if we need to prune if
  FLUSH_STATE_NONE is given. We avoid reading the variable fCheckForPruning
  which is guarded by the mutex cs_LastBlockFile.

Tree-SHA512: 89df06256f73503a74b9e26d580ce9ed09efaef347fae1ff6a5759a2993b0db52edd2fadb65694d27e579a5aed92127753bdf41b5bb1bd516e577fcf17f17999
2018-04-11 15:29:21 +02:00
Anthony Towns 5e3cbe020d [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections 2018-04-11 23:15:28 +10:00
Anthony Towns 005ad26649 ArgsManager: special handling for -regtest and -testnet 2018-04-11 23:15:28 +10:00
Anthony Towns 608415d4e6 [tests] Unit tests for network-specific config entries 2018-04-11 23:15:28 +10:00
Anthony Towns 68797e20f4 ArgsManager: Warn when ignoring network-specific config setting
When network-specific options such as -addnode, -connect, etc are
specified in the default section of the config file, but that setting is
ignored due to testnet or regtest being in use, and it is not overridden
by either a command line option or a setting in the [regtest] or [test]
section of the config file, a warning is added to the log, eg:

  Warning: Config setting for -connect only applied on regtest network when in [regtest] section.
2018-04-11 23:15:28 +10:00
Anthony Towns d1fc4d95af ArgsManager: limit some options to only apply on mainnet when in default section
When specified in bitcoin.conf without using the [regtest] or [test]
section header, or a "regtest." or "test." prefix, the "addnode",
"connect", "port", "bind", "rpcport", "rpcbind", and "wallet" settings
will only be applied when running on mainnet.
2018-04-11 23:15:28 +10:00
Anthony Towns 30f94074c8 [tests] Unit tests for config file sections 2018-04-11 23:15:28 +10:00
Anthony Towns 95eb66d584 ArgsManager: support config file sections 2018-04-11 23:15:28 +10:00
Anthony Towns 4d34fcc713 ArgsManager: drop m_negated_args
When a -nofoo option is seen, instead of adding it to a separate
set of negated args, set the arg as being an empty vector of strings.

This changes the behaviour in some ways:
 - -nofoo=0 still sets foo=1 but no longer treats it as a negated arg
 - -nofoo=1 -foo=2 has GetArgs() return [2] rather than [2,0]
 - "foo=2 \n -nofoo=1" in a config file no longer returns [2,0], just [0]
 - GetArgs returns an empty vector for negated args
2018-04-11 23:15:28 +10:00
Wladimir J. van der Laan b1fdfc1a8c
Merge #12920: test: Fix sign for expected values
c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
2018-04-11 15:01:34 +02:00