Commit Graph

26395 Commits

Author SHA1 Message Date
Jon Atack
f8a1c4d946
cli -netinfo: various quick updates and fixes
- add new signet chain

- update change "uptime" column name to "age" per suggestion by 0xB10C (Timo)

- add an additional digit to mping field width

- change m_networks_size from size_t to uint8_t, as size_t was a holdover
  from m_networks_size being defined as size_t m_networks.size() in a draft

- order Peer struct members by decreasing memory size
2020-10-25 16:15:56 +01:00
Wladimir J. van der Laan
6866259fab net: Hardcoded seeds update for 0.21
Stats:

```
  IPv4   IPv6  Onion Pass
426728  59523   7900 Initial
426728  59523   7900 Skip entries with invalid address
426728  59523   7900 After removing duplicates
426727  59523   7900 Skip entries from suspicious hosts
123226  51785   7787 Enforce minimal number of blocks
121710  51322   7586 Require service bit 1
  4706   1427   3749 Require minimum uptime
  4124   1098   3681 Require a known and recent user agent
  4033   1075   3681 Filter out hosts with multiple bitcoin ports
   512    140    512 Look up ASNs and limit results per ASN and per net
```
2020-10-25 14:25:00 +01:00
RandyMcMillan
36e875b4c5 contrib: Add new versions to makeseeds.py and update gitignore 2020-10-25 14:08:33 +01:00
Jon Atack
fc5721723d
wallet: fix SetFeeEstimateMode() error message
to clarify for the user the confusing error message that the missing fee rate
needs to be set in the conf_target param/option.
2020-10-25 00:35:38 +02:00
Jon Atack
052427eef1
wallet, bugfix: fix bumpfee with explicit fee rate modes 2020-10-24 22:03:11 +02:00
MarcoFalke
d67883d01e
Merge bitcoin-core/gui#43: bugfix: Call setWalletActionsEnabled(true) only for the first wallet
20c9e03554 gui: Call setWalletActionsEnabled(true) only for the first wallet (Hennadii Stepanov)

Pull request description:

  On master (a78742830a) there is a bug:
  - open an encrypted wallet; please note that the "Encrypt Wallet..." menu item is disabled that is expected:
  ![Screenshot from 2020-08-03 12-38-37](https://user-images.githubusercontent.com/32963518/89169084-70060c80-d586-11ea-86b9-05ef38d08f41.png)
  - then open any other wallet; note that the "Encrypt Wallet..." menu item gets enabled that is wrong:
  ![Screenshot from 2020-08-03 12-42-36](https://user-images.githubusercontent.com/32963518/89169385-d68b2a80-d586-11ea-9813-a533a847e098.png)

  This PR fixes this bug.

ACKs for top commit:
  jonasschnelli:
    Tested ACK 20c9e03554 - I could reproduce the issue on master and have verify that this PR fixes it.
  achow101:
    ACK 20c9e03554

Tree-SHA512: 2c9ab94bde8c4f413b0a95c05bf3a1a29f5910e0f99d6639a11dd77758c78af25b060b3fecd78117066ef15b113feb79870bc1347cc04289da915c00623e5787
2020-10-24 09:01:37 +02:00
Hennadii Stepanov
bf6855a909
wallet: Fix bug when just created encrypted wallet cannot get address 2020-10-23 19:24:24 +03:00
Jonas Schnelli
49984b44cf
Merge bitcoin-core/gui#71: Fix visual quality of text in QR image
6954156b40 qt: Fix visual quality of text in QR image (Hennadii Stepanov)
8071c75d45 qt, refactor: Limit scope of QPainter object (Hennadii Stepanov)

Pull request description:

  Master (197450f808):
  ![DeepinScreenshot_select-area_20200824001800](https://user-images.githubusercontent.com/32963518/90988962-96283680-e59f-11ea-8e20-42e9b23033f5.png)

  This PR (6954156b40):
  - macOS 10.15.6
  ![Screenshot from 2020-09-07 15-40-30](https://user-images.githubusercontent.com/32963518/92390251-2c716600-f123-11ea-96f0-0e9d35810c76.png)

  - Linux Mint 20
  ![Screenshot from 2020-09-07 15-48-13](https://user-images.githubusercontent.com/32963518/92390272-36936480-f123-11ea-8fee-4de23bb40ed9.png)

  Fix #54
  Fix https://github.com/bitcoin/bitcoin/issues/19103

  ---

  The first commit is easy to review with [`git diff --word-diff`](8071c75d45).

ACKs for top commit:
  jonasschnelli:
    Tested ACK 6954156b40 - tested on macOS 10.15. Fixes the problem.

Tree-SHA512: 6ecb3397d2a5094c5f00ee05fc09520751568404e000a8691b6de7e57f38c2d5da628694e5e45a2b4cc302a846bbc00014c40820233eb026d3ebd4f68c2c9913
2020-10-23 11:54:47 +02:00
fanquake
9af7c1993b
Merge #20216: wallet: fix buffer over-read in SQLite file magic check
56a461f727 wallet: fix buffer over-read in SQLite file magic check (Sebastian Falbesoner)

Pull request description:

  Looking at our new SQLite database code, I noticed that there is a potential problem in the method `IsSQLiteFile()`:  If there is no terminating zero within the first 16 bytes of the file, the `magic` buffer would be over-read in the `std::string` constructor for `magic_str`. Fixed by using the "from buffer" variant of the string ctor (that also takes a size) rather than the "from c-string" variant (see http://www.cplusplus.com/reference/string/string/string/).

  The behaviour can be reproduced by the following steps:
  * Creating a file of at least 512 bytes in size (to pass the minimum size check) that doesn't contain zero bytes in the magic area, e.g. simply:
  `$ python3 -c "print('A'*512)" > /tmp/corrupt_wallet`
  * Showing content and size of the `magic_str` string in case the magic check fails
  * Create a simple unit test that simply calls `IsSQLiteFile` with the corrupt wallet file
  * Run the unit test and see the random gibberish output of `magic_str` after 16 `A`s :-)

  Or, TLDR variant, just get the branch https://github.com/theStack/bitcoin/tree/reproduce_sqlite_magic_overread, compile unit Tests and run the script `./reproduce_sqlite_magic_overread.sh`.

  Note that this is the minimal diff, probably it would be better to avoid `std::string` at all in this case and just use `memcmp`, strings that include null bytes are pretty confusing.

ACKs for top commit:
  promag:
    Code review ACK 56a461f727.
  practicalswift:
    ACK 56a461f727: patch looks correct
  achow101:
    ACK 56a461f727

Tree-SHA512: a7aadd4d38eb92337e6281df2980f4bde744dbb6cf112b9cd0f2cab8772730e302db9123a8fe7ca4e7e844c47e68957487adb2bed4518c40b4bed6a69d7922b4
2020-10-23 10:10:54 +08:00
Jonas Schnelli
9453fbf5a0
Merge #20: Wrap tooltips in the intro window
6ed4bcabc1 qt: Wrap tooltips in the intro window (Hennadii Stepanov)

Pull request description:

  On master (d6fe5b28df):

  ![DeepinScreenshot_select-area_20200702082514](https://user-images.githubusercontent.com/32963518/86319852-18e6e200-bc3e-11ea-902c-1b868540f4cf.png)

  With this PR:

  ![Screenshot from 2020-07-02 08-22-44](https://user-images.githubusercontent.com/32963518/86319881-28fec180-bc3e-11ea-9d76-522a5e71c32d.png)

  ---

  This is a move-only change.

  This was done while reviewing #15.

ACKs for top commit:
  jonasschnelli:
    utACK 6ed4bcabc1

Tree-SHA512: 67507c8c5628cd95fe8e377ce21e2c23d305faf1affa0b7579885553c20055ba07ed61e2aed3230d7cd22c3c90f76e0c58cb3238be9f153a8ca6e6d4e38753b0
2020-10-22 21:26:00 +02:00
MarcoFalke
88271184e8
Merge #20112: test: Speed up wallet_resendwallettransactions with mockscheduler RPC
fa299ac273 test: Speed up wallet_resendwallettransactions test with mockscheduler RPC (MarcoFalke)

Pull request description:

  Also fixes #20143

ACKs for top commit:
  guggero:
    ACK fa299ac2

Tree-SHA512: 024ced4aa5f5c266e24fd0583d47b45b19c2a6ae25a06fabeacaa0ac996eec0c45f11cc34b2df17d01759b78ed31a991aa86978aafcc76cb0017382f601bf85a
2020-10-22 14:18:06 +02:00
MarcoFalke
7012db2a6b
Merge #20176: test: Fix intermittent issue in p2p_feefilter
fa5a91a352 test: Fix typo (one tx is enough) in p2p_feefilter (MarcoFalke)
fa3af2c0d3 test: Fix intermittent issue in p2p_feefilter (MarcoFalke)

Pull request description:

  Fixes:

  ```
  Traceback (most recent call last):
    File "test/functional/test_framework/test_framework.py", line 126, in main
      self.run_test()
    File "test/functional/p2p_feefilter.py", line 63, in run_test
      self.test_feefilter()
    File "test/functional/p2p_feefilter.py", line 117, in test_feefilter
      txids = [miniwallet.send_self_transfer(fee_rate=Decimal('0.00020000'), from_node=node1)['wtxid'] for _ in range(3)]
    File "test/functional/p2p_feefilter.py", line 117, in <listcomp>
      txids = [miniwallet.send_self_transfer(fee_rate=Decimal('0.00020000'), from_node=node1)['wtxid'] for _ in range(3)]
    File "test/functional/test_framework/wallet.py", line 63, in send_self_transfer
      txid = from_node.sendrawtransaction(tx_hex)
    File "test/functional/test_framework/coverage.py", line 47, in __call__
      return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
    File "test/functional/test_framework/authproxy.py", line 146, in __call__
      raise JSONRPCException(response['error'], status)
  test_framework.authproxy.JSONRPCException: bad-txns-inputs-missingorspent (-25)

ACKs for top commit:
  guggero:
    ACK fa5a91a3

Tree-SHA512: 51d885753f72e1c91c4580709c15bdab60ff8c9d6f9bcb6db78a560e7e4dd7f76ce23add3303b374174afa3f11f74aa61db189a90c68d7f7655b15e64f51ed96
2020-10-22 11:02:33 +02:00
MarcoFalke
1cb4e339f9
Merge #20039: test: Convert amounts from float to decimal
5aadd4be18 Convert amounts from float to decimal (Prayank)

Pull request description:

  > decimal is preferred in accounting applications

  https://docs.python.org/3.8/library/decimal.html

  Decimal type saves an exact value so better than using float.

  ~~3 variables declared with type as 'Decimal' in [test/functional/mempool_accept.py](https://github.com/bitcoin/bitcoin/blob/master/test/functional/mempool_accept.py): fee, fee_expected, output_amount~~

  ~~Not required to convert to string anymore for using the above variables as decimal~~

  + fee, fee_expected, output_amount
  ~~+ 8 decimal places~~
  + Using value of coin['amount'] as decimal and removed 'int'
  + Removed unnecessary parentheses
  + Remove str() and use quotes

  Fixes https://github.com/bitcoin/bitcoin/issues/20011

ACKs for top commit:
  guggero:
    ACK 5aadd4be18

Tree-SHA512: 5877cf3837e5b65bec0fc8909de141a720bfa02a747513e21d20f3c41ec0cfecc524d2c347a96596b0a1a97900da2acf08b799f26b11d537e4dcddc6ce45f38e
2020-10-22 10:13:44 +02:00
Sebastian Falbesoner
56a461f727 wallet: fix buffer over-read in SQLite file magic check
If there is no terminating zero within the 16 magic bytes, the buffer would be
over-read in the std::string constructor. Fixed by using the "from buffer"
variant of the ctor (that also takes a size) rather than the "from c-string"
variant.
2020-10-22 03:39:55 +02:00
fanquake
dda18e7310
Merge #20214: test: Fix rpc_net intermittent issue
fa5f46600f test: Fix rpc_net intermittent issue (MarcoFalke)

Pull request description:

  Without the sync, the nodes might generate blocks at the same height and thus never be able to sync

ACKs for top commit:
  practicalswift:
    ACK fa5f46600f: patch looks correct

Tree-SHA512: 21255795c2121c71fc620beb766855e57c7af94a668331d1b625665e22eb4b485a2b5c3ad2bb9a7042744f3c3e49c71251bcec41ba25bca03fd54aae32968a3a
2020-10-22 08:40:38 +08:00
MarcoFalke
fa5f46600f
test: Fix rpc_net intermittent issue 2020-10-21 21:07:28 +02:00
Prayank
5aadd4be18 Convert amounts from float to decimal
+ fee, fee_expected, output_amount
+ Using value of coin['amount'] as decimal and removed 'int'
+ Removed unnecessary parentheses
+ Remove str() and use quotes
2020-10-21 21:21:39 +05:30
Russell Yanofsky
01476a88a6 wallet: Make -wallet setting not create wallets
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  https://github.com/bitcoin-core/gui/issues/95,
  https://github.com/bitcoin/bitcoin/pull/19754#issuecomment-685858578,
  https://github.com/bitcoin/bitcoin/pull/19754#issuecomment-685858578

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after #15454. #15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. #15454 release
  notes are updated here and are simpler.

This change should be targeted for 0.21.0. It's a bug fix and simplifies
behavior of the #15937 / #19754 / #15454 features added in 0.21.0.
2020-10-21 08:48:43 -04:00
MarcoFalke
b46f37ba5e
Merge #20198: Show name, format and if uses descriptors in bitcoin-wallet tool
fa4074b395 Show name, format and if uses descriptors in bitcoin-wallet tool (Jonas Schnelli)

Pull request description:

ACKs for top commit:
  MarcoFalke:
    ACK fa4074b395
  jonatack:
    re-ACK fa4074b395

Tree-SHA512: cf6ee96ff21532fc4b0ba7a0fdfdc1fa485c9b1495447350fe65cd0bd919e0e0280613933265cdee069b8c29ccf015ac374535a70cac3d4fb89f4d08b3a03519
2020-10-21 14:48:43 +02:00
MarcoFalke
47fc883106
Merge #19967: test: Replace (dis)?connect_nodes globals with TestFramework methods
3c7d9ab8c8 test: Move (dis)?connect_nodes globals into TestFramework as helpers (Elliott Jin)
4b16c61461 scripted-diff: test: Replace uses of (dis)?connect_nodes global (Prayank)
be386840d4 test: Replace use of (dis)?connect_nodes globals (Elliott Jin)

Pull request description:

  `util.py` defines global helper functions `connect_nodes` and `disconnect_nodes`; however, these functions are confusing because they take a node and an index (instead of two indexes).

  The `TestFramework` object has enough context to convert from `i` to `self.nodes[i]`, so we can replace all instances of `connect_nodes(self.nodes[a], b)` with `self.connect_nodes(a, b)`. Similarly, we can replace instances of `disconnect_nodes`.

  The approach taken in this PR builds on #19945 but uses a scripted-diff for the majority of the changes.

  Fixes: #19821

ACKs for top commit:
  MarcoFalke:
    ACK 3c7d9ab8c8
  guggero:
    ACK 3c7d9ab8

Tree-SHA512: e027092748602904abcd986d7299624c8754c3236314b6d8e392e306741c212f266c2207e385adfb194f67ae6559a585ee7b15d639b1d65c4651dbf503e5931a
2020-10-21 14:43:12 +02:00
Vasil Dimov
af3b0dfc54
net: fix output of peer address in version message
If `-logips -debug=net` is specified then we print the contents of the
version message we send to the peer, including his address. Because the
addresses in the version message use pre-BIP155 encoding they cannot
represent a Tor v3 address and we would actually send 16 `0`s instead (a
dummy IPv6 address). However we would print the full address in the log
message. Before this fix:

```
2020-10-21T12:24:17Z send version message: version 70016, blocks=653500, us=[::]:0, them=xwjtp3mj427zdp4tljiiivg2l5ijfvmt5lcsfaygtpp6cw254kykvpyd.onion:8333, peer=0
```

This is confusing because we pretend to send one thing while we actually
send another. Adjust the printout to reflect what we are sending. After
this fix:

```
2020-10-21T12:26:54Z send version message: version 70016, blocks=653500, us=[::]:0, them=[::]:0, peer=0
```
2020-10-21 14:40:42 +02:00
MarcoFalke
0f86e7f128
Merge #20157: Bugfix: chainparams: Add missing (always enabled) Taproot deployment for Signet
2d5793c016 Bugfix: chainparams: Add missing (disabled) Taproot deployment for Signet (Luke Dashjr)

Pull request description:

  Is there a way we can trigger compiler warnings if a deployment is undefined?

ACKs for top commit:
  decryp2kanon:
    utACK 2d5793c016
  MarcoFalke:
    review ACK 2d5793c016

Tree-SHA512: 135cefae0f8dc552b0f682c2b87cabca7a4716290a36410a55968850e803a5049234e3cc597c8ef8d7917ae5d5ea3fb851e160df171b6793114c6bc01c5ea3e7
2020-10-21 14:19:33 +02:00
Jonas Schnelli
fa4074b395 Show name, format and if uses descriptors in bitcoin-wallet tool 2020-10-21 13:28:15 +02:00
Luke Dashjr
bbb42a6896 RPC: createwallet: Nicer error message if descriptor wallet requested and sqlite support not compiled in 2020-10-20 13:44:43 +00:00
Luke Dashjr
6608fec332 GUI: Create Wallet: Nicely disable descriptor wallet checkbox if sqlite support not compiled in 2020-10-20 13:44:43 +00:00
Luke Dashjr
7b54d768e1 Make sqlite support optional (compile-time) 2020-10-20 13:44:43 +00:00
Luke Dashjr
2d5793c016 Bugfix: chainparams: Add missing (disabled) Taproot deployment for Signet 2020-10-20 13:32:23 +00:00
Elliott Jin
3c7d9ab8c8 test: Move (dis)?connect_nodes globals into TestFramework as helpers 2020-10-20 00:43:00 -07:00
Prayank
4b16c61461 scripted-diff: test: Replace uses of (dis)?connect_nodes global
-BEGIN VERIFY SCRIPT-

 # max-depth=0 excludes test/functional/test_framework/...
 FILES=$(git grep -l --max-depth 0 "connect_nodes" test/functional)

 # Replace (dis)?connect_nodes(self.nodes[a], b) with self.(dis)?connect_nodes(a, b)
 sed -i 's/\b\(dis\)\?connect_nodes(self\.nodes\[\(.*\)\]/self.\1connect_nodes(\2/g' $FILES

 # Remove imports in the middle of a line
 sed -i 's/\(dis\)\?connect_nodes, //g' $FILES
 sed -i 's/, \(dis\)\?connect_nodes//g' $FILES

 # Remove imports on a line by themselves
 sed -i '/^\s*\(dis\)\?connect_nodes,\?$/d' $FILES
 sed -i '/^from test_framework\.util import connect_nodes$/d' $FILES

-END VERIFY SCRIPT-

Co-authored-by: Elliott Jin <elliott.jin@gmail.com>
2020-10-20 00:42:00 -07:00
Elliott Jin
be386840d4 test: Replace use of (dis)?connect_nodes globals
A later scripted-diff commit replaces the majority of uses, which all
follow this pattern:

    (dis)?connect_nodes(self.nodes[a], b)

This commit replaces the few "special cases".
2020-10-20 00:27:45 -07:00
practicalswift
79ef8324d4 tests: Add fuzzing harness for CConnman 2020-10-20 06:18:54 +00:00
Samuel Dobson
f5bd46a4cc
Merge #20125: rpc, wallet: Expose database format in getwalletinfo
624bab00dd test: add coverage for getwalletinfo format field (Jon Atack)
5e737a0092 rpc, wallet: Expose database format in getwalletinfo (João Barbosa)

Pull request description:

  Support for sqlite based wallets was added in #19077. This PR adds the `format` key in `getwalletinfo` response, that can be `bdb` or  `sqlite`.

ACKs for top commit:
  jonatack:
    Tested ACK 624bab00dd
  laanwj:
    Code review ACK 624bab00dd.
  MarcoFalke:
    doesn't hurt ACK 624bab00dd
  hebasto:
    ACK 624bab00dd, tested on Linux Mint 20 (x86_64).
  meshcollider:
    utACK 624bab00dd

Tree-SHA512: a81f8530f040f6381d33e073a65f281993eccfa717424ab6e651c1203cbaf27794dcb7175570459e7fdaa211565bc060d0a3ecbe70d2b6f9c49b8d5071e4441c
2020-10-20 12:35:33 +13:00
MarcoFalke
45385018e1
Merge #20162: p2p: declare Announcement::m_state as uint8_t, add getter/setter
c8abbc9d1f p2p: declare Announcement::m_state as uint8_t, add getter/setter (Jon Atack)

Pull request description:

  Change `Announcement::m_state` in `tx_request.cpp` from type `State` to `uint8_t` and add a getter and setter for the conversion to/from `State`. This should silence these travis ci gcc compiler warnings:

  ```
  txrequest.cpp:73:21: warning: ‘{anonymous}::Announcement::m_state’ is
  too small to hold all values of ‘enum class {anonymous}::State’
       State m_state : 3;
                       ^
  ```

  The gcc warnings are based on the maximum value held by the underlying uint8_t enumerator type, even though the intention of the bitfield declaration is the maximum declared enumerator value. They have apparently been silenced in gcc 8.4+ and 9.3+ according to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414.

ACKs for top commit:
  sipa:
    utACK c8abbc9d1f
  ajtowns:
    ACK c8abbc9d1f -- quick code review
  hebasto:
    ACK c8abbc9d1f, tested on Bionic (x86_64, gcc 7.5.0):

Tree-SHA512: 026721dd7a78983a72da77638d3327d2b252bef804e489278a852f000046c028d6557bbd6c2b4cea391d4e01f9264a1be842d502047cb90b2997cc37bee59e61
2020-10-19 13:09:32 +02:00
fanquake
4f807348af
Merge #20185: doc: Merge release notes
fa38093bee doc: Merge release notes (MarcoFalke)

Pull request description:

  Now that all features are merged, open release notes editing at the wiki

  https://github.com/bitcoin-core/bitcoin-devwiki/wiki/0.21.0-Release-Notes-Draft

ACKs for top commit:
  fanquake:
    ACK fa38093bee

Tree-SHA512: ced161a2fcb0366a77a05b020c8dd65a0cf0a0de17b8260bbca9b5833ed370f92b1b81116bfc59b83380bf28b55d8963c628cf13a0cad603e5c823341b446065
2020-10-19 18:47:55 +08:00
MarcoFalke
fa38093bee
doc: Merge release notes 2020-10-19 12:00:16 +02:00
MarcoFalke
4769942d90
Merge #19624: Warn on unknown rw_settings
fa48405ef8 Warn on unknown rw_settings (MarcoFalke)

Pull request description:

  Log a warning to debug log if unknown settings are encountered. This should probably only ever happen when the software is upgraded.

  Something similar is already done for the command line and config file. See:

  * test: Add test for unknown args #16234 (commit fa7dd88b71)

ACKs for top commit:
  ryanofsky:
    Code review ACK fa48405ef8. Looks good and I could see this being helpful for debugging. Thanks for taking suggestions

Tree-SHA512: cec7d88adf84fa0a842f56b26245157736eb50df433db951e622ea07fd145b899822b24cdab1d8b36c066415ce4f0ef09b493fa8a8d691532822a59c573aafa7
2020-10-19 11:30:49 +02:00
MarcoFalke
fa5a91a352
test: Fix typo (one tx is enough) in p2p_feefilter 2020-10-19 09:42:40 +02:00
MarcoFalke
d9d9a29352
Merge #20179: test: Fix intermittent issue in wallet_import_rescan
faab86f6c8 test: Fix intermittent issue in wallet_send (MarcoFalke)
faca3734c0 test: Fix intermittent issue in wallet_import_rescan (MarcoFalke)

Pull request description:

  Fixes the issue

  ```
   node2 2020-10-16T14:26:28.699593Z (mocktime: 2020-10-16T16:26:46Z) [msghand] Timeout downloading block 1131f0318b913e078402524f1e63e53d52171844dd8246a03b970e540cb56924 from peer=0, disconnecting

ACKs for top commit:
  fjahr:
    utACK faab86f6c8

Tree-SHA512: 739e8ad488c50e6beae676fb6cb021033cca6192da4acb4512c182bd8843f2f42a4a07474118285cb1d91798904433e4abb09476cc9ce115aae87ce64db69eaf
2020-10-19 09:27:32 +02:00
MarcoFalke
152ddb3197
Merge #20180: test: Fix -Wunused-function warnings if configured --without-libs
76bbcc414f test: Fix -Wunused-function warning if configured --without-libs (Hennadii Stepanov)

Pull request description:

  On master (80c8a02f1b) compiling with gcc:
  ```
  $ ./configure --without-libs
  $ make clean && make
  ...
  test/script_tests.cpp:1369:23: warning: ‘CScriptWitness script_tests::ScriptWitnessFromJSON(const UniValue&)’ defined but not used [-Wunused-function]
   1369 | static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
        |                       ^~~~~~~~~~~~~~~~~~~~~
  test/script_tests.cpp:1357:28: warning: ‘std::vector<CTxOut> script_tests::TxOutsFromJSON(const UniValue&)’ defined but not used [-Wunused-function]
   1357 | static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
        |                            ^~~~~~~~~~~~~~
  test/script_tests.cpp:1350:28: warning: ‘CMutableTransaction script_tests::TxFromHex(const string&)’ defined but not used [-Wunused-function]
   1350 | static CMutableTransaction TxFromHex(const std::string& str)
        |                            ^~~~~~~~~
  ...
  ```

  This change is move-only (nice to review with `git diff --color-moved`).

ACKs for top commit:
  practicalswift:
    ACK 76bbcc414f: diff looks correct
  fanquake:
    ACK 76bbcc414f - verified that this fixes the warnings. As mentioned can be reviewed with `git diff HEAD~ --color-moved=dimmed_zebra`.

Tree-SHA512: 7799ac190d1e3f15e38b36cfcd1f8d138be80cab6c6cfad8f7828e07deffc2037d52f1d967f7f233a3a8ed74eee184f5275076c2f364c3e363c77a1f40aa5030
2020-10-19 09:18:16 +02:00
fanquake
62af467ff0
Merge #20082: [bugfix] random: fixes read buffer to use min rather than max
bd5215103e random: fixes read buffer resizing in RandAddSeedPerfmon (Ethan Heilman)

Pull request description:

  As shown below when resizing the read buffer `vData` `std::max((vData.size() * 3) / 2, nMaxSize)` is used. This means that the buffer size immediately jumps to `nMaxSize`. I believe the intend of this code is to grow the buffer size through several steps rather than immediately resize it to the max size.

  ```cpp
      std::vector<unsigned char> vData(250000, 0);
      long ret = 0;
      unsigned long nSize = 0;
      const size_t nMaxSize = 10000000; // Bail out at more than 10MB of performance data
      while (true) {
          nSize = vData.size();
          ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", nullptr, nullptr, vData.data(), &nSize);
          if (ret != ERROR_MORE_DATA || vData.size() >= nMaxSize)
              break;
          vData.resize(std::max((vData.size() * 3) / 2, nMaxSize)); // Grow size of buffer exponentially
      }
  ```

  vData always starts at size 250,000 and nMaxSize is always 10,000,000 so the first time this line is reached:
  ```cpp
  vData.resize(std::max((vData.size() * 3) / 2, nMaxSize));
  ```
  the effect will always be to resize vData to nMaxSize. Then because the loop terminates when vData.size >= 10,000,000 only one resize operation will take place.

  To fix this issue we replace `std::min` with `std::max`

  This PR also adds a comment clarifying the behavior of this function the first time it is called.

ACKs for top commit:
  fanquake:
    ACK bd5215103e - thanks for taking a look at this Ethan. Swapping from `std::max` to `std::min` here certainly seems correct.

Tree-SHA512: 7c65f700e5bbe44bc2f1ffdcdc99ec19c542894c95b5ee9791facd09d02afae88d1f8f35af129719e4860db94bc790856e7adb1d218a395381e7c2913b95f1d0
2020-10-19 14:04:10 +08:00
Andrew Chow
5f720544f3 wallet: Add GetClosestWalletFeature function
Given a version number, get the closest supported WalletFeature
for a version number.
2020-10-19 00:14:38 -04:00
Andrew Chow
842ae3842d wallet: Add utility method for CanSupportFeature 2020-10-19 00:14:38 -04:00
fanquake
a1e0359618
Merge #19986: refactor: clean up -Wlogical-op warning in wallet/scriptpubkeyman.cp
95fedd33a2 refactor: Clean up -Wlogical-op warning (maskoficarus)

Pull request description:

  This is a quick patch that fixes #19912 . This change prevents a -Wlogical-op warning that occurs because we're treating a const int value as a boolean. There's no sense checking if a non-zero constant has a value, so I've removed the check.

  #18836 also addresses the same warning, but has a larger scope and will require more review. This pull request will act as a patch to prevent this compile warning until 18836 is merged.

ACKs for top commit:
  MarcoFalke:
    review ACK 95fedd33a2
  hebasto:
    ACK 95fedd33a2, tested on Linux Mint 20 (x86_64):

Tree-SHA512: 13a9d7f7cb472f4c22a01ca2f9771a75267ff769bdae9d0dc6b2c7f3b05369f6dfa859be2b172b39c15ede6c44cddf556380b3565e42850faa65ccd3fe6e175b
2020-10-19 11:07:11 +08:00
fanquake
c92aa8357c
Merge #19911: net: guard vRecvGetData with cs_vRecv and orphan_work_set with g_cs_orphans
da0988daf1 scripted-diff: rename vRecvGetData (Neha Narula)
ba951812ec Guard vRecvGetData (now in net processing) with its own mutex (Neha Narula)
2d9f2fca43 Move vRecvGetData to net processing (Neha Narula)
673247b58c Lock before checking if orphan_work_set is empty; indicate it is guarded (Neha Narula)
8803aee668 Move m_orphan_work_set to net_processing (Neha Narula)
9c47cb29f9 [Rename only] Rename orphan_work_set to m_orphan_work_set. (Neha Narula)

Pull request description:

  Add annotations to guard `vRecvGetData` and `orphan_work_set` and fix up places where they were accessed without a lock. There is no current data race because they happen to be accessed by only one thread, but this might not always be the case.

  Original discussion: https://github.com/bitcoin/bitcoin/pull/18861#discussion_r451778445

ACKs for top commit:
  MarcoFalke:
    review ACK da0988daf1 🐬
  jnewbery:
    Code review ACK da0988daf1
  hebasto:
    ACK da0988daf1, I have reviewed the code and it looks correct, I agree it can be merged.

Tree-SHA512: 31cadd319ddc9273a87e77afc4db7339fd636e816b5e742eba5cb32927ac5cc07a672b2268d2d38a75a0f1b17d93836adab9acf7e52f26ea9a43f54efa57257e
2020-10-19 10:25:38 +08:00
Hennadii Stepanov
76bbcc414f
test: Fix -Wunused-function warning if configured --without-libs
This is a move-only change.
2020-10-18 19:06:01 +03:00
MarcoFalke
faab86f6c8
test: Fix intermittent issue in wallet_send 2020-10-18 11:02:59 +02:00
MarcoFalke
faca3734c0
test: Fix intermittent issue in wallet_import_rescan 2020-10-18 10:10:20 +02:00
MarcoFalke
80c8a02f1b
Merge #20159: test: mining_getblocktemplate_longpoll.py improvements (use MiniWallet, add logging)
b128b56672 test: add logging for mining_getblocktemplate_longpoll.py (Sebastian Falbesoner)
8ee3536b2b test: remove unused helpers random_transaction(), make_change() and gather_inputs() (Sebastian Falbesoner)
fddce7e199 test: use MiniWallet for mining_getblocktemplate_longpoll.py (Sebastian Falbesoner)

Pull request description:

  This PR enables one more of the non-wallet functional tests (mining_getblocktemplate_longpoll.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead, as proposed in #20078. Also adds missing log messages for the subtests.

  This was the only functional test that used the `random_transaction` helper in `test_framework/util.py`, hence it is removed, together with other helpers (`make_change` and `gather_inputs`) that were again only used by `random_transaction`.

ACKs for top commit:
  MarcoFalke:
    ACK b128b56672

Tree-SHA512: 09a5fa7b0f5976a47040f7027236d7ec0426d5a4829a082221c4b5fae294470230e89ae3df0bca0eea26833162c03980517f5cc88761ad251c3df4c4a49bca46
2020-10-17 17:57:23 +02:00
MarcoFalke
fa3af2c0d3
test: Fix intermittent issue in p2p_feefilter 2020-10-17 17:48:03 +02:00
fanquake
5d644778da
Merge #20169: Taproot follow-up: Make ComputeEntrySchnorr and ComputeEntryECDSA const to clarify contract
51365674e8 script: Make ComputeEntrySchnorr and ComputeEntryECDSA const to clarify contract (practicalswift)

Pull request description:

  Make `ComputeEntrySchnorr` and `ComputeEntryECDSA` `const` to clarify contract.

ACKs for top commit:
  benthecarman:
    ACK 51365674e8
  theStack:
    ACK 51365674e8 👌
  sipa:
    utACK 51365674e8

Tree-SHA512: 0f7a72bf6df7a97d21045ead9db398d2a9527c358aeeb894dec34a5386da4cc316e2f3326716e960ef8aa47bf73b99d1f92bb6d45dfa7871c84624bcad8a79f1
2020-10-17 22:46:56 +08:00