Commit graph

31988 commits

Author SHA1 Message Date
MarcoFalke
08dcc5912d
Merge bitcoin/bitcoin#23688: test: remove unneeded sync_all() calls in wallet_listtransactions.py
0ba98eda28 test: remove unneeded sync_all() calls in wallet_listtransactions.py (Sebastian Falbesoner)

Pull request description:

  This is a small follow-up to #23659. The `self.sync_all()` calls after generating blocks can be removed, since that happens automatically per default by the test framework's generate function (if no explicit sync_fun is passed).
  On the course of touching the file, imports are sorted and the grammar of a log message is fixed.

ACKs for top commit:
  fanquake:
    ACK 0ba98eda28 - thanks for following up.
  shaavan:
    ACK 0ba98eda28

Tree-SHA512: 451e733865dcb1e424d90289c8c89272837a9af6fd4b77d6c60728c84524d9c792d684b7e601b02a0efda67231183c42dd9040d96214ac7d9473b2808cabe73f
2021-12-07 08:57:46 +01:00
MarcoFalke
877f3aa85c
Merge bitcoin/bitcoin#23686: test: fix interface_bitcoin_cli.py --descriptors and add to test runner
035767f54a test: add interface_bitcoin_cli.py --descriptors to test_runner.py (Sebastian Falbesoner)
e4fa28a322 test: fix test interface_bitcoin_cli.py for descriptor wallets (Sebastian Falbesoner)

Pull request description:

  The functional test interface_bitcoin_cli.py currently fails on master branch, if descriptor wallets are used (argument `--descriptors`), see #23684. This is due to the fact that different change output types are used for created transactions (P2WPKH for legacy wallets, P2TR for descriptor wallets; the former doesn't have a ScriptPubKeyMan for bech32m), resulting in different tx sizes and hence also fees. Fix this by explicitely setting the output type via passing both `-addresstype=bech32` and `-changetype=bech32` as argument. The former would not be needed by now, but makes the test more deterministic and avoids a failure if bech32m becomes the default address type.

  Fixes #23684, should also pave the way for #23682.

Top commit has no ACKs.

Tree-SHA512: 39b780e25e4c7094cb3378e0f10d4a8aebac1500b7b2d68de47e54e23b9b5efe5afcf8765bb8398eeaf56968e2586a1b294a0f8773c7d90f4188a0f00b8501ff
2021-12-07 08:51:05 +01:00
fanquake
6223e550c5
Merge bitcoin/bitcoin#23685: doc: Merge release note snippets
faef7e93e1 doc: Merge release note snippets (MarcoFalke)

Pull request description:

  Periodic merge to make it easier to browse them in one file.

  Can be reviewed with `--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`

ACKs for top commit:
  shaavan:
    ACK faef7e93e1
  fanquake:
    ACK faef7e93e1

Tree-SHA512: 590f36af45a53413bd602fdd8810bf5733b4bad78bf257f3e91e1001f47d86e5a00db4fcbaaa2585e702c2d824e6c225da14e7ae7a90c2a150908c278bb2a911
2021-12-07 08:56:55 +08:00
Sebastian Falbesoner
0ba98eda28 test: remove unneeded sync_all() calls in wallet_listtransactions.py 2021-12-06 23:36:31 +01:00
Carl Dong
8d466a8504 Move -checkblocks LogPrintf to AppInitMain 2021-12-06 16:41:58 -05:00
Carl Dong
aad8d59789 node/chainstate: Reduce coupling of LogPrintf
...by moving the try/catch out of LoadChainstate

I strongly recommend reviewing with the following git-diff flags:
  --color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change
2021-12-06 16:41:58 -05:00
Carl Dong
b345979a2b node/chainstate: Decouple from concept of uiInterface
...instead allow the caller to optionally pass in callbacks which are
triggered for certain events.

Behaviour change: The string "Verifying blocks..." was previously
printed for each chainstate in chainman which did not have an
effectively empty coinsview, now it will be printed once unconditionally
before we call VerifyLoadedChain.
2021-12-06 16:41:33 -05:00
Pieter Wuille
31ba1af74a Remove unused (and broken) functionality in SpanReader
This removes the ability to set an offset in the SpanReader constructor,
as the current code is broken. All call sites use pos=0, so it is actually
unused. If future call sites need it, SpanReader{a, b, c, d} is equivalent
to SpanReader{a, b, c.subspan(d)}.

It also removes the ability to deserialize from SpanReader directly from
the constructor. This too is unused, and can be more idiomatically
simulated using (SpanReader{a, b, c} >> x >> y >> z) instead of
SpanReader{a, b, c, x, y, z}.
2021-12-06 16:18:14 -05:00
Carl Dong
ca7c0b934d Split off VerifyLoadedChainstate 2021-12-06 15:58:10 -05:00
Carl Dong
adf4912d77 node/chainstate: Remove do/while loop
I strongly recommend reviewing with the following git-diff flags:
  --ignore-space-change
2021-12-06 15:57:46 -05:00
Carl Dong
975235ca0a Move init logistics message for BAD_GENESIS_BLOCK to init.cpp 2021-12-06 15:56:55 -05:00
Carl Dong
8715658983 Move mempool nullptr Assert out of LoadChainstate 2021-12-06 15:56:55 -05:00
Carl Dong
9162a4f93e node/chainstate: Decouple from concept of NodeContext
...instead pass in only the necessary information

Also allow mempool to be a nullptr
2021-12-06 15:56:55 -05:00
Carl Dong
c7a5c46e6f node/chainstate: Decouple from ArgsManager
...instead pass in only the necessary information
2021-12-06 15:56:55 -05:00
Carl Dong
ae9121f958 node/chainstate: Decouple from stringy errors
This allows us to separate the initialization code from translations and
error reporting.

This change changes the caller semantics of LoadChainstate quite
drastically.

To see that this change doesn't change behaviour, observe that:

1. Prior to this change, LoadChainstate returned false only in the "bad
   genesis block" failure case (by returning InitError()), indicating
   that the caller should immediately bail. After this change, the
   corresponding ERROR_BAD_GENESIS_BLOCK handler in src/init.cpp
   maintains behavioue by also bailing immediately.

2. The failed_* temporary booleans were only used to break out of the
   outer do/while(false) loop. They can therefore be safely removed.
2021-12-06 15:56:50 -05:00
Carl Dong
cbac28b72f node/chainstate: Decouple from GetTimeMillis
...instead just move it out
2021-12-06 15:55:49 -05:00
Carl Dong
cb64af9635 node: Extract chainstate loading sequence
I strongly recommend reviewing with the following git-diff flags:
  --color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change

[META] This commit is intended to be as close to a move-only commit as
       possible, and lingering ugliness will be resolved in subsequent
       commits.

A few variables that are passed in by value instead of by reference
deserve explanation:

- fReset and fReindexChainstate are both local variables in AppInitMain
  and are not modified in the sequence

- fPruneMode, despite being a global, is only modified in
  AppInitParameterInteraction, long before LoadChainstate is called

----

[META] This semantic will change in a future commit named
       "node/chainstate: Decouple from stringy errors"
2021-12-06 15:55:16 -05:00
Sebastian Falbesoner
035767f54a test: add interface_bitcoin_cli.py --descriptors to test_runner.py 2021-12-06 20:13:10 +01:00
Sebastian Falbesoner
e4fa28a322 test: fix test interface_bitcoin_cli.py for descriptor wallets 2021-12-06 20:13:06 +01:00
W. J. van der Laan
786ffb3ae4
Merge bitcoin/bitcoin#17160: refactor: net: subnet lookup: use single-result LookupHost()
a989f98d24 refactor: net: subnet lookup: use single-result LookupHost() (Sebastian Falbesoner)

Pull request description:

  plus describe single IP subnet case for more clarity

ACKs for top commit:
  jonatack:
    utACK a989f98d24 the patch rebases cleanly to master, the debug build is green, and it is essentially the same patch as c8991f0251dd2a modulo local variable naming, braced initialization, and a comment
  vasild:
    ACK a989f98d24

Tree-SHA512: 082d3481b1fa5e5f3267b7c4a812954b67b36d1f94c5296fe20110699f053e5042dfa13f728ae20249e9b8d71e930c3b119410125d0faeccdfbdc259223ee3a6
2021-12-06 19:59:35 +01:00
W. J. van der Laan
695ba2fe54
Merge bitcoin/bitcoin#23486: rpc: Only allow specific types to be P2(W)SH wrapped in decodescript
99993425af rpc: Only allow specific types to be P2(W)SH wrapped in decodescript (MarcoFalke)

Pull request description:

  It seems confusing to return a P2SH wrapping address that is eventually either policy- or consensus-unspendable.

ACKs for top commit:
  laanwj:
    Code review re-ACK 99993425af

Tree-SHA512: 3cd530442acee7c295d244995f0f17b2cae7212f1e0970bb5807621f8ff8e4308a3236b385d77087cd493d32ee524813d8edd15e91d937ef9a800094b7bc4946
2021-12-06 19:26:04 +01:00
Andrew Toth
bce20c34d6
Include coinbase transactions in receivedby wallet rpcs 2021-12-06 12:30:58 -05:00
node01
9544ab60ce doc: Improve ZMQ documentation
Co-authored-by: 0xB10C <19157360+0xB10C@users.noreply.github.com>
Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2021-12-06 13:31:28 -03:00
MarcoFalke
faef7e93e1
doc: Merge release note snippets 2021-12-06 13:55:02 +01:00
MarcoFalke
dca9ab48b8
Merge bitcoin/bitcoin#23661: cover DisconnectBlock with lock annotation
7da4a8ffb3 cover DisconnectBlock with lock annotation (James O'Beirne)

Pull request description:

  While reviewing #23630, I noticed that `DisconnectBlock` is uncovered by lock annotations. CoinsTip() access requires cs_main and therefore so should this function.

ACKs for top commit:
  jonatack:
    ACK 7da4a8ffb3

Tree-SHA512: 3e2b0247c138b31deeadcd48eb3f7bc8d32c0b6bb6d6e94ccf8ea0cbbc50b1b35d83f662eee432f2bd2d87a3fe9c94604da806ec711df93298bfb0ab34a5a05b
2021-12-06 13:38:54 +01:00
MarcoFalke
8b2c0df83e
Merge bitcoin/bitcoin#23614: test: add unit test for block-relay-only eviction
4740fe8212 test: Add test for block relay only eviction (Martin Zumsande)

Pull request description:

  Adds a unit test for block-relay-only eviction logic added in #19858, which was not covered by any tests before. The added test is very similar to the existing `stale_tip_peer_management` unit test, which tests the analogous logic for regular outbound peers.

ACKs for top commit:
  glozow:
    reACK 4740fe8212
  rajarshimaitra:
    tACK 4740fe8212
  shaavan:
    ACK 4740fe8212. Great work @ mzumsande!
  LarryRuane:
    ACK 4740fe8212

Tree-SHA512: 5985afd7d8f7ae311903dbbf6b7d526e16309c83c88ae6dd6551960c0b186156310a6be0cf6b684f82ac1378d0fc5aa3717f0139e078471013fceb6aebe81bf6
2021-12-06 13:23:55 +01:00
MarcoFalke
32d9f3770a
Merge bitcoin/bitcoin#23596: test: fix wallet_transactiontime_rescan.py --descriptors and add to test runner
e4a54af6b8  test: add wallet_transactiontime_rescan.py --descriptors to test_runner.py (Sebastian Falbesoner)
b60e02e993 test: fix test wallet_transactiontime_rescan.py for descriptor wallets (Sebastian Falbesoner)
a905ed1a61 test: refactor: use `set_node_times` helper in wallet_transactiontime_rescan.py (Sebastian Falbesoner)

Pull request description:

  The functional test wallet_transactiontime_rescan.py currently fails on master branch, if descriptor wallets are used (argument `--descriptors`). This is due to the fact that in this case, the test framework maps the importaddress RPC calls to the importdescriptors RPC (rescan=False -> timestamp='now'), which always rescans blocks of the past 2 hours, based on the current MTP timestamp. In order to avoid importing the last address (wo3), we generate 10 more blocks with advanced time, to ensure that the balance after importing is zero:
  681b25e3cd/test/functional/wallet_transactiontime_rescan.py (L125-L134)

  Calling this test with descriptor wallets is also added to test runner. Fixes #23562.

ACKs for top commit:
  Sjors:
    tACK e4a54af
  brunoerg:
    tACK e4a54af6b8

Tree-SHA512: 9fd8e298d48dd7947b1218d61a1a66c1241b3dbb14451b0ec7cd30caa74ee540e7ee5a7bd10d421b9e3b6e549fa5c3e85bd02496436128b433b328118642f600
2021-12-06 12:28:25 +01:00
W. J. van der Laan
22feb7fee9
Merge bitcoin/bitcoin#23577: Follow-ups to Bech32 error detection
a4fe70171b Make Bech32 LocateErrors return error list rather than using out-arg (Samuel Dobson)
2fa4fd1961 Use std::iota instead of manually pushing range (Samuel Dobson)
405c96fc9f Use bounds-checked array lookups in Bech32 error detection code (Samuel Dobson)
28d9c2857f Simplify encoding of e in GF(1024) tables to (1,0) (Samuel Dobson)
14358a029d Replace GF1024 tables and syndrome constants with compile-time generated constexprs. (Samuel Dobson)
63f7b69779 Update release note for bech32 error detection (Samuel Dobson)
c8b9a224e7 Report encoding type in bech32 error message (Samuel Dobson)
92f0cafdca Improve Bech32 boost tests (Samuel Dobson)
bb4d3e9b97 Address review comments for Bech32 error validation (Samuel Dobson)

Pull request description:

  A number of follow-ups and improvements to the bech32 error location code, introduced in #16807.

  Notably, this removes the hardcoded GF1024 tables in favour of constexpr table generation.

ACKs for top commit:
  laanwj:
    Re-ACK a4fe70171b

Tree-SHA512: 6312373c20ebd6636f5797304876fa0d70fa777de2f6c507245f51a652b3d1224ebc55b236c9e11e6956c1e88e65faadab51d53587078efccb451455aa2e2276
2021-12-06 12:18:17 +01:00
MarcoFalke
fad2e0a36a
ci: Make macOS native task sqlite only 2021-12-06 12:03:26 +01:00
MarcoFalke
fadc0c80ae
p2p: Make timeout mockable and type safe, speed up test 2021-12-06 10:47:52 +01:00
MarcoFalke
99993425af
rpc: Only allow specific types to be P2(W)SH wrapped in decodescript 2021-12-06 10:33:12 +01:00
MarcoFalke
d20d6ac545
Merge bitcoin/bitcoin#23672: tests: Add data-driven testcases to rpc_decodescript.py
b35942e500 tests: Add data-driven testcases to rpc_decodescript.py (Dimitri)

Pull request description:

  closes #23641

Top commit has no ACKs.

Tree-SHA512: 2f494c78ad085d523fae15befaadb9e0fc382b5310e3a95395ecf06a90968b15b6d232f7564098ed0a68419e27aa2e5260fe691cf2ce84af9fb6b65634e54d77
2021-12-06 10:09:30 +01:00
MarcoFalke
42b35f17d5
Merge bitcoin/bitcoin#23681: test: Remove false coinstatsindex test
c055f6b216 test: Remove false coinstatsindex test (Fabian Jahr)

Pull request description:

  This test never actually tested the behavior that it describes in the comments. This was discovered in #21590 which seems to speed up muhash which lead to the test failing.

  I can vaguely remember that the described behavior was desired by some reviewers of `coinstatsindex`: That `coinstatsindex` should be aware of stale blocks and able to return statistics on them as well. The index actually does this for blocks that it sees while the index is active, i.e. while running `coinstatsindex` all blocks will be indexed and even when they become stale the index (via `gettxoutsetinfo`) will still return a result for them when given the right hash. But this currently does not work for blocks that the node saw and that became stale _before_ the node activated `coinstatsindex`. While the index syncs initially everything but the active chain is ignored and I don't see any indication that this ever worked differently in the past.

  Introducing this behavior seems non-trivial at first glance so, while I will give this a shot, I think the test should be removed so it does not confuse users and does not block #21590.

Top commit has no ACKs.

Tree-SHA512: b05f5dfeea3e453c8bb7c761501d0d896d4412a3f0c08037955951fae9fe388c63402da401792591e18da8fb67734f47f1a297d573cdb66e0ced451698718067
2021-12-06 09:56:05 +01:00
Samuel Dobson
a4fe70171b Make Bech32 LocateErrors return error list rather than using out-arg 2021-12-06 14:17:41 +13:00
Fabian Jahr
c055f6b216
test: Remove false coinstatsindex test 2021-12-05 22:42:29 +01:00
Dimitri
b35942e500 tests: Add data-driven testcases to rpc_decodescript.py 2021-12-05 22:07:04 +01:00
Andrew Chow
05300c1439 Use SelectionResult in SelectCoins
Replace setCoinsRet and nValueRet with SelectionResult
2021-12-05 13:44:10 -05:00
Andrew Chow
9d9b101d20 Use SelectionResult in AttemptSelection
Replace setCoinsRet and nValueRet with a SelectionResult in
AttemptSelection
2021-12-05 13:44:09 -05:00
Andrew Chow
bb50850a44 Use SelectionResult for waste calculation 2021-12-05 13:43:28 -05:00
Andrew Chow
e8f7ae5eb3 Make an OutputGroup for preset inputs
In SelectCoins, for our preset inputs, we combine all of the preset
inputs into a single OutputGroup. This allows us to combine the preset
inputs with additional selection algo results.
2021-12-05 13:40:48 -05:00
Andrew Chow
51a9c00b4d Return SelectionResult from SelectCoinsSRD
Changes SelectCoinsSRD to return a SelectionResult.
2021-12-05 13:40:48 -05:00
Andrew Chow
0ef6184575 Return SelectionResult from KnapsackSolver
Returns a std::optional<SelectionResult> from KnapsackSolver instead of
using out parameters for the inputs set and selected value.
2021-12-05 13:40:42 -05:00
Andrew Chow
60d2ca72e3 Return SelectionResult from SelectCoinsBnB
Removes coins_out and value_ret has SelectCoinsBnB return a
std::optional<SelectionResult>
2021-12-05 13:39:51 -05:00
Andrew Chow
a339add471 Make member variables of SelectionResult private 2021-12-05 13:39:51 -05:00
Andrew Chow
cbf0b9f4ff scripted-diff: Use SelectionResult in coin selector tests
Replace the CoinSet actual_selection with a SelectionResult
expected_result. We don't use the SelectionResult functions yet, but
will soon.

-BEGIN VERIFY SCRIPT-
sed -i 's/CoinSet actual_selection/SelectionResult expected_result(CAmount(0))/' src/wallet/test/coinselector_tests.cpp
sed -i 's/actual_selection/expected_result.m_selected_inputs/' src/wallet/test/coinselector_tests.cpp
sed -i 's/expected_result.m_selected_inputs.clear/expected_result.Clear/' src/wallet/test/coinselector_tests.cpp
-END VERIFY SCRIPT-
2021-12-05 13:39:51 -05:00
Andrew Chow
9d1d86da04 Introduce SelectionResult struct
Introduces a SelectionResult struct which contains the set of selected
inputs and the total transaction fee for the transaction. This will be
used by the various SelectCoins* functions. Additionally helpers are
provided to compute the total input value and result comparisons.
2021-12-05 13:39:41 -05:00
Hennadii Stepanov
ac9e4bc1e2
build: Fix build for Android x86_64 2021-12-05 15:41:08 +02:00
Hennadii Stepanov
78a6bc6919
build, qt: Use Android NDK r23 LTS 2021-12-05 03:00:02 +02:00
brianddk
5767208504
correct rpc address_type helptext
added address_type of `bech32m` to rpc calls `getnewaddress`/`getrawchangeaddress`
2021-12-04 18:47:15 -06:00
Hennadii Stepanov
ea989deecc
Merge bitcoin-core/gui#493: qt: Handle Android back key in the Node window
a56a104938 qt: Handle Android back key in the Node window (Hennadii Stepanov)
f045f98717 qt, android: Add GUIUtil::IsEscapeOrBack helper (Hennadii Stepanov)

Pull request description:

  On master (4633199cc8) there are no means to return from the Node window to the main one on Android.

  This PR assigns this functionality to the Android back key:

  ![Screenshot_1638395318](https://user-images.githubusercontent.com/32963518/144320316-af5599ac-0379-40e6-9887-7f5ee30b97ae.png)

ACKs for top commit:
  icota:
    utACK a56a104938

Tree-SHA512: 379c1ad8c6bffa037e861b88c66eb33872d7f7d54aa2f76289a51c55d79a37a0c16262b20f22d00fda11522c7df1f3561c1ceae34cd7a85da94aee4c6cdcfaaf
2021-12-05 02:45:13 +02:00