Merge pull request #4543 from Munkybooty/backports-0.19-pr4

Backports 0.19 pr4
This commit is contained in:
PastaPastaPasta 2021-11-10 16:02:28 -05:00 committed by GitHub
commit 05c133ef62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 99 additions and 12 deletions

View File

@ -34,6 +34,7 @@ BASE_CACHE ?= $(BASEDIR)/built
SDK_PATH ?= $(BASEDIR)/SDKs SDK_PATH ?= $(BASEDIR)/SDKs
NO_QT ?= NO_QT ?=
NO_WALLET ?= NO_WALLET ?=
NO_ZMQ ?=
NO_UPNP ?= NO_UPNP ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
@ -126,6 +127,7 @@ endif
qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages)
wallet_packages_$(NO_WALLET) = $(wallet_packages) wallet_packages_$(NO_WALLET) = $(wallet_packages)
upnp_packages_$(NO_UPNP) = $(upnp_packages) upnp_packages_$(NO_UPNP) = $(upnp_packages)
zmq_packages_$(NO_ZMQ) = $(zmq_packages)
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_)
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
@ -134,6 +136,10 @@ ifneq ($(qt_packages_),)
native_packages += $(qt_native_packages) native_packages += $(qt_native_packages)
endif endif
ifneq ($(zmq_packages_),)
packages += $(zmq_packages)
endif
all_packages = $(packages) $(native_packages) all_packages = $(packages) $(native_packages)
meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk
@ -193,6 +199,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
-e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
-e 's|@no_qt@|$(NO_QT)|' \ -e 's|@no_qt@|$(NO_QT)|' \
-e 's|@no_zmq@|$(NO_ZMQ)|' \
-e 's|@no_wallet@|$(NO_WALLET)|' \ -e 's|@no_wallet@|$(NO_WALLET)|' \
-e 's|@no_upnp@|$(NO_UPNP)|' \ -e 's|@no_upnp@|$(NO_UPNP)|' \
-e 's|@debug@|$(DEBUG)|' \ -e 's|@debug@|$(DEBUG)|' \

View File

@ -79,6 +79,8 @@ The following can be set when running make: `make FOO=bar`
<dd>If a source file can't be fetched, try here before giving up</dd> <dd>If a source file can't be fetched, try here before giving up</dd>
<dt>NO_QT</dt> <dt>NO_QT</dt>
<dd>Don't download/build/cache qt and its dependencies</dd> <dd>Don't download/build/cache qt and its dependencies</dd>
<dt>NO_ZMQ</dt>
<dd>Don't download/build/cache packages needed for enabling zeromq</dd>
<dt>NO_WALLET</dt> <dt>NO_WALLET</dt>
<dd>Don't download/build/cache libs needed to enable the wallet</dd> <dd>Don't download/build/cache libs needed to enable the wallet</dd>
<dt>NO_UPNP</dt> <dt>NO_UPNP</dt>

View File

@ -43,6 +43,10 @@ if test -z $with_gui && test -n "@no_qt@"; then
with_gui=no with_gui=no
fi fi
if test -z $enable_zmq && test -n "@no_zmq@"; then
enable_zmq=no
fi
if test -n "@debug@" && test -z "@no_qt@" && test "x$with_gui" != xno; then if test -n "@debug@" && test -z "@no_qt@" && test "x$with_gui" != xno; then
with_gui=qt5_debug with_gui=qt5_debug
fi fi

View File

@ -1,4 +1,4 @@
packages:=boost openssl libevent zeromq gmp bls-dash backtrace cmake immer packages:=boost openssl libevent gmp bls-dash backtrace cmake immer
qt_native_packages = native_protobuf qt_native_packages = native_protobuf
qt_packages = qrencode protobuf zlib qt_packages = qrencode protobuf zlib
@ -10,6 +10,8 @@ qt_mingw32_packages=qt
wallet_packages=bdb wallet_packages=bdb
zmq_packages=zeromq
upnp_packages=miniupnpc upnp_packages=miniupnpc
darwin_native_packages = native_biplist native_ds_store native_mac_alias darwin_native_packages = native_biplist native_ds_store native_mac_alias

View File

@ -237,6 +237,7 @@ The list of files should be:
dash-${VERSION}-aarch64-linux-gnu.tar.gz dash-${VERSION}-aarch64-linux-gnu.tar.gz
dash-${VERSION}-arm-linux-gnueabihf.tar.gz dash-${VERSION}-arm-linux-gnueabihf.tar.gz
dash-${VERSION}-i686-pc-linux-gnu.tar.gz dash-${VERSION}-i686-pc-linux-gnu.tar.gz
dash-${VERSION}-riscv64-linux-gnu.tar.gz
dash-${VERSION}-x86_64-linux-gnu.tar.gz dash-${VERSION}-x86_64-linux-gnu.tar.gz
dash-${VERSION}-osx64.tar.gz dash-${VERSION}-osx64.tar.gz
dash-${VERSION}-osx.dmg dash-${VERSION}-osx.dmg

View File

@ -132,6 +132,7 @@ BITCOIN_TESTS =\
test/cachemap_tests.cpp \ test/cachemap_tests.cpp \
test/cachemultimap_tests.cpp \ test/cachemultimap_tests.cpp \
test/coins_tests.cpp \ test/coins_tests.cpp \
test/compilerbug_tests.cpp \
test/compress_tests.cpp \ test/compress_tests.cpp \
test/crypto_tests.cpp \ test/crypto_tests.cpp \
test/cuckoocache_tests.cpp \ test/cuckoocache_tests.cpp \

View File

@ -1395,6 +1395,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="20" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View File

@ -0,0 +1,43 @@
// Copyright (c) 2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <test/setup_common.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(compilerbug_tests, BasicTestingSetup)
#if defined(__GNUC__)
// This block will also be built under clang, which is fine (as it supports noinline)
void __attribute__ ((noinline)) set_one(unsigned char* ptr)
{
*ptr = 1;
}
int __attribute__ ((noinline)) check_zero(unsigned char const* in, unsigned int len)
{
for (unsigned int i = 0; i < len; ++i) {
if (in[i] != 0) return 0;
}
return 1;
}
void set_one_on_stack() {
unsigned char buf[1];
set_one(buf);
}
BOOST_AUTO_TEST_CASE(gccbug_90348) {
// Test for GCC bug 90348. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348
for (int i = 0; i <= 4; ++i) {
unsigned char in[4];
for (int j = 0; j < i; ++j) {
in[j] = 0;
set_one_on_stack(); // Apparently modifies in[0]
}
BOOST_CHECK(check_zero(in, i));
}
}
#endif
BOOST_AUTO_TEST_SUITE_END()

View File

@ -2179,6 +2179,10 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock(); auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet); LOCK(pwallet->cs_wallet);
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: wallet does not contain private keys, nothing to encrypt.");
}
if (pwallet->IsCrypted()) { if (pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called."); throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");
} }

View File

@ -42,7 +42,11 @@ class RawTransactionsTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 3 self.num_nodes = 3
self.extra_args = [["-txindex"], ["-txindex"], ["-txindex"]] self.extra_args = [
["-txindex"],
["-txindex"],
["-txindex"],
]
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()
@ -303,30 +307,30 @@ class RawTransactionsTest(BitcoinTestFramework):
# getrawtransaction tests # getrawtransaction tests
# 1. valid parameters - only supply txid # 1. valid parameters - only supply txid
txHash = rawTx["txid"] txId = rawTx["txid"]
assert_equal(self.nodes[0].getrawtransaction(txHash), rawTxSigned['hex']) assert_equal(self.nodes[0].getrawtransaction(txId), rawTxSigned['hex'])
# 2. valid parameters - supply txid and 0 for non-verbose # 2. valid parameters - supply txid and 0 for non-verbose
assert_equal(self.nodes[0].getrawtransaction(txHash, 0), rawTxSigned['hex']) assert_equal(self.nodes[0].getrawtransaction(txId, 0), rawTxSigned['hex'])
# 3. valid parameters - supply txid and False for non-verbose # 3. valid parameters - supply txid and False for non-verbose
assert_equal(self.nodes[0].getrawtransaction(txHash, False), rawTxSigned['hex']) assert_equal(self.nodes[0].getrawtransaction(txId, False), rawTxSigned['hex'])
# 4. valid parameters - supply txid and 1 for verbose. # 4. valid parameters - supply txid and 1 for verbose.
# We only check the "hex" field of the output so we don't need to update this test every time the output format changes. # We only check the "hex" field of the output so we don't need to update this test every time the output format changes.
assert_equal(self.nodes[0].getrawtransaction(txHash, 1)["hex"], rawTxSigned['hex']) assert_equal(self.nodes[0].getrawtransaction(txId, 1)["hex"], rawTxSigned['hex'])
# 5. valid parameters - supply txid and True for non-verbose # 5. valid parameters - supply txid and True for non-verbose
assert_equal(self.nodes[0].getrawtransaction(txHash, True)["hex"], rawTxSigned['hex']) assert_equal(self.nodes[0].getrawtransaction(txId, True)["hex"], rawTxSigned['hex'])
# 6. invalid parameters - supply txid and string "Flase" # 6. invalid parameters - supply txid and string "Flase"
assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txHash, "Flase") assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, "Flase")
# 7. invalid parameters - supply txid and empty array # 7. invalid parameters - supply txid and empty array
assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txHash, []) assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, [])
# 8. invalid parameters - supply txid and empty dict # 8. invalid parameters - supply txid and empty dict
assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txHash, {}) assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, {})
inputs = [ {'txid' : "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout' : 1, 'sequence' : 1000}] inputs = [ {'txid' : "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout' : 1, 'sequence' : 1000}]
outputs = { self.nodes[0].getnewaddress() : 1 } outputs = { self.nodes[0].getnewaddress() : 1 }

View File

@ -88,4 +88,10 @@ elif PYTHONWARNINGS="ignore" flake8 --version | grep -q "Python 2"; then
exit 0 exit 0
fi fi
PYTHONWARNINGS="ignore" git ls-files "*.py" | xargs flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; echo "${enabled[*]}") PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; echo "${enabled[*]}")$(
if [[ $# == 0 ]]; then
git ls-files "*.py"
else
echo "$@"
fi
)