Commit graph

31092 commits

Author SHA1 Message Date
fanquake
2b90eae33c
doc: update developer docs for subtree renaming 2021-09-29 15:12:12 +08:00
MarcoFalke
8daecf4d1d
Merge bitcoin/bitcoin#23108: ci: Enable extended tests on native Windows
fa87230ec5 ci: Enable extended tests on native Windows (MarcoFalke)

Pull request description:

ACKs for top commit:
  hebasto:
    ACK fa87230ec5

Tree-SHA512: d1b15a572021462b52e900d91b89b6a9cb3451fc7d1aebf4272f856b78fa1382a170ef9b7fb54702ebe0b2e123e3b618375bcf99a390e57c2039cbab61fa9114
2021-09-29 08:26:20 +02:00
MarcoFalke
7d4ea7c7ef
Merge bitcoin/bitcoin#23120: test: Remove unused and confusing main parameter from script_util
fa54efda9b test: pep-8 touched test (MarcoFalke)
fa46768059 test: Remove unused and confusing main parameter from script_util (MarcoFalke)

Pull request description:

ACKs for top commit:
  fanquake:
    ACK fa54efda9b

Tree-SHA512: 124e888e16c92bb24ab4d6f68a768d295500a48f8c6c0b4f069493effcd761f80be78dd93b31edbb529ebe4c8aaca764aaff48d1e3b23659dde722981dc787a5
2021-09-29 08:08:25 +02:00
Samuel Dobson
b207971465 Fix feature_segwit failure due to witness 2021-09-29 17:41:35 +13:00
Samuel Dobson
6c006495ef Remove outdated dummy wallet -salvagewallet arg 2021-09-29 15:45:20 +13:00
Amiti Uttarwar
021f86953e [style] Run changed files through clang formatter. 2021-09-28 22:21:10 -04:00
Amiti Uttarwar
375750387e scripted-diff: Rename CAddrInfo to AddrInfo
-BEGIN VERIFY SCRIPT-
git grep -l CAddrInfo src/ | xargs sed -i 's/CAddrInfo/AddrInfo/g'
-END VERIFY SCRIPT-
2021-09-28 22:21:10 -04:00
Amiti Uttarwar
dd8f7f2500 scripted-diff: Rename CAddrMan to AddrMan
-BEGIN VERIFY SCRIPT-
git grep -l CAddrMan src/ test/ | xargs sed -i 's/CAddrMan/AddrMan/g'
-END VERIFY SCRIPT-
2021-09-28 22:21:10 -04:00
Amiti Uttarwar
3c263d3f63 [includes] Fix up included files 2021-09-28 22:21:06 -04:00
fanquake
a11da75411
bloom: cleanup includes 2021-09-29 09:48:36 +08:00
fanquake
f1ed1d3194
bloom: use constexpr where appropriate 2021-09-29 09:43:37 +08:00
William Casarin
2ba4ddf31d
bloom: use Span instead of std::vector for insert and contains
We can avoid many unnecessary std::vector allocations by changing
CBloomFilter to take Spans instead of std::vector's for the `insert`
and `contains` operations.

CBloomFilter currently converts types such as CDataStream and uint256
to std::vector on `insert` and `contains`. This is unnecessary because
CDataStreams and uint256 are already std::vectors internally. We just
need a way to point to the right data within those types. Span gives
us this ability.

Signed-off-by: William Casarin <jb55@jb55.com>
2021-09-29 09:40:10 +08:00
fanquake
3c776fdcec
Merge bitcoin/bitcoin#23122: doc: Remove un-actionable TODO from chainparams.cpp
fa189621cc doc: Remove un-actionable TODO from chainparams.cpp (MarcoFalke)

Pull request description:

  This can't be fixed by writing code, see discussion in https://github.com/bitcoin/bitcoin/pull/23021/files#r717426632

ACKs for top commit:
  jarolrod:
    ACK fa189621cc
  prayank23:
    ACK fa189621cc

Tree-SHA512: 3c5c0a0f45d057c9a617797007220837d7dcb29ae5996441e41b3698a67dc3d898f465adc0a958ecef430068cd9c564540bb534bbb3b230a53130ea001629f3e
2021-09-29 09:20:56 +08:00
Amiti Uttarwar
29727c2aa1 [doc] Update comments
Maintain comments on the external interfaces rather than on the internal
functions that implement them.
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
14f9e000d0 [refactor] Update GetAddr_() function signature
Update so the internal function signature matches the external one, as is the
case for the other addrman functions.
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
40acd6fc9a [move-only] Move constants to test-only header
Review hint: git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
7cf41bbb38 [addrman] Change CAddrInfo access
Since knowledge of CAddrInfo is limited to callsites that import
addrman_impl.h, only objects in addrman.cpp or the tests have access. Thus we
can remove calling them friends and make the members public.
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
e3f1ea659c [move-only] Move CAddrInfo to test-only header file
Now that no bitcoind callers require knowledge of the CAddrInfo object, it can
be moved into the test-only header file.

Review hint: use git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
7cba9d5618 [net, addrman] Remove external dependencies on CAddrInfo objects
CAddrInfo objects are an implementation detail of how AddrMan manages and adds
metadata to different records. Encapsulate this logic by updating Select &
SelectTriedCollision to return the additional info that the callers need.
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
8af5b54f97 [addrman] Introduce CAddrMan::Impl to encapsulate addrman implementation.
Introduce the pimpl pattern for CAddrMan to separate the implementation details
from the externally used object representation. This reduces compile-time
dependencies and conceptually clarifies AddrMan's interface from the
implementation specifics.

Since the unit & fuzz tests currently rely on accessing CAddrMan internals, this
commit introduces addrman_impl.h, which is exclusively imported by addrman.cpp
and test files.

Review hint: git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space
2021-09-28 19:02:34 -04:00
Amiti Uttarwar
f2e5f38f09 [move-only] Match ordering of CAddrMan declarations and definitions
Also move `Check` and `ForceCheckAddrman` to be after the `FunctionName_` functions.

Review hint: use git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space
2021-09-28 18:56:36 -04:00
Samuel Dobson
6a5381a06b
Merge bitcoin/bitcoin#20591: wallet, bugfix: fix ComputeTimeSmart function during rescanning process.
240ea294d5 doc: update doxygen documention of ComputeTimeSmart() and AddToWalletIfInvolvingMe() regarding rescanning_old_block parameter (BitcoinTsunami)
d6eb39af21 test: add functional test to check transaction time determination during block rescanning (BitcoinTsunami)
07b44f16e7 wallet: fix ComputeTimeSmart algorithm to use blocktime during old block rescanning (BitcoinTsunami)

Pull request description:

  The function ComputeTimeSmart in wallet.cpp assume that transaction are discovered in the right order.
  Moreover the 'smarttime' determination algorithm is coded with realtime scenario in mind and not rescanning of old block.

  The functional test demonstrate that if the user import a wallet, then rescan only recent history, and then rescan the entire history, the older transaction discovered would have an incorrect time determination.
  In the context of rescanning old block, the only time value that as a meaning is the blocktime.

  That's why I've fixed the problem with a simple separation between rescanning of old block and realtime time determination. The fix is written to have no impact on every realtime scenario and only impact the behaviour during a rescanning process.
  This PR Fixes #20181.

  To be fair, I don't think that this bug could be triggered with the wallet GUI, because it always proceed with a proper rescan.
  But RPC API provide the possibility to trigger it. I've discovered it, because Specter desktop v0.10.0 was impacted. (https://github.com/cryptoadvance/specter-desktop/issues/680).

ACKs for top commit:
  jonatack:
    ACK 240ea294d5 per `git diff b92d552 240ea29`, re-verified rebase to latest master + debug build clean + new test passes on the branch and fails on master, only change since my review a few hours ago is incorporation of latest review suggestions
  meshcollider:
    re-utACK 240ea294d5

Tree-SHA512: 514b02e41d011ddfa325f5e8080b93800e1ea4ed5853fa420670a6ac700e8b463000dbea65f8ced8565cfb950c7f51b69154034dcb111e67aca3b964a0061494
2021-09-29 11:18:23 +13:00
Samuel Dobson
10c6929d55 Include vout when copying transaction ID from coin selection 2021-09-29 11:16:59 +13:00
Samuel Dobson
b55232a337
Merge bitcoin/bitcoin#22722: rpc: update estimatesmartfee to return max of CBlockPolicyEstimator::estimateSmartFee, mempoolMinFee and minRelayTxFee
ea31caf6b4 update estimatesmartfee rpc to return max of estimateSmartFee, mempoolMinFee and minRelayTxFee. (pranabp-bit)

Pull request description:

  This PR is in response to the issue [#19699](https://github.com/bitcoin/bitcoin/issues/19699).

  Based on the discussion in the comments of PR [#22673](https://github.com/bitcoin/bitcoin/pull/22673) changes have been made in the `estimatesmartfee` itself such that it takes into account `mempoolMinFee` and `relayMinFee` . Hence it provides a fee estimate that is most likely to be paid by the user in an actual transaction, preventing issues such as [#16072](https://github.com/bitcoin/bitcoin/issues/16072).

  The test file test/functional/feature_fee_estimation.py has also been updated to check this functionality.

ACKs for top commit:
  meshcollider:
    re-utACK ea31caf6b4

Tree-SHA512: 8f36153a07cbd552c5c13d11d9c6e987a7a555ea4cc83f2573c0c92dd97c706d90c30a7248671437c2f3a836d3272f8fad53d15a5fa6efaa0409ae8009b0a18d
2021-09-29 10:55:29 +13:00
Samuel Dobson
d6492d4ed0
Merge bitcoin/bitcoin#22650: Remove -deprecatedrpc=addresses flag and corresponding code/logic
43cd6b8af9 doc: add release notes for removal of the -deprecatedrpc=addresses flag (Michael Dietz)
2b1fdc2c6c refactor: minor styling, prefer snake case and same line if (Michael Dietz)
d64deac7b8 refactor: share logic between ScriptPubKeyToUniv and ScriptToUniv (Michael Dietz)
8721638daa rpc: remove deprecated addresses and reqSigs from rpc outputs (Michael Dietz)

Pull request description:

  Resolves #21797 now that we've branched-off to v23 ("addresses" and "reqSigs" deprecated) "ExtractDestinations" should be removed.

   `-deprecatedrpc=addresses` was initially added in this PR #20286 (which resolved the original issue #20102).

  Some chunks of code and logic are no longer used/necessary with the removal of this, and therefore some minor refactoring is done in this PR as well (separated commits)

ACKs for top commit:
  MarcoFalke:
    re-ACK 43cd6b8af9 🐉
  meshcollider:
    Code review ACK 43cd6b8af9
  jonatack:
    ACK 43cd6b8af9 per `git range-diff a9d0cec 92dc5e9 43cd6b8`, also rebased to latest master, debug built + quick re-review of each commit to bring back context, and ran tests locally at the final commit

Tree-SHA512: fba83495e396d3c06f0dcf49292f14f4aa6b68fa758f0503941fade1a6e7271cda8378e2734af1faea550d1b43c85a36c52ebcc9dec0732936f9233b4b97901c
2021-09-29 10:41:30 +13:00
Hennadii Stepanov
f000cdcf0a
Merge bitcoin-core/gui#434: Keep InitExecutor in main gui thread
03a5fe06bd qt: Keep InitExecutor in main gui thread (João Barbosa)

Pull request description:

  The `InitExecutor` constructor moves the instance to a dedicated thread. This PR changes that by using `GUIUtil::ObjectInvoke` to run the relevant code in that thread.

  A possible follow-up is to ditch the dedicated thread and use `QThreadPool` or even `QtConcurrent::run` (if we want to enable that).

ACKs for top commit:
  hebasto:
    ACK 03a5fe06bd, tested on Linux Mint 20.2 (Qt 5.12.8).
  jarolrod:
    ACK 03a5fe06bd

Tree-SHA512: 8b40300371d4c04efb9913600a06ba4899af0b5f50fdb26ea23ec751df6d3bd52f8bd693a5e8f6a94ebf3790583dc96c6070e6878d247dece62347aa9bd99031
2021-09-28 23:26:29 +03:00
Niklas Gögge
18c5b23a0f [test] Test that -blocksonly nodes still serve compact blocks. 2021-09-28 22:11:30 +02:00
Niklas Gögge
a79ad65fc2 [test] Test that getdata(CMPCT) is still sent on regular low bandwidth connections.
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-09-28 22:11:30 +02:00
Niklas Gögge
5e231c116b [test] Test that -blocksonly nodes do not send getdata(CMPCT) on a low bandwidth connection.
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-09-28 22:11:30 +02:00
Niklas Gögge
5bf6587457 [test] Test that -blocksonly nodes do not request high bandwidth mode.
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-09-28 22:11:30 +02:00
Niklas Gögge
0dc8bf5b92 [net processing] Dont request compact blocks in blocks-only mode 2021-09-28 22:11:30 +02:00
BitcoinTsunami
240ea294d5 doc: update doxygen documention of ComputeTimeSmart() and AddToWalletIfInvolvingMe() regarding rescanning_old_block parameter 2021-09-28 21:49:35 +02:00
BitcoinTsunami
d6eb39af21 test: add functional test to check transaction time determination during block rescanning 2021-09-28 21:49:22 +02:00
BitcoinTsunami
07b44f16e7 wallet: fix ComputeTimeSmart algorithm to use blocktime during old block rescanning 2021-09-28 20:56:52 +02:00
Amiti Uttarwar
5faa7dd6d8 [move-only] Move CAddrMan function definitions to cpp
In preparation for introducing the pimpl pattern to addrman, move all function
bodies out of the header file.

Review hint: use git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space
2021-09-28 14:46:02 -04:00
MarcoFalke
fa189621cc
doc: Remove un-actionable TODO from chainparams.cpp 2021-09-28 20:18:20 +02:00
MarcoFalke
fa87230ec5
ci: Enable extended tests on native Windows 2021-09-28 20:12:36 +02:00
MarcoFalke
fa54efda9b
test: pep-8 touched test
Can be reviewed with "--word-diff-regex=.".
2021-09-28 15:48:55 +02:00
MarcoFalke
fa46768059
test: Remove unused and confusing main parameter from script_util
Bitcoin script opcodes are equal on all chains (main and test) anyway.

Can be reviewed with "--word-diff-regex=.".
2021-09-28 15:46:57 +02:00
W. J. van der Laan
efa227f5df
Merge bitcoin/bitcoin#23097: Run specified functional tests with all matching flags
b8909b0746 Run functional tests with all possible flags (Samuel Dobson)

Pull request description:

  Functional tests which use flags like `--descriptors` or `--legacy-wallet` won't run if only the base script is given to `test_runner.py` because it doesn't match any script in the list exactly. It would be easier if it would just run both options.

  For example, instead of:
  ```
  test_runner.py 'wallet_basic.py --legacy-wallet' 'wallet_basic.py --descriptors'
  ```

  We can now just run:
  ```
  test_runner.py wallet_basic
  ```

  Also useful for `--usecli`, the IPv4/IPv6/nonloopback `rpc_bind.py` variations, etc.

ACKs for top commit:
  laanwj:
    Code review ACK b8909b0746
  MarcoFalke:
    review ACK b8909b0746

Tree-SHA512: d367037cb170e705551726d47fe4569ebc3ceadece280dd3edbb3ecb41e19f3263d6d272b407316ed6011164e850df4321fb340b1b183b34497c9f7cc439f4d8
2021-09-28 15:32:23 +02:00
pranabp-bit
ea31caf6b4 update estimatesmartfee rpc to return max of estimateSmartFee, mempoolMinFee and minRelayTxFee.
This will provide better estimates which would be closer to fee paid in actual
transactions.
The test has also been changed such that when the node is restarted with a
high mempoolMinFee, the estimatesmartfee still returns a feeRate greater
than or equal to the mempoolMinFee, minRelayTxFee.(just like the feeRate of actual transactions)
2021-09-28 18:36:38 +05:30
fanquake
dccf3d25f9
Merge bitcoin/bitcoin#23117: test: Use assert_equal over assert for easier debugging
fa8f3ba131 test: pep-8 (MarcoFalke)
fac5708afc test: Use assert_equal over assert for easier debugging (MarcoFalke)

Pull request description:

  See #23116

ACKs for top commit:
  jonatack:
    Light code review ACK fa8f3ba131
  hebasto:
    ACK fa8f3ba131, I have reviewed the code and it looks OK, I agree it can be merged.
  theStack:
    Code-review ACK fa8f3ba131

Tree-SHA512: bfdb91fd72144f05c38ed9aa8e40e17f59dcb90ac164b8bd01e241296a6c91a01f79a95a5eb97cc8445fdabe8605ef5b8062219a683613627c776feb7433a460
2021-09-28 20:16:06 +08:00
MarcoFalke
fa8f3ba131
test: pep-8 2021-09-28 10:52:33 +02:00
MarcoFalke
fac5708afc
test: Use assert_equal over assert for easier debugging 2021-09-28 10:48:51 +02:00
MarcoFalke
a9d0cec499
Merge bitcoin/bitcoin#23106: Ensure wallet is unlocked before signing PSBT with walletprocesspsbt and GUI
7e3ee4cdd0 GUI: Ask user to unlock wallet before signing psbt (Samuel Dobson)
0f3acecf33 Add test that walletprocesspsbt requires unlocked wallet when signing (Samuel Dobson)
0e895212bb Ensure wallet is unlocked before signing in walletprocesspsbt (Samuel Dobson)

Pull request description:

  If signing a PSBT, we need to ensure the wallet is unlocked.

  Fixes #22874, fixes bitcoin-core/gui#312

ACKs for top commit:
  achow101:
    ACK 7e3ee4cdd0
  lsilva01:
    Code Review ACK 7e3ee4cdd0
  benthecarman:
    ACK 7e3ee4cdd0

Tree-SHA512: 6726a873582747900ab454ea21153a92be86808a4c1517dc2856b389876a2da9e8df1ffa9b567b6bd017038342c3544ecf5ca3c97744e7debe0a5ee65563687d
2021-09-28 09:49:44 +02:00
Samuel Dobson
a8bbd4cc81
Merge bitcoin/bitcoin#22938: test: Add remaining scenarios of 0 waste, in wallet waste_test
efcaefc7b5 test: Add remaining scenarios of 0 waste (rajarshimaitra)

Pull request description:

  As per the [review club](https://bitcoincore.reviews/22009) discussion on #22009 , it was observed that there were other two fee scenarios in which selection waste could be zero.

  These are:
   - (LTF - Fee) == Change Cost
   - (LTF - Fee) == Excess

  Even though these are obvious by the definition of waste metric, adding tests for them can be helpful in explaining its behavior
  to new readers of the code base, along with pinning the behavior for future.

  This PR adds those two cases to waste calculation unit test.

  Also let me know if I am missing more scenarios.

ACKs for top commit:
  jonatack:
    Tested re-ACK efcaefc7b5
  achow101:
    ACK efcaefc7b5
  meshcollider:
    ACK efcaefc7b5

Tree-SHA512: 13fe3e2c0ea7bb58d34e16c32908b84705130dec16382ff941e5e60ca5b379f9c5811b33f36c4c72d7a98cfbb6af2f196d0a69e96989afa4b9e49893eaadd7cb
2021-09-28 20:20:06 +13:00
MarcoFalke
27836f296d
Merge bitcoin/bitcoin#22942: fuzz: Cleanup muhash fuzz target
0000dca6f0 fuzz: Cleanup muhash fuzz target (MarcoFalke)

Pull request description:

ACKs for top commit:
  fjahr:
    ACK 0000dca6f0

Tree-SHA512: 9893ad5cea0faf94a18a778ae9d62d4a37850b445b6f22fdbe57c882c956c8bca6d03dd040aa4512ce3fba350b186c3d5ed80295b6310bea60197783b50b01b6
2021-09-28 08:38:09 +02:00
fanquake
67eae69f3f
Merge bitcoin/bitcoin#23060: release: increase minimum compiler and lib(std)c++ requirements
182de7ba10 ci: update minimum compiler requirements for std::filesystem (fanquake)
04f5bafb7b doc: update minimum compiler requirements for std::filesystem (fanquake)

Pull request description:

  This increases the minimum required compiler versions to Clang 7 and GCC 8.1. This has been split out of #20744 (migration to `std::filesystem`), as it's also a requirement for some other changes, such as #20452 or #20457 which want to make use of `std::from_chars`. As well as #20435, which is also `std::filesystem` related. Given that the `std::filesystem` changes are moving ahead, splitting out this change to let other PRs take advantage of the new requirements seems worthwhile.

  Clang 7 has been available in Debian since [Stretch (oldoldstable)](https://packages.debian.org/stretch/clang-7) and in Ubuntu since [Bionic (18.04)](https://packages.ubuntu.com/bionic-updates/clang-7). GCC 8 has been available in Debian since [Buster (oldstable)](https://packages.debian.org/buster/gcc) and in Ubuntu since [Bionic (18.04)](https://packages.ubuntu.com/bionic/gcc-8). CentOS 8 also packages GCC 8.

  The CI changes here give us one build with GCC 8, and another using Clang 7 on top of libc++.

  Note that the minimum required libc++ in dependencies.md is unchanged as, at least for `<filesystem>`, and the `*_chars` use cases, libc++ 7 [should be sufficient](https://en.cppreference.com/w/cpp/compiler_support/17).

  I've tested that building `<filesystem>` code using Clang 7 & libc++ works. i.e `clang++-7 -std=c++17 fs.cpp -stdlib=libc++ -lc++fs`. Also that building `<filesystem>` code with Clang 7 and libstdc++ 8 works. i.e `clang++-7 -std=c++17  fs.cpp -lstdc++fs`.

ACKs for top commit:
  MarcoFalke:
    review ACK 182de7ba10

Tree-SHA512: 5bc151c4be58005711eed6bd8a091f3417f75a0218c11c08cffff9d749edadd965726bb7856a8e693e96e69ed0596989cda1aac4b29fb6d30705b1687a5b3363
2021-09-28 14:03:14 +08:00
Samuel Dobson
7e3ee4cdd0 GUI: Ask user to unlock wallet before signing psbt 2021-09-28 13:27:07 +13:00
Samuel Dobson
0f3acecf33 Add test that walletprocesspsbt requires unlocked wallet when signing 2021-09-28 13:27:07 +13:00