Commit graph

24670 commits

Author SHA1 Message Date
Peter Bushnell e12e970df6
docs: match usage text to script and location
Update the usage text in the README to match the usage text in the Python script.

02b26ba1c1/contrib/testgen/gen_key_io_test_vectors.py (L9)

Also to match the file names in the actual destination.

02b26ba1c1/src/test/data/key_io_valid.json
02b26ba1c1/src/test/data/key_io_invalid.json

Following the README usage text generates new files when the user is likely to have wanted to update the existing files.
2020-06-21 10:31:18 +01:00
Samuel Dobson 02b26ba1c1
Merge #19200: rpc: remove deprecated getaddressinfo fields
bc01f7ae05 doc: release note for rpc getaddressinfo removals (Jon Atack)
90e989390e rpc: getaddressinfo RPCResult fixup (Jon Atack)
a8507c99da rpc: remove deprecated getaddressinfo `labels: purpose` (Jon Atack)
645a8653c8 rpc: remove deprecated getaddressinfo `label` field (Jon Atack)

Pull request description:

  These were deprecated in #17578 and #17585, with expected 0.21 removal notified in the 0.20 release notes.
  ```
  - The `getaddressinfo` RPC has had its `label` field deprecated
    (re-enable for this release using the configuration parameter
    `-deprecatedrpc=label`).  The `labels` field is altered from returning
    JSON objects to returning a JSON array of label names (re-enable
    previous behavior for this release using the configuration parameter
    `-deprecatedrpc=labelspurpose`).  Backwards compatibility using the
    deprecated configuration parameters is expected to be dropped in the
    0.21 release.  (#17585, #17578)
  ```

ACKs for top commit:
  Sjors:
    utACK bc01f7a
  adamjonas:
    utACK bc01f7a
  meshcollider:
    utACK bc01f7ae05

Tree-SHA512: ae1af381e32c4c3bde8b061a56382838513a9a82c88767843cdeae3a2ab8aa7d8c2e66e106d2b31ea07d74bb80c191a2f842c9aaecc7c5438ad9a9bc66d1b251
2020-06-21 21:07:00 +12:00
Samuel Dobson 6bb5f6d8e3
Merge #16377: [rpc] don't automatically append inputs in walletcreatefundedpsbt
e5327f947c [rpc] fundrawtransaction: add_inputs option to control automatic input adding (Sjors Provoost)
79804fe24b [rpc] walletcreatefundedpsbt: don't automatically append inputs (Sjors Provoost)

Pull request description:

  When the user doesn't specificy inputs, it makes sense to automatically select them. But when the user does specify inputs, `walletcreatefundedpsbt` now fails if the amount is insufficient, unless `addInputs` is set to `true`.

  Similarly for `fundrawtransaction` if the original transaction already specified inputs, we only add more if `addInputs` is set to `true`.

  This protects against fat finger mistakes in the amount or fee rate (see also #16257). The behavior is also more similar to GUI coin selection.

ACKs for top commit:
  achow101:
    ACK e5327f947c
  meshcollider:
    utACK e5327f947c

Tree-SHA512: d8653b820914396c7c25b0d0a2b7e92de214aa023bc1aa085feb37d3b20fab361ebea90416a7db989f19bdc37e26cf0adfbcb712c80985c87afa67a9bd44fecb
2020-06-21 20:52:34 +12:00
Samuel Dobson bd331bd745
Merge #17938: Disallow automatic conversion between disparate hash types
4d7369125a Disallow automatic conversion between hash types (Ben Woosley)
fa9ef2cdbe Remove an apparently unnecessary conversion (Ben Woosley)
966a22d859 Explicitly support conversion between equivalent hash types (Ben Woosley)
f32c1e07fd Use explicit conversion from WitnessV0KeyHash -> CKeyID (Ben Woosley)
2c54217f91 Use explicit conversion from PKHash -> CKeyID (Ben Woosley)
a9e451f144 Convert CPubKey to WitnessV0KeyHash directly (Ben Woosley)
3fcc468123 Prefer explicit CScriptID construction (Ben Woosley)
0a5ea32ce6 Prefer explicit uint160 conversion (Ben Woosley)

Pull request description:

  This bases the script/standard hash types, TxDestination-related and CScriptID on a base template which does not silently convert the underlying `uintN` type.

  Inspired by and built on #17924. Commits are small and focused to ease review.

  Note some of these changes may be relative to existing bugs of the same sort as #17924. See particularly "Convert CPubKey to WitnessV0KeyHash directly" and "Remove an apparently unnecessary conversion".

ACKs for top commit:
  achow101:
    ACK 4d7369125a
  meshcollider:
    re-utACK 4d7369125a

Tree-SHA512: f1b3284ddc6fb6c6e726f2c22668b6d732d45eb5418262ed2b9c728f60be7be43dfb414b6ddd9915025c8dcd7f360dc3b46e997a945a2feb95b0e5c4f05d6b54
2020-06-21 20:26:59 +12:00
MarcoFalke 879acc681a
Merge #19018: docs: fixing description of the field sequence in walletcreatefundedpsbt RPC method
d0a3feea73 Change docs for walletcreatefundedpsbt RPC method (Ivan Vershigora)

Pull request description:

  `sequence` field in the list of inputs currently marked as "required". Actually it can be omitted and it's value depends on `locktime` and `options.replaceable` fields. Just the same as in `createpsbt` call.

ACKs for top commit:
  achow101:
    ACK d0a3feea73

Tree-SHA512: 3f429a2c2eea283a47fb5002a99f7e2a5ed6f67df9fd895c1ab938256c48a6497ed6ac2673d8fe8968dfb67b939f4a84570899d9faf52f3abd6ec90c0703d1bd
2020-06-20 07:30:24 -04:00
MarcoFalke d4f9ae0025
Merge #19054: wallet: Skip hdKeypath of 'm' when determining inactive hd seeds
951bca61d7 tests: feature_backwards_compatibility.py test 0.16 up/downgrade (Andrew Chow)
3a03a11e8c Skip hdKeypath of 'm' (Andrew Chow)

Pull request description:

  Previously the seed was stored with keypath 'm' so we need to skip this as well when determining inactive seeds.

  Fixes #19051

ACKs for top commit:
  Sjors:
    ACK 951bca61d7
  instagibbs:
    re-utACK 951bca61d7
  ryanofsky:
    Code review ACK 951bca61d7. No significant changes since last review, just updated comment and some test tweaks

Tree-SHA512: 930f77e7097c9cf4f1012e540bd2b1a72fd279262517f10c1531b2ad48c632ef95e0dd4edea81bcc3b3db306479d34e5e79e5d6c4ed31dfa4b77a4231436436e
2020-06-19 16:14:47 -04:00
Ben Woosley 4d7369125a
Disallow automatic conversion between hash types
A templated BaseHash does not allow for automatic conversion, thus
conversions much be explicitly allowed / whitelisted, which will
reduce the risk of unintended conversions.
2020-06-19 12:14:08 -07:00
Ben Woosley fa9ef2cdbe
Remove an apparently unnecessary conversion
CScript -> CScriptID -> ScriptHash is unnecessary because
ScriptHash and CScriptID do the same thing.
2020-06-19 12:14:08 -07:00
Ben Woosley 966a22d859
Explicitly support conversion between equivalent hash types
ScriptHash <-> CScriptID
CKeyID -> PKHash
PKHash -> WitnessV0KeyHash
2020-06-19 12:14:08 -07:00
Ben Woosley f32c1e07fd
Use explicit conversion from WitnessV0KeyHash -> CKeyID
These types are equivalent, in data etc, so they need only their
data cast across.
2020-06-19 12:14:08 -07:00
Ben Woosley 2c54217f91
Use explicit conversion from PKHash -> CKeyID
These types are equivalent, in data etc, so they need only their
data cast across.

Note a function is used rather than a casting
operator as CKeyID is defined at a lower level than script/standard
2020-06-19 12:14:07 -07:00
Ben Woosley a9e451f144
Convert CPubKey to WitnessV0KeyHash directly
The round-tripping through PKHash has no effect, and is
potentially misleading as such.
2020-06-19 12:14:07 -07:00
Ben Woosley 3fcc468123
Prefer explicit CScriptID construction 2020-06-19 12:14:07 -07:00
Ben Woosley 0a5ea32ce6
Prefer explicit uint160 conversion 2020-06-19 12:14:06 -07:00
MarcoFalke f3d776b593
Merge #19309: refactor: Fix link error with --enable-debug
b83cc0fc94 Fix link error with --enable-debug (Hennadii Stepanov)

Pull request description:

  Fixes a link error on master (39bd9ddb87):
  ```
  $ ./configure --enable-debug
  $ make
  ...
  bitcoin_wallet-bitcoin-wallet.o:(.data.rel.ro+0x0): undefined reference to `InitError(bilingual_str const&)'
  libbitcoin_wallet_tool.a(libbitcoin_wallet_tool_a-wallettool.o):(.data.rel.ro+0x8): undefined reference to `InitError(bilingual_str const&)'
  libbitcoin_wallet.a(libbitcoin_wallet_a-salvage.o):(.data.rel.ro+0x8): undefined reference to `InitError(bilingual_str const&)'
  libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o):(.data.rel.ro+0x8): undefined reference to `InitError(bilingual_str const&)'
  libbitcoin_wallet.a(libbitcoin_wallet_a-walletdb.o):(.data.rel.ro+0x8): undefined reference to `InitError(bilingual_str const&)'
  libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o):(.data.rel.ro+0x8): more undefined references to `InitError(bilingual_str const&)' follow
  collect2: error: ld returned 1 exit status
  ```

  See:
  - https://github.com/bitcoin/bitcoin/pull/19295#issuecomment-645471771
  - https://github.com/bitcoin/bitcoin/pull/19295#issuecomment-645487182

ACKs for top commit:
  achow101:
    Re-ACK b83cc0fc94

Tree-SHA512: f563d978b6725284049449bb0b3a184d356f32e9b63bcadb0ba71352d3d521af3dbb4a7b4fc0a5a620ed99c357e59f62249c10d0defc0cbe7775f2c06791dabe
2020-06-19 14:38:13 -04:00
MarcoFalke 6dc1b45087
Merge #19267: ci: Upgrade most ci configs to focal
fa05f44893 ci: Upgrade most ci configs to focal (MarcoFalke)
fad6720891 doc: move doc to ci readme (MarcoFalke)
fa880773b4 ci: Have one config run in xenial to test against python3.5 (MarcoFalke)
fa6ddb2fa1 travis: Always run multiprocess build (MarcoFalke)

Pull request description:

  Generally developers compile with recent compilers, so bumping the ci configs to a recent OS should be uncontroversial. Older OSes (especially with compiler sanitizers) need workarounds that can be dropped by running on a more recent OS.

  This pull changes the asan sanitizer and the experimental multiprocess build to use focal.
  Also, it runs the no_wallet config on xenial to test against python 3.5, according to `doc/dependencies.md`.

  Finally, all configs that mimic gitian (win and mac) will stay at bionic.

ACKs for top commit:
  Sjors:
    ACK fa05f44893, assuming Travis passes
  hebasto:
    ACK fa05f44893

Tree-SHA512: 55ec56c71ba2280d27c1a8856a1e6c310b1fbf469d5a8a1dde228063e3892e1dd1e51408ecff7a3d77ac2ae018daa9e9bbbb60598cdeaab8c32a146b11b3e7c4
2020-06-19 12:53:23 -04:00
MarcoFalke fa05f44893
ci: Upgrade most ci configs to focal 2020-06-19 10:44:11 -04:00
MarcoFalke fad6720891
doc: move doc to ci readme 2020-06-19 10:44:00 -04:00
MarcoFalke fa880773b4
ci: Have one config run in xenial to test against python3.5
Also, bump the travis env to bionic. This shouldn't matter at all
because all ci configs run inside a docker, but it does seem to fix a
bug. See
https://github.com/bitcoin/bitcoin/pull/19267#issuecomment-643630309
2020-06-19 10:43:21 -04:00
MarcoFalke fa6ddb2fa1
travis: Always run multiprocess build 2020-06-19 10:31:49 -04:00
MarcoFalke febe5823b4
Merge #19321: ci: Run asan ci config on cirrus
fa2eb3d5d6 ci: Run asan ci config on cirrus (MarcoFalke)
fa93527738 cirrus: Clear dummy task (MarcoFalke)

Pull request description:

  Currently it is not possible to use travis in forked repositories due to the 50 minute limit on builds. A fresh build (uncached) of the address sanitizer config takes more than 50 minutes.

  One approach to fix this could be to throw away tests until the run time is less than 50 minutes. However, the risk of being blind of failures in the thrown away tests is not worth the gain. Also, to detect them, one has to run the asan configuration nightly and failures could only be detected post-merge.

  Another approach would be to ask travis support to raise the limit for a forked repository. This is a tedious and manual one-by-one process, so I'd rather not.

  Finally, a different ci provider can be used, since the config files are designed to be platform-agnostic. This is what I picked.

  I kept all settings identical to the travis machine for now. Both providers run in the google cloud, so this should be a "move-only".

ACKs for top commit:
  hebasto:
    ACK fa2eb3d5d6

Tree-SHA512: 159d7dc6f5b24583e941282cdd40465b15db787f0a658a3e81a7b1a22abdb4cb573709b9b5c4465523e0ba0060b17a68fbdbda7a9ecdeb649f31535d377bbe75
2020-06-19 10:26:37 -04:00
MarcoFalke 5f72ddb7ee
Merge #18863: refactor: Make CScriptVisitor stateless
3351c91ed4 refactor: Make CScriptVisitor stateless (João Barbosa)

Pull request description:

  `CScriptVisitor` was added in 1025440184 (#1357) and the visitor return type was never used. Now `CScriptVisitor` is stateless and `CScript` is the return type.

ACKs for top commit:
  MarcoFalke:
    ACK 3351c91ed4 🏤
  sipa:
    utACK 3351c91ed4

Tree-SHA512: d158ad2ebe8ea4dc8cc090b943dd66fa5421a84f9443e16ab2d661df38e1a85de16ff13cbaa56924489d8d43cba25fa3cd8b6904bbbcbf356b886ffe8ffba19a
2020-06-19 07:52:49 -04:00
MarcoFalke 62948caf44
Merge #18937: refactor: s/command/msg_type/ in CNetMsgMaker and CSerializedNetMsg
51e9393c1f refactor: s/command/msg_type/ in CNetMsgMaker and CSerializedNetMsg (Sebastian Falbesoner)

Pull request description:

  Follow-up PR for #18533 -- another small step towards getting rid of the confusing "command" terminology. Also see PR #18610 which tackled the functional tests.

ACKs for top commit:
  MarcoFalke:
    ACK 51e9393c1f

Tree-SHA512: bb6f05a7be6823d5c4eab1d05b31fee944e700946827ad9425d59a3957fd879776c88c606319cbe9832d9451b275baedf913b71429ea3e01e4e82bf2d419e819
2020-06-19 06:54:24 -04:00
fanquake c940c1ad85
Merge #19293: net: Avoid redundant and confusing FAILED log
fa1904e5f0 net: Remove dead logging code (MarcoFalke)
fac12ebf4f net: Avoid redundant and confusing FAILED log (MarcoFalke)

Pull request description:

  Remove a redundant and confusing "FAILED" log message and gets rid of the unused return type in `ProcessMessage`

ACKs for top commit:
  jnewbery:
    utACK fa1904e5f0
  gzhao408:
    utACK fa1904e5f0
  troygiorshev:
    ACK fa1904e5f0
  naumenkogs:
    utACK fa1904e

Tree-SHA512: bfa553d5efa022727ed17877fb7c08c14849d804fe6d6a7ce172d513857beba35de41ea40b27ff1aedf68b81e2cda7b2a948ac985fcaaf1b6cfb96cce4837c90
2020-06-19 17:17:29 +08:00
fanquake 0101110f9b
Merge #19322: [net] split PushInventory()
f52d403b81 [net] split PushInventory() (John Newbery)

Pull request description:

  PushInventory() is currently called with a CInv object, which can be a
  MSG_TX or MSG_BLOCK. PushInventory() only uses the type to determine
  whether to add the hash to setInventoryTxToSend or
  vInventoryBlockToSend.

  Since the caller always knows what type of inventory they're pushing,
  the CInv is wastefully constructed and thrown away, and tx/block relay
  is being split out, we split the function into PushTxInventory() and
  PushBlockInventory().

ACKs for top commit:
  amitiuttarwar:
    utACK f52d403b81. nice cleanup, this has bothered me :)
  naumenkogs:
    utACK f52d403
  sipa:
    utACK f52d403b81

Tree-SHA512: 331495199a3b1a2620e6a62beb336e494291b725d8fd64bb44726c02e80807f3974ff4f329bb0f059088e65cd7d41eff276c1065806d2dd6e72c5a9f368e82cd
2020-06-19 15:41:24 +08:00
fanquake 057bd3189f
Merge #19197: init: use std::thread for ThreadImport()
83fd3a6d73 init: use std::thread for ThreadImport() (fanquake)

Pull request description:

  [Mentioned](https://github.com/bitcoin/bitcoin/pull/19142#issuecomment-638090759) in #19142, which removed the `boost::interruption_point()`
  in `ThreadImport()`.

ACKs for top commit:
  hebasto:
    ACK 83fd3a6d73, I have reviewed the code and it looks OK, I agree it can be merged.
  donaloconnor:
    ACK 83fd3a6
  laanwj:
    Code review ACK 83fd3a6d73
  MarcoFalke:
    ACK 83fd3a6d73

Tree-SHA512: 0644947d669feb61eed3a944012dad1bd3dd75cf994aa2630013043c213a335b162b63e20aa37e0997740d8e3a3ec367b660b5196007a09e13f0ac455b36c821
2020-06-19 13:29:03 +08:00
MarcoFalke dbd7a91fdf
Merge #19310: wallet: BerkeleyDatabase make BerkeleyDatabase::Create, CreateMock, and CreateDummy non-static functions
da7a83c5ee Remove WalletDatabase::Create, CreateMock, and CreateDummy (Andrew Chow)
d6045d0ac6 scripted-diff: Replace WalletDatabase::Create* with CreateWalletDatabase (Andrew Chow)
45c08f8a7b Add Create*WalletDatabase functions (Andrew Chow)

Pull request description:

  Instead of having `Create`, `CreateMock`, and `CreateDummy` being static functions in `BerkeleyDatabase`, move these to standalone functions in `walletdb.cpp`. This prepares us for having different `WalletDatabase` classes.

  Part of #18971. This was originally one commit but has been split into 3 to make it (hopefully) easier to review.

ACKs for top commit:
  MarcoFalke:
    ACK da7a83c5ee 🎂
  ryanofsky:
    Code review ACK da7a83c5ee. Easy review, nice scripted-diff

Tree-SHA512: 1feb7cb3889168c555154bf3701a49095fd6b8cab911d44b7f7efbf6fcee2280ccb3d4afec8a83755b39a592ecd13b90a318faa655c321f87bdabdf1e2312327
2020-06-18 16:29:21 -04:00
John Newbery f52d403b81 [net] split PushInventory()
PushInventory() is currently called with a CInv object, which can be a
MSG_TX or MSG_BLOCK. PushInventory() only uses the type to determine
whether to add the hash to setInventoryTxToSend or
vInventoryBlockToSend.

Since the caller always knows what type of inventory they're pushing,
the CInv is wastefully constructed and thrown away, and tx/block relay
is being split out, we split the function into PushTxInventory() and
PushBlockInventory().
2020-06-18 15:45:48 -04:00
MarcoFalke fa2eb3d5d6
ci: Run asan ci config on cirrus 2020-06-18 14:33:54 -04:00
MarcoFalke fa93527738
cirrus: Clear dummy task 2020-06-18 14:33:31 -04:00
MarcoFalke c2bcb99c1d
Merge #19071: doc: Separate repository for the gui
66666d55b1 doc: Mention repo split in the READMEs (MarcoFalke)
faceed753a doc: Add redirect for GUI issues and pull requests (MarcoFalke)

Pull request description:

  ## 🥅 Goals

  Splitting up the GUI (and splitting out modules in general) has been brought up often in recent years. Now that the GUI is primarily connected through (internal) interfaces with the node, it seems an appropriate time to revive this discussion.

  Before looking for solutions, we should define a set of goals that we want to achieve. I will start with some ideas to get started and I hope that others will chime in to share and prioritize their goals.

  ### Separate issue and patch management

  It is currently not possible to subscribe to only a subset of modules in Bitcoin Core, or exclude modules from issue and patch notifications. While it is possible to reactively mute conversations in the stream of all ongoing discussions, there is no way to proactively achieve this. Moreover, the list of open issues and pull request will always include GUI related ones by default. Only with [filters](https://github.com/bitcoin/bitcoin/pulls?q=is%3Aopen+is%3Apr+-label%3AGUI) it is possible to hide them.

  ### More focused review and interests

  Long term goals of the GUI are partially unclear #17395 . Bitcoin Core developers are generally fluent on the command line. Thus, they might not be interested or motivated to review improvements to the GUI, which might not affect their workflow on the command line at all.  Splitting up the GUI will hopefully attract similar minded people to a project whose primary goal is to build and improve the GUI.

  ### Maintain high quality assurance

  The quality of the GUI (and even more importantly Bitcoin Core in general) must not degrade. This means that code review itself is not negatively affected by splitting the GUI, but also the integration of the GUI into the rest of Bitcoin Core. One issue could arise when arbitrary version-combinations are allowed. We are struggling hard to test against all supported versions of Boost. Making the GUI version another dimension is going to make testing impossible.

  ### The GUI *is* Bitcoin Core

  When a user downloads Bitcoin Core from our website (or another package manager) they expect the GUI to be included. This should not change (at least not as a result of splitting up the GUI into another project).

  Similarly, when building Bitcoin Core, the gui should still be built when `--with-gui` is specified.

  ## 🌳 Proposed solution: Monotree

  TLDR. Everything stays the same, the development process for the GUI changes slightly.

  Long version:
  * An exact mirror of the master development branch is hosted at `bitcoin-core/gui`. The new repository is used to track gui-only issues and pull requests. Global changes that happen to touch gui code still go to the *main* repo.
  * All pull requests will be merged into `bitcoin/bitcoin`.
  * Decision making process and maintainers will be identical for both repos.

  ### Disadvantages

  * Review activity might decrease?

  * It doesn't go far enough. bitcoin/bitcoin#3440 is proposing a modularized Bitcoin Core. The GUI could be an "add-on", connected over RPC or capnproto (bitcoin/bitcoin#10102). Thus, the gui could even be hosted as a subtree or completely separate project.

  ### Advantages

  * Review activity might increase? It is impossible to predict the future, but for example the `libsecp256k1` subtree has a lot of domain specific experts, maintainers and reviewers. I think longer term it makes sense to at least try this route for the gui as well.

  * A smaller step is easier to undo when it turns out to come with any unforeseen downsides.

  * No substantial changes to the decision making progress.

  * Nothing changes in how developers set up their dev environment or how users build from the source. Also, the release binaries and process will stay exactly the same. No version drift. Finally, code sharing between the GUI and Bitcoin Core is not made any harder.

  * The organizational side. There are 72 open issues (~14%) and 61 open PRs (~16%) with the GUI label. If moved to its own repo, non-GUI developers wouldn't have to be distracted with GUI-only issues and PRs and GUI enhancements. GUI developers have their own repo to focus on GUI development exclusively.

  ### Implementation (outstanding TODOs)

  * Adjust maintainer merge script https://github.com/bitcoin-core/bitcoin-maintainer-tools/pull/57
  * Create bitcoin-core/gui repository (empty or with master branch only)
  * Assign all existing bitcoin core maintainers to the new repo
  * Celebrate? 🥳

  * Long-term: Think how long the grace period is for existing GUI related issues and pull requests. Issues can be transferred with a script after a grace period of some months?

ACKs for top commit:
  fjahr:
    ACK 66666d55b1
  Sjors:
    ACK 66666d55b1
  troygiorshev:
    re-ACK 66666d5
  practicalswift:
    re-ACK 66666d55b1
  hebasto:
    re-ACK 66666d55b1

Tree-SHA512: 2e1a8de945fa6995583059a2e322621763fccce74a869f9aa750f73546b26350487c4acc4222c03cb3ac1f88e80f0b9d9a3a80a200432fee0d785f52c5cb6174
2020-06-18 14:19:26 -04:00
MarcoFalke 0865a8881d
Merge bitcoin-core/gui#3: scripted-diff: Make SeparatorStyle a scoped enum
25f3554351 scripted-diff: Make SeparatorStyle a scoped enum (Hennadii Stepanov)

Pull request description:

  This PR is [split](https://github.com/bitcoin/bitcoin/pull/17877#issuecomment-644751515) from https://github.com/bitcoin/bitcoin/pull/17877 and makes `BitcoinUnits::SeparatorStyle` a scoped enum.

ACKs for top commit:
  MarcoFalke:
    review ACK 25f3554351 🚐

Tree-SHA512: 578f1340a476cf79faa109a83815d3c75e26d9c18873e653d7624b52428ccb2677293116db0a60ae14c949d63b64988fc5a39c7184c2352b87b00e8ddaaaf474
2020-06-18 12:59:28 -04:00
MarcoFalke c7ebab12f9
Merge #19292: wallet: Refactor BerkeleyBatch Read, Write, Erase, and Exists functions into non-template functions
a389ed52e8 walletdb: refactor Read, Write, Erase, and Exists into non-template func (Andrew Chow)

Pull request description:

  In order to override these later, the specific details of how the Read, Write, Erase, and Exists functions interact with the actual database file need to go into functions that are not templated.

  The functions `ReadKey`, `WriteKey`, `EraseKey`, and `HasKey` are introduced to handle the actual interaction with the database.

  This is mostly a moveonly.

  Based on #19290

ACKs for top commit:
  ryanofsky:
    Code review ACK a389ed52e8. No changes since last review, just non-conflicting rebase
  Sjors:
    utACK a389ed52e8
  MarcoFalke:
    ACK a389ed52e8 🔳

Tree-SHA512: 73bd2fe9ddc4a132d4db6b97e77f5d5f8aa68b8cb25192384f3bacd826365947763a9eee73672331d34578e3f5ade85ee6aa550ff4d89eb62e482250dd5973e4
2020-06-18 10:25:51 -04:00
Hennadii Stepanov 25f3554351
scripted-diff: Make SeparatorStyle a scoped enum
-BEGIN VERIFY SCRIPT-
# General rename helper: $1 -> $2
rename_global() { sed -i "s/\<$1\>/$2/g" $(git grep -l "$1"); }

# Helper to rename SeparatorStyle enumerators
rename_value() {
  sed -i "s/    $1/    $2/g" src/qt/bitcoinunits.h;
  rename_global $1 "SeparatorStyle::$2";
}

rename_global 'enum SeparatorStyle' 'enum class SeparatorStyle'
rename_value 'separatorNever' 'NEVER'
rename_value 'separatorStandard' 'STANDARD'
rename_value 'separatorAlways' 'ALWAYS'
-END VERIFY SCRIPT-
2020-06-18 15:30:15 +03:00
Wladimir J. van der Laan b8740d6737
Merge #18468: Span improvements
26acc8dd9b Add sanity check asserts to span when -DDEBUG (Pieter Wuille)
2676aeadfa Simplify usage of Span in several places (Pieter Wuille)
ab303a16d1 Add Span constructors for arrays and vectors (Pieter Wuille)
bb3d38fc06 Make pointer-based Span construction safer (Pieter Wuille)
1f790a1147 Make Span size type unsigned (Pieter Wuille)

Pull request description:

  This improves our Span class by making it closer to the C++20 `std::span` one:
  * ~~Support conversion between compatible Spans (e.g. `Span<char>` to `Span<const char>`).~~ (done in #18591)
  * Make the size type `std::size_t` rather than `std::ptrdiff_t` (the C++20 one underwent the same change).
  * Support construction of Spans directly from arrays, `std::string`s, `std::array`s, `std::vector`s, `prevector`s, ... (for all but arrays, this only works for const containers to prevent surprises).

  And then make use of those improvements in various call sites.

  I realize the template magic used looks scary, but it's only needed to make overload resultion make the right choices. Note that the operations done on values are all extremely simple: no casts, explicit conversions, or warning-silencing constructions. That should hopefully make it simpler to review.

ACKs for top commit:
  laanwj:
    Code review ACK 26acc8dd9b
  promag:
    Code review ACK 26acc8dd9b.

Tree-SHA512: 5a5bd346a140edf782b5b3b3f04d9160c7b9e9def35159814a07780ab1dd352545b88d3cc491e0f80d161f829c49ebfb952fddc9180f1a56f1257aa51f38788a
2020-06-18 14:12:21 +02:00
MarcoFalke 343c0bfbf1
Merge #19304: test: Check that message sends successfully when header is split across two buffers
80d4423f99 Test buffered valid message (Troy Giorshev)

Pull request description:

  This PR is a tweak of #19302.  This sends a valid message.

  Additionally, this test includes logging in the same vein as #19272.

ACKs for top commit:
  MarcoFalke:
    tested ACK 80d4423f99 (added an assert(false) to observe deterministic coverage) 🌦
  gzhao408:
    ACK 80d4423f99 👊

Tree-SHA512: 3b1aa5ec480a1661917354788923d64595e2886448c9697ec0606a81293e8b4a4642b2b3cc9afb2206ce6f74e5c6d687308c5ad19cb73c5b354d3071ad8496f8
2020-06-18 07:39:37 -04:00
fanquake 931035b608
Merge #19301: build: don't warn when doxygen isn't found
fa84edb93c build: don't warn when doxygen isn't found (fanquake)

Pull request description:

  Doxygen isn't so important that we need to warn when it is missing. I'd
  assume it might even be missing more often than not for most builds.

ACKs for top commit:
  MarcoFalke:
    Fine with me ACK fa84edb93c
  hebasto:
    ACK fa84edb93c, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 793ebf01a8a5d48b78a70fdef0022633fca59b30074c960ebb21589e3bd98992b8304621a2d999195d12172ed30fe9eefeeb2a952d58853cf58e8d9902b0090c
2020-06-18 13:18:49 +08:00
Pieter Wuille 26acc8dd9b Add sanity check asserts to span when -DDEBUG 2020-06-17 15:10:50 -07:00
Hennadii Stepanov b83cc0fc94
Fix link error with --enable-debug 2020-06-17 22:31:58 +03:00
Troy Giorshev 80d4423f99 Test buffered valid message
A message can be broken across two buffers, with the split inside its
header.  Usually this will occur when sending many messages, such that
the first buffer fills.

This test uses the RPC to verify that the message is actually being
received in two pieces.

There is a very rare chance of a race condition where the test framework
sends a message in between the two halves of the message under test.  In
this case the peer will almost certainly disconnect and the test will
fail.  An assert has been added to help debugging that rare case.
2020-06-17 15:23:06 -04:00
MarcoFalke 35ed88f187
Merge #19298: test: Add missing sync_blocks
fa195d4eba test: Add missing sync_blocks (MarcoFalke)

Pull request description:

  Bitcoin Core does not sort block and tx announcements for other peers, so generating 100 blocks and then sending out a transaction might reject it if it arrives too early. (non-final)

  Fix that by syncing the blocks first.

  Fix #19265
  Fix #19311

ACKs for top commit:
  Sjors:
    utACK fa195d4eba: sounds plausible

Tree-SHA512: fdc46aed59595e4189509e71bd4a3607a93893933cc01d806cec2ee7701d54d7422c5f22dd83b81ddb021f9113b3119a688fdd8cf8a6474fc12fea422aedd064
2020-06-17 14:45:20 -04:00
Andrew Chow da7a83c5ee Remove WalletDatabase::Create, CreateMock, and CreateDummy
These are superseded by CreateWalletDatabase, CreateMockWalletDatabase,
and CreateDummyWalletDatabase
2020-06-17 14:13:17 -04:00
Andrew Chow d6045d0ac6 scripted-diff: Replace WalletDatabase::Create* with CreateWalletDatabase
-BEGIN VERIFY SCRIPT-
sed -i -e 's/WalletDatabase::Create(/CreateWalletDatabase(/g' `git grep -l "WalletDatabase::Create("`
sed -i -e 's/WalletDatabase::CreateDummy(/CreateDummyWalletDatabase(/g' `git grep -l "WalletDatabase::CreateDummy("`
sed -i -e 's/WalletDatabase::CreateMock(/CreateMockWalletDatabase(/g' `git grep -l "WalletDatabase::CreateMock("`
-END VERIFY SCRIPT-
2020-06-17 14:12:41 -04:00
Andrew Chow 45c08f8a7b Add Create*WalletDatabase functions
These functions doing the same things as WalletDatabase::Create,
CreateMock, and CreateDummy
2020-06-17 12:31:29 -04:00
Andrew Chow a389ed52e8 walletdb: refactor Read, Write, Erase, and Exists into non-template func
In order to override these later, the specific details of how the Read,
Write, Erase, and Exists functions interact with the actual database
file need to go into functions that are not templated.
2020-06-17 10:29:27 -04:00
MarcoFalke 39bd9ddb87
Merge #19295: refactor: Use AbortError in FatalError
fa02b47313 refactor: Use AbortError in FatalError (MarcoFalke)

Pull request description:

  `FatalError` has been copied from `AbortNode`, so the two should use the same style to avoid confusion.

  Follow-up to #18927

ACKs for top commit:
  hebasto:
    ACK fa02b47313, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 2cf6d18a6ffb5c2e5cf54f0a072a7cef6dc7e924152b2fee44e6ff2c6c53bad962afd364eda30d8a73883d656429ea68391090e6a27057e69eaefd7c4dad0a33
2020-06-17 06:36:34 -04:00
fanquake fa84edb93c
build: don't warn when doxygen isn't found
Doxygen isn't so important that we need to warn when it is missing. I'd
assume it might even be missing more often than not for most builds.
2020-06-17 18:27:00 +08:00
MarcoFalke 38389dd3a0
Merge #19252: test: wait for disconnect in disconnect_p2ps + bloomfilter test followups
9a40cfc558 [refactor] use waiting inside disconnect_p2ps (gzhao408)
aeb9fb414e [test] wait for disconnect_p2ps to be reflected in getpeerinfo (gzhao408)
e81942d2e1 [test] logging and style followups for bloomfilter tests (gzhao408)

Pull request description:

  Followup to #19083 which adds bloomfilter-related tests.

  1. Make test_node `disconnect_p2ps` wait until disconnection is complete to avoid race conditions (and not place the burden on tests) from MarcoFalke's [comment](https://github.com/bitcoin/bitcoin/pull/19083#discussion_r437383989). And clean up any redundant `wait_until`s in the functional tests.
  2. Clean up style + logging in p2p_filter.py and p2p_nobloomfilter_messages.py and jonatack's other [comments](https://github.com/bitcoin/bitcoin/pull/19083#pullrequestreview-428955784)

ACKs for top commit:
  jonatack:
    Code review ACK 9a40cfc from re-reviewing the diff and `git range-diff 5cafb46 8386ad5 9a40cfc`
  MarcoFalke:
    ACK 9a40cfc558 🐂

Tree-SHA512: 2e14b1c12fc08a355bd5ccad7a2a734a4ccda4bc7dc7bac171cb57359819fc1599d764290729af74832fac3e2be258c5d406c701e78ab6d7262835859b9a7d87
2020-06-17 06:20:10 -04:00
MarcoFalke 9a482d3604
Merge #19249: Add means to handle negative capabilities in the Clang Thread Safety annotations
f8213c05f0 Add means to handle negative capabilities in thread safety annotations (Hennadii Stepanov)

Pull request description:

  This commit is separated from #19238, and it adds support of [Negative Capabilities](https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#negative) in the Clang Thread Safety Analysis attributes.

  > Negative requirements are an alternative `EXCLUDES` [`LOCKS_EXCLUDED`] that provide a stronger safety guarantee. A negative requirement uses the `REQUIRES` [`EXCLUSIVE_LOCKS_REQUIRED`] attribute, in conjunction with the ! operator, to indicate that a capability should not be held.

  Examples of usage:
  - #19238 (for a class)
  - https://github.com/hebasto/bitcoin/tree/200610-addrman-tsn (for the whole code base)

ACKs for top commit:
  MarcoFalke:
    Approach ACK f8213c05f0
  vasild:
    ACK f8213c05

Tree-SHA512: 86d992826b87579661bd228712ae5ee6acca6f70b885ef7e96458974eac184e4874a525c669607ba6b6c861aa4806409a8792d100e6914c858bcab43d31cfb1b
2020-06-17 06:07:37 -04:00
Samuel Dobson 62d863f915
Merge #19290: wallet: move BDB specific classes to bdb.{cpp/h}
61c16339da walletdb: Move BDB specific things into bdb.{cpp/h} (Andrew Chow)
8f033642a8 walletdb: moveonly: Move BerkeleyBatch Cursor and Txn funcs to cpp (Andrew Chow)
25a655794a walletdb: move IsWalletLoaded to walletdb.cpp (Andrew Chow)
f6fc5f3849 walletdb: Add IsBDBWalletLoaded to look for BDB wallets specifically (Andrew Chow)
c3538f435a walletdb: Make SpliWalletFilePath non-static (Andrew Chow)

Pull request description:

  Moves the BDB specific classes from db.{cpp/h} to bdb.{cpp/h}.

  To do this, `SplitWalletFilePath` is first made non-static. Then `IsWalletLoaded` functionality is moved to `IsBDBWalletLoaded` which is called by `IsWalletLoaded`. Then the bulk of db.{cpp/h} is moved to a new file bdb.{cpp/h}.

  While doing some moveonly stuff, an additional commit moves the `*Cursor` and `Txn*` implementations out of the header file and into the cpp file.

  Part of #18971

ACKs for top commit:
  laanwj:
    Code review ACK 61c16339da
  promag:
    Code review ACK 61c16339da.
  meshcollider:
    utACK 61c16339da

Tree-SHA512: cb676cd34c9cd3c838a4fef230d84711efe4cf0d2eefa64ebfd7f787ddc6f7379db0b29454874ddc46ca7ffee0f18f6f3fb96a85513cd10164048948fd03a80c
2020-06-17 21:49:42 +12:00