Commit graph

13668 commits

Author SHA1 Message Date
James O'Beirne 3ccbc376dd refactoring: FlushStateToDisk -> CChainState
Also renames global methods for clarity:

- ::FlushStateToDisk() -> CChainState::ForceFlushStateToDisk()
  - This performs an unconditional flush.

- ::PruneAndFlush() -> CChainState::PruneAndFlush()
2019-05-16 09:06:54 -04:00
James O'Beirne 4d6688603b refactoring: introduce ChainstateActive()
To be used once we move global functions (e.g. FlushStateToDisk()) into
CChainState methods.

Thanks to Marco Falke for suggestions
2019-05-16 09:06:54 -04:00
James O'Beirne d7c97edeea move-only: make the CChainState interface public
along with DisconnectResult, and CBlockIndexWorkComparator.

The CChainState interface needs to be known to the rest of the system because
many global functions will move to CChainState methods. This is to allow
other parts of the system to be parameterized per chainstate instance
instead of assuming a single global.
2019-05-16 09:05:07 -04:00
Wladimir J. van der Laan 47ec8318a6
Merge #15968: Fix portability issue with pthreads
1b05dff080 Fix portability issue with pthreads (grim-trigger)

Pull request description:

  This change resolves the following issue:
  https://github.com/bitcoin/bitcoin/issues/15951

  Only tested on OpenBSD 6.5/amd64

ACKs for commit 1b05df:
  fanquake:
    tACK 1b05dff. Tested on OpenBSD6.4 (`vagrant`).
  laanwj:
    utACK 1b05dff080

Tree-SHA512: af48581af32820d5adc9ae5abb44f8f1b592c323f86fe2484108b81629389f6ef347598f9a087aa6476ac553e59828cd7927bb4ab11dc70e7c9a944a92fc54ae
2019-05-16 14:19:06 +02:00
Carl Dong 8be3f30633 netaddress: Update CNetAddr for ORCHIDv2
The original ORCHID prefix was deprecated as of 2014-03, the new
ORCHIDv2 prefix was allocated by RFC7343 as of 2014-07. We did not
consider the original ORCHID prefix routable, and I don't see any reason
to consider the new one to be either.
2019-05-15 14:21:48 -04:00
MarcoFalke fa7e311e16
[doc] rpcwallet: Only fail rescan when blocks have been pruned 2019-05-15 14:09:28 -04:00
MarcoFalke 2d16fb7a2b
Merge #14984: rpc: Speedup getrawmempool when verbose=true
2d5cf4c41d rpc: Speedup getrawmempool when verbose=true (João Barbosa)

Pull request description:

  Instead of calling `pushKV(hash, info)`, which incurs in duplicate key checks, call `__pushKV` which (currently) doesn't.

  Improves RPC `getrawmempool` and REST `/rest/mempool/contents.json`.

  Fixes #14765.

ACKs for commit 2d5cf4:

Tree-SHA512: c3e91371bb41f39e79dcef820815e1dc27fb689ca3c4bf3a00467d2215b3baecd44d9792f7a481577a5b7ae1fc6cbaa07b1cd62123b845082eba65b35c2b3ca5
2019-05-15 11:32:29 -04:00
practicalswift 1609809fb2 validation: Hold cs_main when reading chainActive in RewindBlockIndex 2019-05-15 14:58:15 +02:00
Chris Capobianco e23809a05b [rpc] deriveaddresses: Correct descriptor checksum in RPCExamples 2019-05-14 12:46:24 -04:00
MarcoFalke 65526fc866
Merge #15777: [docs] Add doxygen comments for keypool classes
f1a77b0c51 [docs] Add doxygen comment for CReserveKey (John Newbery)
37796b2dd4 [docs] Add doxygen comment for CKeyPool (John Newbery)
ef2d515af3 [wallet] move-only: move CReserveKey to be next to CKeyPool (John Newbery)

Pull request description:

  Docs/move-only

  Adds doxygen comments for the CKeyPool and CReserveKey objects. The way these work is pretty confusing and it's easy to overlook details (eg https://github.com/bitcoin/bitcoin/pull/15557#discussion_r271956393).

  These are on the verbose side, but I think too much commenting is better than not enough. Happy to take feedback on what's an appropriate level.

ACKs for commit f1a77b:
  jonatack:
    Thanks, John. Re-ACK f1a77b0c51, doc-only changes with respect to previous review.
  jb55:
    ACK f1a77b0c51

Tree-SHA512: 8bc97c7029cd2e8d9bfd2d2144eeff73474c71eda5a9d10817e1578ca0b70da677252037d83143faaff1808e2193408a21a8a89d36049eac77fd313990f0b67b
2019-05-14 09:16:33 -04:00
MarcoFalke 6f4ba6492a
Merge #15988: Add test for ArgsManager::GetChainName
f6bb11fd37 Add test for ArgsManager::GetChainName (Russell Yanofsky)
4b331159df Add unit test NextString, ForEachNoDup functions (Russell Yanofsky)
05bfee3451 util_SettingsMerge test cleanup (Russell Yanofsky)

Pull request description:

  There was some test coverage previously, but it was limited and didn't test conflicting and negated arguments.

ACKs for commit f6bb11:
  MarcoFalke:
    re-utACK f6bb11fd37

Tree-SHA512: d03596614dc48584c7a9440117b107c6abb23fd4c7fa15fb4015351ec3de08b2656bc956ce05310663675672343d7a6aff35421657f29172080c7005045680b0
2019-05-14 08:53:37 -04:00
MarcoFalke fa2b52af32
Disallow extended encoding for non-witness transactions (take 3) 2019-05-14 08:33:55 -04:00
MarcoFalke 40c66bb3d1
Merge #15855: [refactor] interfaces: Add missing LockAnnotation for cs_main
fa3c651143 [refactor] interfaces: Add missing LockAnnotation for cs_main (MarcoFalke)

Pull request description:

  This adds missing `LockAnnotation lock(::cs_main);` to `src/interfaces/chain.cpp` (as well as tests and  benchmarks)

ACKs for commit fa3c65:
  practicalswift:
    utACK fa3c651143
  ryanofsky:
    utACK fa3c651143

Tree-SHA512: b67082fe3718c94b4addf7f2530593915225c25080f20c3ffa4ff7e08f1f49548f255fb285f89a8feff84be3f6c91e1792495ced9f6bf396732396d1356d597a
2019-05-14 08:23:24 -04:00
Andrew Chow 662d1171d9 Add option to create an encrypted wallet 2019-05-13 22:49:34 -04:00
MarcoFalke fa3c651143
[refactor] interfaces: Add missing LockAnnotation for cs_main 2019-05-13 14:46:01 -04:00
MarcoFalke 667a861741
Merge #14364: doc: Clarify -blocksdir usage
ccc27bdcd2 doc: Clarify -blocksdir usage (Daniel McNally)

Pull request description:

  This PR attempts to clarify and correct the `-blocksdir` argument description and default value. `-blocksdir` does not refer to the full path to the actual `blocks` directory, but rather the root/parent directory which contains the `blocks` directory. Accordingly, the default value is `<datadir>` and not `<datadir>/blocks` - this behavior of defaulting to the datadir can also be seen in init.cpp:

  ```cpp
      if (gArgs.IsArgSet("-blocksdir")) {
          path = fs::system_complete(gArgs.GetArg("-blocksdir", ""));
          if (!fs::is_directory(path)) {
              path = "";
              return path;
          }
      } else {
          path = GetDataDir(false);
      }
  ```

  It also attempts to clarify that only the `.dat` files containing block data are impacted by `-blocksdir`, not the index files.

  I believe this would close #12828.

ACKs for commit ccc27b:
  hebasto:
    utACK ccc27bdcd2

Tree-SHA512: 7b65f66b0579fd56e8c8cd4f9f22d6af56181817762a68deccd7fca51820ad82d9a0c48f5f1f012e746c67bcdae7af4555fad867cb620a9ca538d465c9d86c2b
2019-05-13 12:46:03 -04:00
MarcoFalke fa86c8aec6
init: Remove dead code in LoadChainTip 2019-05-13 11:53:38 -04:00
MarcoFalke fa8ced32a6
doc: Mention blocksonly in reduce-traffic.md, unhide option 2019-05-13 10:44:46 -04:00
Jonas Schnelli 8794a4b3ae
QA: add test for HKDF HMAC_SHA256 L32 2019-05-11 09:14:09 +02:00
Jonas Schnelli 551d489416
Add HKDF HMAC_SHA256 L=32 implementations 2019-05-11 09:14:07 +02:00
Pieter Wuille 26fe9b9909 Add support for descriptors to utxoupdatepsbt
This adds a descriptors argument to the utxoupdatepsbt RPC. This means:
* Input and output scripts and keys will be filled in when known
* P2SH-witness outputs will be filled in from the UTXO set when a descriptor
  is provided to show they're segwit outputs.
2019-05-10 14:36:58 -07:00
Pieter Wuille 3135c1a2d2 Abstract out UpdatePSBTOutput from FillPSBT 2019-05-10 14:31:22 -07:00
Pieter Wuille fb90ec3c33 Abstract out EvalDescriptorStringOrObject from scantxoutset 2019-05-10 14:31:21 -07:00
Pieter Wuille eaf4f88734 Abstract out IsSegWitOutput from utxoupdatepsbt
This is not a pure refactor; additional functionality is added in
IsSegWitOutput which lets it recurse into P2SH when a
SigningProvider is provided that knows about the inner script.
2019-05-10 14:22:33 -07:00
MarcoFalke e2371f842f
Merge #14802: rpc: faster getblockstats using BlockUndo data
d20d756752 rpc: faster getblockstats using BlockUndo data (Felix Weis)

Pull request description:

  Using undo data for a block (rev?????.dat) we can retrieve value information about prevouts and calculate the final transaction fee (rate). This approach is about 80x faster, drops the requirement for `-txindex`, and works for all non-pruned blocks.

  ```
  # 2018-11-25T16:36:19Z Bitcoin Core version v0.17.99.0-edc715240-dirty (release build)
  seq 550100 550200  0.00s user 0.00s system 62% cpu 0.004 total
  xargs -n1 src/bitcoin-cli getblockstats  0.21s user 0.19s system 17% cpu 2.302 total

  # 2018-11-25T16:39:17Z Bitcoin Core version v0.17.0 (release build)
  seq 550100 550200  0.00s user 0.00s system 87% cpu 0.002 total
  xargs -n1 src/bitcoin-cli getblockstats  0.24s user 0.22s system 0% cpu 3:19.42 total
  ```

ACKs for commit d20d75:
  MarcoFalke:
    re-utACK d20d756752

Tree-SHA512: 5babc3eb8d2fee2cb23dc12f522656b80737a540cbf2b13390a8f388304c46c064cca76f896b46a6e2abae8cc582d28e1ab20dd4bb17ad6142f20630c2d30c54
2019-05-10 13:20:48 -04:00
Felix Weis d20d756752 rpc: faster getblockstats using BlockUndo data
Using undo data for a block (rev?????.dat) we can retrieve value information about prevouts and calculate the final transaction fee (rate). This approach is about 80x faster, drops the requirement for -txindex, and works for all non-pruned blocks.
2019-05-10 08:33:14 -04:00
MarcoFalke 14959753a4
Merge #15744: refactor: Extract ParseDescriptorRange
510c6532ba Extract ParseDescriptorRange (Ben Woosley)

Pull request description:

  So as to be consistently informative when the checks fail, and
  to protect against unintentional divergence among the checks.

ACKs for commit 510c65:
  meshcollider:
    Oh apologies, yes. Thanks :) utACK 510c6532ba
  MarcoFalke:
    utACK 510c6532ba
  sipa:
    utACK 510c6532ba

Tree-SHA512: b1f0792bfaa163890a20654a0fc2c4c4a996659916bf5f4a495662436b39326692a1a0c825caafd859e48c05f5dd1865c4f7c28092be5074edda3c94f94f9f8b
2019-05-10 08:09:44 -04:00
Jonas Schnelli 695141bf7a
Merge #15512: Add ChaCha20 encryption option (XOR)
2dfe27517 Add ChaCha20 bench (Jonas Schnelli)
2bc2b8b49 Add ChaCha20 encryption option (XOR) (Jonas Schnelli)

Pull request description:

  The current ChaCha20 implementation does not support message encryption (it can only output the keystream which is sufficient for the RNG).

  This PR adds the actual XORing of the `plaintext` with the `keystream` in order to return the desired `ciphertext`.

  Required for v2 message transport protocol.

ACKs for commit 2dfe27:
  jnewbery:
    Looks good. utACK 2dfe275171.
  jnewbery:
    utACK 2dfe275171
  sipa:
    utACK 2dfe275171
  ryanofsky:
    utACK 2dfe275171. Changes since last review are just renaming the Crypt method, adding comments, and simplifying the benchmark.

Tree-SHA512: 84bb234da2ca9fdc44bc29a786d9dd215520f81245270c1aef801ef66b6091b7793e2eb38ad6dbb084925245065c5dce9e5582f2d0fa220ab3e182d43412d5b5
2019-05-10 09:26:23 +02:00
Pieter Wuille 0b09a57aec Give WalletModel::UnlockContext move semantics 2019-05-09 18:07:33 -07:00
Wladimir J. van der Laan de5af41e35
Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types
78e407ad0c GetKeyBirthTimes should return key ids, not destinations (Gregory Sanders)
70946e7fee Replace CScriptID and CKeyID in CTxDestination with dedicated types (Gregory Sanders)

Pull request description:

  The current usage seems to be an overloading of meanings. `CScriptID` is used in the wallet as a lookup key, as well as a destination, and `CKeyID` likewise. Instead, have all destinations be dedicated types.

  New types:
  `CScriptID`->`ScriptHash`
  `CKeyID`->`PKHash`

ACKs for commit 78e407:
  ryanofsky:
    utACK 78e407ad0c. Only changes are removing extra CScriptID()s and fixing the test case.
  Sjors:
    utACK 78e407a
  meshcollider:
    utACK 78e407ad0c

Tree-SHA512: 437f59fc3afb83a40540da3351507aef5aed44e3a7f15b01ddad6226854edeee762ff0b0ef336fe3654c4cd99a205cef175211de8b639abe1130c8a6313337b9
2019-05-09 18:54:43 +02:00
MarcoFalke fa1dce7329
net: Rename ::fRelayTxes to ::g_relay_txes
This helps to distinguish it from CNode::fRelayTxes and avoid bugs like
425278d17b
2019-05-09 09:10:53 -04:00
MarcoFalke 08788ce170
Merge #15890: Doc: remove text about txes always relayed from -whitelist
e0bb279999 Doc: remove text about txes always relayed from -whitelist (David A. Harding)

Pull request description:

  Updates text since -whitelistforcerelay was set to false by default in PR #15193.

ACKs for commit e0bb27:
  fanquake:
    utACK e0bb279
  MarcoFalke:
    utACK e0bb279999

Tree-SHA512: cf0c9321d72692d573039a04f8f1d048cbdf67ed86cc781523dabd3c45d2731b788f53749e6bb29d7da1ab44eb04030f352469b20489bb2a26c2c38fb61f6489
2019-05-08 15:59:42 -04:00
MarcoFalke 49c1aa5f83
Merge #15971: validation: Add compile-time checking for negative locking requirement in LimitValidationInterfaceQueue
62d50ef308 Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main) (practicalswift)

Pull request description:

  This PR adds compile-time checking for negative locking requirements that follow from the run-time locking requirement `AssertLockNotHeld(cs_main)` in `LimitValidationInterfaceQueue(...)`.

  Changes:
  * Add `LOCKS_EXCLUDED(cs_main)` to `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`
  * Add `LOCKS_EXCLUDED(cs_main)` to `CChainState::ActivateBestChain(…)`, `CChainState:: InvalidateBlock(…)` and `CChainState::RewindBlockIndex(…)` which all call `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`
  * Add `LOCKS_EXCLUDED(cs_main)` to `InvalidateBlock(…)` which calls `CChainState::InvalidateBlock(...)` which in turn calls `LimitValidationInterfaceQueue(...)` which  does `AssertLockNotHeld(cs_main)`
  * Add `LOCKS_EXCLUDED(cs_main)` to `RewindBlockIndex(…)` which calls `CChainState::RewindBlockIndex(...)` which in turn calls `LimitValidationInterfaceQueue(...)` which does `AssertLockNotHeld(cs_main)`

ACKs for commit 62d50e:
  MarcoFalke:
    utACK 62d50ef308

Tree-SHA512: 73d092ccd08c851ae3c5d60370c369fc030c5793f5507e2faccb6f91c851ddc0ce059fbea3899f2856330d7a8c78f2ac6a2988e8268b03154f946be9e60e3be1
2019-05-08 09:19:41 -04:00
MeshCollider ef802ef5d6
Merge #15880: utils and libraries: Replace deprecated Boost Filesystem functions
a0a222eec Replace deprecated Boost Filesystem function (Hennadii Stepanov)
4f65af97b Remove dead code for walletFile check (Hennadii Stepanov)

Pull request description:

  Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions).

  See more: https://lists.boost.org/Archives/boost/2010/01/160905.php

  Also this PR prevents further use of deprecated Boost Filesystem functions.
  Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines

  Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains:
  ```c++
  # ifndef BOOST_FILESYSTEM_NO_DEPRECATED

      inline std::string extension(const path & p)
      {
        return p.extension().string();
      }

      inline std::string basename(const path & p)
      {
        return p.stem().string();
      }

      inline path change_extension( const path & p, const path & new_extension )
      {
        path new_p( p );
        new_p.replace_extension( new_extension );
        return new_p;
      }

  # endif
  ```

  UPDATE:
  Also removed unused code as [noted](https://github.com/bitcoin/bitcoin/pull/15880#discussion_r279386614) by **ryanofsky**.

ACKs for commit a0a222:
  Empact:
    utACK a0a222eec0
  practicalswift:
    utACK a0a222eec0
  fanquake:
    utACK a0a222e
  ryanofsky:
    utACK a0a222eec0. Only change is dropping assert and squashing first two commits.

Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7
2019-05-09 00:01:29 +12:00
MeshCollider c3ef63a52f Show loaded wallets as disabled in open menu instead of nothing 2019-05-08 23:54:25 +12:00
practicalswift 62d50ef308 Add LOCKS_EXCLUDED(cs_main) to LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)
Add LOCKS_EXCLUDED(cs_main) to functions calling LimitValidationInterfaceQueue(...) which does AssertLockNotHeld(cs_main)

Add LOCKS_EXCLUDED(cs_main) to functions calling CChainState::InvalidateBlock(...) which calls LimitValidationInterfaceQueue(...) which in turn does AssertLockNotHeld(cs_main)

Add LOCKS_EXCLUDED(cs_main) to functions calling CChainState::RewindBlockIndex(...) which calls LimitValidationInterfaceQueue(...) which in turn does AssertLockNotHeld(cs_main)
2019-05-08 10:31:54 +02:00
Russell Yanofsky f6bb11fd37 Add test for ArgsManager::GetChainName
There was some test coverage previously, but it was limited and didn't test
conflicting and negated arguments.
2019-05-07 11:51:30 -04:00
MarcoFalke b2a6b02161
Merge #15948: refactor: rename chainActive
486c1eea86 refactoring: remove unused chainActive (James O'Beirne)
631940aab2 scripted-diff: replace chainActive -> ::ChainActive() (James O'Beirne)
a3a609079c refactoring: introduce unused ChainActive() (James O'Beirne)
1b6e6fcfd2 rename: CChainState.chainActive -> m_chain (James O'Beirne)

Pull request description:

  This is part of the assumeutxo project:

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/2019-04-proposal/proposal

  ---

  This change refactors the `chainActive` reference into a `::ChainActive()` call. It also distinguishes `CChainState`'s `CChain` data member as `m_chain` instead of the current `chainActive`, which makes it easily confused with the global data.

  The active chain must be obtained via function because its reference will be swapped at some point during runtime after loading a UTXO snapshot.

  This change, though lengthy, should be pretty easy to review since most of it is contained within a scripted-diff. Once merged, the parent PR should be easier to review.

ACKs for commit 486c1e:
  Sjors:
    utACK 486c1ee
  promag:
    utACK 486c1ee.
  practicalswift:
    utACK 486c1eea86

Tree-SHA512: 06ed8f9e77f2d25fc9bea0ba86436d80dbbce90a1e8be23e37ec4eeb26060483e60b4a5c4fba679cb1867f61e3921c24abeb9cabdfb4d0a9b1c4ddd77b17456a
2019-05-07 11:51:30 -04:00
Russell Yanofsky 4b331159df Add unit test NextString, ForEachNoDup functions
Remove testcase generating code from util_SettingsMerge so it can be reused in
new tests.

The hash value expected in util_SettingsMerge changes as a result of this, but
only because the testcases are generated in a different order, not because any
cases are added or removed. It is possible to verify this with:

    SETTINGS_MERGE_TEST_OUT=new.txt test/test_bitcoin --run_test=util_tests/util_SettingsMerge
    git checkout HEAD~1
    make test/test_bitcoin
    SETTINGS_MERGE_TEST_OUT=old.txt test/test_bitcoin --run_test=util_tests/util_SettingsMerge
    diff -u <(sort old.txt) <(sort new.txt)

The new output is a little more readable, with simpler testcases sorted first.
2019-05-07 11:51:30 -04:00
Russell Yanofsky 05bfee3451 util_SettingsMerge test cleanup
Followup to #15869. Treat "-wallet" as the network-specific argument in test
instead of "-server", to make test output clearer and be more consistent with
bitcoind. Update embedded hash to match changed output from this.
2019-05-07 11:51:30 -04:00
orient 41ab2a8924
fix static_assert for macro HAVE_THREAD_LOCAL
fix static_assert for macro HAVE_THREAD_LOCAL while define DEBUG_LOCKCONTENTION
2019-05-07 14:11:35 +08:00
grim-trigger 1b05dff080
Fix portability issue with pthreads
This change resolves the following issue:
https://github.com/bitcoin/bitcoin/issues/15951

Only tested on OpenBSD 6.5/amd64
2019-05-07 00:17:33 +00:00
Pieter Wuille 3cb9ce85d0 Document strenghtening 2019-05-06 15:15:04 -07:00
Pieter Wuille 1d207bc46f Add hash strengthening to the RNG
Once every minute, this will feed the RNG state through repeated SHA512
for 10ms. The timings of that operation are used as entropy source as
well.
2019-05-06 15:15:04 -07:00
Pieter Wuille c01c065b9d Do not construct out-of-bound pointers in SHA512/SHA1/RIPEMD160 code 2019-05-06 15:11:10 -07:00
MarcoFalke 3632143ebb
Merge #14266: refactor: Lift prevector default vals to the member declaration
d2eee87928 Lift prevector default vals to the member declaration (Ben Woosley)

Pull request description:

  I overlooked this possibility in #14028

ACKs for commit d2eee8:
  promag:
    utACK d2eee87, change looks good because members are always initialized.
  251Labs:
    utACK d2eee87 nice one.
  ken2812221:
    utACK d2eee87928
  practicalswift:
    utACK d2eee87928
  scravy:
    utACK d2eee87928

Tree-SHA512: f2726bae1cf892fd680cf8571027bcdc2e42ba567eaa901fb5fb5423b4d11b29e745e0163d82cb513d8c81399cc85933a16ed66d4a30829382d4721ffc41dc97
2019-05-06 15:32:24 -04:00
MarcoFalke aaaa57c2aa
scripted-diff: Bump copyright headers in wallet
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./src/wallet/
-END VERIFY SCRIPT-
2019-05-06 14:05:52 -04:00
MarcoFalke faf3729242
wallet: Only fail rescan when blocks have actually been pruned 2019-05-06 14:03:56 -04:00
Wladimir J. van der Laan c5ffe8d515
Merge #15730: rpc: Show scanning details in getwalletinfo
b6c748f849 doc: Add release notes for 15730 (João Barbosa)
d3e8458365 rpc: Show scanning details in getwalletinfo (João Barbosa)
90e27abe37 wallet: Track current scanning progress (João Barbosa)
2ee811e693 wallet: Track scanning duration (João Barbosa)

Pull request description:

  Closes #15724.

ACKs for commit b6c748:
  MarcoFalke:
    re-utACK b6c748f849 (Only change since my last review is rebase, adding release notes, and returning false instead of null)
  laanwj:
    utACK b6c748f849
  jonatack:
    ACK b6c748f849, only changes appear to be rebase for https://github.com/bitcoin/bitcoin/pull/15730#discussion_r280030617 and release notes.

Tree-SHA512: 8ee98f971c15f66ce8138fc92c55e51abc9faf01866a31ac7ce2ad766aa2bb88559eabee3b5815d645c84cdf1c19dc35ec03f31461e39bc5f6040edec0b87116
2019-05-06 13:38:12 +02:00
Wladimir J. van der Laan a3d2d6b067
Merge #15930: rpc: Add balances RPC
facfb4111d rpc: Deprecate getunconfirmedbalance and getwalletinfo balances (MarcoFalke)
999931cf8f rpc: Add getbalances RPC (MarcoFalke)
fad13e925e rpcwallet: Make helper methods const on CWallet (MarcoFalke)
fad40ec915 wallet: Use IsValidNumArgs in getwalletinfo rpc (MarcoFalke)

Pull request description:

  This exposes the `CWallet::GetBalance()` struct over RPC.

  In the future, incorrectly named rpcs such as `getunconfirmedbalance` or rpcs redundant to this such as `getbalance` could be removed.

ACKs for commit facfb4:
  jnewbery:
    utACK facfb4111d

Tree-SHA512: 1f54fedce55df9a8ea82d2b6265354b39a956072621876ebaee2355aac0e23c7b64340c3279502415598c095858529e18b50789be956250aafda1cd3a8d948a5
2019-05-06 11:36:42 +02:00
Wladimir J. van der Laan 9bbaac73bb
Merge #15928: GUI: Move QRImageWidget to its own file-pair
fc929842c2 GUI: Move QRImageWidget to its own file-pair (Luke Dashjr)
77851ab682 GUI: Refactor actual QR code rendering into new QRImageWidget::setQR (Luke Dashjr)

Pull request description:

  For at least QR-code based pairing of mobile wallets with nodes, it will be desirable to render QR codes even without wallet support.

  Therefore, this prepares by moving the QRImageWidget out of a wallet-specific file into its own `qrencoder` file-pair.

ACKs for commit fc9298:
  laanwj:
    utACK fc929842c2
  jonasschnelli:
    utACK fc929842c2

Tree-SHA512: 95529a38c0573a4b3f1253fb5f11ca07a5b3a9840ec24acc7d87270212f3c9f7c5b186d9274d297517a3b80494f38a57574fb9730b1574db01688539b987bd91
2019-05-06 10:04:33 +02:00
Wladimir J. van der Laan d7d7d31506
Merge #15141: Rewrite DoS interface between validation and net_processing
0ff1c2a838 Separate reason for premature spends (coinbase/locktime) (Suhas Daftuar)
54470e767b Assert validation reasons are contextually correct (Suhas Daftuar)
2120c31521 [refactor] Update some comments in validation.cpp as we arent doing DoS there (Matt Corallo)
12dbdd7a41 [refactor] Drop unused state.DoS(), state.GetDoS(), state.CorruptionPossible() (Matt Corallo)
aa502b88d1 scripted-diff: Remove DoS calls to CValidationState (Matt Corallo)
7721ad64f4 [refactor] Prep for scripted-diff by removing some \ns which annoy sed. (Matt Corallo)
5e78c5734b Allow use of state.Invalid() for all reasons (Matt Corallo)
6b34bc6b6f Fix handling of invalid headers (Suhas Daftuar)
ef54b486d5 [refactor] Use Reasons directly instead of DoS codes (Matt Corallo)
9ab2a0412e CorruptionPossible -> BLOCK_MUTATED (Matt Corallo)
6e55b292b0 CorruptionPossible -> TX_WITNESS_MUTATED (Matt Corallo)
7df16e70e6 LookupBlockIndex -> CACHED_INVALID (Matt Corallo)
c8b0d22698 [refactor] Drop redundant nDoS, corruptionPossible, SetCorruptionPossible (Matt Corallo)
34477ccd39 [refactor] Add useful-for-dos "reason" field to CValidationState (Matt Corallo)
6a7f8777a0 Ban all peers for all block script failures (Suhas Daftuar)
7b999103e2 Clean up banning levels (Matt Corallo)
b8b4c80146 [refactor] drop IsInvalid(nDoSOut) (Matt Corallo)
8818729013 [refactor] Refactor misbehavior ban decisions to MaybePunishNode() (Matt Corallo)
00e11e61c0 [refactor] rename stateDummy -> orphan_state (Matt Corallo)
f34fa719cf Drop obsolete sigops comment (Matt Corallo)

Pull request description:

  This is a rebase of #11639 with some fixes for the last few comments which were not yet addressed.

  The original PR text, with some strikethroughs of text that is no longer correct:

  > This cleans up an old main-carryover - it made sense that main could decide what DoS scores to assign things because the DoS scores were handled in a different part of main, but now validation is telling net_processing what DoS scores to assign to different things, which is utter nonsense. Instead, we replace CValidationState's nDoS and CorruptionPossible with a general ValidationInvalidReason, which net_processing can handle as it sees fit. I keep the behavior changes here to a minimum, but in the future we can utilize these changes for other smarter behavior, such as disconnecting/preferring to rotate outbound peers based on them providing things which are invalid due to SOFT_FORK because we shouldn't ban for such cases.
  >
  > This is somewhat complementary with, though obviously conflicts heavily with #11523, which added enums in place of DoS scores, as well as a few other cleanups (which are still relevant).
  >
  > Compared with previous bans, the following changes are made:
  >
  > Txn with empty vin/vout or null prevouts move from 10 DoS
  > points to 100.
  > Loose transactions with a dependency loop now result in a ban
  > instead of 10 DoS points.
  > ~~BIP68-violation no longer results in a ban as it is SOFT_FORK.~~
  > ~~Non-SegWit SigOp violation no longer results in a ban as it
  > considers P2SH sigops and is thus SOFT_FORK.~~
  > ~~Any script violation in a block no longer results in a ban as
  > it may be the result of a SOFT_FORK. This should likely be
  > fixed in the future by differentiating between them.~~
  > Proof of work failure moves from 50 DoS points to a ban.
  > Blocks with timestamps under MTP now result in a ban, blocks
  > too far in the future continue to not result in a ban.
  > Inclusion of non-final transactions in a block now results in a
  > ban instead of 10 DoS points.

  Note: The change to ban all peers for consensus violations is actually NOT the change I'd like to make -- I'd prefer to only ban outbound peers in those situations.  The current behavior is a bit of a mess, however, and so in the interests of advancing this PR I tried to keep the changes to a minimum.  I plan to revisit the behavior in a followup PR.

  EDIT: One reviewer suggested I add some additional context for this PR:

  > The goal of this work was to make net_processing aware of the actual reasons for validation failures, rather than just deal with opaque numbers instructing it to do something.
  >
  > In the future, I'd like to make it so that we use more context to decide how to punish a peer. One example is to differentiate inbound and outbound peer misbehaviors. Another potential example is if we'd treat RECENT_CONSENSUS_CHANGE failures differently (ie after the next consensus change is implemented), and perhaps again we'd want to treat some peers differently than others.

ACKs for commit 0ff1c2:
  jnewbery:
    utACK 0ff1c2a838
  ryanofsky:
    utACK 0ff1c2a838. Only change is dropping the first commit (f3883a321bf4ab289edcd9754b12cae3a648b175), and dropping the temporary `assert(level == GetDoS())` that was in 35ee77f2832eaffce30042e00785c310c5540cdc (now c8b0d22698)

Tree-SHA512: e915a411100876398af5463d0a885920e44d473467bb6af991ef2e8f2681db6c1209bb60f848bd154be72d460f039b5653df20a6840352c5f7ea5486d9f777a3
2019-05-04 11:58:57 +02:00
Jonas Schnelli 2dfe275171
Add ChaCha20 bench 2019-05-03 22:52:11 +02:00
James O'Beirne 486c1eea86 refactoring: remove unused chainActive 2019-05-03 15:03:05 -04:00
James O'Beirne 631940aab2 scripted-diff: replace chainActive -> ::ChainActive()
Though at the moment ChainActive() simply references `g_chainstate.m_chain`,
doing this change now clears the way for multiple chainstate usage and allows
us to script the diff.

-BEGIN VERIFY SCRIPT-
git grep -l "chainActive" | grep -E '(h|cpp)$' | xargs sed -i '/chainActive =/b; /extern CChain& chainActive/b; s/\(::\)\{0,1\}chainActive/::ChainActive()/g'
-END VERIFY SCRIPT-
2019-05-03 15:02:54 -04:00
James O'Beirne a3a609079c refactoring: introduce unused ChainActive()
in preparation for the following scripted-diff commit.
2019-05-03 14:38:38 -04:00
James O'Beirne 1b6e6fcfd2 rename: CChainState.chainActive -> m_chain
This can't be a scripted-diff due to the confusion of the global
chainActive and the CChainState member of the same name.

This specific rename makes the following chainActive -> ::ChainActive() diff
scriptable.
2019-05-03 14:38:30 -04:00
Jonas Schnelli 2bc2b8b49a
Add ChaCha20 encryption option (XOR) 2019-05-03 20:31:18 +02:00
MarcoFalke facfb4111d
rpc: Deprecate getunconfirmedbalance and getwalletinfo balances 2019-05-03 13:59:44 -04:00
MarcoFalke 94daebf327
Merge #15932: rpc: Serialize in getblock without cs_main
faea56400d rpc: Add lock annotations to block{,header}ToJSON (MarcoFalke)
fab00a5cb9 rpc: Serialize in getblock without cs_main (MarcoFalke)
fa1c3591ad rpc: Use IsValidNumArgs in getblock (MarcoFalke)

Pull request description:

  No need to hold cs_main when serializing a struct to json

  Fixes: #15925

ACKs for commit faea56:
  jnewbery:
    utACK faea56400d
  jonasschnelli:
    utACK faea56400d

Tree-SHA512: 005d378cda1e6024e9f5142f99a8adbefe202cd7bfeaafee55eb909e8990a3790aa27fcf5dd16119cc9afe9dc8bd30f660de40233316781669be166bac3018e7
2019-05-03 08:09:22 -04:00
Suhas Daftuar 0ff1c2a838 Separate reason for premature spends (coinbase/locktime) 2019-05-02 15:30:58 -04:00
Suhas Daftuar 54470e767b Assert validation reasons are contextually correct 2019-05-02 15:29:09 -04:00
Matt Corallo 2120c31521 [refactor] Update some comments in validation.cpp as we arent doing DoS there 2019-05-02 15:27:32 -04:00
Matt Corallo 12dbdd7a41 [refactor] Drop unused state.DoS(), state.GetDoS(), state.CorruptionPossible()
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 15:25:43 -04:00
Matt Corallo aa502b88d1 scripted-diff: Remove DoS calls to CValidationState
-BEGIN VERIFY SCRIPT-
sed -i 's/\.DoS(\(.*\), REJECT_\(.*\), \(true\|false\)/.DoS(\1, REJECT_\2/' src/validation.cpp src/consensus/tx_verify.cpp src/consensus/tx_check.cpp
sed -i 's/state.GetRejectCode(), state.GetRejectReason(), [^,]\+, state.GetDebugMessage())/state.GetRejectCode(), state.GetRejectReason(), state.GetDebugMessage())/' src/validation.cpp
sed -i 's/\.DoS([^,]*, /.Invalid\(/' src/validation.cpp src/consensus/tx_verify.cpp src/consensus/tx_check.cpp
-END VERIFY SCRIPT-

Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
2019-05-02 15:24:07 -04:00
Matt Corallo 7721ad64f4 [refactor] Prep for scripted-diff by removing some \ns which annoy sed. 2019-05-02 15:22:29 -04:00
Matt Corallo 5e78c5734b Allow use of state.Invalid() for all reasons
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 15:21:24 -04:00
Suhas Daftuar 6b34bc6b6f Fix handling of invalid headers
We only disconnect outbound peers (excluding HB compact block peers and manual
connections) when receiving a CACHED_INVALID header.
2019-05-02 15:17:24 -04:00
Matt Corallo ef54b486d5 [refactor] Use Reasons directly instead of DoS codes 2019-05-02 15:15:50 -04:00
Matt Corallo 9ab2a0412e CorruptionPossible -> BLOCK_MUTATED
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 15:14:12 -04:00
Matt Corallo 6e55b292b0 CorruptionPossible -> TX_WITNESS_MUTATED
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 15:12:38 -04:00
Matt Corallo 7df16e70e6 LookupBlockIndex -> CACHED_INVALID
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 15:11:03 -04:00
Matt Corallo c8b0d22698 [refactor] Drop redundant nDoS, corruptionPossible, SetCorruptionPossible
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 15:10:32 -04:00
Matt Corallo 34477ccd39 [refactor] Add useful-for-dos "reason" field to CValidationState
This is a first step towards cleaning up our DoS interface - make
validation return *why* something is invalid, and let net_processing
figure out what that implies in terms of banning/disconnection/etc.

Behavior change: peers will now be banned for providing blocks
with premature coinbase spends.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
                Suhas Daftuar <sdaftuar@gmail.com>
2019-05-02 14:55:13 -04:00
MarcoFalke faea56400d
rpc: Add lock annotations to block{,header}ToJSON 2019-05-02 14:33:26 -04:00
Suhas Daftuar 6a7f8777a0 Ban all peers for all block script failures
This eliminates a discrepancy between block validation with multiple
script check threads, versus a single script check thread.
2019-05-02 11:00:19 -04:00
Matt Corallo 7b999103e2 Clean up banning levels
Compared with previous bans, the following changes are made:
 * Txn with empty vin/vout or null prevouts move from 10 DoS
   points to 100.
 * Loose transactions with a dependency loop now result in a ban
   instead of 10 DoS points.
 * Many pre-segwit soft-fork errors now result in a ban.
   Note: Transactions that violate soft-fork script flags since P2SH do not generally
   result in a ban. Also, banning behavior for invalid blocks is dependent on
   whether the node is validating with multiple script check threads, due to a long-
   standing bug. That inconsistency is still present after this commit.
 * Proof of work failure moves from 50 DoS points to a ban.
 * Blocks with timestamps under MTP now result in a ban, blocks
   too far in the future continue to *not* result in a ban.
 * Inclusion of non-final transactions in a block now results in a
   ban instead of 10 DoS points.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 11:00:19 -04:00
Matt Corallo b8b4c80146 [refactor] drop IsInvalid(nDoSOut)
Co-authored-by: Anthony Towns <aj@erisian.com.au>
2019-05-02 11:00:19 -04:00
Matt Corallo 8818729013 [refactor] Refactor misbehavior ban decisions to MaybePunishNode()
Isolate the decision of whether to ban a peer to one place in the
code, rather than having it sprinkled throughout net_processing.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
                Suhas Daftuar <sdaftuar@gmail.com>
                John Newbery <john@johnnewbery.com>
2019-05-02 11:00:19 -04:00
Matt Corallo 00e11e61c0 [refactor] rename stateDummy -> orphan_state
Co-authored-by: Anthony Towns <aj@erisian.com.au>
                Suhas Daftuar <sdaftuar@gmail.com>
2019-05-02 11:00:19 -04:00
Matt Corallo f34fa719cf Drop obsolete sigops comment
This comment was confusing and incorrect when first added ("invalid rather than
merely non-standard" has the opposite meaning of what is actually the case),
and was also not updated after segwit with the correct variable names.

Delete it since the code reads just fine on its own.

Co-authored by: Anthony Towns <aj@erisian.com.au>
                Suhas Daftuar <sdaftuar@gmail.com>
2019-05-02 11:00:19 -04:00
MarcoFalke 999931cf8f
rpc: Add getbalances RPC 2019-05-02 10:10:23 -04:00
MarcoFalke fad13e925e
rpcwallet: Make helper methods const on CWallet 2019-05-02 10:09:48 -04:00
MarcoFalke c1ba1182eb
Merge #15938: refactor: Silence "control reaches end of non-void function" (-Wreturn-type) in psbt.cpp
beb42d71a0 Silence GCC 7 warning "control reaches end of non-void function" (-Wreturn-type) in psbt.cpp (practicalswift)

Pull request description:

  Silence GCC 7 warning "control reaches end of non-void function" (`-Wreturn-type`) in `psbt.cpp`.

  Context: ef22fe8c1f (r33370109)

  Before this patch:

  ```
  $ ./configure CC=gcc-7 CXX=g++-7
  $ make 2>&1 | grep -A2 "warning: "
  leveldb/util/logging.cc:58:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             (v == kMaxUint64/10 && delta > kMaxUint64%10)) {
                                    ~~~~~~^~~~~~~~~~~~~~~
  --
  leveldb/port/port_posix.cc:60:15: warning: ‘ecx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return (ecx & (1 << 20)) != 0;
            ~~~~~^~~~~~~~~~~~
  --
  psbt.cpp:341:1: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^
  $
  ```

  After this patch:

  ```
  $ ./configure CC=gcc-7 CXX=g++-7
  $ make 2>&1 | grep -A2 "warning: "
  leveldb/util/logging.cc:58:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             (v == kMaxUint64/10 && delta > kMaxUint64%10)) {
                                    ~~~~~~^~~~~~~~~~~~~~~
  --
  leveldb/port/port_posix.cc:60:15: warning: ‘ecx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     return (ecx & (1 << 20)) != 0;
            ~~~~~^~~~~~~~~~~~
  $
  ```

ACKs for commit beb42d:

Tree-SHA512: b068b9aef565cae0bd1fa1f79c8d422ed2c3e7645edfa14a780a36dd66095a3c627f4111a6b16e706ce6c8abafe51725af8b3bf60778821de0aa8f6193bfadf8
2019-05-02 09:13:52 -04:00
practicalswift beb42d71a0 Silence GCC 7 warning "control reaches end of non-void function" (-Wreturn-type) in psbt.cpp 2019-05-02 15:08:22 +02:00
MarcoFalke c4560a7dfe
Merge #15650: Handle the result of posix_fallocate system call
5d35ae3326 Handle the result of posix_fallocate system call (Luca Venturini)

Pull request description:

  The system call `posix_fallocate` is not supported on some filesystems.

  - catches the result of posix_allocate and fall back to the default behaviour if the return value is different from 0 (success)

  Fixes #15624

ACKs for commit 5d35ae:
  MarcoFalke:
    utACK 5d35ae3326
  sipa:
    utACK 5d35ae3326, though the Yoda condition is an uncommon style in this project.
  hebasto:
    utACK 5d35ae3326
  practicalswift:
    utACK 5d35ae3326

Tree-SHA512: 7ab3b35fb633926f28a58b2b07ffde8e31bb997c80a716b1b45ee716fe9ff4ddcef0a05810bd4423530e220cfc62f8925517d27a8b92b05a524272063e43f746
2019-05-02 08:43:57 -04:00
Luke Dashjr fc929842c2 GUI: Move QRImageWidget to its own file-pair 2019-05-02 12:18:18 +00:00
João Barbosa d3e8458365 rpc: Show scanning details in getwalletinfo 2019-05-02 11:39:07 +01:00
João Barbosa 90e27abe37 wallet: Track current scanning progress 2019-05-02 11:39:05 +01:00
MarcoFalke 0936f35f65
Merge #15842: refactor: replace isPotentialtip/waitForNotifications by higher method
422677963a refactor: replace isPotentialtip/waitForNotifications by higher method (Antoine Riard)
edfe9438ca Add WITH_LOCK macro: run code while locking a mutex (Antoine Riard)

Pull request description:

  In Chain interface, instead of a isPotentialTip and a WaitForNotifications method, both used only once in CWallet::BlockUntilSyncedToCurrentChain, combine them in a higher WaitForNotificationsUpToTip method. Semantic should be unchanged, wallet wait for pending notifications to be processed unless block hash points to the current chain tip or a descendant.

ACKs for commit 422677:
  jnewbery:
    ACK 422677963a
  ryanofsky:
    utACK 422677963a. Only change is adding the cs_wallet lock annotation.

Tree-SHA512: 2834ff0218795ef607543fae822e5cce25d759c1a9cfcb1f896a4af03071faed5276fbe0966e0c6ed65dc0e88af161899c5b2ca358a2d24fe70969a550000bf2
2019-05-01 15:02:31 -04:00
John Newbery f1a77b0c51 [docs] Add doxygen comment for CReserveKey 2019-05-01 14:53:36 -04:00
John Newbery 37796b2dd4 [docs] Add doxygen comment for CKeyPool 2019-05-01 14:53:32 -04:00
MarcoFalke fab00a5cb9
rpc: Serialize in getblock without cs_main 2019-05-01 12:32:11 -04:00
MarcoFalke fa1c3591ad
rpc: Use IsValidNumArgs in getblock 2019-05-01 11:16:21 -04:00
MarcoFalke fad40ec915
wallet: Use IsValidNumArgs in getwalletinfo rpc 2019-05-01 10:21:21 -04:00
MarcoFalke 12aa2ac988
Merge #15323: rpc: Expose g_is_mempool_loaded via getmempoolinfo
effe81f750 Move g_is_mempool_loaded into CTxMemPool::m_is_loaded (Ben Woosley)
bb8ae2c419 rpc: Expose g_is_mempool_loaded via getmempoolinfo and /rest/mempool/info.json (Ben Woosley)

Pull request description:

  And use it to fix a race condition in mempool_persist.py:
  https://travis-ci.org/Empact/bitcoin/jobs/487577243

  Since e.g. getrawmempool returns errors based on this status, this
  enables users to test it for readiness.

  Fixes #12863

ACKs for commit effe81:
  MarcoFalke:
    utACK effe81f750
  jnewbery:
    utACK effe81f750

Tree-SHA512: 74328b0c17a97efb8a000d4ee49b9a673c2b6dde7ea30c43a6a2eff961a233351c9471f9a42344412135786c02bdf2ee1b2526651bb8fed68bd94d2120c4ef86
2019-05-01 10:06:15 -04:00
Luke Dashjr 77851ab682 GUI: Refactor actual QR code rendering into new QRImageWidget::setQR 2019-05-01 05:25:17 +00:00
MarcoFalke 2c35fe6238
Merge #15849: Thread names in logs and deadlock debug tools
8722e54e56 threads: add thread names to deadlock debugging message (James O'Beirne)
383b186c28 threads: prefix log messages with thread names (James O'Beirne)
ddd95ccb80 tests: add threadutil tests (James O'Beirne)
ae5f2b6a6c threads: introduce util/threadnames, refactor thread naming (James O'Beirne)
188ca75e5f disable HAVE_THREAD_LOCAL on unreliable platforms (James O'Beirne)

Pull request description:

  I'm resurrecting this one (from #13168) because I need it to make progress on #15735.

  It's now off by default and can be turned on with `-logthreadnames=1`.

  Ran some benchmarks (IBD from local peer from 500_000 -> 504_000) and it's within spitting distance either on or off:

  ### threadnames off (default)

  #### 2018-05-threadnames.3 vs. master (absolute)
  |                      name                      | iterations |   2018-05-threadnames.3    |           master           |
  |------------------------------------------------|-----------:|----------------------------|----------------------------|
  | ibd.local.500000.504000.dbcache=2048           |          3 | 376.1584 (± 9.2944)        | 392.3414 (± 13.4238)       |
  | ibd.local.500000.504000.dbcache=2048.mem-usage |          3 | 2236117.3333 (± 1845.9623) | 2238690.6667 (± 2669.3487) |

  #### 2018-05-threadnames.3 vs. master (relative)
  |                      name                      | iterations | 2018-05-threadnames.3 | master |
  |------------------------------------------------|-----------:|----------------------:|-------:|
  | ibd.local.500000.504000.dbcache=2048           |          3 |                     1 |  1.043 |
  | ibd.local.500000.504000.dbcache=2048.mem-usage |          3 |                     1 |  1.001 |

  ### threadnames on

  #### 2018-05-threadnames-take-2 vs. master (absolute)
  |                      name                      | iterations | 2018-05-threadnames-take-2 |           master           |
  |------------------------------------------------|-----------:|----------------------------|----------------------------|
  | ibd.local.500000.504000.dbcache=2048           |          3 | 367.6861 (± 0.3941)        | 364.1667 (± 0.9776)        |
  | ibd.local.500000.504000.dbcache=2048.mem-usage |          3 | 2238461.3333 (± 3697.8730) | 2237014.6667 (± 3307.6966) |

  #### 2018-05-threadnames-take-2 vs. master (relative)
  |                      name                      | iterations | 2018-05-threadnames-take-2 | master |
  |------------------------------------------------|-----------:|---------------------------:|-------:|
  | ibd.local.500000.504000.dbcache=2048           |          3 |                      1.010 |   1.00 |
  | ibd.local.500000.504000.dbcache=2048.mem-usage |          3 |                      1.001 |   1.00 |
  ```

ACKs for commit 8722e5:
  Empact:
    utACK 8722e54e56
  jnewbery:
    utACK 8722e54e56
  MarcoFalke:
    re-utACK 8722e54e56 (Only change since my previous review is DEFAULT_LOGTHREADNAMES=false and stylistic updates

Tree-SHA512: 50af992708295b8d680cf10025262dd964e599a356bdfc1dfc84fb18c00afabcb34d3d12d551b0677ff81f8fccad0e17c1d5b24dfecb953a913bc77fdd1a4577
2019-04-30 15:26:01 -04:00
MarcoFalke 10ed4dff24
Merge #15869: Add settings merge test to prevent regresssions
151f3e9cf1 Add settings merge test to prevent regresssions (Russell Yanofsky)

Pull request description:

  Test-only change. Motivation: I'm trying to clean up settings code and add support for read/write settings without changing existing behavior, but current tests are very scattershot and don't actually cover a lot of current behavior.

ACKs for commit 151f3e:
  jonasschnelli:
    utACK 151f3e9cf1.
  MarcoFalke:
    utACK 151f3e9cf1

Tree-SHA512: f9062f078da02855cdbdcae37d0cea5684e82adbe5c701a8eb042ee4a57d899f0ffb6a9db3bcf58b639dff22b2b2d8a75f9a7917402df58904036753d65a1e3e
2019-04-30 12:13:22 -04:00
Hennadii Stepanov a0a222eec0
Replace deprecated Boost Filesystem function
Boost Filesystem basename() function is deprecated since v1.36.0.
Also, defining BOOST_FILESYSTEM_NO_DEPRECATED before including
filesystem headers is strongly recommended. This prevents inadvertent
use of old features, particularly legacy function names, that have been
replaced and are going to go away in the future.
2019-04-30 10:05:54 +03:00
Hennadii Stepanov 4f65af97b4
Remove dead code for walletFile check
SplitWalletPath() garanties the walletFile is a plain filename without a
directory.
2019-04-30 00:43:50 +03:00
James O'Beirne 8722e54e56 threads: add thread names to deadlock debugging message
Also refactor CLockLocation to use an initialization list.
2019-04-29 13:51:59 -04:00
James O'Beirne 383b186c28 threads: prefix log messages with thread names
Introduce a new flag (`-logthreadnames`) which allows toggling
of this behavior.
2019-04-29 13:49:15 -04:00
James O'Beirne ddd95ccb80 tests: add threadutil tests 2019-04-29 13:43:01 -04:00
James O'Beirne ae5f2b6a6c threads: introduce util/threadnames, refactor thread naming
This work is prerequisite to attaching thread names to log lines and deadlock
debug utilities. This code allows setting of an "internal" threadname per
thread on platforms where thread_local is available.

This commit also moves RenameThread() out of a more general module and adds a
numeric suffix to disambiguate between threads with the same name. It
explicitly names a few main threads using the new util::ThreadRename().
2019-04-29 13:42:25 -04:00
Gregory Sanders 78e407ad0c GetKeyBirthTimes should return key ids, not destinations 2019-04-29 10:15:23 -04:00
Gregory Sanders 70946e7fee Replace CScriptID and CKeyID in CTxDestination with dedicated types 2019-04-29 10:15:23 -04:00
MarcoFalke 10852210bc
Merge #15877: doc: Fix -dustrelayfee= argument docs grammar
64491cb376 doc: Fix -dustrelayfee= argument docs grammar (keepkeyjon)

Pull request description:

ACKs for commit 64491c:
  fanquake:
    utACK 64491cb

Tree-SHA512: 562180e5bb065c71cda89555afd1cd5a54a98b058ab9006af3a6437fbbde46c7f3930b3fe98900bbb18f329057e00da81bc8290bdf6160d7eccc97d255b30e4b
2019-04-29 09:10:36 -04:00
MarcoFalke 5873e9a3e8
Merge #15919: Remove unused OpenSSL includes to make it more clear where OpenSSL is used
a34081b7c3 Remove unused OpenSSL includes to make it more clear where OpenSSL is used (practicalswift)

Pull request description:

  Remove unused OpenSSL includes to make it more clear where OpenSSL is used.

  Before this patch:

  ```
  $ git grep '#include <openssl/' -- "*.cpp" "*.h"
  src/init.cpp:#include <openssl/crypto.h>
  src/qt/paymentrequestplus.cpp:#include <openssl/x509_vfy.h>
  src/qt/paymentrequestplus.h:#include <openssl/x509.h>
  src/qt/paymentserver.cpp:#include <openssl/x509_vfy.h>
  src/qt/rpcconsole.cpp:#include <openssl/crypto.h>
  src/qt/test/paymentservertests.cpp:#include <openssl/x509.h>
  src/qt/test/paymentservertests.cpp:#include <openssl/x509_vfy.h>
  src/qt/test/test_main.cpp:#include <openssl/ssl.h>
  src/qt/winshutdownmonitor.cpp:#include <openssl/rand.h>
  src/random.cpp:#include <openssl/err.h>
  src/random.cpp:#include <openssl/rand.h>
  src/random.cpp:#include <openssl/conf.h>
  src/test/crypto_tests.cpp:#include <openssl/aes.h>
  src/test/crypto_tests.cpp:#include <openssl/evp.h>
  ```

  After this patch:

  ```
  $ git grep '#include <openssl/' -- "*.cpp" "*.h"
  src/qt/paymentrequestplus.cpp:#include <openssl/x509_vfy.h>
  src/qt/paymentrequestplus.h:#include <openssl/x509.h>
  src/qt/paymentserver.cpp:#include <openssl/x509_vfy.h>
  src/qt/test/paymentservertests.cpp:#include <openssl/x509.h>
  src/qt/test/paymentservertests.cpp:#include <openssl/x509_vfy.h>
  src/qt/test/test_main.cpp:#include <openssl/ssl.h>
  src/qt/winshutdownmonitor.cpp:#include <openssl/rand.h>
  src/random.cpp:#include <openssl/err.h>
  src/random.cpp:#include <openssl/rand.h>
  src/random.cpp:#include <openssl/conf.h>
  ```

  Removed:
  * `src/init.cpp:#include <openssl/crypto.h>` (unused since 5ecfa36fd0 (2016))
  * `src/qt/rpcconsole.cpp:#include <openssl/crypto.h>` (unused since 5ecfa36fd0 (2016))
  * `src/test/crypto_tests.cpp:#include <openssl/aes.h>` (introduced unused in daa384120a (2015))
  * `src/test/crypto_tests.cpp:#include <openssl/evp.h>` (introduced unused in daa384120a (2015))

ACKs for commit a34081:
  MarcoFalke:
    utACK a34081b7c3
  real-or-random:
    utACK a34081b
  fanquake:
    utACK a34081b

Tree-SHA512: 8ab9699c063f2d0ed2d71738f20ac5c21336585f7f62fd3a4b23199a125ea3224725591d64171347465762181788fac1bc4ce13d8824090bf1a5ac71a66d6538
2019-04-29 08:51:03 -04:00
MarcoFalke c1d2b76d80
Merge #15913: Bugfix: dummywallet: Add -ignorepartialspends to list of ignored wallet options
765d5890be Bugfix: dummywallet: Add -ignorepartialspends to list of ignored wallet options (Luke Dashjr)
0f09eb779d dummywallet: Reformat ignored wallet options list (Luke Dashjr)

Pull request description:

  When building w/o wallet support, we add all the wallet options as hidden options to avoid throwing errors/warnings that they're unknown.

  `-ignorepartialspends` is missing from this list. This PR adds it.

  (This seems like a good candidate for a linter? Or maybe we can autogenerate it?)

  Also reformats the dummywallet options list across multiple lines to make conflicts less often.

ACKs for commit 765d58:
  meshcollider:
    utACK 765d5890be
  MarcoFalke:
    utACK 765d5890be
  promag:
    utACK 765d589.
  practicalswift:
    utACK 765d5890be
  fanquake:
    utACK 765d589

Tree-SHA512: 37c8037148bdc1b7a8bde201eff51ee6a64c042c17eb8b6c68faef490d16575348c2f22ab81f48302b8ad80a5559222af23b721a8b5acc1d89c0757fb88796a6
2019-04-29 08:45:48 -04:00
MarcoFalke 150be1c7b3
Merge #15917: wallet: Avoid logging no_such_file_or_directory error
70c1cf8c1c wallet: Avoid logging no_such_file_or_directory error (João Barbosa)

Pull request description:

  Avoid logging `IsBerkeleyBtree: No such file or directory ...`. The result of `IsBerkeleyBtree` is the same since `fs::file_size()` returns 0 for non existent files.

  Fix #15912.

ACKs for commit 70c1cf:
  practicalswift:
    utACK 70c1cf8c1c
  jonasschnelli:
    utACK 70c1cf8c1c
  Empact:
    utACK 70c1cf8c1c

Tree-SHA512: 964a64fff9a17b805a1570884cdb2beb82283498f790b0464e011791803ae7f37dba213320c76a920dd92b2b972a7640e6277ecf470400734149dc8f9f9f1d6d
2019-04-29 08:06:55 -04:00
practicalswift a34081b7c3 Remove unused OpenSSL includes to make it more clear where OpenSSL is used 2019-04-29 12:53:24 +02:00
Jonas Schnelli 3a0d6da098
Merge #15371: gui: Uppercase bech32 addresses in qr codes
3407b446c gui: Uppercase bech32 addresses in qr codes (Ben Carman)

Pull request description:

  Closes #12191

ACKs for commit 3407b4:
  meshcollider:
    utACK 3407b446cc
  jonasschnelli:
    Re utACK 3407b446cc

Tree-SHA512: d63ecf8e9805c46c9f554cc929661a37837bc3ba9b7b931331c2a5c2b81468742e1819c9add73966083011709cc15ae1870a454348af8591b3d75d3765dca568
2019-04-29 09:04:40 +02:00
João Barbosa 70c1cf8c1c wallet: Avoid logging no_such_file_or_directory error 2019-04-29 00:07:55 +01:00
João Barbosa 2ee811e693 wallet: Track scanning duration 2019-04-28 11:14:54 +01:00
Luke Dashjr 765d5890be Bugfix: dummywallet: Add -ignorepartialspends to list of ignored wallet options 2019-04-28 04:42:38 +00:00
Luke Dashjr 0f09eb779d dummywallet: Reformat ignored wallet options list 2019-04-28 04:42:14 +00:00
andrewtoth 1b602f6fed remove extraneous scope 2019-04-27 10:16:33 -04:00
andrewtoth 6ad372a973 wallet: log on rescan completion 2019-04-27 10:15:56 -04:00
MarcoFalke 3356799ee3
Merge #15778: [wallet] Move maxtxfee from node to wallet
5c759c73b2 [wallet] Move maxTxFee to wallet (John Newbery)

Pull request description:

  Closes #15355

  Moves the `-maxtxfee` from the node to the wallet. See discussion in issue for details.

  This is a cleanup. There is no change in behaviour.

  Completes #15620

ACKs for commit 5c759c:
  MarcoFalke:
    utACK 5c759c73b2
  ryanofsky:
    utACK 5c759c73b2. Changes since last review: updated commit message and an error message and method name.
  meshcollider:
    utACK 5c759c73b2

Tree-SHA512: 2f9b2729da3940a5cda994d3f3bc11ee1a52fcc1c5e9842ea0ea63e4eb0300e8416853046776311298bc449ba07554aa46f0f245ce28598a5b0bd7347c12e752
2019-04-27 09:28:54 -04:00
MeshCollider b025aa3b9e
Merge #15846: [POLICY] Make sending to future native witness outputs standard
c634b1e20 [POLICY] Make sending to future native witness outputs standard (Pieter Wuille)

Pull request description:

  As discussed in the April 18 2019 IRC meeting.

  This makes sending to future Segwit versions via native outputs (bech32) standard for relay, mempool acceptance, and mining. The reasons are:
  * This may interfere with smooth adoption of future segwit versions, if they're defined (by the sender wallet/node).
  * It violates BIP173 ("Version 0 witness addresses are always 42 or 62 characters, but implementations MUST allow the use of any version."), though admittedly this code was written before BIP173.
  * It doesn't protect much, as P2SH-embedded segwit cannot be filtered in this way.
  * As a general policy, the sender shouldn't care what the receiver likes his outputs to be.

  Note that _spending_ such outputs (including P2SH-embedded ones) remains nonstandard, as that is actually required for softfork safety.

ACKs for commit c634b1:
  MarcoFalke:
    utACK c634b1e207
  harding:
    Tested ACK c634b1e207
  meshcollider:
    utACK c634b1e207

Tree-SHA512: e37168a1be9f445a04d4280593f0a92bdae33eee00ecd803d5eb16acb5c9cfc0f1f0a1dfbd5a0cc73da2c9928ec11cbdac7911513a78f85b789ae0d00e1b5962
2019-04-27 21:50:45 +12:00
MeshCollider 703414994a
Merge #15784: rpc: Remove dependency on interfaces::Chain in SignTransaction
99e88a372 rpc: Remove dependency on interfaces::Chain in SignTransaction (Antoine Riard)

Pull request description:

  Assuming wallet RPCs and node RPCs will go into different processes, signrawtransactionwithkey doesn't need to access Coins via interfaces::Chain, it may use directly utility in node/coins.cpp

  Obviously will need rebase after #15638

Tree-SHA512: 42ee8fcbcd38643bbd82210db6f68249bed5ee036a4c930a1db534d0469a133e287b8869c977bf0cc79a7296dde04f72adb74d24e1cd20f4a280f4c2b7fceb74
2019-04-27 15:29:48 +12:00
MarcoFalke d76b72a454
Merge #15267: doc: explain AcceptToMemoryPoolWorker's coins_to_uncache
5d26205272 doc: explain AcceptToMemoryPoolWorker's coins_to_uncache (James O'Beirne)

Pull request description:

  I found ATMPW's `coins_to_uncache` a little hard to understand (see #15264). This adds some doc for posterity.

ACKs for commit 5d2620:
  jnewbery:
    ACK 5d26205272

Tree-SHA512: 088508fa78012fab8680663c4e30f5cee29768416c2ca8b8b2abc29b6ac7067c5a589674f0254474a7ccc95477889d41719760f5796792bf492f51b3dd499c6c
2019-04-26 13:09:30 -04:00
James O'Beirne 5d26205272 doc: explain AcceptToMemoryPoolWorker's coins_to_uncache 2019-04-26 10:01:45 -04:00
Suhas Daftuar e32e08407e Remove NOTFOUND transactions from in-flight data structures
This prevents a bug where the in-flight queue for our peers will not be
drained, resulting in not downloading any new transactions from our peers.

Thanks to ajtowns for reporting this bug.
2019-04-26 09:31:29 -04:00
Suhas Daftuar 23163b7593 Add an explicit memory bound to m_tx_process_time
Previously there was an implicit bound based on the handling of m_tx_announced,
but that approach is error-prone (particularly if we start automatically
removing things from that set).
2019-04-26 09:31:29 -04:00
Suhas Daftuar 218697b645 Improve NOTFOUND comment 2019-04-26 09:31:29 -04:00
MarcoFalke c65c77c721
Merge #14039: Disallow extended encoding for non-witness transactions
bb530efa18 Disallow extended encoding for non-witness transactions (Pieter Wuille)

Pull request description:

  BIP144 specifies that transactions without witness should use the legacy encoding, which is currently not enforced.

  This rule was present in the original SegWit implementation (https://github.com/bitcoin/bitcoin/pull/8149), but was subsequently dropped (https://github.com/bitcoin/bitcoin/pull/8589).

  As all hashes, txids, and weights are always computed over a reserialized version of a transaction, it is mostly harmless to permit extended encoding for non-segwit transactions, but I'd rather strictly follow the BIP.

ACKs for commit bb530e:
  instagibbs:
    utACK bb530efa18
  stevenroose:
    utACK bb530efa18

Tree-SHA512: 1aeccd6a555f43784fefb076ce2e8ad2f5ba7be49840544a50050d0390f82373f87201bf56cf8bb30841b4f9cd893b382261a080da875d4e11ab7051f8640dbe
2019-04-25 14:15:43 -04:00
David A. Harding e0bb279999
Doc: remove text about txes always relayed from -whitelist
Updates text since -whitelistforcerelay was set to false by default in
PR #15193.
2019-04-25 13:11:33 -04:00
Hennadii Stepanov 2ee756f041
Show recipient list as detailedText of QMessageBox 2019-04-24 23:36:15 +03:00
Hennadii Stepanov 654e419549
Make SendConfirmationDialog fully fledged
The property-based API has been used. Added support for the
`informativeText` and `detailedText` properties.
2019-04-24 21:56:10 +03:00
keepkeyjon 64491cb376
doc: Fix -dustrelayfee= argument docs grammar 2019-04-23 14:07:06 -06:00
Antoine Riard 422677963a refactor: replace isPotentialtip/waitForNotifications by higher method
Add GUARDED_BY(cs_wallet) annotation to m_last_block_processed, given
that its now guarded by cs_wallet instead of cs_main
2019-04-23 13:53:46 -04:00
MarcoFalke 4bd7187da8
Merge #15699: Remove no-op CClientUIInterface::[signal_name]_disconnect. Disconnect BlockNotifyGenesisWait and RPCNotifyBlockChange properly.
6dd469a3be Disconnect BlockNotifyGenesisWait and RPCNotifyBlockChange properly. Remove no-op CClientUIInterface::[signal_name]_disconnect. (practicalswift)

Pull request description:

  Resolves #15698.

  Changes:
  * Remove no-op `CClientUIInterface::[signal_name]_disconnect`.
  * Disconnect `BlockNotifyGenesisWait` and `RPCNotifyBlockChange` properly.

ACKs for commit 6dd469:
  MarcoFalke:
    utACK 6dd469a3be

Tree-SHA512: 0b50d658fa72261332bc57ddea379fd08f4bc1de392c10c628e20142d6fd244b606c39fd0665d6bc39324c1aa8c8814ac942b4659106279e33b90206aaf37411
2019-04-23 13:03:41 -04:00
Jonas Schnelli e9e777e21b
Merge #15874: Resolve the qt/guiutil <-> qt/optionsmodel CD
fa1c8e297 Resolve the qt/guiutil <-> qt/optionsmodal CD (251)

Pull request description:

  This pull request attempts to resolve the `qt/guiutil` <-> `qt/optionsmodel` circular dependency.

  The `Intro` class in `qt/intro` has a static member function `getDefaultDataDirectory` which is used by `qt/optionsmodel` and creates the circular dependency
  `qt/guiutil -> qt/walletmodel -> qt/optionsmodel -> qt/intro -> qt/guiutil`.

  This circular dependency is resolved by moving `Intro::getDefaultDataDirectory` to `GUIUtil::getDefaultDataDirectory` without modifying the implementation.

ACKs for commit fa1c8e:
  MarcoFalke:
    utACK fa1c8e2978
  promag:
    utACK fa1c8e2.
  hebasto:
    utACK fa1c8e2978
  practicalswift:
    utACK fa1c8e2978
  jonasschnelli:
    utACK fa1c8e2978

Tree-SHA512: 58cc4aee937c943d8de9dc97ef1789decfddb0287308f44e7e3a3b497c19e51da184988e17207544fff410168ec98dd49a3e62c47e84ad1f0cf6ef7247a80fb5
2019-04-23 18:11:01 +02:00
MarcoFalke cd14d210c4
Merge #15463: rpc: Speedup getaddressesbylabel
710a7136f9 rpc: Speedup getaddressesbylabel (João Barbosa)

Pull request description:

  Fixes #15447. Same approach of #14984, this change avoids duplicate key check when building the JSON response in memory.

ACKs for commit 710a71:
  MarcoFalke:
    utACK 710a7136f9
  ryanofsky:
    utACK 710a7136f9. Just new comments and assert since last review.

Tree-SHA512: 77c95df9ff3793e348619aa070e6fd36df9da1b461d708ab146652cb3699f1a472ef6eb38dafdb8374375cbc97daef07635fcb0501961f167a023309513742e2
2019-04-23 10:59:41 -04:00
Wladimir J. van der Laan 2d5419feed
Merge #15780: wallet: add cachable amounts for caching credit/debit values
c9e6e7ed7 wallet: add cachable amounts for caching credit/debit values (Karl-Johan Alm)

Pull request description:

  This is a refactoring that will make #13756 a lot cleaner and straight-forward, since it adds another combination to the pile (watch-only * spendable * reused).

  It's also a nice change in general.

Tree-SHA512: 6c876d58bbffd5cb85ef632dea4fd6afed163904bbde5efdb307fa119af178ed3cb5df047255da7e9a9136fed876922f1116fce61a3710f308c72275f9b7d18b
2019-04-23 16:43:10 +02:00
251 fa1c8e2978 Resolve the qt/guiutil <-> qt/optionsmodal CD
This pull request attempts to resolve the `qt/guiutil` <-> `qt/optionsmodel`
circular dependency.

The circular dependency is resolved by moving the `Intro::getDefaultDataDirectory`
member function to `GUIUtil::getDefaultDataDirectory`.
2019-04-23 13:26:06 +02:00
Karl-Johan Alm c9e6e7ed79
wallet: add cachable amounts for caching credit/debit values 2019-04-23 08:18:58 +09:00
Russell Yanofsky 151f3e9cf1 Add settings merge test to prevent regresssions 2019-04-22 08:10:05 -04:00
João Barbosa 710a7136f9 rpc: Speedup getaddressesbylabel 2019-04-22 10:00:07 +01:00
Antoine Riard edfe9438ca Add WITH_LOCK macro: run code while locking a mutex
Results from ryanofksy suggestion on isPotentialTip/
waitForNotifications refactoring
2019-04-20 08:13:34 -04:00
MarcoFalke 56376f3365
Merge #15670: refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight
765c0b364d refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight (Antoine Riard)

Pull request description:

  As suggested in #14711, pass height to CChain::FindEarliestAtLeast to
  simplify Chain interface by combining findFirstBlockWithTime and
  findFirstBlockWithTimeAndHeight into one

ACKs for commit 765c0b:
  jnewbery:
    utACK 765c0b364d. Nice work @ariard!
  ryanofsky:
    utACK 765c0b364d. Looks good, thanks for implementing the suggestion!

Tree-SHA512: 63f98252a93da95f08c0b6325ea98f717aa9ae4036d17eaa6edbec68e5ddd65672d66a6af267b80c36311fffa9b415a47308e95ea7718b300b685e23d4e9e6ec
2019-04-19 12:03:12 -04:00
MarcoFalke b6a5583c4f
Merge #15853: wallet: Remove unused import checkpoints.h
fadf7d1390 wallet: Remove unused import checkpoints.h (MarcoFalke)

Pull request description:

  Yet another silent merge conflict. This one was caused by unsorted includes.

ACKs for commit fadf7d:

Tree-SHA512: b5bcbddfa0c443bd179cd239cb1d9942d904303d59ca72f97bcac8711f8d9cbdf96821c7fd33ed6c0f4ec9ec1ad72af176ffae11c5f19db861a0486022e321a5
2019-04-19 10:20:16 -04:00
MarcoFalke fadf7d1390
wallet: Remove unused import checkpoints.h 2019-04-19 09:50:23 -04:00
MarcoFalke ae2c19f578
Merge #15655: Resolve the checkpoints <-> validation circular dependency
418d3230f8 Resolve the checkpoints <-> validation CD. (251)

Pull request description:

  This pull request attempts to resolve the `checkpoints -> validation -> checkpoints` circular dependency.

  The circular dependency is resolved by moving the `CheckPoints::GetLastCheckpoint(const CCheckpointData& data)` function to `validation.cpp` where it used exclusively by the private function `ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& params, const CBlockIndex* pindexPrev, int64_t nAdjustedTime)`.

ACKs for commit 418d32:
  promag:
    utACK 418d323, only `GetLastCheckpoint` usage is in `validation.cpp` and so makes sense to move it there.
  practicalswift:
    utACK 418d3230f8
  MarcoFalke:
    utACK 418d3230f8
  sipa:
    utACK 418d3230f8

Tree-SHA512: 03c3556bc192e65f5e3fa76fd545d4ee7d63d3fb06b132f7a1fa6131aa21ddd2e5b2d19e2222dfe524f422daaca30efde219bed188db8c74ff4b088876b5bc16
2019-04-19 09:34:01 -04:00
Pieter Wuille c634b1e207 [POLICY] Make sending to future native witness outputs standard 2019-04-18 12:46:07 -07:00
Wladimir J. van der Laan 84adc79e10
Merge #15829: qt: update request payment button text and tab description
81b2830b15 qt: update request payment button text and tab description (Tobias Kaderle)

Pull request description:

  Rebased and squashed version of #14484.

  ![create new address](https://user-images.githubusercontent.com/863730/56212202-1f665980-608c-11e9-80d8-87a6211a9def.png)

  ![addresses dialog](https://user-images.githubusercontent.com/863730/56212205-22614a00-608c-11e9-83e4-efe531ea6070.png)

ACKs for commit 81b283:
  MarcoFalke:
    utACK 81b2830b15
  jonasschnelli:
    utACK 81b2830b15
  meshcollider:
    utACK 81b2830b15

Tree-SHA512: 96c6dc1f08560066110ec916b0a8879265db46174a5c5993332509b6bceb93ed6a8e06e3e8bd382e35aacc1c4d4a2458ec1d065213060db34ded4f0b2683964a
2019-04-18 19:48:11 +02:00
Wladimir J. van der Laan 6ce77a3668
Merge #15833: [doc] remove out-of-date comment on pay-to-witness support
2d8ba4f867 remove out-of-date comment on pay-to-witness support (r8921039)

Pull request description:

  The comment below on function 'ExtractDestinations' was added 2017-08-15 while the support was added later on 2017-08-25 through function 'ExtractDestination'.

  ```
  Currently does not extract address from pay-to-witness scripts
  ```

ACKs for commit 2d8ba4:

Tree-SHA512: ce8eb9660c56a8998cc94c8cbc5d47f875045b4aa558f2325cb125ec77794a100f7b73ead12a48a7630aa80483237bb67eb8ee6b0f9a527275ed546718b7a0e1
2019-04-18 19:45:45 +02:00
Wladimir J. van der Laan f5aaeae0cd
Merge #15801: Bugfix: GUI: Options: Initialise prune setting range before loading current value, and remove upper bound limit
8a33f4d63f GUI: Options: Remove the upper-bound limit from pruning size setting (Luke Dashjr)
4ddeb2f860 GUI: Options: Set the range of pruning size before loading its value (Luke Dashjr)

Pull request description:

  This fixes two bugs:

  1. The prune setting range was set *after* loading the current value. If users had a prune of (eg) 200, it would get limited to 99 before the range was raised. This is fixed by setting the range first.
  2. The prune setting was limited to <= the chainparams' "assumed blockchain size". There's no reason for this limit (the UX is the same either way), and there are use cases it breaks (eg, setting a prune size such that it begins pruning at some future point). Therefore, I raised it to the max value.

  This is a daggy fix, so should cleanly merge to both master and 0.18 branches.

ACKs for commit 8a33f4:
  MarcoFalke:
    utACK 8a33f4d63f
  laanwj:
    utACK 8a33f4d63f
  promag:
    utACK 8a33f4d.

Tree-SHA512: 480570fa243ab5cc76af76fded18cb8cb2d3194b9f050fec5e03ca551edeeda72ee8b06312e200a9e49404ec1cdffa62f7150cf9982ec1b282f17d90879ce438
2019-04-18 17:46:38 +02:00
John Newbery 5c759c73b2 [wallet] Move maxTxFee to wallet
This commit moves the maxtxfee setting to the wallet. There is only
one minor behavior change:

- an error message in feebumper now refers to -maxtxfee instead of
maxTxFee.
2019-04-18 11:34:42 -04:00
James O'Beirne 89e8df1674 tests: fix outdate include in blockfilter_index_tests 2019-04-18 10:25:47 -04:00
MarcoFalke e4beef611a
Merge #14121: Index for BIP 157 block filters
c7efb652f3 blockfilter: Update BIP 158 test vectors. (Jim Posen)
19308c9e21 rpc: Add getblockfilter RPC method. (Jim Posen)
ff35105096 init: Add CLI option to enable block filter index. (Jim Posen)
accc8b8b18 index: Access functions for global block filter indexes. (Jim Posen)
2bc90e4e7b test: Unit test for block filter index reorg handling. (Jim Posen)
6bcf0998c0 test: Unit tests for block index filter. (Jim Posen)
b5e8200db7 index: Implement lookup methods on block filter index. (Jim Posen)
75a76e3619 index: Implement block filter index with write operations. (Jim Posen)
2ad2338ef9 serialize: Serialization support for big-endian 32-bit ints. (Jim Posen)
ba6ff9a6f7 blockfilter: Functions to translate filter types to/from names. (Jim Posen)
62b7a4f094 index: Ensure block locator is not stale after chain reorg. (Jim Posen)
4368384f1d index: Allow atomic commits of index state to be extended. (Jim Posen)

Pull request description:

  This introduces a new BlockFilterIndex class, which is required for BIP 157 support.

  The index is uses the asynchronous BaseIndex infrastructure driven by the ValidationInterface callbacks. Filters are stored sequentially in flat files and the disk location of each filter is indexed in LevelDB along with the filter hash and header. The index is designed to ensure persistence of filters reorganized out of the main chain to simplify the BIP 157 net implementation.

  Stats (block height = 565500):
  - Syncing the index from scratch takes 45m
  - Total index size is 3.8 GiB

ACKs for commit c7efb6:
  MarcoFalke:
    utACK c7efb652f3
  ryanofsky:
    Slightly tested ACK c7efb652f3 (I just rebuilt the index with the updated PR and tested the RPC). Changes since last review: rebase, fixed compile errors in internal commits, new comments, updated error messages, tweaked cache size logic, renamed commit method, renamed constants and globals, fixed whitespace, extra BlockFilterIndex::Init error check.

Tree-SHA512: f8ed7a9b6f76df45933aa5eba92b27b3af83f6df2ccb3728a5c89eec80f654344dc14f055f6f63eb9b3a7649dd8af6553fe14969889e7e2fd2f8461574d18f28
2019-04-18 09:48:25 -04:00
MarcoFalke dae72998e8
Merge #15779: test: Add wallet_balance benchmark
fad7c33342 refactor: Add handleNotifications method to wallet (MarcoFalke)
fa46ac3127 bench: Add wallet_balance benchmarks (MarcoFalke)

Pull request description:

ACKs for commit fad7c3:
  ryanofsky:
    utACK fad7c33342. I might squash or rearrange the commits to avoid adding code in one commit that just gets deleted in the next one. But overall this looks good and the cleanup is nice.

Tree-SHA512: 231faac168cbe9bb0ab4bf10ac1d5b042c610364406d75061fba27f1e9d16c71867e74cc4606e9f42659aa980d7133c00e29fcc18bbba7da2fa7a80178b3246c
2019-04-17 15:14:12 -04:00
MarcoFalke fad7c33342
refactor: Add handleNotifications method to wallet
Further stylistic cleanups in touched files:

* Sort the includes
* Wrap long single-line constructors into multiple lines
2019-04-17 14:20:44 -04:00
MarcoFalke e2b5fdee00
Merge #15474: rest/rpc: Make mempoolinfo atomic
e377846ff1 rest/rpc: Make mempoolinfo atomic (João Barbosa)

Pull request description:

  Make `/rest/mempool/info.json` endpoint and `getmempoolinfo` RPC atomic.

ACKs for commit e37784:

Tree-SHA512: 6b40844df813e180d68731fc263bd9a2c2a01fe143a4f5a8974e3e0023e6e2e1e9bc46669ddfdf44f0e47142feda2a2aad1ea02ef8837081e11522347f314b0b
2019-04-17 10:30:38 -04:00
Antoine Riard 99e88a3726 rpc: Remove dependency on interfaces::Chain in SignTransaction
Comment SignTransaction utility
2019-04-17 08:17:17 -04:00
MarcoFalke 0c9de67f34
Merge #15352: tests: Reduce noise level in test_bitcoin output
0aef39d067 Silence "Test case [...] did not check any assertions" warnings when running "test_bitcoin --log_level=test_suite" (practicalswift)
5fd73c8694 Avoid repeated log messages in tests by connecting to signal handlers (ThreadSafeMessageBox, etc.) only once (practicalswift)
e502c3c515 tests: Reduce noise level in test_bitcoin output (practicalswift)

Pull request description:

  Reduce noise level in `test_bitcoin` output.

  Context: When working on the non-determinism issues in the unit tests (see #15296) I got a bit tired of the amount of noise in the `test_bitcoin` output :-)

  Before:

  ```
  $ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c
        1 Running 341 test cases...
        1 Test case blockencodings_tests/TransactionsRequestDeserializationOverflowTest did not check any assertions
        1 CheckSplitTorReplyLine(PROTOCOLINFO PIVERSION)
        1 CheckSplitTorReplyLine(AUTH METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie")
        1 CheckSplitTorReplyLine(AUTH METHODS=NULL)
        1 CheckSplitTorReplyLine(AUTH METHODS=HASHEDPASSWORD)
        1 CheckSplitTorReplyLine(VERSION Tor="0.2.9.8 (git-a0df013ea241b026)")
        1 CheckSplitTorReplyLine(AUTHCHALLENGE SERVERHASH=aaaa SERVERNONCE=bbbb)
        1 CheckSplitTorReplyLine(COMMAND)
        1 CheckSplitTorReplyLine(COMMAND SOME  ARGS)
        1 CheckSplitTorReplyLine(COMMAND  ARGS)
        1 CheckSplitTorReplyLine(COMMAND   EVEN+more  ARGS)
        1 CheckParseTorReplyMapping(METHODS=COOKIE,SAFECOOKIE COOKIEFILE="/home/x/.tor/control_auth_cookie")
        1 CheckParseTorReplyMapping(METHODS=NULL)
        1 CheckParseTorReplyMapping(METHODS=HASHEDPASSWORD)
        1 CheckParseTorReplyMapping(Tor="0.2.9.8 (git-a0df013ea241b026)")
        1 CheckParseTorReplyMapping(SERVERHASH=aaaa SERVERNONCE=bbbb)
        1 CheckParseTorReplyMapping(ServiceID=exampleonion1234)
        1 CheckParseTorReplyMapping(PrivateKey=RSA1024:BLOB)
        1 CheckParseTorReplyMapping(ClientAuth=bob:BLOB)
        1 CheckParseTorReplyMapping(Foo=Bar=Baz Spam=Eggs)
        1 CheckParseTorReplyMapping(Foo="Bar=Baz")
        1 CheckParseTorReplyMapping(Foo="Bar Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\ Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\@Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\"Baz" Spam="\"Eggs\"")
        1 CheckParseTorReplyMapping(Foo="Bar\\Baz")
        1 CheckParseTorReplyMapping(Foo="Bar\nBaz\t" Spam="\rEggs" Octals="\1a\11\17\18\81\377\378\400\2222" Final=Check)
        1 CheckParseTorReplyMapping(Valid=Mapping Escaped="Escape\\")
        1 CheckParseTorReplyMapping(Valid=Mapping Bare="Escape\")
        1 CheckParseTorReplyMapping(OneOctal="OneEnd\1" TwoOctal="TwoEnd\11")
        1 CheckParseTorReplyMapping(Null="\0")
        1 CheckParseTorReplyMapping(SOME=args,here MORE optional=arguments  here)
        1 CheckParseTorReplyMapping(ARGS)
        1 CheckParseTorReplyMapping(MORE ARGS)
        1 CheckParseTorReplyMapping(MORE  ARGS)
        1 CheckParseTorReplyMapping(EVEN more=ARGS)
        1 CheckParseTorReplyMapping(EVEN+more ARGS)
        1 Test case util_tests/util_criticalsection did not check any assertions
        1 Testing known outcomes
      326 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_943311758/tempdir/path_does_not_exist" does not exist
      327 Error: Specified -walletdir "/tmp/test_bitcoin/1553850209_643733972/tempdir/not_a_directory.dat" is not a directory
      328 Error: Specified -walletdir "wallets" is a relative path
        1
        1 *** No errors detected

  ```

  After:

  ```
  $ src/test/test_bitcoin --log_level=test_suite 2>&1 | grep -vE '(Entering|Leaving)' | uniq -c
        1 Running 341 test cases...
        1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_943311758/tempdir/path_does_not_exist" does not exist
        1 Error: Specified -walletdir "/tmp/test_bitcoin/1553850026_643733972/tempdir/not_a_directory.dat" is not a directory
        1 Error: Specified -walletdir "wallets" is a relative path
        1
        1 *** No errors detected

  ```

ACKs for commit 0aef39:
  MarcoFalke:
    utACK 0aef39d067

Tree-SHA512: 9cc22f64aa5c875861bae6533d18675ad978c623f053754deef6a8e271ea70bda3f72fb4ec5c8fd19b841757f21380639051d5f5b44301b9d2464b57655e9c05
2019-04-16 14:18:47 -04:00
Tobias Kaderle 81b2830b15
qt: update request payment button text and tab description 2019-04-16 20:40:13 +08:00
MarcoFalke 598323911e
Merge #15770: rpc: Validate maxfeerate with AmountFromValue
aa410c2b17 rpc: Validate maxfeerate with AmountFromValue (João Barbosa)

Pull request description:

  With this change `maxfeerate` can also be set as a string, accordingly to the help test:
  ```
    maxfeerate    (numeric or string,
  ```
  Beside, there are no tests for the removed errors.

ACKs for commit aa410c:
  meshcollider:
    utACK aa410c2b17
  MarcoFalke:
    utACK aa410c2b17 Good catch

Tree-SHA512: f3bfea91dc7daa943729e270585dbf333055aeda805fbd01eaab20a7e0e6147382647c11525334382d198df0d3d45da6102b541efda5a1361f96271c98d5d89d
2019-04-15 17:05:42 -04:00
MarcoFalke fa46ac3127
bench: Add wallet_balance benchmarks 2019-04-15 16:49:34 -04:00
r8921039 2d8ba4f867 remove out-of-date comment on pay-to-witness support 2019-04-15 09:15:25 -07:00
MarcoFalke 78295e97b8
Merge #15788: test: Unify testing setups for fuzz, bench, and unit tests
faf400077d scripted-diff: Bump copyright headers in test, bench (MarcoFalke)
fa821904bf scripted-diff: Rename test_bitcoin to test/setup_common (MarcoFalke)
fa8685d49e test: Use test_bitcoin setup in bench, Add test utils (MarcoFalke)
666696b673 test: Have segwit always active in (Basic)TestingSetup (MarcoFalke)

Pull request description:

  Now that the fuzz tests can use the BasicTestingSetup [1], do the same for bench.

  Also move some duplicate code to a common "test/util" module.

  [1]:  fuzz: Link BasicTestingSetup (shared with unit tests) #15504

ACKs for commit faf400:
  jonatack:
    ACK faf400077d

Tree-SHA512: 8ac5692e72cf50e460958f291643ae6b8bb04d5c1331ed50dce9eb4e9457e5a925144c532c42b360a26707e11eeece74aab27db8c76ab9a429b9dd7167e7cdc4
2019-04-15 11:28:25 -04:00
MarcoFalke 2a854a1781
Merge #15750: [rpc] Remove the addresses field from the getaddressinfo return object
b4338c151d [rpc] Remove the addresses field from the getaddressinfo return object (John Newbery)

Pull request description:

  The "addresses" field was confusing because it refered to public keys
  using their P2PKH address.  It was included in the return object when
  needed for backward compatibility. Remove that compatibility now that
  the -deprecatedrpc=validateaddress option has been removed.

  New applications should use the 'embedded'->'address' field for P2SH or
  P2WSH wrapped addresses, and 'pubkeys' for inspecting multisig
  participants.

ACKs for commit b4338c:
  jonatack:
    ACK b4338c151d. Tests [gist](https://gist.github.com/jonatack/31915e290bb1be39b9769dc9357385ca).

Tree-SHA512: 2c207510e565df600428838bfc6db5211fa06aaace365e31cbd74f1d2376b598675cb90df2fc1440858d49b22095aaa9d6b9ce3de0aff22417fe72cc6a6a321f
2019-04-15 11:09:18 -04:00
Wladimir J. van der Laan 0c6487c74f
Merge #15751: Speed up deriveaddresses for large ranges
41a46cbb31 Speed up deriveaddresses for large ranges (Pieter Wuille)

Pull request description:

  `deriveaddresses` dumps all generated addresses into a single `FlatSigningProvider`, which is also used for looking up information for future derivations. @achow101 points out that the growing data structures may unnecessary increase lookup time for later derivations.

  Fix this by separating the provider used for lookups (`key_provider`) and the one we dump things into.

  This gives a 10x speedup for a range of 7000 elements, and probably a larger speedup for larger ranges.

ACKs for commit 41a46c:
  achow101:
    Regardless, I do think this is a good change, so utACK 41a46cbb31
  fanquake:
    tACK 41a46cb
  meshcollider:
    utACK 41a46cbb31

Tree-SHA512: a1b894ce9d5195d8f9760f44acc6d67a90bb259283fd8c1524c38a222fe53e8c1d35b6653a508b121b7ad91e155c97d26c658f6bdcebf6c360546931e4a26a22
2019-04-15 13:52:17 +02:00
MeshCollider 4f4ef3138b
Merge #15557: Enhance bumpfee to include inputs when targeting a feerate
184f8785f wallet_bumpfee.py: add test for change key preservation (Gregory Sanders)
d08becff8 add functional tests for feerate bumpfee with adding inputs (Gregory Sanders)
0ea47ba7b generalize bumpfee to add inputs when needed (Gregory Sanders)

Pull request description:

  When targeting a feerate using `bumpfee`, call a new function that directly uses `CWallet::CreateTransaction` and coin control to get the desired result. This allows us to get a superset of previous behavior, with an arbitrary RBF bump of a transaction provided it passes the preconditional checks and spare confirmed utxos are available.

  Note(s):
  0) The coin selection will use knapsack solver for the residual selection.
  1) This functionality, just like knapsack coin selection in general, will hoover up negative-value inputs when given the chance.
  2) Newly added inputs must be confirmed due to current Core policy. See error: `replacement-adds-unconfirmed`
  3) Supporting this with `totalFee` is difficult since the "minimum total fee" option in `CreateTransaction` logic was (rightly)taken out in #10390 .

ACKs for commit 184f87:
  jnewbery:
    utACK 184f8785f7

Tree-SHA512: fb6542bdfb2c6010e328ec475cf9dcbff4eb2b1a1b27f78010214534908987a5635797196fa05edddffcbcf2987335872dc644a99261886d5cbb34a8f262ad3e
2019-04-15 08:39:50 +12:00
John Newbery ef2d515af3 [wallet] move-only: move CReserveKey to be next to CKeyPool
reviewer tip: use git diff --color-moved=dimmed-zebra
2019-04-14 09:32:40 -04:00
MeshCollider adc55dbac5
Merge #15748: [rpc] remove dead mining code
1b46a4889 [cleanup] Remove unused CReserveKey (John Newbery)
9819ad6d0 [rpc] simplify generate RPC (John Newbery)

Pull request description:

  Removes dead code from after the generate method was removed

ACKs for commit 1b46a4:
  MarcoFalke:
    utACK 1b46a4889f
  meshcollider:
    utACK 1b46a4889f
  scravy:
    utACK 1b46a48
  Empact:
    utACK 1b46a4889f

Tree-SHA512: d1fab1bf76ac3036b85cf33be89868bc016f912575545ecaa16f958397b0ec4f1ce4de8fe254d4f21aabeea9c83a8928530cc520de26af0d1a8bdb4ca0f2cb77
2019-04-14 16:09:05 +12:00
Ben Woosley 510c6532ba
Extract ParseDescriptorRange
So as to be consistently informative when the checks fail, and
to protect against unintentional divergence among the checks.
2019-04-13 18:52:11 -07:00
Luke Dashjr 8a33f4d63f GUI: Options: Remove the upper-bound limit from pruning size setting
Hypothetically, someone may wish to begin pruning at a future blockchain size, and there's no reason to limit it lower
2019-04-11 23:44:48 +00:00
Luke Dashjr 4ddeb2f860 GUI: Options: Set the range of pruning size before loading its value
Without this, an out-of-default-range value gets limited to the range
2019-04-11 23:42:26 +00:00
John Newbery b4338c151d [rpc] Remove the addresses field from the getaddressinfo return object
The "addresses" field was confusing because it refered to public keys
using their P2PKH address.  It was included in the return object when
needed for backward compatibility. Remove that compatibility now that
the -deprecatedrpc=validateaddress option has been removed.

New applications should use the 'embedded'->'address' field for P2SH or
P2WSH wrapped addresses, and 'pubkeys' for inspecting multisig
participants.
2019-04-11 15:10:53 -04:00
MarcoFalke faf400077d
scripted-diff: Bump copyright headers in test, bench
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./src/bench/
./contrib/devtools/copyright_header.py update ./src/test/
-END VERIFY SCRIPT-
2019-04-11 13:34:43 -04:00
MarcoFalke fa821904bf
scripted-diff: Rename test_bitcoin to test/setup_common
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/test_bitcoin\.(h|cpp)/setup_common.\1/g' $(git grep -l test_bitcoin)
git mv ./src/test/test_bitcoin.h   ./src/test/setup_common.h
git mv ./src/test/test_bitcoin.cpp ./src/test/setup_common.cpp
sed -i -e 's/BITCOIN_TEST_TEST_BITCOIN_H/BITCOIN_TEST_SETUP_COMMON_H/g' ./src/test/setup_common.h
-END VERIFY SCRIPT-
2019-04-11 10:12:36 -04:00
Wladimir J. van der Laan bb68abe784
Merge #15718: docs: Improve netaddress comments
303372c41a docs: Improve netaddress comments (Carl Dong)

Pull request description:

  Improves comments for `netaddress`, making them available to Doxygen.

  I think this is worthwhile because a lot of the code require some context (e.g., A lot of the things that we do to fit hostnames and tor addresses into `CNetAddr` is non-obvious, and documenting it is beneficial).

ACKs for commit 303372:

Tree-SHA512: 2a35784a01ed8ec5fdbe111a540192d31bde16afa96e4be97b0385daf290fc7469a66d7cb8905a70b920fad6a0e7400ca4e5da082d6e4af1d1aaccc0e8297720
2019-04-11 16:02:54 +02:00
Wladimir J. van der Laan 570eb7b130
Merge #15782: Avoid redefine warning
0b3a65455a Avoid redefine warning (Peter Bushnell)

Pull request description:

  Wrap preprocessor definition of NOMINMAX in ifndef conditional to suppress warning when cross compiling Windows.

  `fs.cpp:6:0: warning: "NOMINMAX" redefined`
  `/usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/include/c++/x86_64-w64-mingw32/bits/os_defines.h:45:0: note: this is the location of the previous definition
   #define NOMINMAX 1`

  #define NOMINMAX was introduced in the following merge.

  https://github.com/bitcoin/bitcoin/pull/14426

ACKs for commit 0b3a65:
  practicalswift:
    utACK 0b3a65455a
  promag:
    utACK 0b3a654.

Tree-SHA512: 0175195b88e63d3d44ffac2b8cc87ae7b285a45ed4e49605bca0cc82db073006c22024ef9c2f287980d357dac1099f798f1eeaa0bd75bb7a625919dc1632366c
2019-04-11 15:57:13 +02:00
Gregory Sanders 0ea47ba7b3 generalize bumpfee to add inputs when needed 2019-04-11 07:21:49 -04:00
MeshCollider c536dfbcb0
Merge #15639: bitcoin-wallet tool: Drop libbitcoin_server.a dependency
78a2fb55c bitcoin-wallet tool: Drop libbitcoin_server.a dependency (Russell Yanofsky)
b874747b5 Remove access to node globals from wallet-linked code (Russell Yanofsky)
fbc6bb8e8 bitcoin-wallet tool: Drop MakeChain calls (Russell Yanofsky)

Pull request description:

  Dropping the `bitcoin-wallet` dependency on `libbitcoin_server.a` ensures wallet code can't access node global state, avoiding bugs like https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431

ACKs for commit 78a2fb:
  jnewbery:
    utACK 78a2fb55c9. Nice work, Russ.
  MarcoFalke:
    utACK 78a2fb5
  MeshCollider:
    utACK 78a2fb55c9

Tree-SHA512: ee6ea774f683b936bea66638211dd53c42b8316e1ef03dd58d12fb7ee3891432a43c5c149944173c1e2436aa756b672e1679c39fc10043792ac55cd4d8af2823
2019-04-11 21:29:59 +12:00
MeshCollider f6120d40d5
Merge #15728: [wallet] Refactor relay transactions
7a9046e48 [wallet] Refactor CWalletTx::RelayWalletTransaction() (John Newbery)

Pull request description:

  Refactor `CWalletTx::RelayWalletTransaction()` function.

  This was a suggestion from the wallet-node separation PR: https://github.com/bitcoin/bitcoin/pull/15288#discussion_r256036330, which we deferred until after the main PR was merged.

  There are also makes two minor behavior changes:

  - no longer assert if fBroadcastTransactions is false. Just return false from the function.
  - no longer print the relay message if p2pEnabled is set to false (since the transaction is not actually relayed).

ACKs for commit 7a9046:
  promag:
    utACK 7a9046e48d.
  MeshCollider:
    utACK 7a9046e48d
  ryanofsky:
    utACK 7a9046e48d. No changes at all, just rebase after base PR #15632 was merged

Tree-SHA512: 2ae6214cfadd917a1b3a892c4277e5e57c3eb791e17f67511470e6fbc634d19356554b9f9c55af6b779fdef821914aad59b7cc9e6c13ece145df003bf507d486
2019-04-11 21:25:07 +12:00
MarcoFalke fa8685d49e
test: Use test_bitcoin setup in bench, Add test utils 2019-04-10 15:59:11 -04:00
MarcoFalke 666696b673
test: Have segwit always active in (Basic)TestingSetup 2019-04-10 15:57:48 -04:00
Carl Dong 303372c41a docs: Improve netaddress comments
- Improve IsRFC methods docs
- Improve {Is,Set}Internal docs
- Add tor methods docs
- Add IsIPv{4,6} docs
- Add IsValid docs
- Add IsRoutable docs
- Improve GetGroup docs
- Add CService::GetSockAddr docs
- Add CService::GetKey docs
- Add CSubNet::Match docs
- Add NetmaskBits docs
- Add CNetAddr default constructor docs
2019-04-10 11:48:47 -04:00
John Newbery 1b46a4889f [cleanup] Remove unused CReserveKey 2019-04-10 11:44:40 -04:00
John Newbery 9819ad6d07 [rpc] simplify generate RPC
Removes dead code from after the generate method was removed
2019-04-10 11:44:37 -04:00
Russell Yanofsky 78a2fb55c9 bitcoin-wallet tool: Drop libbitcoin_server.a dependency
This ensures wallet code doesn't access node global state, avoiding bugs like
https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431
2019-04-10 09:51:37 -04:00
Wladimir J. van der Laan 6a135fbe5b
Merge #15638: Move-only: Pull wallet code out of libbitcoin_server
4d074e84a2 [build] Move AnalyzePSBT from psbt.cpp to node/psbt.cpp (Russell Yanofsky)
fd509bd1f7 [docs] Document src subdirectories and different libraries (John Newbery)
9eaeb7fb8d [build] Move wallet load functions to wallet/load unit (John Newbery)
91a25d1e71 [build] Add several util units (John Newbery)
99517866b6 [build] Move several units into common libraries (John Newbery)
0509465542 [build] Move rpc rawtransaction util functions to rpc/rawtransaction_util.cpp (John Newbery)
1acc61f874 [build] Move rpc utility methods to rpc/util (John Newbery)
4a75c9d651 [build] Move policy settings to new src/policy/settings unit (John Newbery)
fdf8888b6f [build] Move CheckTransaction from lib_server to lib_consensus (John Newbery)

Pull request description:

  This is a move-only commit. No code is changing and the moves can be easily verified with:

  ```sh
  git log -p -n1 --color-moved=dimmed_zebra
  ```

  This commit moves functions and variables that wallet code depends on out of libbitcoin_server.a, so the bitcoin-wallet tool can be built without libbitcoin_server.a in #15639, and attempting to access server state from wallet code will result in link errors instead of silently broken code.

  List of moves:

  - `CheckTransaction` moves from `consensus/tx_verify.cpp` to `consensus/tx_check.cpp`
  - `urlDecode` moves from `httpserver.cpp` to `util/url.cpp`
  - `TransactionErrorString` moves from `node/transaction.cpp` to `util/error.cpp`
  - `StringForFeeReason` and `FeeModeFromString` move from `policy/fees.cpp` to `util/fees.cpp`
  - `incrementalRelayFee` `dustRelayFee` and `nBytesPerSigOp` move from `policy/policy.cpp` to `policy/settings.cpp`
  - `SignalsOptInRBF` moves from `policy/rbf.cpp` to `util/rbf.cpp`
  - `fIsBareMultisigStd` moves from `validation.cpp` to `policy/settings.cpp`
  - `ConstructTransaction` `TxInErrorToJSON` and `SignTransaction` move from `rpc/rawtransaction.cpp` to `rpc/rawtransaction_util.cpp`
  - `RPCTypeCheck` `RPCTypeCheckArgument` `RPCTypeCheckObj` `AmountFromValue` `ParseHashV``ParseHashO` `ParseHexV` `ParseHexO` `HelpExampleCli` and `HelpExampleRpc` move from `rpc/server.cpp` to `rpc/util.cpp`
  - `AmountHighWarn` and `AmountErrMsg` move from `ui_interface.cpp` to `util/error.cpp`
  - `FormatStateMessage` and `strMessageMagic` move from `validation.cpp` to `util/validation.cpp`
  - `VerifyWallets` `LoadWallets` `StartWallets` `FlushWallets` `StopWallets` and `UnloadWallets` move from `wallet/init.cpp` to `wallet/node.cpp`

ACKs for commit 4d074e:
  jnewbery:
    utACK 4d074e84a2 (checked by doing the rebase myself and verifying no difference between my branch and 4d074e84a2)

Tree-SHA512: 5e1604a9fb06475f2b96da0de0baa8330f4dda834dc20a0183ef11e1e4c27631d1d1bbb9abf0054efc03d56945fdf9920f63366b6a4f200f665b742a479ff75c
2019-04-10 15:51:37 +02:00
Russell Yanofsky b874747b51 Remove access to node globals from wallet-linked code
Remove last few instances of accesses to node global variables from wallet
code. Also remove accesses to node globals from code in policy/policy.cpp that
isn't actually called by wallet code, but does get linked into wallet code.

This is the last change needed to allow bitcoin-wallet tool to be linked
without depending on libbitcoin_server.a, to ensure wallet code doesn't access
node global state and avoid bugs like
https://github.com/bitcoin/bitcoin/pull/15557#discussion_r267735431
2019-04-10 09:51:37 -04:00
Russell Yanofsky fbc6bb8e83 bitcoin-wallet tool: Drop MakeChain calls
Pass null Chain interface pointer to CWallet. This is needed to drop
libbitcoin_server dependency and avoid linking node code.
2019-04-10 09:51:37 -04:00
MarcoFalke e3a0688f82
Merge #15659: [docs] fix findFork comment
c968780785 [docs] fix comment: the return value of findFork is _not_ an ancestor when the specified block is on the active chain (r8921039)

Pull request description:

  The return value of findFork is an ancestor of the specified block only when specified block is _not_ on the active chain. When it is on the active chain, the return value is the specified block itself, not an ancestor of it.

ACKs for commit c96878:
  promag:
    utACK c968780, however comment could be shorter.
  ryanofsky:
    utACK c968780785. Only change since last review is squash

Tree-SHA512: bb05d734059898784c4a59b5b0344719eb4dfb2d49a0f7f705fcb2eb630702e66be81c01299185faf0c219fa9f9aa64cbdf6d5f91e0b3dce0ff420909a454a18
2019-04-10 09:34:02 -04:00
MarcoFalke e82f6ad6f2
Merge #15754: rpc: getrpcinfo docs
f4b7a2f205 rpc: getrpcinfo docs (Ben Carman)

Pull request description:

  Fixes #15731

ACKs for commit f4b7a2:
  laanwj:
    utACK f4b7a2f205

Tree-SHA512: 45dce83c4bfac2ddf85133a29aee332e9de8f73c15438ce899a2edbcd0d82d4f743753f6699c50cbc62d110fa8c6bc257722447e1090cdd23acbe00f26014ec8
2019-04-10 09:24:22 -04:00
John Newbery 7a9046e48d [wallet] Refactor CWalletTx::RelayWalletTransaction()
This refactors the CWalletTx::RelayWalletTransaction() function to be
clearer and adds comments. It also makes two minor behavior
changes:

- no longer assert if fBroadcastTransactions is false. Just return false
from the function.
- no longer print the relay message if p2pEnabled is set to false (since
the transaction is not actually relayed).
2019-04-10 09:19:55 -04:00
Peter Bushnell 0b3a65455a Avoid redefine warning 2019-04-10 12:16:52 +01:00
MarcoFalke 8c022e8ac4
Merge #15746: rpc: RPCHelpMan: Always name dictionary keys
fa26eb5e8f rpc: RPCHelpMan: Always push_name when outer type is an object (MarcoFalke)
fa652b229e rpc: Add some doxygen comments to utils (MarcoFalke)

Pull request description:

  Fixes two issues reported in #15737:

  * > I am very perplexed as to how the code I'm looking at is generating the help text I'm seeing

  So add documentation

  * > This is a value for which a key is missing

  So always serialize the name of the dictionary key if the outer type is a dictionary

ACKs for commit fa26eb:
  promag:
    Tested ACK fa26eb5.

Tree-SHA512: b6f0cee1f1123d245d4902e8e113b5260cae7f2cb39c9bfb8893c5b0b33ffb6349ad05813d560d39a94ccf655399c05fcda15d9b0733e6bd696538fe0aca7021
2019-04-09 21:20:48 -04:00
MarcoFalke 5392aee64f
Merge #15629: init: Throw error when network specific config is ignored
fae38c3dc6 doc: Fix all typos reported by codespell (MarcoFalke)
fa9058f0ed doc: Add release notes for 15629 (MarcoFalke)
fa4a922d78 qa: Add test for missing testnet section in conf file (MarcoFalke)
dddd6f0f58 init: Throw error when network specific config is ignored (MarcoFalke)

Pull request description:

  This should have no effect on mainnet users, but simplifies testing, where config settings are currently ignored with only a warning. Fix this by making it an error.

  Issues:
  *  bitcoin client 0.17.0 ignores wallet's name (file) #14523
  *  Can't set custom rpcport on testnet #13777
  * ...

ACKs for commit fae38c:

Tree-SHA512: 2e209526898eea6e444c803ec2666989cee4ca137492d32984998733c50a70056cb54657df8dc3027a6a0612738a8afce0bc35824b868c5f22281e00e0188530
2019-04-09 21:14:49 -04:00
Russell Yanofsky 4d074e84a2 [build] Move AnalyzePSBT from psbt.cpp to node/psbt.cpp
psbt.cpp definitions except for AnalyzePSBT are used by the wallet and need to
be linked into the wallet binary. AnalyzePSBT is an exception in that it is not
used by the wallet, and depends on node classes like CCoinsViewCache, and on
node global variables like nBytesPerSigOp.

So AnalyzePSBT is more at home in libbitcoin_server than libbitcoin_common, and
in any case needs to be defined in a separate object file than other PSBT
utilities, to avoid dragging link dependencies on node functions and global
variables into the wallet.
2019-04-09 17:53:08 -04:00
John Newbery fd509bd1f7 [docs] Document src subdirectories and different libraries 2019-04-09 17:53:08 -04:00
John Newbery 9eaeb7fb8d [build] Move wallet load functions to wallet/load unit
Moves the following wallet load functions to a new wallet/load unit in
the libbitcoin_wallet library. All other functions in wallet/init remain
in libbitcoin_server:

- `VerifyWallets`
- `LoadWallets`
- `StartWallets`
- `FlushWallets`
- `StopWallets`
- `UnloadWallets`
2019-04-09 17:53:08 -04:00
John Newbery 91a25d1e71 [build] Add several util units
Adds the following util units and adds them to libbitcoin_util:

- `util/url.cpp` takes `urlDecode` from `httpserver.cpp`
- `util/error.cpp` takes `TransactionErrorString` from
  `node/transaction.cpp` and `AmountHighWarn` and `AmountErrMsg` from
  `ui_interface.cpp`
- `util/fees.cpp` takes `StringForFeeReason` and `FeeModeFromString` from `policy/fees.cpp`
- `util/rbf.cpp` takes `SignalsOptInRBF` from `policy/rbf.cpp`
- 'util/validation.cpp` takes `FormatStateMessage` and `strMessageMagic` from 'validation.cpp`
2019-04-09 17:53:08 -04:00
John Newbery 99517866b6 [build] Move several units into common libraries
Moves the following units into libbitcoin_util or libbitcoin_common
since they are required by multiple libraries:

- bloom
- interfaces/handler
- merkleblock
- outputtype
2019-04-09 17:53:08 -04:00
John Newbery 0509465542 [build] Move rpc rawtransaction util functions to rpc/rawtransaction_util.cpp
rpc/rawtransaction.cpp moves to libbitcoin_server since it should not be
accessed by non-node libraries. The utility following utility methods
move to their own unit rpc/rawtransaction_util since they need to be
accessed by non-node libraries:

- `ConstructTransaction`
- `TxInErrorToJSON`
- `SignTransaction`
2019-04-09 17:53:08 -04:00