mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge pull request #4261 from PastaPastaPasta/backport-triv-pr16
Backport triv pr16
This commit is contained in:
commit
0c2b1be930
26
.editorconfig
Normal file
26
.editorconfig
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# This is the top-most EditorConfig file.
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# For all files.
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
# Source code files
|
||||||
|
[*.{h,cpp,py,sh}]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
# .cirrus.yml, .appveyor.yml, .fuzzbuzz.yml, etc.
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# Makefiles
|
||||||
|
[{*.am,Makefile.*.include}]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
# Autoconf scripts
|
||||||
|
[configure.ac]
|
||||||
|
indent_size = 2
|
13
Makefile.am
13
Makefile.am
@ -74,6 +74,7 @@ COVERAGE_INFO = baseline.info \
|
|||||||
dist-hook:
|
dist-hook:
|
||||||
-$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -
|
-$(GIT) archive --format=tar HEAD -- src/clientversion.cpp | $(AMTAR) -C $(top_distdir) -xf -
|
||||||
|
|
||||||
|
if TARGET_WINDOWS
|
||||||
$(BITCOIN_WIN_INSTALLER): all-recursive
|
$(BITCOIN_WIN_INSTALLER): all-recursive
|
||||||
$(MKDIR_P) $(top_builddir)/release
|
$(MKDIR_P) $(top_builddir)/release
|
||||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
|
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
|
||||||
@ -84,6 +85,10 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
|
|||||||
echo error: could not build $@
|
echo error: could not build $@
|
||||||
@echo built $@
|
@echo built $@
|
||||||
|
|
||||||
|
deploy: $(BITCOIN_WIN_INSTALLER)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if TARGET_DARWIN
|
||||||
$(OSX_APP)/Contents/PkgInfo:
|
$(OSX_APP)/Contents/PkgInfo:
|
||||||
$(MKDIR_P) $(@D)
|
$(MKDIR_P) $(@D)
|
||||||
@echo "APPL????" > $@
|
@echo "APPL????" > $@
|
||||||
@ -127,7 +132,7 @@ $(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE).png $(OSX_BACKGROUND_IMAGE)@2x.
|
|||||||
tiffutil -cathidpicheck $^ -out $@
|
tiffutil -cathidpicheck $^ -out $@
|
||||||
|
|
||||||
deploydir: $(OSX_DMG)
|
deploydir: $(OSX_DMG)
|
||||||
else
|
else !BUILD_DARWIN
|
||||||
APP_DIST_DIR=$(top_builddir)/dist
|
APP_DIST_DIR=$(top_builddir)/dist
|
||||||
APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||||
|
|
||||||
@ -154,15 +159,11 @@ $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt: $(OSX_APP_BUILT) $(OSX_PACKAG
|
|||||||
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||||
|
|
||||||
deploydir: $(APP_DIST_EXTRAS)
|
deploydir: $(APP_DIST_EXTRAS)
|
||||||
endif
|
endif !BUILD_DARWIN
|
||||||
|
|
||||||
if TARGET_DARWIN
|
|
||||||
appbundle: $(OSX_APP_BUILT)
|
appbundle: $(OSX_APP_BUILT)
|
||||||
deploy: $(OSX_DMG)
|
deploy: $(OSX_DMG)
|
||||||
endif
|
endif
|
||||||
if TARGET_WINDOWS
|
|
||||||
deploy: $(BITCOIN_WIN_INSTALLER)
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(BITCOIN_QT_BIN): FORCE
|
$(BITCOIN_QT_BIN): FORCE
|
||||||
$(MAKE) -C src qt/$(@F)
|
$(MAKE) -C src qt/$(@F)
|
||||||
|
@ -133,7 +133,6 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
|||||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static])
|
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static])
|
||||||
AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb])
|
AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb])
|
||||||
elif test "x$TARGET_OS" = xdarwin; then
|
elif test "x$TARGET_OS" = xdarwin; then
|
||||||
AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)])
|
|
||||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa])
|
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa])
|
||||||
AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa])
|
AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa])
|
||||||
fi
|
fi
|
||||||
@ -219,7 +218,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
|||||||
*darwin*)
|
*darwin*)
|
||||||
BITCOIN_QT_CHECK([
|
BITCOIN_QT_CHECK([
|
||||||
MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC"
|
MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC"
|
||||||
base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit"
|
base_frameworks="-framework Foundation -framework AppKit"
|
||||||
AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
|
AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
|
@ -1423,6 +1423,10 @@ if test "x$use_ccache" != "xno"; then
|
|||||||
CXX="$ac_cv_path_CCACHE $CXX"
|
CXX="$ac_cv_path_CCACHE $CXX"
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT($use_ccache)
|
AC_MSG_RESULT($use_ccache)
|
||||||
|
if test "x$use_ccache" = "xyes"; then
|
||||||
|
AX_CHECK_COMPILE_FLAG([-fdebug-prefix-map=A=B],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -fdebug-prefix-map=\$(abs_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||||
|
AX_CHECK_PREPROC_FLAG([-fmacro-prefix-map=A=B],[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -fmacro-prefix-map=\$(abs_srcdir)=."],,[[$CXXFLAG_WERROR]])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl enable wallet
|
dnl enable wallet
|
||||||
|
@ -60,16 +60,17 @@ start_pre() {
|
|||||||
"${BITCOIND_PIDDIR}"
|
"${BITCOIND_PIDDIR}"
|
||||||
|
|
||||||
checkpath -f \
|
checkpath -f \
|
||||||
-o ${BITCOIND_USER}:${BITCOIND_GROUP} \
|
-o "${BITCOIND_USER}:${BITCOIND_GROUP}" \
|
||||||
-m 0660 \
|
-m 0660 \
|
||||||
${BITCOIND_CONFIGFILE}
|
"${BITCOIND_CONFIGFILE}"
|
||||||
|
|
||||||
checkconfig || return 1
|
checkconfig || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
checkconfig()
|
checkconfig()
|
||||||
{
|
{
|
||||||
if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
|
if grep -qs '^rpcuser=' "${BITCOIND_CONFIGFILE}" && \
|
||||||
|
! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
|
||||||
eerror ""
|
eerror ""
|
||||||
eerror "ERROR: You must set a secure rpcpassword to run dashd."
|
eerror "ERROR: You must set a secure rpcpassword to run dashd."
|
||||||
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"
|
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"
|
||||||
|
@ -14,7 +14,7 @@ LOCALNET_V4="192.168.0.0/16"
|
|||||||
#defines the IPv6 address space for which you wish to disable rate limiting
|
#defines the IPv6 address space for which you wish to disable rate limiting
|
||||||
LOCALNET_V6="fe80::/10"
|
LOCALNET_V6="fe80::/10"
|
||||||
|
|
||||||
#delete existing rules
|
#delete existing rules ('Error: Cannot delete qdisc with handle of zero.' means there weren't any.)
|
||||||
tc qdisc del dev ${IF} root
|
tc qdisc del dev ${IF} root
|
||||||
|
|
||||||
#add root class
|
#add root class
|
||||||
|
@ -4,3 +4,4 @@
|
|||||||
B8B3F1C0E58C15DB6A81D30C3648A882F4316B9B
|
B8B3F1C0E58C15DB6A81D30C3648A882F4316B9B
|
||||||
CA03882CB1FC067B5D3ACFE4D300116E1C875A3D
|
CA03882CB1FC067B5D3ACFE4D300116E1C875A3D
|
||||||
E777299FC265DD04793070EB944D35F9AC3DB76A
|
E777299FC265DD04793070EB944D35F9AC3DB76A
|
||||||
|
D1DBF2C4B96F2DEBF4C16654410108112E7EA81F
|
||||||
|
@ -180,7 +180,7 @@ install: check-packages $(host_prefix)/share/config.site
|
|||||||
download-one: check-sources $(all_sources)
|
download-one: check-sources $(all_sources)
|
||||||
|
|
||||||
download-osx:
|
download-osx:
|
||||||
@$(MAKE) -s HOST=x86_64-apple-darwin14 download-one
|
@$(MAKE) -s HOST=x86_64-apple-darwin download-one
|
||||||
download-linux:
|
download-linux:
|
||||||
@$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one
|
@$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one
|
||||||
download-win:
|
download-win:
|
||||||
|
@ -9,6 +9,7 @@ define $(package)_set_vars
|
|||||||
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
|
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication
|
||||||
$(package)_config_opts_mingw32=--enable-mingw
|
$(package)_config_opts_mingw32=--enable-mingw
|
||||||
$(package)_config_opts_linux=--with-pic
|
$(package)_config_opts_linux=--with-pic
|
||||||
|
$(package)_config_opts_android=--with-pic
|
||||||
$(package)_cflags+=-Wno-error=implicit-function-declaration
|
$(package)_cflags+=-Wno-error=implicit-function-declaration
|
||||||
$(package)_cxxflags=-std=c++11
|
$(package)_cxxflags=-std=c++11
|
||||||
$(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
|
$(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
|
||||||
|
@ -6,7 +6,6 @@ $(package)_file_name=qtbase-$($(package)_suffix)
|
|||||||
$(package)_sha256_hash=eed620cb268b199bd83b3fc6a471c51d51e1dc2dbb5374fc97a0cc75facbe36f
|
$(package)_sha256_hash=eed620cb268b199bd83b3fc6a471c51d51e1dc2dbb5374fc97a0cc75facbe36f
|
||||||
$(package)_dependencies=openssl zlib
|
$(package)_dependencies=openssl zlib
|
||||||
$(package)_linux_dependencies=freetype fontconfig libxcb
|
$(package)_linux_dependencies=freetype fontconfig libxcb
|
||||||
$(package)_build_subdir=qtbase
|
|
||||||
$(package)_qt_libs=corelib network widgets gui plugins testlib
|
$(package)_qt_libs=corelib network widgets gui plugins testlib
|
||||||
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch xkb-default.patch no-xlib.patch
|
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch xkb-default.patch no-xlib.patch
|
||||||
|
|
||||||
@ -85,6 +84,9 @@ $(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
|
|||||||
$(package)_config_opts_darwin += -device-option MAC_LD64_VERSION=$(LD64_VERSION)
|
$(package)_config_opts_darwin += -device-option MAC_LD64_VERSION=$(LD64_VERSION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# for macOS on Apple Silicon (ARM) see https://bugreports.qt.io/browse/QTBUG-85279
|
||||||
|
$(package)_config_opts_arm_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64
|
||||||
|
|
||||||
$(package)_config_opts_linux = -qt-xkbcommon-x11
|
$(package)_config_opts_linux = -qt-xkbcommon-x11
|
||||||
$(package)_config_opts_linux += -qt-xcb
|
$(package)_config_opts_linux += -qt-xcb
|
||||||
$(package)_config_opts_linux += -no-xcb-xlib
|
$(package)_config_opts_linux += -no-xcb-xlib
|
||||||
@ -156,31 +158,30 @@ define $(package)_config_cmds
|
|||||||
export PKG_CONFIG_SYSROOT_DIR=/ && \
|
export PKG_CONFIG_SYSROOT_DIR=/ && \
|
||||||
export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \
|
export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \
|
||||||
export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \
|
export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \
|
||||||
|
cd qtbase && \
|
||||||
./configure $($(package)_config_opts) && \
|
./configure $($(package)_config_opts) && \
|
||||||
echo "host_build: QT_CONFIG ~= s/system-zlib/zlib" >> mkspecs/qconfig.pri && \
|
echo "host_build: QT_CONFIG ~= s/system-zlib/zlib" >> mkspecs/qconfig.pri && \
|
||||||
echo "CONFIG += force_bootstrap" >> mkspecs/qconfig.pri && \
|
echo "CONFIG += force_bootstrap" >> mkspecs/qconfig.pri && \
|
||||||
$(MAKE) sub-src-clean && \
|
cd .. && \
|
||||||
cd ../qttranslations && ../qtbase/bin/qmake qttranslations.pro -o Makefile && \
|
$(MAKE) -C qtbase sub-src-clean && \
|
||||||
cd translations && ../../qtbase/bin/qmake translations.pro -o Makefile && cd ../.. && \
|
qtbase/bin/qmake -o qttranslations/Makefile qttranslations/qttranslations.pro && \
|
||||||
cd qttools/src/linguist/lrelease/ && ../../../../qtbase/bin/qmake lrelease.pro -o Makefile && \
|
qtbase/bin/qmake -o qttranslations/translations/Makefile qttranslations/translations/translations.pro && \
|
||||||
cd ../lupdate/ && ../../../../qtbase/bin/qmake lupdate.pro -o Makefile && cd ../../../..
|
qtbase/bin/qmake -o qttools/src/linguist/lrelease/Makefile qttools/src/linguist/lrelease/lrelease.pro && \
|
||||||
|
qtbase/bin/qmake -o qttools/src/linguist/lupdate/Makefile qttools/src/linguist/lupdate/lupdate.pro
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_build_cmds
|
define $(package)_build_cmds
|
||||||
$(MAKE) -C src $(addprefix sub-,$($(package)_qt_libs)) && \
|
$(MAKE) -C qtbase/src $(addprefix sub-,$($(package)_qt_libs)) && \
|
||||||
$(MAKE) -C ../qttools/src/linguist/lrelease && \
|
$(MAKE) -C qttools/src/linguist/lrelease && \
|
||||||
$(MAKE) -C ../qttools/src/linguist/lupdate && \
|
$(MAKE) -C qttools/src/linguist/lupdate && \
|
||||||
$(MAKE) -C ../qttranslations
|
$(MAKE) -C qttranslations
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
define $(package)_stage_cmds
|
||||||
$(MAKE) -C src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && cd .. && \
|
$(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \
|
||||||
$(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \
|
$(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \
|
||||||
$(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \
|
$(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \
|
||||||
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \
|
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets
|
||||||
if `test -f qtbase/src/plugins/platforms/xcb/xcb-static/libxcb-static.a`; then \
|
|
||||||
cp qtbase/src/plugins/platforms/xcb/xcb-static/libxcb-static.a $($(package)_staging_prefix_dir)/lib; \
|
|
||||||
fi
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_postprocess_cmds
|
define $(package)_postprocess_cmds
|
||||||
|
@ -332,22 +332,20 @@ public:
|
|||||||
* * nNew
|
* * nNew
|
||||||
* * nTried
|
* * nTried
|
||||||
* * number of "new" buckets XOR 2**30
|
* * number of "new" buckets XOR 2**30
|
||||||
* * all nNew addrinfos in vvNew
|
* * all new addresses (total count: nNew)
|
||||||
* * all nTried addrinfos in vvTried
|
* * all tried addresses (total count: nTried)
|
||||||
* * for each bucket:
|
* * for each new bucket:
|
||||||
* * number of elements
|
* * number of elements
|
||||||
* * for each element: index
|
* * for each element: index in the serialized "all new addresses"
|
||||||
|
* * asmap checksum
|
||||||
*
|
*
|
||||||
* 2**30 is xorred with the number of buckets to make addrman deserializer v0 detect it
|
* 2**30 is xorred with the number of buckets to make addrman deserializer v0 detect it
|
||||||
* as incompatible. This is necessary because it did not check the version number on
|
* as incompatible. This is necessary because it did not check the version number on
|
||||||
* deserialization.
|
* deserialization.
|
||||||
*
|
*
|
||||||
* Notice that vvTried, mapAddr and vVector are never encoded explicitly;
|
* vvNew, vvTried, mapInfo, mapAddr and vRandom are never encoded explicitly;
|
||||||
* they are instead reconstructed from the other information.
|
* they are instead reconstructed from the other information.
|
||||||
*
|
*
|
||||||
* vvNew is serialized, but only used if ADDRMAN_UNKNOWN_BUCKET_COUNT didn't change,
|
|
||||||
* otherwise it is reconstructed as well.
|
|
||||||
*
|
|
||||||
* This format is more complex, but significantly smaller (at most 1.5 MiB), and supports
|
* This format is more complex, but significantly smaller (at most 1.5 MiB), and supports
|
||||||
* changes to the ADDRMAN_ parameters without breaking the on-disk structure.
|
* changes to the ADDRMAN_ parameters without breaking the on-disk structure.
|
||||||
*
|
*
|
||||||
@ -405,13 +403,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Store asmap version after bucket entries so that it
|
// Store asmap checksum after bucket entries so that it
|
||||||
// can be ignored by older clients for backward compatibility.
|
// can be ignored by older clients for backward compatibility.
|
||||||
uint256 asmap_version;
|
uint256 asmap_checksum;
|
||||||
if (m_asmap.size() != 0) {
|
if (m_asmap.size() != 0) {
|
||||||
asmap_version = SerializeHash(m_asmap);
|
asmap_checksum = SerializeHash(m_asmap);
|
||||||
}
|
}
|
||||||
s << asmap_version;
|
s << asmap_checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
@ -494,47 +492,63 @@ public:
|
|||||||
nTried -= nLost;
|
nTried -= nLost;
|
||||||
|
|
||||||
// Store positions in the new table buckets to apply later (if possible).
|
// Store positions in the new table buckets to apply later (if possible).
|
||||||
std::map<int, int> entryToBucket; // Represents which entry belonged to which bucket when serializing
|
// An entry may appear in up to ADDRMAN_NEW_BUCKETS_PER_ADDRESS buckets,
|
||||||
|
// so we store all bucket-entry_index pairs to iterate through later.
|
||||||
|
std::vector<std::pair<int, int>> bucket_entries;
|
||||||
|
|
||||||
for (int bucket = 0; bucket < nUBuckets; bucket++) {
|
for (int bucket = 0; bucket < nUBuckets; ++bucket) {
|
||||||
int nSize = 0;
|
int num_entries{0};
|
||||||
s >> nSize;
|
s >> num_entries;
|
||||||
for (int n = 0; n < nSize; n++) {
|
for (int n = 0; n < num_entries; ++n) {
|
||||||
int nIndex = 0;
|
int entry_index{0};
|
||||||
s >> nIndex;
|
s >> entry_index;
|
||||||
if (nIndex >= 0 && nIndex < nNew) {
|
if (entry_index >= 0 && entry_index < nNew) {
|
||||||
entryToBucket[nIndex] = bucket;
|
bucket_entries.emplace_back(bucket, entry_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 supplied_asmap_version;
|
// If the bucket count and asmap checksum haven't changed, then attempt
|
||||||
|
// to restore the entries to the buckets/positions they were in before
|
||||||
|
// serialization.
|
||||||
|
uint256 supplied_asmap_checksum;
|
||||||
if (m_asmap.size() != 0) {
|
if (m_asmap.size() != 0) {
|
||||||
supplied_asmap_version = SerializeHash(m_asmap);
|
supplied_asmap_checksum = SerializeHash(m_asmap);
|
||||||
}
|
}
|
||||||
uint256 serialized_asmap_version;
|
uint256 serialized_asmap_checksum;
|
||||||
if (format >= Format::V2_ASMAP) {
|
if (format >= Format::V2_ASMAP) {
|
||||||
s >> serialized_asmap_version;
|
s >> serialized_asmap_checksum;
|
||||||
|
}
|
||||||
|
const bool restore_bucketing{nUBuckets == ADDRMAN_NEW_BUCKET_COUNT &&
|
||||||
|
serialized_asmap_checksum == supplied_asmap_checksum};
|
||||||
|
|
||||||
|
if (!restore_bucketing) {
|
||||||
|
LogPrint(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int n = 0; n < nNew; n++) {
|
for (auto bucket_entry : bucket_entries) {
|
||||||
CAddrInfo &info = mapInfo[n];
|
int bucket{bucket_entry.first};
|
||||||
int bucket = entryToBucket[n];
|
const int entry_index{bucket_entry.second};
|
||||||
int nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
|
CAddrInfo& info = mapInfo[entry_index];
|
||||||
if (format >= Format::V2_ASMAP && nUBuckets == ADDRMAN_NEW_BUCKET_COUNT && vvNew[bucket][nUBucketPos] == -1 &&
|
|
||||||
info.nRefCount < ADDRMAN_NEW_BUCKETS_PER_ADDRESS && serialized_asmap_version == supplied_asmap_version) {
|
// The entry shouldn't appear in more than
|
||||||
|
// ADDRMAN_NEW_BUCKETS_PER_ADDRESS. If it has already, just skip
|
||||||
|
// this bucket_entry.
|
||||||
|
if (info.nRefCount >= ADDRMAN_NEW_BUCKETS_PER_ADDRESS) continue;
|
||||||
|
|
||||||
|
int bucket_position = info.GetBucketPosition(nKey, true, bucket);
|
||||||
|
if (restore_bucketing && vvNew[bucket][bucket_position] == -1) {
|
||||||
// Bucketing has not changed, using existing bucket positions for the new table
|
// Bucketing has not changed, using existing bucket positions for the new table
|
||||||
vvNew[bucket][nUBucketPos] = n;
|
vvNew[bucket][bucket_position] = entry_index;
|
||||||
info.nRefCount++;
|
++info.nRefCount;
|
||||||
} else {
|
} else {
|
||||||
// In case the new table data cannot be used (format unknown, bucket count wrong or new asmap),
|
// In case the new table data cannot be used (bucket count wrong or new asmap),
|
||||||
// try to give them a reference based on their primary source address.
|
// try to give them a reference based on their primary source address.
|
||||||
LogPrint(BCLog::ADDRMAN, "Bucketing method was updated, re-bucketing addrman entries from disk\n");
|
|
||||||
bucket = info.GetNewBucket(nKey, m_asmap);
|
bucket = info.GetNewBucket(nKey, m_asmap);
|
||||||
nUBucketPos = info.GetBucketPosition(nKey, true, bucket);
|
bucket_position = info.GetBucketPosition(nKey, true, bucket);
|
||||||
if (vvNew[bucket][nUBucketPos] == -1) {
|
if (vvNew[bucket][bucket_position] == -1) {
|
||||||
vvNew[bucket][nUBucketPos] = n;
|
vvNew[bucket][bucket_position] = entry_index;
|
||||||
info.nRefCount++;
|
++info.nRefCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,6 +429,11 @@ bool CNetAddr::IsValid() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CJDNS addresses always start with 0xfc
|
||||||
|
if (IsCJDNS() && (m_addr[0] != 0xFC)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// documentation IPv6 address
|
// documentation IPv6 address
|
||||||
if (IsRFC3849())
|
if (IsRFC3849())
|
||||||
return false;
|
return false;
|
||||||
|
@ -175,13 +175,17 @@ AddressTableModel::~AddressTableModel()
|
|||||||
|
|
||||||
int AddressTableModel::rowCount(const QModelIndex &parent) const
|
int AddressTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddressTableModel::columnCount(const QModelIndex &parent) const
|
int AddressTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,13 +103,17 @@ BanTableModel::~BanTableModel()
|
|||||||
|
|
||||||
int BanTableModel::rowCount(const QModelIndex &parent) const
|
int BanTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int BanTableModel::columnCount(const QModelIndex &parent) const
|
int BanTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,7 +957,7 @@ void BitcoinGUI::showBackups()
|
|||||||
|
|
||||||
void BitcoinGUI::showHelpMessageClicked()
|
void BitcoinGUI::showHelpMessageClicked()
|
||||||
{
|
{
|
||||||
helpMessageDialog->show();
|
GUIUtil::bringToFront(helpMessageDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::showCoinJoinHelpClicked()
|
void BitcoinGUI::showCoinJoinHelpClicked()
|
||||||
|
@ -17,12 +17,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QtDBus>
|
#include <QtDBus>
|
||||||
#endif
|
#endif
|
||||||
// Include ApplicationServices.h after QtDbus to avoid redefinition of check().
|
|
||||||
// This affects at least OSX 10.6. See /usr/include/AssertMacros.h for details.
|
|
||||||
// Note: This could also be worked around using:
|
|
||||||
// #define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
|
||||||
#include <qt/macnotificationhandler.h>
|
#include <qt/macnotificationhandler.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -140,13 +140,17 @@ void PeerTableModel::stopAutoRefresh()
|
|||||||
|
|
||||||
int PeerTableModel::rowCount(const QModelIndex &parent) const
|
int PeerTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PeerTableModel::columnCount(const QModelIndex &parent) const
|
int PeerTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,15 +38,17 @@ RecentRequestsTableModel::~RecentRequestsTableModel()
|
|||||||
|
|
||||||
int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const
|
int RecentRequestsTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return list.length();
|
return list.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RecentRequestsTableModel::columnCount(const QModelIndex &parent) const
|
int RecentRequestsTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,6 @@ void RPCConsole::setClientModel(ClientModel *model)
|
|||||||
// set up peer table
|
// set up peer table
|
||||||
ui->peerWidget->setModel(model->getPeerTableModel());
|
ui->peerWidget->setModel(model->getPeerTableModel());
|
||||||
ui->peerWidget->verticalHeader()->hide();
|
ui->peerWidget->verticalHeader()->hide();
|
||||||
ui->peerWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
ui->peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
ui->peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
@ -673,7 +672,6 @@ void RPCConsole::setClientModel(ClientModel *model)
|
|||||||
// set up ban table
|
// set up ban table
|
||||||
ui->banlistWidget->setModel(model->getBanTableModel());
|
ui->banlistWidget->setModel(model->getBanTableModel());
|
||||||
ui->banlistWidget->verticalHeader()->hide();
|
ui->banlistWidget->verticalHeader()->hide();
|
||||||
ui->banlistWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
@ -289,13 +289,17 @@ int TransactionTableModel::getChainLockHeight() const
|
|||||||
|
|
||||||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return priv->size();
|
return priv->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransactionTableModel::columnCount(const QModelIndex &parent) const
|
int TransactionTableModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return columns.length();
|
return columns.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,6 +549,16 @@ BOOST_AUTO_TEST_CASE(cnetaddr_unserialize_v2)
|
|||||||
BOOST_CHECK_EQUAL(addr.ToString(), "fc00:1:2:3:4:5:6:7");
|
BOOST_CHECK_EQUAL(addr.ToString(), "fc00:1:2:3:4:5:6:7");
|
||||||
BOOST_REQUIRE(s.empty());
|
BOOST_REQUIRE(s.empty());
|
||||||
|
|
||||||
|
// Invalid CJDNS, wrong prefix.
|
||||||
|
s << MakeSpan(ParseHex("06" // network type (CJDNS)
|
||||||
|
"10" // address length
|
||||||
|
"aa000001000200030004000500060007" // address
|
||||||
|
));
|
||||||
|
s >> addr;
|
||||||
|
BOOST_CHECK(addr.IsCJDNS());
|
||||||
|
BOOST_CHECK(!addr.IsValid());
|
||||||
|
BOOST_REQUIRE(s.empty());
|
||||||
|
|
||||||
// Invalid CJDNS, with bogus length.
|
// Invalid CJDNS, with bogus length.
|
||||||
s << MakeSpan(ParseHex("06" // network type (CJDNS)
|
s << MakeSpan(ParseHex("06" // network type (CJDNS)
|
||||||
"01" // address length
|
"01" // address length
|
||||||
|
@ -1052,7 +1052,7 @@ static constexpr char LockCommand = 'L';
|
|||||||
static constexpr char UnlockCommand = 'U';
|
static constexpr char UnlockCommand = 'U';
|
||||||
static constexpr char ExitCommand = 'X';
|
static constexpr char ExitCommand = 'X';
|
||||||
|
|
||||||
static void TestOtherProcess(fs::path dirname, std::string lockname, int fd)
|
[[noreturn]] static void TestOtherProcess(fs::path dirname, std::string lockname, int fd)
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -88,7 +88,7 @@ class AssumeValidTest(BitcoinTestFramework):
|
|||||||
last_height = current_height
|
last_height = current_height
|
||||||
if timeout < 0:
|
if timeout < 0:
|
||||||
assert False, "blockchain too short after timeout: %d" % current_height
|
assert False, "blockchain too short after timeout: %d" % current_height
|
||||||
timeout - 0.25
|
timeout -= 0.25
|
||||||
continue
|
continue
|
||||||
elif current_height > height:
|
elif current_height > height:
|
||||||
assert False, "blockchain too long: %d" % current_height
|
assert False, "blockchain too long: %d" % current_height
|
||||||
|
@ -250,7 +250,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
|
|
||||||
# Methods to override in subclass test scripts.
|
# Methods to override in subclass test scripts.
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
"""Tests must this method to change default values for number of nodes, topology, etc"""
|
"""Tests must override this method to change default values for number of nodes, topology, etc"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def add_options(self, parser):
|
def add_options(self, parser):
|
||||||
|
Loading…
Reference in New Issue
Block a user