mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
Merge pull request #1770 from codablock/pr_backport_bitcoin_0.12-1
Backport missing PRs from Bitcoin 0.13 - Part 1
This commit is contained in:
commit
0658252f59
@ -25,6 +25,7 @@ env:
|
||||
global:
|
||||
- MAKEJOBS=-j5
|
||||
- RUN_TESTS=false
|
||||
- CHECK_DOC=0
|
||||
- BOOST_TEST_RANDOM=1$TRAVIS_BUILD_ID
|
||||
- CCACHE_SIZE=400M
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
@ -65,6 +66,7 @@ install:
|
||||
before_script:
|
||||
- unset CC; unset CXX
|
||||
- unset DISPLAY
|
||||
#- if [ "$CHECK_DOC" = 1 ]; then contrib/devtools/check-doc.py; fi TODO reenable after all Bitcoin PRs have been merged and docs fully fixed
|
||||
- mkdir -p depends/SDKs depends/sdk-sources
|
||||
- if [ -n "$OSX_SDK" -a ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi
|
||||
- if [ -n "$OSX_SDK" -a -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi
|
||||
|
40
Makefile.am
40
Makefile.am
@ -3,6 +3,7 @@ SUBDIRS = src
|
||||
.PHONY: deploy FORCE
|
||||
|
||||
GZIP_ENV="-9n"
|
||||
export PYTHONPATH
|
||||
|
||||
if BUILD_BITCOIN_LIBS
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
@ -14,12 +15,18 @@ BITCOIN_QT_BIN=$(top_builddir)/src/qt/dash-qt$(EXEEXT)
|
||||
BITCOIN_CLI_BIN=$(top_builddir)/src/dash-cli$(EXEEXT)
|
||||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
|
||||
OSX_APP=Dash-Qt.app
|
||||
OSX_DMG=Dash-Core.dmg
|
||||
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
|
||||
OSX_DMG = $(OSX_VOLNAME).dmg
|
||||
OSX_BACKGROUND_SVG=background.svg
|
||||
OSX_BACKGROUND_IMAGE=background.tiff
|
||||
OSX_BACKGROUND_IMAGE_DPIS=36 72
|
||||
OSX_DSSTORE_GEN=$(top_srcdir)/contrib/macdeploy/custom_dsstore.py
|
||||
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||
OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||
OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||
OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
||||
OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
||||
@ -34,9 +41,9 @@ WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
|
||||
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
|
||||
$(top_srcdir)/doc/README_windows.txt
|
||||
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||
$(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||
$(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
|
||||
$(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_SVG) \
|
||||
$(OSX_DSSTORE_GEN) \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||
|
||||
@ -90,17 +97,20 @@ $(OSX_APP)/Contents/MacOS/Dash-Qt: $(BITCOIN_QT_BIN)
|
||||
$(MKDIR_P) $(@D)
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||
$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings:
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
echo '{ CFBundleDisplayName = "$(PACKAGE_NAME)"; CFBundleName = "$(PACKAGE_NAME)"; }' > $@
|
||||
|
||||
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
$(OSX_APP)/Contents/MacOS/Dash-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
|
||||
osx_volname:
|
||||
echo $(OSX_VOLNAME) >$@
|
||||
|
||||
if BUILD_DARWIN
|
||||
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
$(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||
$(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2 -volname $(OSX_VOLNAME)
|
||||
|
||||
deploydir: $(OSX_DMG)
|
||||
else
|
||||
@ -114,13 +124,17 @@ $(APP_DIST_DIR)/Applications:
|
||||
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt
|
||||
|
||||
$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Dash-Core" -no-pad -r -dir-mode 0755 -apple -o $@ dist
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist
|
||||
|
||||
$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||
dpi%.$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_SVG)
|
||||
sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d $* -p $* | $(IMAGEMAGICK_CONVERT) - $@
|
||||
OSX_BACKGROUND_IMAGE_DPIFILES := $(foreach dpi,$(OSX_BACKGROUND_IMAGE_DPIS),dpi$(dpi).$(OSX_BACKGROUND_IMAGE))
|
||||
$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE_DPIFILES)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL) $< $@
|
||||
$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
||||
$(INSTALL) $< $@
|
||||
$(TIFFCP) -c none $(OSX_BACKGROUND_IMAGE_DPIFILES) $@
|
||||
|
||||
$(APP_DIST_DIR)/.DS_Store: $(OSX_DSSTORE_GEN)
|
||||
$< "$@" "$(OSX_VOLNAME)"
|
||||
|
||||
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||
|
@ -6,4 +6,6 @@ if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then
|
||||
LIBTOOLIZE="${GLIBTOOLIZE}"
|
||||
export LIBTOOLIZE
|
||||
fi
|
||||
which autoreconf >/dev/null || \
|
||||
(echo "configuration failed, please install autoconf first" && exit 1)
|
||||
autoreconf --install --force --warnings=all
|
||||
|
@ -38,7 +38,7 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
|
||||
done
|
||||
if test "x$bdbpath" = "xX"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([libdb_cxx headers missing, Dash Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
|
||||
AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
|
||||
elif test "x$bdb48path" = "xX"; then
|
||||
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
|
||||
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
|
||||
@ -60,7 +60,7 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
|
||||
])
|
||||
done
|
||||
if test "x$BDB_LIBS" = "x"; then
|
||||
AC_MSG_ERROR([libdb_cxx missing, Dash Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
|
||||
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
|
||||
fi
|
||||
AC_SUBST(BDB_LIBS)
|
||||
])
|
||||
|
@ -235,7 +235,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
||||
|
||||
|
||||
dnl enable qt support
|
||||
AC_MSG_CHECKING(whether to build Dash Core GUI)
|
||||
AC_MSG_CHECKING(whether to build ]AC_PACKAGE_NAME[ GUI)
|
||||
BITCOIN_QT_CHECK([
|
||||
bitcoin_enable_qt=yes
|
||||
bitcoin_enable_qt_test=yes
|
||||
|
16
configure.ac
16
configure.ac
@ -6,7 +6,9 @@ define(_CLIENT_VERSION_REVISION, 3)
|
||||
define(_CLIENT_VERSION_BUILD, 0)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, false)
|
||||
define(_COPYRIGHT_YEAR, 2017)
|
||||
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/dashpay/dash/issues],[dashcore])
|
||||
define(_COPYRIGHT_HOLDERS,[The %s developers])
|
||||
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[Dash Core])
|
||||
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/dashpay/dash/issues],[dashcore],[https://dash.org/])
|
||||
AC_CONFIG_SRCDIR([src/validation.cpp])
|
||||
AC_CONFIG_HEADERS([src/config/dash-config.h])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
@ -78,6 +80,8 @@ AC_PATH_PROG(HEXDUMP,hexdump)
|
||||
AC_PATH_TOOL(READELF, readelf)
|
||||
AC_PATH_TOOL(CPPFILT, c++filt)
|
||||
|
||||
AC_ARG_VAR(PYTHONPATH, Augments the default search path for python module files)
|
||||
|
||||
dnl pkg-config check.
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
@ -348,6 +352,9 @@ case $host in
|
||||
AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool)
|
||||
AC_PATH_TOOL([OTOOL], [otool], otool)
|
||||
AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage)
|
||||
AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert)
|
||||
AC_PATH_PROGS([IMAGEMAGICK_CONVERT], [convert],convert)
|
||||
AC_PATH_PROGS([TIFFCP], [tiffcp],tiffcp)
|
||||
|
||||
dnl libtool will try to strip the static lib, which is a problem for
|
||||
dnl cross-builds because strip attempts to call a hard-coded ld,
|
||||
@ -1035,12 +1042,19 @@ AC_DEFINE(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION, [Build revision])
|
||||
AC_DEFINE(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD, [Version Build])
|
||||
AC_DEFINE(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE, [Version is release])
|
||||
AC_DEFINE(COPYRIGHT_YEAR, _COPYRIGHT_YEAR, [Version is release])
|
||||
AC_DEFINE(COPYRIGHT_HOLDERS, "_COPYRIGHT_HOLDERS", [Copyright holder(s) before %s replacement])
|
||||
AC_DEFINE(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION", [Replacement for %s in copyright holders string])
|
||||
define(_COPYRIGHT_HOLDERS_FINAL, patsubst(_COPYRIGHT_HOLDERS, [%s], [_COPYRIGHT_HOLDERS_SUBSTITUTION]))
|
||||
AC_DEFINE(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL", [Copyright holder(s)])
|
||||
AC_SUBST(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR)
|
||||
AC_SUBST(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR)
|
||||
AC_SUBST(CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION)
|
||||
AC_SUBST(CLIENT_VERSION_BUILD, _CLIENT_VERSION_BUILD)
|
||||
AC_SUBST(CLIENT_VERSION_IS_RELEASE, _CLIENT_VERSION_IS_RELEASE)
|
||||
AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
|
||||
AC_SUBST(COPYRIGHT_HOLDERS, "_COPYRIGHT_HOLDERS")
|
||||
AC_SUBST(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION")
|
||||
AC_SUBST(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL")
|
||||
|
||||
AC_SUBST(RELDFLAGS)
|
||||
AC_SUBST(HARDENED_CXXFLAGS)
|
||||
|
@ -11,10 +11,10 @@ Repository Tools
|
||||
|
||||
### [Developer tools](/contrib/devtools) ###
|
||||
Specific tools for developers working on this repository.
|
||||
Contains the script `github-merge.sh` for merging github pull requests securely and signing them using GPG.
|
||||
Contains the script `github-merge.py` for merging github pull requests securely and signing them using GPG.
|
||||
|
||||
### [Verify-Commits](/contrib/verify-commits) ###
|
||||
Tool to verify that every merge commit was signed by a developer using the above `github-merge.sh` script.
|
||||
Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script.
|
||||
|
||||
### [Linearize](/contrib/linearize) ###
|
||||
Construct a linear, no-fork, best version of the blockchain.
|
||||
@ -48,9 +48,5 @@ Test and Verify Tools
|
||||
### [TestGen](/contrib/testgen) ###
|
||||
Utilities to generate test vectors for the data-driven Dash tests.
|
||||
|
||||
### [Test Patches](/contrib/test-patches) ###
|
||||
These patches are applied when the automated pull-tester
|
||||
tests each pull and when master is tested using jenkins.
|
||||
|
||||
### [Verify SF Binaries](/contrib/verifysfbinaries) ###
|
||||
This script attempts to download and verify the signature file SHA256SUMS.asc from SourceForge.
|
||||
|
@ -2,11 +2,29 @@ Contents
|
||||
========
|
||||
This directory contains tools for developers working on this repository.
|
||||
|
||||
check-doc.py
|
||||
============
|
||||
|
||||
Check if all command line args are documented. The return value indicates the
|
||||
number of undocumented args.
|
||||
|
||||
clang-format.py
|
||||
===============
|
||||
|
||||
A script to format cpp source code according to [.clang-format](../../src/.clang-format). This should only be applied to new files or files which are currently not actively developed on. Also, git subtrees are not subject to formatting.
|
||||
|
||||
clang-format-diff.py
|
||||
===================
|
||||
|
||||
A script to format unified git diffs according to [.clang-format](../../src/.clang-format).
|
||||
|
||||
For instance, to format the last commit with 0 lines of context,
|
||||
the script should be called from the git root folder as follows.
|
||||
|
||||
```
|
||||
git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v
|
||||
```
|
||||
|
||||
fix-copyright-headers.py
|
||||
========================
|
||||
|
||||
@ -38,14 +56,14 @@ Usage: `git-subtree-check.sh DIR COMMIT`
|
||||
|
||||
`COMMIT` may be omitted, in which case `HEAD` is used.
|
||||
|
||||
github-merge.sh
|
||||
github-merge.py
|
||||
===============
|
||||
|
||||
A small script to automate merging pull-requests securely and sign them with GPG.
|
||||
|
||||
For example:
|
||||
|
||||
./github-merge.sh bitcoin/bitcoin 3077
|
||||
./github-merge.py 3077
|
||||
|
||||
(in any git repository) will help you merge pull request #3077 for the
|
||||
bitcoin/bitcoin repository.
|
||||
|
45
contrib/devtools/check-doc.py
Executable file
45
contrib/devtools/check-doc.py
Executable file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
'''
|
||||
This checks if all command line args are documented.
|
||||
Return value is 0 to indicate no error.
|
||||
|
||||
Author: @MarcoFalke
|
||||
'''
|
||||
|
||||
from subprocess import check_output
|
||||
import re
|
||||
|
||||
FOLDER_GREP = 'src'
|
||||
FOLDER_TEST = 'src/test/'
|
||||
CMD_ROOT_DIR = '`git rev-parse --show-toplevel`/%s' % FOLDER_GREP
|
||||
CMD_GREP_ARGS = r"egrep -r -I '(map(Multi)?Args(\.count\(|\[)|Get(Bool)?Arg\()\"\-[^\"]+?\"' %s | grep -v '%s'" % (CMD_ROOT_DIR, FOLDER_TEST)
|
||||
CMD_GREP_DOCS = r"egrep -r -I 'HelpMessageOpt\(\"\-[^\"=]+?(=|\")' %s" % (CMD_ROOT_DIR)
|
||||
REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"')
|
||||
REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")')
|
||||
# list unsupported, deprecated and duplicate args as they need no documentation
|
||||
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay'])
|
||||
|
||||
def main():
|
||||
used = check_output(CMD_GREP_ARGS, shell=True)
|
||||
docd = check_output(CMD_GREP_DOCS, shell=True)
|
||||
|
||||
args_used = set(re.findall(REGEX_ARG,used))
|
||||
args_docd = set(re.findall(REGEX_DOC,docd)).union(SET_DOC_OPTIONAL)
|
||||
args_need_doc = args_used.difference(args_docd)
|
||||
args_unknown = args_docd.difference(args_used)
|
||||
|
||||
print "Args used : %s" % len(args_used)
|
||||
print "Args documented : %s" % len(args_docd)
|
||||
print "Args undocumented: %s" % len(args_need_doc)
|
||||
print args_need_doc
|
||||
print "Args unknown : %s" % len(args_unknown)
|
||||
print args_unknown
|
||||
|
||||
exit(len(args_need_doc))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
164
contrib/devtools/clang-format-diff.py
Executable file
164
contrib/devtools/clang-format-diff.py
Executable file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License.
|
||||
#
|
||||
# ============================================================
|
||||
#
|
||||
# University of Illinois/NCSA
|
||||
# Open Source License
|
||||
#
|
||||
# Copyright (c) 2007-2015 University of Illinois at Urbana-Champaign.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Developed by:
|
||||
#
|
||||
# LLVM Team
|
||||
#
|
||||
# University of Illinois at Urbana-Champaign
|
||||
#
|
||||
# http://llvm.org
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal with
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
# of the Software, and to permit persons to whom the Software is furnished to do
|
||||
# so, subject to the following conditions:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimers.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimers in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of the LLVM Team, University of Illinois at
|
||||
# Urbana-Champaign, nor the names of its contributors may be used to
|
||||
# endorse or promote products derived from this Software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# ============================================================
|
||||
#
|
||||
#===------------------------------------------------------------------------===#
|
||||
|
||||
r"""
|
||||
ClangFormat Diff Reformatter
|
||||
============================
|
||||
|
||||
This script reads input from a unified diff and reformats all the changed
|
||||
lines. This is useful to reformat all the lines touched by a specific patch.
|
||||
Example usage for git/svn users:
|
||||
|
||||
git diff -U0 HEAD^ | clang-format-diff.py -p1 -i
|
||||
svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
|
||||
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import difflib
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
import StringIO
|
||||
import sys
|
||||
|
||||
|
||||
# Change this to the full path if clang-format is not on the path.
|
||||
binary = 'clang-format'
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=
|
||||
'Reformat changed lines in diff. Without -i '
|
||||
'option just output the diff that would be '
|
||||
'introduced.')
|
||||
parser.add_argument('-i', action='store_true', default=False,
|
||||
help='apply edits to files instead of displaying a diff')
|
||||
parser.add_argument('-p', metavar='NUM', default=0,
|
||||
help='strip the smallest prefix containing P slashes')
|
||||
parser.add_argument('-regex', metavar='PATTERN', default=None,
|
||||
help='custom pattern selecting file paths to reformat '
|
||||
'(case sensitive, overrides -iregex)')
|
||||
parser.add_argument('-iregex', metavar='PATTERN', default=
|
||||
r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc|js|ts|proto'
|
||||
r'|protodevel|java)',
|
||||
help='custom pattern selecting file paths to reformat '
|
||||
'(case insensitive, overridden by -regex)')
|
||||
parser.add_argument('-sort-includes', action='store_true', default=False,
|
||||
help='let clang-format sort include blocks')
|
||||
parser.add_argument('-v', '--verbose', action='store_true',
|
||||
help='be more verbose, ineffective without -i')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Extract changed lines for each file.
|
||||
filename = None
|
||||
lines_by_file = {}
|
||||
for line in sys.stdin:
|
||||
match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
|
||||
if match:
|
||||
filename = match.group(2)
|
||||
if filename == None:
|
||||
continue
|
||||
|
||||
if args.regex is not None:
|
||||
if not re.match('^%s$' % args.regex, filename):
|
||||
continue
|
||||
else:
|
||||
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
|
||||
continue
|
||||
|
||||
match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
|
||||
if match:
|
||||
start_line = int(match.group(1))
|
||||
line_count = 1
|
||||
if match.group(3):
|
||||
line_count = int(match.group(3))
|
||||
if line_count == 0:
|
||||
continue
|
||||
end_line = start_line + line_count - 1;
|
||||
lines_by_file.setdefault(filename, []).extend(
|
||||
['-lines', str(start_line) + ':' + str(end_line)])
|
||||
|
||||
# Reformat files containing changes in place.
|
||||
for filename, lines in lines_by_file.iteritems():
|
||||
if args.i and args.verbose:
|
||||
print 'Formatting', filename
|
||||
command = [binary, filename]
|
||||
if args.i:
|
||||
command.append('-i')
|
||||
if args.sort_includes:
|
||||
command.append('-sort-includes')
|
||||
command.extend(lines)
|
||||
command.extend(['-style=file', '-fallback-style=none'])
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||
stderr=None, stdin=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode != 0:
|
||||
sys.exit(p.returncode);
|
||||
|
||||
if not args.i:
|
||||
with open(filename) as f:
|
||||
code = f.readlines()
|
||||
formatted_code = StringIO.StringIO(stdout).readlines()
|
||||
diff = difflib.unified_diff(code, formatted_code,
|
||||
filename, filename,
|
||||
'(before formatting)', '(after formatting)')
|
||||
diff_string = string.join(diff, '')
|
||||
if len(diff_string) > 0:
|
||||
sys.stdout.write(diff_string)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
235
contrib/devtools/github-merge.py
Executable file
235
contrib/devtools/github-merge.py
Executable file
@ -0,0 +1,235 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2016 Bitcoin Core Developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# This script will locally construct a merge commit for a pull request on a
|
||||
# github repository, inspect it, sign it and optionally push it.
|
||||
|
||||
# The following temporary branches are created/overwritten and deleted:
|
||||
# * pull/$PULL/base (the current master we're merging onto)
|
||||
# * pull/$PULL/head (the current state of the remote pull request)
|
||||
# * pull/$PULL/merge (github's merge)
|
||||
# * pull/$PULL/local-merge (our merge)
|
||||
|
||||
# In case of a clean merge that is accepted by the user, the local branch with
|
||||
# name $BRANCH is overwritten with the merged result, and optionally pushed.
|
||||
from __future__ import division,print_function,unicode_literals
|
||||
import os,sys
|
||||
from sys import stdin,stdout,stderr
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
# External tools (can be overridden using environment)
|
||||
GIT = os.getenv('GIT','git')
|
||||
BASH = os.getenv('BASH','bash')
|
||||
|
||||
# OS specific configuration for terminal attributes
|
||||
ATTR_RESET = ''
|
||||
ATTR_PR = ''
|
||||
COMMIT_FORMAT = '%h %s (%an)%d'
|
||||
if os.name == 'posix': # if posix, assume we can use basic terminal escapes
|
||||
ATTR_RESET = '\033[0m'
|
||||
ATTR_PR = '\033[1;36m'
|
||||
COMMIT_FORMAT = '%C(bold blue)%h%Creset %s %C(cyan)(%an)%Creset%C(green)%d%Creset'
|
||||
|
||||
def git_config_get(option, default=None):
|
||||
'''
|
||||
Get named configuration option from git repository.
|
||||
'''
|
||||
try:
|
||||
return subprocess.check_output([GIT,'config','--get',option]).rstrip()
|
||||
except subprocess.CalledProcessError as e:
|
||||
return default
|
||||
|
||||
def retrieve_pr_title(repo,pull):
|
||||
'''
|
||||
Retrieve pull request title from github.
|
||||
Return None if no title can be found, or an error happens.
|
||||
'''
|
||||
import urllib2,json
|
||||
try:
|
||||
req = urllib2.Request("https://api.github.com/repos/"+repo+"/pulls/"+pull)
|
||||
result = urllib2.urlopen(req)
|
||||
result = json.load(result)
|
||||
return result['title']
|
||||
except Exception as e:
|
||||
print('Warning: unable to retrieve pull title from github: %s' % e)
|
||||
return None
|
||||
|
||||
def ask_prompt(text):
|
||||
print(text,end=" ",file=stderr)
|
||||
reply = stdin.readline().rstrip()
|
||||
print("",file=stderr)
|
||||
return reply
|
||||
|
||||
def parse_arguments(branch):
|
||||
epilog = '''
|
||||
In addition, you can set the following git configuration variables:
|
||||
githubmerge.repository (mandatory),
|
||||
user.signingkey (mandatory),
|
||||
githubmerge.host (default: git@github.com),
|
||||
githubmerge.branch (default: master),
|
||||
githubmerge.testcmd (default: none).
|
||||
'''
|
||||
parser = argparse.ArgumentParser(description='Utility to merge, sign and push github pull requests',
|
||||
epilog=epilog)
|
||||
parser.add_argument('pull', metavar='PULL', type=int, nargs=1,
|
||||
help='Pull request ID to merge')
|
||||
parser.add_argument('branch', metavar='BRANCH', type=str, nargs='?',
|
||||
default=branch, help='Branch to merge against (default: '+branch+')')
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
# Extract settings from git repo
|
||||
repo = git_config_get('githubmerge.repository')
|
||||
host = git_config_get('githubmerge.host','git@github.com')
|
||||
branch = git_config_get('githubmerge.branch','master')
|
||||
testcmd = git_config_get('githubmerge.testcmd')
|
||||
signingkey = git_config_get('user.signingkey')
|
||||
if repo is None:
|
||||
print("ERROR: No repository configured. Use this command to set:", file=stderr)
|
||||
print("git config githubmerge.repository <owner>/<repo>", file=stderr)
|
||||
exit(1)
|
||||
if signingkey is None:
|
||||
print("ERROR: No GPG signing key set. Set one using:",file=stderr)
|
||||
print("git config --global user.signingkey <key>",file=stderr)
|
||||
exit(1)
|
||||
|
||||
host_repo = host+":"+repo # shortcut for push/pull target
|
||||
|
||||
# Extract settings from command line
|
||||
args = parse_arguments(branch)
|
||||
pull = str(args.pull[0])
|
||||
branch = args.branch
|
||||
|
||||
# Initialize source branches
|
||||
head_branch = 'pull/'+pull+'/head'
|
||||
base_branch = 'pull/'+pull+'/base'
|
||||
merge_branch = 'pull/'+pull+'/merge'
|
||||
local_merge_branch = 'pull/'+pull+'/local-merge'
|
||||
|
||||
devnull = open(os.devnull,'w')
|
||||
try:
|
||||
subprocess.check_call([GIT,'checkout','-q',branch])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: Cannot check out branch %s." % (branch), file=stderr)
|
||||
exit(3)
|
||||
try:
|
||||
subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/pull/'+pull+'/*:refs/heads/pull/'+pull+'/*'])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: Cannot find pull request #%s on %s." % (pull,host_repo), file=stderr)
|
||||
exit(3)
|
||||
try:
|
||||
subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+head_branch], stdout=devnull, stderr=stdout)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: Cannot find head of pull request #%s on %s." % (pull,host_repo), file=stderr)
|
||||
exit(3)
|
||||
try:
|
||||
subprocess.check_call([GIT,'log','-q','-1','refs/heads/'+merge_branch], stdout=devnull, stderr=stdout)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: Cannot find merge of pull request #%s on %s." % (pull,host_repo), file=stderr)
|
||||
exit(3)
|
||||
try:
|
||||
subprocess.check_call([GIT,'fetch','-q',host_repo,'+refs/heads/'+branch+':refs/heads/'+base_branch])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: Cannot find branch %s on %s." % (branch,host_repo), file=stderr)
|
||||
exit(3)
|
||||
subprocess.check_call([GIT,'checkout','-q',base_branch])
|
||||
subprocess.call([GIT,'branch','-q','-D',local_merge_branch], stderr=devnull)
|
||||
subprocess.check_call([GIT,'checkout','-q','-b',local_merge_branch])
|
||||
|
||||
try:
|
||||
# Create unsigned merge commit.
|
||||
title = retrieve_pr_title(repo,pull)
|
||||
if title:
|
||||
firstline = 'Merge #%s: %s' % (pull,title)
|
||||
else:
|
||||
firstline = 'Merge #%s' % (pull,)
|
||||
message = firstline + '\n\n'
|
||||
message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%h %s (%an)',base_branch+'..'+head_branch]).decode('utf-8')
|
||||
try:
|
||||
subprocess.check_call([GIT,'merge','-q','--commit','--no-edit','--no-ff','-m',message.encode('utf-8'),head_branch])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: Cannot be merged cleanly.",file=stderr)
|
||||
subprocess.check_call([GIT,'merge','--abort'])
|
||||
exit(4)
|
||||
logmsg = subprocess.check_output([GIT,'log','--pretty=format:%s','-n','1']).decode('utf-8')
|
||||
if logmsg.rstrip() != firstline.rstrip():
|
||||
print("ERROR: Creating merge failed (already merged?).",file=stderr)
|
||||
exit(4)
|
||||
|
||||
print('%s#%s%s %s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title))
|
||||
subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch])
|
||||
print()
|
||||
# Run test command if configured.
|
||||
if testcmd:
|
||||
# Go up to the repository's root.
|
||||
toplevel = subprocess.check_output([GIT,'rev-parse','--show-toplevel']).strip()
|
||||
os.chdir(toplevel)
|
||||
if subprocess.call(testcmd,shell=True):
|
||||
print("ERROR: Running %s failed." % testcmd,file=stderr)
|
||||
exit(5)
|
||||
|
||||
# Show the created merge.
|
||||
diff = subprocess.check_output([GIT,'diff',merge_branch+'..'+local_merge_branch])
|
||||
subprocess.check_call([GIT,'diff',base_branch+'..'+local_merge_branch])
|
||||
if diff:
|
||||
print("WARNING: merge differs from github!",file=stderr)
|
||||
reply = ask_prompt("Type 'ignore' to continue.")
|
||||
if reply.lower() == 'ignore':
|
||||
print("Difference with github ignored.",file=stderr)
|
||||
else:
|
||||
exit(6)
|
||||
reply = ask_prompt("Press 'd' to accept the diff.")
|
||||
if reply.lower() == 'd':
|
||||
print("Diff accepted.",file=stderr)
|
||||
else:
|
||||
print("ERROR: Diff rejected.",file=stderr)
|
||||
exit(6)
|
||||
else:
|
||||
# Verify the result manually.
|
||||
print("Dropping you on a shell so you can try building/testing the merged source.",file=stderr)
|
||||
print("Run 'git diff HEAD~' to show the changes being merged.",file=stderr)
|
||||
print("Type 'exit' when done.",file=stderr)
|
||||
if os.path.isfile('/etc/debian_version'): # Show pull number on Debian default prompt
|
||||
os.putenv('debian_chroot',pull)
|
||||
subprocess.call([BASH,'-i'])
|
||||
reply = ask_prompt("Type 'm' to accept the merge.")
|
||||
if reply.lower() == 'm':
|
||||
print("Merge accepted.",file=stderr)
|
||||
else:
|
||||
print("ERROR: Merge rejected.",file=stderr)
|
||||
exit(7)
|
||||
|
||||
# Sign the merge commit.
|
||||
reply = ask_prompt("Type 's' to sign off on the merge.")
|
||||
if reply == 's':
|
||||
try:
|
||||
subprocess.check_call([GIT,'commit','-q','--gpg-sign','--amend','--no-edit'])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("Error signing, exiting.",file=stderr)
|
||||
exit(1)
|
||||
else:
|
||||
print("Not signing off on merge, exiting.",file=stderr)
|
||||
exit(1)
|
||||
|
||||
# Put the result in branch.
|
||||
subprocess.check_call([GIT,'checkout','-q',branch])
|
||||
subprocess.check_call([GIT,'reset','-q','--hard',local_merge_branch])
|
||||
finally:
|
||||
# Clean up temporary branches.
|
||||
subprocess.call([GIT,'checkout','-q',branch])
|
||||
subprocess.call([GIT,'branch','-q','-D',head_branch],stderr=devnull)
|
||||
subprocess.call([GIT,'branch','-q','-D',base_branch],stderr=devnull)
|
||||
subprocess.call([GIT,'branch','-q','-D',merge_branch],stderr=devnull)
|
||||
subprocess.call([GIT,'branch','-q','-D',local_merge_branch],stderr=devnull)
|
||||
|
||||
# Push the result.
|
||||
reply = ask_prompt("Type 'push' to push the result to %s, branch %s." % (host_repo,branch))
|
||||
if reply.lower() == 'push':
|
||||
subprocess.check_call([GIT,'push',host_repo,'refs/heads/'+branch])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -1,185 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script will locally construct a merge commit for a pull request on a
|
||||
# github repository, inspect it, sign it and optionally push it.
|
||||
|
||||
# The following temporary branches are created/overwritten and deleted:
|
||||
# * pull/$PULL/base (the current master we're merging onto)
|
||||
# * pull/$PULL/head (the current state of the remote pull request)
|
||||
# * pull/$PULL/merge (github's merge)
|
||||
# * pull/$PULL/local-merge (our merge)
|
||||
|
||||
# In case of a clean merge that is accepted by the user, the local branch with
|
||||
# name $BRANCH is overwritten with the merged result, and optionally pushed.
|
||||
|
||||
REPO="$(git config --get githubmerge.repository)"
|
||||
if [[ "d$REPO" == "d" ]]; then
|
||||
echo "ERROR: No repository configured. Use this command to set:" >&2
|
||||
echo "git config githubmerge.repository <owner>/<repo>" >&2
|
||||
echo "In addition, you can set the following variables:" >&2
|
||||
echo "- githubmerge.host (default git@github.com)" >&2
|
||||
echo "- githubmerge.branch (default master)" >&2
|
||||
echo "- githubmerge.testcmd (default none)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOST="$(git config --get githubmerge.host)"
|
||||
if [[ "d$HOST" == "d" ]]; then
|
||||
HOST="git@github.com"
|
||||
fi
|
||||
|
||||
BRANCH="$(git config --get githubmerge.branch)"
|
||||
if [[ "d$BRANCH" == "d" ]]; then
|
||||
BRANCH="master"
|
||||
fi
|
||||
|
||||
TESTCMD="$(git config --get githubmerge.testcmd)"
|
||||
|
||||
PULL="$1"
|
||||
|
||||
if [[ "d$PULL" == "d" ]]; then
|
||||
echo "Usage: $0 pullnumber [branch]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ "d$2" != "d" ]]; then
|
||||
BRANCH="$2"
|
||||
fi
|
||||
|
||||
# Initialize source branches.
|
||||
git checkout -q "$BRANCH"
|
||||
if git fetch -q "$HOST":"$REPO" "+refs/pull/$PULL/*:refs/heads/pull/$PULL/*"; then
|
||||
if ! git log -q -1 "refs/heads/pull/$PULL/head" >/dev/null 2>&1; then
|
||||
echo "ERROR: Cannot find head of pull request #$PULL on $HOST:$REPO." >&2
|
||||
exit 3
|
||||
fi
|
||||
if ! git log -q -1 "refs/heads/pull/$PULL/merge" >/dev/null 2>&1; then
|
||||
echo "ERROR: Cannot find merge of pull request #$PULL on $HOST:$REPO." >&2
|
||||
exit 3
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Cannot find pull request #$PULL on $HOST:$REPO." >&2
|
||||
exit 3
|
||||
fi
|
||||
if git fetch -q "$HOST":"$REPO" +refs/heads/"$BRANCH":refs/heads/pull/"$PULL"/base; then
|
||||
true
|
||||
else
|
||||
echo "ERROR: Cannot find branch $BRANCH on $HOST:$REPO." >&2
|
||||
exit 3
|
||||
fi
|
||||
git checkout -q pull/"$PULL"/base
|
||||
git branch -q -D pull/"$PULL"/local-merge 2>/dev/null
|
||||
git checkout -q -b pull/"$PULL"/local-merge
|
||||
TMPDIR="$(mktemp -d -t ghmXXXXX)"
|
||||
|
||||
function cleanup() {
|
||||
git checkout -q "$BRANCH"
|
||||
git branch -q -D pull/"$PULL"/head 2>/dev/null
|
||||
git branch -q -D pull/"$PULL"/base 2>/dev/null
|
||||
git branch -q -D pull/"$PULL"/merge 2>/dev/null
|
||||
git branch -q -D pull/"$PULL"/local-merge 2>/dev/null
|
||||
rm -rf "$TMPDIR"
|
||||
}
|
||||
|
||||
# Create unsigned merge commit.
|
||||
(
|
||||
echo "Merge pull request #$PULL"
|
||||
echo ""
|
||||
git log --no-merges --topo-order --pretty='format:%h %s (%an)' pull/"$PULL"/base..pull/"$PULL"/head
|
||||
)>"$TMPDIR/message"
|
||||
if git merge -q --commit --no-edit --no-ff -m "$(<"$TMPDIR/message")" pull/"$PULL"/head; then
|
||||
if [ "d$(git log --pretty='format:%s' -n 1)" != "dMerge pull request #$PULL" ]; then
|
||||
echo "ERROR: Creating merge failed (already merged?)." >&2
|
||||
cleanup
|
||||
exit 4
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Cannot be merged cleanly." >&2
|
||||
git merge --abort
|
||||
cleanup
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# Run test command if configured.
|
||||
if [[ "d$TESTCMD" != "d" ]]; then
|
||||
# Go up to the repository's root.
|
||||
while [ ! -d .git ]; do cd ..; done
|
||||
if ! $TESTCMD; then
|
||||
echo "ERROR: Running $TESTCMD failed." >&2
|
||||
cleanup
|
||||
exit 5
|
||||
fi
|
||||
# Show the created merge.
|
||||
git diff pull/"$PULL"/merge..pull/"$PULL"/local-merge >"$TMPDIR"/diff
|
||||
git diff pull/"$PULL"/base..pull/"$PULL"/local-merge
|
||||
if [[ "$(<"$TMPDIR"/diff)" != "" ]]; then
|
||||
echo "WARNING: merge differs from github!" >&2
|
||||
read -p "Type 'ignore' to continue. " -r >&2
|
||||
if [[ "d$REPLY" =~ ^d[iI][gG][nN][oO][rR][eE]$ ]]; then
|
||||
echo "Difference with github ignored." >&2
|
||||
else
|
||||
cleanup
|
||||
exit 6
|
||||
fi
|
||||
fi
|
||||
read -p "Press 'd' to accept the diff. " -n 1 -r >&2
|
||||
echo
|
||||
if [[ "d$REPLY" =~ ^d[dD]$ ]]; then
|
||||
echo "Diff accepted." >&2
|
||||
else
|
||||
echo "ERROR: Diff rejected." >&2
|
||||
cleanup
|
||||
exit 6
|
||||
fi
|
||||
else
|
||||
# Verify the result.
|
||||
echo "Dropping you on a shell so you can try building/testing the merged source." >&2
|
||||
echo "Run 'git diff HEAD~' to show the changes being merged." >&2
|
||||
echo "Type 'exit' when done." >&2
|
||||
if [[ -f /etc/debian_version ]]; then # Show pull number in prompt on Debian default prompt
|
||||
export debian_chroot="$PULL"
|
||||
fi
|
||||
bash -i
|
||||
read -p "Press 'm' to accept the merge. " -n 1 -r >&2
|
||||
echo
|
||||
if [[ "d$REPLY" =~ ^d[Mm]$ ]]; then
|
||||
echo "Merge accepted." >&2
|
||||
else
|
||||
echo "ERROR: Merge rejected." >&2
|
||||
cleanup
|
||||
exit 7
|
||||
fi
|
||||
fi
|
||||
|
||||
# Sign the merge commit.
|
||||
read -p "Press 's' to sign off on the merge. " -n 1 -r >&2
|
||||
echo
|
||||
if [[ "d$REPLY" =~ ^d[Ss]$ ]]; then
|
||||
if [[ "$(git config --get user.signingkey)" == "" ]]; then
|
||||
echo "ERROR: No GPG signing key set, not signing. Set one using:" >&2
|
||||
echo "git config --global user.signingkey <key>" >&2
|
||||
cleanup
|
||||
exit 1
|
||||
else
|
||||
if ! git commit -q --gpg-sign --amend --no-edit; then
|
||||
echo "Error signing, exiting."
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Not signing off on merge, exiting."
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up temporary branches, and put the result in $BRANCH.
|
||||
git checkout -q "$BRANCH"
|
||||
git reset -q --hard pull/"$PULL"/local-merge
|
||||
cleanup
|
||||
|
||||
# Push the result.
|
||||
read -p "Type 'push' to push the result to $HOST:$REPO, branch $BRANCH. " -r >&2
|
||||
if [[ "d$REPLY" =~ ^d[Pp][Uu][Ss][Hh]$ ]]; then
|
||||
git push "$HOST":"$REPO" refs/heads/"$BRANCH"
|
||||
fi
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python2
|
||||
'''
|
||||
Perform basic ELF security checks on a series of executables.
|
||||
Exit status will be 0 if succesful, and the program will be silent.
|
||||
Exit status will be 0 if successful, and the program will be silent.
|
||||
Otherwise the exit status will be 1 and it will log which executables failed which checks.
|
||||
Needs `readelf` (for ELF) and `objdump` (for PE).
|
||||
'''
|
||||
|
@ -32,6 +32,7 @@ script: |
|
||||
SIGNED=dash-osx-signed.dmg
|
||||
|
||||
tar -xf ${UNSIGNED}
|
||||
OSX_VOLNAME="$(cat osx_volname)"
|
||||
./detached-sig-apply.sh ${UNSIGNED} signature/osx
|
||||
${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "Dash-Core" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app
|
||||
${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "${OSX_VOLNAME}" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app
|
||||
${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}
|
||||
|
@ -6,21 +6,27 @@ suites:
|
||||
architectures:
|
||||
- "amd64"
|
||||
packages:
|
||||
- "ca-certificates"
|
||||
- "curl"
|
||||
- "g++"
|
||||
- "git-core"
|
||||
- "pkg-config"
|
||||
- "autoconf"
|
||||
- "librsvg2-bin"
|
||||
- "libtiff-tools"
|
||||
- "libtool"
|
||||
- "automake"
|
||||
- "faketime"
|
||||
- "bsdmainutils"
|
||||
- "cmake"
|
||||
- "imagemagick"
|
||||
- "libcap-dev"
|
||||
- "libz-dev"
|
||||
- "libbz2-dev"
|
||||
- "ca-certificates"
|
||||
- "python"
|
||||
- "python-dev"
|
||||
- "python-setuptools"
|
||||
- "fonts-tuffy"
|
||||
reference_datetime: "2017-01-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/dashpay/dash.git"
|
||||
@ -110,8 +116,11 @@ script: |
|
||||
make ${MAKEOPTS}
|
||||
make install-strip DESTDIR=${INSTALLPATH}
|
||||
|
||||
make osx_volname
|
||||
make deploydir
|
||||
OSX_VOLNAME="$(cat osx_volname)"
|
||||
mkdir -p unsigned-app-${i}
|
||||
cp osx_volname unsigned-app-${i}/
|
||||
cp contrib/macdeploy/detached-sig-apply.sh unsigned-app-${i}
|
||||
cp contrib/macdeploy/detached-sig-create.sh unsigned-app-${i}
|
||||
cp ${BASEPREFIX}/${i}/native/bin/dmg ${BASEPREFIX}/${i}/native/bin/genisoimage unsigned-app-${i}
|
||||
@ -123,7 +132,7 @@ script: |
|
||||
popd
|
||||
|
||||
make deploy
|
||||
${WRAP_DIR}/dmg dmg Dash-Core.dmg ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
|
||||
${WRAP_DIR}/dmg dmg "${OSX_VOLNAME}.dmg" ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
|
||||
|
||||
cd installed
|
||||
find . -name "lib*.la" -delete
|
||||
|
@ -1 +0,0 @@
|
||||
{ CFBundleDisplayName = "Dash Core"; CFBundleName = "Dash Core"; }
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
Binary file not shown.
34
contrib/macdeploy/background.svg
Normal file
34
contrib/macdeploy/background.svg
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1000pt" height="640pt" viewBox="0 0 1000 640" preserveAspectRatio="xMidYMid meet">
|
||||
<!-- kate: space-indent off;
|
||||
Copyright (c) 2015 The Bitcoin Core developers
|
||||
Distributed under the MIT software license, see the accompanying
|
||||
file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
-->
|
||||
<style type="text/css"><![CDATA[
|
||||
text {
|
||||
font-family: "Tuffy";
|
||||
font-size: 86px;
|
||||
fill: gray;
|
||||
text-anchor: middle;
|
||||
}
|
||||
]]></style>
|
||||
<defs>
|
||||
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:rgb(239,239,239);stop-opacity:1" />
|
||||
<stop offset="33%" style="stop-color:rgb(239,239,239);stop-opacity:1" />
|
||||
<stop offset="80%" style="stop-color:rgb(205,205,205);stop-opacity:1" />
|
||||
<stop offset="100%" style="stop-color:rgb(204,204,204);stop-opacity:1" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="1000" height="640" style="fill:url(#gradient);stroke-width:0" />
|
||||
<g transform="translate(500,0) scale(0.9, 1)">
|
||||
<text x="0" y="114">PACKAGE_NAME</text>
|
||||
</g>
|
||||
<g transform="translate(0.000000,640.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M4995 3705 c-24 -23 -25 -29 -25 -165 l0 -140 -306 0 -306 0 -29 -29 c-29 -29 -29 -31 -29 -141 0 -110 0 -112 29 -141 l29 -29 306 0 306 0 0 -140 c0 -136 1 -142 25 -165 16 -17 35 -25 57 -25 29 0 72 32 306 226 180 149 274 233 278 250 13 53 -2 70 -278 299 -235 194 -277 225 -306 225 -22 0 -41 -8 -57 -25z" fixlter="url(#glow)"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 136 KiB |
60
contrib/macdeploy/custom_dsstore.py
Executable file
60
contrib/macdeploy/custom_dsstore.py
Executable file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
import biplist
|
||||
from ds_store import DSStore
|
||||
from mac_alias import Alias
|
||||
import sys
|
||||
|
||||
output_file = sys.argv[1]
|
||||
package_name_ns = sys.argv[2]
|
||||
|
||||
ds = DSStore.open(output_file, 'w+')
|
||||
ds['.']['bwsp'] = {
|
||||
'ShowStatusBar': False,
|
||||
'WindowBounds': '{{300, 280}, {500, 343}}',
|
||||
'ContainerShowSidebar': False,
|
||||
'SidebarWidth': 0,
|
||||
'ShowTabView': False,
|
||||
'PreviewPaneVisibility': False,
|
||||
'ShowToolbar': False,
|
||||
'ShowSidebar': False,
|
||||
'ShowPathbar': True
|
||||
}
|
||||
|
||||
icvp = {
|
||||
'gridOffsetX': 0.0,
|
||||
'textSize': 12.0,
|
||||
'viewOptionsVersion': 1,
|
||||
'backgroundImageAlias': '\x00\x00\x00\x00\x02\x1e\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x94\\\xb0H+\x00\x05\x00\x00\x00\x98\x0fbackground.tiff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\xd19\xb0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\r\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b.background\x00\x00\x10\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x11\x00\x08\x00\x00\xd19\xb0\xf8\x00\x00\x00\x01\x00\x04\x00\x00\x00\x98\x00\x0e\x00 \x00\x0f\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00.\x00t\x00i\x00f\x00f\x00\x0f\x00\x02\x00\x00\x00\x12\x00\x1c/.background/background.tiff\x00\x14\x01\x06\x00\x00\x00\x00\x01\x06\x00\x02\x00\x00\x0cMacintosh HD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x97\xab\xc3H+\x00\x00\x01\x88[\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02u\xab\x8d\xd1\x94\\\xb0devrddsk\xff\xff\xff\xff\x00\x00\t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07bitcoin\x00\x00\x10\x00\x08\x00\x00\xce\x97\xab\xc3\x00\x00\x00\x11\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x01\x00\x14\x01\x88[\x88\x00\x16\xa9\t\x00\x08\xfaR\x00\x08\xfaQ\x00\x02d\x8e\x00\x0e\x00\x02\x00\x00\x00\x0f\x00\x1a\x00\x0c\x00M\x00a\x00c\x00i\x00n\x00t\x00o\x00s\x00h\x00 \x00H\x00D\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\x14\xff\xff\x00\x00\xff\xff\x00\x00',
|
||||
'backgroundColorBlue': 1.0,
|
||||
'iconSize': 96.0,
|
||||
'backgroundColorGreen': 1.0,
|
||||
'arrangeBy': 'none',
|
||||
'showIconPreview': True,
|
||||
'gridSpacing': 100.0,
|
||||
'gridOffsetY': 0.0,
|
||||
'showItemInfo': False,
|
||||
'labelOnBottom': True,
|
||||
'backgroundType': 2,
|
||||
'backgroundColorRed': 1.0
|
||||
}
|
||||
alias = Alias.from_bytes(icvp['backgroundImageAlias'])
|
||||
alias.volume.name = package_name_ns
|
||||
alias.volume.posix_path = '/Volumes/' + package_name_ns
|
||||
alias.volume.disk_image_alias.target.filename = package_name_ns + '.temp.dmg'
|
||||
alias.volume.disk_image_alias.target.carbon_path = 'Macintosh HD:Users:\x00dashcoreuser:\x00Documents:\x00dashcore:\x00dashcore:\x00' + package_name_ns + '.temp.dmg'
|
||||
alias.volume.disk_image_alias.target.posix_path = 'Users/dashcoreuser/Documents/dashcore/dashcore/' + package_name_ns + '.temp.dmg'
|
||||
alias.target.carbon_path = package_name_ns + ':.background:\x00background.tiff'
|
||||
icvp['backgroundImageAlias'] = biplist.Data(alias.to_bytes())
|
||||
ds['.']['icvp'] = icvp
|
||||
|
||||
ds['.']['vSrn'] = ('long', 1)
|
||||
|
||||
ds['Applications']['Iloc'] = (370, 156)
|
||||
ds['Dash-Qt.app']['Iloc'] = (128, 156)
|
||||
|
||||
ds.flush()
|
||||
ds.close()
|
@ -495,6 +495,7 @@ ap.add_argument("-fancy", nargs=1, metavar="plist", default=[], help="make a fan
|
||||
ap.add_argument("-add-qt-tr", nargs=1, metavar="languages", default=[], help="add Qt translation files to the bundle's ressources; the language list must be separated with commas, not with whitespace")
|
||||
ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translation files")
|
||||
ap.add_argument("-add-resources", nargs="+", metavar="path", default=[], help="list of additional files or folders to be copied into the bundle's resources; must be the last argument")
|
||||
ap.add_argument("-volname", nargs=1, metavar="volname", default=[], help="custom volume name for dmg")
|
||||
|
||||
config = ap.parse_args()
|
||||
|
||||
@ -596,6 +597,13 @@ if os.path.exists("dist"):
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if len(config.volname) == 1:
|
||||
volname = config.volname[0]
|
||||
else:
|
||||
volname = app_bundle_name
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
target = os.path.join("dist", "Dash-Qt.app")
|
||||
|
||||
if verbose >= 2:
|
||||
@ -757,7 +765,7 @@ if config.dmg is not None:
|
||||
|
||||
if fancy is None:
|
||||
try:
|
||||
runHDIUtil("create", dmg_name, srcfolder="dist", format="UDBZ", volname="Dash-Core", ov=True)
|
||||
runHDIUtil("create", dmg_name, srcfolder="dist", format="UDBZ", volname=volname, ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
else:
|
||||
@ -772,7 +780,7 @@ if config.dmg is not None:
|
||||
if verbose >= 3:
|
||||
print "Creating temp image for modification..."
|
||||
try:
|
||||
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname="Dash-Core", ov=True)
|
||||
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname=volname, ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
|
||||
@ -837,7 +845,7 @@ if config.dmg is not None:
|
||||
items_positions.append(itemscript.substitute(params))
|
||||
|
||||
params = {
|
||||
"disk" : "Dash-Core",
|
||||
"disk" : volname,
|
||||
"window_bounds" : "300,300,800,620",
|
||||
"icon_size" : "96",
|
||||
"background_commands" : "",
|
||||
|
@ -7,7 +7,7 @@ build_darwin_OTOOL: = $(shell xcrun -f otool)
|
||||
build_darwin_NM: = $(shell xcrun -f nm)
|
||||
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
|
||||
build_darwin_SHA256SUM = shasum -a 256
|
||||
build_darwin_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -o
|
||||
build_darwin_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
|
||||
|
||||
#darwin host on darwin builder. overrides darwin host preferences.
|
||||
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION)
|
||||
|
@ -1,2 +1,2 @@
|
||||
build_linux_SHA256SUM = sha256sum
|
||||
build_linux_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -o
|
||||
build_linux_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
|
||||
|
@ -67,7 +67,6 @@ CC="@CC@"
|
||||
CXX="@CXX@"
|
||||
OBJC="${CC}"
|
||||
OBJCXX="${CXX}"
|
||||
CCACHE=$prefix/native/bin/ccache
|
||||
CCACHE=$depends_prefix/native/bin/ccache
|
||||
PYTHONPATH=$depends_prefix/native/lib/python/dist-packages:$PYTHONPATH
|
||||
|
||||
|
20
depends/packages/native_biplist.mk
Normal file
20
depends/packages/native_biplist.mk
Normal file
@ -0,0 +1,20 @@
|
||||
package=native_biplist
|
||||
$(package)_version=0.9
|
||||
$(package)_download_path=https://pypi.python.org/packages/source/b/biplist
|
||||
$(package)_file_name=biplist-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=b57cadfd26e4754efdf89e9e37de87885f9b5c847b2615688ca04adfaf6ca604
|
||||
$(package)_install_libdir=$(build_prefix)/lib/python/dist-packages
|
||||
$(package)_patches=sorted_list.patch
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
patch -p1 < $($(package)_patch_dir)/sorted_list.patch
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
python setup.py build
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
mkdir -p $($(package)_install_libdir) && \
|
||||
python setup.py install --root=$($(package)_staging_dir) --prefix=$(build_prefix) --install-lib=$($(package)_install_libdir)
|
||||
endef
|
17
depends/packages/native_ds_store.mk
Normal file
17
depends/packages/native_ds_store.mk
Normal file
@ -0,0 +1,17 @@
|
||||
package=native_ds_store
|
||||
$(package)_version=c80c23706eae
|
||||
$(package)_download_path=https://bitbucket.org/al45tair/ds_store/get
|
||||
$(package)_download_file=$($(package)_version).tar.bz2
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=ce1aa412211610c63d567bbe3e06213006a2d5ba5d76d89399c151b5472cb0da
|
||||
$(package)_install_libdir=$(build_prefix)/lib/python/dist-packages
|
||||
$(package)_dependencies=native_biplist
|
||||
|
||||
define $(package)_build_cmds
|
||||
python setup.py build
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
mkdir -p $($(package)_install_libdir) && \
|
||||
python setup.py install --root=$($(package)_staging_dir) --prefix=$(build_prefix) --install-lib=$($(package)_install_libdir)
|
||||
endef
|
16
depends/packages/native_mac_alias.mk
Normal file
16
depends/packages/native_mac_alias.mk
Normal file
@ -0,0 +1,16 @@
|
||||
package=native_mac_alias
|
||||
$(package)_version=1.1.0
|
||||
$(package)_download_path=https://bitbucket.org/al45tair/mac_alias/get
|
||||
$(package)_download_file=v$($(package)_version).tar.bz2
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=87ad827e66790028361e43fc754f68ed041a9bdb214cca03c853f079b04fb120
|
||||
$(package)_install_libdir=$(build_prefix)/lib/python/dist-packages
|
||||
|
||||
define $(package)_build_cmds
|
||||
python setup.py build
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
mkdir -p $($(package)_install_libdir) && \
|
||||
python setup.py install --root=$($(package)_staging_dir) --prefix=$(build_prefix) --install-lib=$($(package)_install_libdir)
|
||||
endef
|
@ -15,6 +15,8 @@ wallet_packages=bdb
|
||||
|
||||
upnp_packages=miniupnpc
|
||||
|
||||
darwin_native_packages = native_biplist native_ds_store native_mac_alias
|
||||
|
||||
ifneq ($(build_os),darwin)
|
||||
darwin_native_packages=native_cctools native_cdrkit native_libdmg-hfsplus
|
||||
darwin_native_packages += native_cctools native_cdrkit native_libdmg-hfsplus
|
||||
endif
|
||||
|
@ -1,35 +0,0 @@
|
||||
diff --git a/include/boost/atomic/detail/cas128strong.hpp b/include/boost/atomic/detail/cas128strong.hpp
|
||||
index 906c13e..dcb4d7d 100644
|
||||
--- a/include/boost/atomic/detail/cas128strong.hpp
|
||||
+++ b/include/boost/atomic/detail/cas128strong.hpp
|
||||
@@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign>
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
||||
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
|
||||
{
|
||||
+ memset(&v_, 0, sizeof(v_));
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void
|
||||
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
- storage_type value_s = 0;
|
||||
+ storage_type value_s;
|
||||
+ memset(&value_s, 0, sizeof(value_s));
|
||||
memcpy(&value_s, &value, sizeof(value_type));
|
||||
platform_fence_before_store(order);
|
||||
platform_store128(value_s, &v_);
|
||||
@@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign>
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
- storage_type expected_s = 0, desired_s = 0;
|
||||
+ storage_type expected_s, desired_s;
|
||||
+ memset(&expected_s, 0, sizeof(expected_s));
|
||||
+ memset(&desired_s, 0, sizeof(desired_s));
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
|
@ -1,55 +0,0 @@
|
||||
diff --git a/include/boost/atomic/detail/gcc-atomic.hpp b/include/boost/atomic/detail/gcc-atomic.hpp
|
||||
index a130590..4af99a1 100644
|
||||
--- a/include/boost/atomic/detail/gcc-atomic.hpp
|
||||
+++ b/include/boost/atomic/detail/gcc-atomic.hpp
|
||||
@@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign>
|
||||
|
||||
public:
|
||||
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
|
||||
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
|
||||
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
|
||||
{
|
||||
+ memset(&v_, 0, sizeof(v_));
|
||||
memcpy(&v_, &v, sizeof(value_type));
|
||||
}
|
||||
|
||||
void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
- storage_type tmp = 0;
|
||||
+ storage_type tmp;
|
||||
+ memset(&tmp, 0, sizeof(tmp));
|
||||
memcpy(&tmp, &v, sizeof(value_type));
|
||||
__atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
}
|
||||
@@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign>
|
||||
|
||||
value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
- storage_type tmp = 0;
|
||||
+ storage_type tmp;
|
||||
+ memset(&tmp, 0, sizeof(tmp));
|
||||
memcpy(&tmp, &v, sizeof(value_type));
|
||||
tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
|
||||
value_type res;
|
||||
@@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign>
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
- storage_type expected_s = 0, desired_s = 0;
|
||||
+ storage_type expected_s, desired_s;
|
||||
+ memset(&expected_s, 0, sizeof(expected_s));
|
||||
+ memset(&desired_s, 0, sizeof(desired_s));
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
|
||||
@@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign>
|
||||
memory_order success_order,
|
||||
memory_order failure_order) volatile BOOST_NOEXCEPT
|
||||
{
|
||||
- storage_type expected_s = 0, desired_s = 0;
|
||||
+ storage_type expected_s, desired_s;
|
||||
+ memset(&expected_s, 0, sizeof(expected_s));
|
||||
+ memset(&desired_s, 0, sizeof(desired_s));
|
||||
memcpy(&expected_s, &expected, sizeof(value_type));
|
||||
memcpy(&desired_s, &desired, sizeof(value_type));
|
||||
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
|
@ -1,37 +0,0 @@
|
||||
From eec808554936ae068b23df07ab54d4dc6302a695 Mon Sep 17 00:00:00 2001
|
||||
From: jzmaddock <jzmaddock@gmail.com>
|
||||
Date: Sat, 23 Aug 2014 09:38:02 +0100
|
||||
Subject: [PATCH] Fix BOOST_NO_CXX11_VARIADIC_TEMPLATES definition - the
|
||||
feature was introduced in GCC 4.4.
|
||||
|
||||
---
|
||||
include/boost/config/compiler/gcc.hpp | 9 +--------
|
||||
1 file changed, 1 insertion(+), 8 deletions(-)
|
||||
|
||||
diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp
|
||||
index f37159d..97d8a18 100644
|
||||
--- a/include/boost/config/compiler/gcc.hpp
|
||||
+++ b/include/boost/config/compiler/gcc.hpp
|
||||
@@ -154,14 +154,6 @@
|
||||
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
|
||||
# define BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
# define BOOST_NO_CXX11_STATIC_ASSERT
|
||||
-
|
||||
-// Variadic templates compiler:
|
||||
-// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html
|
||||
-# if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__))
|
||||
-# define BOOST_HAS_VARIADIC_TMPL
|
||||
-# else
|
||||
-# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
-# endif
|
||||
#endif
|
||||
|
||||
// C++0x features in 4.4.n and later
|
||||
@@ -176,6 +168,7 @@
|
||||
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
|
||||
# define BOOST_NO_CXX11_INLINE_NAMESPACES
|
||||
+# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
|
||||
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
|
29
depends/patches/native_biplist/sorted_list.patch
Normal file
29
depends/patches/native_biplist/sorted_list.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- a/biplist/__init__.py 2014-10-26 19:03:11.000000000 +0000
|
||||
+++ b/biplist/__init__.py 2016-07-19 19:30:17.663521999 +0000
|
||||
@@ -541,7 +541,7 @@
|
||||
return HashableWrapper(n)
|
||||
elif isinstance(root, dict):
|
||||
n = {}
|
||||
- for key, value in iteritems(root):
|
||||
+ for key, value in sorted(iteritems(root)):
|
||||
n[self.wrapRoot(key)] = self.wrapRoot(value)
|
||||
return HashableWrapper(n)
|
||||
elif isinstance(root, list):
|
||||
@@ -616,7 +616,7 @@
|
||||
elif isinstance(obj, dict):
|
||||
size = proc_size(len(obj))
|
||||
self.incrementByteCount('dictBytes', incr=1+size)
|
||||
- for key, value in iteritems(obj):
|
||||
+ for key, value in sorted(iteritems(obj)):
|
||||
check_key(key)
|
||||
self.computeOffsets(key, asReference=True)
|
||||
self.computeOffsets(value, asReference=True)
|
||||
@@ -714,7 +714,7 @@
|
||||
keys = []
|
||||
values = []
|
||||
objectsToWrite = []
|
||||
- for key, value in iteritems(obj):
|
||||
+ for key, value in sorted(iteritems(obj)):
|
||||
keys.append(key)
|
||||
values.append(value)
|
||||
for key in keys:
|
@ -63,9 +63,8 @@ functionality is broken. Only the compression feature is currently used.
|
||||
Ideally, the creation could be fixed and genisoimage would no longer be necessary.
|
||||
|
||||
Background images and other features can be added to DMG files by inserting a
|
||||
.DS_Store before creation. The easiest way to create this file is to build a
|
||||
DMG without one, move it to a device running OS X, customize the layout, then
|
||||
grab the .DS_Store file for later use. That is the approach taken here.
|
||||
.DS_Store before creation. This is generated by the script
|
||||
contrib/macdeploy/custom_dsstore.py.
|
||||
|
||||
As of OS X Mavericks (10.9), using an Apple-blessed key to sign binaries is a
|
||||
requirement in order to satisfy the new Gatekeeper requirements. Because this
|
||||
|
@ -7,11 +7,11 @@ Some notes on how to build Dash Core in Unix.
|
||||
Note
|
||||
---------------------
|
||||
Always use absolute paths to configure and compile Dash Core and the dependencies,
|
||||
for example, when specifying the the path of the dependency:
|
||||
for example, when specifying the path of the dependency:
|
||||
|
||||
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
|
||||
|
||||
Here BDB_PREFIX must absolute path - it is defined using $(pwd) which ensures
|
||||
Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures
|
||||
the usage of the absolute path.
|
||||
|
||||
To Build
|
||||
@ -51,12 +51,15 @@ Optional dependencies:
|
||||
|
||||
For the versions used in the release, see [release-process.md](release-process.md) under *Fetch and build inputs*.
|
||||
|
||||
System requirements
|
||||
Memory Requirements
|
||||
--------------------
|
||||
|
||||
C++ compilers are memory-hungry. It is recommended to have at least 1 GB of
|
||||
memory available when compiling Dash Core. With 512MB of memory or less
|
||||
compilation will take much longer due to swap thrashing.
|
||||
C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of
|
||||
memory available when compiling Dash Core. On systems with less, gcc can be
|
||||
tuned to conserve memory with additional CXXFLAGS:
|
||||
|
||||
|
||||
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
|
||||
|
||||
Dependency Build Instructions: Ubuntu & Debian
|
||||
----------------------------------------------
|
||||
@ -64,15 +67,17 @@ Build requirements:
|
||||
|
||||
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
|
||||
|
||||
On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the
|
||||
Options when installing required Boost library files:
|
||||
|
||||
1. On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the
|
||||
individual boost development packages, so the following can be used to only
|
||||
install necessary parts of boost:
|
||||
|
||||
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev
|
||||
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev
|
||||
|
||||
If that doesn't work, you can install all boost development packages with:
|
||||
2. If that doesn't work, you can install all boost development packages with:
|
||||
|
||||
sudo apt-get install libboost-all-dev
|
||||
sudo apt-get install libboost-all-dev
|
||||
|
||||
BerkeleyDB is required for the wallet. db4.8 packages are available [here](https://launchpad.net/~bitcoin/+archive/bitcoin).
|
||||
You can add the repository and install using the following commands:
|
||||
|
@ -74,11 +74,11 @@ In the VirtualBox GUI click "Create" and choose the following parameters in the
|
||||
- File location and size: at least 40GB; as low as 20GB *may* be possible, but better to err on the safe side
|
||||
- Click `Create`
|
||||
|
||||
Get the [Debian 8.x net installer](http://cdimage.debian.org/debian-cd/8.2.0/amd64/iso-cd/debian-8.2.0-amd64-netinst.iso) (a more recent minor version should also work, see also [Debian Network installation](https://www.debian.org/CD/netinst/)).
|
||||
Get the [Debian 8.x net installer](http://cdimage.debian.org/debian-cd/8.3.0/amd64/iso-cd/debian-8.3.0-amd64-netinst.iso) (a more recent minor version should also work, see also [Debian Network installation](https://www.debian.org/CD/netinst/)).
|
||||
This DVD image can be validated using a SHA256 hashing tool, for example on
|
||||
Unixy OSes by entering the following in a terminal:
|
||||
|
||||
echo "d393d17ac6b3113c81186e545c416a00f28ed6e05774284bb5e8f0df39fcbcb9 debian-8.2.0-amd64-netinst.iso" | sha256sum -c
|
||||
echo "dd25bcdde3c6ea5703cc0f313cde621b13d42ff7d252e2538a11663c93bf8654 debian-8.3.0-amd64-netinst.iso" | sha256sum -c
|
||||
# (must return OK)
|
||||
|
||||
After creating the VM, we need to configure it.
|
||||
@ -262,6 +262,7 @@ Then set up LXC and the rest with the following, which is a complex jumble of se
|
||||
# the version of lxc-start in Debian needs to run as root, so make sure
|
||||
# that the build script can execute it without providing a password
|
||||
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc
|
||||
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" >> /etc/sudoers.d/gitian-lxc
|
||||
# make /etc/rc.local script that sets up bridge between guest and host
|
||||
echo '#!/bin/sh -e' > /etc/rc.local
|
||||
echo 'brctl addbr br0' >> /etc/rc.local
|
||||
@ -305,6 +306,7 @@ Clone the git repositories for Dash Core and Gitian.
|
||||
```bash
|
||||
git clone https://github.com/devrandom/gitian-builder.git
|
||||
git clone https://github.com/dashpay/dash
|
||||
git clone https://github.com/dashpay/gitian.sigs.git
|
||||
```
|
||||
|
||||
Setting up the Gitian image
|
||||
|
@ -11,7 +11,7 @@ The interface is defined in the C header `dashconsensus.h` located in `src/scri
|
||||
|
||||
#### Version
|
||||
|
||||
`dashconsensus_version` returns an `unsigned int` with the the API version *(currently at an experimental `0`)*.
|
||||
`dashconsensus_version` returns an `unsigned int` with the API version *(currently at an experimental `0`)*.
|
||||
|
||||
#### Script Validation
|
||||
|
||||
|
@ -27,7 +27,7 @@ In order to avoid rebuilding all dependencies for each build, the binaries are
|
||||
cached and re-used when possible. Changes in the dependency-generator will
|
||||
trigger cache-invalidation and rebuilds as necessary.
|
||||
|
||||
These caches can be manually removed if necessary. This is one of the the very few
|
||||
These caches can be manually removed if necessary. This is one of the very few
|
||||
manual operations that is possible with Travis, and it can be done by the
|
||||
Dash Core committer via the Travis web interface.
|
||||
|
||||
|
@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Bitcoin Core consensus library
|
||||
Name: @PACKAGE_NAME@ consensus library
|
||||
Description: Library for the Bitcoin consensus protocol.
|
||||
Version: @PACKAGE_VERSION@
|
||||
Libs: -L${libdir} -ldashconsensus
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
# blocktools.py - utilities for manipulating blocks and transactions
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
@ -1,3 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
||||
"""
|
||||
This module contains utilities for doing coverage analysis on the RPC
|
||||
interface.
|
||||
|
@ -53,16 +53,10 @@ class TxnMallTest(BitcoinTestFramework):
|
||||
clone_inputs = [{"txid":rawtx1["vin"][0]["txid"],"vout":rawtx1["vin"][0]["vout"]}]
|
||||
clone_outputs = {rawtx1["vout"][0]["scriptPubKey"]["addresses"][0]:rawtx1["vout"][0]["value"],
|
||||
rawtx1["vout"][1]["scriptPubKey"]["addresses"][0]:rawtx1["vout"][1]["value"]}
|
||||
clone_raw = self.nodes[0].createrawtransaction(clone_inputs, clone_outputs)
|
||||
clone_locktime = rawtx1["locktime"]
|
||||
clone_raw = self.nodes[0].createrawtransaction(clone_inputs, clone_outputs, clone_locktime)
|
||||
|
||||
# 3 hex manipulations on the clone are required
|
||||
|
||||
# manipulation 1. sequence is at version+#inputs+input+sigstub
|
||||
posseq = 2*(4+1+36+1)
|
||||
seqbe = '%08x' % rawtx1["vin"][0]["sequence"]
|
||||
clone_raw = clone_raw[:posseq] + seqbe[6:8] + seqbe[4:6] + seqbe[2:4] + seqbe[0:2] + clone_raw[posseq + 8:]
|
||||
|
||||
# manipulation 2. createrawtransaction randomizes the order of its outputs, so swap them if necessary.
|
||||
# createrawtransaction randomizes the order of its outputs, so swap them if necessary.
|
||||
# output 0 is at version+#inputs+input+sigstub+sequence+#outputs
|
||||
# 400 DASH serialized is 00902f5009000000
|
||||
pos0 = 2*(4+1+36+1+4+1)
|
||||
@ -74,11 +68,6 @@ class TxnMallTest(BitcoinTestFramework):
|
||||
output1 = clone_raw[pos0 + output_len : pos0 + 2 * output_len]
|
||||
clone_raw = clone_raw[:pos0] + output1 + output0 + clone_raw[pos0 + 2 * output_len:]
|
||||
|
||||
# manipulation 3. locktime is after outputs
|
||||
poslt = pos0 + 2 * output_len
|
||||
ltbe = '%08x' % rawtx1["locktime"]
|
||||
clone_raw = clone_raw[:poslt] + ltbe[6:8] + ltbe[4:6] + ltbe[2:4] + ltbe[0:2] + clone_raw[poslt + 8:]
|
||||
|
||||
# Use a different signature hash type to sign. This creates an equivalent but malleated clone.
|
||||
# Don't send the clone anywhere yet
|
||||
tx1_clone = self.nodes[0].signrawtransaction(clone_raw, None, None, "ALL|ANYONECANPAY")
|
||||
|
@ -17,7 +17,7 @@
|
||||
<string>APPL</string>
|
||||
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin Core developers, 2014-@COPYRIGHT_YEAR@ The Dash Core developers</string>
|
||||
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin Core developers, 2014-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@</string>
|
||||
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@</string>
|
||||
|
@ -70,6 +70,10 @@ f.write("""
|
||||
#endif
|
||||
""")
|
||||
f.write('static const char UNUSED *dash_strings[] = {\n')
|
||||
f.write('QT_TRANSLATE_NOOP("dash-core", "%s"),\n' % (os.getenv('PACKAGE_NAME'),))
|
||||
f.write('QT_TRANSLATE_NOOP("dash-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS'),))
|
||||
if os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION') != os.getenv('PACKAGE_NAME'):
|
||||
f.write('QT_TRANSLATE_NOOP("dash-core", "%s"),\n' % (os.getenv('COPYRIGHT_HOLDERS_SUBSTITUTION'),))
|
||||
messages.sort(key=operator.itemgetter(0))
|
||||
for (msgid, msgstr) in messages:
|
||||
if msgid != EMPTY:
|
||||
|
@ -6,8 +6,8 @@ SetCompressor /SOLID lzma
|
||||
# General Symbol Definitions
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@
|
||||
!define COMPANY "Dash Core project"
|
||||
!define URL https://www.dash.org/
|
||||
!define COMPANY "@PACKAGE_NAME@ project"
|
||||
!define URL @PACKAGE_URL@
|
||||
|
||||
# MUI Symbol Definitions
|
||||
!define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico"
|
||||
@ -59,7 +59,7 @@ XPStyle on
|
||||
BrandingText " "
|
||||
ShowInstDetails show
|
||||
VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@
|
||||
VIAddVersionKey ProductName "Dash Core"
|
||||
VIAddVersionKey ProductName "@PACKAGE_NAME@"
|
||||
VIAddVersionKey ProductVersion "${VERSION}"
|
||||
VIAddVersionKey CompanyName "${COMPANY}"
|
||||
VIAddVersionKey CompanyWebsite "${URL}"
|
||||
|
@ -23,6 +23,7 @@ BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
|
||||
LIBBITCOIN_SERVER=libbitcoin_server.a
|
||||
LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||
LIBBITCOIN_COMMON=libbitcoin_common.a
|
||||
LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
|
||||
LIBBITCOIN_CLI=libbitcoin_cli.a
|
||||
LIBBITCOIN_UTIL=libbitcoin_util.a
|
||||
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
|
||||
@ -38,6 +39,7 @@ EXTRA_LIBRARIES += \
|
||||
crypto/libbitcoin_crypto.a \
|
||||
libbitcoin_util.a \
|
||||
libbitcoin_common.a \
|
||||
libbitcoin_consensus.a \
|
||||
libbitcoin_server.a \
|
||||
libbitcoin_cli.a
|
||||
if ENABLE_WALLET
|
||||
@ -50,9 +52,9 @@ endif
|
||||
|
||||
if BUILD_BITCOIN_LIBS
|
||||
lib_LTLIBRARIES = libdashconsensus.la
|
||||
LIBBITCOIN_CONSENSUS=libdashconsensus.la
|
||||
LIBBITCOINCONSENSUS=libdashconsensus.la
|
||||
else
|
||||
LIBBITCOIN_CONSENSUS=
|
||||
LIBBITCOINCONSENSUS=
|
||||
endif
|
||||
|
||||
bin_PROGRAMS =
|
||||
@ -76,8 +78,6 @@ BITCOIN_CORE_H = \
|
||||
spentindex.h \
|
||||
addrman.h \
|
||||
alert.h \
|
||||
amount.h \
|
||||
arith_uint256.h \
|
||||
base58.h \
|
||||
bip39.h \
|
||||
bip39_english.h \
|
||||
@ -99,9 +99,6 @@ BITCOIN_CORE_H = \
|
||||
compat/sanity.h \
|
||||
compressor.h \
|
||||
consensus/consensus.h \
|
||||
consensus/merkle.h \
|
||||
consensus/params.h \
|
||||
consensus/validation.h \
|
||||
core_io.h \
|
||||
core_memusage.h \
|
||||
privatesend.h \
|
||||
@ -117,7 +114,6 @@ BITCOIN_CORE_H = \
|
||||
governance-vote.h \
|
||||
governance-votedb.h \
|
||||
flat-database.h \
|
||||
hash.h \
|
||||
hdchain.h \
|
||||
httprpc.h \
|
||||
httpserver.h \
|
||||
@ -147,24 +143,16 @@ BITCOIN_CORE_H = \
|
||||
policy/policy.h \
|
||||
policy/rbf.h \
|
||||
pow.h \
|
||||
prevector.h \
|
||||
primitives/block.h \
|
||||
primitives/transaction.h \
|
||||
protocol.h \
|
||||
pubkey.h \
|
||||
random.h \
|
||||
reverselock.h \
|
||||
rpc/client.h \
|
||||
rpc/protocol.h \
|
||||
rpc/server.h \
|
||||
scheduler.h \
|
||||
script/interpreter.h \
|
||||
script/script.h \
|
||||
script/script_error.h \
|
||||
script/sigcache.h \
|
||||
script/sign.h \
|
||||
script/standard.h \
|
||||
serialize.h \
|
||||
spork.h \
|
||||
streams.h \
|
||||
support/allocators/secure.h \
|
||||
@ -175,23 +163,20 @@ BITCOIN_CORE_H = \
|
||||
threadsafety.h \
|
||||
threadinterrupt.h \
|
||||
timedata.h \
|
||||
tinyformat.h \
|
||||
torcontrol.h \
|
||||
txdb.h \
|
||||
txmempool.h \
|
||||
ui_interface.h \
|
||||
uint256.h \
|
||||
undo.h \
|
||||
util.h \
|
||||
utilmoneystr.h \
|
||||
utilstrencodings.h \
|
||||
utiltime.h \
|
||||
validation.h \
|
||||
validationinterface.h \
|
||||
version.h \
|
||||
versionbits.h \
|
||||
wallet/crypter.h \
|
||||
wallet/db.h \
|
||||
wallet/rpcwallet.h \
|
||||
wallet/wallet.h \
|
||||
wallet/wallet_ismine.h \
|
||||
wallet/walletdb.h \
|
||||
@ -343,34 +328,60 @@ crypto_libbitcoin_crypto_a_SOURCES += \
|
||||
crypto/sph_skein.h \
|
||||
crypto/sph_types.h
|
||||
|
||||
# consensus: shared between all executables that validate any consensus rules.
|
||||
libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_consensus_a_SOURCES = \
|
||||
amount.h \
|
||||
arith_uint256.cpp \
|
||||
arith_uint256.h \
|
||||
consensus/merkle.cpp \
|
||||
consensus/merkle.h \
|
||||
consensus/params.h \
|
||||
consensus/validation.h \
|
||||
hash.cpp \
|
||||
hash.h \
|
||||
prevector.h \
|
||||
primitives/block.cpp \
|
||||
primitives/block.h \
|
||||
primitives/transaction.cpp \
|
||||
primitives/transaction.h \
|
||||
pubkey.cpp \
|
||||
pubkey.h \
|
||||
script/dashconsensus.cpp \
|
||||
script/interpreter.cpp \
|
||||
script/interpreter.h \
|
||||
script/script.cpp \
|
||||
script/script.h \
|
||||
script/script_error.cpp \
|
||||
script/script_error.h \
|
||||
serialize.h \
|
||||
tinyformat.h \
|
||||
uint256.cpp \
|
||||
uint256.h \
|
||||
utilstrencodings.cpp \
|
||||
utilstrencodings.h \
|
||||
version.h
|
||||
|
||||
# common: shared between dashd, and dash-qt and non-server tools
|
||||
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_common_a_SOURCES = \
|
||||
amount.cpp \
|
||||
arith_uint256.cpp \
|
||||
base58.cpp \
|
||||
bip39.cpp \
|
||||
chainparams.cpp \
|
||||
coins.cpp \
|
||||
compressor.cpp \
|
||||
consensus/merkle.cpp \
|
||||
core_read.cpp \
|
||||
core_write.cpp \
|
||||
hash.cpp \
|
||||
hdchain.cpp \
|
||||
key.cpp \
|
||||
keystore.cpp \
|
||||
netaddress.cpp \
|
||||
netbase.cpp \
|
||||
primitives/block.cpp \
|
||||
primitives/transaction.cpp \
|
||||
protocol.cpp \
|
||||
pubkey.cpp \
|
||||
scheduler.cpp \
|
||||
script/interpreter.cpp \
|
||||
script/script.cpp \
|
||||
script/script_error.cpp \
|
||||
script/sign.cpp \
|
||||
script/standard.cpp \
|
||||
$(BITCOIN_CORE_H)
|
||||
@ -391,7 +402,6 @@ libbitcoin_util_a_SOURCES = \
|
||||
rpc/protocol.cpp \
|
||||
support/cleanse.cpp \
|
||||
sync.cpp \
|
||||
uint256.cpp \
|
||||
threadinterrupt.cpp \
|
||||
util.cpp \
|
||||
utilmoneystr.cpp \
|
||||
@ -428,6 +438,7 @@ dashd_LDADD = \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CONSENSUS) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBLEVELDB) \
|
||||
$(LIBMEMENV) \
|
||||
@ -474,6 +485,7 @@ dash_tx_LDADD = \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CONSENSUS) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBSECP256K1)
|
||||
|
||||
@ -483,20 +495,7 @@ dash_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
||||
# dashconsensus library #
|
||||
if BUILD_BITCOIN_LIBS
|
||||
include_HEADERS = script/dashconsensus.h
|
||||
libdashconsensus_la_SOURCES = \
|
||||
crypto/hmac_sha512.cpp \
|
||||
crypto/ripemd160.cpp \
|
||||
crypto/sha1.cpp \
|
||||
crypto/sha256.cpp \
|
||||
crypto/sha512.cpp \
|
||||
hash.cpp \
|
||||
primitives/transaction.cpp \
|
||||
pubkey.cpp \
|
||||
script/dashconsensus.cpp \
|
||||
script/interpreter.cpp \
|
||||
script/script.cpp \
|
||||
uint256.cpp \
|
||||
utilstrencodings.cpp
|
||||
libdashconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
|
||||
|
||||
if GLIBC_BACK_COMPAT
|
||||
libdashconsensus_la_SOURCES += compat/glibc_compat.cpp
|
||||
@ -511,6 +510,7 @@ endif
|
||||
#
|
||||
|
||||
CLEANFILES = leveldb/libleveldb.a leveldb/libmemenv.a
|
||||
CLEANFILES += $(EXTRA_LIBRARIES)
|
||||
CLEANFILES += *.gcda *.gcno
|
||||
CLEANFILES += compat/*.gcda compat/*.gcno
|
||||
CLEANFILES += consensus/*.gcda consensus/*.gcno
|
||||
@ -537,7 +537,8 @@ clean-local:
|
||||
|
||||
.rc.o:
|
||||
@test -f $(WINDRES)
|
||||
$(AM_V_GEN) $(WINDRES) -DWINDRES_PREPROC -i $< -o $@
|
||||
## FIXME: How to get the appropriate modulename_CPPFLAGS in here?
|
||||
$(AM_V_GEN) $(WINDRES) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -DWINDRES_PREPROC -i $< -o $@
|
||||
|
||||
.mm.o:
|
||||
$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
|
@ -15,6 +15,7 @@ bench_bench_dash_LDADD = \
|
||||
$(LIBBITCOIN_SERVER) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CONSENSUS) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBLEVELDB) \
|
||||
$(LIBMEMENV) \
|
||||
|
@ -558,7 +558,7 @@ endif
|
||||
if ENABLE_ZMQ
|
||||
qt_dash_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
endif
|
||||
qt_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
|
||||
qt_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
|
||||
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
|
||||
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
qt_dash_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
@ -571,7 +571,7 @@ SECONDARY: $(QT_QM)
|
||||
|
||||
qt/dashstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) $(libbitcoin_util_a_SOURCES)
|
||||
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
|
||||
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) ../share/qt/extract_strings_qt.py $^
|
||||
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" ../share/qt/extract_strings_qt.py $^
|
||||
|
||||
translate: qt/dashstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) qt/dash.cpp $(BITCOIN_QT_H) $(BITCOIN_MM)
|
||||
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
|
||||
|
@ -40,7 +40,7 @@ endif
|
||||
if ENABLE_ZMQ
|
||||
qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
endif
|
||||
qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
|
||||
qt_test_test_dash_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
|
||||
$(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
|
||||
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
|
||||
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
|
@ -48,7 +48,6 @@ BITCOIN_TESTS =\
|
||||
test/bswap_tests.cpp \
|
||||
test/cachemap_tests.cpp \
|
||||
test/cachemultimap_tests.cpp \
|
||||
test/checkblock_tests.cpp \
|
||||
test/coins_tests.cpp \
|
||||
test/compress_tests.cpp \
|
||||
test/crypto_tests.cpp \
|
||||
@ -103,14 +102,14 @@ endif
|
||||
|
||||
test_test_dash_SOURCES = $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
|
||||
test_test_dash_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -I$(builddir)/test/ $(TESTDEFS) $(EVENT_CFLAGS)
|
||||
test_test_dash_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
|
||||
test_test_dash_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
|
||||
$(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1)
|
||||
test_test_dash_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
if ENABLE_WALLET
|
||||
test_test_dash_LDADD += $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
|
||||
test_test_dash_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
test_test_dash_LDADD += $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
test_test_dash_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
|
||||
if ENABLE_ZMQ
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Copyright (c) 2012 Pieter Wuille
|
||||
// Copyright (c) 2012-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Copyright (c) 2012 Pieter Wuille
|
||||
// Copyright (c) 2012-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -216,30 +216,54 @@ void CBloomFilter::UpdateEmptyFull()
|
||||
isEmpty = empty;
|
||||
}
|
||||
|
||||
CRollingBloomFilter::CRollingBloomFilter(unsigned int nElements, double fpRate) :
|
||||
b1(nElements * 2, fpRate, 0), b2(nElements * 2, fpRate, 0)
|
||||
CRollingBloomFilter::CRollingBloomFilter(unsigned int nElements, double fpRate)
|
||||
{
|
||||
// Implemented using two bloom filters of 2 * nElements each.
|
||||
// We fill them up, and clear them, staggered, every nElements
|
||||
// inserted, so at least one always contains the last nElements
|
||||
// inserted.
|
||||
nInsertions = 0;
|
||||
nBloomSize = nElements * 2;
|
||||
|
||||
double logFpRate = log(fpRate);
|
||||
/* The optimal number of hash functions is log(fpRate) / log(0.5), but
|
||||
* restrict it to the range 1-50. */
|
||||
nHashFuncs = std::max(1, std::min((int)round(logFpRate / log(0.5)), 50));
|
||||
/* In this rolling bloom filter, we'll store between 2 and 3 generations of nElements / 2 entries. */
|
||||
nEntriesPerGeneration = (nElements + 1) / 2;
|
||||
uint32_t nMaxElements = nEntriesPerGeneration * 3;
|
||||
/* The maximum fpRate = pow(1.0 - exp(-nHashFuncs * nMaxElements / nFilterBits), nHashFuncs)
|
||||
* => pow(fpRate, 1.0 / nHashFuncs) = 1.0 - exp(-nHashFuncs * nMaxElements / nFilterBits)
|
||||
* => 1.0 - pow(fpRate, 1.0 / nHashFuncs) = exp(-nHashFuncs * nMaxElements / nFilterBits)
|
||||
* => log(1.0 - pow(fpRate, 1.0 / nHashFuncs)) = -nHashFuncs * nMaxElements / nFilterBits
|
||||
* => nFilterBits = -nHashFuncs * nMaxElements / log(1.0 - pow(fpRate, 1.0 / nHashFuncs))
|
||||
* => nFilterBits = -nHashFuncs * nMaxElements / log(1.0 - exp(logFpRate / nHashFuncs))
|
||||
*/
|
||||
uint32_t nFilterBits = (uint32_t)ceil(-1.0 * nHashFuncs * nMaxElements / log(1.0 - exp(logFpRate / nHashFuncs)));
|
||||
data.clear();
|
||||
/* We store up to 16 'bits' per data element. */
|
||||
data.resize((nFilterBits + 15) / 16);
|
||||
reset();
|
||||
}
|
||||
|
||||
/* Similar to CBloomFilter::Hash */
|
||||
inline unsigned int CRollingBloomFilter::Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const {
|
||||
return MurmurHash3(nHashNum * 0xFBA4C795 + nTweak, vDataToHash) % (data.size() * 16);
|
||||
}
|
||||
|
||||
void CRollingBloomFilter::insert(const std::vector<unsigned char>& vKey)
|
||||
{
|
||||
if (nInsertions == 0) {
|
||||
b1.clear();
|
||||
} else if (nInsertions == nBloomSize / 2) {
|
||||
b2.clear();
|
||||
if (nEntriesThisGeneration == nEntriesPerGeneration) {
|
||||
nEntriesThisGeneration = 0;
|
||||
nGeneration++;
|
||||
if (nGeneration == 4) {
|
||||
nGeneration = 1;
|
||||
}
|
||||
/* Wipe old entries that used this generation number. */
|
||||
for (uint32_t p = 0; p < data.size() * 16; p++) {
|
||||
if (get(p) == nGeneration) {
|
||||
put(p, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
b1.insert(vKey);
|
||||
b2.insert(vKey);
|
||||
if (++nInsertions == nBloomSize) {
|
||||
nInsertions = 0;
|
||||
nEntriesThisGeneration++;
|
||||
|
||||
for (int n = 0; n < nHashFuncs; n++) {
|
||||
uint32_t h = Hash(n, vKey);
|
||||
put(h, nGeneration);
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,10 +275,13 @@ void CRollingBloomFilter::insert(const uint256& hash)
|
||||
|
||||
bool CRollingBloomFilter::contains(const std::vector<unsigned char>& vKey) const
|
||||
{
|
||||
if (nInsertions < nBloomSize / 2) {
|
||||
return b2.contains(vKey);
|
||||
for (int n = 0; n < nHashFuncs; n++) {
|
||||
uint32_t h = Hash(n, vKey);
|
||||
if (get(h) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return b1.contains(vKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRollingBloomFilter::contains(const uint256& hash) const
|
||||
@ -265,8 +292,10 @@ bool CRollingBloomFilter::contains(const uint256& hash) const
|
||||
|
||||
void CRollingBloomFilter::reset()
|
||||
{
|
||||
unsigned int nNewTweak = GetRand(std::numeric_limits<unsigned int>::max());
|
||||
b1.reset(nNewTweak);
|
||||
b2.reset(nNewTweak);
|
||||
nInsertions = 0;
|
||||
nTweak = GetRand(std::numeric_limits<unsigned int>::max());
|
||||
nEntriesThisGeneration = 0;
|
||||
nGeneration = 1;
|
||||
for (std::vector<uint32_t>::iterator it = data.begin(); it != data.end(); it++) {
|
||||
*it = 0;
|
||||
}
|
||||
}
|
||||
|
26
src/bloom.h
26
src/bloom.h
@ -110,8 +110,11 @@ public:
|
||||
* reset() is provided, which also changes nTweak to decrease the impact of
|
||||
* false-positives.
|
||||
*
|
||||
* contains(item) will always return true if item was one of the last N things
|
||||
* contains(item) will always return true if item was one of the last N to 1.5*N
|
||||
* insert()'ed ... but may also return true for items that were not inserted.
|
||||
*
|
||||
* It needs around 1.8 bytes per element per factor 0.1 of false positive rate.
|
||||
* (More accurately: 3/(log(256)*log(2)) * log(1/fpRate) * nElements bytes)
|
||||
*/
|
||||
class CRollingBloomFilter
|
||||
{
|
||||
@ -129,10 +132,23 @@ public:
|
||||
void reset();
|
||||
|
||||
private:
|
||||
unsigned int nBloomSize;
|
||||
unsigned int nInsertions;
|
||||
CBloomFilter b1, b2;
|
||||
int nEntriesPerGeneration;
|
||||
int nEntriesThisGeneration;
|
||||
int nGeneration;
|
||||
std::vector<uint32_t> data;
|
||||
unsigned int nTweak;
|
||||
int nHashFuncs;
|
||||
|
||||
unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const;
|
||||
|
||||
inline int get(uint32_t position) const {
|
||||
return (data[(position >> 4) % data.size()] >> (2 * (position & 0xF))) & 0x3;
|
||||
}
|
||||
|
||||
inline void put(uint32_t position, uint32_t val) {
|
||||
uint32_t& cell = data[(position >> 4) % data.size()];
|
||||
cell = (cell & ~(((uint32_t)3) << (2 * (position & 0xF)))) | (val << (2 * (position & 0xF)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // BITCOIN_BLOOM_H
|
||||
|
@ -111,3 +111,35 @@ void CBlockIndex::BuildSkip()
|
||||
if (pprev)
|
||||
pskip = pprev->GetAncestor(GetSkipHeight(nHeight));
|
||||
}
|
||||
|
||||
arith_uint256 GetBlockProof(const CBlockIndex& block)
|
||||
{
|
||||
arith_uint256 bnTarget;
|
||||
bool fNegative;
|
||||
bool fOverflow;
|
||||
bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow);
|
||||
if (fNegative || fOverflow || bnTarget == 0)
|
||||
return 0;
|
||||
// We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256
|
||||
// as it's too large for a arith_uint256. However, as 2**256 is at least as large
|
||||
// as bnTarget+1, it is equal to ((2**256 - bnTarget - 1) / (bnTarget+1)) + 1,
|
||||
// or ~bnTarget / (nTarget+1) + 1.
|
||||
return (~bnTarget / (bnTarget + 1)) + 1;
|
||||
}
|
||||
|
||||
int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params& params)
|
||||
{
|
||||
arith_uint256 r;
|
||||
int sign = 1;
|
||||
if (to.nChainWork > from.nChainWork) {
|
||||
r = to.nChainWork - from.nChainWork;
|
||||
} else {
|
||||
r = from.nChainWork - to.nChainWork;
|
||||
sign = -1;
|
||||
}
|
||||
r = r * arith_uint256(params.nPowTargetSpacing) / GetBlockProof(tip);
|
||||
if (r.bits() > 63) {
|
||||
return sign * std::numeric_limits<int64_t>::max();
|
||||
}
|
||||
return sign * r.GetLow64();
|
||||
}
|
||||
|
@ -334,6 +334,10 @@ public:
|
||||
const CBlockIndex* GetAncestor(int height) const;
|
||||
};
|
||||
|
||||
arith_uint256 GetBlockProof(const CBlockIndex& block);
|
||||
/** Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds. */
|
||||
int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params&);
|
||||
|
||||
/** Used to marshal pointers into hashes for db storage. */
|
||||
class CDiskBlockIndex : public CBlockIndex
|
||||
{
|
||||
|
@ -133,7 +133,6 @@ public:
|
||||
pchMessageStart[3] = 0xbd;
|
||||
vAlertPubKey = ParseHex("048240a8748a80a286b270ba126705ced4f2ce5a7847b3610ea3c06513150dade2a8512ed5ea86320824683fc0818f0ac019214973e677acd1244f6d0571fc5103");
|
||||
nDefaultPort = 9999;
|
||||
nMaxTipAge = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin
|
||||
nDelayGetHeadersTime = 24 * 60 * 60;
|
||||
nPruneAfterHeight = 100000;
|
||||
|
||||
@ -269,7 +268,6 @@ public:
|
||||
pchMessageStart[3] = 0xff;
|
||||
vAlertPubKey = ParseHex("04517d8a699cb43d3938d7b24faaff7cda448ca4ea267723ba614784de661949bf632d6304316b244646dea079735b9a6fc4af804efb4752075b9fe2245e14e412");
|
||||
nDefaultPort = 19999;
|
||||
nMaxTipAge = 0x7fffffff; // allow mining on top of old blocks for testnet
|
||||
nDelayGetHeadersTime = 24 * 60 * 60;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
@ -380,7 +378,6 @@ public:
|
||||
pchMessageStart[1] = 0xc1;
|
||||
pchMessageStart[2] = 0xb7;
|
||||
pchMessageStart[3] = 0xdc;
|
||||
nMaxTipAge = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin
|
||||
nDelayGetHeadersTime = 0; // never delay GETHEADERS in regtests
|
||||
nDefaultPort = 19994;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
@ -64,7 +64,6 @@ public:
|
||||
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
|
||||
/** Policy: Filter transactions that do not match well-defined patterns */
|
||||
bool RequireStandard() const { return fRequireStandard; }
|
||||
int64_t MaxTipAge() const { return nMaxTipAge; }
|
||||
int64_t DelayGetHeadersTime() const { return nDelayGetHeadersTime; }
|
||||
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
||||
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
|
||||
@ -89,7 +88,6 @@ protected:
|
||||
//! Raw pub key bytes for the broadcast alert signing key.
|
||||
std::vector<unsigned char> vAlertPubKey;
|
||||
int nDefaultPort;
|
||||
long nMaxTipAge;
|
||||
int64_t nDelayGetHeadersTime;
|
||||
uint64_t nPruneAfterHeight;
|
||||
std::vector<CDNSSeedData> vSeeds;
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define DO_STRINGIZE(X) #X
|
||||
|
||||
//! Copyright string used in Windows .rc files
|
||||
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, 2014-" STRINGIZE(COPYRIGHT_YEAR) " The Dash Core Developers"
|
||||
#define COPYRIGHT_STR "2009-" STRINGIZE(COPYRIGHT_YEAR) " The Bitcoin Core Developers, 2014-" STRINGIZE(COPYRIGHT_YEAR) " " COPYRIGHT_HOLDERS_FINAL
|
||||
|
||||
/**
|
||||
* dashd-res.rc includes this file, but it cannot cope with real c++ code.
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (c) 2015 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 "merkle.h"
|
||||
#include "hash.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
@ -4,6 +4,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/dash-config.h"
|
||||
#endif
|
||||
|
||||
#include "chainparamsbase.h"
|
||||
#include "clientversion.h"
|
||||
#include "rpc/client.h"
|
||||
@ -41,6 +45,7 @@ std::string HelpMessageCli()
|
||||
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcclienttimeout=<n>", strprintf(_("Timeout during HTTP requests (default: %d)"), DEFAULT_HTTP_CLIENT_TIMEOUT));
|
||||
strUsage += HelpMessageOpt("-stdin", _("Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases)"));
|
||||
|
||||
return strUsage;
|
||||
}
|
||||
@ -75,10 +80,10 @@ static int AppInitRPC(int argc, char* argv[])
|
||||
//
|
||||
ParseParameters(argc, argv);
|
||||
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
|
||||
std::string strUsage = _("Dash Core RPC client version") + " " + FormatFullVersion() + "\n";
|
||||
std::string strUsage = strprintf(_("%s RPC client version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n";
|
||||
if (!mapArgs.count("-version")) {
|
||||
strUsage += "\n" + _("Usage:") + "\n" +
|
||||
" dash-cli [options] <command> [params] " + _("Send command to Dash Core") + "\n" +
|
||||
" dash-cli [options] <command> [params] " + strprintf(_("Send command to %s"), _(PACKAGE_NAME)) + "\n" +
|
||||
" dash-cli [options] help " + _("List commands") + "\n" +
|
||||
" dash-cli [options] help <command> " + _("Get help for a command") + "\n";
|
||||
|
||||
@ -243,15 +248,17 @@ int CommandLineRPC(int argc, char *argv[])
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
// Method
|
||||
if (argc < 2)
|
||||
throw runtime_error("too few parameters");
|
||||
string strMethod = argv[1];
|
||||
|
||||
// Parameters default to strings
|
||||
std::vector<std::string> strParams(&argv[2], &argv[argc]);
|
||||
UniValue params = RPCConvertValues(strMethod, strParams);
|
||||
std::vector<std::string> args = std::vector<std::string>(&argv[1], &argv[argc]);
|
||||
if (GetBoolArg("-stdin", false)) {
|
||||
// Read one arg per line from stdin and append
|
||||
std::string line;
|
||||
while (std::getline(std::cin,line))
|
||||
args.push_back(line);
|
||||
}
|
||||
if (args.size() < 1)
|
||||
throw runtime_error("too few parameters (need at least command)");
|
||||
std::string strMethod = args[0];
|
||||
UniValue params = RPCConvertValues(strMethod, std::vector<std::string>(args.begin()+1, args.end()));
|
||||
|
||||
// Execute and handle connection failures with -rpcwait
|
||||
const bool fWait = GetBoolArg("-rpcwait", false);
|
||||
|
@ -17,7 +17,7 @@ BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Dash"
|
||||
VALUE "FileDescription", "dash-tx (CLI Dash transaction editor utility)"
|
||||
VALUE "FileDescription", "dash-cli (JSON-RPC client for " PACKAGE_NAME ")"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "dash-tx"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
|
@ -2,6 +2,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/dash-config.h"
|
||||
#endif
|
||||
|
||||
#include "base58.h"
|
||||
#include "clientversion.h"
|
||||
#include "coins.h"
|
||||
@ -52,7 +56,7 @@ static int AppInitRawTx(int argc, char* argv[])
|
||||
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help"))
|
||||
{
|
||||
// First part of help message is specific to this utility
|
||||
std::string strUsage = _("Dash Core dash-tx utility version") + " " + FormatFullVersion() + "\n\n" +
|
||||
std::string strUsage = strprintf(_("%s dash-tx utility version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n\n" +
|
||||
_("Usage:") + "\n" +
|
||||
" dash-tx [options] <hex-tx> [commands] " + _("Update hex-encoded dash transaction") + "\n" +
|
||||
" dash-tx [options] -create [commands] " + _("Create hex-encoded dash transaction") + "\n" +
|
||||
|
@ -4,6 +4,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/dash-config.h"
|
||||
#endif
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "clientversion.h"
|
||||
#include "rpc/server.h"
|
||||
@ -14,6 +18,7 @@
|
||||
#include "masternodeconfig.h"
|
||||
#include "httpserver.h"
|
||||
#include "httprpc.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@ -75,16 +80,16 @@ bool AppInit(int argc, char* argv[])
|
||||
// Process help and version before taking care about datadir
|
||||
if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version"))
|
||||
{
|
||||
std::string strUsage = _("Dash Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";
|
||||
std::string strUsage = strprintf(_("%s Daemon"), _(PACKAGE_NAME)) + " " + _("version") + " " + FormatFullVersion() + "\n";
|
||||
|
||||
if (mapArgs.count("-version"))
|
||||
{
|
||||
strUsage += LicenseInfo();
|
||||
strUsage += FormatParagraph(LicenseInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
strUsage += "\n" + _("Usage:") + "\n" +
|
||||
" dashd [options] " + _("Start Dash Core Daemon") + "\n";
|
||||
" dashd [options] " + strprintf(_("Start %s Daemon"), _(PACKAGE_NAME)) + "\n";
|
||||
|
||||
strUsage += "\n" + HelpMessage(HMM_BITCOIND);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
|
||||
governance.UpdatedBlockTip(pindexNew, connman);
|
||||
}
|
||||
|
||||
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
|
||||
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, const CBlock *pblock)
|
||||
{
|
||||
instantsend.SyncTransaction(tx, pblock);
|
||||
CPrivateSend::SyncTransaction(tx, pblock);
|
||||
|
@ -21,7 +21,7 @@ protected:
|
||||
void AcceptedBlockHeader(const CBlockIndex *pindexNew) override;
|
||||
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload) override;
|
||||
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
|
||||
void SyncTransaction(const CTransaction &tx, const CBlock *pblock) override;
|
||||
void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, const CBlock *pblock);
|
||||
|
||||
private:
|
||||
CConnman& connman;
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (c) 2015 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 "httprpc.h"
|
||||
|
||||
#include "base58.h"
|
||||
@ -231,7 +235,7 @@ bool StartHTTPRPC()
|
||||
|
||||
assert(EventBase());
|
||||
httpRPCTimerInterface = new HTTPRPCTimerInterface(EventBase());
|
||||
RPCRegisterTimerInterface(httpRPCTimerInterface);
|
||||
RPCSetTimerInterface(httpRPCTimerInterface);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -245,7 +249,7 @@ void StopHTTPRPC()
|
||||
LogPrint("rpc", "Stopping HTTP RPC server\n");
|
||||
UnregisterHTTPHandler("/", true);
|
||||
if (httpRPCTimerInterface) {
|
||||
RPCUnregisterTimerInterface(httpRPCTimerInterface);
|
||||
RPCUnsetTimerInterface(httpRPCTimerInterface);
|
||||
delete httpRPCTimerInterface;
|
||||
httpRPCTimerInterface = 0;
|
||||
}
|
||||
|
76
src/init.cpp
76
src/init.cpp
@ -38,7 +38,6 @@
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
#include "utilmoneystr.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "validationinterface.h"
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/db.h"
|
||||
@ -103,6 +102,8 @@ static const bool DEFAULT_REST_ENABLE = false;
|
||||
static const bool DEFAULT_DISABLE_SAFEMODE = false;
|
||||
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
|
||||
|
||||
static const char * const DEFAULT_WALLET_DAT = "wallet.dat";
|
||||
|
||||
std::unique_ptr<CConnman> g_connman;
|
||||
std::unique_ptr<PeerLogicValidation> peerLogic;
|
||||
|
||||
@ -390,7 +391,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
||||
// Do not translate _(...) -help-debug options, Many technical terms, and only a very small audience, so is unnecessary stress to translators.
|
||||
string strUsage = HelpMessageGroup(_("Options:"));
|
||||
strUsage += HelpMessageOpt("-?", _("This help message"));
|
||||
strUsage += HelpMessageOpt("-?", _("Print this help message and exit"));
|
||||
strUsage += HelpMessageOpt("-version", _("Print version and exit"));
|
||||
strUsage += HelpMessageOpt("-alerts", strprintf(_("Receive and display P2P network alerts (default: %u)"), DEFAULT_ALERTS));
|
||||
strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
|
||||
@ -449,9 +450,9 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
|
||||
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
|
||||
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG));
|
||||
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), DEFAULT_PEERBLOOMFILTERS));
|
||||
if (showDebug)
|
||||
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0));
|
||||
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", DEFAULT_ENFORCENODEBLOOM));
|
||||
strUsage += HelpMessageOpt("-port=<port>", strprintf(_("Listen for connections on <port> (default: %u or testnet: %u)"), Params(CBaseChainParams::MAIN).GetDefaultPort(), Params(CBaseChainParams::TESTNET).GetDefaultPort()));
|
||||
strUsage += HelpMessageOpt("-proxy=<ip:port>", _("Connect through SOCKS5 proxy"));
|
||||
strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), DEFAULT_PROXYRANDOMIZE));
|
||||
@ -488,14 +489,12 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), DEFAULT_SEND_FREE_TRANSACTIONS));
|
||||
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
|
||||
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
|
||||
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)));
|
||||
strUsage += HelpMessageOpt("-usehd", _("Use hierarchical deterministic key generation (HD) after bip39/bip44. Only has effect during wallet creation/first start") + " " + strprintf(_("(default: %u)"), DEFAULT_USE_HD_WALLET));
|
||||
strUsage += HelpMessageOpt("-mnemonic", _("User defined mnemonic for HD wallet (bip39). Only has effect during wallet creation/first start (default: randomly generated)"));
|
||||
strUsage += HelpMessageOpt("-mnemonicpassphrase", _("User defined mnemonic passphrase for HD wallet (bip39). Only has effect during wallet creation/first start (default: empty string)"));
|
||||
strUsage += HelpMessageOpt("-hdseed", _("User defined seed for HD wallet (should be in hex). Only has effect during wallet creation/first start (default: randomly generated)"));
|
||||
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
|
||||
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat"));
|
||||
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT));
|
||||
strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), DEFAULT_WALLETBROADCAST));
|
||||
strUsage += HelpMessageOpt("-walletnotify=<cmd>", _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
|
||||
strUsage += HelpMessageOpt("-zapwallettxes=<mode>", _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") +
|
||||
@ -567,9 +566,12 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", DEFAULT_LIMITFREERELAY));
|
||||
strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", DEFAULT_RELAYPRIORITY));
|
||||
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE));
|
||||
strUsage += HelpMessageOpt("-maxtipage=<n>", strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)));
|
||||
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction or raw transaction; setting this too low may abort large transactions (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)));
|
||||
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
|
||||
strUsage += HelpMessageOpt("-printtodebuglog", strprintf(_("Send trace/debug info to debug.log file (default: %u)"), 1));
|
||||
if (showDebug)
|
||||
@ -641,15 +643,13 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
std::string LicenseInfo()
|
||||
{
|
||||
// todo: remove urls from translations on next change
|
||||
return FormatParagraph(strprintf(_("Copyright (C) 2009-%i The Bitcoin Core Developers"), COPYRIGHT_YEAR)) + "\n" +
|
||||
return CopyrightHolders(_("Copyright (C)"), 2014, COPYRIGHT_YEAR) + "\n" +
|
||||
"\n" +
|
||||
FormatParagraph(strprintf(_("Copyright (C) 2014-%i The Dash Core Developers"), COPYRIGHT_YEAR)) + "\n" +
|
||||
_("This is experimental software.") + "\n" +
|
||||
"\n" +
|
||||
FormatParagraph(_("This is experimental software.")) + "\n" +
|
||||
_("Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.") + "\n" +
|
||||
"\n" +
|
||||
FormatParagraph(_("Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.")) + "\n" +
|
||||
"\n" +
|
||||
FormatParagraph(_("This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.")) +
|
||||
_("This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.") +
|
||||
"\n";
|
||||
}
|
||||
|
||||
@ -941,6 +941,16 @@ void InitParameterInteraction()
|
||||
}
|
||||
}
|
||||
|
||||
static std::string ResolveErrMsg(const char * const optname, const std::string& strBind)
|
||||
{
|
||||
return strprintf(_("Cannot resolve -%s address: '%s'"), optname, strBind);
|
||||
}
|
||||
|
||||
static std::string AmountErrMsg(const char * const optname, const std::string& strValue)
|
||||
{
|
||||
return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, strValue);
|
||||
}
|
||||
|
||||
void InitLogging()
|
||||
{
|
||||
fPrintToConsole = GetBoolArg("-printtoconsole", false);
|
||||
@ -1117,6 +1127,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
bool fDisableWallet = GetBoolArg("-disablewallet", false);
|
||||
if (!fDisableWallet)
|
||||
walletRegisterRPCCommands();
|
||||
#endif
|
||||
|
||||
nConnectTimeout = GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
|
||||
@ -1135,7 +1147,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
if (ParseMoney(mapArgs["-minrelaytxfee"], n) && n > 0)
|
||||
::minRelayTxFee = CFeeRate(n);
|
||||
else
|
||||
return InitError(strprintf(_("Invalid amount for -minrelaytxfee=<amount>: '%s'"), mapArgs["-minrelaytxfee"]));
|
||||
return InitError(AmountErrMsg("minrelaytxfee", mapArgs["-minrelaytxfee"]));
|
||||
}
|
||||
|
||||
fRequireStandard = !GetBoolArg("-acceptnonstdtxn", !Params().RequireStandard());
|
||||
@ -1150,14 +1162,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0)
|
||||
CWallet::minTxFee = CFeeRate(n);
|
||||
else
|
||||
return InitError(strprintf(_("Invalid amount for -mintxfee=<amount>: '%s'"), mapArgs["-mintxfee"]));
|
||||
return InitError(AmountErrMsg("mintxfee", mapArgs["-mintxfee"]));
|
||||
}
|
||||
if (mapArgs.count("-fallbackfee"))
|
||||
{
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(mapArgs["-fallbackfee"], nFeePerK))
|
||||
return InitError(strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), mapArgs["-fallbackfee"]));
|
||||
if (nFeePerK > nHighTransactionFeeWarning)
|
||||
return InitError(AmountErrMsg("fallbackfee", mapArgs["-fallbackfee"]));
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||
InitWarning(_("-fallbackfee is set very high! This is the transaction fee you may pay when fee estimates are not available."));
|
||||
CWallet::fallbackFee = CFeeRate(nFeePerK);
|
||||
}
|
||||
@ -1165,8 +1177,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
{
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
|
||||
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"]));
|
||||
if (nFeePerK > nHighTransactionFeeWarning)
|
||||
return InitError(AmountErrMsg("paytxfee", mapArgs["-paytxfee"]));
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||
InitWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
|
||||
payTxFee = CFeeRate(nFeePerK, 1000);
|
||||
if (payTxFee < ::minRelayTxFee)
|
||||
@ -1179,8 +1191,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
|
||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s'"), mapArgs["-maxtxfee"]));
|
||||
if (nMaxFee > nHighTransactionMaxFeeWarning)
|
||||
return InitError(AmountErrMsg("maxtxfee", mapArgs["-maxtxfee"]));
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
maxTxFee = nMaxFee;
|
||||
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
||||
@ -1193,7 +1205,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
|
||||
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", DEFAULT_SEND_FREE_TRANSACTIONS);
|
||||
|
||||
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
|
||||
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
|
||||
@ -1208,9 +1220,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
ServiceFlags nLocalServices = NODE_NETWORK;
|
||||
ServiceFlags nRelevantServices = NODE_NETWORK;
|
||||
|
||||
if (GetBoolArg("-peerbloomfilters", true))
|
||||
if (GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
|
||||
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
|
||||
|
||||
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||
|
||||
fEnableReplacement = GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
|
||||
if ((!fEnableReplacement) && mapArgs.count("-mempoolreplacement")) {
|
||||
// Minimal effort at forwards compatibility
|
||||
@ -1231,7 +1245,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
// Sanity check
|
||||
if (!InitSanityCheck())
|
||||
return InitError(_("Initialization sanity check failed. Dash Core is shutting down."));
|
||||
return InitError(strprintf(_("Initialization sanity check failed. %s is shutting down."), _(PACKAGE_NAME)));
|
||||
|
||||
std::string strDataDir = GetDataDir().string();
|
||||
#ifdef ENABLE_WALLET
|
||||
@ -1248,9 +1262,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
||||
// Wait maximum 10 seconds if an old wallet is still running. Avoids lockup during restart
|
||||
if (!lock.timed_lock(boost::get_system_time() + boost::posix_time::seconds(10)))
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Dash Core is probably already running."), strDataDir));
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), strDataDir, _(PACKAGE_NAME)));
|
||||
} catch(const boost::interprocess::interprocess_exception& e) {
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Dash Core is probably already running.") + " %s.", strDataDir, e.what()));
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running.") + " %s.", strDataDir, _(PACKAGE_NAME), e.what()));
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
@ -1442,13 +1456,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-bind"]) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
|
||||
return InitError(strprintf(_("Cannot resolve -bind address: '%s'"), strBind));
|
||||
return InitError(ResolveErrMsg("bind", strBind));
|
||||
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
|
||||
}
|
||||
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-whitebind"]) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, 0, false))
|
||||
return InitError(strprintf(_("Cannot resolve -whitebind address: '%s'"), strBind));
|
||||
return InitError(ResolveErrMsg("whitebind", strBind));
|
||||
if (addrBind.GetPort() == 0)
|
||||
return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind));
|
||||
fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST));
|
||||
@ -1470,7 +1484,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
if (Lookup(strAddr.c_str(), addrLocal, GetListenPort(), fNameLookup) && addrLocal.IsValid())
|
||||
AddLocal(addrLocal, LOCAL_MANUAL);
|
||||
else
|
||||
return InitError(strprintf(_("Cannot resolve -externalip address: '%s'"), strAddr));
|
||||
return InitError(ResolveErrMsg("externalip", strAddr));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1713,10 +1727,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
" or address book entries might be missing or incorrect."));
|
||||
}
|
||||
else if (nLoadWalletRet == DB_TOO_NEW)
|
||||
strErrors << _("Error loading wallet.dat: Wallet requires newer version of Dash Core") << "\n";
|
||||
strErrors << strprintf(_("Error loading wallet.dat: Wallet requires newer version of %s"), _(PACKAGE_NAME)) << "\n";
|
||||
else if (nLoadWalletRet == DB_NEED_REWRITE)
|
||||
{
|
||||
strErrors << _("Wallet needed to be rewritten: restart Dash Core to complete") << "\n";
|
||||
strErrors << strprintf(_("Wallet needed to be rewritten: restart %s to complete"), _(PACKAGE_NAME)) << "\n";
|
||||
LogPrintf("%s", strErrors.str());
|
||||
return InitError(strErrors.str());
|
||||
}
|
||||
|
@ -999,6 +999,7 @@ bool CConnman::AttemptToEvictConnection()
|
||||
// Reduce to the network group with the most connections
|
||||
std::vector<NodeEvictionCandidate> vEvictionNodes = mapAddrCounts[naMostConnections];
|
||||
|
||||
// Do not disconnect peers if there is only 1 connection from their network group
|
||||
if(vEvictionNodes.empty()) {
|
||||
return false;
|
||||
}
|
||||
@ -2032,7 +2033,7 @@ bool CConnman::BindListenPort(const CService &addrBind, std::string& strError, b
|
||||
{
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEADDRINUSE)
|
||||
strError = strprintf(_("Unable to bind to %s on this computer. Dash Core is probably already running."), addrBind.ToString());
|
||||
strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToString(), _(PACKAGE_NAME));
|
||||
else
|
||||
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToString(), NetworkErrorString(nErr));
|
||||
LogPrintf("%s\n", strError);
|
||||
|
@ -88,7 +88,7 @@ namespace {
|
||||
* million to make it highly unlikely for users to have issues with this
|
||||
* filter.
|
||||
*
|
||||
* Memory used: 1.7MB
|
||||
* Memory used: 1.3MB
|
||||
*/
|
||||
boost::scoped_ptr<CRollingBloomFilter> recentRejects;
|
||||
uint256 hashRecentRejectsChainTip;
|
||||
@ -1096,7 +1096,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return false;
|
||||
} else if (GetBoolArg("-enforcenodebloom", false)) {
|
||||
} else if (GetBoolArg("-enforcenodebloom", DEFAULT_ENFORCENODEBLOOM)) {
|
||||
pfrom->fDisconnect = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2013-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -23,9 +23,6 @@
|
||||
* 2. P2SH scripts with a crazy number of expensive
|
||||
* CHECKSIG/CHECKMULTISIG operations
|
||||
*
|
||||
* Check transaction inputs, and make sure any
|
||||
* pay-to-script-hash transactions are evaluating IsStandard scripts
|
||||
*
|
||||
* Why bother? To avoid denial-of-service attacks; an attacker
|
||||
* can submit a standard HASH... OP_EQUAL transaction,
|
||||
* which will get accepted into blocks. The redemption
|
||||
|
44
src/pow.cpp
44
src/pow.cpp
@ -10,7 +10,6 @@
|
||||
#include "chainparams.h"
|
||||
#include "primitives/block.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -191,7 +190,6 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
|
||||
|
||||
// Limit adjustment step
|
||||
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
|
||||
LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);
|
||||
if (nActualTimespan < params.nPowTargetTimespan/4)
|
||||
nActualTimespan = params.nPowTargetTimespan/4;
|
||||
if (nActualTimespan > params.nPowTargetTimespan*4)
|
||||
@ -209,12 +207,6 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
|
||||
if (bnNew > bnPowLimit)
|
||||
bnNew = bnPowLimit;
|
||||
|
||||
/// debug print
|
||||
LogPrintf("GetNextWorkRequired RETARGET\n");
|
||||
LogPrintf("params.nPowTargetTimespan = %d nActualTimespan = %d\n", params.nPowTargetTimespan, nActualTimespan);
|
||||
LogPrintf("Before: %08x %s\n", pindexLast->nBits, bnOld.ToString());
|
||||
LogPrintf("After: %08x %s\n", bnNew.GetCompact(), bnNew.ToString());
|
||||
|
||||
return bnNew.GetCompact();
|
||||
}
|
||||
|
||||
@ -228,43 +220,11 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&
|
||||
|
||||
// Check range
|
||||
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
|
||||
return error("CheckProofOfWork(): nBits below minimum work");
|
||||
return false;
|
||||
|
||||
// Check proof of work matches claimed amount
|
||||
if (UintToArith256(hash) > bnTarget)
|
||||
return error("CheckProofOfWork(): hash doesn't match nBits");
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
arith_uint256 GetBlockProof(const CBlockIndex& block)
|
||||
{
|
||||
arith_uint256 bnTarget;
|
||||
bool fNegative;
|
||||
bool fOverflow;
|
||||
bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow);
|
||||
if (fNegative || fOverflow || bnTarget == 0)
|
||||
return 0;
|
||||
// We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256
|
||||
// as it's too large for a arith_uint256. However, as 2**256 is at least as large
|
||||
// as bnTarget+1, it is equal to ((2**256 - bnTarget - 1) / (bnTarget+1)) + 1,
|
||||
// or ~bnTarget / (nTarget+1) + 1.
|
||||
return (~bnTarget / (bnTarget + 1)) + 1;
|
||||
}
|
||||
|
||||
int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params& params)
|
||||
{
|
||||
arith_uint256 r;
|
||||
int sign = 1;
|
||||
if (to.nChainWork > from.nChainWork) {
|
||||
r = to.nChainWork - from.nChainWork;
|
||||
} else {
|
||||
r = from.nChainWork - to.nChainWork;
|
||||
sign = -1;
|
||||
}
|
||||
r = r * arith_uint256(params.nPowTargetSpacing) / GetBlockProof(tip);
|
||||
if (r.bits() > 63) {
|
||||
return sign * std::numeric_limits<int64_t>::max();
|
||||
}
|
||||
return sign * r.GetLow64();
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
class CBlockHeader;
|
||||
class CBlockIndex;
|
||||
class uint256;
|
||||
class arith_uint256;
|
||||
|
||||
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params&);
|
||||
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params&);
|
||||
@ -21,9 +20,5 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
|
||||
|
||||
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
||||
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&);
|
||||
arith_uint256 GetBlockProof(const CBlockIndex& block);
|
||||
|
||||
/** Return the time it would take to redo the work difference between from and to, assuming the current hashrate corresponds to the difficulty at tip, in seconds. */
|
||||
int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& from, const CBlockIndex& tip, const Consensus::Params&);
|
||||
|
||||
#endif // BITCOIN_POW_H
|
||||
|
@ -1,3 +1,7 @@
|
||||
// Copyright (c) 2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef _BITCOIN_PREVECTOR_H_
|
||||
#define _BITCOIN_PREVECTOR_H_
|
||||
|
||||
|
@ -3,6 +3,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/dash-config.h"
|
||||
#endif
|
||||
|
||||
#include "askpassphrasedialog.h"
|
||||
#include "ui_askpassphrasedialog.h"
|
||||
|
||||
@ -122,9 +126,9 @@ void AskPassphraseDialog::accept()
|
||||
{
|
||||
QMessageBox::warning(this, tr("Wallet encrypted"),
|
||||
"<qt>" +
|
||||
tr("Dash Core will close now to finish the encryption process. "
|
||||
tr("%1 will close now to finish the encryption process. "
|
||||
"Remember that encrypting your wallet cannot fully protect "
|
||||
"your dashs from being stolen by malware infecting your computer.") +
|
||||
"your dashs from being stolen by malware infecting your computer.").arg(tr(PACKAGE_NAME)) +
|
||||
"<br><br><b>" +
|
||||
tr("IMPORTANT: Any previous backups you have made of your wallet file "
|
||||
"should be replaced with the newly generated, encrypted wallet file. "
|
||||
|
@ -3,6 +3,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/dash-config.h"
|
||||
#endif
|
||||
|
||||
#include "bitcoingui.h"
|
||||
|
||||
#include "bitcoinunits.h"
|
||||
@ -127,7 +131,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
|
||||
|
||||
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
|
||||
|
||||
QString windowTitle = tr("Dash Core") + " - ";
|
||||
QString windowTitle = tr(PACKAGE_NAME) + " - ";
|
||||
#ifdef ENABLE_WALLET
|
||||
/* if compiled with wallet support, -disablewallet can still disable the wallet */
|
||||
enableWallet = !GetBoolArg("-disablewallet", false);
|
||||
@ -374,7 +378,7 @@ void BitcoinGUI::createActions()
|
||||
quitAction->setStatusTip(tr("Quit application"));
|
||||
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
|
||||
quitAction->setMenuRole(QAction::QuitRole);
|
||||
aboutAction = new QAction(QIcon(":/icons/" + theme + "/about"), tr("&About Dash Core"), this);
|
||||
aboutAction = new QAction(QIcon(":/icons/" + theme + "/about"), tr("&About %1").arg(tr(PACKAGE_NAME)), this);
|
||||
aboutAction->setStatusTip(tr("Show information about Dash Core"));
|
||||
aboutAction->setMenuRole(QAction::AboutRole);
|
||||
aboutAction->setEnabled(false);
|
||||
@ -382,7 +386,7 @@ void BitcoinGUI::createActions()
|
||||
aboutQtAction->setStatusTip(tr("Show information about Qt"));
|
||||
aboutQtAction->setMenuRole(QAction::AboutQtRole);
|
||||
optionsAction = new QAction(QIcon(":/icons/" + theme + "/options"), tr("&Options..."), this);
|
||||
optionsAction->setStatusTip(tr("Modify configuration options for Dash Core"));
|
||||
optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(tr(PACKAGE_NAME)));
|
||||
optionsAction->setMenuRole(QAction::PreferencesRole);
|
||||
optionsAction->setEnabled(false);
|
||||
toggleHideAction = new QAction(QIcon(":/icons/" + theme + "/about"), tr("&Show / Hide"), this);
|
||||
@ -436,7 +440,7 @@ void BitcoinGUI::createActions()
|
||||
|
||||
showHelpMessageAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Command-line options"), this);
|
||||
showHelpMessageAction->setMenuRole(QAction::NoRole);
|
||||
showHelpMessageAction->setStatusTip(tr("Show the Dash Core help message to get a list with possible Dash Core command-line options"));
|
||||
showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Bitcoin command-line options").arg(tr(PACKAGE_NAME)));
|
||||
|
||||
showPrivateSendHelpAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&PrivateSend information"), this);
|
||||
showPrivateSendHelpAction->setMenuRole(QAction::NoRole);
|
||||
@ -722,7 +726,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
|
||||
void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle)
|
||||
{
|
||||
trayIcon = new QSystemTrayIcon(this);
|
||||
QString toolTip = tr("Dash Core client") + " " + networkStyle->getTitleAddText();
|
||||
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText();
|
||||
trayIcon->setToolTip(toolTip);
|
||||
trayIcon->setIcon(networkStyle->getTrayAndWindowIcon());
|
||||
trayIcon->hide();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -626,14 +626,14 @@ int main(int argc, char *argv[])
|
||||
/// - Do not call GetDataDir(true) before this step finishes
|
||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||
{
|
||||
QMessageBox::critical(0, QObject::tr("Dash Core"),
|
||||
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
|
||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
try {
|
||||
ReadConfigFile(mapArgs, mapMultiArgs);
|
||||
} catch (const std::exception& e) {
|
||||
QMessageBox::critical(0, QObject::tr("Dash Core"),
|
||||
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
|
||||
QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@ -648,7 +648,7 @@ int main(int argc, char *argv[])
|
||||
try {
|
||||
SelectParams(ChainNameFromCommandLine());
|
||||
} catch(std::exception &e) {
|
||||
QMessageBox::critical(0, QObject::tr("Dash Core"), QObject::tr("Error: %1").arg(e.what()));
|
||||
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#ifdef ENABLE_WALLET
|
||||
@ -716,7 +716,7 @@ int main(int argc, char *argv[])
|
||||
app.createWindow(networkStyle.data());
|
||||
app.requestInitialize();
|
||||
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
|
||||
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("Dash Core didn't yet exit safely..."), (HWND)app.getMainWinId());
|
||||
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId());
|
||||
#endif
|
||||
app.exec();
|
||||
app.requestShutdown();
|
||||
|
@ -1,4 +1,7 @@
|
||||
|
||||
// Copyright (c) 2013-2015 The Bitcoin Core developers
|
||||
// Copyright (c) 2014-2017 The Dash Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2014-2017 The Dash Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
@ -406,7 +406,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="openDebugLogfileButton">
|
||||
<property name="toolTip">
|
||||
<string>Open the Dash Core debug log file from the current data directory. This can take a few seconds for large log files.</string>
|
||||
<string>Open the %1 debug log file from the current data directory. This can take a few seconds for large log files.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Open</string>
|
||||
@ -896,6 +896,9 @@
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -957,6 +960,9 @@
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -16,9 +16,6 @@
|
||||
<height>500</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Dash Core - Command-line options</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
|
@ -15,12 +15,12 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="welcomeLabel">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { font-style:italic; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Welcome to Dash Core.</string>
|
||||
<string>Welcome to %1.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@ -44,9 +44,9 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="storageLabel">
|
||||
<property name="text">
|
||||
<string>As this is the first time the program is launched, you can choose where Dash Core will store its data.</string>
|
||||
<string>As this is the first time the program is launched, you can choose where %1 will store its data.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@ -56,7 +56,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="sizeWarningLabel">
|
||||
<property name="text">
|
||||
<string>Dash Core will download and store a copy of the Dash block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</string>
|
||||
<string>%1 will download and store a copy of the Dash block chain. At least %2GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -30,10 +30,10 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="bitcoinAtStartup">
|
||||
<property name="toolTip">
|
||||
<string>Automatically start Dash Core after logging in to the system.</string>
|
||||
<string>Automatically start %1 after logging in to the system.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Start Dash Core on system login</string>
|
||||
<string>&Start %1 on system login</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -681,7 +681,7 @@
|
||||
<item>
|
||||
<widget class="QValueComboBox" name="lang">
|
||||
<property name="toolTip">
|
||||
<string>The user interface language can be set here. This setting will take effect after restarting Dash Core.</string>
|
||||
<string>The user interface language can be set here. This setting will take effect after restarting %1.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -3,6 +3,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/dash-config.h"
|
||||
#endif
|
||||
|
||||
#include "intro.h"
|
||||
#include "ui_intro.h"
|
||||
|
||||
@ -119,11 +123,13 @@ Intro::Intro(QWidget *parent) :
|
||||
signalled(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->welcomeLabel->setText(ui->welcomeLabel->text().arg(tr(PACKAGE_NAME)));
|
||||
ui->storageLabel->setText(ui->storageLabel->text().arg(tr(PACKAGE_NAME)));
|
||||
uint64_t pruneTarget = std::max<int64_t>(0, GetArg("-prune", 0));
|
||||
requiredSpace = BLOCK_CHAIN_SIZE;
|
||||
if (pruneTarget)
|
||||
requiredSpace = CHAIN_STATE_SIZE + std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES);
|
||||
ui->sizeWarningLabel->setText(ui->sizeWarningLabel->text().arg(requiredSpace));
|
||||
ui->sizeWarningLabel->setText(ui->sizeWarningLabel->text().arg(tr(PACKAGE_NAME)).arg(requiredSpace));
|
||||
startThread();
|
||||
}
|
||||
|
||||
@ -194,7 +200,7 @@ void Intro::pickDataDirectory()
|
||||
TryCreateDirectory(GUIUtil::qstringToBoostPath(dataDir));
|
||||
break;
|
||||
} catch (const fs::filesystem_error&) {
|
||||
QMessageBox::critical(0, tr("Dash Core"),
|
||||
QMessageBox::critical(0, tr(PACKAGE_NAME),
|
||||
tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir));
|
||||
/* fall through, back to choosing screen */
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user