Commit graph

31948 commits

Author SHA1 Message Date
sstone
5493e92501 Check descriptors returned by external signers
Check that descriptors returned by external signers have been parsed properly when creating a new wallet.
2021-12-09 11:17:04 +01:00
fanquake
7908772244
Merge bitcoin/bitcoin#23703: scripted-diff: Use named args in RPC docs
fa9aaf8694 scripted-diff: Use named args in RPC docs (MarcoFalke)

Pull request description:

  Incorrect named args are source of bugs, like #22979.

  To allow them being checked by `clang-tidy`, use a format it can understand.

ACKs for top commit:
  fanquake:
    ACK fa9aaf8694 - checked `clang-tidy` and it's fine here, (but throwing errors in other files. i.e `wallet/test/wallet_tests.cpp`).

Tree-SHA512: e09dae8ee999a5c4819e6f848c12139593ca0e915e645c8fabeb97c379188fb9104d286c02c71f590abc64cdec125f78026735f83e016111976baa49d588a9bc
2021-12-09 17:14:26 +08:00
MarcoFalke
529ed33362
Merge bitcoin/bitcoin#23715: test: feature_rbf.py: check specified wallet type availability
84bc35d7a5 test: feature_rbf.py: check specified wallet type availability (Sebastian Falbesoner)

Pull request description:

  The test currently leads to a failure if in general wallet support is compiled, but the library for the specified type (BDB/SQLite) is not, i.e.  if started with the `--legacy-wallet` parameter, but bitcoind is compiled without BDB support, see e.g. https://github.com/bitcoin/bitcoin/pull/23682#issuecomment-989044207

  Fix this by checking if the specified wallet type (BDB for legacy wallet, SQLite for descriptor wallet) is available.

  Also move the helper `is_specified_wallet_compiled()` to the
  test framework's class BitcoinTestFramework first, so it can be reused.

  Should further pave the way for #23682. On my local instance without BDB compiled, all targets in test_runner pass now.

ACKs for top commit:
  mzumsande:
    ACK 84bc35d7a5, changes loook good for me and I confirmed that this fixes the error encountered on master when running the test `--without-bdb`.

Tree-SHA512: 1575c03c793c8e0ac195d0914eff75d02604301c8fb77d0fdb7c0b245561569c0c7db387ef4de499044b68ab6e14b4b78b955f6e74c84197bcaed95f439c9824
2021-12-09 09:24:22 +01:00
MarcoFalke
68ca8677e0
Merge bitcoin/bitcoin#23716: test: replace hashlib.ripemd160 with an own implementation
5b559dc7ec Swap out hashlib.ripemd160 for own implementation (Pieter Wuille)
ad3e9e1f21 Add pure Python RIPEMD-160 (Pieter Wuille)

Pull request description:

  Closes #23710.

ACKs for top commit:
  jamesob:
    ACK 5b559dc7ec, pending CI

Tree-SHA512: dcd4ea2027eac572f7ab0da434b081b9a5d6b78675e559258a446b4d254b29d93c4d2cc12da4a28303543d6d99f5f2246fde4052e84af81d18e04399b137b39e
2021-12-09 09:18:30 +01:00
fanquake
1b76b18f8a
Merge bitcoin/bitcoin#23585: scripted-diff: Drop Darwin version for better maintainability
2f356a0ca8 scripted-diff: Drop Darwin version for better maintainability (Hennadii Stepanov)

Pull request description:

  After this PR, any macOS tools version bumping in the future will touch fewer files in the repo.

  Pointing a Darwin version for the `--host` system does not matter for the following reasons:

  - in terms of the resulted binaries, we should only care about the minimum supported macOS version which is a separated parameter in our build system.

  - in terms of the build system itself, the usage of the `$(host)` variable is self-consistent enough. Btw `$(host_os)` value already has the version dropped:
  ```
  $ make -C depends --no-print-directory print-host_os HOST=x86_64-apple-darwin19
  host_os=darwin
  ```

ACKs for top commit:
  gruve-p:
    ACK 2f356a0ca8
  promag:
    ACK 2f356a0ca8.
  fanquake:
    ACK 2f356a0ca8

Tree-SHA512: 374896ab0ba02b0d8b4b21431fe963bd213b0d09586e0898c13a4c5fa294c1b693f1b2c92880c245c4157c14217b4825b36522f461930477f4d2a727086ebb2a
2021-12-09 16:13:33 +08:00
fanquake
c4ae714f55
Merge bitcoin/bitcoin#23714: doc: Normalize RPC description whitespace
faa0833c43 doc: Normalize RPC description whitespace (MarcoFalke)

Pull request description:

  It is tedious to manually add trailing newlines after the description so that there is an empty new line before the `Arguments` section.

  Fix that by adding it with C++ code.

ACKs for top commit:
  fanquake:
    ACK faa0833c43

Tree-SHA512: 061786c7f19d767f2b7a0362b948e34d181f4cc740a60211756da29ece7554e95be39a9beec3e201eddc8da3ea7e22ac917479eae04b230bb7b0db7a9647af8c
2021-12-09 15:55:46 +08:00
Pieter Wuille
5b559dc7ec Swap out hashlib.ripemd160 for own implementation 2021-12-08 14:29:41 -05:00
Pieter Wuille
ad3e9e1f21 Add pure Python RIPEMD-160 2021-12-08 14:29:34 -05:00
Sebastian Falbesoner
84bc35d7a5 test: feature_rbf.py: check specified wallet type availability
The test currently leads to a failure if in general wallet
support is compiled, but the library for the specified type
(BDB/SQLite) is not, i.e.  if started with the
`--legacy-wallet` parameter, but bitcoind is compiled
without BDB support.

Fix this by checking if the specified wallet type (BDB for
legacy wallet, SQLite for descriptor wallet) is available.

Also move the helper `is_specified_wallet_compiled()` to the
test framework's class BitcoinTestFramework first, so it can
be reused.
2021-12-08 19:57:43 +01:00
MarcoFalke
faa0833c43
doc: Normalize RPC description whitespace 2021-12-08 19:43:24 +01:00
MarcoFalke
f727d814bd
Merge bitcoin/bitcoin#23712: test: interface_bitcoin_cli.py: check specified wallet type availability
b57bf25cfe test: interface_bitcoin_cli.py: check specified wallet type availability (Sebastian Falbesoner)

Pull request description:

  Currently the test `interface_bitcoin_cli.py` performs the wallet-relevant parts if _any_ wallet type support is compiled in, independently of
  whether the test is run with legacy or descriptor wallet specified. This leads to a failure if the test is started with the `--legacy-wallet` parameter, but bitcoind is compiled without BDB support, see e.g
   https://github.com/bitcoin/bitcoin/pull/23686#issuecomment-987705540

  Fix this by checking if the specified wallet type (BDB for legacy wallet, SQLite for descriptor wallet) is available.

  Should further pave the way for #23682.

ACKs for top commit:
  achow101:
    ACK b57bf25cfe

Tree-SHA512: ddb5a94ba61133eff8de79d4946b3b9d476232b26e83bf768894cac4691e72602f88b6c02c72b992e12c2feb9bff1f0a2e0a265948a00954311104add1347184
2021-12-08 18:29:58 +01:00
Sebastian Falbesoner
b57bf25cfe test: interface_bitcoin_cli.py: check specified wallet type availability
Currently the test performs the wallet-relevant parts if
_any_ wallet type support is compiled in, independently of
whether the test is run with legacy or descriptor wallet
specified. This leads to a failure if the test is started
with the `--legacy-wallet` parameter, but bitcoind is
compiled without BDB support.

Fix this by checking if the specified wallet type (BDB for
legacy wallet, SQLite for descriptor wallet) is available.
2021-12-08 17:37:25 +01:00
MarcoFalke
926fc2a0d4
Merge bitcoin/bitcoin#23707: fuzz: Fix RPC internal bug detection
fa77f95c2f fuzz: Fix RPC internal bug detection (MarcoFalke)

Pull request description:

  Previously the fuzz test considered any exception which contains the string `Internal bug detected` (magic string) as a bug. This is not true when the user (fuzzer) passes in the magic string from outside.

  Fix that by:

  1. Changing the format the string in `NonFatalCheckError` to start with the magic string.
  2. Only treat exceptions that start with the magic string as internal bugs.

  This should fix the bug because any other exception shouldn't start with the magic string.

  To test:

  ```
  echo 'bG9nZ2luZ1y+bUludGVybmFsIGJ1ZyBkZXRlY3RlZAAXCqNcjqNcjuYjeg==' | base64 --decode > /tmp/a
  FUZZ=rpc ./src/test/fuzz/fuzz /tmp/a
  ```

  Before:
  ```
  fuzz: test/fuzz/rpc.cpp:365: void rpc_fuzz_target(FuzzBufferType): Assertion `error_msg.find("trigger_internal_bug") != std::string::npos' failed.
  ```

  After:
  ```
  Executed /tmp/a in 0 ms

ACKs for top commit:
  shaavan:
    crACK fa77f95c2f

Tree-SHA512: 079bc97b6ce0cbad8603c7b577cc1ac0fd19e884ccbaba317588b91d98b36afeaa8cb398344b52bf12c9fd1737b3fdd8452b4e833a3b06cb3c789651955f78b8
2021-12-08 16:50:28 +01:00
Andrew Chow
c0405ee27f rpc: Document that DEFAULT is for Taproot, ALL for everything else 2021-12-08 09:43:30 -05:00
Andrew Chow
d3992669df psbt: Actually use SIGHASH_DEFAULT
Make the behavior align with the help text by actually using
SIGHASH_DEFAULT as the default sighash for signing PSBTs.
2021-12-08 09:43:30 -05:00
Andrew Chow
eb9a1a2c59 psbt: Make sighash_type std::optional<int>
It is better to ues an optional to determine whether the sighash type
is set rather than using 0 as a magic number.
2021-12-08 09:43:26 -05:00
MarcoFalke
fa77f95c2f
fuzz: Fix RPC internal bug detection 2021-12-08 14:20:16 +01:00
MarcoFalke
577bd51a4b
Merge bitcoin/bitcoin#23702: doc: Add missing optional to getblockfrompeer
aaaa34e34d doc: Add missing optional to getblockfrompeer (MarcoFalke)

Pull request description:

  Can be reviewed with `--word-diff-regex=. --ignore-all-space`

ACKs for top commit:
  Sjors:
    utACK aaaa34e34d

Tree-SHA512: 7f46c82a46b8cc19f7eb549b9aa13be8cd6849a8ef8a2ddda6d1eee6978d099fccadd29a2bf817f44d601b905f5d5f6b5d8f4f54be5ee8b914b520359c058e68
2021-12-08 13:22:31 +01:00
MarcoFalke
fa9aaf8694
scripted-diff: Use named args in RPC docs
-BEGIN VERIFY SCRIPT-
 sed -i -e 's|, /\* optional \*/ true,|, /*optional=*/true,|g' $( git grep -l ', /\* optional \*/ true,' )
-END VERIFY SCRIPT-
2021-12-08 11:54:12 +01:00
MarcoFalke
aaaa34e34d
doc: Add missing optional to getblockfrompeer 2021-12-08 11:39:31 +01:00
Samuel Dobson
b692e61d61
Merge bitcoin/bitcoin#23254: doc: Fix typo and grammar
ffd11ea876 Fix typo and grammar (Heebs)

Pull request description:

  Fix typo and grammar in the coin selection algorithm's description.

ACKs for top commit:
  meshcollider:
    ACK ffd11ea876

Tree-SHA512: bba07c2efd5140fb3e021618739d70aaa761bbc274afb8158809492b0606773c217e42e58e58b18a2454b9c45ebc883ebece17cdc467ac60e3d3140d7a979db7
2021-12-08 22:43:56 +13:00
MarcoFalke
f6013265b7
Merge bitcoin/bitcoin#20295: rpc: getblockfrompeer
dce8c4c381 rpc: getblockfrompeer (Sjors Provoost)
b884ababc2 rpc: move Ensure* helpers to server_util.h (Sjors Provoost)

Pull request description:

  This adds an RPC method to fetch a block directly from a peer. This can used to fetch stale blocks with lower proof of work that are normally ignored by the node (`headers-only` in `getchaintips`).

  Usage:
  ```
  bitcoin-cli getblockfrompeer HASH peer_n
  ```

  Closes #20155

  Limitations:
  * you have to specify which peer to fetch the block from
  * the node must already have the header

ACKs for top commit:
  jnewbery:
    ACK dce8c4c381
  fjahr:
     re-ACK dce8c4c381

Tree-SHA512: 843ba2b7a308f640770d624d0aa3265fdc5c6ea48e8db32269b96a082b7420f7953d1d8d1ef2e6529392c7172dded9d15639fbc9c24e7bfa5cfb79e13a5498c8
2021-12-08 10:39:37 +01:00
MarcoFalke
84d921e79c
Merge bitcoin/bitcoin#23465: Remove CTxMemPool params from ATMP
f1f10c0514 Remove CTxMemPool params from ATMP (lsilva01)

Pull request description:

  Remove `CTxMemPool` parameter from `AcceptToMemoryPool` function, as suggested in https://github.com/bitcoin/bitcoin/pull/23437#issuecomment-962536149 .

  This requires that `CChainState` has access to `MockedTxPool` in  `tx_pool.cpp` as mentioned https://github.com/bitcoin/bitcoin/pull/23173#discussion_r731895386. So the `MockedTxPool` is attributed to `CChainState::m_mempool` before calling `AcceptToMemoryPool`.

  Requires #23437.

ACKs for top commit:
  jnewbery:
    utACK f1f10c0514
  MarcoFalke:
    review ACK f1f10c0514 🔙

Tree-SHA512: 2a4885f4645014fc1fa98bb1090f13721c1a0796bc0021b9cb43bc8cc13920b6eaf057d1f5ed796e0a110e7813e41fe0196334ce7c80d1231fc057a9a3bdf349
2021-12-08 10:00:55 +01:00
fanquake
099325a759
Merge bitcoin/bitcoin#23616: build: Bump AX_PTHREAD macro to the latest version
d796091b04 build: Bump AX_PTHREAD macro to the latest version (Hennadii Stepanov)

Pull request description:

  This PR silents autoconf >2.69 (this [one](https://formulae.brew.sh/formula/autoconf), for instance) warnings about the obsolete `$as_echo`:

  ```
  % ./autogen.sh
  ...
  configure.ac:847: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
  lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
  lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
  ./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
  ./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
  build-aux/m4/ax_pthread.m4:89: AX_PTHREAD is expanded from...
  configure.ac:847: the top level
  ...
  ```

  No other behavior changes.

ACKs for top commit:
  fanquake:
    ACK d796091b04 - matches upstream at serial 31.

Tree-SHA512: aa9b60698f453427221444a5a63420d833c4c5dd23f8b0c74e5bd4639daec9c6cff0907a5281c00103ccb030e394998cf05653be750d4a3bf0f37ca41ff6fbe1
2021-12-08 13:38:29 +08:00
Samuel Dobson
d5cab1a96d Add createmultisig and addmultisigaddress warnings release note 2021-12-08 17:14:40 +13:00
Samuel Dobson
e46fc935aa Add warnings field to addmultisigaddress to warn about uncompressed keys 2021-12-08 17:14:40 +13:00
Samuel Dobson
d1a9742623 Add warnings field to createmultisig to warn about uncompressed keys 2021-12-08 17:11:46 +13:00
fanquake
fa3fb46b81
Merge bitcoin/bitcoin#23667: Split up rpcwallet
b36e738285 MOVEONLY: Move abortrescan from backup.cpp to transactions.cpp (Samuel Dobson)
d794d0da8f Remove unused imports from rpc/wallet and reorder RPCs (Samuel Dobson)
e116b9747d MOVEONLY: Move rpcwallet to rpc/wallet (Samuel Dobson)
8e30875fde MOVEONLY: Move spending RPCs to spend.cpp (Samuel Dobson)
9ce521a61b MOVEONLY: Move balance and utxo RPCs to coins.cpp (Samuel Dobson)
7b45f5c059 MOVEONLY: Move address related functions from rpcwallet to addresses.cpp (Samuel Dobson)
f7646b407f MOVEONLY: Move transaction related wallet RPCs to transactions.cpp (Samuel Dobson)

Pull request description:

  This is the rest of #23622, to split up rpcwallet into smaller, more logical parts.

  This will have a lot of conflicts but let's just get it over and done with.

ACKs for top commit:
  achow101:
    ACK b36e738285
  ryanofsky:
    Code review ACK b36e738285, verified move-only again

Tree-SHA512: 6695fa23bbe9822c7497db7660f44c3dcb01dfa7276f5830a6b7c73c6b5fa04e04fcd4821bf0e6392e7659ed91a277ced85bd8f77477d785bca4e84a93fe791e
2021-12-08 11:34:30 +08:00
fanquake
0d101050ef
Merge bitcoin/bitcoin#23678: build: Fix build for Android x86_64
ac9e4bc1e2 build: Fix build for Android x86_64 (Hennadii Stepanov)

Pull request description:

  bitcoin/bitcoin#23489 [introduced](https://github.com/bitcoin/bitcoin/pull/23489#issuecomment-985457915) a regression making build for `HOST=x86_64-linux-android` broken due to the [QTBUG-86785](https://bugreports.qt.io/browse/QTBUG-86785).

  This PR fixes this regression.

ACKs for top commit:
  fanquake:
    ACK ac9e4bc1e2

Tree-SHA512: c841a56d745c4b4a75e1bc4d89752de153aa6328752a8fd7df614363ed046a291a9eb58605d82fcba21f3c8b0f0bf47786ed0a63c29f81f5d4ad9c0b12304100
2021-12-08 09:29:39 +08:00
Samuel Dobson
b36e738285 MOVEONLY: Move abortrescan from backup.cpp to transactions.cpp 2021-12-08 11:54:08 +13:00
Samuel Dobson
d794d0da8f Remove unused imports from rpc/wallet and reorder RPCs 2021-12-08 11:45:21 +13:00
Samuel Dobson
e116b9747d MOVEONLY: Move rpcwallet to rpc/wallet 2021-12-08 11:45:21 +13:00
Samuel Dobson
8e30875fde MOVEONLY: Move spending RPCs to spend.cpp 2021-12-08 11:45:21 +13:00
Samuel Dobson
9ce521a61b MOVEONLY: Move balance and utxo RPCs to coins.cpp 2021-12-08 11:45:19 +13:00
Samuel Dobson
7b45f5c059 MOVEONLY: Move address related functions from rpcwallet to addresses.cpp 2021-12-08 11:42:57 +13:00
Samuel Dobson
f7646b407f MOVEONLY: Move transaction related wallet RPCs to transactions.cpp 2021-12-08 11:40:59 +13:00
lsilva01
f1f10c0514 Remove CTxMemPool params from ATMP
Co-authored-by: John Newbery <1063656+jnewbery@users.noreply.github.com>
Co-authored-by: Jon Atack <jon@atack.com>
2021-12-07 18:56:29 -03:00
MarcoFalke
63c63b5533
Merge bitcoin/bitcoin#14707: [RPC] Include coinbase transactions in receivedby RPCs
1dcba996d3 Coinbase receivedby rpcs release notes (Andrew Toth)
b5696750a9 Test including coinbase transactions in receivedby wallet rpcs (Andrew Toth)
bce20c34d6 Include coinbase transactions in receivedby wallet rpcs (Andrew Toth)

Pull request description:

  The current `*receivedby*` RPCs filter out coinbase transactions. This doesn't seem correct since an output to your address in a coinbase transaction *is* receiving those coins.

  This PR corrects this behaviour. Also, a new option `include_immature_coinbase` is added (default=`false`) that includes immature coinbase transactions when set to true.

  However, since this is potentially a breaking change this PR introduces a hidden configuration option `-deprecatedrpc=exclude_coinbase`. This can be set to revert to previous behaviour. If no reports of broken workflow are received, then this option can be removed in a future release.

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

ACKs for top commit:
  jnewbery:
    reACK 1dcba996d3

Tree-SHA512: bfc43b81279fea5b6770a4620b196f6bc7c818d221b228623e9f535ec75a2406bc440e3df911608a3680f11ab64c5a4103917162114f5ff7c4ca8ab07bb9d3df
2021-12-07 20:52:13 +01:00
Carl Dong
7f15eff2dd style-only: Remove redundant scope in *Chainstate
I strongly recommend reviewing with the following git-diff flags:
  --ignore-space-change
2021-12-07 14:48:49 -05:00
Carl Dong
89bec827fd Collapse the 2 cs_main locks in LoadChainstate 2021-12-07 14:48:49 -05:00
Carl Dong
3b1584b794 Remove all #include // for * comments 2021-12-07 14:48:49 -05:00
Carl Dong
9a5a5a3d08 test/setup: Use LoadChainstate
This commit coalesces the chainstate loading sequence between our unit
test and non-unit test init codepaths.
2021-12-07 14:48:49 -05:00
Carl Dong
c541da0d62 node/chainstate: Add options for in-memory DBs
[META] In a future commit, these options will be used in TestingSetup to
       ensure that the DBs are in-memory.
2021-12-07 14:48:49 -05:00
Carl Dong
ceb9790341 node/caches: Remove intermediate variables 2021-12-07 14:48:49 -05:00
Carl Dong
ac4bf138b8 node/caches: Extract cache calculation logic
I strongly recommend reviewing with the following git-diff flags:
  --color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change

[META] In a future commit, this function will be re-used in TestingSetup
       so that the behaviour matches across test and non-test init
       codepaths.
2021-12-07 14:48:49 -05:00
Carl Dong
15f2e33bb3 validation: VerifyDB only needs Consensus::Params
Previously we were passing in CChainParams, when VerifyDB only needed
the Consensus::Params subset.
2021-12-07 14:48:49 -05:00
Carl Dong
4da9c076d1 node/chainstate: Decouple from ShutdownRequested
...instead allow optionally passing in a std::function<bool()>
2021-12-07 14:48:49 -05:00
Carl Dong
05441c2dc5 node/chainstate: Decouple from GetTime
...instead pass in a std::function<int64_t()>

Note that the static_cast is needed (apparently) for the compiler to
know which overloaded GetTime to choose.
2021-12-07 14:48:49 -05:00
Carl Dong
2414ebc18b init: Delay RPC block notif until warmup finished
See added code comment for more details.
2021-12-07 14:48:06 -05:00
MarcoFalke
eaf1c56502
Merge bitcoin/bitcoin#23692: mining, refactor: add m_mempool.cs thread safety lock assertions
275e9390e1 mining, refactor: add m_mempool.cs thread safety lock assertions (Jon Atack)

Pull request description:

  in src/node/miner to

  - BlockAssembler::addPackageTxs()
  - BlockAssembler::SkipMapTxEntry()
  - BlockAssembler::UpdatePackagesForAdded()

  These functions have thread safety lock annotations in their declarations but are missing the corresponding run-time lock assertions in their definitions.

  Per doc/developer-notes.md: "Combine annotations in function declarations with run-time asserts in function definitions."

ACKs for top commit:
  shaavan:
    ACK 275e9390e1. Thanks for catching and fixing this!

Tree-SHA512: 1c6f1ad1bbd94ff391fc8ce1e3b95d88bd3db5db804a1a5ef4636e54b29f5801f79aa9ed753d34c9a79a58cf01c7ed890e7681ff1c7b0f16335dc062bbac31cc
2021-12-07 18:48:33 +01:00