Commit graph

19659 commits

Author SHA1 Message Date
Saibato
8733a8e84c the result of CWallet::IsHDEnabled() was initialized with true.
But in case of no keys or a blank hd wallet the iterator would be skipped
and not set to false but true, since the loop would be not entered.

That had resulted in a wrong return and subsequent false HD and watch-only
icon display in gui when reloading a wallet after closing.

Update src/wallet/wallet.cpp

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2021-08-24 05:10:33 -04:00
fanquake
3ae503c95b
refactor: replace QDateTime::toTime_t with QDateTime::toSecsSinceEpoch 2021-08-24 15:08:04 +08:00
fanquake
27257b39bf
refactor: replace QDateTime::fromTime_t with QDateTime::fromSecsSinceEpoch 2021-08-24 15:06:46 +08:00
fanquake
b20ad0eb16
Merge bitcoin/bitcoin#22772: refactor: hasher cleanup (follow-up to 19935)
4c69571e6e doc: remove outdated comment (Martin Zumsande)
16652a93ea refactor: Remove unused KeyIDHasher (Martin Zumsande)

Pull request description:

  Small follow-ups to  #19935:

  - Removal of unused `KeyIDHasher`  class ([comment in 19935](https://github.com/bitcoin/bitcoin/pull/19935#discussion_r544464524))
  - Removal of an outdated comment, which referred to an old problem with the no longer supported Boost 1.46 and `boost::unordered_map`, now replaced by `std::unordered_map`. ([comment in 19935](https://github.com/bitcoin/bitcoin/pull/19935#discussion_r540911134))

ACKs for top commit:
  Saviour1001:
    Tested ACK <code>[4c69571](4c69571e6e)</code>
  Zero-1729:
    ACK 4c69571e6e
  theStack:
    ACK 4c69571e6e 🆗

Tree-SHA512: 243fda2120bfac6c40a268ca2c0f34482ce27e71fbc50005c0d13c2ad5db9ee72a037f9937c37cc50ed0f9f6f11ee6afee4ac50e5031d6876ec942f41f38dadf
2021-08-24 11:12:15 +08:00
fanquake
61a843e43b
Merge bitcoin/bitcoin#22220: util: make ParseMoney return a std::optional<CAmount>
f7752adba5 util: check MoneyRange() inside ParseMoney() (fanquake)
5ef2738089 util: make ParseMoney return a std::optional<CAmount> (fanquake)

Pull request description:

  Related discussion in #22193.

ACKs for top commit:
  MarcoFalke:
    review ACK f7752adba5 📄

Tree-SHA512: 88453f9e28f668deff4290d4bc0b2468cbd54699a3be1bfeac63a512276d309354672e7ea7deefa01466c3d9d826e837cc1ea244d4d74b4fa9c11c56f074e098
2021-08-24 10:43:38 +08:00
Hennadii Stepanov
d3203a99d8
Merge bitcoin-core/gui#408: Add missing mnemonics in menu bar options
7c33e3a572 qt: Add missing mnemonics in menu bar options (Shashwat)

Pull request description:

  Since #362 we have defaulted to add mnemonic shortcuts for the context menus.
  The Window -> Minimize option and File -> Load PSBT from clipboard were hitherto missing a mnemonic shortcut. This PR adds mnemonic shortcuts for them

  Changes introduced in this PR:
  | Master | PR |
  | ----------| ---- |
  | ![Screenshot from 2021-08-23 23-10-07](https://user-images.githubusercontent.com/85434418/130494098-c65ec9da-c3f1-4243-9b3d-0c87cb677825.png) | ![Screenshot from 2021-08-23 23-08-41](https://user-images.githubusercontent.com/85434418/130494083-849ffd14-05e9-4a6d-bdc3-b3e55b8a8861.png)|
  |![Screenshot from 2021-08-23 23-10-21](https://user-images.githubusercontent.com/85434418/130494233-1b2e8838-c5d4-48a8-9abf-a4acc8d6146c.png)|![Screenshot from 2021-08-23 23-09-00](https://user-images.githubusercontent.com/85434418/130494181-dcdbf119-a2c6-469d-a6c9-3021506ab40b.png)|

ACKs for top commit:
  jarolrod:
    tACK 7c33e3a572
  hebasto:
    ACK 7c33e3a572, tested on Linux Mint 20.2 (Qt 5.12.8).

Tree-SHA512: 32f201ae7716b19ca123856292f8bfa0d805f6c7271ac1b5e08eff6b95017443754c8a76e8396ccca1869a57384e11016cbd99d63ccdd2fae6da4eaf3ae32298
2021-08-23 22:15:29 +03:00
MarcoFalke
ec6db8e858
Merge bitcoin/bitcoin#22769: fuzz: Use LIMITED_WHILE instead of limit_max_ops
faa5fa9a78 fuzz: Use LIMITED_WHILE instead of limit_max_ops (MarcoFalke)

Pull request description:

  This avoids the local stack variable `limit_max_ops` and makes it easier to grep for limited loops. Also, it is less code.

ACKs for top commit:
  theStack:
    Code-review ACK faa5fa9a78 🍷
  Zero-1729:
    crACK faa5fa9a78 🥤

Tree-SHA512: b10d89f4ce57bac0d6e9de9db7d4db85bae81bc02536d46a910be8c0e77333f2d9a547c7fe03df57f5ff9fd90b6994b09996d8e148573fb7ecd840d08b5c0c7d
2021-08-23 20:57:07 +02:00
Shashwat
7c33e3a572 qt: Add missing mnemonics in menu bar options
The Window -> Minimize an File -> Load PSBT from clipboard options were missing a mnemonic
shortcut. This PR adds mnemonic shortcuts for them.
2021-08-23 23:06:55 +05:30
W. J. van der Laan
b1c4a4ed39
Merge bitcoin-core/gui#406: Handle new added plurals in bitcoin_en.ts
2b3d8f3dde qt: Handle new added plurals in bitcoin_en.ts (Hennadii Stepanov)

Pull request description:

  This step was missed. See [`translation_process.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/translation_process.md#handling-plurals-in-source-files).

  Transifex is smart enough to handle `%n` in strings as a plural form. Therefore, only two English strings are broken in the GUI on master (and in 22.0).

ACKs for top commit:
  laanwj:
    ACK 2b3d8f3dde

Tree-SHA512: d39c0da8a295fd7a42e7f2ca3cf5b4f7704c2bdeccdeb10392b37e06dc8577295c9fefbdd5442824639f31c3d014b025a9b937f0b3f630a8ebc977451a5f14f5
2021-08-23 19:27:27 +02:00
MarcoFalke
dbcb5742c4
Merge bitcoin/bitcoin#20541: Move special CAddress-without-nTime logic to net_processing
75290ae61e Drop us=... message in net debug for sending version message (Pieter Wuille)
5d47860334 refactor: move CAddress-without-nTime logic to net_processing (Pieter Wuille)

Pull request description:

  Historically, the VERSION message contains an "addrMe" and an "addrYou". As these are sent before version negotiation is complete, the protocol version is INIT_PROTO_VERSION (209), and in that protocol, CAddress is serialized without nTime.

  This is in fact the only situation left where a CAddress is (de)serialized without nTime. As it's such a simple structure (CService for ip/port + uint64_t for nServices), just inline that structure in the few places where it occurs, and remove the logic for dealing with missing nTime from CAddress.

ACKs for top commit:
  Zero-1729:
    crACK 75290ae61e
  jonatack:
    ACK 75290ae61e
  vasild:
    ACK 75290ae61e

Tree-SHA512: ccd9f478e1766fb2ad845d512b090e6297b82100640545ca490d930785801da3b429d40400bc2eb2cbe9057d5d12362ab33f8d650a1ca9e9e85857aef36ec414
2021-08-23 18:19:52 +02:00
MarcoFalke
f6f7a12462
Merge bitcoin/bitcoin#22622: util: Check if specified config file cannot be opened
127b4608e9 test: Check if specified config file cannot be opened (nthumann)
6bb54708e6 util: Check if specified config file cannot be opened (nthumann)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/22612.
  When running e.g. `./src/bitcoind -datadir=/tmp/bitcoin -regtest -conf=/tmp/bitcoin/regtest/bitcoin.conf` and the specified config cannot be opened (doesn't exist, permission denied, ...), the initialization silently uses the default config.

  As voidburn already noted:
  > I can't think of a situation in which a config file is specified explicitly (in the startup options, as per service unit linked above), but inaccessible, where the fail condition should be to keep booting using defaults instead.

  With this patch applied, the initialization will fail immediately, if the specified config file cannot be opened. If no config file is explicitly specified, the behavior is unchanged. This not only affects `bitcoind`, but also `bitcoin-cli` and `bitcoin-qt`.

  In the example below the datadir is accessible, but the config file is not due to insufficient permissions:
  ```
  $ ./src/bitcoind -datadir=/tmp/bitcoin -regtest --debug=1 -conf=/tmp/bitcoin/regtest/bitcoin.conf
  Error: Error reading configuration file: specified config file "/tmp/bitcoin/regtest/bitcoin.conf" could not be opened.
  ```

ACKs for top commit:
  0xB10C:
    ACK 127b4608e9
  Zero-1729:
    tACK 127b4608e9
  theStack:
    Tested ACK 127b4608e9

Tree-SHA512: 4fe487921485426f1d1da8d256c388af517b984b639d776aec7b159b3e23b669824093d3bdd31139d9415ed5f5de405b3e6a51b110c8ab471f12b9c99ac67cc1
2021-08-23 12:58:01 +02:00
MarcoFalke
58b559fab0
Merge bitcoin/bitcoin#20769: net: fixes #20657 - Advertised address where nobody is listening
a38137479b net: do not advertise address where nobody is listening (Jadi)

Pull request description:

  If the bitcoind starts when listen=0 but listenonion=1, the daemon will
  advertise its onion address but nothing is listening for it.

  This update will enforce listenonion=0 when the listen is 0.

ACKs for top commit:
  vasild:
    ACK a38137479b
  jarolrod:
    ACK a38137479b
  amitiuttarwar:
    ACK a38137479b

Tree-SHA512: e84a0a9a51f2217edf35d06c6cd9085d1e664452655ba92027195a1e88ba081d157310c84e9709a99ce5d46c94f231477ca2d36f010648b0c8b4f2a737d54e5d
2021-08-23 09:01:08 +02:00
fanquake
e826b22da2
Merge bitcoin/bitcoin#22275: A few follow-ups for taproot signing
08f57a0057 Assert that IsComplete() in GetSpendData() (Pieter Wuille)
d8f4b976d5 Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator (Pieter Wuille)
c7048aae95 Simplify SignTransaction precomputation loop (Pieter Wuille)
addb9b5a71 Improve comments in taproot signing logic (Pieter Wuille)

Pull request description:

  This addresses a few review comments from #21365 that were left at the time of merge (as well as some from #22166 applying to the commit it shared with #21365).

  I do not think any are blockers for a 22.0 release.

ACKs for top commit:
  theStack:
    re-ACK 08f57a0057 🌴
  Zero-1729:
    crACK 08f57a0
  jonatack:
    Code review ACK 08f57a0057 per `git range-diff e9d6eb1 9336670 08f57a0` followed by re-code review per commit to swap context back into memory and debug build/run unit tests + feature_taproot.py as a sanity check

Tree-SHA512: 968750109ba8d6faf3016035a38f81c6aefb724c632a3cab0bbf43cf31b9d187b6b0fddd8772768f57338df11eb07ab9c4c6dacdf3cf35b71f29699c67a301ea
2021-08-23 12:25:49 +08:00
fanquake
a93e7a4422
Merge bitcoin/bitcoin#22748: refactor: Avoid temporary vectors/uint256s in VerifyTaprootCommitment
2f0190320d Avoid temporary vectors/uint256s in VerifyTaprootCommitment (Pieter Wuille)

Pull request description:

  As XOnlyPubKey has a Span-based constructor, that can be used directly without needing to first convert the byte sequence into a vector, only to convert that to a uint256, which only then can then be passed as a span to the constructor.

  Reported by @ roconnor-blockstream.

ACKs for top commit:
  Zero-1729:
    crACK 2f0190320d
  theStack:
    re-ACK 2f0190320d
  jonatack:
    ACK 2f0190320d

Tree-SHA512: f5e809d693cf6f6e899278cd706548eb4341e73b3f7ca8926b5fb50afb2098077d691579aea84fd7db2a7edd76be8e400aa2ed886091ee3416651b8a36efba37
2021-08-23 11:40:18 +08:00
Martin Zumsande
4c69571e6e doc: remove outdated comment
No longer relevant because Boost 1.46 is no longer supported and
std::unordered_map is used instead of boost::unordered_map in CCoinsMap.
2021-08-22 17:32:43 +02:00
Martin Zumsande
16652a93ea refactor: Remove unused KeyIDHasher 2021-08-22 17:31:58 +02:00
Pieter Wuille
75290ae61e Drop us=... message in net debug for sending version message
The us=... message in the debug log when sending a version message is
always [::]:0, because we no longer send our own address there.
Therefore, this information is entirely redundant. Remove it.
2021-08-21 19:16:47 -04:00
Pieter Wuille
5d47860334 refactor: move CAddress-without-nTime logic to net_processing
Historically, the VERSION message contains an "addrMe" and an "addrYou". As
these are sent before version negotiation is complete, the protocol version is
INIT_PROTO_VERSION (209), and in that protocol, CAddress is serialized without
nTime.

This is in fact the only situation left where a CAddress is (de)serialized
without nTime. As it's such a simple structure (CService for ip/port + uint64_t
for nServices), just inline that structure in the few places where it occurs,
and remove the logic for dealing with missing nTime from CAddress.
2021-08-21 19:16:47 -04:00
Hennadii Stepanov
2b3d8f3dde
qt: Handle new added plurals in bitcoin_en.ts
This step was missed. See translation_process.md
2021-08-22 00:03:31 +03:00
MarcoFalke
faa5fa9a78
fuzz: Use LIMITED_WHILE instead of limit_max_ops 2021-08-21 19:25:33 +02:00
MarcoFalke
f5a406f003
Merge bitcoin/bitcoin#22633: refactor: Replace remaining binascii method calls
021daedfa1 refactor: replace remaining binascii method calls (Zero-1729)

Pull request description:

  This PR removes the remaining `binascii` method calls outside `test/functional` and `test_framework`, as pointed out here  https://github.com/bitcoin/bitcoin/pull/22619#pullrequestreview-722153458.

  Follow-up to #22593 and #22619
  Closes #22605

ACKs for top commit:
  josibake:
    re-ACK 021daedfa1
  theStack:
    re-ACK 021daedfa1

Tree-SHA512: 2ae9fee8917112c91a5406f219ca70f24cd8902b903db5a61fc2de85ad640d669a772f5c05970be0fcee6ef1cdd32fae2ca5d1ec6dc9798b43352c8160ddde6f
2021-08-21 16:29:55 +02:00
Pieter Wuille
2f0190320d Avoid temporary vectors/uint256s in VerifyTaprootCommitment
As XOnlyPubKey has a Span-based constructor, that can be used directly
without needing to first convert the byte sequence into a vector, only
to convert that to a uint256, which only then can then be passed as a
span to the constructor.
2021-08-20 14:30:59 -04:00
Pieter Wuille
08f57a0057 Assert that IsComplete() in GetSpendData() 2021-08-20 14:29:23 -04:00
Pieter Wuille
d8f4b976d5 Remove default nHashTypeIn arguments to MutableTransactionSignatureCreator
These were unused except in tests, and were also overlooked when changing
SIGHASH_ALL -> SIGHASH_DEFAULT.
2021-08-20 14:29:23 -04:00
Pieter Wuille
c7048aae95 Simplify SignTransaction precomputation loop 2021-08-20 14:29:23 -04:00
Pieter Wuille
addb9b5a71 Improve comments in taproot signing logic 2021-08-20 14:29:23 -04:00
fanquake
602c8eb8f0
Merge bitcoin/bitcoin#22697: addrman: Remove CAddrMan::Clear() function
4d2fa97031 [addrman] Clean up ctor (John Newbery)
7e6e65918f [addrman] inline Clear() into CAddrMan ctor (John Newbery)
406be5ff96 [addrman] Remove all public uses of CAddrMan.Clear() from the tests (John Newbery)
ed9ba8af08 [tests] Remove CAddrMan.Clear() call from CAddrDB::Read() (John Newbery)
e8e7392311 [addrman] Don't call Clear() if parsing peers.dat fails (John Newbery)
181a1207ba [addrman] Move peers.dat parsing to init.cpp (John Newbery)

Pull request description:

  `CAddrMan::Clear()` exists to reset the internal state of `CAddrMan`. It's currently used in two places:

  - on startup, if deserializing peers.dat fails, `Clear()` is called to reset to an empty addrman
  - in tests, `Clear()` is called to reset the addrman for more tests

  In both cases, we can simply destruct the `CAddrMan` and construct a new, empty addrman. That approach is safer - it's possible that `Clear()` could 'reset' the addrman to a state that's not equivalent to a freshly constructed addrman (one actual example of this is that `Clear()` does not clear the `m_tried_collisions` set). On the other hand, if we destruct and then construct a fresh addrman, we're guaranteed that the new object is empty.

  This wasn't possible when addrman was initially implemented, since it was a global, and so it would only be destructed on shutdown. However, addrman is now owned by `node.context`, so we have control over its destruction/construction.

ACKs for top commit:
  laanwj:
    Code review ACK 4d2fa97031
  vasild:
    ACK 4d2fa97031
  Zero-1729:
    crACK 4d2fa97031

Tree-SHA512: f715bf2cbff4f8c3a9dbc613f8c7f11846b065d6807faf3c7d346a0b0b29cbe7ce1dc0509465c2c9b88a8ad55299c9182ea53f5f743e47502a69a0f375e09408
2021-08-20 14:33:25 +08:00
John Newbery
4d2fa97031 [addrman] Clean up ctor
Use default initialization and initializer lists, and use range-based
for loops for resetting the buckets.
2021-08-19 11:29:54 +01:00
John Newbery
7e6e65918f [addrman] inline Clear() into CAddrMan ctor
Clear() is now only called from the ctor, so just inline the code into
that function.

The LOCK(cs) can be removed, since there can be no data races in the ctor.

Also move the function definition out of the header and into the cpp file.
2021-08-19 11:29:54 +01:00
John Newbery
406be5ff96 [addrman] Remove all public uses of CAddrMan.Clear() from the tests
Just use unique_ptr<CAddrMan>s and reset the pointer if a frest addrman is required.
Also make CAddrMan::Clear() private to ensure that no call sites are missed.
2021-08-19 11:26:53 +01:00
fanquake
638855af63
Merge bitcoin/bitcoin#19101: refactor: remove ::vpwallets and related global variables
62a09a3077 refactor: remove ::vpwallets and related global variables (Russell Yanofsky)

Pull request description:

  Get rid of global wallet list variables by moving them to WalletContext struct

  - [`cs_wallets`](e638acf697/src/wallet/wallet.cpp (L56)) is now [`WalletContext::wallet_mutex`](4be544c7ec/src/wallet/context.h (L37))
  - [`vpwallets`](e638acf697/src/wallet/wallet.cpp (L57)) is now [`WalletContext::wallets`](4be544c7ec/src/wallet/context.h (L38))
  - [`g_load_wallet_fns`](e638acf697/src/wallet/wallet.cpp (L58)) is now [`WalletContext::wallet_load_fns`](4be544c7ec/src/wallet/context.h (L39))

ACKs for top commit:
  achow101:
    ACK 62a09a3077
  meshcollider:
    re-utACK 62a09a3077

Tree-SHA512: 74428180d57b4214c3d96963e6ff43e8778f6f23b6880262d1272f2de67d02714fdc3ebb558f62e48655b221a642c36f80ef37c8f89d362e2d66fd93cbf03b8f
2021-08-19 09:42:21 +08:00
fanquake
607a6338a7
Merge bitcoin/bitcoin#22331: crypto: Fix K1/K2 use in ChaCha20-Poly1305 AEAD
cd37356ff9 [crypto] Fix K1/K2 use in ChaCha20-Poly1305 AEAD (Dhruv Mehta)

Pull request description:

  BIP324 mentions K1 is used for the associated data and K2 is used for the payload. The code does the opposite. This is not a security problem but will be a problem across implementations based on the HKDF key derivations.

  BIP324 author Jonas Schnelli thinks a [code update will be better](https://github.com/bitcoin/bitcoin/pull/15649#discussion_r440780669) than a BIP update.

  If this PR is merged:

  - [ ] We need to update the test vector 3 in BIP324

ACKs for top commit:
  jonasschnelli:
    utACK cd37356ff9

Tree-SHA512: e2165117bfbf7a031060e7376912f9af1c1bfc57916383799a0fa2c040e2caaab0d6aafc3425c083a233b96c84fafec75c938e00ceb6bd7d52607d58607cb145
2021-08-19 09:16:28 +08:00
fanquake
cabbd01d85
Merge bitcoin/bitcoin#22724: windres: use PACKAGE_VERSION rather than building more version numbers
f12fbad5a1 windres: use PACKAGE_VERSION rather than building more version numbers (fanquake)

Pull request description:

  Rather than defining more strings, reuse PACKAGE_VERSION, which is already available.

  We also already use PACKAGE_VERSION for `ProductVersion` and `FileVersion` in setup.nsi.

ACKs for top commit:
  MarcoFalke:
    cr ACK f12fbad5a1
  laanwj:
    Code review ACK f12fbad5a1

Tree-SHA512: b74a37cbba105d208d4da9264d295d7e052009fdd6b0ed54a0d9968bbe2deeba1766d6d310438b2939a81555faa0cbd67d5e53f0c8a2de669ce56353c1c67d22
2021-08-19 07:58:03 +08:00
Samuel Dobson
e9d6eb1b80
Merge bitcoin/bitcoin#22217: refactor: Avoid wallet code writing node settings file
49ee2a0ad8 Avoid wallet code writing node settings file (Russell Yanofsky)

Pull request description:

  Change wallet loading code to access settings through the Chain interface instead of writing settings.json directly. This is for running wallet and node in separate processes, since multiprocess code wouldn't easily work with different processes updating the same file.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). The commit was first part of larger PR #10102.

ACKs for top commit:
  jamesob:
    ACK 49ee2a0ad8 ([`jamesob/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co`](https://github.com/jamesob/bitcoin/tree/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co))
  ryanofsky:
    > ACK [49ee2a0](49ee2a0ad8) ([`jamesob/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co`](https://github.com/jamesob/bitcoin/tree/ackr/22217.1.ryanofsky.refactor_avoid_wallet_co))
  Zero-1729:
    crACK 49ee2a0ad8
  meshcollider:
    Code review ACK 49ee2a0ad8

Tree-SHA512: a81c63b87816f739e02e3992808f314294d6c7213babaafdaaf3c4650ebc97ee4f98f9a4684ce4ff87372df59989b8ad5929159c5686293a7cce04e97e2fabba
2021-08-19 10:44:25 +12:00
John Newbery
ed9ba8af08 [tests] Remove CAddrMan.Clear() call from CAddrDB::Read()
`bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)` is _only_
called from the tests, and the call to addr.Clear() only exists so that
a test that Clear() is called passes. Remove that test and the call.
2021-08-18 14:00:52 +01:00
John Newbery
e8e7392311 [addrman] Don't call Clear() if parsing peers.dat fails
Now that we manage the lifespan of node.addrman, we can just reset
node.addrman to a newly initialized CAddrMan if parsing peers.dat
fails, eliminating the possibility that Clear() leaves some old state
behind.
2021-08-18 14:00:52 +01:00
John Newbery
181a1207ba [addrman] Move peers.dat parsing to init.cpp 2021-08-18 14:00:52 +01:00
fanquake
d8ba6327b2
scripted-diff: replace clientInterface with m_client_interface in net
-BEGIN VERIFY SCRIPT-

sed -i -e "s/clientInterface/m_client_interface/g" src/net.cpp src/net.h

-END VERIFY SCRIPT-
2021-08-18 13:54:43 +08:00
fanquake
f68c6cebe6
net: use clientInterface rather than uiInterface 2021-08-18 13:54:09 +08:00
fanquake
b5c468cfe3
Merge bitcoin/bitcoin#22725: MOVEONLY: tests: Move addrman ser/deser tests to addrman_tests.cpp
aaa6ad5455 [MOVEONLY] [tests] Move addrman ser/deser tests to addrman_tests.cpp (John Newbery)

Pull request description:

  Addrman serialization/deserialization tests are currently in net_tests.cpp.
  Move them to addrman_tests.cpp with the rest of the addrman tests.

  Reviewer hint: review using `git diff --color-moved=dimmed-zebra`

ACKs for top commit:
  MarcoFalke:
    review ACK aaa6ad5455 📺
  mjdietzx:
    ACK aaa6ad5455
  Saviour1001:
    Concept ACK <code>[aaa6ad5](aaa6ad5455)</code>

Tree-SHA512: 9a575e63f8830a9dfba30ef63c83ae4b45813add9973308f0d7a2463886438575a2e8a4a23af5b19ed977fbaab1a212ef832f89a25de03920d493e9ebafa9c30
2021-08-18 08:57:34 +08:00
fanquake
62cb4009c2
Merge bitcoin/bitcoin#22215: refactor: Add FoundBlock.found member
5c5d0b6264 Add FoundBlock.found member (Russell Yanofsky)

Pull request description:

  This change lets IPC serialization code handle FoundBlock arguments more simply and efficiently. Without this change there was no way to determine from a FoundBlock object whether a block was found or not. So in order to correctly implement behavior of leaving FoundBlock output variables unmodified when a block was not found, IPC code would have to read preexisting output variable values from the local process, send them to the remote process, receive output values back from the remote process, and save them to output variables unconditionally. With FoundBlock.found method, the process is simpler. There's no need to read or send preexisting local output variable values, just to read final output values from the remote process and set them conditionally if the block was found.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). The commit was first part of larger PR #10102.

ACKs for top commit:
  fjahr:
    Code review ACK 5c5d0b6264
  theStack:
    Concept and code review ACK 5c5d0b6264
  jamesob:
    ACK 5c5d0b6264 ([`jamesob/ackr/22215.1.ryanofsky.refactor_add_foundblock`](https://github.com/jamesob/bitcoin/tree/ackr/22215.1.ryanofsky.refactor_add_foundblock))
  Zero-1729:
    crACK 5c5d0b6

Tree-SHA512: d906e1b7100ff72c3aa06d80bd77673887b2db670ebd52dce7c4f6f557a23a1744c6109308228a37fda6c6ea74f05ba0efecff0ef235ab06ea8acd861fbb8675
2021-08-18 08:49:48 +08:00
John Newbery
aaa6ad5455 [MOVEONLY] [tests] Move addrman ser/deser tests to addrman_tests.cpp
Addrman serialization/deserialization tests are currently in net_tests.cpp.
Move them to addrman_tests.cpp with the rest of the addrman tests.

Reviewer hint: review using `git diff --color-moved=dimmed-zebra`
2021-08-17 13:44:54 +01:00
fanquake
f12fbad5a1
windres: use PACKAGE_VERSION rather than building more version numbers
Rather than defining more strings, reuse PACKAGE_VERSION, which is
already available.

We already use PACKAGE_VERSION for `ProductVersion` and `FileVersion` in setup.nsi.
2021-08-17 16:54:47 +08:00
Russell Yanofsky
62a09a3077 refactor: remove ::vpwallets and related global variables
Move global wallet variables to WalletContext struct
2021-08-17 04:05:15 -04:00
fanquake
f3dbd1c2b2
Merge bitcoin/bitcoin#22627: [addrman] De-duplicate Add() function
60e0cbdd57 [addrman] Merge the two Add() functions (Amiti Uttarwar)

Pull request description:

  This PR merges the two definitions of this overloaded function to reduce code duplication.

  When these functions were introduced in 5fee401fe1, there were multiple places that invoked `Add()` with a single addr and a vector of addrs each, so it made sense to overload the function. I could see how the small difference in log statement was more meaningful when a peer was added via IRC :)

  Now, the definition of `Add()` that takes in a single address is only invoked from the hidden/test-only RPC `addpeeraddress`. These changes should not cause any observable difference, and are covered by the existing tests that use this RPC endpoint.

ACKs for top commit:
  jnewbery:
    Code review ACK 60e0cbdd57
  Zero-1729:
    crACK 60e0cbd
  fanquake:
    ACK 60e0cbdd57

Tree-SHA512: 782fb2ac6d2d403ba7d7ff543197ca42b610b9a8806952d271e57e2ee3527ad1a94af4ebbad5371b5e95d77df07c56ccc8c1d5a2c82cdecb0d2b5085b3bdd5ee
2021-08-17 10:05:03 +08:00
fanquake
df30375788
Merge bitcoin/bitcoin#22715: wallet: use FormatFullVersion() & PACKAGE_NAME in dumpwallet
2d7534bd93 wallet: use PACKAGE_NAME instead of "Bitcoin" in rpcdump (fanquake)
14b4802405 wallet: use FormatFullVersion instead of CLIENT_BUILD in rpcdump (fanquake)

Pull request description:

  The dumpwallet RPC is the last place we're using CLIENT_BUILD directly, rather FormatFullVersion() (which just returns it), so switch to using that. At the same time, use PACKAGE_NAME (Bitcoin Core), rather than just "Bitcoin".

ACKs for top commit:
  MarcoFalke:
    cr ACK 2d7534bd93
  laanwj:
    Tested ACK 2d7534bd93
  achow101:
    ACK 2d7534bd93
  Zero-1729:
    crACK 2d7534b

Tree-SHA512: b38ee074e317448719d2a628380786ec665413515b38d9ce680c21608bc2acf6a2bf817f78f100a8310477613ae72d6969cc4f595f4f44af0896659d3ebf2671
2021-08-17 08:56:17 +08:00
Zero-1729
021daedfa1
refactor: replace remaining binascii method calls 2021-08-16 19:30:56 +01:00
MarcoFalke
42b00a3758
Merge bitcoin/bitcoin#22649: fuzz: Avoid OOM in system fuzz target
fa7718344d fuzz: Avoid OOM in system fuzz target (MarcoFalke)

Pull request description:

  If the inputs size is unlimited, the target may consume unlimited memory, because the argsmanager stores the argument names. Limiting the size should fix this issue.

  Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36906

ACKs for top commit:
  practicalswift:
    cr ACK fa7718344d

Tree-SHA512: 6edfcf324ee9d94e511038ee01340f02db50bcb233af3f1a1717c3602164c88528d9d987e971ec32f1a4593b868019bea0102c53c9b02bfefec3dfde959483cf
2021-08-16 10:47:58 +02:00
fanquake
2d7534bd93
wallet: use PACKAGE_NAME instead of "Bitcoin" in rpcdump 2021-08-16 16:04:53 +08:00
fanquake
14b4802405
wallet: use FormatFullVersion instead of CLIENT_BUILD in rpcdump 2021-08-16 16:04:47 +08:00