Commit graph

19943 commits

Author SHA1 Message Date
Hennadii Stepanov
7ecb309c4e
Merge bitcoin-core/gui#419: Add missing tooltips to options menu settings
9bd168bf54 qt: add missing tooltips to options menu settings (Jarol Rodriguez)

Pull request description:

  This adds missing tooltips to the text of the `Size of database cache` and the `Number of script verification threads` settings.

  All settings in the Options window will now have appropriate tooltip texts.

ACKs for top commit:
  jonatack:
    ACK 9bd168bf54 tested on Debian 5.10.46-4 (2021-08-03)
  hebasto:
    ACK 9bd168bf54, tested on Linux Mint 20.2 (Qt 5.12.8).

Tree-SHA512: d71946bfee33c624a8b79eafe514d2c902090a40bc25097be4c7da4a80270f53305002af1b27d5fd082a0f45f838e22036632f9445918c4b8898073b33c09c08
2021-09-13 16:14:42 +03:00
Jarol Rodriguez
9bd168bf54 qt: add missing tooltips to options menu settings 2021-09-13 01:58:41 -04:00
Jarol Rodriguez
5cc783f5f3 qt: ensure translator comments end in full stop
This ensures that all gui translator comments end in a full stop.
If a comment does not end in a full stop, a translator may think 
that the rest of the comment is being cut off.

While here, add a colon to the word "see" for any comments
touched which point to look at a link.
2021-09-12 18:25:06 -04:00
Sebastian Falbesoner
98cf19ca32 wallet: refactor: avoid duplicate lookup on mapValue["timesmart"]
Also, use a named cast for converting the atoi64() result into an
unsigned int type.
2021-09-12 23:41:32 +02:00
Sebastian Falbesoner
973d8ba93d wallet: refactor: inline function WriteOrderPos()
Since accounts were removed in commit c9c32e6b84,
this function is only called at one place and thus can be as well inlined.
2021-09-12 23:38:20 +02:00
Hennadii Stepanov
5895a502cb
Merge bitcoin-core/gui#391: Add cancel button to configuration options popup
0b869df1c9 qt: Add cancel button to configuration options popup (Shashwat)

Pull request description:

  This PR renames the **OK** button to **Continue** and adds a **Cancel** button to the configuration options pop-up.

  This feature will give the user an option to abort opening the configuration file if they want to. This is an essential helpful feature that was missing in the master branch.

  In some windows managers such as Windows I3. The exit button at the top right corner is missing. So this feature becomes crucial there. And even when the exit button is there, it doesn't prevent the opening of the configuration file even when pressed.

  Additionally, it will always be possible to close using Keyboard Shortcut. This PR helps accessibility for those who need to use a mouse.

  <table>
    <tr>
     <td>Master
     </td>
     <td>PR
     </td>
    </tr>
    <tr>
     <td>

  ![Cancel-conf master(1)](https://user-images.githubusercontent.com/85434418/127555137-7a16dffd-109d-4024-917b-6b85f4df4f4a.png)

     </td>
     <td>

  ![Screenshot from 2021-09-07 20-15-28](https://user-images.githubusercontent.com/85434418/132365729-14f71f92-220b-4bb6-bed4-8315bd5697e6.png)

     </td>
    </tr>
  </table>

ACKs for top commit:
  hebasto:
    ACK 0b869df1c9, tested on Linux Mint 20.2 (Qt 5.12.8):
  prayank23:
    tACK 0b869df1c9

Tree-SHA512: c314e8b84064134f028f66f5015eb0f6ba33d5d4174c9ff49dcb5d2b577dce6019f59f9c7913393a415a323ea98c26febf5ca26e3e2102e7a1d31171e01937f1
2021-09-12 19:21:55 +03:00
Hennadii Stepanov
ee1db7b6dc
Merge bitcoin-core/gui#318: Add Copy address Peers Tab Context Menu Action
3ec061d9da qt: Add "Copy address" item to the context menu in the Peers table (Hennadii Stepanov)

Pull request description:

  Picking up #264

  This adds a `Copy Address` context menu action to the `Peers Tab`.

  Based on the first commit of PR #317 so that we can use `Qt::DisplayRole` in the `copyEntryData` function.

  | Master        | PR               |
  | ----------- | ----------- |
  |  ![Screen Shot 2021-05-05 at 4 51 11 AM](https://user-images.githubusercontent.com/23396902/117117822-fb067400-ad5d-11eb-9466-228456108e52.png) | ![Screen Shot 2021-05-05 at 4 49 15 AM](https://user-images.githubusercontent.com/23396902/117117835-fe99fb00-ad5d-11eb-8de0-f6a9acdbf40e.png) |

ACKs for top commit:
  shaavan:
    tACK 3ec061d9da
  luke-jr:
    utACK 3ec061d9da
  hebasto:
    ACK 3ec061d9da, tested on Linux Mint 20.2 (Qt 5.12.8):

Tree-SHA512: be0d7324592aae3928fa3cc522294f17226419fe8cbe3587df12a36bd4fa9c81bead377b13051e950b9a3fcd290b273861e70d6c76b75cdf76eaf58224b834cd
2021-09-12 19:00:25 +03:00
MarcoFalke
fa66a7d732
p2p: Rename fBlocksOnly, Add test
The new name describes better what the bool does and also limits the confusion of the three different concepts:
* fBlocksOnly (This bool to skip tx invs)
* -blocksonly (A setting to ignore incoming txs)
* block-relay-only (A connection type in the block-relay-only P2P graph)
2021-09-12 12:53:50 +02:00
Hennadii Stepanov
3174425255
Cleanup headers after #20788 2021-09-11 10:47:02 +03:00
Sebastian Falbesoner
65ed198295 wallet: refactor: inline function ReadOrderPos()
Since accounts were removed in commit c9c32e6b84,
this function is only called at one place and thus can be as well inlined. Also,
avoid a duplicate lookup by using the find() method and dereference, instead of
calling count() and operator[].
2021-09-10 16:17:03 +02:00
Shashwat
0b869df1c9 qt: Add cancel button to configuration options popup
This adds a cancel buttion to the configuration options window
2021-09-10 19:02:54 +05:30
merge-script
053a5fc7d9
Merge bitcoin/bitcoin#22762: Raise InitError when peers.dat is invalid or corrupted
fa55c3dc1b Raise InitError when peers.dat is invalid or corrupted (MarcoFalke)
fa4e2ccfd8 Inline ReadPeerAddresses (MarcoFalke)
fa5aeec80c Move LoadAddrman from init to addrdb (MarcoFalke)

Pull request description:

  peers.dat is silently erased when it can not be parsed or when it appears corrupted. Fix that by notifying the user. This might help in the following examples:

  * The user provided the database, but picked the wrong one.
  * A future version of Bitcoin Core wrote the file and it can't be read.
  * The file was corrupted by a logic bug in Bitcoin Core.
  * The file was corrupted by a disk failure.

ACKs for top commit:
  jonatack:
    Code review re-ACK fa55c3dc1b per `git range-diff eb1f570 fa59c6d fa55c3` and verified the new tests fail on master, except "Check mocked addrman is valid", as expected
  prayank23:
    tACK fa55c3dc1b
  vasild:
    ACK fa55c3dc1b

Tree-SHA512: 78264a78ee570a3c3262cf9c8542b5ffaffa5f52da1eef66c8c381f346989272967cfe1769c573502d9d7d3f7ad68c3ac3b2ec734185d2e4e7595b7122b14196
2021-09-10 11:41:20 +02:00
glozow
3cf46f6055 [doc] improve RBF documentation
Document a few non-obvious things and delete no-longer-relevant comments
(e.g. about taking a lock that we're already holding).
No change in behavior.
2021-09-10 10:32:29 +01:00
glozow
c78eb8651b [policy/refactor] pass in relay fee instead of using global 2021-09-10 09:38:01 +01:00
fanquake
b8336b22d3
Merge bitcoin/bitcoin#22675: RBF move 2/3: extract RBF logic into policy/rbf
32748da0f4 whitespace fixups after move and scripted-diff (glozow)
fa47622e8d scripted-diff: rename variables in policy/rbf (glozow)
ac761f0a23 MOVEONLY: fee checks (Rules 3 and 4) to policy/rbf (glozow)
9c2f9f8984 MOVEONLY: check that fees > direct conflicts to policy/rbf (glozow)
3f033f01a6 MOVEONLY: check for disjoint conflicts and ancestors to policy/rbf (glozow)
7b60c02b7d MOVEONLY: BIP125 Rule 2 to policy/rbf (glozow)
f8ad2a57c6 Make GetEntriesForConflicts return std::optional (glozow)

Pull request description:

  This PR does not change behavior. It extracts the BIP125 logic into helper functions (and puts them in the policy/rbf* files). This enables three things - I think each one individually is pretty good:

  - Implementation of package RBF (see #22290). I want it to be as close to BIP125 as possible so that it doesn't become a distinct fee-bumping mechanism. Doing these move-only commits first means the diff is mostly mechanical to review, and I just need to create a function that mirrors the single transaction validation.
  - We will be able to isolate and test our RBF logic alone. Recently, there have been some discussions on discrepancies between our code and BIP125, as well as proposals for improving it. Generally, I think making this code more modular and de-bloating validation.cpp is probably a good idea.
  - Witness Replacement (replacing same-txid-different-wtxid when the witness is significantly smaller and therefore higher feerate) in a BIP125-similar way. Hopefully it can just be implemented with calls to the rbf functions (i.e. `PaysForRBF`) and an edit to the relevant mempool entries.

ACKs for top commit:
  mjdietzx:
    ACK 32748da0f4
  theStack:
    Code-review ACK 32748da0f4 📐
  MarcoFalke:
    review ACK 32748da0f4 🦇

Tree-SHA512: d89985c8b4b42b54861018deb89468e04968c85a3fb1113bbcb2eb2609577bc4fd9bf254593b5bd0e7ab059a0fa8192d1a903b00f77e6f120c7a80488ffcbfc0
2021-09-10 14:44:54 +08:00
fanquake
5446070418
Merge bitcoin/bitcoin#22911: [net] Minor cleanups to asmap
853c4edb70 [net] Remove asmap argument from CNode::CopyStats() (John Newbery)
9fd5618610 [asmap] Make DecodeAsmap() a utility function (John Newbery)
bfdf4ef334 [asmap] Remove SanityCheckASMap() from netaddress (John Newbery)
07a9eccb60 [net] Remove CConnman::Options.m_asmap (John Newbery)

Pull request description:

  These small cleanups to the asmap code are the first 4 commits from #22910. They're minor improvements that are independently useful whether or not 22910 is merged.

ACKs for top commit:
  naumenkogs:
    ACK 853c4edb70
  theStack:
    Concept and code-review ACK 853c4edb70 🗺️
  fanquake:
    ACK 853c4edb70

Tree-SHA512: 64783743182592ac165df6ff8d18870b63861e9204ed722c207fca6938687aac43232a5ac4d8228cf8b92130ab0349de1b410a2467bb5a9d60dd9a7221b3b85b
2021-09-10 14:04:16 +08:00
fanquake
a907704e7f
compat: remove glibc_compat.cpp 2021-09-10 11:18:58 +08:00
fanquake
62e45da945
build: remove glibc-back-compat from build system
At this point, or minimum required glibc is implicitly 2.18, due to
thread_local support being enabled by default. However, users can
disable thread_local support to maintain 2.17 ccompat for now, which is
currently done in the Guix build.
2021-09-10 11:18:58 +08:00
merge-script
d2dd1697ce
Merge bitcoin/bitcoin#22904: sync, log: inline lock contention logging macro to fix duration, improve BCLog::LogMsg()
f530202353 Make unexpected time type in BCLog::LogMsg() a compile-time error (Martin Ankerl)
bddae7e7ff Add util/types.h with ALWAYS_FALSE template (MarcoFalke)
498b323425 log, timer: improve BCLog::LogMsg() (Jon Atack)
8d2f847ed9 sync: inline lock contention logging macro to fix time duration (Jon Atack)

Pull request description:

  Follow-up to #22736.

  The first commit addresses the issue identified and reported by Martin Ankerl in https://github.com/bitcoin/bitcoin/pull/22736#discussion_r703019629 to fix the lock contention duration reporting.

  The next three commits make improvements to the timer code in `BCLog::LogMsg()` and add `util/types.h` with an `ALWAYS_FALSE` template, that springboard from https://github.com/bitcoin/bitcoin/pull/22736#discussion_r702747920 by Marco Falke.

ACKs for top commit:
  martinus:
    re-ACK f530202353. I ran a fully synced node for about a day. My node was mostly idle though so not much was going on. I [wrote a little script](https://github.com/martinus/bitcoin-stuff/blob/main/scripts/parse-debuglog-contention-single.rb) to parse the `debug.log` and summarize the output to see if anything interesting was going on, here is the result:
  theStack:
    ACK f530202353

Tree-SHA512: 37d093eac5590e1b5846ab5994d0950d71e131177d1afe4a5f7fcd614270f977e0ea117e7af788e9a74ddcccab35b42ec8fa4db3a3378940d4988df7d21cdaaa
2021-09-09 15:55:03 +02:00
fanquake
1d0c57a05c
Merge bitcoin/bitcoin#22914: util: remove libevent <= 2.0.18 back-compat code
6045a14642 util: remove libevent <= 2.0.18 back-compat code (fanquake)

Pull request description:

  Now that we require libevent >=2.0.21, remove backwards compatibility code for older versions.

ACKs for top commit:
  kristapsk:
    ACK 6045a14642

Tree-SHA512: 49a237ee3cef78b105f8ea91dc3e541fe700fe3a3d02a88f85ec91772068ffbe508dbe196a4d693399b2bcf903251b9bc2573f04cb8f2e21a2ea481f35bfde32
2021-09-09 21:54:27 +08:00
W. J. van der Laan
020c2b7609
Merge bitcoin/bitcoin#22923: test: Switch multiprocess to clang i686 build
fa309ee61c bench: Fix 32-bit compilation failure in addrman bench (MarcoFalke)
fae0295a79 ci: Switch multiprocess to i686 build (MarcoFalke)

Pull request description:

  Building for i686 with clang helps to catch bugs early for:
  * The OSS-Fuzz i686 clang libFuzzer build
  * The arm 32-bit native clang build

  Fixes  #22889

ACKs for top commit:
  hebasto:
    ACK fa309ee61c

Tree-SHA512: 581820d319aae2fcd4dd44979ee3d4164a575f0438476890aa2a7447f1392a5da26766cd6ab954530499b54f66eec2417bdeefdd7efb19bc27dd679cd2b9d0ce
2021-09-09 15:52:26 +02:00
fanquake
6045a14642
util: remove libevent <= 2.0.18 back-compat code
Now that we require libevent >=2.0.21, remove backwards compatibility
code for older versions.
2021-09-09 21:37:42 +08:00
W. J. van der Laan
b05d3e76e7
Merge bitcoin/bitcoin#22079: zmq: Add support to listen on IPv6 addresses
e6998838e5 doc: Add IPv6 address to zmq example (nthumann)
8abe5703a9 test: Add IPv6 test to zmq (nthumann)
ded449b726 zmq: Enable IPv6 on listening socket (nthumann)

Pull request description:

  This PR adds support for listening on IPv6 addresses with bitcoinds ZMQ interface, just like the RPC server.
  Currently, it is not possible to specify an IPv6 address, as the `ZMQ_IPV6` [socket option](http://api.zeromq.org/master:zmq-setsockopt#toc27) is not set and therefore the ZMQ initialization fails, if one does so. The absence of this option has also been noted [here](https://github.com/bitcoin/bitcoin/issues/15198#issuecomment-617378512).
  With this PR one can e.g. set `-zmqpubhashblock=tcp://[::1]:28333` to listen on the IPv6 loopback address.

ACKs for top commit:
  laanwj:
    Code review ACK e6998838e5
  theStack:
    Tested ACK e6998838e5 🌱

Tree-SHA512: 43c3043d8d5c79794d475926259c1be975b694db4fcc1f7750a9a28e242f0fa1b531735a63ea5777498003aa5834f6243f39742d0f3941f2f37593d0c7890700
2021-09-09 15:37:13 +02:00
MarcoFalke
fa55c3dc1b
Raise InitError when peers.dat is invalid or corrupted 2021-09-09 09:20:43 +02:00
MarcoFalke
fa4e2ccfd8
Inline ReadPeerAddresses
No need to have a function that is only called in one place
2021-09-09 09:12:12 +02:00
MarcoFalke
fa5aeec80c
Move LoadAddrman from init to addrdb
Init should only concern itself with the initialization order, not the
detailed initialization logic of every module.

Also, inlining logic into a method that is ~800 lines of code, makes it
impossible to unit test on its own.
2021-09-09 09:11:41 +02:00
MarcoFalke
fa309ee61c
bench: Fix 32-bit compilation failure in addrman bench 2021-09-09 08:30:53 +02:00
MarcoFalke
896649996b
Merge bitcoin/bitcoin#22915: Remove confusing CAddrDB
fade9a1a4d Remove confusing CAddrDB (MarcoFalke)
fa7f77b7d1 Fix addrdb includes (MarcoFalke)
fa3f5d0dae Move addrman includes from .h to .cpp (MarcoFalke)

Pull request description:

  Split out from #22762 to avoid having to carry it around in (an)other rebase(s)

ACKs for top commit:
  ryanofsky:
    Code review ACK fade9a1a4d
  lsilva01:
    Code Review ACK fade9a1a4d

Tree-SHA512: 7615fb0b6235d0c1e6f8cd6263dd18c4d95890567c2b797fe6fce6cb12cc85ce6eacbe07dbb6d81b05d179ef03b42edfd61c940e35a1044ce6d363b54c2dae5c
2021-09-09 08:09:39 +02:00
fanquake
8805e06663
Merge bitcoin/bitcoin#22390: system: skip trying to set the locale on NetBSD
fdd71448e7 system: skip trying to set the locale on NetBSD (fanquake)

Pull request description:

  Just treat it the same as the other BSDs.

  Fixes #17379.

ACKs for top commit:
  laanwj:
    Code review ACK fdd71448e7
  practicalswift:
    cr ACK fdd71448e7

Tree-SHA512: 5fe0a66f014279ad2683b548692a36af493377fb92d1f28b15dc4feef871190fe08ef40dcc4f5ba21a525fe365c42fb429fe4be0673a1e96db163af587c23204
2021-09-09 13:51:02 +08:00
fanquake
da67b75c5c
Merge bitcoin/bitcoin#22903: Enable clang-tidy bugprone-argument-comment and fix violations
fa57fa1a2e Enable clang-tidy bugprone-argument-comment and fix violations (MarcoFalke)

Pull request description:

  Named arguments can be dangerous when they are wrong, because they are not enforced by the compiler. Currently there are only minor typos, no actual bugs.

  Fix the typos and add the `.clang-tidy` file to make it easier to find them in the future.

ACKs for top commit:
  practicalswift:
    cr ACK fa57fa1a2e
  fanquake:
    ACK fa57fa1a2e

Tree-SHA512: b66f01e0a1e77e56ed8454002176df660cc2cc0947a90785aa33cc5b8003a1f99fd8b2f8f89f2a0bf180ff2c42c031d69e669d127bb557b879c17975275a220b
2021-09-09 11:33:58 +08:00
fanquake
69a439b880
doc: add missing copyright header to getuniquepath.cpp
This was missed in #21052.
2021-09-08 16:28:21 +08:00
fanquake
7d7d5e8efd
Merge bitcoin/bitcoin#22879: addrman: Fix format string in deserialize error
fab0b55cf0 addrman: Fix format string in deserialize error (MarcoFalke)
facce4ca44 test: Remove useless overwrite (MarcoFalke)

Pull request description:

  The format string is evaluated differently on modern compilers (clang 10 and later, as well as gcc 10 and later).

  Work around the behaviour change in compilers by pinning the underlying type of the format arguments.

  Can be tested by observing a failing test when running against master compiled with clang 10 or gcc 10 (or later).

ACKs for top commit:
  jonatack:
    ACK fab0b55cf0 verified the test fails on master as expected only at line 61 (assertion fixed by the code change); the last two test additions pass as expected
  mzumsande:
    ACK fab0b55cf0

Tree-SHA512: 07462901435107f3bc79098fd7d06446bfe8fe065fffdd35adfcba8f1dd3c499575006557afe7bc74b79d690c5ef7b58e3e031e908161be5529cf237e3b30609
2021-09-08 15:17:42 +08:00
Martin Ankerl
f530202353
Make unexpected time type in BCLog::LogMsg() a compile-time error 2021-09-07 19:19:31 +02:00
MarcoFalke
bddae7e7ff
Add util/types.h with ALWAYS_FALSE template 2021-09-07 19:19:02 +02:00
John Newbery
853c4edb70 [net] Remove asmap argument from CNode::CopyStats()
This saves passing around a reference to the asmap std::vector<bool>.
2021-09-07 15:24:14 +01:00
John Newbery
9fd5618610 [asmap] Make DecodeAsmap() a utility function
DecopeAsmap is a pure utility function and doesn't have any
dependencies on addrman, so move it to util/asmap.

Reviewer hint: use:

`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
2021-09-07 15:24:00 +01:00
John Newbery
bfdf4ef334 [asmap] Remove SanityCheckASMap() from netaddress
SanityCheckASMap(asmap, bits) simply calls through to SanityCheckASMap(asmap)
in util/asmap. Update all callers to simply call that function.
2021-09-07 13:31:10 +01:00
John Newbery
07a9eccb60 [net] Remove CConnman::Options.m_asmap
This data member was introduced in ec45646de9 but never used.
2021-09-07 10:14:50 +01:00
MarcoFalke
fade9a1a4d
Remove confusing CAddrDB
The class only stores the file path, reading it from a global. Globals
are confusing and make testing harder.

The method reading from a stream does not even use any class members, so
putting it in a class is also confusing.
2021-09-07 11:05:16 +02:00
MarcoFalke
fa7f77b7d1
Fix addrdb includes 2021-09-07 10:44:48 +02:00
MarcoFalke
fa3f5d0dae
Move addrman includes from .h to .cpp
This is a follow-up to the code move in commit a820e79512
2021-09-07 10:44:43 +02:00
MarcoFalke
9393666e78
Merge bitcoin/bitcoin#19833: wallet: Avoid locking cs_wallet recursively
5fabde6fad wallet: AddWalletDescriptor requires cs_wallet lock (João Barbosa)
32d036e8da wallet: GetLabelAddresses requires cs_wallet lock (João Barbosa)

Pull request description:

  This is another small change towards non recursive wallet lock.

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

Tree-SHA512: 00506f0159c56854a171e58a451db8dd9b9f735039697b1cf2ca7f54de61fb51cc1e5eff42265233e041b4b1bfd29c2247496dc4456578e1a23c323bdec2901b
2021-09-07 10:34:44 +02:00
MarcoFalke
fa57fa1a2e
Enable clang-tidy bugprone-argument-comment and fix violations 2021-09-07 09:11:10 +02:00
Hennadii Stepanov
503194d2ee
Merge bitcoin-core/gui#398: refactor: Pass WalletModel object to the WalletView constructor
d319c4dae9 qt, refactor: Replace WalletFrame::addWallet with WalletFrame::addView (Hennadii Stepanov)
92ddc02a16 qt, refactor: Declare getWalletModel with const and noexcept qualifiers (Hennadii Stepanov)
ca0e680bdc qt, refactor: Drop redundant checks of walletModel (Hennadii Stepanov)
404373bc6a qt, refactor: Pass WalletModel object to WalletView constructor (Hennadii Stepanov)

Pull request description:

  An instance of the `WalletView` class without the `walletModel` data member being set is invalid. So, it is better to set it in the constructor.

  Establishing one more `WalletView` class's invariant in constructor:
  - allows to drop all of checks of the`walletModel` in member functions
  - makes reasoning about the code that uses instances of the `WalletView` class  easier

  Possible follow ups could extend this approach to other classes, e.g., `OverviewPage`, `TransactionView`, `ReceiveCoinsDialog`, `SendCoinsDialog`, `AddressBookPage`.

ACKs for top commit:
  ShaMan239:
    Code review ACK d319c4dae9
  promag:
    Code review ACK d319c4dae9.
  jarolrod:
    ACK d319c4dae9

Tree-SHA512: b0c61f82811bb5aba2738067b53dc9ea4439230d547ce5c8fd85c480d8d70ea15f9942dbf13842383acbce467fba1ab4e132e37c56b654b46ba897301a41066e
2021-09-07 08:48:52 +03:00
Jon Atack
498b323425
log, timer: improve BCLog::LogMsg()
- make timer code more homogeneous
- replace division with multiplication
- log if the time type is unexpected
2021-09-07 00:37:39 +02:00
Jon Atack
8d2f847ed9
sync: inline lock contention logging macro to fix time duration
Co-authored-by: Martin Ankerl <martin.ankerl@gmail.com>
2021-09-06 23:43:51 +02:00
MarcoFalke
a8fdfea77b
Merge bitcoin/bitcoin#22791: init: Fix asmap/addrman initialization order bug
724c497562 [fuzz] Add ConsumeAsmap() function (John Newbery)
5840476714 [addrman] Make m_asmap private (John Newbery)
f9002cb5db [net] Rename the copyStats arg from m_asmap to asmap (John Newbery)
f572f2b204 [addrman] Set m_asmap in CAddrMan initializer list (John Newbery)
593247872d [net] Remove CConnMan::SetAsmap() (John Newbery)
50fd77045e [init] Read/decode asmap before constructing addrman (John Newbery)

Pull request description:

  Commit 181a1207 introduced an initialization order bug: CAddrMan's m_asmap must be set before deserializing peers.dat.

  The first commit restores the correct initialization order. The remaining commits make `CAddrMan::m_asmap` usage safer:

  - don't reach into `CAddrMan`'s internal data from `CConnMan`
  - set `m_asmap` in the initializer list and make it const
  - make `m_asmap` private, and access it (as a reference to const) from a getter.

  This ensures that peers.dat deserialization must happen after setting m_asmap, since m_asmap is set during CAddrMan construction.

ACKs for top commit:
  mzumsande:
    Tested ACK 724c497562
  amitiuttarwar:
    code review but utACK 724c497562
  naumenkogs:
    utACK 724c497562
  vasild:
    ACK 724c497562
  MarcoFalke:
    review ACK 724c497562 👫

Tree-SHA512: 684a4cf9e3d4496c9997fb2bc4ec874809987055c157ec3fad1d2143b8223df52b5a0af787d028930b27388c8efeba0aeb2446cb35c337a5552ae76112ade726
2021-09-06 12:41:36 +02:00
MarcoFalke
2c6707be8b
Merge bitcoin/bitcoin#22848: MOVEONLY: Expose BanMapToJson / BanMapFromJson
6919c823cb MOVEONLY: Expose BanMapToJson / BanMapFromJson (Russell Yanofsky)

Pull request description:

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

  ---

  CSubNet serialization code that was removed in #22570 fa4e6afdae was needed by multiprocess code to share ban map between gui and node processes.

  Rather than adding it back, use suggestion from MarcoFalke https://github.com/bitcoin/bitcoin/pull/10102#discussion_r690922929 to use JSON serialization. This requires making BanMapToJson / BanMapFromJson functions public.

ACKs for top commit:
  promag:
    reACK 6919c823cb.

Tree-SHA512: ce909a61b7869d16cf2e9f91b643dd9d2604efc5777703d3b77a4c40cb0ccdd20396ba87b1ec85aade142e12ff9ea4c95c7155840354873579565471779f5a33
2021-09-06 10:35:30 +02:00
MarcoFalke
fa92777448
Merge bitcoin/bitcoin#22736: log, sync: change lock contention from preprocessor directive to log category
7e69873283 sync: remove DEBUG_LOCKCONTENTION preprocessor directives (Jon Atack)
9b08006bc5 log, sync: improve lock contention logging and add time duration (Jon Atack)
3f4c6b87f1 log, timer: add timing macro in usec LOG_TIME_MICROS_WITH_CATEGORY (Jon Atack)
b7a17444e0 log, sync: add LOCK logging category, apply it to lock contention (Jon Atack)

Pull request description:

  To enable lock contention logging, `DEBUG_LOCKCONTENTION` has to be defined at compilation. Once built, the logging is not limited to a category and is high frequency, verbose and in all-caps. With these factors combined, it seems likely to be rarely used.

  This patch:
  - adds a `lock` logging category
  - adds a timing macro in microseconds, `LOG_TIME_MICROS_WITH_CATEGORY`
  - updates `BCLog::LogMsg()` to omit irrelevant decimals for microseconds and skip unneeded code and math
  - improves the lock contention logging, drops the all-caps, and displays the duration in microseconds
  - removes the conditional compilation directives
  - allows lock contentions to be logged on startup with `-debug=lock` or at run time with `bitcoin-cli logging '["lock"]'`

  ```
  $ bitcoind -signet -debug=lock
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 started
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1920 completed (4μs)
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 started
  2021-09-01T12:40:01Z LockContention: cs_vNodes, net.cpp:1302 completed (4μs)
  2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 started
  2021-09-01T12:40:02Z LockContention: cs_vNodes, net.cpp:2242 completed (20μs)
  2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 started
  2021-09-01T12:43:04Z LockContention: ::cs_main, validation.cpp:4980 completed (3μs)

  $ bitcoin-cli -signet logging
    "lock": true,

  $ bitcoin-cli -signet logging [] '["lock"]'
    "lock": false,

  $ bitcoin-cli -signet logging '["lock"]'
    "lock": true,
  ```

  I've tested this with Clang 13 and GCC 10.2.1, on Debian, with and without `--enable-debug`.

ACKs for top commit:
  hebasto:
    re-ACK 7e69873283, added a contention duration to the log message since my [previous](https://github.com/bitcoin/bitcoin/pull/22736#pullrequestreview-743764606) review.
  theStack:
    re-ACK 7e69873283 🔏 ⏲️

Tree-SHA512: c4b5eb88d3a2c051acaa842b3055ce30efde1f114f61da6e55fcaa27476c1c33a60bc419f7f5ccda532e1bdbe70815222ec2b2b6d9226f29c8e94e598aacfee7
2021-09-06 10:31:12 +02:00
MarcoFalke
4bd56bc291
Merge bitcoin/bitcoin#22894: netinfo: clarify client and server versions in header
e952d7557e netinfo: clarify client and server versions in header (Jon Atack)

Pull request description:

  Clarify in -netinfo output that both the client and the server versions are provided.

  before
  ```
  Bitcoin Core v22.0.0rc3 - 70016/Satoshi:22.99.0/
  ```

  after
  ```
  Bitcoin Core client v22.0.0rc3 - server 70016/Satoshi:22.99.0/
  ```

  Closes #22873.

ACKs for top commit:
  benthecarman:
    utACK e952d7557e
  prayank23:
    ACK e952d7557e
  Zero-1729:
    tACK e952d7557e

Tree-SHA512: 3e817892d398aabacb1401fd5b1816c4d4f563b4f8cf1096bdb8b53f7c4ef82d4caee09f5c7724f1fe292f837434a332acefba735152ed24a238bb6f006df909
2021-09-06 09:16:32 +02:00
fanquake
78d39f8438
Merge bitcoin/bitcoin#22861: test: Update test README and lint script
fa0937de35 test: Rename bitcoin-util-test.py to util/test_runner.py (MarcoFalke)
fa050bbc0a test: Update test README and lint script (MarcoFalke)

Pull request description:

  * Remove unused `yq`
  * Update fuzzing docs

ACKs for top commit:
  Saviour1001:
    ACK <code>[fa0937d](fa0937de35)</code>
  practicalswift:
    cr ACK fa0937de35
  fanquake:
    ACK fa0937de35

Tree-SHA512: 6b148d838e1fcf219ab92e579948e34ea7ce8b4692a3d28bb2a51aaa34cbc7cdbd79e72ce787b485fdf524e5b3521b033692583602d4e379bd160e0e41d66e28
2021-09-06 09:53:41 +08:00
Hennadii Stepanov
3ec061d9da qt: Add "Copy address" item to the context menu in the Peers table
Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
2021-09-05 15:37:14 -04:00
Jon Atack
350e034e64
consensus: don't call GetBlockPos in ReadBlockFromDisk without lock 2021-09-05 17:55:06 +02:00
MarcoFalke
91e07cc50d
Merge bitcoin/bitcoin#22591: Util: error if settings json exists, but is unreadable
2b071265c3 error if settings.json exists, but is unreadable (Tyler Chambers)

Pull request description:

  If settings.json exists, but is unreadable, we should error instead of overwriting.

  Fixes #22571

ACKs for top commit:
  Zero-1729:
    tACK 2b071265c3
  ShaMan239:
    tACK 2b071265c3
  prayank23:
    tACK 2b071265c3
  ryanofsky:
    Code review ACK 2b071265c3. Thanks for the fix! Note that PR   https://github.com/bitcoin-core/gui/pull/379 will change the appearance of dialogs shown in screenshots above. So it could be interesting to test the two PRs together (but current testing seems more than sufficient)
  theStack:
    ACK 2b071265c3 📁

Tree-SHA512: 6f7f96ce8a13213d0335198a2245d127264495c877105058d1503252435915b332a6e55068ac21088f4c0c017d564689f4956213328d5bdee81d73711efc5511
2021-09-05 17:12:37 +02:00
Jon Atack
e952d7557e
netinfo: clarify client and server versions in header 2021-09-05 12:44:16 +02:00
MarcoFalke
fab0b55cf0
addrman: Fix format string in deserialize error
Also add a regression test.
2021-09-05 10:26:03 +02:00
fanquake
6490a3ef6c
Merge bitcoin/bitcoin#22859: Replace uses of boost::trim* with locale-independent alternatives (#18130 rebased)
696c76d660 tests: Add TrimString(...) tests (practicalswift)
4bf18b089e Replace use of boost::trim_right with locale-independent TrimString (Ben Woosley)
93551862a1 Replace use of boost::trim use with locale-independent TrimString (Ben Woosley)

Pull request description:

  This is [#18130 rebased](https://github.com/bitcoin/bitcoin/pull/18130#issuecomment-900158759).

  > `TrimString` is an existing alternative.

  > Note `TrimString` uses `" \f\n\r\t\v"` as the pattern, which is consistent with the default behavior of `std::isspace`. See: https://en.cppreference.com/w/cpp/string/byte/isspace

ACKs for top commit:
  jb55:
    utACK 696c76d660
  practicalswift:
    ACK 696c76d660
  jonatack:
    ACK 696c76d660
  theStack:
    Code-review ACK 696c76d660

Tree-SHA512: 6a70e3777602dfa65a60353e5c6874eb951e4a806844cd4bdaa4237cad980a4f61ec205defc05a29f9707776835975838f6cc635259c42adfe37ceb02ba9358d
2021-09-05 11:13:36 +08:00
fanquake
f4e12fd50c
Merge bitcoin/bitcoin#22278: Add LIFETIMEBOUND to CScript where needed
fa7e6c56f5 Add LIFETIMEBOUND to InitializeChainstate (MarcoFalke)
fa5c896724 Add LIFETIMEBOUND to CScript where needed (MarcoFalke)

Pull request description:

  Without this, stack-use-after-scope can only be detected at runtime with ASan or code review, both of which are expensive.

  Use `LIFETIMEBOUND` to turn this error into a compile warning.

  See https://releases.llvm.org/12.0.0/tools/clang/docs/AttributeReference.html#lifetimebound

  Example:

  ```cpp
  const CScript a{WITH_LOCK(::cs_main, return CScript{} << OP_0 << OP_1)};
  ```

  Before: (no warning)
  After:

  ```
  warning: returning reference to local temporary object [-Wreturn-stack-address]
      const CScript a{WITH_LOCK(::cs_main, return CScript{} << OP_0 << OP_1)};
                                                  ^~~~~~~~~
  ./sync.h:276:65: note: expanded from macro 'WITH_LOCK'
  #define WITH_LOCK(cs, code) [&]() -> decltype(auto) { LOCK(cs); code; }()
                                                                  ^~~~

ACKs for top commit:
  theuni:
    utACK fa7e6c56f5.
  jonatack:
    Light ACK fa7e6c56f5 debug build with clang 13, reproduced the example compiler warning in the pull description, and briefly looked at `clang::lifetimebound` support in earlier versions of clang; it is in clang 7 (https://releases.llvm.org/7.0.0/tools/clang/docs/AttributeReference.html#lifetimebound-clang-lifetimebound), did not see references to it in earlier docs

Tree-SHA512: e915acdc4532445205b7703fab61a5d682231ace78ecfb274cb8523ca2bddefd85828f50ac047cfb1afaff92a331f5f7b5a1472539f999e30f7cf8ac8c3222f3
2021-09-04 10:51:36 +08:00
João Barbosa
5fabde6fad wallet: AddWalletDescriptor requires cs_wallet lock
No change in behavior, the lock is already held at call sites.
2021-09-03 18:30:01 +01:00
João Barbosa
32d036e8da wallet: GetLabelAddresses requires cs_wallet lock
No change in behavior, the lock is already held at call sites.
2021-09-03 18:28:12 +01:00
MarcoFalke
5fb6701bdb
Merge bitcoin/bitcoin#22860: test: Always clear reject reason in IsStandard tx test
fa1b08eb14 test: Always clear reject reason in IsStandard tx test (MarcoFalke)

Pull request description:

  For some tests the reject reason wasn't cleared between runs and thus subsequent tests might (theoretically) fail to verify the correct reject reason.

ACKs for top commit:
  benthecarman:
    ACK fa1b08eb14
  theStack:
    Code-review ACK fa1b08eb14

Tree-SHA512: fcb727a690f92a4cf06127c302ba464f1e8cb997498e4f7fd9e210d193559b07e6efdb9d5c8a0bef3fe643bdfd5fedd431aaace20978dd49e56b8e770cb9f930
2021-09-03 17:49:09 +02:00
MarcoFalke
fa7e6c56f5
Add LIFETIMEBOUND to InitializeChainstate 2021-09-03 13:42:59 +02:00
MarcoFalke
fa5c896724
Add LIFETIMEBOUND to CScript where needed 2021-09-03 13:42:03 +02:00
Samuel Dobson
d5d0a5c604
Merge bitcoin/bitcoin#17526: Add Single Random Draw as an additional coin selection algorithm
3633b667ff Use SelectCoinsSRD if it has less waste (Andrew Chow)
8bf789b4b4 Add SelectCoinsSRD function (Andrew Chow)
2ad3b5d2ad tests: wallet_basic lock needed unspents (Andrew Chow)
b77885f13e tests: wallet_txn explicilty specify inputs (Andrew Chow)
59ba7d2861 tests: rpc_fundrawtx better test for UTXO inclusion with include_unsafe (Andrew Chow)
a165bfbe44 tests: rpc_fundrawtx use specific inputs for unavailable change test (Andrew Chow)
df765a484d tests: rpc_fundrawtx lock to UTXO types (Andrew Chow)

Pull request description:

  To ease in the use of SRD as our fallback mechanism, this PR adds it as a secondary fallback algorithm in addition to the knapsack solver. Since #22009, the solution with the least waste will be chosen. This pattern is continued with SRD simply being another solution whose waste is compared.

ACKs for top commit:
  glozow:
    reACK 3633b66 via `git range-diff  981b9d1...3633b66`, thanks for taking the suggestions
  laanwj:
    Concept and code review ACK 3633b667ff

Tree-SHA512: 895659f553fea2230990136565bdf18b1328de8b0ce47f06b64bb4d69301f6dd68cb38debe5c24fb6de1317b735fc020a987c541f00bbea65229de47e53adf92
2021-09-03 22:45:48 +12:00
merge-script
825f4a64e6
Merge bitcoin/bitcoin#22976: scripted-diff: Rename overloaded int GetArg to GetIntArg
93b9800fec scripted-diff: Rename overloaded int GetArg to GetIntArg (Russell Yanofsky)

Pull request description:

  This is meant to improve readability of code and remove guesswork needed to determine argument types and migrate to [typed arguments (#22978)](https://github.com/bitcoin/bitcoin/issues/22978) by having distinctly named `GetArg` `GetArgs` `GetBoolArg` and `GetIntArg` methods.

  ---

  This commit was originally part of #22766 and had some review discussion there. But it was [wisely suggested](https://github.com/bitcoin/bitcoin/pull/22766#issuecomment-910001542) to be split off  to make that PR smaller.

ACKs for top commit:
  hebasto:
    ACK 93b9800fec.
  MarcoFalke:
    re-ACK 93b9800fec 📨

Tree-SHA512: e034bd938b2c8fbadd90bcd52213a61161965dfddf18c2cb0d68816ecf2438cde8afee6fb7e3418f5c6b35c208338da9deb99e4e418dbf68ca34552e0916a625
2021-09-27 15:13:09 +02:00
W. J. van der Laan
68bbfcc250
Merge bitcoin/bitcoin#23021: net: switch to signet DNS seed
dc10ca346b net: switch to signet DNS seed (Sjors Provoost)

Pull request description:

  I spun up a DNS seed for Signet, source: https://github.com/sipa/bitcoin-seeder/pull/94

  If anyone else spins up a DNS seed, let me know in the comment and I'll add it.

  Because one DNS seed is not very diverse, this PR leaves two hardcoded nodes just in case (). The one dropped node no longer exists.

  Replaces #23000.

ACKs for top commit:
  kallewoof:
    utACK dc10ca346b
  laanwj:
    Concept and code review ACK dc10ca346b
  jarolrod:
    ACK dc10ca346b
  shaavan:
    ACK dc10ca346b

Tree-SHA512: 534d189becd51974042fddc3efe3df230484f05cd945e756eaf6a4a8a580e2161b3a959eb3d44dea526269eea6f87a033f7cbfe86586782c6ca4ee7c7c4097a9
2021-09-27 14:48:33 +02:00
W. J. van der Laan
16a5997336
Merge bitcoin/bitcoin#22579: doc: Add references for the generator/constant used in Bech32(m)
b8cd2a4292 Add references for the generator/constant used in Bech32(m) (Pieter Wuille)

Pull request description:

  I often find myself recreating this, or looking up references for this construction. So instead, this seems like as good a place as any to place a summary.

ACKs for top commit:
  Zero-1729:
    crACK b8cd2a4292

Tree-SHA512: 9d2001c5016485cea441c28fda093d67a7d4274e4c1e4dd3d357353ce6a52987e38d684d8462bad2d72ba0b6b1db2f809948e228fb02371e64b12146aace89bd
2021-09-27 14:34:04 +02:00
W. J. van der Laan
07e743edd0
Merge bitcoin/bitcoin#22892: doc: Clarify that change_cost cannot be negative in GetSelectionWaste
d2eccacd18 doc: Clarify that change_cost cannot be negative in GetSelectionWaste (benthecarman)

Pull request description:

  We assert that the `change_cost` must be positive so we should document it in the function's docs

  4f5ad43b1e/src/wallet/coinselection.cpp (L361)

ACKs for top commit:
  jonatack:
    ACK d2eccacd18
  jarolrod:
    ACK d2eccacd18
  shaavan:
    ACK d2eccacd18

Tree-SHA512: 089bc41d7e212b811455527ce2ac83301eae0edc03933dcbd5229b22078827395c8e3bcfda0ba029b7c60705db3119b4f80e372842a6bd8dae195dbaa0b52833
2021-09-27 14:24:06 +02:00
Russell Yanofsky
93b9800fec scripted-diff: Rename overloaded int GetArg to GetIntArg
Improve readability of code, simplify future scripted diff cleanup PRs, and be
more consistent with naming for GetBoolArg.

This will also be useful for replacing runtime settings type checking
with compile time checking.

-BEGIN VERIFY SCRIPT-
git grep -l GetArg | xargs sed -i 's/GetArg(\([^)]*\( [0-9]\+\|-1\|port\|BaseParams().RPCPort()\|Params().GetDefaultPort()\|_TIMEOUT\|Height\|_WORKQUEUE\|_THREADS\|_CONNECTIONS\|LIMIT\|SigOp\|Bytes\|_VERSION\|_AGE\|_CHECKS\|Checks() ? 1 : 0\|_BANTIME\|Cache\|BLOCKS\|LEVEL\|Weight\|Version\|BUFFER\|TARGET\|WEIGHT\|TXN\|TRANSACTIONS\|ADJUSTMENT\|i64\|Size\|nDefault\|_EXPIRY\|HEIGHT\|SIZE\|SNDHWM\|_TIME_MS\)\))/GetIntArg(\1)/g'
-END VERIFY SCRIPT-

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2021-09-27 06:57:20 -04:00
W. J. van der Laan
8b523f2e55
Merge bitcoin/bitcoin#23094: doc: Remove outdated comments
ee7891a0c4 doc: Remove outdated comments (Hennadii Stepanov)

Pull request description:

  The first removed comment was introduced in #5288, the second one in #13503.

  Both are outdated since #14336.

ACKs for top commit:
  duncandean:
    crACK ee7891a0

Tree-SHA512: a2d6071919e81c916bfc2178109bbc464417321bcc567ed0644448c5faea8e58cb08a7657afa1b6ffe1fb63e114a2a47b31c893e471839ba9d49a3986e68b2a7
2021-09-27 12:57:20 +02:00
merge-script
632be5514c
Merge bitcoin/bitcoin#23061: Fix (inverse) meaning of -persistmempool
faa9c19a4b doc: Add 23061 release notes (MarcoFalke)
faff17bbde Fix (inverse) meaning of -persistmempool (MarcoFalke)

Pull request description:

  Passing `-persistmempool` is currently treated as `-nopersistmempool`

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

Tree-SHA512: f34a89a07745dabe340eb845b2a348b79c093e9056f7a21c17e1ba2e278177c9b4cf30e8095791fd645a7f90eb34850b2eee0c869b4f6ec02bf749c73b0e52ee
2021-09-27 10:12:14 +02:00
Hennadii Stepanov
ee7891a0c4
doc: Remove outdated comments
They are outdated since #14336.
2021-09-25 14:19:24 +03:00
Andrew Chow
3633b667ff Use SelectCoinsSRD if it has less waste
Try to find a solution with SelectCoinsSRD. If we do have one, add it to
the list of solutions from which we choose the one with the least waste
as the solution to use.
2021-09-23 13:33:25 -04:00
Andrew Chow
8bf789b4b4 Add SelectCoinsSRD function 2021-09-23 13:33:25 -04:00
MarcoFalke
faff17bbde
Fix (inverse) meaning of -persistmempool 2021-09-22 11:29:44 +02:00
Sjors Provoost
dc10ca346b
net: switch to signet DNS seed
This commit also drops a seed node that no longer exists.
2021-09-17 21:22:32 +02:00
benthecarman
d2eccacd18
doc: Clarify that change_cost cannot be negative in GetSelectionWaste 2021-09-05 12:55:54 -05:00
Russell Yanofsky
6919c823cb MOVEONLY: Expose BanMapToJson / BanMapFromJson
CSubNet serialization code that was removed in
fa4e6afdae was needed by multiprocess code
to share ban map between gui and node processes.

Rather than adding it back, use suggestion from MarcoFalke
<falke.marco@gmail.com>
https://github.com/bitcoin/bitcoin/pull/10102#discussion_r690922929 to
use JSON serialization. This requires making BanMapToJson /
BanMapFromJson functions public.
2021-09-03 05:21:58 -04:00
Samuel Dobson
629c4ab2e3
Merge bitcoin/bitcoin#22100: refactor: Clean up new wallet spend, receive files added #21207
b11a195ef4 refactor: Detach wallet transaction methods (followup for move-only) (Russell Yanofsky)

Pull request description:

  This makes `CWallet` and `CWalletTx` methods in `spend.cpp` and `receive.cpp` files into standalone functions.

  It's a followup to [#21207 MOVEONLY: CWallet transaction code out of wallet.cpp/.h](https://github.com/bitcoin/bitcoin/pull/21207), which moved code from `wallet.cpp` to new `spend.cpp` and `receive.cpp` files.

  There are no changes in behavior. This is just making methods into functions and removing circular dependencies created by #21207. There are no comment or documentation changes, either. Removed comments from `transaction.h` are just migrated to `spend.h`, `receive.h`, and `wallet.h`.

  ---

  This commit was split off from #21206 so there are a few earlier review comments there

ACKs for top commit:
  achow101:
    ACK b11a195ef4
  Sjors:
    utACK b11a195ef4
  meshcollider:
    light ACK b11a195ef4

Tree-SHA512: 75ce818d3f03b728b14b12e2d21bd20b7be73978601989cb37ff98254393300d1bb7823281449cd3d9e40756d67d42bd9a46bbdafd2e8baa95aaf2cb1c84549f
2021-09-03 21:21:58 +12:00
Hennadii Stepanov
d319c4dae9
qt, refactor: Replace WalletFrame::addWallet with WalletFrame::addView
No need to pass an instance of the WalletModel class to this method.

Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
2021-09-03 00:27:14 +03:00
MarcoFalke
dd097c42df
Merge bitcoin/bitcoin#18448: rpc: fix/add missing RPCExamples for "Util" RPCs
ea98d9c2ef rpc: fix/add missing RPCExamples for "Util" RPCs (Sebastian Falbesoner)

Pull request description:

  Similar to https://github.com/bitcoin/bitcoin/pull/18398, this PR gives the RPCExamples in the RPC category "Util" (that currently contains `createmultisig`, `deriveaddresses`, `estimatesmartfee`, `getdescriptorinfo`, `signmessagewithprivkey`, `validateaddress`, `verifymessage`) some love by fixing one broken and adding three missing examples:
  - fixed `HelpExampleRpc` for `createmultisig` (disturbing escape characters and quotation marks)
  - added missing `HelpExampleRpc` for
      -  `deriveaddresses` (also put descriptor in a new string constant)
      - `estimatesmartfee`
      - `getdescriptorinfo` (also put descriptor in a new string constant)

  Output for `createmultisig` example on the master branch:
  ```
  $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createmultisig", "params": [2, "[\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  Enter host password for user '__cookie__':
  {"result":null,"error":{"code":-1,"message":"JSON value is not an array as expected"},"id":"curltest"}
  ```

  Output for `createmultisig` example on the PR branch:
  ```
  $ curl --user __cookie__ --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createmultisig", "params": [2, ["03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd","03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626"]]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
  Enter host password for user '__cookie__':
  {"result":{"address":"3QsFXpFJf2ZY6GLWVoNFFd2xSDwdS713qX","redeemScript":"522103789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd2103dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a6162652ae","descriptor":"sh(multi(2,03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd,03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626))#4djp057k"},"error":null,"id":"curltest"}
  ```

ACKs for top commit:
  jonatack:
    ACK ea98d9c2ef looked at the code, rebased to master, ran the helps, did not try running the added json-rpc examples

Tree-SHA512: d6ecb6da66f19517065453357d210102e2cc9f1f8037aeb6a9177ff036d0c21773dddf5e0acdbc71edbbde3026e4d1e7ce7c0935cd3e023c60f34e1b173b3299
2021-09-02 18:04:54 +02:00
glozow
32748da0f4 whitespace fixups after move and scripted-diff 2021-09-02 16:23:27 +01:00
glozow
fa47622e8d scripted-diff: rename variables in policy/rbf
"Fee Delta" is already a term used for prioritizing transactions:
modified = base fees + delta

Here, delta also means the difference between original and modified replacement fees:
nDeltaFees = (original_base + original_delta) - (replacement_base + replacement_delta)

This is insanely confusing. Also, since mempool is no longer a member of a
class (MemPoolAccept.m_pool), the "m" prefix is unnecessary. The rest are
clarity/style-focused changes to already-touched lines.

-BEGIN VERIFY SCRIPT-

ren() { sed -i "s/\<$1\>/$2/g" src/policy/rbf* ; }

ren nDeltaFees additional_fees
ren m_pool pool

ren nSize replacement_vsize
ren nModifiedFees replacement_fees
ren nConflictingFees original_fees
ren oldFeeRate original_feerate
ren newFeeRate replacement_feerate

ren setAncestors ancestors
ren setIterConflicting iters_conflicting
ren setConflictsParents parents_of_conflicts
ren setConflicts direct_conflicts
ren allConflicting all_conflicts

sed -i "s/ hash\b/ txid/g" src/policy/rbf*
-END VERIFY SCRIPT-
2021-09-02 16:23:27 +01:00
glozow
ac761f0a23 MOVEONLY: fee checks (Rules 3 and 4) to policy/rbf 2021-09-02 16:23:27 +01:00
glozow
9c2f9f8984 MOVEONLY: check that fees > direct conflicts to policy/rbf 2021-09-02 16:23:27 +01:00
glozow
3f033f01a6 MOVEONLY: check for disjoint conflicts and ancestors to policy/rbf
This checks that a transaction isn't trying to replace something it
supposedly depends on.
2021-09-02 16:23:27 +01:00
glozow
7b60c02b7d MOVEONLY: BIP125 Rule 2 to policy/rbf 2021-09-02 16:23:26 +01:00
glozow
f8ad2a57c6 Make GetEntriesForConflicts return std::optional
Avoids reusing err_string.
2021-09-02 16:23:25 +01:00
W. J. van der Laan
a70768d159
Merge bitcoin/bitcoin#22501: netinfo: display addr_{processed, rate_limited, relay_enabled} and relaytxes data
218862a018 Display peers in -netinfo that we don't relay addresses to (Jon Atack)
3834e23b25 Display peers in -netinfo that request we not relay transactions (Jon Atack)
0a9ee3a2c7 Simplify a few conditionals in -netinfo (Jon Atack)
5eeea8e257 Add addr_processed and addr_rate_limited stats to -netinfo (Jon Atack)

Pull request description:

  Update CLI -netinfo to display the getpeerinfo `addr_processed`, `addr_rate_limited`, `addr_relay_enabled` and `relaytxes` data with auto-adjusting column widths.

  ```
  $ ./src/bitcoin-cli -netinfo help

    txn      Time since last novel transaction received from the peer and accepted into our mempool, in minutes
             "*" - the peer requested we not relay transactions to it (relaytxes is false)

    addrp    Total number of addresses processed, excluding those dropped due to rate limiting
             "." - we do not relay addresses to this peer (addr_relay_enabled is false)

    addrl    Total number of addresses dropped due to rate limiting
  ```

  ![Screenshot from 2021-08-22 14-31-40](https://user-images.githubusercontent.com/2415484/130355514-f6fd4f21-79d6-463b-9791-de01ebef20b1.png)

ACKs for top commit:
  0xB10C:
    Code review and tested ACK 218862a018
  Zero-1729:
    re-tACK 218862a018
  vasild:
    ACK 218862a018
  jarolrod:
    tACK 218862a018

Tree-SHA512: bb9da4bdd71859b234f6e4c2c46257a57ef0d0e0b363d2b8fded128bcaa28132f64a0a4651c622e1de1e3b7c05c7587a4369e9e79799895884fda9745c63409d
2021-09-02 17:12:48 +02:00
MarcoFalke
fa0937de35
test: Rename bitcoin-util-test.py to util/test_runner.py
To normalize the name of all three test runners (fuzz, functional, util).
2021-09-02 10:43:19 +02:00
MarcoFalke
fa1b08eb14
test: Always clear reject reason in IsStandard tx test 2021-09-02 09:40:07 +02:00
MarcoFalke
6bf706a056
Merge bitcoin/bitcoin#22846: policy: unit test Segwit dust thresholds
97cea1a93a policy: unit test Segwit dust thresholds (Antoine Poinsot)

Pull request description:

  This is the unit testing part of #22779, hence without the threshold modification.

ACKs for top commit:
  MarcoFalke:
    cr ACK 97cea1a93a
  benthecarman:
    crACK 97cea1a93a

Tree-SHA512: 96fb194709ae44364455eb920ed3ecff2e11e5327e0a72b9eeec9f9445894302099a0c4ffb1e0c8d4d523c0bfe06c57f1ebb0c03cf3389a73f518e3b174c45aa
2021-09-02 09:03:11 +02:00
practicalswift
696c76d660
tests: Add TrimString(...) tests 2021-09-02 13:20:08 +08:00
Ben Woosley
4bf18b089e
Replace use of boost::trim_right with locale-independent TrimString
Note the only use of readStdin is fed to DecodeHexTx, which fails in
IsHex on non-hex characters as recorded in p_util_hexdigit.
2021-09-02 13:19:42 +08:00
Ben Woosley
93551862a1
Replace use of boost::trim use with locale-independent TrimString 2021-09-02 13:17:46 +08:00
fanquake
43bf824ff2
Merge bitcoin/bitcoin#22853: fuzz: Remove addrdb fuzz target
fa18553d38 fuzz: Remove addrdb fuzz target (MarcoFalke)

Pull request description:

  The target has several issues:
  * It is named incorrectly (`addrdb`, but it constructs a `CBanEntry`)
  * It doesn't do anything meaningful, other than consuming one integer and passing it to a constructor
  * It consumes CPU time that can be used for the other targets
  * It is redundant with the banman fuzz target

  Fix all by removing it.

ACKs for top commit:
  amitiuttarwar:
    ACK fa18553d38, thanks for the cleanup

Tree-SHA512: 3f8944d3f80913bf466c03062fed070e96073fb72d0938b2bc9a2586960c86879d6f251e16fd81cfeb4e6685ff9eef6bccb25cd3901b218a100c90f25a3c9240
2021-09-02 10:45:53 +08:00
fanquake
01fa1481f9
Merge bitcoin/bitcoin#22836: Stricter BIP32 decoding and test vector 5
56a42f10f4 Stricter BIP32 decoding and test vector 5 (Pieter Wuille)

Pull request description:

  This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed https://github.com/bitcoin/bips/pull/921 BIP32 test vector 5.

ACKs for top commit:
  darosior:
    utACK 56a42f10f4 -- Had to implement essentially the same fix in python-bip32.
  kristapsk:
    ACK 56a42f10f4. Checked that test vectors are the same as in BIP32 and that tests pass.

Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
2021-09-02 10:41:16 +08:00
Samuel Dobson
9a86327512
Merge bitcoin/bitcoin#22512: Consolidate XOnlyPubKey lookup hack
d9d3ec07cf Consolidate XOnlyPubKey lookup hack (Andrew Chow)

Pull request description:

  The places where we need to lookup information for a XOnlyPubKey
  currently implement a hack which makes both serializations of the full
  pubkey in order to try the CKeyIDs for the lookup functions. Instead of
  duplicating this everywhere it is needed, we can consolidate the CKeyID
  generation into a function, and then have wrappers around GetPubKey,
  GetKey, and GetKeyOrigin which takes the XOnlyPubKey, retrieves all of
  the CKeyIDs (using the new GetKeyIDs() function in XOnlyPubKey), and
  tries their respective underlying lookup function.

  Split from #22364

ACKs for top commit:
  S3RK:
    Code Review reACK d9d3ec0
  Zero-1729:
    re-crACK d9d3ec0
  theStack:
    re-ACK d9d3ec07cf
  meshcollider:
    Code review + functional test run ACK d9d3ec07cf

Tree-SHA512: 21a7f6d37fad74483a38006f82b3558337fe9ed30e0b4392e6fff82c22251a42ac996b43f06cdaa9289ee34a768e181d87aa4208b5538e36ae4977954e1fa6a0
2021-09-02 13:31:10 +12:00
Jon Atack
7e69873283
sync: remove DEBUG_LOCKCONTENTION preprocessor directives
to allow logging the lock contentions without the need to define
DEBUG_LOCKCONTENTION at compile time.
2021-09-01 15:26:35 +02:00
Jon Atack
9b08006bc5
log, sync: improve lock contention logging and add time duration
in microseconds.

Change the function name in order to print "LockContention" instead
of "PrintLockContention" to the log.  Add Doxygen documentation.

With this change, the lock contention log prints:

2021-09-01T11:29:03Z LockContention: pnode->cs_vSend, net.cpp:1373 started
2021-09-01T11:29:03Z LockContention: pnode->cs_vSend, net.cpp:1373 completed (31μs)
2021-09-01T11:29:03Z LockContention: cs_vNodes, net.cpp:2277 started
2021-09-01T11:29:03Z LockContention: cs_vNodes, net.cpp:2277 completed (6μs)
2021-09-01T11:29:04Z LockContention: cs_vNodes, net.cpp:2242 started
2021-09-01T11:29:04Z LockContention: cs_vNodes, net.cpp:2242 completed (3μs)

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Co-authored-by: practicalswift <practicalswift@users.noreply.github.com>
2021-09-01 15:25:38 +02:00
Jon Atack
3f4c6b87f1
log, timer: add timing macro in usec LOG_TIME_MICROS_WITH_CATEGORY
and update BCLog::LogMsg() to omit irrelevant decimals for microseconds
and skip unneeded code and math.
2021-09-01 15:12:52 +02:00
MarcoFalke
fa18553d38
fuzz: Remove addrdb fuzz target 2021-09-01 09:43:06 +02:00
Russell Yanofsky
b11a195ef4 refactor: Detach wallet transaction methods (followup for move-only)
Followup to commit "MOVEONLY: CWallet transaction code out of
wallet.cpp/.h" that detaches and renames some CWalletTx methods, making
into them into standalone functions or CWallet methods instead.

There are no changes in behavior and no code changes that aren't purely
mechanical. It just gives spend and receive functions more consistent
names and removes the circular dependencies added by the earlier
MOVEONLY commit.

There are also no comment or documentation changes. Removed comments
from transaction.h are just migrated to spend.h, receive.h, and
wallet.h.
2021-09-01 02:22:58 -05:00
MarcoFalke
b3a2b8c29f
Merge bitcoin/bitcoin#22849: Remove unused SERIALIZE_METHODS for CBanEntry
fa3bd9de99 Remove CBanEntry::SetNull (MarcoFalke)
fab53ff1e5 Remove unused SERIALIZE_METHODS for CBanEntry (MarcoFalke)

Pull request description:

  It would be confusing to keep unused and dead code.

ACKs for top commit:
  ryanofsky:
    Code review ACK fa3bd9de99.
  theStack:
    Code-review ACK fa3bd9de99

Tree-SHA512: 85ab8de2ad1ada08e745806f2992def08bf8ead268caed7700a9fc61e3c7646e4ed7ae50a6d591c5bb9467f8999ea063ce5b5bd4fa0d58d8fc9d89e5a91f35a5
2021-09-01 09:22:58 +02:00
Samuel Dobson
70676e40d8
Merge bitcoin/bitcoin#22009: wallet: Decide which coin selection solution to use based on waste metric
86beee0579 Use waste metric for deciding which selection to use (Andrew Chow)
b3df0caf7c tests: Test GetSelectionWaste (Andrew Chow)
4f5ad43b1e Add waste metric calculation function (Andrew Chow)
935b3ddf72 scripted-diff: tests: Use KnapsackSolver directly (Andrew Chow)
6a023a6f90 tests: Add KnapsackGroupOutputs helper function (Andrew Chow)
d5069fc1aa tests: Use SelectCoinsBnB directly instead of AttemptSelection (Andrew Chow)
54de7b4746 Allow the long term feerate to be configured, default of 10 sat/vb (Andrew Chow)

Pull request description:

  Branch and Bound introduced a metric that we call waste. This metric is used as part of bounding the search tree, but it can be generalized to all coin selection solutions, including those with change. As such, this PR introduces the waste metric at a higher level so that we can run both of our coin selection algorithms (BnB and KnapsackSolver) and choose the one which has the least waste. In the event that both find a solution with the same change, we choose the one that spends more inputs.

  Also this PR sets the long term feerate to 10 sat/vb rather than using the 1008 block estimate. This allows the long term feerate to be the feerate that we switch between consolidating and optimizing for fees. This also removes a bug where the long term feerate would incorrectly be set to the fallback fee. While this doesn't matter prior to this PR, it does have an effect following this. The long term feerate can be configured by the user through a new `-consolidatefeerate` option.

ACKs for top commit:
  Xekyo:
    reACK 86beee0 via git range-diff fe47558...86beee0
  meshcollider:
    re-utACK 86beee0579

Tree-SHA512: 54b154b346538eca68ae2a3b83a033b495c1605c14f842bfc43ded2256b110983ce674c647fe753cf0305b1b178403d8d60d6d4203c7a712bec784be52e90d42
2021-09-01 16:59:13 +12:00
fanquake
a820e79512
Merge bitcoin/bitcoin#22740: [addrman] Move serialization code to cpp
85b15ddc8f [refactor] [addrman] Update constant comments (John Newbery)
af9638a0fb [move-only] Extract constants from addrman .h to .cpp (Amiti Uttarwar)
7dc443a62d [addrman] Change addrman #define constants to be constexprs (Amiti Uttarwar)
a65053f1d4 [addrman] Move CAddrMan::Unserialize to cpp file (John Newbery)
1622543cf4 [addrman] Move CAddrMan::Serialize to cpp file (John Newbery)

Pull request description:

  Moving the serialization code from the header to the cpp helps clarify interfaces vs internals, as well as speed up the compilation of the whole program with a smaller header file.

ACKs for top commit:
  jnewbery:
    Code review ACK 85b15ddc8f
  0xB10C:
    Code review ACK 85b15ddc8
  mzumsande:
    Code Review ACK 85b15ddc8f (+ performed some light testing)

Tree-SHA512: a1aac25155601dd0ffd073b37388d9062c3d82c499821bd7ee883286cbc5dc0c7ae87f127c127778dae290006b98166640dc974d1953f3f34c53a67cf7b21613
2021-09-01 10:51:54 +08:00
MarcoFalke
fa3bd9de99
Remove CBanEntry::SetNull 2021-08-31 18:30:11 +02:00
MarcoFalke
fab53ff1e5
Remove unused SERIALIZE_METHODS for CBanEntry 2021-08-31 18:13:10 +02:00
Antoine Poinsot
97cea1a93a
policy: unit test Segwit dust thresholds
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-08-31 16:51:38 +02:00
fanquake
81f4a3e84d
Merge bitcoin/bitcoin#22796: RBF move (1/3): extract BIP125 Rule 5 into policy/rbf
f293c68be0 MOVEONLY: getting mempool conflicts to policy/rbf (glozow)
8d71796335 [validation] quit RBF logic earlier and separate loops (glozow)
badb9b11a6 call SignalsOptInRBF instead of checking all inputs (glozow)
e0df41d7d5 [validation] default conflicting fees and size to 0 (glozow)
b001b9f6de MOVEONLY: BIP125 max conflicts limit to policy/rbf.h (glozow)

Pull request description:

  See #22675 for motivation, this is one chunk of it. It extracts some BIP125 logic into policy/rbf:

  - Defines a constant for specifying the maximum number of mempool entries we'd consider replacing by RBF
  - Calls the available `SignalsOptInRBF` function instead of manually iterating through inputs
  - Moves the logic for getting the list of conflicting mempool entries to a helper function
  - Also does a bit of preparation for future moves - moving declarations around, etc
  Also see #22677 for addressing the circular dependency.

ACKs for top commit:
  jnewbery:
    Code review ACK f293c68be0
  theStack:
    Code-review ACK f293c68be0 📔
  ariard:
    ACK f293c68b

Tree-SHA512: a60370994569cfc91d4b2ad5e94542d4855a48927ae8b174880216074e4fa50d4523dd4ee36efdd6edf2bf7adb87a8beff9c3aaaf6dd323b286b287233e63790
2021-08-31 22:34:25 +08:00
Pieter Wuille
56a42f10f4 Stricter BIP32 decoding and test vector 5 2021-08-30 12:02:04 -04:00
Sebastian Falbesoner
0bd882b740 refactor: remove RecursiveMutex cs_nBlockSequenceId
The RecursiveMutex cs_nBlockSequenceId is only used at one place in
CChainState::ReceivedBlockTransactions() to atomically read-and-increment the
nBlockSequenceId member. At this point, the cs_main lock is set, hence we can
use a plain int for the member and mark it as guarded by cs_main.
2021-08-29 13:31:00 +02:00
Andrew Chow
86beee0579 Use waste metric for deciding which selection to use
Instead of always choosing BnB if it finds a solution, always do both
BnB and KnapsackSolver and choose the one which has the least waste.
2021-08-27 12:46:19 -04:00
Andrew Chow
b3df0caf7c tests: Test GetSelectionWaste
Tests for some waste calculation scenarios

add_coin is modified to allow fee and long term fee to be set for an
added CInputCoin.
2021-08-27 12:46:17 -04:00
Andrew Chow
4f5ad43b1e Add waste metric calculation function 2021-08-27 12:46:06 -04:00
Andrew Chow
935b3ddf72 scripted-diff: tests: Use KnapsackSolver directly
When doing the coin selector tests for KnapsackSolver, call it directly
instead of using AttemptSelection and hoping/instructing it uses
KnapsackSolver.

-BEGIN VERIFY SCRIPT-
sed -i 's/testWallet\.AttemptSelection( /KnapsackSolver(/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/testWallet\.AttemptSelection(/KnapsackSolver(/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/, filter_standard, vCoins, setCoinsRet, nValueRet, coin_selection_params)/, KnapsackGroupOutputs(filter_standard), setCoinsRet, nValueRet)/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/, filter_confirmed, vCoins, setCoinsRet, nValueRet, coin_selection_params)/, KnapsackGroupOutputs(filter_confirmed), setCoinsRet, nValueRet)/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/, filter_standard_extra, vCoins, setCoinsRet, nValueRet, coin_selection_params)/, KnapsackGroupOutputs(filter_standard_extra), setCoinsRet, nValueRet)/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/BOOST_CHECK( /BOOST_CHECK(/g' src/wallet/test/coinselector_tests.cpp
-END VERIFY SCRIPT-
2021-08-27 12:46:06 -04:00
Andrew Chow
6a023a6f90 tests: Add KnapsackGroupOutputs helper function
In order to change the KnapsackSolver tests to call KnapsackSolver, we
need KnapsackGroupOutputs to create the OutputGroups filtered with the
filter criteria.
2021-08-27 12:46:06 -04:00
Andrew Chow
d5069fc1aa tests: Use SelectCoinsBnB directly instead of AttemptSelection
Instead of calling AttemptSelection with the hopes/instruction that it
uses BnB, call SelectCoinsBnB directly to test it.
2021-08-27 12:46:06 -04:00
Andrew Chow
54de7b4746 Allow the long term feerate to be configured, default of 10 sat/vb
The long term feerate is really the highest feerate that the user is
comfortable with making consolidatory transactions. This is should thus
be something that can be configured by the user via a new startup option
-consolidatefeerate. The default value is 10 sat/vbyte, chosen
arbitrarily (it seems like a reasonable number).
2021-08-27 12:46:04 -04:00
John Newbery
724c497562 [fuzz] Add ConsumeAsmap() function 2021-08-27 11:01:45 +01:00
John Newbery
5840476714 [addrman] Make m_asmap private
Add a GetAsmap() getter function that returns a reference to const.
2021-08-27 11:01:43 +01:00
John Newbery
f9002cb5db [net] Rename the copyStats arg from m_asmap to asmap
The m_ prefix indicates that a variable is a data member. Using it as
a parameter name is misleading.

Also update the name of the function from copyStats to CopyStats to
comply with our style guide.
2021-08-27 10:55:44 +01:00
John Newbery
f572f2b204 [addrman] Set m_asmap in CAddrMan initializer list
This allows us to make it const.
2021-08-27 10:55:41 +01:00
MarcoFalke
33707a2a88
Merge bitcoin/bitcoin#22782: Remove unused MaybeSetAddrName
fa9eade142 Remove GetAddrName (MarcoFalke)
fa786570a5 Remove unused RecursiveMutex cs_addrName (MarcoFalke)
fa82f4ea96 Remove unused MaybeSetAddrName (MarcoFalke)

Pull request description:

  .

ACKs for top commit:
  jnewbery:
    Code review ACK fa9eade142
  naumenkogs:
    utACK fa9eade142

Tree-SHA512: 61501a699add59225dc8127b6dfdda450d768c86f958fdf94e9c28309c3705ecfbee4b064d44228b8c1190c19c39272becc7ede8386ac1406699ea2285881c72
2021-08-27 11:46:26 +02:00
W. J. van der Laan
19364c0ddf
Merge bitcoin/bitcoin#20586: Fix Windows build with --enable-werror
b367745cfe ci: Make Cirrus CI Windows build with --enable-werror (Hennadii Stepanov)
c713bb2b24 Fix Windows build with --enable-werror on Ubuntu Focal (Hennadii Stepanov)

Pull request description:

  This PR makes possible to cross-compile Windows build with `--enable-werror --enable-suppress-external-warnings`.
  Some problems are fixed, others are silenced.

  Also `--enable-werror` is enabled for Cirrus CI Windows build (the last one on Cirrus CI without `--enable-werror`).

ACKs for top commit:
  practicalswift:
    cr ACK b367745cfe: patch looks correct
  laanwj:
    Code review ACK b367745cfe
  vasild:
    ACK b367745cfe
  jarolrod:
    ACK b367745cfe

Tree-SHA512: 64f5c99b7dad4c0efce80cd45d7074f275bd8411235dc9e0841287bdab64b812c6f8f9d632c35531d0b8210148531f53aaaac77be7699b29d2d6aaae304dbee0
2021-08-27 08:31:45 +02:00
fanquake
adccbb380b
Merge bitcoin/bitcoin#21862: test: Set regtest.BIP65Height = 111 to speed up tests
faf7e485e9 Set regtest.BIP65Height = 111 to speed up tests (MarcoFalke)

Pull request description:

  No need to waste time by forcing creation of more than 1000 blocks to get the benefits of being able to test BIP 65. Also, reducing the height makes it more likely that (third-party) tests are conforming to BIP 65, which is enforced on mainnet for all new blocks.

ACKs for top commit:
  theStack:
    re-ACK faf7e485e9 📍
  Zero-1729:
    re-ACK faf7e485e9
  kristapsk:
    ACK faf7e485e9

Tree-SHA512: 79a8263e7233838666b9b636b496a8b9eb12398c779f9434677e1d62816732c0a7c7b3e73965be1fb0038d35e05e5a90e665bd74e9610104127dfc4ea38169bf
2021-08-27 07:53:25 +08:00
Hennadii Stepanov
b8d45a3c20
Merge bitcoin-core/gui#384: Add copy IP/Netmask action for banned peer
ab1461d5d3 qt: Add copy IP/Netmask action for banned peer (Shashwat)

Pull request description:

  This PR adds a Copy IP/Netmask context menu action to the Banned Peers Table.

  This feature is helpful if a node using GUI might want to alert its peer about a particular malicious user. So it can copy that user’s IP/Netmask and broadcast it to its peers so they can ban it instantly using the setban command in the console.

  | Master        | PR               |
  | ----------- | ----------- |
  | ![Screenshot_from_2021-07-21_00-01-331](https://user-images.githubusercontent.com/23396902/126377808-bd23bb19-3f47-4f1b-8371-39baa9747bbe.png) | ![Screenshot from 2021-08-20 20-13-28(1)(1)](https://user-images.githubusercontent.com/85434418/130251441-a8d0f816-a2e9-4e63-a22d-94885c5cec98.png) |

ACKs for top commit:
  jarolrod:
    re-ACK ab1461d
  hebasto:
    re-ACK ab1461d5d3, tested on Linux Mint 20.2 (Qt 5.12.8).

Tree-SHA512: a528f089bd4cb5b51fec987550d21c2587459ad80f854b55850bc62c776c21f3fa31052a17e2b0e9e9d0b3468799c8070ed306543730fb7b324f283847151e17
2021-08-26 22:51:46 +03:00
John Newbery
85b15ddc8f [refactor] [addrman] Update constant comments
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-08-26 11:56:13 -07:00
Amiti Uttarwar
af9638a0fb [move-only] Extract constants from addrman .h to .cpp
Reviewer hint: use `git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space`

Co-authored-by: John Newbery <john@johnnewbery.com>
2021-08-26 11:56:13 -07:00
Amiti Uttarwar
7dc443a62d [addrman] Change addrman #define constants to be constexprs
Co-authored-by: John Newbery <john@johnnewbery.com>
2021-08-26 11:56:13 -07:00
John Newbery
a65053f1d4 [addrman] Move CAddrMan::Unserialize to cpp file
Reviewer hint: use `git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space`

Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-08-26 11:53:44 -07:00
John Newbery
1622543cf4 [addrman] Move CAddrMan::Serialize to cpp file
Reviewer hint: use `git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space`

Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-08-26 11:53:34 -07:00
Shashwat
ab1461d5d3 qt: Add copy IP/Netmask action for banned peer
This adds a copy IP/Netmask context menu action for peers in the banned peer table
2021-08-26 23:33:27 +05:30
Hennadii Stepanov
92ddc02a16
qt, refactor: Declare getWalletModel with const and noexcept qualifiers 2021-08-26 16:28:00 +03:00
Hennadii Stepanov
ca0e680bdc
qt, refactor: Drop redundant checks of walletModel
The walletModel member is set in the WalletView constructor now.
2021-08-26 16:28:00 +03:00
Hennadii Stepanov
404373bc6a
qt, refactor: Pass WalletModel object to WalletView constructor
An instance of the WalletView class without walletModel data member
being set is invalid. So, it is better to set it in the constructor.
2021-08-26 16:27:56 +03:00
Hennadii Stepanov
774a4f517c
Merge bitcoin-core/gui#403: refactor: Make paths to update Encryption and HD wallet statuses simpler
b8aa84b1a1 qt, refactor: Replace `if` check with `assert` (Hennadii Stepanov)
fcdc8b0fcb qt, refactor: Drop redundant signalling in WalletView::setWalletModel (Hennadii Stepanov)
37dcf161d3 qt, refactor: Emit WalletView::encryptionStatusChanged signal directly (Hennadii Stepanov)
7d0d4c0490 qt: Add WalletFrame::currentWalletSet signal (Hennadii Stepanov)

Pull request description:

  This PR makes signal-slot paths to reach `setHDStatus` and `setEncryptionStatus` functions shorter and easier to reason about them.

  Required to simplify #398 (see https://github.com/bitcoin-core/gui/pull/398#discussion_r686094883).

  ---

  **Note for reviewers.** Please verify that "Encrypt Wallet..." menu item, and the following icons

  ![DeepinScreenshot_select-area_20210811202120](https://user-images.githubusercontent.com/32963518/129074601-13fa998a-ac47-4ad2-be00-ba400b12c18a.png)

  and updated properly in each and every possible scenario.

ACKs for top commit:
  jarolrod:
    tACK b8aa84b1a1
  Talkless:
    Code review ACK b8aa84b1a1. Did build on Debian Sid with Qt 5.15.2 but no actual testing performed.
  ryanofsky:
    Code review ACK b8aa84b1a1. Only change since last review was rebase

Tree-SHA512: 275737cdba02baff71049df41bc24089e916f96326dd2dea26ec607c7949cb3aae368eeabbe3ad5a0a27651503a1d65536873726de854c5f6af259bcc29727e7
2021-08-26 15:56:18 +03:00
W. J. van der Laan
7740ebcb02
Merge bitcoin/bitcoin#22648: doc, test: improve i2p/tor docs and i2p reachable unit tests
017597767b Add I2P network SetReachable/IsReachable unit test assertions (Jon Atack)
b87a9c4d13 Improve doc/i2p.md regarding I2P router options/versions (Jon Atack)
bebcf785c0 Update i2p.md and tor.md regarding -onlynet config option (Jon Atack)

Pull request description:

  This pull addresses https://github.com/bitcoin/bitcoin/issues/22634#issuecomment-894104681 and various user feedback/questions, updates the -onlynet documentation in doc/i2p.md and doc/tor.md per #22651 (src/init.cpp is already fine) and fills in some missing I2P unit test coverage.

  Note: this PR depends in part on whether #22651 is merged in order to propose the correct -onlynet documentation (it is currently aligned with the change in #22651), so that PR should be decided or merged first.

ACKs for top commit:
  Rspigler:
    Re-ACK 017597767b
  prayank23:
    reACK 017597767b
  vasild:
    ACK 017597767b

Tree-SHA512: ae606437522bfccdfb7508108cddc7dfede2385e30a0561dbd007b784ed2639962c28552eb0e9336412faa323637fe964c26b8d8fc6dcf9fc63734ac00d05736
2021-08-26 12:44:46 +02:00
MarcoFalke
faf7e485e9
Set regtest.BIP65Height = 111 to speed up tests 2021-08-26 11:08:24 +02:00
MarcoFalke
fa9eade142
Remove GetAddrName
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines.html#c131-avoid-trivial-getters-and-setters
2021-08-26 10:44:26 +02:00
MarcoFalke
fa786570a5
Remove unused RecursiveMutex cs_addrName 2021-08-26 10:27:52 +02:00
fanquake
3a62b8b77e
Merge bitcoin/bitcoin#22713: Fix build with Boost 1.77.0
acb7aad27e Fix build with Boost 1.77.0 (Rafael Sadowski)

Pull request description:

  BOOST_FILESYSTEM_C_STR changed to accept the path as an argument.

ACKs for top commit:
  hebasto:
    ACK acb7aad27e
  benthecarman:
    ACK acb7aad27e
  fanquake:
    ACK acb7aad27e - tested the fix with Boost 1.77.0 and 1.71.0.

Tree-SHA512: c25fcb56971ee7a448cfb074f8a13696b32c16c63f81076f8a76911f93aa849c8f3637555b0b4215fa0d8b958641d7e4e60d10e103b833545cbc6b1f4009b526
2021-08-26 16:20:52 +08:00
MarcoFalke
cea38b491f
Merge bitcoin/bitcoin#22183: Remove gArgs from wallet.h and wallet.cpp
c3c213215b Use `context.args` in `src/wallet/load.cpp`. (Kiminuo)
25de4e77fe Use `context.args` in `CWallet::Create` instead of `gArgs`. (Kiminuo)
aa5e7c9471 Fix typo in bitcoin-cli.cpp (Kiminuo)

Pull request description:

  The PR attempts to move us an inch towards the [goal](https://github.com/bitcoin/bitcoin/pull/21244#discussion_r615307465) by using `WalletContext` in `wallet.{h|cpp}` code instead of relying on the global state (i.e. `gArgs`).

  Edit: The PR builds on #19101.

ACKs for top commit:
  ryanofsky:
    Code review ACK c3c213215b. Changes since last review: just rebasing and adding wallet load commit

Tree-SHA512: 2b436f5a219e32c2d529f55a89edca086d949396cebf9e089a21aa7b1c180e3c0fb17468f415dfc834f8e1614f8b3914c7e9a0bd33b95e7e0199c0dfe5ca9490
2021-08-26 10:01:43 +02:00
MarcoFalke
84be9a89c1
Merge bitcoin/bitcoin#22755: fuzz: Avoid timeout in blockfilter fuzz target
fa2547fc52 fuzz: Avoid timeout in blockfilter fuzz target (MarcoFalke)

Pull request description:

  Previously it would take 10 seconds to run this input, now it takes 10ms: [clusterfuzz-testcase-blockfilter-5022838196142080.log](https://github.com/bitcoin/bitcoin/files/7021883/clusterfuzz-testcase-blockfilter-5022838196142080.log)

  The fix is moving the `MatchAny` out of the hot loop.

  Also, to avoid unlimited runtime, cap the hot loop at 30k iterations.

ACKs for top commit:
  GeneFerneau:
    Approach ACK [fa2547f](fa2547fc52)

Tree-SHA512: a04e7388856930ec81222da8f05b665a923fe9482aeb4c55c9be4561aa7320a0703dbbf8d438ae92854e877a8e3b46777a29c0b652b8f34c29c2142cc5d63ccb
2021-08-26 08:10:12 +02:00
MarcoFalke
e08770bed1
Merge bitcoin/bitcoin#22780: doc: Remove incorrect INIT_PROTO_VERSION from nTime comment
fa9c075f72 doc: Remove incorrect INIT_PROTO_VERSION from nTime comment (MarcoFalke)

Pull request description:

  Missed in commit dbcb5742c4

ACKs for top commit:
  sipa:
    ACK fa9c075f72
  jnewbery:
    ACK fa9c075f72

Tree-SHA512: d086b94658219fadca1a937e64ef5b6a475fbf72661b6008d98e0e2b912cbbdb1f025c531b12a8ed9946fbbd79e1e09fba7c91403fc997158e1170dfbd300b29
2021-08-25 20:13:22 +02:00
Kiminuo
c3c213215b Use context.args in src/wallet/load.cpp. 2021-08-25 16:08:51 +02:00
John Newbery
593247872d [net] Remove CConnMan::SetAsmap()
CAddrMan::m_asmap is now set directly in AppInitMain() so
CConnMan::SetAsmap() is no longer required.
2021-08-25 13:23:53 +01:00
John Newbery
50fd77045e [init] Read/decode asmap before constructing addrman
Commit 181a1207 introduced an initialization order bug: CAddrMan's
m_asmap must be set before deserializing peers.dat. Restore that
ordering.

review hint: use

`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
2021-08-25 13:23:50 +01:00
MarcoFalke
fa82f4ea96
Remove unused MaybeSetAddrName
This logic is a no-op since it was introduced in commit
f9f5cfc506.

m_addr_name is never initialized to the empty string, because
ToStringIPPort never returns an empty string.
2021-08-24 19:19:19 +02:00
glozow
f293c68be0 MOVEONLY: getting mempool conflicts to policy/rbf 2021-08-24 15:51:54 +01:00