Merge bitcoin/bitcoin#29888: [27.x] Backports

bd5860bc7a [WIP] doc: release notes for 27.x (fanquake)
475aac41fb doc: add LLVM instruction for macOS < 13 (Sjors Provoost)
a995902d60 depends: Fix build of Qt for 32-bit platforms (laanwj)
0fcceefe22 Fix #29767, set m_synced = true after Commit() (nanlour)
ae9a2ed40a sign: don't assume we are parsing a sane Miniscript (Antoine Poinsot)
a6a59cfebc rpc: Reword SighashFromStr error message (MarcoFalke)
364bf01ff2 build: Fix false positive `CHECK_ATOMIC` test for clang-15 (Hennadii Stepanov)
9277793b4e test: Fix failing univalue float test (MarcoFalke)
5c097910e0 doc: archive 27.0 release notes (fanquake)
897e5af58a [rpc, bugfix] Enforce maximum value for setmocktime (dergoegge)
602cfd580a ci: Bump s390x to ubuntu:24.04 (MarcoFalke)
20e6e8dc80 Change Luke Dashjr seed to dashjr-list-of-p2p-nodes.us (Luke Dashjr)
a6862c50c5 depends: fix mingw-w64 Qt DEBUG=1 build (fanquake)

Pull request description:

  Backports:
  * https://github.com/bitcoin/bitcoin/pull/29691
  * https://github.com/bitcoin/bitcoin/pull/29747
  * https://github.com/bitcoin/bitcoin/pull/29776
  * https://github.com/bitcoin/bitcoin/pull/29853
  * https://github.com/bitcoin/bitcoin/pull/29856
  * https://github.com/bitcoin/bitcoin/pull/29859
  * https://github.com/bitcoin/bitcoin/pull/29869
  * https://github.com/bitcoin/bitcoin/pull/29870
  * https://github.com/bitcoin/bitcoin/pull/29886
  * https://github.com/bitcoin/bitcoin/pull/29892
  * https://github.com/bitcoin/bitcoin/pull/29934
  * https://github.com/bitcoin/bitcoin/pull/29985

ACKs for top commit:
  willcl-ark:
    reACK bd5860bc7a
  stickies-v:
    re-ACK bd5860bc7a
  TheCharlatan:
    ACK bd5860bc7a

Tree-SHA512: a1a40de70cf52b5fc01d9dcc772421751a18c6a48a726c4c05c0371c585a53a27902e17daed9e0d721ab7763c94bb32de05c146bd6bc73fd558edd08b31e8547
This commit is contained in:
merge-script 2024-05-13 11:53:26 +08:00
commit c7885ecd77
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
19 changed files with 336 additions and 166 deletions

View file

@ -7,7 +7,7 @@ dnl warranty.
# Clang, when building for 32-bit,
# and linking against libstdc++, requires linking with
# -latomic if using the C++ atomic library.
# Can be tested with: clang++ test.cpp -m32
# Can be tested with: clang++ -std=c++20 test.cpp -m32
#
# Sourced from http://bugs.debian.org/797228
@ -27,8 +27,11 @@ m4_define([_CHECK_ATOMIC_testbody], [[
auto t1 = t.load();
t.compare_exchange_strong(t1, 3s);
std::atomic<int64_t> a{};
std::atomic<double> d{};
d.store(3.14);
auto d1 = d.load();
std::atomic<int64_t> a{};
int64_t v = 5;
int64_t r = a.fetch_add(v);
return static_cast<int>(r);

View file

@ -9,8 +9,8 @@ export LC_ALL=C.UTF-8
export HOST=s390x-linux-gnu
export PACKAGES="python3-zmq"
export CONTAINER_NAME=ci_s390x
export CI_IMAGE_NAME_TAG="docker.io/s390x/debian:bookworm"
export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
export CI_IMAGE_NAME_TAG="docker.io/s390x/ubuntu:24.04"
export TEST_RUNNER_EXTRA="--exclude rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
export RUN_FUNCTIONAL_TESTS=true
export GOAL="install"
export BITCOIN_CONFIG="--enable-reduce-exports"

View file

@ -24,6 +24,7 @@ $(package)_patches += fix-macos-linker.patch
$(package)_patches += memory_resource.patch
$(package)_patches += utc_from_string_no_optimize.patch
$(package)_patches += windows_lto.patch
$(package)_patches += zlib-timebits64.patch
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=a31785948c640b7c66d9fe2db4993728ca07f64e41c560b3625ad191b276ff20
@ -178,6 +179,7 @@ $(package)_config_opts_mingw32 += -xplatform win32-g++
$(package)_config_opts_mingw32 += "QMAKE_CFLAGS = '$($(package)_cflags) $($(package)_cppflags)'"
$(package)_config_opts_mingw32 += "QMAKE_CXX = '$($(package)_cxx)'"
$(package)_config_opts_mingw32 += "QMAKE_CXXFLAGS = '$($(package)_cxxflags) $($(package)_cppflags)'"
$(package)_config_opts_mingw32 += "QMAKE_LINK = '$($(package)_cxx)'"
$(package)_config_opts_mingw32 += "QMAKE_LFLAGS = '$($(package)_ldflags)'"
$(package)_config_opts_mingw32 += "QMAKE_LIB = '$($(package)_ar) rc'"
$(package)_config_opts_mingw32 += -device-option CROSS_COMPILE="$(host)-"
@ -254,6 +256,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
patch -p1 -i $($(package)_patch_dir)/zlib-timebits64.patch && \
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \

View file

@ -0,0 +1,31 @@
From a566e156b3fa07b566ddbf6801b517a9dba04fa3 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Sat, 29 Jul 2023 22:13:09 -0700
Subject: [PATCH] Avoid compiler complaints if _TIME_BITS defined when building
zlib.
zlib does not use time_t, so _TIME_BITS is irrelevant. However it
may be defined anyway as part of a sledgehammer indiscriminately
applied to all builds.
From https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3.patch
---
qtbase/src/3rdparty/zlib/src/gzguts.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/qtbase/src/3rdparty/zlib/src/gzguts.h b/qtbase/src/3rdparty/zlib/src/gzguts.h
index e23f831f5..f9375047e 100644
--- a/qtbase/src/3rdparty/zlib/src/gzguts.h
+++ b/qtbase/src/3rdparty/zlib/src/gzguts.h
@@ -26,9 +26,8 @@
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
-# ifdef _FILE_OFFSET_BITS
-# undef _FILE_OFFSET_BITS
-# endif
+# undef _FILE_OFFSET_BITS
+# undef _TIME_BITS
#endif
#ifdef HAVE_HIDDEN

View file

@ -51,6 +51,20 @@ To install, run the following from your terminal:
brew install automake libtool boost pkg-config libevent
```
For macOS 11 (Big Sur) and 12 (Monterey) you need to install a more recent version of llvm.
``` bash
brew install llvm
```
And append the following to the configure commands below:
``` bash
CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++
```
Try `llvm@17` if compilation fails with the default version of llvm.
### 4. Clone Bitcoin repository
`git` should already be installed by default on your system.

View file

@ -1,8 +1,8 @@
Bitcoin Core version 27.0 is now available from:
Bitcoin Core version 27.x is now available from:
<https://bitcoincore.org/bin/bitcoin-core-27.0/>
<https://bitcoincore.org/bin/bitcoin-core-27.x/>
This release includes new features, various bug fixes and performance
This release includes various bug fixes and performance
improvements, as well as updated translations.
Please report bugs using the issue tracker at GitHub:
@ -37,181 +37,55 @@ unsupported systems.
Notable changes
===============
libbitcoinconsensus
-------------------
### Miniscript
- libbitcoinconsensus is deprecated and will be removed for v28. This library has
existed for nearly 10 years with very little known uptake or impact. It has
become a maintenance burden.
- #29853 sign: don't assume we are parsing a sane TapMiniscript
The underlying functionality does not change between versions, so any users of
the library can continue to use the final release indefinitely, with the
understanding that Taproot is its final consensus update.
### RPC
In the future, libbitcoinkernel will provide a much more useful API that is
aware of the UTXO set, and therefore be able to fully validate transactions and
blocks. (#29189)
- #29869 rpc, bugfix: Enforce maximum value for setmocktime
- #29870 rpc: Reword SighashFromStr error message
mempool.dat compatibility
-------------------------
### Index
- The `mempool.dat` file created by -persistmempool or the savemempool RPC will
be written in a new format. This new format includes the XOR'ing of transaction
contents to mitigate issues where external programs (such as anti-virus) attempt
to interpret and potentially modify the file.
- #29776 Fix #29767, set m_synced = true after Commit()
This new format can not be read by previous software releases. To allow for a
downgrade, a temporary setting `-persistmempoolv1` has been added to fall back
to the legacy format. (#28207)
### Test
P2P and network changes
-----------------------
- #29892 test: Fix failing univalue float test
- BIP324 v2 transport is now enabled by default. It remains possible to disable v2
by running with `-v2transport=0`. (#29347)
- Manual connection options (`-connect`, `-addnode` and `-seednode`) will
now follow `-v2transport` to connect with v2 by default. They will retry with
v1 on failure. (#29058)
### Build
- Network-adjusted time has been removed from consensus code. It is replaced
with (unadjusted) system time. The warning for a large median time offset
(70 minutes or more) is kept. This removes the implicit security assumption of
requiring an honest majority of outbound peers, and increases the importance
of the node operator ensuring their system time is (and stays) correct to not
fall out of consensus with the network. (#28956)
- #29747 depends: fix mingw-w64 Qt DEBUG=1 build
- #29859 build: Fix false positive CHECK_ATOMIC test
- #29985 depends: Fix build of Qt for 32-bit platforms with recent glibc
Mempool Policy Changes
----------------------
### Doc
- Opt-in Topologically Restricted Until Confirmation (TRUC) Transactions policy
(aka v3 transaction policy) is available for use on test networks when
`-acceptnonstdtxn=1` is set. By setting the transaction version number to 3, TRUC transactions
request the application of limits on spending of their unconfirmed outputs. These
restrictions simplify the assessment of incentive compatibility of accepting or
replacing TRUC transactions, thus ensuring any replacements are more profitable for
the node and making fee-bumping more reliable. TRUC transactions are currently
nonstandard and can only be used on test networks where the standardness rules are
relaxed or disabled (e.g. with `-acceptnonstdtxn=1`). (#28948)
- #29934 doc: add LLVM instruction for macOS < 13
External Signing
----------------
### CI
- Support for external signing on Windows has been disabled. It will be re-enabled
once the underlying dependency (Boost Process), has been replaced with a different
library. (#28967)
- #29856 ci: Bump s390x to ubuntu:24.04
Updated RPCs
------------
### Misc
- The addnode RPC now follows the `-v2transport` option (now on by default, see above) for making connections.
It remains possible to specify the transport type manually with the v2transport argument of addnode. (#29239)
Build System
------------
- A C++20 capable compiler is now required to build Bitcoin Core. (#28349)
- MacOS releases are configured to use the hardened runtime libraries (#29127)
Wallet
------
- The CoinGrinder coin selection algorithm has been introduced to mitigate unnecessary
large input sets and lower transaction costs at high feerates. CoinGrinder
searches for the input set with minimal weight. Solutions found by
CoinGrinder will produce a change output. CoinGrinder is only active at
elevated feerates (default: 30+sat/vB, based on `-consolidatefeerate`×3). (#27877)
- The Branch And Bound coin selection algorithm will be disabled when the subtract fee
from outputs feature is used. (#28994)
- If the birth time of a descriptor is detected to be later than the first transaction
involving that descriptor, the birth time will be reset to the earlier time. (#28920)
Low-level changes
=================
Pruning
-------
- When pruning during initial block download, more blocks will be pruned at each
flush in order to speed up the syncing of such nodes. (#20827)
Init
----
- Various fixes to prevent issues where subsequent instances of Bitcoin Core would
result in deletion of files in use by an existing instance. (#28784, #28946)
- Improved handling of empty `settings.json` files. (#29144)
- #29691 Change Luke Dashjr seed to dashjr-list-of-p2p-nodes.us
Credits
=======
Thanks to everyone who directly contributed to this release:
- 22388o⚡
- Aaron Clauson
- Amiti Uttarwar
- Andrew Toth
- Anthony Towns
- Antoine Poinsot
- Ava Chow
- Brandon Odiwuor
- brunoerg
- Chris Stewart
- Cory Fields
- dergoegge
- djschnei21
- Fabian Jahr
- fanquake
- furszy
- Gloria Zhao
- Greg Sanders
- Hennadii Stepanov
- Hernan Marino
- iamcarlos94
- ismaelsadeeq
- Jameson Lopp
- Jesse Barton
- John Moffett
- Jon Atack
- josibake
- jrakibi
- Justin Dhillon
- Kashif Smith
- kevkevin
- Kristaps Kaupe
- L0la L33tz
- laanwj
- Luke Dashjr
- Lőrinc
- marco
- MarcoFalke
- Mark Friedenbach
- Marnix
- Martin Leitner-Ankerl
- Martin Zumsande
- Max Edwards
- Murch
- muxator
- naiyoma
- Nikodemas Tuckus
- ns-xvrn
- pablomartin4btc
- Peter Todd
- Pieter Wuille
- Richard Myers
- Roman Zeyde
- Russell Yanofsky
- Ryan Ofsky
- Sebastian Falbesoner
- Sergi Delgado Segura
- nanlour
- Sjors Provoost
- stickies-v
- stratospher
- Supachai Kheawjuy
- TheCharlatan
- UdjinM6
- Vasil Dimov
- w0xlt
- willcl-ark
As well as to everyone that helped with translations on
[Transifex](https://www.transifex.com/bitcoin/bitcoin/).

View file

@ -0,0 +1,217 @@
Bitcoin Core version 27.0 is now available from:
<https://bitcoincore.org/bin/bitcoin-core-27.0/>
This release includes new features, various bug fixes and performance
improvements, as well as updated translations.
Please report bugs using the issue tracker at GitHub:
<https://github.com/bitcoin/bitcoin/issues>
To receive security and update notifications, please subscribe to:
<https://bitcoincore.org/en/list/announcements/join/>
How to Upgrade
==============
If you are running an older version, shut it down. Wait until it has completely
shut down (which might take a few minutes in some cases), then run the
installer (on Windows) or just copy over `/Applications/Bitcoin-Qt` (on macOS)
or `bitcoind`/`bitcoin-qt` (on Linux).
Upgrading directly from a version of Bitcoin Core that has reached its EOL is
possible, but it might take some time if the data directory needs to be migrated. Old
wallet versions of Bitcoin Core are generally supported.
Compatibility
==============
Bitcoin Core is supported and extensively tested on operating systems
using the Linux Kernel 3.17+, macOS 11.0+, and Windows 7 and newer. Bitcoin
Core should also work on most other Unix-like systems but is not as
frequently tested on them. It is not recommended to use Bitcoin Core on
unsupported systems.
Notable changes
===============
libbitcoinconsensus
-------------------
- libbitcoinconsensus is deprecated and will be removed for v28. This library has
existed for nearly 10 years with very little known uptake or impact. It has
become a maintenance burden.
The underlying functionality does not change between versions, so any users of
the library can continue to use the final release indefinitely, with the
understanding that Taproot is its final consensus update.
In the future, libbitcoinkernel will provide a much more useful API that is
aware of the UTXO set, and therefore be able to fully validate transactions and
blocks. (#29189)
mempool.dat compatibility
-------------------------
- The `mempool.dat` file created by -persistmempool or the savemempool RPC will
be written in a new format. This new format includes the XOR'ing of transaction
contents to mitigate issues where external programs (such as anti-virus) attempt
to interpret and potentially modify the file.
This new format can not be read by previous software releases. To allow for a
downgrade, a temporary setting `-persistmempoolv1` has been added to fall back
to the legacy format. (#28207)
P2P and network changes
-----------------------
- BIP324 v2 transport is now enabled by default. It remains possible to disable v2
by running with `-v2transport=0`. (#29347)
- Manual connection options (`-connect`, `-addnode` and `-seednode`) will
now follow `-v2transport` to connect with v2 by default. They will retry with
v1 on failure. (#29058)
- Network-adjusted time has been removed from consensus code. It is replaced
with (unadjusted) system time. The warning for a large median time offset
(70 minutes or more) is kept. This removes the implicit security assumption of
requiring an honest majority of outbound peers, and increases the importance
of the node operator ensuring their system time is (and stays) correct to not
fall out of consensus with the network. (#28956)
Mempool Policy Changes
----------------------
- Opt-in Topologically Restricted Until Confirmation (TRUC) Transactions policy
(aka v3 transaction policy) is available for use on test networks when
`-acceptnonstdtxn=1` is set. By setting the transaction version number to 3, TRUC transactions
request the application of limits on spending of their unconfirmed outputs. These
restrictions simplify the assessment of incentive compatibility of accepting or
replacing TRUC transactions, thus ensuring any replacements are more profitable for
the node and making fee-bumping more reliable. TRUC transactions are currently
nonstandard and can only be used on test networks where the standardness rules are
relaxed or disabled (e.g. with `-acceptnonstdtxn=1`). (#28948)
External Signing
----------------
- Support for external signing on Windows has been disabled. It will be re-enabled
once the underlying dependency (Boost Process), has been replaced with a different
library. (#28967)
Updated RPCs
------------
- The addnode RPC now follows the `-v2transport` option (now on by default, see above) for making connections.
It remains possible to specify the transport type manually with the v2transport argument of addnode. (#29239)
Build System
------------
- A C++20 capable compiler is now required to build Bitcoin Core. (#28349)
- MacOS releases are configured to use the hardened runtime libraries (#29127)
Wallet
------
- The CoinGrinder coin selection algorithm has been introduced to mitigate unnecessary
large input sets and lower transaction costs at high feerates. CoinGrinder
searches for the input set with minimal weight. Solutions found by
CoinGrinder will produce a change output. CoinGrinder is only active at
elevated feerates (default: 30+sat/vB, based on `-consolidatefeerate`×3). (#27877)
- The Branch And Bound coin selection algorithm will be disabled when the subtract fee
from outputs feature is used. (#28994)
- If the birth time of a descriptor is detected to be later than the first transaction
involving that descriptor, the birth time will be reset to the earlier time. (#28920)
Low-level changes
=================
Pruning
-------
- When pruning during initial block download, more blocks will be pruned at each
flush in order to speed up the syncing of such nodes. (#20827)
Init
----
- Various fixes to prevent issues where subsequent instances of Bitcoin Core would
result in deletion of files in use by an existing instance. (#28784, #28946)
- Improved handling of empty `settings.json` files. (#29144)
Credits
=======
Thanks to everyone who directly contributed to this release:
- 22388o⚡
- Aaron Clauson
- Amiti Uttarwar
- Andrew Toth
- Anthony Towns
- Antoine Poinsot
- Ava Chow
- Brandon Odiwuor
- brunoerg
- Chris Stewart
- Cory Fields
- dergoegge
- djschnei21
- Fabian Jahr
- fanquake
- furszy
- Gloria Zhao
- Greg Sanders
- Hennadii Stepanov
- Hernan Marino
- iamcarlos94
- ismaelsadeeq
- Jameson Lopp
- Jesse Barton
- John Moffett
- Jon Atack
- josibake
- jrakibi
- Justin Dhillon
- Kashif Smith
- kevkevin
- Kristaps Kaupe
- L0la L33tz
- Luke Dashjr
- Lőrinc
- marco
- MarcoFalke
- Mark Friedenbach
- Marnix
- Martin Leitner-Ankerl
- Martin Zumsande
- Max Edwards
- Murch
- muxator
- naiyoma
- Nikodemas Tuckus
- ns-xvrn
- pablomartin4btc
- Peter Todd
- Pieter Wuille
- Richard Myers
- Roman Zeyde
- Russell Yanofsky
- Ryan Ofsky
- Sebastian Falbesoner
- Sergi Delgado Segura
- Sjors Provoost
- stickies-v
- stratospher
- Supachai Kheawjuy
- TheCharlatan
- UdjinM6
- Vasil Dimov
- w0xlt
- willcl-ark
As well as to everyone that helped with translations on
[Transifex](https://www.transifex.com/bitcoin/bitcoin/).

View file

@ -256,6 +256,6 @@ util::Result<int> SighashFromStr(const std::string& sighash)
if (it != map_sighash_values.end()) {
return it->second;
} else {
return util::Error{Untranslated(sighash + " is not a valid sighash parameter.")};
return util::Error{Untranslated("'" + sighash + "' is not a valid sighash parameter.")};
}
}

View file

@ -164,9 +164,9 @@ void BaseIndex::ThreadSync()
const CBlockIndex* pindex_next = NextSyncBlock(pindex, m_chainstate->m_chain);
if (!pindex_next) {
SetBestBlockIndex(pindex);
m_synced = true;
// No need to handle errors in Commit. See rationale above.
Commit();
m_synced = true;
break;
}
if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {

View file

@ -133,7 +133,7 @@ public:
// release ASAP to avoid it where possible.
vSeeds.emplace_back("seed.bitcoin.sipa.be."); // Pieter Wuille, only supports x1, x5, x9, and xd
vSeeds.emplace_back("dnsseed.bluematt.me."); // Matt Corallo, only supports x9
vSeeds.emplace_back("dnsseed.bitcoin.dashjr.org."); // Luke Dashjr
vSeeds.emplace_back("dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us."); // Luke Dashjr
vSeeds.emplace_back("seed.bitcoinstats.com."); // Christian Decker, supports x1 - xf
vSeeds.emplace_back("seed.bitcoin.jonasschnelli.ch."); // Jonas Schnelli, only supports x1, x5, x9, and xd
vSeeds.emplace_back("seed.btc.petertodd.net."); // Peter Todd, only supports x1, x5, x9, and xd

View file

@ -26,6 +26,7 @@
#include <univalue.h>
#include <util/any.h>
#include <util/check.h>
#include <util/time.h>
#include <stdint.h>
#ifdef HAVE_MALLOC_INFO
@ -58,9 +59,11 @@ static RPCHelpMan setmocktime()
LOCK(cs_main);
const int64_t time{request.params[0].getInt<int64_t>()};
if (time < 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Mocktime cannot be negative: %s.", time));
constexpr int64_t max_time{Ticks<std::chrono::seconds>(std::chrono::nanoseconds::max())};
if (time < 0 || time > max_time) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Mocktime must be in the range [0, %s], not %s.", max_time, time));
}
SetMockTime(time);
const NodeContext& node_context{EnsureAnyNodeContext(request.context)};
for (const auto& chain_client : node_context.chain_clients) {

View file

@ -295,7 +295,7 @@ struct TapSatisfier: Satisfier<XOnlyPubKey> {
//! Conversion from a raw xonly public key.
template <typename I>
std::optional<XOnlyPubKey> FromPKBytes(I first, I last) const {
CHECK_NONFATAL(last - first == 32);
if (last - first != 32) return {};
XOnlyPubKey pubkey;
std::copy(first, last, pubkey.begin());
return pubkey;

View file

@ -291,6 +291,7 @@ BOOST_AUTO_TEST_CASE(rpc_parse_monetary_values)
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("1e-8")), COIN/100000000);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.1e-7")), COIN/100000000);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.01e-6")), COIN/100000000);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.00000000000000000000000000000000000001e+30")), 1);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.0000000000000000000000000000000000000000000000000000000000000000000000000001e+68")), COIN/100000000);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("10000000000000000000000000000000000000000000000000000000000000000e-64")), COIN);
BOOST_CHECK_EQUAL(AmountFromValue(ValueFromString("0.000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000e64")), COIN);

View file

@ -1277,6 +1277,30 @@ BOOST_AUTO_TEST_CASE(script_combineSigs)
BOOST_CHECK(combined.scriptSig == partial3c);
}
/**
* Reproduction of an exception incorrectly raised when parsing a public key inside a TapMiniscript.
*/
BOOST_AUTO_TEST_CASE(sign_invalid_miniscript)
{
FillableSigningProvider keystore;
SignatureData sig_data;
CMutableTransaction prev, curr;
// Create a Taproot output which contains a leaf in which a non-32 bytes push is used where a public key is expected
// by the Miniscript parser. This offending Script was found by the RPC fuzzer.
const auto invalid_pubkey{ParseHex("173d36c8c9c9c9ffffffffffff0200000000021e1e37373721361818181818181e1e1e1e19000000000000000000b19292929292926b006c9b9b9292")};
TaprootBuilder builder;
builder.Add(0, {invalid_pubkey}, 0xc0);
XOnlyPubKey nums{ParseHex("50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0")};
builder.Finalize(nums);
prev.vout.emplace_back(0, GetScriptForDestination(builder.GetOutput()));
curr.vin.emplace_back(COutPoint{prev.GetHash(), 0});
sig_data.tr_spenddata = builder.GetSpendData();
// SignSignature can fail but it shouldn't raise an exception (nor crash).
BOOST_CHECK(!SignSignature(keystore, CTransaction(prev), curr, 0, SIGHASH_ALL, sig_data));
}
BOOST_AUTO_TEST_CASE(script_standard_push)
{
ScriptError err;

View file

@ -421,7 +421,7 @@ void univalue_readwrite()
// Valid, with leading or trailing whitespace
BOOST_CHECK(v.read(" 1.0") && (v.get_real() == 1.0));
BOOST_CHECK(v.read("1.0 ") && (v.get_real() == 1.0));
BOOST_CHECK(v.read("0.00000000000000000000000000000000000001e+30 ") && v.get_real() == 1e-8);
BOOST_CHECK(v.read("0.00000000000000000000000000000000000001e+30 "));
BOOST_CHECK(!v.read(".19e-6")); //should fail, missing leading 0, therefore invalid JSON
// Invalid, initial garbage

View file

@ -886,7 +886,7 @@ class PSBTTest(BitcoinTestFramework):
assert_equal(comb_psbt, psbt)
self.log.info("Test walletprocesspsbt raises if an invalid sighashtype is passed")
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].walletprocesspsbt, psbt, sighashtype="all")
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].walletprocesspsbt, psbt, sighashtype="all")
self.log.info("Test decoding PSBT with per-input preimage types")
# note that the decodepsbt RPC doesn't check whether preimages and hashes match
@ -992,7 +992,7 @@ class PSBTTest(BitcoinTestFramework):
self.nodes[2].sendrawtransaction(processed_psbt['hex'])
self.log.info("Test descriptorprocesspsbt raises if an invalid sighashtype is passed")
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[2].descriptorprocesspsbt, psbt, [descriptor], sighashtype="all")
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[2].descriptorprocesspsbt, psbt, [descriptor], sighashtype="all")
if __name__ == '__main__':

View file

@ -124,7 +124,7 @@ class SignRawTransactionWithKeyTest(BitcoinTestFramework):
self.log.info("Test signing transaction with invalid sighashtype")
tx = self.nodes[0].createrawtransaction(INPUTS, OUTPUTS)
privkeys = [self.nodes[0].get_deterministic_priv_key().key]
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithkey, tx, privkeys, sighashtype="all")
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithkey, tx, privkeys, sighashtype="all")
def run_test(self):
self.successful_signing_test()

View file

@ -23,7 +23,7 @@ class UptimeTest(BitcoinTestFramework):
self._test_uptime()
def _test_negative_time(self):
assert_raises_rpc_error(-8, "Mocktime cannot be negative: -1.", self.nodes[0].setmocktime, -1)
assert_raises_rpc_error(-8, "Mocktime must be in the range [0, 9223372036], not -1.", self.nodes[0].setmocktime, -1)
def _test_uptime(self):
wait_time = 10

View file

@ -55,7 +55,7 @@ class SignRawTransactionWithWalletTest(BitcoinTestFramework):
def test_with_invalid_sighashtype(self):
self.log.info("Test signrawtransactionwithwallet raises if an invalid sighashtype is passed")
assert_raises_rpc_error(-8, "all is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithwallet, hexstring=RAW_TX, sighashtype="all")
assert_raises_rpc_error(-8, "'all' is not a valid sighash parameter.", self.nodes[0].signrawtransactionwithwallet, hexstring=RAW_TX, sighashtype="all")
def script_verification_error_test(self):
"""Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.