Commit graph

11357 commits

Author SHA1 Message Date
Wladimir J. van der Laan 7b6041d1a7
Merge #12916: Introduce BigEndian wrapper and use it for netaddress ports
ece88fd Introduce BigEndian wrapper and use it for netaddress ports (Pieter Wuille)

Pull request description:

  This is another small improvement taken from #10785.

  Instead of manually converting from/to BE format in the `CService` serializer, provide a generic way in serialize.h to serialize BE data (only 16 bits for now).

Tree-SHA512: bd67cf7eed465dad08551fb62f659e755e0691e4597a9f59d285d2b79975b50e5710d35a34a185b5ad232e1deda9a4946615f9132b1ed7d96ed8087f73ace66b
2018-04-11 14:23:58 +02:00
practicalswift 0000d8f727 Document how FlushStateMode::NONE is handled 2018-04-11 12:45:59 +02:00
practicalswift 2311c7cc86 Call FlushStateToDisk(...) regardless of fCheckForPruning
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.
2018-04-11 12:40:08 +02:00
Ben Woosley 459ea5836e
rpc: Drop redundant testing of signrawtransaction prevtxs args
These other types are already tested on line 736.
2018-04-11 03:33:01 -07:00
Wladimir J. van der Laan 807d2ac186
Merge #12941: [Trivial] Ignore macOS daemon() depracation warning
12e7c55 Ignore macOS daemon() depracation warning (Jonas Schnelli)

Pull request description:

  `daemon()` is deprecated on OSX since 10.5 (should migrate to `posix_spawn()`). There are no signs `daemon()` will get removed by Apple.

Tree-SHA512: d5bcdc5d6b507576e0358906a73f9c766f2072f4a9aef6bdc559e10dbec95337ffa50a1ccb60f7197591e2e74f87c74c13387de880aaedc6dbf3796253f69561
2018-04-11 11:43:23 +02:00
Wladimir J. van der Laan 9b3370d1c6
Merge #12892: [wallet] [rpc] introduce 'label' API for wallet
41ba061 [docs] Add release notes for wallet 'label' API. (John Newbery)
189e0ef [wallet] [rpc] introduce 'label' API for wallet (Wladimir J. van der Laan)

Pull request description:

  Add label API to wallet RPC.

  This is one step towards #3816 ("Remove bolt-on account system") although it doesn't
  actually remove anything yet.

  These initially mirror the account functions, with the following differences:

  - These functions aren't DEPRECATED in the help
  - Help mentions 'label' instead of accounts. In the language used, labels are
    associated with addresses, instead of addresses associated with labels. (unlike
    with accounts.)
  - Labels have no balance
    - No balances in `listlabels`
    - `listlabels` has no minconf or watchonly argument
  - Like in the GUI, labels can be set on any address, not just receiving addreses
  - Unlike accounts, labels can be deleted.
    Being unable to delete them is a common annoyance (see #1231).
    Currently only by reassigning all addresses using `setlabel`, but an explicit
    call `deletelabel` which assigns all address to the default label may make
    sense.

Tree-SHA512: 45cc313c68ad529ce3a15c02181d2ab0083a7e14fe824e2cde34972713fecce512e3d4b9aa46db5355f2baa857c44b234d4fe9709225bc23c7ebbc0e03febbf5
2018-04-11 11:41:20 +02:00
Jonas Schnelli 12e7c558af
Ignore macOS daemon() depracation warning 2018-04-11 10:19:44 +02:00
Anthony Towns 3673ca36ef ArgsManager: keep command line and config file arguments separate 2018-04-11 18:13:54 +10:00
Karl-Johan Alm c55aa4f27d
test: Fix sign for expected values
A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.
2018-04-11 13:39:41 +09:00
Ben Woosley 3450a9b25c
Extract consts for WITNESS_V0 hash sizes 2018-04-10 20:13:32 -07:00
Wladimir J. van der Laan 189e0ef33e [wallet] [rpc] introduce 'label' API for wallet
Add label API to wallet RPC.

This is one step towards #3816 ("Remove bolt-on account system") although it doesn't
actually remove anything yet.

These initially mirror the account functions, with the following differences:

- These functions aren't DEPRECATED in the help
- Help mentions 'label' instead of accounts. In the language used, labels are
  associated with addresses, instead of addresses associated with labels. (unlike
  with accounts.)
- Labels have no balance
  - No balances in `listlabels`
  - `listlabels` has no minconf or watchonly argument
- Like in the GUI, labels can be set on any address, not just receiving addreses
- Unlike accounts, labels can be deleted.
  Being unable to delete them is a common annoyance (see #1231).
  Currently only by reassigning all addresses using `setlabel`, but an explicit
  call `deletelabel` which assigns all address to the default label may make
  sense.

Thanks to Pierre Rochard for test fixes.
2018-04-10 19:27:22 -04:00
251 40c58866c7 Fix illegal default addProxy and addrSeparateProxyTor settings. 2018-04-10 22:22:55 +02:00
Wladimir J. van der Laan 0a8054e7cd
Merge #12731: Support serialization as another type without casting
818dc74 Support serialization as another type without casting (Pieter Wuille)

Pull request description:

  This adds a `READWRITEAS(type, obj)` macro which serializes `obj` as if it were converted to `const type&` when `const`, and to `type&` when non-`const`. No actual cast is involved, so this only works when this conversion can be done automatically.

  This makes it usable in serialization code that uses a single implementation for both serialization and deserializing, which doesn't know the constness of the object involved.

  This is a redo of #12712, using a slightly different interface.

Tree-SHA512: 262f0257284ff99b5ffaec9b997c194e221522ba35c3ac8eaa9bb344449d7ea0a314de254dc77449fa7aaa600f8cd9a24da65aade8c1ec6aa80c6e9a7bba5ca7
2018-04-10 20:54:33 +02:00
Wladimir J. van der Laan a84b056d5f
Merge #12749: [wallet] feebumper: discard change outputs below discard rate
f526046 adapt bumpfee change discard test to be more strict and add note on p2sh discrep (Gregory Sanders)
5805d6f feebumper: discard change outputs below discard rate (Gregory Sanders)

Pull request description:

  The "discard rate" is the concept we use to ensure the wallet isnt creating not so useful just-above-relay dust.

  Outside of bumpfee previous to this PR, and manually creating such an output, the wallet will never make change outputs of that size, preferring to send them to fees instead.

  "Worst case" for the user is that users pay a slightly higher feerate than they were expecting, which is already a possibility with relay dust.

Tree-SHA512: dd69351810dc1709437602e7db1be46e4e905ccd8e16d03952de8b4c1fdbf9cb7e6c99968930896baf6b5c7cb005a03ec0506a2669d22e21e32982e60329606b
2018-04-10 19:35:51 +02:00
Pieter Wuille be67831210 Make DummySignatureCreator a singleton 2018-04-10 09:29:17 -07:00
Pieter Wuille 190b8d2dcf Make BaseSignatureCreator a pure interface 2018-04-10 09:29:17 -07:00
Wladimir J. van der Laan 9b9d717263 wallet: Remove redundant lambda function arg in handleTransactionChanged
Makes the build warning-clean again here:

    bitcoin/src/interfaces/wallet.cpp:425:18: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
                [fn, this](CWallet*, const uint256& txid, ChangeType status) { fn(txid, status); }));
                     ^
2018-04-10 15:23:37 +02:00
Wladimir J. van der Laan dd1ca9e0b3
Merge #12926: Run unit tests in parallel
7ef9cd8 Increase entropy in test temp directory name (Pieter Wuille)
f6dfb0f Reorder travis builds (Pieter Wuille)
156db42 tests: run tests in parallel (Cory Fields)
66f3255 tests: split up actual tests and helper files (Cory Fields)

Pull request description:

  This runs the unit tests (`src/test/test_bitcoin`) in 4 separate simultaneous processes, significantly speeding up some Travis runs (over 2x for win32).

  This uses an approach by @theuni that relies on `make` as the mechanism for distributing tests over processes (through `-j`). For every test .cpp file, we search for `BOOST_FIXTURE_TEST_SUITE` or `BOOST_AUTO_TEST_SUITE`, and then invoke the test binary for just that suite (using `-t`). The (verbose) output is stored in a temporary file, and only shown in the case of failure.

  Some makefile reshuffling is necessary to avoid trying to run tests from `src/test/test_bitcoin.cpp` for example, which contains framework/utility code but no real tests.

  Finally, order the Travis jobs from slow to fast (apart from the arm/doc job which goes first, for fast failure). This should help reducing the total wall clock time before opening a PR and finishing Travis, in case where not all jobs are started simultaneously.

  This is an alternative to #12831.

Tree-SHA512: 9f82eb4ade14ac859618da533c7d9df2aa9f5592a076dcc4939beeffd109eda33f7d5480d8f50c0d8b23bf3099759e9f3a2d4c78efb5b66b04569b39b354c185
2018-04-10 14:27:18 +02:00
Pieter Wuille 7ef9cd8491 Increase entropy in test temp directory name 2018-04-09 19:59:29 -04:00
Cory Fields 156db42c3f tests: run tests in parallel 2018-04-09 19:56:25 -04:00
Cory Fields 66f32551bd tests: split up actual tests and helper files 2018-04-09 19:55:49 -04:00
MarcoFalke 06ead15050
Merge #12927: Docs: fixed link, replaced QT with Qt
7039319db5 Docs: fixed link, replaced QT with Qt (Darko Janković)

Pull request description:

Tree-SHA512: 6c071189b4c030d03d3d09535333d2ed7115fba07ee2561591124c2063041966cc8012e4d8416c3dda155f2df5e15b8f772712cac35b4d266b50c48f4d74b6e4
2018-04-09 19:09:56 -04:00
Darko Janković 7039319db5
Docs: fixed link, replaced QT with Qt 2018-04-09 22:55:36 +02:00
Steve Lee 23abfb7b7f added logging line back that was accidentally removed with #10762 2018-04-09 12:21:25 -07:00
Wladimir J. van der Laan 0700b6f778
Merge #11851: scripted-diff: Rename wallet database classes
9b0f0c5 Add m_ prefix to WalletBatch::m_batch (Russell Yanofsky)
398c6f0 Update walletdb comment after renaming. (Russell Yanofsky)
ea23945 scripted-diff: Rename wallet database classes (Russell Yanofsky)

Pull request description:

  Scripted diff to rename some wallet classes. Motivated by discussion in https://github.com/bitcoin/bitcoin/pull/11687#discussion_r155354119

  | Current          | New                 |
  | ---------------- | ------------------- |
  | CDBEnv           | BerkeleyEnvironment |
  | CDB              | BerkeleyBatch       |
  | CWalletDBWrapper | WalletDatabase      |
  | CWalletDB        | WalletBatch         |

  Berkeley\* classes are intended to contain BDB specific code, while Wallet\* classes are intended to be more backend-agnostic.

  Also renamed associated variables:

  | Current             | New             |
  | ------------------- | --------------- |
  | dbw                 | database        |
  | pwalletdb           | batch           |
  | pwalletdbEncryption | encrypted_batch |

Tree-SHA512: 372f2e24b2deb59d4792b5ed578aaf0cce51b6db41c400bef5d0c2cd7833e62ae4d4afa0f6000268d52e15b20f737c5a55f1cecf7768556a782fd8cd6fe051d9
2018-04-09 19:29:54 +02:00
Jonas Schnelli cab0824c96
Logprint the start of a rescan 2018-04-09 18:49:09 +02:00
Wladimir J. van der Laan b86730a4d7 util: Remove designator initializer from ScheduleBatchPriority
Although no compiler appears to complain about it, these are
not valid for c++11.
(http://en.cppreference.com/w/cpp/language/aggregate_initialization says they're c++20)

The structure is defined as:

   struct sched_param {
       int sched_priority;
   };

So passing 0 for the first field has the same effect.
2018-04-09 17:02:19 +02:00
Wladimir J. van der Laan cff66e6a29 util: Pass pthread_self() to pthread_setschedparam instead of 0
Nowhere in the man page of `pthread_setschedparam` it is mentioned that
`0` is a valid value. The example uses `pthread_self()`, so should we.

(noticed by Anthony Towns)
2018-04-09 15:44:46 +02:00
MarcoFalke 603975b96a
Merge #12770: Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer conversion
9142dfea81 Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer conversion (practicalswift)

Pull request description:

  Use explicit casting in cuckoocache's `compute_hashes(...)` to clarify integer conversion.

  I discussed this code with the code's author @JeremyRubin who suggested patching it to avoid any confusion.

  At least one static analyzer incorrectly warns about a shift past bitwidth (UB) here, so this patch will help avoid confusion for human reviewers and static analyzers alike :-)

Tree-SHA512: 0419ee31b422d2ffedbd1a100688ec0ff5b0c1690d6d92592f638ca8db07a21a9650cb467923108c6f14a38d2bf07d6e6c85d2d1d4b7da53ffe6919f94f32655
2018-04-09 08:06:09 -04:00
MarcoFalke cd8e45b4e7
Merge #12007: [Doc] Clarify the meaning of fee delta not being a fee rate in prioritisetransaction RPC
c198dc00e1 [Doc] Clarify the meaning of fee delta not being a fee rate in prioritisetransaction RPC (Jan Čapek)

Pull request description:

  Hi,

  I have faced some confusion among our developers considering this being a fee rate. Would you consider including this tiny doc update?

  Best regards,

  Jan Capek

Tree-SHA512: cd0560540418e53c5c19ceab2d5aca229f4ef6b788b9543695742522e1c63a7f2cce2574b47fead098a106da2f77e297f0c728474565f6259b50d62369bbe7da
2018-04-09 08:04:10 -04:00
practicalswift 280023f31d Remove duplicate includes 2018-04-09 09:18:49 +02:00
Wladimir J. van der Laan 4781813b56
Merge #12537: [arith_uint256] Make it safe to use "self" in operators
b120f7b [test] Add tests for self usage in arith_uint256 (Karl-Johan Alm)
08b17de [arith_uint256] Do not destroy *this content if passed-in operator may reference it (Karl-Johan Alm)

Pull request description:

  Before this fix (see test commit), `v *= v` would result in `0` because `operator*=` set `*this` (`==b`) to `0` at the start. This patch changes the code to use `a` as temporary for `*this`~~, with drawback that `*this` is set to `a` at the end, an extra `=` operation in other words~~.

Tree-SHA512: 8028a99880c3198a39c4bcc5056169735ba960625d553e15c0317510a52940c875f7a1fefe14e1af7fcf10c07a246411994a328cb1507bf3eaf1b6e7425390dc
2018-04-09 05:57:19 +02:00
Pieter Wuille ece88fd269 Introduce BigEndian wrapper and use it for netaddress ports 2018-04-08 15:31:01 -07:00
MarcoFalke bd42b85e8b
Merge #12905: [rpcwallet] Clamp walletpassphrase value at 100M seconds
2b2b96cd45 Use std::bind instead of boost::bind to re-lock the wallet (Suhas Daftuar)
662d19ff72 [rpcwallet] Clamp walletpassphrase value at 100M seconds (Suhas Daftuar)

Pull request description:

  Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping).

Tree-SHA512: 890f3b641f6c586e2f8f629a9d23bca6ceb8b237b285561aad488cb7adf941a21177d3129d0c2b8293c0a673cd8e401957dbe2b6b3b7c8c4e991bb411d260102
2018-04-08 12:58:46 -04:00
Wladimir J. van der Laan 97785863e2
Merge #12886: Introduce Span type and use it instead of FLATDATA
9272d70 Support serializing Span<unsigned char> and use that instead of FLATDATA (Pieter Wuille)
833bc08 Add Slice: a (pointer, size) array view that acts like a container (Pieter Wuille)

Pull request description:

  Introduce a new data type `Span`, which is an encapsulated pointer + size (like C++20's `std::span` or LevelDB's `Slice`), and represents a view to a sequence of objects laid out continuously in memory.

  The immediate use case is replacing the remaining `FLATDATA` invocations. Instead of those, we support serializing/deserializing unsigned char `Span`s (treating them as arrays).

  A longer term goal for `Span`s is making the script execution operate on them rather than on `CScript` itself. This will allow separate storage mechanisms for scripts.

Tree-SHA512: 7b0da3c802e5df367f223275004d16b04262804c007b7c73fda927176f0a9c3b2ef3225fa842cb73500b0df73175ec1419f1f5239de2402e21dd9ae8e5d05233
2018-04-08 18:13:49 +02:00
Suhas Daftuar 2b2b96cd45 Use std::bind instead of boost::bind to re-lock the wallet
Change suggested by Marco Falke.
2018-04-08 10:44:40 -04:00
Suhas Daftuar 662d19ff72 [rpcwallet] Clamp walletpassphrase value at 100M seconds
Larger values seem to trigger a bug on macos+libevent (resulting in the
rpc server stopping).
2018-04-08 10:44:40 -04:00
Jonas Schnelli 25c56cdbe7
Merge #12878: [refactor] Config handling refactoring in preparation for network-specific sections
77a733a99 [tests] Add additional unit tests for -nofoo edge cases (Anthony Towns)
af173c2be [tests] Check GetChainName works with config entries (Anthony Towns)
fa27f1c23 [tests] Add unit tests for ReadConfigStream (Anthony Towns)
087c5d204 ReadConfigStream: assume the stream is good (Anthony Towns)
6d5815aad Separate out ReadConfigStream from ReadConfigFile (Anthony Towns)
834d30341 [tests] Add unit tests for GetChainName (Anthony Towns)
11b6b5b86 Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName (Anthony Towns)

Pull request description:

  This does a bit of refactoring of the configuration handling code in order to add additional tests to make adding support for [test]/[regtest] sections in the config file in #11862 easier. Should not cause any behaviour changes.

Tree-SHA512: 8d2ce1449fc180de03414e7e569d1a21ba1e9f6564e13d3faf3961f710adc725fa0d4ab49b89ebd2baa11ea36ac5018377f693a84037d386a8b8697c9d6db3e9
2018-04-08 16:24:30 +02:00
Wladimir J. van der Laan 24133b177a
Merge #12561: Check for block corruption in ConnectBlock()
0e7c52d Shut down if trying to connect a corrupted block (Suhas Daftuar)

Pull request description:

  (Updated OP after reworking the approach)

  Shut down if a corrupted block is found in ConnectBlock().  This prevents an infinite loop trying to connect such a block, and alerts the node operator that there may be potential hardware failure.

Tree-SHA512: f20d56aa9d36d6eeff4c3d13c0fbd14f06a57701bd13c2416d36f0cc4235f81f752139e336a073617e8e803782c5096c960108af122b19a51227de512e9095ee
2018-04-08 11:08:43 +02:00
Wladimir J. van der Laan 3190785c11
Merge #12891: [logging] add lint-logs.sh to check for newline termination.
d207207 [logging] add lint-logs.sh to check for newline termination. (John Newbery)
5c21e6c [logging] Comment all continuing logs. (John Newbery)

Pull request description:

  Check that all calls to LogPrintf() are terminated by a newline,
  except those that are explicitly marked as 'continued' logs.

Tree-SHA512: fe5162b2b2df1e8a4c807da87584fa9af97a6b8377e4090fe0caa136d90bf29a487a123cde94569bdce7101fee3478196d99aa13f1212e24bfe5f41c773604fc
2018-04-08 11:04:49 +02:00
Wladimir J. van der Laan d6f10b248a
Merge #12895: tests: Add note about test suite name uniqueness requirement to developer notes
d1b622b tests: Add check for test suite name uniqueness in lint-tests.sh (practicalswift)
dc8067b tests: Add note about uniqueness requirement for test suite names (practicalswift)
3ebfb2d tests: Avoid test suite name collision in wallet crypto_tests (MarcoFalke)

Pull request description:

  * Add documentation: Add note about test suite name uniqueness requirement in developer notes
  * Add regression test: Update `lint-tests.sh` to make it check also for test suite name uniqueness

  Context: #12894 (`tests: Avoid test suite name collision in wallet crypto_tests`)

Tree-SHA512: 3c8502db069ef3d753f534976a86a997b12bac539e808a7285193bf81c9dd8c1b06821c3dd1bdf870ab87722b02c8aa9574c62ace70c2a1b8091785cb8c9aace
2018-04-08 10:47:35 +02:00
MarcoFalke 048ac8326b
Merge #12906: Avoid interface keyword to fix windows gitian build
17780d6f35 scripted-diff: Avoid `interface` keyword to fix windows gitian build (Russell Yanofsky)

Pull request description:

  Rename `interface` to `interfaces`

  Build failure reported by ken2812221 in https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-379434756

Tree-SHA512: e02c97c728540f344202c13b036f9f63af23bd25e25ed7a5cfe9e2c2f201a12ff232cc94a93fbe37ef6fb6bf9e036fe62210ba798ecd30de191d09338754a8d0
2018-04-07 15:19:47 -04:00
Wladimir J. van der Laan becd8dd2ec
Merge #12618: Set SCHED_BATCH priority on the loadblk thread.
d54874d Set SCHED_BATCH priority on the loadblk thread. (Evan Klitzke)

Pull request description:

  Today I came across #10271, and while reading the discussion #6358 was linked to. Linux systems have a `SCHED_BATCH` scheduler priority that is useful for threads like loadblk. You can find the full details at [sched(7)](http://man7.org/linux/man-pages/man7/sched.7.html), but I'll quote the relevant part of the man page below:

  > ...this policy will cause the scheduler to always assume that the thread is
  CPU-intensive. Consequently, the scheduler will apply a small scheduling penalty
  with respect to wakeup behavior, so that this thread is mildly disfavored in
  scheduling decisions.
  >
  > This policy is useful for workloads that are noninteractive, but do not want to
  lower their nice value, and for workloads that want a deterministic scheduling
  policy without interactivity causing extra preemptions (between the workload's
  tasks).

  I think this change is useful independently of #10271 and irrespective of whether that change is merged. Under normal operation the loadblk thread will just import `mempool.dat`. However, if Bitcoin is started with `-reindex` or `-reindex-chainstate` this thread will use a great deal of CPU while it rebuilds the chainstate database (and the block database in the case of `-reindex`). By setting `SCHED_BATCH` this thread is less likely to interfere with interactive tasks (e.g. the user's web browser, text editor, etc.).

  I'm leaving the nice value unchanged (which also affects scheduling decisions) because I think that's better set by the user. Likewise I'm not using [ioprio_set(2)](http://man7.org/linux/man-pages/man2/ioprio_set.2.html) because it can cause the thread to become completely I/O starved (and knowledgeable users can use `ionice(1)` anyway).

Tree-SHA512: ea8f7d3921ed5708948809da771345cdc33efd7ba3323e9dfec07a25bc21e8612e2676f9c178e2710c7bc437e8c9cafc5e0463613688fea5699b6e8e2fec6cff
2018-04-07 19:48:39 +02:00
Russell Yanofsky 9b0f0c5513 Add m_ prefix to WalletBatch::m_batch 2018-04-07 12:48:27 -04:00
Russell Yanofsky 398c6f0f9d Update walletdb comment after renaming.
Text from https://github.com/bitcoin/bitcoin/pull/11851#issuecomment-350320608
by John Newbery <john@johnnewbery.com>.
2018-04-07 11:48:27 -05:00
Russell Yanofsky ea23945dbc scripted-diff: Rename wallet database classes
-BEGIN VERIFY SCRIPT-

sed -i 's/\<CWalletDBWrapper\>/BerkeleyDatabase/g' src/wallet/db.h src/wallet/db.cpp
sed -i '/statuses/i/** Backend-agnostic database type. */\nusing WalletDatabase = BerkeleyDatabase\;\n' src/wallet/walletdb.h
ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' ':(exclude)*dbwrapper*' test | xargs sed -i "s:\<$1\>:$2:g"; }
ren CDBEnv           BerkeleyEnvironment
ren CDB              BerkeleyBatch
ren CWalletDBWrapper WalletDatabase
ren CWalletDB        WalletBatch
ren dbw              database
ren m_dbw            m_database
ren walletdb         batch
ren pwalletdb        batch
ren pwalletdbIn      batch_in
ren wallet/batch.h   wallet/walletdb.h
ren pwalletdbEncryption encrypted_batch

-END VERIFY SCRIPT-
2018-04-07 11:48:27 -05:00
Wladimir J. van der Laan f8d6dc47cb
Merge #12860: Add testmempoolaccept to release-notes, Add missing const
fafcad3 doc: Add testmempoolaccept to release-notes (MarcoFalke)

Pull request description:

  Some fixups for #11742:

  * Add release notes for the new rpc
  * Fix a typo in the original pull
  * Make the mempool reference passed to `CheckInputsFromMempoolAndCache` const, since that function is called before we return from ATMP and we must not modify the mempool.

Tree-SHA512: 72c459ba69f7698a69c91d2592f10f7fb1864846c7d8c525050d48286f92ba5ec5fe554c54235b52fbd9a8f00226c526ad84584641ec39084e1a1310a261510d
2018-04-07 18:43:39 +02:00
John Newbery 5c21e6c6d3 [logging] Comment all continuing logs.
Most logs should terminated with a '\n'. Some logs
are built up over multiple calls to logPrintf(), so
do not need a newline terminater. Comment all of
these 'continued' logs as a linter hing.
2018-04-07 12:29:48 -04:00
Wladimir J. van der Laan 215158a633
Merge #12785: wallet: Initialize m_last_block_processed to nullptr
f63bc5e wallet: Initialize m_last_block_processed to nullptr. Initialize fields where defined. (practicalswift)

Pull request description:

  Initialize `m_last_block_processed` to `nullptr`.

  `m_last_block_processed` was introduced in 5ee3172636.

Tree-SHA512: 6e4a807e5b02115cbd80460761056f2eb22043203212d88dd0cd44c28dc0abce30ab29b078ca2c612232e76af4886f4fdbf2b0ff75e2df19b4d1a801b236cc13
2018-04-07 16:40:08 +02:00
Russell Yanofsky 17780d6f35 scripted-diff: Avoid interface keyword to fix windows gitian build
Rename `interface` to `interfaces`

Build failure reported by Chun Kuan Lee <ken2812221@gmail.com>
https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-379434756

-BEGIN VERIFY SCRIPT-

git mv src/interface src/interfaces
ren() { git grep -l "$1" | xargs sed -i "s,$1,$2,g"; }
ren interface/            interfaces/
ren interface::           interfaces::
ren BITCOIN_INTERFACE_    BITCOIN_INTERFACES_
ren "namespace interface" "namespace interfaces"

-END VERIFY SCRIPT-
2018-04-07 03:42:02 -04:00
MarcoFalke 3ebfb2dadb tests: Avoid test suite name collision in wallet crypto_tests 2018-04-06 16:29:14 +02:00
João Barbosa d894894aab wallet: Refactor to WalletInitInterface* const g_wallet_init_interface 2018-04-05 21:09:22 +01:00
João Barbosa 39bc2faa2e wallet: Make WalletInitInterface and DummyWalletInit private 2018-04-05 21:09:21 +01:00
Anthony Towns 77a733a99a [tests] Add additional unit tests for -nofoo edge cases 2018-04-06 04:46:39 +10:00
Anthony Towns af173c2bec [tests] Check GetChainName works with config entries 2018-04-06 04:46:32 +10:00
Anthony Towns fa27f1c23e [tests] Add unit tests for ReadConfigStream 2018-04-06 04:46:32 +10:00
Anthony Towns 087c5d2040 ReadConfigStream: assume the stream is good 2018-04-06 04:46:32 +10:00
Anthony Towns 6d5815aad0 Separate out ReadConfigStream from ReadConfigFile 2018-04-06 04:46:32 +10:00
Anthony Towns 834d303415 [tests] Add unit tests for GetChainName 2018-04-06 04:46:23 +10:00
Anthony Towns 11b6b5b86e Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName 2018-04-06 04:46:02 +10:00
Wladimir J. van der Laan 5f0c6a7b0e
Merge #10244: Refactor: separate gui from wallet and node
9960137 Add developer notes about blocking GUI code (Russell Yanofsky)
9a61eed Use WalletBalances struct in Qt (Russell Yanofsky)
56f33ca Remove direct bitcoin calls from qt/sendcoinsdialog.cpp (Russell Yanofsky)
e872c93 Remove direct bitcoin access from qt/guiutil.cpp (Russell Yanofsky)
5884558 Remove direct bitcoin calls from qt transaction table files (Russell Yanofsky)
3cab2ce Remove direct bitcoin calls from qt/paymentserver.cpp (Russell Yanofsky)
3ec2ebc Remove direct bitcoin calls from qt/addresstablemodel.cpp (Russell Yanofsky)
827de03 Remove direct bitcoin calls from qt/coincontroldialog.cpp (Russell Yanofsky)
a0704a8 Remove most direct bitcoin calls from qt/walletmodel.cpp (Russell Yanofsky)
90d4640 Remove direct bitcoin calls from qt/optionsdialog.cpp (Russell Yanofsky)
582daf6 Remove direct bitcoin calls from qt/rpcconsole.cpp (Russell Yanofsky)
3034a46 Remove direct bitcoin calls from qt/bantablemodel.cpp (Russell Yanofsky)
e0b66a3 Remove direct bitcoin calls from qt/peertablemodel.cpp (Russell Yanofsky)
d7c2c95 Remove direct bitcoin calls from qt/intro.cpp (Russell Yanofsky)
fe6f27e Remove direct bitcoin calls from qt/clientmodel.cpp (Russell Yanofsky)
5fba3af Remove direct bitcoin calls from qt/splashscreen.cpp (Russell Yanofsky)
c2f672f Remove direct bitcoin calls from qt/utilitydialog.cpp (Russell Yanofsky)
3d619e9 Remove direct bitcoin calls from qt/bitcoingui.cpp (Russell Yanofsky)
c0f2756 Remove direct bitcoin calls from qt/optionsmodel.cpp (Russell Yanofsky)
71e0d90 Remove direct bitcoin calls from qt/bitcoin.cpp (Russell Yanofsky)
ea73b84 Add src/interface/README.md (Russell Yanofsky)

Pull request description:

  This is a refactoring PR that does not change behavior in any way. This change:

  1. Creates abstract [`Node`](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-local/src/interface/node.h) and [`Wallet`](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-local/src/interface/wallet.h) interfaces in [`src/interface/`](https://github.com/ryanofsky/bitcoin/tree/pr/ipc-local/src/interface)
  1. Updates Qt code to call the new interfaces. This largely consists of diffs of the form:

  ```diff
  -    InitLogging();
  -    InitParameterInteraction();
  +    node.initLogging();
  +    node.initParameterInteraction();
  ```

  This change allows followup PR #10102 (makes `bitcoin-qt` control `bitcoind` over an IPC socket) to work without any significant updates to Qt code. Additionally:

  * It provides a single place to describe the interface between GUI and daemon code.
  * It can make better GUI testing possible, because Node and Wallet objects have virtual methods that can be overloaded for mocking.
  * It can be used to help make the GUI more responsive (see https://github.com/bitcoin/bitcoin/issues/10504)

  Other notes:

  * I used python scripts [hide-globals.py](https://github.com/ryanofsky/home/blob/master/src/2017/hide-globals/hide-globals.py) and [replace-syms.py](https://github.com/ryanofsky/home/blob/master/src/2017/hide-globals/replace-syms.py) to identify all the places where Qt code was accessing libbitcoin global variables and calling functions accessing those global variables.
  * These changes were originally part of #10102. Thanks to @JeremyRubin for the suggestion of splitting them out.

  Commits:

  - [`ea73b84d2d` Add src/interface/README.md](ea73b84d2d)
  - [`71e0d90876` Remove direct bitcoin calls from qt/bitcoin.cpp](71e0d90876)
  - [`c0f2756be5` Remove direct bitcoin calls from qt/optionsmodel.cpp](c0f2756be5)
  - [`3d619e9d36` Remove direct bitcoin calls from qt/bitcoingui.cpp](3d619e9d36)
  - [`c2f672fb19` Remove direct bitcoin calls from qt/utilitydialog.cpp](c2f672fb19)
  - [`5fba3af21e` Remove direct bitcoin calls from qt/splashscreen.cpp](5fba3af21e)
  - [`fe6f27e6ea` Remove direct bitcoin calls from qt/clientmodel.cpp](fe6f27e6ea)
  - [`d7c2c95948` Remove direct bitcoin calls from qt/intro.cpp](d7c2c95948)
  - [`e0b66a3b7c` Remove direct bitcoin calls from qt/peertablemodel.cpp](e0b66a3b7c)
  - [`3034a462a5` Remove direct bitcoin calls from qt/bantablemodel.cpp](3034a462a5)
  - [`582daf6d22` Remove direct bitcoin calls from qt/rpcconsole.cpp](582daf6d22)
  - [`90d4640b7e` Remove direct bitcoin calls from qt/optionsdialog.cpp](90d4640b7e)
  - [`a0704a8996` Remove most direct bitcoin calls from qt/walletmodel.cpp](a0704a8996)
  - [`827de038ab` Remove direct bitcoin calls from qt/coincontroldialog.cpp](827de038ab)
  - [`3ec2ebcd9b` Remove direct bitcoin calls from qt/addresstablemodel.cpp](3ec2ebcd9b)
  - [`3cab2ce5f9` Remove direct bitcoin calls from qt/paymentserver.cpp](3cab2ce5f9)
  - [`58845587e1` Remove direct bitcoin calls from qt transaction table files](58845587e1)
  - [`e872c93ee8` Remove direct bitcoin access from qt/guiutil.cpp](e872c93ee8)
  - [`56f33ca349` Remove direct bitcoin calls from qt/sendcoinsdialog.cpp](56f33ca349)
  - [`9a61eed1fc` Use WalletBalances struct in Qt](9a61eed1fc)
  - [`9960137697` Add developer notes about blocking GUI code](9960137697)

Tree-SHA512: 7b9eff2f37d4ea21972d7cc6a3dbe144248595d6c330524396d867f3cd2841d666cdc040fd3605af559dab51b075812402f61d628d16cf13719335c1d8bf8ed3
2018-04-05 18:19:35 +02:00
Pieter Wuille 9272d70536 Support serializing Span<unsigned char> and use that instead of FLATDATA 2018-04-05 08:20:37 -07:00
Pieter Wuille 833bc08583 Add Slice: a (pointer, size) array view that acts like a container 2018-04-05 08:20:37 -07:00
practicalswift f63bc5e063 wallet: Initialize m_last_block_processed to nullptr. Initialize fields where defined. 2018-04-05 15:49:30 +02:00
Wladimir J. van der Laan bd59c4395c
Merge #12859: Bugfix: Include <memory> for std::unique_ptr
a5bca13 Bugfix: Include <memory> for std::unique_ptr (Luke Dashjr)

Pull request description:

  Not sure why all these includes were missing, but it's breaking builds for some users:

  https://bugs.gentoo.org/show_bug.cgi?id=652142

  (Added to all files with a reference to `std::unique_ptr`)

Tree-SHA512: 8a2c67513ca07b9bb52c34e8a20b15e56f8af2530310d9ee9b0a69694dd05e02e7a3683f14101a2685d457672b56addec591a0bb83900a0eb8e2a43d43200509
2018-04-05 09:31:53 +02:00
Wladimir J. van der Laan 2fc94370f5
Merge #12887: [trivial] Add newlines to end of log messages.
5b10ab0 [trivial] Add newlines to end of log messages. (John Newbery)

Pull request description:

  Log messages should terminate with a '\n', or the following log will be
  written to the same line without a timestamp. Fix a couple of cases
  where the message is not terminated with a \n.

Tree-SHA512: 88677afe85c88ce9f58312430e8881916bd76bbc8cd353ff81c97b3de8356680503160992c0ef3ea192b4694e848e9ca2480dbc38fea1776903b3784497f1af6
2018-04-05 09:13:11 +02:00
Pieter Wuille 88430cbab4
Merge #12167: Make segwit failure due to CLEANSTACK violation return a SCRIPT_ERR_CLEANSTACK error code
1e747e3c1e Make segwit failure due to CLEANSTACK violation return a SCRIPT_ERR_CLEANSTACK error code. (Mark Friedenbach)

Pull request description:

  If a segwit script terminates with a stack size not equal to one, the current error code is EVAL_FALSE. This is semantically wrong, and prevents explicitly checking CLEANSTACK violations in the unit tests. This PR changes the error code (and affected unit tests) to use SCRIPT_ERROR_CLEANSTACK instead of SCRIPT_ERROR_EVAL_FALSE.

Tree-SHA512: 8f7b1650f7a23a942cde1070e3e56420be456b4a7be42515b237e95557bf2bd5e7ba9aabd213c8092bea28c165dbe73f5a3486300089aeb01e698151b42484b1
2018-04-04 17:30:24 -07:00
MarcoFalke bfaed1ab2e
Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size
f8c249ab91 Assert CPubKey::ValidLength to the pubkey's header-relevent size (Ben Woosley)

Pull request description:

  A pubkey's length is specific to its type which is indicated by its header value. GetLen returns the header-indicated length, so this change ensures that a key matches its header-indicated length.

  And replace some magic values with their constant equivalents.

Tree-SHA512: b727b39a631babe0932326396fc4d796ade8ec1e37454ff0c709ae9b78ecbd0cfdf59d84089ba8415e6efa7bc180e3cd39a14ddaf0871cbac54b96851e1b7b44
2018-04-04 17:50:32 -04:00
MarcoFalke dab0d6859b
Merge #12702: [wallet] [rpc] [doc] importprivkey: hint about importmulti
4e05687153 [wallet] [rpc] [doc] importprivkey: hint about importmulti (Karl-Johan Alm)

Pull request description:

  From #12701, a hint about `importmulti` inside the help for `importprivkey` seems useful.

Tree-SHA512: 09ddfd384062b4365f678167076cb9f5af1eb8f083714a20c2a9bb14fef1c886d1666196272bf09862537166d15ae89c3330cdc6836eee76cb54d137e53301df
2018-04-04 17:26:50 -04:00
Russell Yanofsky 9a61eed1fc Use WalletBalances struct in Qt
Suggested by John Newbery <john@johnnewbery.com>
https://github.com/bitcoin/bitcoin/pull/10244#discussion_r177504284
2018-04-04 16:52:41 -04:00
Russell Yanofsky 56f33ca349 Remove direct bitcoin calls from qt/sendcoinsdialog.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky e872c93ee8 Remove direct bitcoin access from qt/guiutil.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 58845587e1 Remove direct bitcoin calls from qt transaction table files 2018-04-04 16:52:40 -04:00
Russell Yanofsky 3cab2ce5f9 Remove direct bitcoin calls from qt/paymentserver.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 3ec2ebcd9b Remove direct bitcoin calls from qt/addresstablemodel.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 827de038ab Remove direct bitcoin calls from qt/coincontroldialog.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky a0704a8996 Remove most direct bitcoin calls from qt/walletmodel.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 90d4640b7e Remove direct bitcoin calls from qt/optionsdialog.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 582daf6d22 Remove direct bitcoin calls from qt/rpcconsole.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 3034a462a5 Remove direct bitcoin calls from qt/bantablemodel.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky e0b66a3b7c Remove direct bitcoin calls from qt/peertablemodel.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky d7c2c95948 Remove direct bitcoin calls from qt/intro.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky fe6f27e6ea Remove direct bitcoin calls from qt/clientmodel.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 5fba3af21e Remove direct bitcoin calls from qt/splashscreen.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky c2f672fb19 Remove direct bitcoin calls from qt/utilitydialog.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 3d619e9d36 Remove direct bitcoin calls from qt/bitcoingui.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky c0f2756be5 Remove direct bitcoin calls from qt/optionsmodel.cpp 2018-04-04 16:52:40 -04:00
Russell Yanofsky 71e0d90876 Remove direct bitcoin calls from qt/bitcoin.cpp 2018-04-04 16:52:37 -04:00
John Newbery 5b10ab0116 [trivial] Add newlines to end of log messages.
Log messages should terminate with a '\n', or the following log will be
written to the same line without a timestamp. Fix a couple of cases
where the message is not terminated with a \n.
2018-04-04 15:52:23 -04:00
Pieter Wuille 4a6c0e3dcf Modernize best block mutex/cv/hash variable naming 2018-04-03 21:53:27 -07:00
Pieter Wuille 45dd135039 Fix csBestBlock/cvBlockChange waiting in rpc/mining 2018-04-03 21:53:27 -07:00
Russell Yanofsky ea73b84d2d Add src/interface/README.md 2018-04-03 11:52:21 -04:00
Karl-Johan Alm 4e05687153
[wallet] [rpc] [doc] importprivkey: hint about importmulti 2018-04-03 11:53:06 +09:00
Ben Woosley b386970d07
[moveonly] Extract HelpRequested to dry up the help options testing
This ensures consistency across interfaces and makes the version handling more clear.
2018-04-02 15:42:06 -07:00
Luke Dashjr a5bca13095 Bugfix: Include <memory> for std::unique_ptr 2018-04-02 18:31:52 +00:00
MarcoFalke fafcad38c8
doc: Add testmempoolaccept to release-notes 2018-04-02 11:37:09 -04:00
Wladimir J. van der Laan 18815b4bfb
Merge #11742: rpc: Add testmempoolaccept
b55555d rpc: Add testmempoolaccept (MarcoFalke)

Pull request description:

  To check if a single raw transaction makes it into the current transaction pool, one had to call `sendrawtransaction`. However, on success, this adds the transaction to the mempool with no easy way to undo.

  The call `testmempoolaccept` is introduced to provide a way to solely check the result without changing the mempool state.

Tree-SHA512: 5afd9311190135cee8fc1f229c7d39bf893f1028f29e28d34f70df820198ff97b4bf86b41cbbd6e6c36a5c30073cefa92d541c74a4939c7a2a6fa283dfd41b63
2018-04-02 16:02:33 +02:00
Chun Kuan Lee 177b875adc
Avoid travis lint-include-guards error 2018-04-02 16:42:21 +08:00
MarcoFalke 0c5f67b8e5
Merge #12757: Clarify include guard naming convention
3bcc0059b8 Add lint-include-guards.sh which checks include guard consistency (practicalswift)
8fd6af89a0 Fix missing or inconsistent include guards (practicalswift)
8af65d96f4 Document include guard convention (practicalswift)

Pull request description:

  * **Documentation**: Document include guard convention
  * **Fix**: Fix missing or inconsistent include guards
  * **Regression test**: Add `lint-include-guards.sh` which checks include guard consistency

Tree-SHA512: 8171878f60fd08ccbea943a11e835195750592abb9d7ab74eaa4265ae7fac523b1da9d31ca13d6ab73dd596e49986bfb7593c696e5f39567c93e610165bc2acc
2018-04-01 18:30:21 -04:00
MarcoFalke 9beded5860
Merge #12719: tests: Add note about test suite naming convention in developer-notes.md
db983beba6 tests: Add lint-tests.sh which checks the test suite naming convention (practicalswift)
5fd864fe8a tests: Rename test suits not following the test suite naming convention (practicalswift)
7b4a296a71 tests: Add note about test suite naming convention (practicalswift)

Pull request description:

  Changes:
  * Add note about test suite naming convention
  * Fix exceptions
  * Add regression test

  Rationale:
  * Consistent naming of test suites makes programmatic test running of specific tests/subsets of tests easier
  * Explicit is better than implicit

  Before this commit:

  ```
  $ contrib/devtools/lint-tests.sh
  The test suite in file src/test/foo_tests.cpp should be named
  "foo_tests". Please make sure the following test suites follow
  that convention:

  src/test/blockchain_tests.cpp:BOOST_FIXTURE_TEST_SUITE(blockchain_difficulty_tests, BasicTestingSetup)
  src/test/prevector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(PrevectorTests, TestingSetup)
  src/wallet/test/coinselector_tests.cpp:BOOST_FIXTURE_TEST_SUITE(coin_selection_tests, WalletTestingSetup)
  src/wallet/test/crypto_tests.cpp:BOOST_FIXTURE_TEST_SUITE(wallet_crypto, BasicTestingSetup)
  $
  ```

  After this commit:

  ```
  $ contrib/devtools/lint-tests.sh
  $
  ```

Tree-SHA512: 7258ab9a6b9b8fc1939efadc619e2f2f02cfce8034c7f2e5dc5ecc769aa12e17f6fb8e363817feaf15c026c5b958b2574525b8d2d3f6be69658679bf8ceea9e9
2018-04-01 18:28:22 -04:00