aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-05-13 11:53:26 +0800
committermerge-script <fanquake@gmail.com>2024-05-13 11:53:26 +0800
commitc7885ecd778d7e42bc07a0ba73156525e86a8aae (patch)
tree5c35568d75935595ecf024834a9d0ebcb8001530 /src
parentd82283950f5ff3b2116e705f931c6e89e5fdd0be (diff)
parentbd5860bc7a892c6bcffe313246dd6b81b973b9c6 (diff)
Merge bitcoin/bitcoin#29888: [27.x] Backports
bd5860bc7a892c6bcffe313246dd6b81b973b9c6 [WIP] doc: release notes for 27.x (fanquake) 475aac41fba0b55a487c7fe21a1f540d3f0bb7b6 doc: add LLVM instruction for macOS < 13 (Sjors Provoost) a995902d604c701be4f46087057b907de9a0ecca depends: Fix build of Qt for 32-bit platforms (laanwj) 0fcceefe22532dc6389a95d2e058599e9496003b Fix #29767, set m_synced = true after Commit() (nanlour) ae9a2ed40a4f40bce822fb7cb47804c45e394e11 sign: don't assume we are parsing a sane Miniscript (Antoine Poinsot) a6a59cfebc81d82fefb69c6592f4c75fcdde902f rpc: Reword SighashFromStr error message (MarcoFalke) 364bf01ff254f9fa01e14f24002af682a51b4883 build: Fix false positive `CHECK_ATOMIC` test for clang-15 (Hennadii Stepanov) 9277793b4ee70a6f0d471cf3ff3051f2eebdbb15 test: Fix failing univalue float test (MarcoFalke) 5c097910e03229150ed9b5fdae65173cfbf66740 doc: archive 27.0 release notes (fanquake) 897e5af58a1a02e3b555c52eefb8f7cb61a7a91a [rpc, bugfix] Enforce maximum value for setmocktime (dergoegge) 602cfd580a8f44a8f49b59b2a6660c54f6aec1ca ci: Bump s390x to ubuntu:24.04 (MarcoFalke) 20e6e8dc805036730672b64b768ea771a1000fd8 Change Luke Dashjr seed to dashjr-list-of-p2p-nodes.us (Luke Dashjr) a6862c50c52f1606f8ad143da8d8f3c7e8f3f5c3 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 bd5860bc7a892c6bcffe313246dd6b81b973b9c6 stickies-v: re-ACK bd5860bc7a892c6bcffe313246dd6b81b973b9c6 TheCharlatan: ACK bd5860bc7a892c6bcffe313246dd6b81b973b9c6 Tree-SHA512: a1a40de70cf52b5fc01d9dcc772421751a18c6a48a726c4c05c0371c585a53a27902e17daed9e0d721ab7763c94bb32de05c146bd6bc73fd558edd08b31e8547
Diffstat (limited to 'src')
-rw-r--r--src/core_read.cpp2
-rw-r--r--src/index/base.cpp2
-rw-r--r--src/kernel/chainparams.cpp2
-rw-r--r--src/rpc/node.cpp7
-rw-r--r--src/script/sign.cpp2
-rw-r--r--src/test/rpc_tests.cpp1
-rw-r--r--src/test/script_tests.cpp24
-rw-r--r--src/univalue/test/object.cpp2
8 files changed, 35 insertions, 7 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp
index e32e46d1b9..5956d9df5f 100644
--- a/src/core_read.cpp
+++ b/src/core_read.cpp
@@ -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.")};
}
}
diff --git a/src/index/base.cpp b/src/index/base.cpp
index bcfe7215be..af7a80392d 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -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)) {
diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp
index 264a2fd681..26c261eba2 100644
--- a/src/kernel/chainparams.cpp
+++ b/src/kernel/chainparams.cpp
@@ -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
diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp
index 45053f882d..02e56e61eb 100644
--- a/src/rpc/node.cpp
+++ b/src/rpc/node.cpp
@@ -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) {
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index be4b357568..22ac062a63 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -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;
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp
index 0d2460c606..3a1cb45e8d 100644
--- a/src/test/rpc_tests.cpp
+++ b/src/test/rpc_tests.cpp
@@ -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);
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index ac457d9c77..f61eb38679 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -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;
diff --git a/src/univalue/test/object.cpp b/src/univalue/test/object.cpp
index 8b90448b36..1c724555f3 100644
--- a/src/univalue/test/object.cpp
+++ b/src/univalue/test/object.cpp
@@ -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