Compare commits
203
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05381f2f5b | ||
|
|
61a024e182 | ||
|
|
cf42fa1566 | ||
|
|
64f228ebbb | ||
|
|
cd772f57ff | ||
|
|
559319048b | ||
|
|
d432936543 | ||
|
|
3fa6588657 | ||
|
|
63d72460c0 | ||
|
|
141f1400dc | ||
|
|
90afa72147 | ||
|
|
3d9e8f595f | ||
|
|
cce0fde619 | ||
|
|
41417bf469 | ||
|
|
09e2ba2d68 | ||
|
|
c18f0ed8ea | ||
|
|
9a67b514c9 | ||
|
|
8d955fdd22 | ||
|
|
24269e177f | ||
|
|
36ccf3e903 | ||
|
|
c751b27e54 | ||
|
|
f2462c74b3 | ||
|
|
4a4c091c55 | ||
|
|
7eddd19521 | ||
|
|
9cb4064adb | ||
|
|
5a393f5b14 | ||
|
|
ffe68d634f | ||
|
|
e560834489 | ||
|
|
141e583cce | ||
|
|
c7cabf0e96 | ||
|
|
21f065aff9 | ||
|
|
40a3668c97 | ||
|
|
a08967a572 | ||
|
|
c165df198d | ||
|
|
b5a4abeca2 | ||
|
|
05fb9f7fbb | ||
|
|
6cf81b01b4 | ||
|
|
fe95f84542 | ||
|
|
2e9e904a5d | ||
|
|
22cdb6cf59 | ||
|
|
f20513bd71 | ||
|
|
85c6263ddb | ||
|
|
f22d02f537 | ||
|
|
0a9af2d4cb | ||
|
|
7751ea37b6 | ||
|
|
caf1146b13 | ||
|
|
34da2b7c76 | ||
|
|
8965b6ab47 | ||
|
|
16e5759455 | ||
|
|
21693ff0b7 | ||
|
|
1c98a758d0 | ||
|
|
435df68c62 | ||
|
|
048fda2a66 | ||
|
|
f455979eb1 | ||
|
|
392d1382c1 | ||
|
|
807add9f5d | ||
|
|
30db5cc641 | ||
|
|
09a9238c04 | ||
|
|
1220b91fa7 | ||
|
|
8418707286 | ||
|
|
c42f4177ce | ||
|
|
0cd9ad208c | ||
|
|
0a0b2ea11f | ||
|
|
59dd855d2d | ||
|
|
5ff7b372cd | ||
|
|
16521ce086 | ||
|
|
623a19bc2b | ||
|
|
27beb83222 | ||
|
|
c470bbd19d | ||
|
|
ac73c7d433 | ||
|
|
0c2fb87dc1 | ||
|
|
90347141bd | ||
|
|
4d4bc37df9 | ||
|
|
d2ed162ce0 | ||
|
|
298dc15686 | ||
|
|
fa941016e8 | ||
|
|
b138b4abff | ||
|
|
b4602e3240 | ||
|
|
fa0c76adee | ||
|
|
88c566a13f | ||
|
|
ddd008dbef | ||
|
|
fd616d8d08 | ||
|
|
e11856515e | ||
|
|
a057cc08fd | ||
|
|
ae1b6756c9 | ||
|
|
46c162df47 | ||
|
|
ef70f9b52b | ||
|
|
c6e4a1fca5 | ||
|
|
89a9a9d938 | ||
|
|
abae8aeff1 | ||
|
|
8b8b3a9a5f | ||
|
|
dcb032dcdf | ||
|
|
6042dfe008 | ||
|
|
75b5d8c4ea | ||
|
|
7a590d8390 | ||
|
|
5d12143c73 | ||
|
|
7bee41452b | ||
|
|
ff56bb9b44 | ||
|
|
db445d4e5a | ||
|
|
ad94165db9 | ||
|
|
39ece4fc28 | ||
|
|
70ee1f8709 | ||
|
|
a9eab081d5 | ||
|
|
cfdd6b2f6c | ||
|
|
a3fe125490 | ||
|
|
3362a95be3 | ||
|
|
924cf794e1 | ||
|
|
252844329f | ||
|
|
67225e2fd7 | ||
|
|
2a5cc40dc4 | ||
|
|
53dcf2b407 | ||
|
|
d8bc0ce1da | ||
|
|
f9db08e8ca | ||
|
|
79358817e5 | ||
|
|
9666dbaf09 | ||
|
|
b90157891a | ||
|
|
6f04264bbb | ||
|
|
5782fdcd8c | ||
|
|
de5e48a461 | ||
|
|
df5131bd41 | ||
|
|
9f556622c5 | ||
|
|
542651cfb4 | ||
|
|
ec71f06a8d | ||
|
|
7edebedef1 | ||
|
|
fb9ad043f8 | ||
|
|
91fa15aaeb | ||
|
|
96f15e8bb3 | ||
|
|
60f7a97930 | ||
|
|
2f9fd29321 | ||
|
|
5331ad0506 | ||
|
|
94065024c7 | ||
|
|
85aacc41ba | ||
|
|
bb90695551 | ||
|
|
5150accdd2 | ||
|
|
1e49fe450d | ||
|
|
b0e88b8914 | ||
|
|
0242b5afa4 | ||
|
|
9e87d82e7f | ||
|
|
76dd5257f9 | ||
|
|
f046d846ae | ||
|
|
1476554d3b | ||
|
|
f13041f17b | ||
|
|
f9fc08c5f8 | ||
|
|
dc4923a71b | ||
|
|
248e5ec348 | ||
|
|
eb2cc84a31 | ||
|
|
9461f98c53 | ||
|
|
703a24418c | ||
|
|
5f51fd6d59 | ||
|
|
29899ecd36 | ||
|
|
f7adb32e38 | ||
|
|
86fadee990 | ||
|
|
8bc1badada | ||
|
|
24d796a6cc | ||
|
|
168efeaca6 | ||
|
|
73e538cf6a | ||
|
|
96dc936862 | ||
|
|
7ff32a6b98 | ||
|
|
b72fbabe17 | ||
|
|
06544faff0 | ||
|
|
1b5af2c177 | ||
|
|
f7dbcaa72f | ||
|
|
89306ab0df | ||
|
|
5b47b8efd4 | ||
|
|
e1ed37edae | ||
|
|
786825c719 | ||
|
|
480d6bb078 | ||
|
|
c64128df58 | ||
|
|
0d49c82edd | ||
|
|
833180f538 | ||
|
|
fcefc6851a | ||
|
|
fcdea8ad2a | ||
|
|
465a583f9d | ||
|
|
eece974d0a | ||
|
|
0f681cecad | ||
|
|
eb202ea21d | ||
|
|
83aafd5b32 | ||
|
|
6ba1f15432 | ||
|
|
6bfee8a8c2 | ||
|
|
2936dbc557 | ||
|
|
2307a6eb2b | ||
|
|
5f71eac634 | ||
|
|
cf3d7f94c2 | ||
|
|
fab0fbefcf | ||
|
|
b5ec6d4bf8 | ||
|
|
3e4829af09 | ||
|
|
9833545d18 | ||
|
|
82e2b9cb25 | ||
|
|
65e7a8b97f | ||
|
|
c6d905746b | ||
|
|
1ffd67f11f | ||
|
|
48c845902a | ||
|
|
3d827bee69 | ||
|
|
4a2960f73e | ||
|
|
0333914467 | ||
|
|
8935869487 | ||
|
|
dbaadc9ea9 | ||
|
|
ad6d845ac9 | ||
|
|
517010e30e | ||
|
|
8c4cd2bd89 | ||
|
|
ff41e479a0 | ||
|
|
f0f745d8de | ||
|
|
cd2f4f35bb |
No files matched your search
+11
-8
@@ -1,13 +1,14 @@
|
||||
*.tar.gz
|
||||
|
||||
*.exe
|
||||
src/bitcoin
|
||||
src/bitcoind
|
||||
src/bitcoin-cli
|
||||
src/bitcoin-tx
|
||||
src/test/test_bitcoin
|
||||
src/test/test_bitcoin_fuzzy
|
||||
src/qt/test/test_bitcoin-qt
|
||||
src/lbrycrd
|
||||
src/lbrycrdd
|
||||
src/lbrycrd-cli
|
||||
src/lbrycrd-tx
|
||||
src/test/test_lbrycrd
|
||||
src/test/test_lbrycrd_fuzzy
|
||||
src/qt/lbrycrd-qt
|
||||
src/qt/test/test_lbrycrd-qt
|
||||
|
||||
# autoreconf
|
||||
Makefile.in
|
||||
@@ -61,7 +62,6 @@ src/qt/bitcoin-qt.includes
|
||||
*.pyc
|
||||
*.o
|
||||
*.o-*
|
||||
*.patch
|
||||
*.a
|
||||
*.pb.cc
|
||||
*.pb.h
|
||||
@@ -116,3 +116,6 @@ test/cache/*
|
||||
|
||||
libbitcoinconsensus.pc
|
||||
contrib/devtools/split-debug.sh
|
||||
|
||||
.idea
|
||||
cmake-build-*/
|
||||
+88
-157
@@ -1,166 +1,97 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
os: linux
|
||||
language: minimal
|
||||
filter_secrets: false
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- depends/built
|
||||
- depends/sdk-sources
|
||||
- $HOME/.ccache
|
||||
- ${HOME}/ccache
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
- test
|
||||
env:
|
||||
global:
|
||||
- MAKEJOBS=-j3
|
||||
- RUN_TESTS=false
|
||||
- RUN_BENCH=false # Set to true for any one job that has debug enabled, to quickly check bench is not crashing or hitting assertions
|
||||
- DOCKER_NAME_TAG=ubuntu:18.04
|
||||
- LC_ALL=C.UTF-8
|
||||
- BOOST_TEST_RANDOM=1$TRAVIS_BUILD_ID
|
||||
- CCACHE_SIZE=100M
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- CCACHE_COMPRESS=1
|
||||
- CCACHE_DIR=$HOME/.ccache
|
||||
- BASE_OUTDIR=$TRAVIS_BUILD_DIR/out
|
||||
- SDK_URL=https://bitcoincore.org/depends-sources/sdks
|
||||
- WINEDEBUG=fixme-all
|
||||
- DOCKER_PACKAGES="build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache"
|
||||
before_install:
|
||||
- export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g")
|
||||
- BEGIN_FOLD () { echo ""; CURRENT_FOLD_NAME=$1; echo "travis_fold:start:${CURRENT_FOLD_NAME}"; }
|
||||
- END_FOLD () { RET=$?; echo "travis_fold:end:${CURRENT_FOLD_NAME}"; return $RET; }
|
||||
install:
|
||||
- travis_retry docker pull $DOCKER_NAME_TAG
|
||||
- env | grep -E '^(CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL)' | tee /tmp/env
|
||||
- if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN"; fi
|
||||
- DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$TRAVIS_BUILD_DIR,dst=$TRAVIS_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $TRAVIS_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG)
|
||||
- DOCKER_EXEC () { docker exec $DOCKER_ID bash -c "cd $PWD && $*"; }
|
||||
- if [ -n "$DPKG_ADD_ARCH" ]; then DOCKER_EXEC dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi
|
||||
- travis_retry DOCKER_EXEC apt-get update
|
||||
- travis_retry DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES $DOCKER_PACKAGES
|
||||
before_script:
|
||||
- DOCKER_EXEC echo \> \$HOME/.bitcoin # Make sure default datadir does not exist and is never read by creating a dummy file
|
||||
- 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
|
||||
- if [[ $HOST = *-mingw32 ]]; then DOCKER_EXEC update-alternatives --set $HOST-g++ \$\(which $HOST-g++-posix\); fi
|
||||
- if [ -z "$NO_DEPENDS" ]; then DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS; fi
|
||||
script:
|
||||
- export TRAVIS_COMMIT_LOG=`git log --format=fuller -1`
|
||||
- OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST
|
||||
- BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib"
|
||||
- if [ -z "$NO_DEPENDS" ]; then DOCKER_EXEC ccache --max-size=$CCACHE_SIZE; fi
|
||||
- BEGIN_FOLD autogen; test -n "$CONFIG_SHELL" && DOCKER_EXEC "$CONFIG_SHELL" -c "./autogen.sh" || DOCKER_EXEC ./autogen.sh; END_FOLD
|
||||
- mkdir build && cd build
|
||||
- BEGIN_FOLD configure; DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false); END_FOLD
|
||||
- BEGIN_FOLD distdir; DOCKER_EXEC make distdir VERSION=$HOST; END_FOLD
|
||||
- cd bitcoin-$HOST
|
||||
- BEGIN_FOLD configure; DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false); END_FOLD
|
||||
- BEGIN_FOLD build; DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false ); END_FOLD
|
||||
- if [ "$RUN_TESTS" = "true" ]; then BEGIN_FOLD unit-tests; DOCKER_EXEC LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib make $MAKEJOBS check VERBOSE=1; END_FOLD; fi
|
||||
- if [ "$RUN_BENCH" = "true" ]; then BEGIN_FOLD bench; DOCKER_EXEC LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib $OUTDIR/bin/bench_bitcoin -scaling=0.001 ; END_FOLD; fi
|
||||
- if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then extended="--extended --exclude feature_pruning,feature_dbcrash"; fi
|
||||
- if [ "$RUN_TESTS" = "true" ]; then BEGIN_FOLD functional-tests; DOCKER_EXEC test/functional/test_runner.py --combinedlogslen=4000 --coverage --quiet --failfast ${extended}; END_FOLD; fi
|
||||
after_script:
|
||||
- echo $TRAVIS_COMMIT_RANGE
|
||||
- echo $TRAVIS_COMMIT_LOG
|
||||
- quality
|
||||
|
||||
jobs:
|
||||
include:
|
||||
# ARM
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=arm-linux-gnueabihf
|
||||
PACKAGES="g++-arm-linux-gnueabihf"
|
||||
DEP_OPTS="NO_QT=1"
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
|
||||
# Win32
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=i686-w64-mingw32
|
||||
DPKG_ADD_ARCH="i386"
|
||||
DEP_OPTS="NO_QT=1"
|
||||
PACKAGES="python3 nsis g++-mingw-w64-i686 wine-binfmt wine32"
|
||||
RUN_TESTS=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-reduce-exports"
|
||||
# Win64
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=x86_64-w64-mingw32
|
||||
DEP_OPTS="NO_QT=1"
|
||||
PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine-binfmt wine64"
|
||||
RUN_TESTS=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-reduce-exports"
|
||||
# 32-bit + dash
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=i686-pc-linux-gnu
|
||||
PACKAGES="g++-multilib python3-zmq"
|
||||
DEP_OPTS="NO_QT=1"
|
||||
RUN_TESTS=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++"
|
||||
CONFIG_SHELL="/bin/dash"
|
||||
# x86_64 Linux (uses qt5 dev package instead of depends Qt to speed up build and avoid timeout)
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=x86_64-unknown-linux-gnu
|
||||
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools protobuf-compiler libdbus-1-dev libharfbuzz-dev libprotobuf-dev"
|
||||
DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
|
||||
RUN_TESTS=true
|
||||
RUN_BENCH=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CXXFLAGS=\"-g0 -O2\""
|
||||
# x86_64 Linux (Qt5 & system libs)
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=x86_64-unknown-linux-gnu
|
||||
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
|
||||
NO_DEPENDS=1
|
||||
RUN_TESTS=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
|
||||
# x86_64 Linux, No wallet
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=x86_64-unknown-linux-gnu
|
||||
PACKAGES="python3"
|
||||
DEP_OPTS="NO_WALLET=1"
|
||||
RUN_TESTS=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
|
||||
# Cross-Mac
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=x86_64-apple-darwin14
|
||||
PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git"
|
||||
OSX_SDK=10.11
|
||||
GOAL="all deploy"
|
||||
BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --enable-werror"
|
||||
- stage: lint
|
||||
env:
|
||||
sudo: false
|
||||
cache: false
|
||||
language: python
|
||||
python: '3.6'
|
||||
|
||||
- &build-template
|
||||
stage: build
|
||||
name: linux
|
||||
env: NAME=linux EXT=
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: minimal
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
- travis_retry pip install flake8
|
||||
before_script:
|
||||
- git fetch --unshallow
|
||||
- mkdir -p ${HOME}/ccache
|
||||
- docker pull $DOCKER_BUILD_IMAGE
|
||||
script:
|
||||
- if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then test/lint/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi
|
||||
- test/lint/git-subtree-check.sh src/crypto/ctaes
|
||||
- test/lint/git-subtree-check.sh src/secp256k1
|
||||
- test/lint/git-subtree-check.sh src/univalue
|
||||
- test/lint/git-subtree-check.sh src/leveldb
|
||||
- test/lint/check-doc.py
|
||||
- test/lint/check-rpc-mappings.py .
|
||||
- test/lint/lint-all.sh
|
||||
- if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then
|
||||
while read LINE; do travis_retry gpg --keyserver hkp://subset.pool.sks-keyservers.net --recv-keys $LINE; done < contrib/verify-commits/trusted-keys &&
|
||||
travis_wait 50 contrib/verify-commits/verify-commits.py;
|
||||
fi
|
||||
- docker run -v "$(pwd):/lbrycrd" -v "${HOME}/ccache:/ccache" -w /lbrycrd -e CCACHE_DIR=/ccache ${DOCKER_IMAGE} packaging/build_${NAME}_64bit.sh
|
||||
before_deploy:
|
||||
- mkdir -p dist
|
||||
- sudo zip -Xj dist/lbrycrd-${NAME}.zip src/lbrycrdd${EXT} src/lbrycrd-cli${EXT} src/lbrycrd-tx${EXT}
|
||||
- sudo zip -Xj dist/lbrycrd-${NAME}-test.zip src/test/test_lbrycrd${EXT} src/test/test_lbrycrd_fuzzy${EXT}
|
||||
- sha256sum dist/lbrycrd-${NAME}.zip
|
||||
- sha256sum dist/lbrycrd-${NAME}-test.zip
|
||||
deploy:
|
||||
- provider: s3
|
||||
access_key_id: AKIAICKFHNTR5RITASAQ
|
||||
secret_access_key:
|
||||
secure: Qfgs8vGnEUvgiZNP2S9zY8qHEzaDOceF/XTv32jRBOISWfTqOTE56DZbOp8WKHPAqn0dx04jKA1NfV9f06sXU1NVbiJ2VYISo6XAk0n3RBJL3/mhNxvut/zM2DHkFPljWTkWEColS0ZyA3m4eUyJvAw/i+mOBT/zDD/oIlS5Uo5l/x3LmF9fYBuei0ucwSQeNOr2wCMIl+pXrIU7B3lEzXh1asayW6A9y7DOqMLnrSQ7TLlSssbnhuhDVpFx0xxX/U2NPraotbGKdo3wwMbms/lluBe60I/LsDNp9/SZXMDXh2YLGUImr97octwpdzIMjF+kU7QAZJzM7grz8PU9+MQh2V5sn6Xsww2x4PdkmHGz/2FMzhrCrlPf5JCaPBH49G+w4/29HYmMrlimOOVx4qXCpQ/XtWWne/d6MF0qqT6JhdPuD9ohmTpxcHRkCe2fxUw6Yn3dj+/+YoCywAcwcBm5jLpAotmWoCmmcnm9rvB7bIuPPZAjJUZViCnyvwY4Tj3Fb+sOuK4b/O5D2+cuS+WgQRkN/RspYlXrXTIh8Efv/yhW5L9WdzG1OExJDw2hX5VTccRRgIKZxZp80U2eYqn2M07+1nU+ShX4kgiSon46k5cfacLgzLKWEyCxWSSTbsYcwRxvDEjtYy4wxAYx8+J3dgQPs/opDXoQTJMjud0=
|
||||
bucket: build.lbry.io
|
||||
upload-dir: lbrycrd/${TRAVIS_BRANCH}
|
||||
acl: public_read
|
||||
local_dir: dist
|
||||
skip_cleanup: true
|
||||
on:
|
||||
repo: lbryio/lbrycrd
|
||||
all_branches: true
|
||||
|
||||
- <<: *build-template
|
||||
name: windows
|
||||
env: NAME=windows EXT=.exe
|
||||
|
||||
- <<: *build-template
|
||||
name: osx
|
||||
env: NAME=darwin EXT=
|
||||
before_install:
|
||||
- mkdir -p ./depends/SDKs && pushd depends/SDKs && curl -C - ${MAC_OS_SDK} | tar --skip-old-files -xJ && popd
|
||||
|
||||
- &test-template
|
||||
stage: test
|
||||
env: NAME=linux
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: minimal
|
||||
git:
|
||||
depth: 3
|
||||
install:
|
||||
- mkdir -p testrun && cd testrun
|
||||
- curl http://build.lbry.io/lbrycrd/${TRAVIS_BRANCH}/lbrycrd-${NAME}-test.zip -o temp.zip
|
||||
- unzip temp.zip
|
||||
script: ./test_lbrycrd
|
||||
|
||||
- <<: *test-template
|
||||
# os: windows # doesn't support secrets at the moment
|
||||
os: linux
|
||||
dist: xenial
|
||||
env: NAME=windows
|
||||
services:
|
||||
- docker
|
||||
script:
|
||||
- docker pull $DOCKER_WINE_IMAGE
|
||||
- docker run -v "$(pwd):/test" -e "WINEDEBUG=-all" -it $DOCKER_WINE_IMAGE wine "/test/test_lbrycrd.exe"
|
||||
|
||||
- <<: *test-template
|
||||
os: osx
|
||||
osx_image: xcode8.3
|
||||
env: NAME=darwin
|
||||
|
||||
|
||||
- stage: quality
|
||||
name: "check format"
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: minimal
|
||||
install:
|
||||
- sudo apt-get install -y clang-format-3.9
|
||||
script: git diff -U0 origin/master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1
|
||||
@@ -0,0 +1,15 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2019 LBRY Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in 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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
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 AUTHORS 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 IN THE SOFTWARE.
|
||||
+6
-1
@@ -19,12 +19,13 @@ endif
|
||||
BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT)
|
||||
BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT)
|
||||
BITCOIN_CLI_BIN=$(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT)
|
||||
BITCOIN_TX_BIN=$(top_builddir)/src/$(BITCOIN_TX_NAME)$(EXEEXT)
|
||||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
|
||||
OSX_APP=Bitcoin-Qt.app
|
||||
OSX_APP=LBRYcrd-Qt.app
|
||||
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
|
||||
OSX_DMG = $(OSX_VOLNAME).dmg
|
||||
OSX_BACKGROUND_SVG=background.svg
|
||||
@@ -74,6 +75,7 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release
|
||||
@test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \
|
||||
echo error: could not build $@
|
||||
@echo built $@
|
||||
@@ -167,6 +169,9 @@ $(BITCOIND_BIN): FORCE
|
||||
$(BITCOIN_CLI_BIN): FORCE
|
||||
$(MAKE) -C src $(@F)
|
||||
|
||||
$(BITCOIN_TX_BIN): FORCE
|
||||
$(MAKE) -C src $(@F)
|
||||
|
||||
if USE_LCOV
|
||||
LCOV_FILTER_PATTERN=-p "/usr/include/" -p "src/leveldb/" -p "src/bench/" -p "src/univalue" -p "src/crypto/ctaes" -p "src/secp256k1"
|
||||
|
||||
|
||||
@@ -1,76 +1,194 @@
|
||||
Bitcoin Core integration/staging tree
|
||||
=====================================
|
||||
# LBRYcrd - The LBRY blockchain
|
||||
|
||||
[](https://travis-ci.org/bitcoin/bitcoin)
|
||||
[](https://travis-ci.org/lbryio/lbrycrd)
|
||||
|
||||
https://bitcoincore.org
|
||||
LBRYcrd uses a blockchain similar to bitcoin's to implement an index and payment system for content on the LBRY network. It is a fork of bitcoin core. In addition to the libraries used by bitcoin, LBRYcrd also uses icu4c.
|
||||
|
||||
What is Bitcoin?
|
||||
----------------
|
||||
Please read the [lbry.tech overview](https://lbry.tech/overview) for a general understanding of the LBRY pieces. From there you could read the [LBRY spec](https://spec.lbry.com/) for specifics on the data in the blockchain.
|
||||
|
||||
Bitcoin is an experimental digital currency that enables instant payments to
|
||||
anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate
|
||||
with no central authority: managing transactions and issuing money are carried
|
||||
out collectively by the network. Bitcoin Core is the name of open source
|
||||
software which enables the use of this currency.
|
||||
## Installation
|
||||
|
||||
For more information, as well as an immediately useable, binary version of
|
||||
the Bitcoin Core software, see https://bitcoincore.org/en/download/, or read the
|
||||
[original whitepaper](https://bitcoincore.org/bitcoin.pdf).
|
||||
Latest binaries are available from https://github.com/lbryio/lbrycrd/releases. There is no installation procedure; the CLI binaries will run as-is and will have any uncommon dependencies statically linked into the binary. The QT GUI is not supported. LBRYcrd is distributed as a collection of executable files; traditional installers are not provided.
|
||||
|
||||
License
|
||||
-------
|
||||
## Usage
|
||||
|
||||
Bitcoin Core is released under the terms of the MIT license. See [COPYING](COPYING) for more
|
||||
information or see https://opensource.org/licenses/MIT.
|
||||
The `lbrycrdd` executable will start a LBRYcrd node and connect you to the LBRYcrd network. Use the `lbrycrd-cli` executable
|
||||
to interact with lbrycrdd through the command line. Command-line help for both executables are available through
|
||||
the "--help" flag (e.g. `lbrycrdd --help`). Examples:
|
||||
|
||||
Development Process
|
||||
-------------------
|
||||
#### Examples:
|
||||
|
||||
Run `./lbrycrdd -server -daemon` to start lbrycrdd in the background.
|
||||
|
||||
Run `./lbrycrd-cli getinfo` to check for some basic information about your LBRYcrd node.
|
||||
|
||||
Run `./lbrycrd-cli help` to get a list of all commands that you can run. To get help on specific commands run `./lbrycrd-cli [command_name] help`
|
||||
|
||||
Test locally:
|
||||
```
|
||||
./lbrycrdd -server -regtest -txindex # run this in its own window
|
||||
./lbrycrd-cli -regtest generate 120 # mine 20 spendable coins
|
||||
./lbrycrd-cli -regtest claimname my_name deadbeef 1 # hold a name claim with 1 coin
|
||||
./lbrycrd-cli -regtest generate 1 # get that claim into the block
|
||||
./lbrycrd-cli -regtest listnameclaims # show owned claims
|
||||
./lbrycrd-cli -regtest getclaimsforname my_name # show claims under that name
|
||||
./lbrycrd-cli -regtest stop # kill lbrycrdd
|
||||
rm -fr ~/.lbrycrd/regtest/ # destroy regtest data
|
||||
```
|
||||
For further understanding of a "regtest" setup, see the local stack setup instructions here: https://lbry.tech/resources/regtest-setup
|
||||
|
||||
The CLI help is also browsable online at https://lbry.tech/api/blockchain
|
||||
|
||||
#### Data directory:
|
||||
|
||||
Lbrycrdd will use the below default data directories (changeable with -datadir):
|
||||
|
||||
```
|
||||
Windows: %APPDATA%\lbrycrd
|
||||
Mac: ~/Library/Application Support/lbrycrd
|
||||
Unix: ~/.lbrycrd
|
||||
```
|
||||
The data directory contains various things such as your default wallet (wallet.dat), debug logs (debug.log), and blockchain data. You can optionally create a configuration file lbrycrd.conf in the default data directory which will be used by default when running lbrycrdd.
|
||||
|
||||
For a list of configuration parameters, run `./lbrycrdd --help`. Below is a sample lbrycrd.conf to enable JSON RPC server on lbrycrdd.
|
||||
|
||||
```
|
||||
rpcuser=lbry
|
||||
rpcpassword=xyz123456790
|
||||
daemon=1
|
||||
server=1
|
||||
txindex=1
|
||||
```
|
||||
|
||||
## Running from Source
|
||||
The easiest way to compile is to utilize the Docker image that contains the necessary compilers: lbry/build_lbrycrd. This will allow you to reproduce the build as made on our build servers. I this sample we map a local lbrycrd folder and a local ccache folder inside the image:
|
||||
```
|
||||
git clone https://github.com/lbryio/lbrycrd.git
|
||||
cd lbrycrd
|
||||
docker run -v "$(pwd):/lbrycrd" --rm -v "${HOME}/ccache:/ccache" -w /lbrycrd -e CCACHE_DIR=/ccache lbry/build_lbrycrd packaging/build_linux_64bit.sh
|
||||
```
|
||||
Some examples of compiling directly:
|
||||
#### Ubuntu with pulled static dependencies:
|
||||
```
|
||||
sudo apt install build-essential git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates
|
||||
git clone https://github.com/lbryio/lbrycrd.git
|
||||
cd lbrycrd
|
||||
./packaging/build_linux_64bit.sh
|
||||
./src/test/test_lbrycrd
|
||||
|
||||
```
|
||||
Other Linux distros would be similar. The build shell script is fairly trivial; take a peek at its contents.
|
||||
#### Ubuntu with local shared dependencies:
|
||||
Note: using untested dependencies may lead to conflicting results.
|
||||
```
|
||||
sudo add-apt-repository ppa:bitcoin/bitcoin
|
||||
sudo apt-get update
|
||||
sudo apt-get install libdb4.8-dev libdb4.8++-dev libicu-dev libssl-dev libevent-dev \
|
||||
build-essential git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates \
|
||||
libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev
|
||||
|
||||
# optionally include libminiupnpc-dev libzmq3-dev
|
||||
|
||||
git clone https://github.com/lbryio/lbrycrd.git
|
||||
cd lbrycrd
|
||||
./autogen.sh
|
||||
./configure --enable-static --disable-shared --with-pic --without-gui CXXFLAGS="-O3 -march=native"
|
||||
make -j$(nproc)
|
||||
./src/lbrycrdd -server ...
|
||||
|
||||
```
|
||||
#### MacOS (cross-compiled):
|
||||
```
|
||||
sudo apt-get install clang llvm git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates \
|
||||
libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev
|
||||
|
||||
git clone https://github.com/lbryio/lbrycrd.git
|
||||
cd lbrycrd
|
||||
# download MacOS SDK from your favorite source
|
||||
mkdir depends/SDKs
|
||||
tar ... extract SDK to depends/SDKs/MacOSX10.11.sdk
|
||||
./packaging/build_darwin_64bit.sh
|
||||
|
||||
```
|
||||
Look in packaging/build_darwin_64bit.sh for further understanding.
|
||||
#### MacOS with local shared dependencies:
|
||||
```
|
||||
brew install boost berkeley-db@4 icu4c libevent
|
||||
# fix conflict with gawk pulled first:
|
||||
brew reinstall readline
|
||||
brew reinstall gawk
|
||||
|
||||
git clone https://github.com/lbryio/lbrycrd.git
|
||||
cd lbrycrd/depends
|
||||
make NO_QT=1
|
||||
cd ..
|
||||
./autogen.sh
|
||||
CONFIG_SITE=$(pwd)/depends/x86_64-apple-darwin15.6.0/share/config.site ./configure --enable-static --disable-shared --with-pic --without-gui --enable-reduce-exports CXXFLAGS=-O2
|
||||
make -j$(sysctl -n hw.ncpu)
|
||||
|
||||
```
|
||||
#### Windows (cross-compiled):
|
||||
Compiling on MS Windows (outside of WSL) is not supported. The Windows build is cross-compiled from Linux like so:
|
||||
```
|
||||
sudo apt-get install build-essential git libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates \
|
||||
g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
|
||||
|
||||
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
||||
|
||||
git clone https://github.com/lbryio/lbrycrd.git
|
||||
cd lbrycrd
|
||||
./packaging/build_windows_64bit.sh
|
||||
|
||||
```
|
||||
|
||||
If you encounter any errors, please check `doc/build-*.md` for further instructions. If you're still stuck, [create an issue](https://github.com/lbryio/lbrycrd/issues/new) with the output of that command, your system info, and any other information you think might be helpful. The scripts in the packaging folder are simple and will grant extra light on the build process as needed.
|
||||
|
||||
#### Use with CLion:
|
||||
CLion has not traditionally supported Autotools projects, although some progress on that is now in the works. We do include a cmake build file for compiling lbrycrd. See contrib/cmake. Alas, CLion doesn't support external projects in cmake, so that particular approach is also insufficient. CLion does support "compile_commands.json" projects. Fortunately, this can be easily generated for lbrycrd like so:
|
||||
```
|
||||
pip install --user compiledb
|
||||
./autogen.sh && ./configure --enable-static=no --enable-shared --with-pic --without-gui CXXFLAGS="-O0 -g" CFLAGS="-O0 -g" # or whatever normal lbrycrd config
|
||||
compiledb make -j10
|
||||
```
|
||||
Then open the newly generated compile_commands.json file as a project in CLion. Debugging is supported if you compiled with `-g`. To enable that you will need to create a target in CLion by going to File -> Settings -> Build -> Custom Build Targets. Add an empty target with your choice of name. From there you can go to "Edit Configurations", typically found in a drop-down at the top of the editor. Add a Custom Build Application, select your new target, select the compiled file (i.e. test_lbrycrd or lbrycrdd, etc), and then add any necessary command line parameters. Ensure that there is nothing in the "Before launch" section.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see [https://lbry.tech/contribute](https://lbry.tech/contribute)
|
||||
|
||||
We follow the same coding guidelines as documented by Bitcoin Core, see [here](/doc/developer-notes.md). To run an automated code formatting check, try:
|
||||
`git diff -U0 master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1`. This will check any commits not on master for proper code formatting.
|
||||
We try to avoid altering parts of the code that is inherited from Bitcoin Core unless absolutely necessary. This will make it easier to merge changes from Bitcoin Core. If commits are expected not to be merged upstream (i.e. we broke up a commit from Bitcoin Core in order to use a single feature in it), the commit message must contain the string "NOT FOR UPSTREAM MERGE".
|
||||
|
||||
The `master` branch is regularly built and tested, but is not guaranteed to be
|
||||
completely stable. [Tags](https://github.com/bitcoin/bitcoin/tags) are created
|
||||
regularly to indicate new official, stable release versions of Bitcoin Core.
|
||||
|
||||
The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
|
||||
Testing
|
||||
-------
|
||||
completely stable. [Releases](https://github.com/lbryio/lbrycrd/releases) are created
|
||||
regularly to indicate new official, stable release versions.
|
||||
|
||||
Testing and code review is the bottleneck for development; we get more pull
|
||||
requests than we can review and test on short notice. Please be patient and help out by testing
|
||||
other people's pull requests, and remember this is a security-critical project where any mistake might cost people
|
||||
lots of money.
|
||||
lots of money. Developers are strongly encouraged to write [unit tests](/doc/unit-tests.md) for new code and to
|
||||
submit new unit tests for old code. Unit tests are compiled by default and can be run with `src/test/test_lbrycrd`.
|
||||
|
||||
### Automated Testing
|
||||
The Travis CI system makes sure that every pull request is built, and that unit and sanity tests are automatically run. See https://travis-ci.org/lbryio/lbrycrd
|
||||
|
||||
Developers are strongly encouraged to write [unit tests](src/test/README.md) for new code, and to
|
||||
submit new unit tests for old code. Unit tests can be compiled and run
|
||||
(assuming they weren't disabled in configure) with: `make check`. Further details on running
|
||||
and extending unit tests can be found in [/src/test/README.md](/src/test/README.md).
|
||||
### Testnet
|
||||
|
||||
There are also [regression and integration tests](/test), written
|
||||
in Python, that are run automatically on the build server.
|
||||
These tests can be run (if the [test dependencies](/test) are installed) with: `test/functional/test_runner.py`
|
||||
Testnet is maintained for testing purposes and can be accessed using the command `./lbrycrdd -testnet`. If you would like to obtain testnet credits, please contact brannon@lbry.com or grin@lbry.com .
|
||||
|
||||
The Travis CI system makes sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.
|
||||
It is easy to solo mine on testnet. (It's easy on mainnet too, but much harder to win.) For instructions see https://github.com/lbryio/sgminer-gm and https://github.com/lbryio/lbrycrd/tree/master/contrib/mining
|
||||
|
||||
### Manual Quality Assurance (QA) Testing
|
||||
## License
|
||||
|
||||
Changes should be tested by somebody other than the developer who wrote the
|
||||
code. This is especially important for large or high-risk changes. It is useful
|
||||
to add a test plan to the pull request description if testing the changes is
|
||||
not straightforward.
|
||||
This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
Translations
|
||||
------------
|
||||
## Security
|
||||
|
||||
Changes to translations as well as new translations can be submitted to
|
||||
[Bitcoin Core's Transifex page](https://www.transifex.com/projects/p/bitcoin/).
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues.
|
||||
Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
|
||||
|
||||
Translations are periodically pulled from Transifex and merged into the git repository. See the
|
||||
[translation process](doc/translation_process.md) for details on how this works.
|
||||
## Contact
|
||||
|
||||
The primary contact for this project is [@BrannonKing](https://github.com/BrannonKing) (brannon@lbry.com)
|
||||
|
||||
**Important**: We do not accept translation changes as GitHub pull requests because the next
|
||||
pull from Transifex would automatically overwrite them again.
|
||||
|
||||
Translators should also subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bitcoin-translators).
|
||||
@@ -0,0 +1,120 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_boost_locale.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_BOOST_LOCALE
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Test for System library from the Boost C++ libraries. The macro requires
|
||||
# a preceding call to AX_BOOST_BASE. Further documentation is available at
|
||||
# <http://randspringer.de/boost/index.html>.
|
||||
#
|
||||
# This macro calls:
|
||||
#
|
||||
# AC_SUBST(BOOST_LOCALE_LIB)
|
||||
#
|
||||
# And sets:
|
||||
#
|
||||
# HAVE_BOOST_LOCALE
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_BOOST_LOCALE],
|
||||
[
|
||||
AC_ARG_WITH([boost-locale],
|
||||
AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@],
|
||||
[use the Locale library from boost - it is possible to specify a certain library for the linker
|
||||
e.g. --with-boost-locale=boost_locale-gcc-mt ]),
|
||||
[
|
||||
if test "$withval" = "no"; then
|
||||
want_boost="no"
|
||||
elif test "$withval" = "yes"; then
|
||||
want_boost="yes"
|
||||
ax_boost_user_locale_lib=""
|
||||
else
|
||||
want_boost="yes"
|
||||
ax_boost_user_locale_lib="$withval"
|
||||
fi
|
||||
],
|
||||
[want_boost="yes"]
|
||||
)
|
||||
|
||||
if test "x$want_boost" = "xyes"; then
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])
|
||||
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||
export CPPFLAGS
|
||||
|
||||
LDFLAGS_SAVED="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||
export LDFLAGS
|
||||
|
||||
AC_CACHE_CHECK(whether the Boost::Locale library is available,
|
||||
ax_cv_boost_locale,
|
||||
[AC_LANG_PUSH([C++])
|
||||
CXXFLAGS_SAVE=$CXXFLAGS
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/locale.hpp>]],
|
||||
[[boost::locale::generator gen;
|
||||
std::locale::global(gen(""));]])],
|
||||
ax_cv_boost_locale=yes, ax_cv_boost_locale=no)
|
||||
CXXFLAGS=$CXXFLAGS_SAVE
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
if test "x$ax_cv_boost_locale" = "xyes"; then
|
||||
AC_SUBST(BOOST_CPPFLAGS)
|
||||
|
||||
AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available])
|
||||
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
|
||||
|
||||
LDFLAGS_SAVE=$LDFLAGS
|
||||
if test "x$ax_boost_user_locale_lib" = "x"; then
|
||||
for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
|
||||
[link_locale="no"])
|
||||
done
|
||||
if test "x$link_locale" != "xyes"; then
|
||||
for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` ; do
|
||||
ax_lib=${libextension}
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
|
||||
[link_locale="no"])
|
||||
done
|
||||
fi
|
||||
|
||||
else
|
||||
for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do
|
||||
AC_CHECK_LIB($ax_lib, exit,
|
||||
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
|
||||
[link_locale="no"])
|
||||
done
|
||||
|
||||
fi
|
||||
if test "x$ax_lib" = "x"; then
|
||||
AC_MSG_ERROR(Could not find a version of the library!)
|
||||
fi
|
||||
if test "x$link_locale" = "xno"; then
|
||||
AC_MSG_ERROR(Could not link against $ax_lib !)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||
LDFLAGS="$LDFLAGS_SAVED"
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
function HELP {
|
||||
echo "Use this command to build lbrycrd."
|
||||
echo "Dependencies will be pulled and built first."
|
||||
echo "Use autogen & configure directly to avoid this and use system shared libraries instead."
|
||||
echo
|
||||
echo "Optional arguments:"
|
||||
echo "-jN: number of parallel build jobs"
|
||||
echo "-q: compile the QT GUI (not working at present)"
|
||||
echo "-d: force a rebuild of dependencies"
|
||||
echo "-u: run the unit tests when done"
|
||||
echo "-g: include debug symbols"
|
||||
echo "-h: show help"
|
||||
exit 1
|
||||
}
|
||||
|
||||
REBUILD_DEPENDENCIES=false
|
||||
RUN_UNIT_TESTS=false
|
||||
COMPILE_WITH_DEBUG=false
|
||||
DO_NOT_COMPILE_THE_GUI="NO_QT=1"
|
||||
WITH_COMPILE_THE_GUI=no
|
||||
|
||||
if test -z $PARALLEL_JOBS; then
|
||||
PARALLEL_JOBS=$(expr $(getconf _NPROCESSORS_ONLN) / 2 + 1)
|
||||
fi
|
||||
|
||||
while getopts j:qdugh FLAG; do
|
||||
case ${FLAG} in
|
||||
j)
|
||||
PARALLEL_JOBS=$OPTARG
|
||||
;;
|
||||
q)
|
||||
DO_NOT_COMPILE_THE_GUI=
|
||||
WITH_COMPILE_THE_GUI=qt5
|
||||
;;
|
||||
g)
|
||||
COMPILE_WITH_DEBUG=true
|
||||
;;
|
||||
u)
|
||||
RUN_UNIT_TESTS=true
|
||||
;;
|
||||
d)
|
||||
REBUILD_DEPENDENCIES=true
|
||||
;;
|
||||
h)
|
||||
HELP
|
||||
;;
|
||||
\?)
|
||||
HELP
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Compiling with ${PARALLEL_JOBS} jobs in parallel."
|
||||
|
||||
BUILD_FLAGS=(CXXFLAGS="-O3 -march=native")
|
||||
if test "$COMPILE_WITH_DEBUG" = true; then
|
||||
BUILD_FLAGS=(--with-debug CXXFLAGS="-Og -g")
|
||||
fi
|
||||
|
||||
cd depends
|
||||
if test "$REBUILD_DEPENDENCIES" = true; then
|
||||
make clean
|
||||
fi
|
||||
make -j${PARALLEL_JOBS} ${DO_NOT_COMPILE_THE_GUI} V=1
|
||||
cd ..
|
||||
|
||||
LC_ALL=C autoreconf --install
|
||||
|
||||
CONFIG_SITE=$(pwd)/depends/$($(pwd)/depends/config.guess)/share/config.site ./configure --enable-reduce-exports \
|
||||
--enable-static --disable-shared --with-pic --with-gui=${WITH_COMPILE_THE_GUI} "${BUILD_FLAGS[@]}"
|
||||
|
||||
if test $? -eq 0; then
|
||||
make -j${PARALLEL_JOBS}
|
||||
fi
|
||||
|
||||
if test $? -eq 0 && "$RUN_UNIT_TESTS" = true; then
|
||||
./src/test/test_lbrycrd
|
||||
fi
|
||||
+70
-22
@@ -1,23 +1,23 @@
|
||||
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
|
||||
AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 0)
|
||||
define(_CLIENT_VERSION_MINOR, 16)
|
||||
define(_CLIENT_VERSION_REVISION, 99)
|
||||
define(_CLIENT_VERSION_BUILD, 0)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, false)
|
||||
define(_COPYRIGHT_YEAR, 2018)
|
||||
define(_CLIENT_VERSION_MINOR, 17)
|
||||
define(_CLIENT_VERSION_REVISION, 2)
|
||||
define(_CLIENT_VERSION_BUILD, 1)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||
define(_COPYRIGHT_YEAR, 2019)
|
||||
define(_COPYRIGHT_HOLDERS,[The %s developers])
|
||||
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Bitcoin Core]])
|
||||
AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/])
|
||||
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRYcrd Core]])
|
||||
AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/lbryio/lbrycrd/issues],[lbrycrd],[https://lbry.com/])
|
||||
AC_CONFIG_SRCDIR([src/validation.cpp])
|
||||
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([build-aux/m4])
|
||||
|
||||
BITCOIN_DAEMON_NAME=bitcoind
|
||||
BITCOIN_GUI_NAME=bitcoin-qt
|
||||
BITCOIN_CLI_NAME=bitcoin-cli
|
||||
BITCOIN_TX_NAME=bitcoin-tx
|
||||
BITCOIN_DAEMON_NAME=lbrycrdd
|
||||
BITCOIN_GUI_NAME=lbrycrd-qt
|
||||
BITCOIN_CLI_NAME=lbrycrd-cli
|
||||
BITCOIN_TX_NAME=lbrycrd-tx
|
||||
|
||||
dnl Unless the user specified ARFLAGS, force it to be cr
|
||||
AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to <cr> if not set])
|
||||
@@ -146,6 +146,12 @@ AC_ARG_WITH([qrencode],
|
||||
[use_qr=$withval],
|
||||
[use_qr=auto])
|
||||
|
||||
AC_ARG_WITH([icu],
|
||||
[AS_HELP_STRING([--with-icu],
|
||||
[Required ICU root path])],
|
||||
[ICU_PREFIX=$withval],
|
||||
[ICU_PREFIX=auto])
|
||||
|
||||
AC_ARG_ENABLE([hardening],
|
||||
[AS_HELP_STRING([--disable-hardening],
|
||||
[do not attempt to harden the resulting executables (default is to harden when possible)])],
|
||||
@@ -395,7 +401,7 @@ CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
|
||||
|
||||
AC_ARG_WITH([utils],
|
||||
[AS_HELP_STRING([--with-utils],
|
||||
[build bitcoin-cli bitcoin-tx (default=yes)])],
|
||||
[build lbrycrd-cli lbrycrd-tx (default=yes)])],
|
||||
[build_bitcoin_utils=$withval],
|
||||
[build_bitcoin_utils=yes])
|
||||
|
||||
@@ -640,6 +646,10 @@ if test x$ac_cv_sys_large_files != x &&
|
||||
CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
|
||||
fi
|
||||
|
||||
AS_IF([test x$enable_static != x && test x$LDFLAGS != xdarwin], [
|
||||
# darwin should be using -stdlib=libc++ (and may need a -static instead)
|
||||
AX_CHECK_LINK_FLAG([[-static-libstdc++]], [LDFLAGS="$LDFLAGS -static-libstdc++"])
|
||||
])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"])
|
||||
|
||||
AX_GCC_FUNC_ATTRIBUTE([visibility])
|
||||
@@ -693,10 +703,12 @@ if test x$TARGET_OS != xwindows; then
|
||||
AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
|
||||
fi
|
||||
|
||||
# All versions of gcc that we commonly use for building are subject to bug
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
|
||||
# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
|
||||
AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"])
|
||||
if test x$use_hardening != xno; then
|
||||
use_hardening=yes
|
||||
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
|
||||
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
|
||||
|
||||
AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[
|
||||
AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[
|
||||
@@ -716,6 +728,10 @@ if test x$use_hardening != xno; then
|
||||
*mingw*)
|
||||
AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(libssp missing))
|
||||
;;
|
||||
*)
|
||||
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
|
||||
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -779,7 +795,7 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
)
|
||||
|
||||
TEMP_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$TEMP_LDFLAGS $PTHREAD_CFLAGS"
|
||||
LDFLAGS="$TEMP_LDFLAGS $PTHREAD_LIBS"
|
||||
AC_MSG_CHECKING([for thread_local support])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
#include <thread>
|
||||
@@ -895,6 +911,7 @@ AX_BOOST_SYSTEM
|
||||
AX_BOOST_FILESYSTEM
|
||||
AX_BOOST_THREAD
|
||||
AX_BOOST_CHRONO
|
||||
AX_BOOST_LOCALE
|
||||
|
||||
dnl Boost 1.56 through 1.62 allow using std::atomic instead of its own atomic
|
||||
dnl counter implementations. In 1.63 and later the std::atomic approach is default.
|
||||
@@ -961,8 +978,7 @@ fi
|
||||
|
||||
if test x$use_boost = xyes; then
|
||||
|
||||
BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB"
|
||||
|
||||
BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_LOCALE_LIB $BOOST_THREAD_LIB $BOOST_CHRONO_LIB"
|
||||
|
||||
dnl If boost (prior to 1.57) was built without c++11, it emulated scoped enums
|
||||
dnl using c++98 constructs. Unfortunately, this implementation detail leaked into
|
||||
@@ -1052,6 +1068,26 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
# the plan for dealing with ICU:
|
||||
# if the user specifies an ICU prefix, use that one.
|
||||
# if the user did not specify an ICU prefix but did specify a general prefix use that one.
|
||||
# otherwise use pkg_config if it's available.
|
||||
# well, actually, things seem to work fine without this fallback to pkg_config so we'll leave that out for now.
|
||||
# note: in order to use AC_CHECK_LIB we have to override CPPFLAGS and LDFLAGS
|
||||
# however, we don't want to keep those overridden after our checks;
|
||||
# we want to rely on ICU_CPPFLAGS and ICU_LIBS after that
|
||||
# to further complicate matters there are at least three different naming conventions for ICU libraries
|
||||
# to simplify things we'll just check one from each convention
|
||||
|
||||
AS_IF([test "x${prefix}" != "xNONE" && test "x$ICU_PREFIX" == "xauto"], [
|
||||
ICU_PREFIX="${prefix}"
|
||||
])
|
||||
|
||||
AS_IF([test "x$ICU_PREFIX" != "xauto"], [
|
||||
ICU_CPPFLAGS="$(PKG_CONFIG_SYSROOT_DIR=/ PKG_CONFIG_LIBDIR=$ICU_PREFIX/lib/pkgconfig PKG_CONFIG_PATH=$ICU_PREFIX/share/pkgconfig pkg-config icu-io icu-uc icu-i18n --cflags)"
|
||||
ICU_LIBS="$(PKG_CONFIG_SYSROOT_DIR=/ PKG_CONFIG_LIBDIR=$ICU_PREFIX/lib/pkgconfig PKG_CONFIG_PATH=$ICU_PREFIX/share/pkgconfig pkg-config icu-io icu-uc icu-i18n --libs)"
|
||||
])
|
||||
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
: dnl
|
||||
m4_ifdef(
|
||||
@@ -1079,9 +1115,15 @@ if test x$use_pkgconfig = xyes; then
|
||||
else
|
||||
AC_DEFINE_UNQUOTED([ENABLE_ZMQ],[0],[Define to 1 to enable ZMQ functions])
|
||||
fi
|
||||
|
||||
if test "x$ICU_PREFIX" == "xauto"; then
|
||||
PKG_CHECK_MODULES([ICU], [icu-io, icu-uc, icu-i18n])
|
||||
fi
|
||||
]
|
||||
)
|
||||
else
|
||||
else # probably compiling on Windows or cross-compiling for it:
|
||||
AC_MSG_NOTICE([Configuring for MinGW])
|
||||
|
||||
AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing))
|
||||
AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing))
|
||||
|
||||
@@ -1126,6 +1168,9 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([Using ICU_CPPFLAGS="$ICU_CPPFLAGS"])
|
||||
AC_MSG_NOTICE([Using ICU_LIBS="$ICU_LIBS"])
|
||||
|
||||
save_CXXFLAGS="${CXXFLAGS}"
|
||||
CXXFLAGS="${CXXFLAGS} ${CRYPTO_CFLAGS} ${SSL_CFLAGS}"
|
||||
AC_CHECK_DECLS([EVP_MD_CTX_new],,,[AC_INCLUDES_DEFAULT
|
||||
@@ -1187,7 +1232,7 @@ AC_MSG_CHECKING([whether to build bitcoind])
|
||||
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
|
||||
AC_MSG_RESULT($build_bitcoind)
|
||||
|
||||
AC_MSG_CHECKING([whether to build utils (bitcoin-cli bitcoin-tx)])
|
||||
AC_MSG_CHECKING([whether to build utils (lbrycrd-cli lbrycrd-tx)])
|
||||
AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes])
|
||||
AC_MSG_RESULT($build_bitcoin_utils)
|
||||
|
||||
@@ -1288,7 +1333,7 @@ if test x$bitcoin_enable_qt != xno; then
|
||||
AC_MSG_WARN("xgettext is required to update qt translations")
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to build test_bitcoin-qt])
|
||||
AC_MSG_CHECKING([whether to build test_lbrycrd-qt])
|
||||
if test x$use_gui_tests$bitcoin_enable_qt_test = xyesyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BUILD_TEST_QT="yes"
|
||||
@@ -1299,7 +1344,7 @@ fi
|
||||
|
||||
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
|
||||
|
||||
AC_MSG_CHECKING([whether to build test_bitcoin])
|
||||
AC_MSG_CHECKING([whether to build test_lbrycrd])
|
||||
if test x$use_tests = xyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BUILD_TEST="yes"
|
||||
@@ -1385,11 +1430,14 @@ AC_SUBST(LIBTOOL_APP_LDFLAGS)
|
||||
AC_SUBST(USE_UPNP)
|
||||
AC_SUBST(USE_QRCODE)
|
||||
AC_SUBST(BOOST_LIBS)
|
||||
AC_SUBST(ICU_CPPFLAGS)
|
||||
AC_SUBST(ICU_LIBS)
|
||||
AC_SUBST(TESTDEFS)
|
||||
AC_SUBST(LEVELDB_TARGET_FLAGS)
|
||||
AC_SUBST(MINIUPNPC_CPPFLAGS)
|
||||
AC_SUBST(MINIUPNPC_LIBS)
|
||||
AC_SUBST(CRYPTO_LIBS)
|
||||
AC_SUBST(SSL_CFLAGS)
|
||||
AC_SUBST(SSL_LIBS)
|
||||
AC_SUBST(EVENT_LIBS)
|
||||
AC_SUBST(EVENT_PTHREADS_LIBS)
|
||||
@@ -1431,7 +1479,7 @@ if test x$need_bundled_univalue = xyes; then
|
||||
AC_CONFIG_SUBDIRS([src/univalue])
|
||||
fi
|
||||
|
||||
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery --disable-jni"
|
||||
ac_configure_args="${ac_configure_args} --enable-static --disable-shared --with-pic --with-bignum=no --enable-module-recovery --disable-jni"
|
||||
AC_CONFIG_SUBDIRS([src/secp256k1])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(lbrycrd)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
include(cmake/CPM.cmake)
|
||||
include(ExternalProject)
|
||||
|
||||
set(OPTIONS "" CACHE STRING "lbrycrdd configure options")
|
||||
set(CPPFLAGS "" CACHE STRING "lbrycrdd compiler options")
|
||||
set(LDFLAGS "" CACHE STRING "lbrycrdd linker options")
|
||||
set(DISABLE_TESTS OFF CACHE BOOL "compilation without tests")
|
||||
set(DISABLE_WALLET OFF CACHE BOOL "compilation without wallet support")
|
||||
set(DISABLE_BENCH OFF CACHE BOOL "compilation without bench support")
|
||||
|
||||
if(NOT ${CPM_USE_LOCAL_PACKAGES})
|
||||
set(OPTIONS "${OPTIONS} --enable-static --disable-shared")
|
||||
else()
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
endif()
|
||||
|
||||
set(OPTIONS "--without-gui ${OPTIONS} --with-pic")
|
||||
|
||||
if (${DISABLE_TESTS})
|
||||
set(OPTIONS "${OPTIONS} --disable-tests")
|
||||
endif()
|
||||
|
||||
if (${DISABLE_WALLET})
|
||||
set(OPTIONS "${OPTIONS} --disable-wallet")
|
||||
endif()
|
||||
|
||||
if (${DISABLE_BENCH})
|
||||
set(OPTIONS "${OPTIONS} --disable-bench")
|
||||
endif()
|
||||
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR} ARCH)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME OpenSSL
|
||||
GITHUB_REPOSITORY openssl/openssl
|
||||
VERSION 1.0.2
|
||||
GIT_TAG OpenSSL_1_0_2r
|
||||
DOWNLOAD_ONLY TRUE
|
||||
)
|
||||
|
||||
if(OpenSSL_ADDED)
|
||||
ExternalProject_Add(OpenSSL
|
||||
PREFIX openssl
|
||||
SOURCE_DIR ${OpenSSL_SOURCE_DIR}
|
||||
CONFIGURE_COMMAND ${OpenSSL_SOURCE_DIR}/Configure ${ARCH} no-shared no-dso no-engines -fPIC --prefix=<INSTALL_DIR>
|
||||
BUILD_IN_SOURCE 1
|
||||
)
|
||||
set(DEPENDS ${DEPENDS} OpenSSL)
|
||||
ExternalProject_Get_Property(OpenSSL INSTALL_DIR)
|
||||
set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib")
|
||||
set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include")
|
||||
set(OPENSSL_CPPFLAGS "CPPFLAGS=-I${INSTALL_DIR}/include")
|
||||
set(OPENSSL_LDFLAGS "LDFLAGS=-L${INSTALL_DIR}/lib")
|
||||
endif(OpenSSL_ADDED)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME Libevent
|
||||
GITHUB_REPOSITORY libevent/libevent
|
||||
VERSION 2.1.8
|
||||
GIT_TAG release-2.1.8-stable
|
||||
DOWNLOAD_ONLY TRUE
|
||||
)
|
||||
|
||||
if(Libevent_ADDED)
|
||||
ExternalProject_Add(Libevent
|
||||
PREFIX libevent
|
||||
DEPENDS ${DEPENDS}
|
||||
SOURCE_DIR ${Libevent_SOURCE_DIR}
|
||||
CONFIGURE_COMMAND ${Libevent_SOURCE_DIR}/autogen.sh
|
||||
&& ${Libevent_SOURCE_DIR}/configure ${OPENSSL_CPPFLAGS} --enable-cxx --disable-shared --with-pic ${OPENSSL_LDFLAGS} --prefix=<INSTALL_DIR>
|
||||
BUILD_IN_SOURCE 1
|
||||
)
|
||||
set(DEPENDS ${DEPENDS} Libevent)
|
||||
ExternalProject_Get_Property(Libevent INSTALL_DIR)
|
||||
set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib")
|
||||
set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include")
|
||||
endif(Libevent_ADDED)
|
||||
|
||||
if(NOT ${DISABLE_WALLET})
|
||||
CPMAddPackage(
|
||||
NAME BerkeleyDB
|
||||
VERSION 4.8.30
|
||||
URL https://download.oracle.com/berkeley-db/db-4.8.30.NC.zip
|
||||
URL_HASH SHA256=43ecd76886992ea416fdadc54b7f2b83ef249d9a6964bd07708ccae42d0226ce
|
||||
DOWNLOAD_ONLY TRUE
|
||||
)
|
||||
|
||||
if(NOT ${BerkeleyDB_VERSION} VERSION_LESS "5.0")
|
||||
set(OPTIONS "${OPTIONS} --with-incompatible-bdb")
|
||||
endif()
|
||||
|
||||
if(BerkeleyDB_ADDED)
|
||||
ExternalProject_Add(BerkeleyDB
|
||||
PREFIX bdb
|
||||
SOURCE_DIR ${BerkeleyDB_SOURCE_DIR}
|
||||
PATCH_COMMAND sed -i "s/__atomic_compare_exchange/__atomic_compare_exchange_db/" ${BerkeleyDB_SOURCE_DIR}/dbinc/atomic.h
|
||||
CONFIGURE_COMMAND ${BerkeleyDB_SOURCE_DIR}/dist/configure --enable-cxx --disable-shared --with-pic --prefix=<INSTALL_DIR>
|
||||
)
|
||||
set(DEPENDS ${DEPENDS} BerkeleyDB)
|
||||
ExternalProject_Get_Property(BerkeleyDB INSTALL_DIR)
|
||||
set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib")
|
||||
set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include")
|
||||
endif(BerkeleyDB_ADDED)
|
||||
endif()
|
||||
|
||||
set(BOOST_LIBS chrono,filesystem,system,locale,thread)
|
||||
|
||||
string(REPLACE "," ";" BOOST_COMPONENTS ${BOOST_LIBS})
|
||||
|
||||
if(NOT ${DISABLE_TESTS})
|
||||
set(BOOST_LIBS ${BOOST_LIBS},test)
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS};unit_test_framework)
|
||||
endif()
|
||||
|
||||
CPMAddPackage(
|
||||
NAME Boost
|
||||
GITHUB_REPOSITORY boostorg/boost
|
||||
VERSION 1.64.0
|
||||
COMPONENTS ${BOOST_COMPONENTS}
|
||||
GIT_TAG boost-1.69.0
|
||||
GIT_SUBMODULES libs/* tools/*
|
||||
DOWNLOAD_ONLY TRUE
|
||||
)
|
||||
|
||||
# if boost is found system wide we expect to be compiled against icu, so we can skip it
|
||||
if(Boost_ADDED)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME ICU
|
||||
GITHUB_REPOSITORY unicode-org/icu
|
||||
VERSION 63.2
|
||||
GIT_TAG release-63-2
|
||||
DOWNLOAD_ONLY TRUE
|
||||
)
|
||||
|
||||
if(ICU_ADDED)
|
||||
ExternalProject_Add(ICU
|
||||
PREFIX icu
|
||||
SOURCE_DIR ${ICU_SOURCE_DIR}
|
||||
CONFIGURE_COMMAND ${ICU_SOURCE_DIR}/icu4c/source/configure --disable-extras --disable-strict --enable-static
|
||||
--disable-shared --disable-tests --disable-samples --disable-dyload --disable-layoutex CFLAGS=-fPIC CPPFLAGS=-fPIC --prefix=<INSTALL_DIR>
|
||||
)
|
||||
set(DEPENDS ${DEPENDS} ICU)
|
||||
ExternalProject_Get_Property(ICU INSTALL_DIR)
|
||||
set(ICU_PATH ${INSTALL_DIR})
|
||||
set(OPTIONS "${OPTIONS} --with-icu=${ICU_PATH}")
|
||||
set(LDFLAGS "${LDFLAGS} -L${ICU_PATH}/lib")
|
||||
set(CPPFLAGS "${CPPFLAGS} -I${ICU_PATH}/include")
|
||||
endif(ICU_ADDED)
|
||||
|
||||
ExternalProject_Add(Boost
|
||||
PREFIX boost
|
||||
DEPENDS ${DEPENDS}
|
||||
SOURCE_DIR ${Boost_SOURCE_DIR}
|
||||
CONFIGURE_COMMAND ${Boost_SOURCE_DIR}/bootstrap.sh --with-icu=${ICU_PATH} --with-libraries=${BOOST_LIBS} && ${Boost_SOURCE_DIR}/b2 headers
|
||||
BUILD_COMMAND ${Boost_SOURCE_DIR}/b2 install threading=multi -sNO_BZIP2=1 -sNO_ZLIB=1 link=static linkflags="-L${ICU_PATH}/lib -licuio -licuuc -licudata -licui18n" cxxflags=-fPIC boost.locale.iconv=off boost.locale.posix=off boost.locale.icu=on boost.locale.std=off -sICU_PATH=${ICU_PATH} --prefix=<INSTALL_DIR>
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
)
|
||||
set(DEPENDS ${DEPENDS} Boost)
|
||||
ExternalProject_Get_Property(Boost INSTALL_DIR)
|
||||
set(OPTIONS "${OPTIONS} --with-boost=${INSTALL_DIR}")
|
||||
set(LDFLAGS "${LDFLAGS} -L${INSTALL_DIR}/lib")
|
||||
set(CPPFLAGS "${CPPFLAGS} -I${INSTALL_DIR}/include")
|
||||
set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${Boost_SOURCE_DIR}/bin.v2)
|
||||
endif(Boost_ADDED)
|
||||
|
||||
set(CPPFLAGS "${CPPFLAGS} -Wno-parentheses -Wno-unused-local-typedefs -Wno-deprecated -Wno-implicit-fallthrough -Wno-unused-parameter")
|
||||
|
||||
separate_arguments(OPTIONS)
|
||||
|
||||
ExternalProject_Add(lbrycrdd
|
||||
PREFIX lbrycrdd
|
||||
DEPENDS ${DEPENDS}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../../autogen.sh
|
||||
&& ${CMAKE_CURRENT_SOURCE_DIR}/../../configure ${OPTIONS} CPPFLAGS=${CPPFLAGS} LDFLAGS=${LDFLAGS} --prefix=<INSTALL_DIR>
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_ALWAYS 1
|
||||
)
|
||||
@@ -0,0 +1,210 @@
|
||||
# TheLartians/CPM - A simple Git dependency manager
|
||||
# =================================================
|
||||
# See https://github.com/TheLartians/CPM for usage and update instructions.
|
||||
#
|
||||
# MIT License
|
||||
# -----------
|
||||
#[[
|
||||
Copyright (c) 2019 Lars Melchior
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in 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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
||||
AUTHORS 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 IN THE
|
||||
SOFTWARE.
|
||||
]]
|
||||
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
set(CURRENT_CPM_VERSION 0.11.1)
|
||||
|
||||
if(CPM_DIRECTORY)
|
||||
if(NOT ${CPM_DIRECTORY} MATCHES ${CMAKE_CURRENT_LIST_DIR})
|
||||
if (${CPM_VERSION} VERSION_LESS ${CURRENT_CPM_VERSION})
|
||||
CPM_HANDLE_OLD_VERSION(${CURRENT_CPM_VERSION})
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CPM_VERSION ${CURRENT_CPM_VERSION} CACHE INTERNAL "")
|
||||
set(CPM_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")
|
||||
set(CPM_PACKAGES "" CACHE INTERNAL "")
|
||||
|
||||
option(CPM_USE_LOCAL_PACKAGES "Use locally installed packages (find_package)" ON)
|
||||
option(CPM_LOCAL_PACKAGES_ONLY "Use only locally installed packages" OFF)
|
||||
|
||||
include(FetchContent)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# Initialize logging prefix
|
||||
if(NOT CPM_INDENT)
|
||||
set(CPM_INDENT "CPM:")
|
||||
endif()
|
||||
|
||||
# The main workhorse of CPM
|
||||
function(CPMAddPackage)
|
||||
|
||||
set(oneValueArgs
|
||||
NAME
|
||||
VERSION
|
||||
GIT_TAG
|
||||
DOWNLOAD_ONLY
|
||||
GITHUB_REPOSITORY
|
||||
GITLAB_REPOSITORY
|
||||
)
|
||||
|
||||
set(multiValueArgs
|
||||
OPTIONS
|
||||
COMPONENTS
|
||||
)
|
||||
|
||||
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(${CPM_USE_LOCAL_PACKAGES} OR ${CPM_LOCAL_PACKAGES_ONLY})
|
||||
find_package(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION} OPTIONAL_COMPONENTS ${CPM_ARGS_COMPONENTS} QUIET)
|
||||
|
||||
if(${CPM_ARGS_NAME}_FOUND)
|
||||
message(STATUS "CPM: adding local package ${CPM_ARGS_NAME}@${${CPM_ARGS_NAME}_VERSION}")
|
||||
set(${CPM_ARGS_NAME}_VERSION "${${CPM_ARGS_NAME}_VERSION}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(${CPM_LOCAL_PACKAGES_ONLY})
|
||||
message(SEND_ERROR "CPM: ${CPM_ARGS_NAME} not found via find_package(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT CPM_ARGS_VERSION)
|
||||
set(CPM_ARGS_VERSION 0)
|
||||
endif()
|
||||
|
||||
if (NOT CPM_ARGS_GIT_TAG)
|
||||
set(CPM_ARGS_GIT_TAG v${CPM_ARGS_VERSION})
|
||||
endif()
|
||||
|
||||
list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS GIT_TAG ${CPM_ARGS_GIT_TAG})
|
||||
|
||||
if(CPM_ARGS_DOWNLOAD_ONLY)
|
||||
set(DOWNLOAD_ONLY ${CPM_ARGS_DOWNLOAD_ONLY})
|
||||
else()
|
||||
set(DOWNLOAD_ONLY NO)
|
||||
endif()
|
||||
|
||||
if (CPM_ARGS_GITHUB_REPOSITORY)
|
||||
list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS GIT_REPOSITORY "https://github.com/${CPM_ARGS_GITHUB_REPOSITORY}.git")
|
||||
endif()
|
||||
|
||||
if (CPM_ARGS_GITLAB_REPOSITORY)
|
||||
list(APPEND CPM_ARGS_UNPARSED_ARGUMENTS GIT_REPOSITORY "https://gitlab.com/${CPM_ARGS_GITLAB_REPOSITORY}.git")
|
||||
endif()
|
||||
|
||||
if (${CPM_ARGS_NAME} IN_LIST CPM_PACKAGES)
|
||||
CPM_GET_PACKAGE_VERSION(${CPM_ARGS_NAME})
|
||||
if(${CPM_PACKAGE_VERSION} VERSION_LESS ${CPM_ARGS_VERSION})
|
||||
message(WARNING "${CPM_INDENT} requires a newer version of ${CPM_ARGS_NAME} (${CPM_ARGS_VERSION}) than currently included (${CPM_PACKAGE_VERSION}).")
|
||||
endif()
|
||||
if (CPM_ARGS_OPTIONS)
|
||||
foreach(OPTION ${CPM_ARGS_OPTIONS})
|
||||
CPM_PARSE_OPTION(${OPTION})
|
||||
if(NOT "${${OPTION_KEY}}" STREQUAL ${OPTION_VALUE})
|
||||
message(WARNING "${CPM_INDENT} ignoring package option for ${CPM_ARGS_NAME}: ${OPTION_KEY} = ${OPTION_VALUE} (${${OPTION_KEY}})")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
CPM_FETCH_PACKAGE(${CPM_ARGS_NAME} ${DOWNLOAD_ONLY})
|
||||
CPMGetProperties(${CPM_ARGS_NAME})
|
||||
set(${CPM_ARGS_NAME}_VERSION ${CPM_ARGS_VERSION} PARENT_SCOPE)
|
||||
set(${CPM_ARGS_NAME}_SOURCE_DIR "${${CPM_ARGS_NAME}_SOURCE_DIR}" PARENT_SCOPE)
|
||||
set(${CPM_ARGS_NAME}_BINARY_DIR "${${CPM_ARGS_NAME}_BINARY_DIR}" PARENT_SCOPE)
|
||||
set(${CPM_ARGS_NAME}_ADDED NO PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
CPMRegisterPackage(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION})
|
||||
|
||||
if (CPM_ARGS_OPTIONS)
|
||||
foreach(OPTION ${CPM_ARGS_OPTIONS})
|
||||
CPM_PARSE_OPTION(${OPTION})
|
||||
set(${OPTION_KEY} ${OPTION_VALUE} CACHE INTERNAL "")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
CPM_DECLARE_PACKAGE(${CPM_ARGS_NAME} ${CPM_ARGS_VERSION} ${CPM_ARGS_GIT_TAG} "${CPM_ARGS_UNPARSED_ARGUMENTS}")
|
||||
CPM_FETCH_PACKAGE(${CPM_ARGS_NAME} ${DOWNLOAD_ONLY})
|
||||
CPMGetProperties(${CPM_ARGS_NAME})
|
||||
set(${CPM_ARGS_NAME}_VERSION ${CPM_ARGS_VERSION} PARENT_SCOPE)
|
||||
set(${CPM_ARGS_NAME}_SOURCE_DIR "${${CPM_ARGS_NAME}_SOURCE_DIR}" PARENT_SCOPE)
|
||||
set(${CPM_ARGS_NAME}_BINARY_DIR "${${CPM_ARGS_NAME}_BINARY_DIR}" PARENT_SCOPE)
|
||||
set(${CPM_ARGS_NAME}_ADDED YES PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (CPM_DECLARE_PACKAGE PACKAGE VERSION GIT_TAG)
|
||||
message(STATUS "${CPM_INDENT} adding package ${PACKAGE}@${VERSION} (${GIT_TAG})")
|
||||
|
||||
FetchContent_Declare(
|
||||
${PACKAGE}
|
||||
${ARGN}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function (CPM_FETCH_PACKAGE PACKAGE DOWNLOAD_ONLY)
|
||||
set(CPM_OLD_INDENT "${CPM_INDENT}")
|
||||
set(CPM_INDENT "${CPM_INDENT} ${PACKAGE}:")
|
||||
if(${DOWNLOAD_ONLY})
|
||||
if(NOT "${PACKAGE}_POPULATED")
|
||||
FetchContent_Populate(${PACKAGE})
|
||||
endif()
|
||||
else()
|
||||
FetchContent_MakeAvailable(${PACKAGE})
|
||||
endif()
|
||||
set(CPM_INDENT "${CPM_OLD_INDENT}")
|
||||
endfunction()
|
||||
|
||||
function (CPMGetProperties PACKAGE)
|
||||
FetchContent_GetProperties(${PACKAGE})
|
||||
string(TOLOWER ${PACKAGE} lpackage)
|
||||
set(${PACKAGE}_SOURCE_DIR "${${lpackage}_SOURCE_DIR}" PARENT_SCOPE)
|
||||
set(${PACKAGE}_BINARY_DIR "${${lpackage}_BINARY_DIR}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(CPMRegisterPackage PACKAGE VERSION)
|
||||
list(APPEND CPM_PACKAGES ${PACKAGE})
|
||||
set(CPM_PACKAGES ${CPM_PACKAGES} CACHE INTERNAL "")
|
||||
set("CPM_PACKAGE_${PACKAGE}_VERSION" ${VERSION} CACHE INTERNAL "")
|
||||
endfunction()
|
||||
|
||||
function(CPM_GET_PACKAGE_VERSION PACKAGE)
|
||||
set(CPM_PACKAGE_VERSION "${CPM_PACKAGE_${PACKAGE}_VERSION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(CPM_PARSE_OPTION OPTION)
|
||||
string(REGEX MATCH "^[^ ]+" OPTION_KEY ${OPTION})
|
||||
string(LENGTH ${OPTION_KEY} OPTION_KEY_LENGTH)
|
||||
math(EXPR OPTION_KEY_LENGTH "${OPTION_KEY_LENGTH}+1")
|
||||
string(SUBSTRING ${OPTION} "${OPTION_KEY_LENGTH}" "-1" OPTION_VALUE)
|
||||
set(OPTION_KEY "${OPTION_KEY}" PARENT_SCOPE)
|
||||
set(OPTION_VALUE "${OPTION_VALUE}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (CPM_HANDLE_OLD_VERSION NEW_CPM_VERSION)
|
||||
|
||||
message(AUTHOR_WARNING "${CPM_INDENT} \
|
||||
A dependency is using a more recent CPM (${NEW_CPM_VERSION}) than the current project (${CPM_VERSION}). \
|
||||
It is recommended to upgrade CPM to the most recent version. \
|
||||
See https://github.com/TheLartians/CPM for more information."
|
||||
)
|
||||
|
||||
endfunction()
|
||||
@@ -0,0 +1,171 @@
|
||||
# Author: sum01 <sum01@protonmail.com>
|
||||
# Git: https://github.com/sum01/FindBerkeleyDB
|
||||
# Read the README.md for the full info.
|
||||
|
||||
# NOTE: If Berkeley DB ever gets a Pkg-config ".pc" file, add pkg_check_modules() here
|
||||
|
||||
# Checks if environment paths are empty, set them if they aren't
|
||||
if(NOT "$ENV{BERKELEYDB_ROOT}" STREQUAL "")
|
||||
set(_BERKELEYDB_HINTS "$ENV{BERKELEYDB_ROOT}")
|
||||
elseif(NOT "$ENV{Berkeleydb_ROOT}" STREQUAL "")
|
||||
set(_BERKELEYDB_HINTS "$ENV{Berkeleydb_ROOT}")
|
||||
elseif(NOT "$ENV{BERKELEYDBROOT}" STREQUAL "")
|
||||
set(_BERKELEYDB_HINTS "$ENV{BERKELEYDBROOT}")
|
||||
else()
|
||||
# Set just in case, as it's used regardless if it's empty or not
|
||||
set(_BERKELEYDB_HINTS "")
|
||||
endif()
|
||||
|
||||
# Allow user to pass a path instead of guessing
|
||||
if(BerkeleyDB_ROOT_DIR)
|
||||
set(_BERKELEYDB_PATHS "${BerkeleyDB_ROOT_DIR}")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*[wW]indows.*")
|
||||
# MATCHES is used to work on any devies with windows in the name
|
||||
# Shameless copy-paste from FindOpenSSL.cmake v3.8
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||
list(APPEND _BERKELEYDB_HINTS "${_programfiles}")
|
||||
|
||||
# There's actually production release and version numbers in the file path.
|
||||
# For example, if they're on v6.2.32: C:/Program Files/Oracle/Berkeley DB 12cR1 6.2.32/
|
||||
# But this still works to find it, so I'm guessing it can accept partial path matches.
|
||||
|
||||
foreach(_TARGET_BERKELEYDB_PATH "Oracle/Berkeley DB" "Berkeley DB")
|
||||
list(APPEND _BERKELEYDB_PATHS
|
||||
"${_programfiles}/${_TARGET_BERKELEYDB_PATH}"
|
||||
"C:/Program Files (x86)/${_TARGET_BERKELEYDB_PATH}"
|
||||
"C:/Program Files/${_TARGET_BERKELEYDB_PATH}"
|
||||
"C:/${_TARGET_BERKELEYDB_PATH}"
|
||||
)
|
||||
endforeach()
|
||||
else()
|
||||
# Paths for anything other than Windows
|
||||
# Cellar/berkeley-db is for macOS from homebrew installation
|
||||
list(APPEND _BERKELEYDB_PATHS
|
||||
"/usr"
|
||||
"/usr/local"
|
||||
"/usr/local/Cellar/berkeley-db"
|
||||
"/opt"
|
||||
"/opt/local"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Find includes path
|
||||
find_path(BerkeleyDB_INCLUDE_DIRS
|
||||
NAMES "db.h"
|
||||
HINTS ${_BERKELEYDB_HINTS}
|
||||
PATH_SUFFIXES "include" "includes"
|
||||
PATHS ${_BERKELEYDB_PATHS}
|
||||
)
|
||||
|
||||
# Checks if the version file exists, save the version file to a var, and fail if there's no version file
|
||||
if(BerkeleyDB_INCLUDE_DIRS)
|
||||
# Read the version file db.h into a variable
|
||||
file(READ "${BerkeleyDB_INCLUDE_DIRS}/db.h" _BERKELEYDB_DB_HEADER)
|
||||
# Parse the DB version into variables to be used in the lib names
|
||||
string(REGEX REPLACE ".*DB_VERSION_MAJOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MAJOR "${_BERKELEYDB_DB_HEADER}")
|
||||
string(REGEX REPLACE ".*DB_VERSION_MINOR ([0-9]+).*" "\\1" BerkeleyDB_VERSION_MINOR "${_BERKELEYDB_DB_HEADER}")
|
||||
# Patch version example on non-crypto installs: x.x.xNC
|
||||
string(REGEX REPLACE ".*DB_VERSION_PATCH ([0-9]+(NC)?).*" "\\1" BerkeleyDB_VERSION_PATCH "${_BERKELEYDB_DB_HEADER}")
|
||||
else()
|
||||
if(BerkeleyDB_FIND_REQUIRED)
|
||||
# If the find_package(BerkeleyDB REQUIRED) was used, fail since we couldn't find the header
|
||||
message(FATAL_ERROR "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.")
|
||||
elseif(NOT BerkeleyDB_FIND_QUIETLY)
|
||||
message(WARNING "Failed to find Berkeley DB's header file \"db.h\"! Try setting \"BerkeleyDB_ROOT_DIR\" when initiating Cmake.")
|
||||
endif()
|
||||
# Set some garbage values to the versions since we didn't find a file to read
|
||||
set(BerkeleyDB_VERSION_MAJOR "0")
|
||||
set(BerkeleyDB_VERSION_MINOR "0")
|
||||
set(BerkeleyDB_VERSION_PATCH "0")
|
||||
endif()
|
||||
|
||||
# The actual returned/output version variable (the others can be used if needed)
|
||||
set(BerkeleyDB_VERSION "${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}.${BerkeleyDB_VERSION_PATCH}")
|
||||
|
||||
# Finds the target library for berkeley db, since they all follow the same naming conventions
|
||||
macro(_berkeleydb_get_lib _BERKELEYDB_OUTPUT_VARNAME _TARGET_BERKELEYDB_LIB)
|
||||
# Different systems sometimes have a version in the lib name...
|
||||
# and some have a dash or underscore before the versions.
|
||||
# CMake recommends to put unversioned names before versioned names
|
||||
find_library(${_BERKELEYDB_OUTPUT_VARNAME}
|
||||
NAMES
|
||||
"${_TARGET_BERKELEYDB_LIB}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}.${BerkeleyDB_VERSION_MINOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}${BerkeleyDB_VERSION_MINOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}${BerkeleyDB_VERSION_MAJOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}-${BerkeleyDB_VERSION_MAJOR}"
|
||||
"lib${_TARGET_BERKELEYDB_LIB}_${BerkeleyDB_VERSION_MAJOR}"
|
||||
HINTS ${_BERKELEYDB_HINTS}
|
||||
PATH_SUFFIXES
|
||||
"lib"
|
||||
"lib64"
|
||||
"libs"
|
||||
"libs64"
|
||||
PATHS ${_BERKELEYDB_PATHS}
|
||||
)
|
||||
# If the library was found, add it to our list of libraries
|
||||
if(${_BERKELEYDB_OUTPUT_VARNAME})
|
||||
# If found, append to our libraries variable
|
||||
# The ${{}} is because the first expands to target the real variable, the second expands the variable's contents...
|
||||
# and the real variable's contents is the path to the lib. Thus, it appends the path of the lib to BerkeleyDB_LIBRARIES.
|
||||
list(APPEND BerkeleyDB_LIBRARIES "${${_BERKELEYDB_OUTPUT_VARNAME}}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Find and set the paths of the specific library to the variable
|
||||
_berkeleydb_get_lib(BerkeleyDB_LIBRARY "db")
|
||||
# NOTE: Windows doesn't have a db_cxx lib, but instead compiles the cxx code into the "db" lib
|
||||
_berkeleydb_get_lib(BerkeleyDB_Cxx_LIBRARY "db_cxx")
|
||||
# NOTE: I don't think Linux/Unix gets an SQL lib
|
||||
_berkeleydb_get_lib(BerkeleyDB_Sql_LIBRARY "db_sql")
|
||||
_berkeleydb_get_lib(BerkeleyDB_Stl_LIBRARY "db_stl")
|
||||
|
||||
# Needed for find_package_handle_standard_args()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# Fails if required vars aren't found, or if the version doesn't meet specifications.
|
||||
find_package_handle_standard_args(BerkeleyDB
|
||||
FOUND_VAR BerkeleyDB_FOUND
|
||||
REQUIRED_VARS
|
||||
BerkeleyDB_INCLUDE_DIRS
|
||||
BerkeleyDB_LIBRARY
|
||||
BerkeleyDB_LIBRARIES
|
||||
VERSION_VAR BerkeleyDB_VERSION
|
||||
)
|
||||
|
||||
# Only show the variables in the GUI if they click "advanced".
|
||||
# Does nothing when using the CLI
|
||||
mark_as_advanced(FORCE
|
||||
BerkeleyDB_FOUND
|
||||
BerkeleyDB_INCLUDE_DIRS
|
||||
BerkeleyDB_LIBRARIES
|
||||
BerkeleyDB_VERSION
|
||||
BerkeleyDB_VERSION_MAJOR
|
||||
BerkeleyDB_VERSION_MINOR
|
||||
BerkeleyDB_VERSION_PATCH
|
||||
BerkeleyDB_LIBRARY
|
||||
BerkeleyDB_Cxx_LIBRARY
|
||||
BerkeleyDB_Stl_LIBRARY
|
||||
BerkeleyDB_Sql_LIBRARY
|
||||
)
|
||||
|
||||
# Create an imported lib for easy linking by external projects
|
||||
if(BerkeleyDB_FOUND AND BerkeleyDB_LIBRARIES AND NOT TARGET Oracle::BerkeleyDB)
|
||||
add_library(Oracle::BerkeleyDB UNKNOWN IMPORTED)
|
||||
set_target_properties(Oracle::BerkeleyDB PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${BerkeleyDB_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${BerkeleyDB_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES "${BerkeleyDB_LIBRARIES}"
|
||||
)
|
||||
endif()
|
||||
|
||||
include(FindPackageMessage)
|
||||
# A message that tells the user what includes/libs were found, and obeys the QUIET command.
|
||||
find_package_message(BerkeleyDB
|
||||
"Found BerkeleyDB libraries: ${BerkeleyDB_LIBRARIES}"
|
||||
"[${BerkeleyDB_LIBRARIES}[${BerkeleyDB_INCLUDE_DIRS}]]"
|
||||
)
|
||||
@@ -0,0 +1,97 @@
|
||||
# - Try to find libevent
|
||||
#.rst
|
||||
# FindLibevent
|
||||
# ------------
|
||||
#
|
||||
# Find Libevent include directories and libraries. Invoke as::
|
||||
#
|
||||
# find_package(Libevent
|
||||
# [version] [EXACT] # Minimum or exact version
|
||||
# [REQUIRED] # Fail if Libevent is not found
|
||||
# [COMPONENT <C>...]) # Libraries to look for
|
||||
#
|
||||
# Valid components are one or more of:: libevent core extra pthreads openssl.
|
||||
# Note that 'libevent' contains both core and extra. You must specify one of
|
||||
# them for the other components.
|
||||
#
|
||||
# This module will define the following variables::
|
||||
#
|
||||
# LIBEVENT_FOUND - True if headers and requested libraries were found
|
||||
# LIBEVENT_INCLUDE_DIRS - Libevent include directories
|
||||
# LIBEVENT_LIBRARIES - Libevent libraries to be linked
|
||||
# LIBEVENT_<C>_FOUND - Component <C> was found (<C> is uppercase)
|
||||
# LIBEVENT_<C>_LIBRARY - Library to be linked for Libevent component <C>.
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_LIBEVENT QUIET libevent)
|
||||
|
||||
# Look for the Libevent 2.0 or 1.4 headers
|
||||
find_path(LIBEVENT_INCLUDE_DIR
|
||||
NAMES
|
||||
event2/event-config.h
|
||||
event-config.h
|
||||
HINTS
|
||||
${PC_LIBEVENT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(LIBEVENT_INCLUDE_DIR)
|
||||
set(_version_regex "^#define[ \t]+_EVENT_VERSION[ \t]+\"([^\"]+)\".*")
|
||||
if(EXISTS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h")
|
||||
# Libevent 2.0
|
||||
file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event2/event-config.h"
|
||||
LIBEVENT_VERSION REGEX "${_version_regex}")
|
||||
if("${LIBEVENT_VERSION}" STREQUAL "")
|
||||
set(LIBEVENT_VERSION ${PC_LIBEVENT_VERSION})
|
||||
endif()
|
||||
else()
|
||||
# Libevent 1.4
|
||||
file(STRINGS "${LIBEVENT_INCLUDE_DIR}/event-config.h"
|
||||
LIBEVENT_VERSION REGEX "${_version_regex}")
|
||||
endif()
|
||||
string(REGEX REPLACE "${_version_regex}" "\\1"
|
||||
LIBEVENT_VERSION "${LIBEVENT_VERSION}")
|
||||
unset(_version_regex)
|
||||
endif()
|
||||
|
||||
set(_LIBEVENT_REQUIRED_VARS)
|
||||
foreach(COMPONENT ${Libevent_FIND_COMPONENTS})
|
||||
set(_LIBEVENT_LIBNAME libevent)
|
||||
# Note: compare two variables to avoid a CMP0054 policy warning
|
||||
if(COMPONENT STREQUAL _LIBEVENT_LIBNAME)
|
||||
set(_LIBEVENT_LIBNAME event)
|
||||
else()
|
||||
set(_LIBEVENT_LIBNAME "event_${COMPONENT}")
|
||||
endif()
|
||||
string(TOUPPER "${COMPONENT}" COMPONENT_UPPER)
|
||||
find_library(LIBEVENT_${COMPONENT_UPPER}_LIBRARY
|
||||
NAMES ${_LIBEVENT_LIBNAME}
|
||||
HINTS ${PC_LIBEVENT_LIBRARY_DIRS}
|
||||
)
|
||||
if(LIBEVENT_${COMPONENT_UPPER}_LIBRARY)
|
||||
set(Libevent_${COMPONENT}_FOUND 1)
|
||||
endif()
|
||||
list(APPEND _LIBEVENT_REQUIRED_VARS LIBEVENT_${COMPONENT_UPPER}_LIBRARY)
|
||||
endforeach()
|
||||
unset(_LIBEVENT_LIBNAME)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBEVENT_FOUND to TRUE
|
||||
# if all listed variables are TRUE and the requested version matches.
|
||||
find_package_handle_standard_args(Libevent REQUIRED_VARS
|
||||
${_LIBEVENT_REQUIRED_VARS}
|
||||
LIBEVENT_INCLUDE_DIR
|
||||
VERSION_VAR LIBEVENT_VERSION
|
||||
HANDLE_COMPONENTS)
|
||||
|
||||
if(LIBEVENT_FOUND)
|
||||
set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
|
||||
set(LIBEVENT_LIBRARIES)
|
||||
foreach(COMPONENT ${Libevent_FIND_COMPONENTS})
|
||||
string(TOUPPER "${COMPONENT}" COMPONENT_UPPER)
|
||||
list(APPEND LIBEVENT_LIBRARIES ${LIBEVENT_${COMPONENT_UPPER}_LIBRARY})
|
||||
set(LIBEVENT_${COMPONENT_UPPER}_FOUND ${Libevent_${COMPONENT}_FOUND})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBEVENT_INCLUDE_DIR ${_LIBEVENT_REQUIRED_VARS})
|
||||
unset(_LIBEVENT_REQUIRED_VARS)
|
||||
Executable
+291
@@ -0,0 +1,291 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import subprocess as sp
|
||||
import sys
|
||||
import json
|
||||
import urllib.request as req
|
||||
import jsonschema
|
||||
|
||||
|
||||
re_full = re.compile(r'(?P<name>^.*?$)(?P<desc>.*?)(^Argument.*?$(?P<args>.*?))?(^Result[^\n,]*?:\s*$(?P<resl>.*?))?(^Exampl.*?$(?P<exmp>.*))?', re.DOTALL | re.MULTILINE)
|
||||
re_argline = re.compile(r'^("?)(?P<name>\w.*?)\1(\s*:.+?,?\s*)?\s+\((?P<type>.*?)\)\s*(?P<desc>.*?)\s*$', re.DOTALL)
|
||||
|
||||
|
||||
def get_obj_from_dirty_text(full_object: str):
|
||||
lines = full_object.splitlines()
|
||||
lefts = []
|
||||
i = 0
|
||||
while i < len(lines):
|
||||
idx = lines[i].find('(')
|
||||
left = lines[i][0:idx].strip() if idx >= 0 else lines[i]
|
||||
left = left.rstrip('.') # handling , ...
|
||||
left = left.strip()
|
||||
left = left.rstrip(',')
|
||||
lefts.append(left)
|
||||
while idx >= 0 and i < len(lines) - 1:
|
||||
idx2 = len(re.match(r'^\s*', lines[i + 1]).group())
|
||||
if idx2 > idx:
|
||||
lines[i] += lines.pop(i + 1)[idx2 - 1:]
|
||||
else:
|
||||
break
|
||||
i += 1
|
||||
|
||||
ret = None
|
||||
try:
|
||||
property_stack = []
|
||||
object_stack = []
|
||||
name_stack = []
|
||||
|
||||
last_name = None
|
||||
for i in range(0, len(lines)):
|
||||
left = lefts[i]
|
||||
if not left:
|
||||
continue
|
||||
line = lines[i].strip()
|
||||
|
||||
arg_parsed = re_argline.fullmatch(line)
|
||||
property_refined_type = 'object'
|
||||
if arg_parsed is not None:
|
||||
property_name, property_type, property_desc = arg_parsed.group('name', 'type', 'desc')
|
||||
property_refined_type, property_required, property_child = get_type(property_type, None)
|
||||
|
||||
if property_refined_type is not 'array' and property_refined_type is not 'object':
|
||||
property_stack[-1][property_name] = {
|
||||
'type': property_refined_type,
|
||||
'description': property_desc
|
||||
}
|
||||
else:
|
||||
last_name = property_name
|
||||
elif len(left) > 1:
|
||||
match = re.match(r'^(\[)?"(?P<name>\w.*?)"(\])?.*', left)
|
||||
if match is not None:
|
||||
last_name = match.group('name')
|
||||
if match.group(1) is not None and match.group(3) is not None:
|
||||
left = '['
|
||||
property_refined_type = 'string'
|
||||
if 'string' not in line:
|
||||
raise NotImplementedError('Not implemented: ' + line)
|
||||
|
||||
if left.endswith('['):
|
||||
object_stack.append({'type': 'array', 'items': {'type': property_refined_type}})
|
||||
property_stack.append({})
|
||||
name_stack.append(last_name)
|
||||
elif left.endswith('{'):
|
||||
object_stack.append({'type': 'object'})
|
||||
property_stack.append({})
|
||||
name_stack.append(last_name)
|
||||
elif (left.endswith(']') and '[' not in left) or (left.endswith('}') and '{' not in left):
|
||||
obj = object_stack.pop()
|
||||
prop = property_stack.pop()
|
||||
name = name_stack.pop()
|
||||
if len(prop) > 0:
|
||||
if 'items' in obj:
|
||||
obj['items']['properties'] = prop
|
||||
else:
|
||||
obj['properties'] = prop
|
||||
if len(property_stack) > 0:
|
||||
if 'items' in object_stack[-1]:
|
||||
object_stack[-1]['items']['type'] = obj['type']
|
||||
if len(prop) > 0:
|
||||
object_stack[-1]['items']['properties'] = prop
|
||||
else:
|
||||
if name is None:
|
||||
raise RuntimeError('Not expected')
|
||||
property_stack[-1][name] = obj
|
||||
else:
|
||||
ret = obj
|
||||
if ret is not None:
|
||||
if i + 1 < len(lines) - 1:
|
||||
print('WARNING: unparsable data...', file=sys.stderr)
|
||||
lines = lines[i+1:]
|
||||
if not lines[0]:
|
||||
lines = lines[1:]
|
||||
nret = get_obj_from_dirty_text("\n".join(lines))
|
||||
if not nret:
|
||||
nret = get_obj_from_dirty_text("\n".join(lines[1:]))
|
||||
if nret:
|
||||
ret.update(nret)
|
||||
return ret
|
||||
except Exception as e:
|
||||
print('Exception: ' + str(e), file=sys.stderr)
|
||||
print('Unable to cope with: ' + '\n'.join(lines), file=sys.stderr)
|
||||
return None
|
||||
|
||||
|
||||
def get_type(arg_type: str, full_line: str):
|
||||
if arg_type is None:
|
||||
return 'string', True, None
|
||||
|
||||
required = 'required' in arg_type or 'optional' not in arg_type
|
||||
|
||||
arg_type = arg_type.lower()
|
||||
if 'array' in arg_type:
|
||||
return 'array', required, None
|
||||
if 'numeric' in arg_type or 'number' in arg_type:
|
||||
return 'number', required, None
|
||||
if 'bool' in arg_type:
|
||||
return 'boolean', required, None
|
||||
if 'string' in arg_type:
|
||||
return 'string', required, None
|
||||
if 'object' in arg_type:
|
||||
properties = get_obj_from_dirty_text(full_line) if full_line is not None else None
|
||||
return 'object', required, properties
|
||||
|
||||
if arg_type.startswith('optional'):
|
||||
return 'optional', required, None
|
||||
if arg_type.startswith('json'):
|
||||
return 'json', required, None
|
||||
|
||||
print('Unable to derive type from: ' + arg_type, file=sys.stderr)
|
||||
return None, False, None
|
||||
|
||||
|
||||
def get_default(arg_refined_type: str, arg_type: str):
|
||||
if 'default=' in arg_type:
|
||||
if 'number' in arg_refined_type:
|
||||
return int(re.match('.*default=([^,)]+)', arg_type).group(1))
|
||||
if 'string' in arg_refined_type:
|
||||
return re.match('.*default=([^,)]+)', arg_type).group(1)
|
||||
if 'boolean' in arg_refined_type:
|
||||
if 'default=true' in arg_type:
|
||||
return True
|
||||
if 'default=false' in arg_type:
|
||||
return False
|
||||
raise NotImplementedError('Not implemented: ' + arg_type)
|
||||
if 'array' in arg_type:
|
||||
raise NotImplementedError('Not implemented: ' + arg_type)
|
||||
return None
|
||||
|
||||
|
||||
def parse_single_argument(line: str):
|
||||
if line:
|
||||
line = line.strip()
|
||||
if not line or line.startswith('None'):
|
||||
return None, None, False
|
||||
|
||||
arg_parsed = re_argline.fullmatch(line)
|
||||
if arg_parsed is None:
|
||||
if line.startswith('{') or line.startswith('['):
|
||||
return get_obj_from_dirty_text(line), None, True
|
||||
else:
|
||||
print("Unparsable argument: " + line, file=sys.stderr)
|
||||
descriptor = {
|
||||
'type': 'array' if line.startswith('[') else 'object',
|
||||
'description': line,
|
||||
}
|
||||
return descriptor, None, True
|
||||
|
||||
arg_name, arg_type, arg_desc = arg_parsed.group('name', 'type', 'desc')
|
||||
if not arg_type:
|
||||
raise NotImplementedError('Not implemented: ' + arg_type)
|
||||
arg_refined_type, arg_required, arg_properties = get_type(arg_type, arg_desc)
|
||||
|
||||
if arg_properties is not None:
|
||||
return arg_properties, arg_name, arg_required
|
||||
|
||||
arg_refined_default = get_default(arg_refined_type, arg_type)
|
||||
arg_desc = re.sub('\s+', ' ', arg_desc.strip()) \
|
||||
if arg_desc and arg_refined_type is not 'object' and arg_refined_type is not 'array' \
|
||||
else arg_desc.strip() if arg_desc else ''
|
||||
|
||||
descriptor = {
|
||||
'type': arg_refined_type,
|
||||
'description': arg_desc,
|
||||
}
|
||||
if arg_refined_default is not None:
|
||||
descriptor['default'] = arg_refined_default
|
||||
return descriptor, arg_name, arg_required
|
||||
|
||||
|
||||
def parse_params(args: str):
|
||||
arguments = {}
|
||||
requireds = []
|
||||
if args:
|
||||
for line in re.split('\s*\d+\.\s+', args, re.DOTALL):
|
||||
descriptor, name, required = parse_single_argument(line)
|
||||
if descriptor is None:
|
||||
continue
|
||||
if required:
|
||||
requireds.append(name)
|
||||
arguments[name] = descriptor
|
||||
return arguments, requireds
|
||||
|
||||
|
||||
def get_api(section_name: str, command: str, command_help: str):
|
||||
|
||||
parsed = re_full.fullmatch(command_help)
|
||||
if parsed is None:
|
||||
raise RuntimeError('Unable to resolve help format for ' + command)
|
||||
|
||||
name, desc, args, resl, exmp = parsed.group('name', 'desc', 'args', 'resl', 'exmp')
|
||||
|
||||
properties, required = parse_params(args)
|
||||
result_descriptor, result_name, result_required = parse_single_argument(resl)
|
||||
|
||||
desc = re.sub('\s+', ' ', desc.strip()) if desc else name
|
||||
example_array = exmp.splitlines() if exmp else []
|
||||
|
||||
ret = {
|
||||
'summary': desc,
|
||||
'description': example_array,
|
||||
'tags': [section_name],
|
||||
'params': {
|
||||
'type': 'object',
|
||||
'properties': properties,
|
||||
'required': required
|
||||
},
|
||||
}
|
||||
if result_descriptor is not None:
|
||||
ret['result'] = result_descriptor
|
||||
return ret
|
||||
|
||||
|
||||
def write_api():
|
||||
if len(sys.argv) < 2:
|
||||
print("Missing required argument: <path to CLI tool>", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
cli_tool = sys.argv[1]
|
||||
result = sp.run([cli_tool, "help"], stdout=sp.PIPE, universal_newlines=True)
|
||||
commands = result.stdout
|
||||
sections = re.split('^==\s*(.*?)\s*==$', commands, flags=re.MULTILINE)
|
||||
methods = {}
|
||||
for section in sections:
|
||||
if not section:
|
||||
continue
|
||||
lines = section.splitlines()
|
||||
if len(lines) == 1:
|
||||
section_name = lines[0]
|
||||
continue
|
||||
for command in sorted(lines[1:]):
|
||||
if not command:
|
||||
continue
|
||||
command = command.split(' ')[0]
|
||||
result = sp.run([cli_tool, "help", command], stdout=sp.PIPE, universal_newlines=True)
|
||||
methods[command] = get_api(section_name, command, result.stdout)
|
||||
|
||||
version = sp.run([cli_tool, "--version"], stdout=sp.PIPE, universal_newlines=True)
|
||||
wrapper = {
|
||||
'$schema': 'https://rawgit.com/mzernetsch/jrgen/master/jrgen-spec.schema.json',
|
||||
'jrgen': '1.1',
|
||||
'jsonrpc': '1.0', # see https://github.com/bitcoin/bitcoin/pull/12435
|
||||
'info': {
|
||||
'title': 'lbrycrd RPC API',
|
||||
'version': version.stdout.strip(),
|
||||
'description': []
|
||||
},
|
||||
'definitions': {}, # for items used in $ref further down
|
||||
'methods': methods,
|
||||
}
|
||||
|
||||
schema = req.urlopen(wrapper['$schema']).read().decode('utf-8')
|
||||
try:
|
||||
jsonschema.validate(wrapper, schema)
|
||||
except Exception as e:
|
||||
print('From schema validation: ' + str(e), file=sys.stderr)
|
||||
|
||||
print(json.dumps(wrapper, indent=4))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
write_api()
|
||||
Executable
+134
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import subprocess as sp
|
||||
import sys
|
||||
import json
|
||||
|
||||
re_full = re.compile(r'(?P<name>^.*?$)(?P<desc>.*?)(^Argument.*?$(?P<args>.*?))?(^Result[^\n]*?:\s*$(?P<resl>.*?))?(^Exampl.*?$(?P<exmp>.*))?', re.DOTALL | re.MULTILINE)
|
||||
re_argline = re.compile(r'^("?)(?P<name>.*?)\1\s+\((?P<type>.*?)\)\s*(?P<desc>.*)$', re.DOTALL)
|
||||
|
||||
|
||||
def get_type(arg_type, full_line):
|
||||
if arg_type is None:
|
||||
return 'string'
|
||||
|
||||
arg_type = arg_type.lower().split(',')[0].strip()
|
||||
if 'numeric' in arg_type:
|
||||
return 'number'
|
||||
if 'bool' in arg_type:
|
||||
return 'boolean'
|
||||
if 'array' in arg_type:
|
||||
return 'array'
|
||||
if 'object' in arg_type:
|
||||
return 'object'
|
||||
|
||||
supported_types = ['number', 'string', 'object', 'array', 'optional']
|
||||
if arg_type in supported_types:
|
||||
return arg_type
|
||||
|
||||
print("get_type: WARNING", arg_type, "is not supported type", file=sys.stderr)
|
||||
return arg_type
|
||||
|
||||
|
||||
def parse_params(args):
|
||||
arguments = []
|
||||
if args:
|
||||
for line in re.split('\s*\d+\.\s+', args, re.DOTALL):
|
||||
if not line or not line.strip() or line.strip().startswith('None'):
|
||||
continue
|
||||
arg_parsed = re_argline.fullmatch(line)
|
||||
if arg_parsed is None:
|
||||
continue
|
||||
arg_name, arg_type, arg_desc = arg_parsed.group('name', 'type', 'desc')
|
||||
if not arg_type:
|
||||
raise Exception('Not implemented: ' + arg_type)
|
||||
arg_required = 'required' in arg_type or 'optional' not in arg_type
|
||||
arg_refined_type = get_type(arg_type, line)
|
||||
arg_desc = re.sub('\s+', ' ', arg_desc.strip()) if arg_desc else []
|
||||
arguments.append({
|
||||
'name': arg_name,
|
||||
'type': arg_refined_type,
|
||||
'description': arg_desc,
|
||||
'is_required': arg_required
|
||||
})
|
||||
return arguments
|
||||
|
||||
|
||||
def process_examples(examples: str):
|
||||
if not examples:
|
||||
return []
|
||||
examples = examples.strip()
|
||||
splits = examples.split('\n')
|
||||
result = []
|
||||
inner = {}
|
||||
for s in splits:
|
||||
if not s:
|
||||
continue
|
||||
if '> curl' in s:
|
||||
inner['curl'] = s.strip()
|
||||
elif '> lbrycrd' in s:
|
||||
inner['cli'] = s.strip()
|
||||
else:
|
||||
if 'title' in inner:
|
||||
result.append(inner)
|
||||
inner = {}
|
||||
inner['title'] = s.strip()
|
||||
result.append(inner)
|
||||
return result
|
||||
|
||||
|
||||
def get_api(section_name, command, command_help):
|
||||
|
||||
parsed = re_full.fullmatch(command_help)
|
||||
if parsed is None:
|
||||
raise Exception('Unable to resolve help format for ' + command)
|
||||
|
||||
name, desc, args, resl, exmp = parsed.group('name', 'desc', 'args', 'resl', 'exmp')
|
||||
|
||||
arguments = parse_params(args)
|
||||
|
||||
cmd_desc = re.sub('\s+', ' ', desc.strip()) if desc else ''
|
||||
examp_desc = process_examples(exmp)
|
||||
cmd_resl = resl.strip() if resl else None
|
||||
|
||||
ret = {
|
||||
'name': command,
|
||||
'namespace': section_name,
|
||||
'description': cmd_desc,
|
||||
'arguments': arguments,
|
||||
'examples': examp_desc
|
||||
}
|
||||
if cmd_resl is not None:
|
||||
ret['returns'] = cmd_resl
|
||||
return ret
|
||||
|
||||
|
||||
def write_api():
|
||||
if len(sys.argv) < 2:
|
||||
print("Missing required argument: <path to CLI tool>", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
cli_tool = sys.argv[1]
|
||||
result = sp.run([cli_tool, "help"], stdout=sp.PIPE, universal_newlines=True)
|
||||
commands = result.stdout
|
||||
sections = re.split('^==\s*(.*?)\s*==$', commands, flags=re.MULTILINE)
|
||||
apis = []
|
||||
for section in sections:
|
||||
if not section:
|
||||
continue
|
||||
lines = section.splitlines()
|
||||
if len(lines) == 1:
|
||||
section_name = lines[0]
|
||||
continue
|
||||
for command in sorted(lines[1:]):
|
||||
if not command:
|
||||
continue
|
||||
command = command.split(' ')[0]
|
||||
result = sp.run([cli_tool, "help", command], stdout=sp.PIPE, universal_newlines=True)
|
||||
apis.append(get_api(section_name, command, result.stdout))
|
||||
|
||||
print(json.dumps(apis, indent=4))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
write_api()
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -13,7 +13,7 @@ package_name_ns = sys.argv[2]
|
||||
ds = DSStore.open(output_file, 'w+')
|
||||
ds['.']['bwsp'] = {
|
||||
'ShowStatusBar': False,
|
||||
'WindowBounds': b'{{300, 280}, {500, 343}}',
|
||||
'WindowBounds': '{{300, 280}, {500, 343}}',
|
||||
'ContainerShowSidebar': False,
|
||||
'SidebarWidth': 0,
|
||||
'ShowTabView': False,
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
## Stratum Server Instructions
|
||||
In simple terms, the stratum protocol is a protocol to distribute crypto mining work to multiple miners. Mining pools typically run a stratum endpoint that the various miners communicate with.
|
||||
Please refer to other web sources for more information about mining pools or the stratum protocol.
|
||||
|
||||
When mining LBC, you can solo mine directly to an instance of a full node (using the node's wallet). Or you can mine as part of a pool.
|
||||
You can host your own pool or use one of the many hosted LBC pools. See https://miningpoolstats.stream/lbry
|
||||
|
||||
This document refers to Yiimp, a derivative of Yaamp, as found here: https://github.com/tpruvot/yiimp.git .
|
||||
Please refer to the instructions there as well. Yiimp has supported LBRY mining for several years.
|
||||
|
||||
Yiimp consists of two pieces: the web GUI for pool management (written in PHP) and the Stratum server (written in C++). The two communicate via polling a MySQL database (or MariaDB).
|
||||
The web GUI and configuration of the pooling rewards, fees, etc. are out of scope here.
|
||||
|
||||
To help you with running Yiimp, we have created two docker images: one for the DB and one for the Yiimp Stratum Server. (See the subfolders.)
|
||||
Use of the Docker images is optional; you can refer to other Yiimp and MySQL documentation for running it without Docker.
|
||||
If you are using your own database instance, you will need to import the Yiimp SQL files to establish the yaamp database.
|
||||
See https://github.com/tpruvot/yiimp/tree/next/sql .
|
||||
|
||||
### Sample Usage Steps:
|
||||
|
||||
#### 1. Run the full lbrycrd node:
|
||||
```
|
||||
./lbrycrdd -testnet -rpcuser=ruser -rpcpassword=rpswd -deprecatedrpc=validateaddress -deprecatedrpc=accounts -daemon
|
||||
```
|
||||
The included deprecated RPCs are required for compatibility with Yiimp.
|
||||
It will need to be caught up to the current block before it is ready.
|
||||
Remove `-testnet` for the real deal.
|
||||
#### 2. Run and initialize the datatabase:
|
||||
```
|
||||
docker run -d -e MYSQL_ROOT_PASSWORD=patofpaq -e MYSQL_DATABASE=yaamp --network host --name db lbry/yiimp_db
|
||||
|
||||
docker exec -it db mysql -uroot -ppatofpaq
|
||||
use yaamp;
|
||||
delete from coins;
|
||||
insert into coins(name, symbol, symbol2, algo, enable, auto_ready, rpcuser, rpcpasswd, rpchost, rpcport, rpccurl, rpcencoding, hasgetinfo, hassubmitblock, usememorypool, usesegwit, auxpow)
|
||||
values('Local LBRY Instance', 'LBC', 'LBC', 'lbry', 1, 1, 'ruser', 'rpswd', '127.0.0.1', 19245, 1, 'utf-8', 0, 1, 0, 0, 0);
|
||||
exit
|
||||
```
|
||||
Use port 19245 for testnet, port 9245 for main.
|
||||
#### 3. Run the stratum server:
|
||||
```
|
||||
docker run --network host -d lbry/yiimp_stratum
|
||||
```
|
||||
Alternatively, to get more output or see how its called directly:
|
||||
```
|
||||
docker run --network host -it lbry/yiimp_stratum bash
|
||||
cat config/lbry.conf
|
||||
./stratum config/lbry
|
||||
```
|
||||
|
||||
#### 4. Connect sgminer to it:
|
||||
```
|
||||
sgminer -k lbry -o stratum+tcp://127.0.0.1:3334/ -D -T -O mn824Su1wX7ip8WcNYzXwwWqvBvkeWGRo6:x
|
||||
```
|
||||
The username there is the account to receive payments from the pool. The password is unused. Tested with https://github.com/lbryio/sgminer-gm.
|
||||
You can use whatever miner you prefer.
|
||||
@@ -0,0 +1,34 @@
|
||||
FROM mariadb:10.1-bionic
|
||||
ARG REPOSITORY=https://github.com/tpruvot/yiimp.git
|
||||
|
||||
ENV BUILD_DEPS \
|
||||
ca-certificates \
|
||||
git
|
||||
|
||||
COPY init-db.sh /docker-entrypoint-initdb.d/
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ${BUILD_DEPS} \
|
||||
&& git clone --progress ${REPOSITORY} ~/yiimp \
|
||||
&& mkdir /tmp/sql \
|
||||
&& mv ~/yiimp/sql/2016-04-03-yaamp.sql.gz /tmp/sql/0000-00-00-initial.sql.gz \
|
||||
&& cp ~/yiimp/sql/*.sql /tmp/sql \
|
||||
&& apt-get purge -y --auto-remove ${BUILD_DEPS} \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf ~/yiimp
|
||||
|
||||
EXPOSE 3306
|
||||
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
LABEL maintainer="blockchain@lbry.com" \
|
||||
decription="yiimp_db" \
|
||||
version="1.0" \
|
||||
org.label-schema.name="yiimp_db" \
|
||||
org.label-schema.description="Use this to run a compatible MariaDB for yiimp's stratum server" \
|
||||
org.label-schema.build-date=$BUILD_DATE \
|
||||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.vcs-url="https://github.com/lbryio/lbrycrd" \
|
||||
org.label-schema.schema-version="1.0.0-rc1" \
|
||||
org.label-schema.vendor="LBRY" \
|
||||
org.label-schema.docker.cmd="docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` -t lbry/yiimp_db yiimp_db"
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
for f in /tmp/sql/*; do
|
||||
case "$f" in
|
||||
*.sql) echo "$0: running $f"; "${mysql[@]}" --force < "$f"; echo ;;
|
||||
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;;
|
||||
*) echo "$0: ignoring $f" ;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
@@ -0,0 +1,54 @@
|
||||
FROM alpine:3.7
|
||||
ARG REPOSITORY=https://github.com/tpruvot/yiimp.git
|
||||
|
||||
ENV BUILD_DEPS \
|
||||
build-base \
|
||||
git
|
||||
|
||||
ENV RUN_DEPS \
|
||||
curl-dev \
|
||||
gmp-dev \
|
||||
mariadb-dev \
|
||||
libssh2-dev \
|
||||
curl
|
||||
|
||||
RUN apk update \
|
||||
&& apk add --no-cache ${BUILD_DEPS} \
|
||||
&& apk add --no-cache ${RUN_DEPS} \
|
||||
&& git clone --progress ${REPOSITORY} ~/yiimp \
|
||||
&& sed -i 's/ulong/uint64_t/g' ~/yiimp/stratum/algos/rainforest.c \
|
||||
&& find ~/yiimp -name '*akefile' -exec sed -i 's/-march=native//g' {} + \
|
||||
&& make -C ~/yiimp/stratum/iniparser \
|
||||
&& make -C ~/yiimp/stratum \
|
||||
&& mkdir /var/stratum /var/stratum/config \
|
||||
&& cp ~/yiimp/stratum/run.sh /var/stratum \
|
||||
&& cp ~/yiimp/stratum/config/run.sh /var/stratum/config \
|
||||
&& cp ~/yiimp/stratum/stratum /var/stratum \
|
||||
&& cp ~/yiimp/stratum/config.sample/lbry.conf /var/stratum/config \
|
||||
&& sed -i 's/yaamp.com/127.0.0.1/g' /var/stratum/config/lbry.conf \
|
||||
&& sed -i 's/yaampdb/127.0.0.1/g' /var/stratum/config/lbry.conf \
|
||||
&& rm -rf ~/yiimp \
|
||||
&& apk del ${BUILD_DEPS} \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
LABEL maintainer="blockchain@lbry.com" \
|
||||
decription="yiimp_stratum" \
|
||||
version="1.0" \
|
||||
org.label-schema.name="yiimp_stratum" \
|
||||
org.label-schema.description="Use this to run yiimp's stratum server in lbry mode" \
|
||||
org.label-schema.build-date=$BUILD_DATE \
|
||||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.vcs-url="https://github.com/lbryio/lbrycrd" \
|
||||
org.label-schema.schema-version="1.0.0-rc1" \
|
||||
org.label-schema.vendor="LBRY" \
|
||||
org.label-schema.docker.cmd="docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` -t lbry/yiimp_stratum yiimp_stratum"
|
||||
|
||||
WORKDIR /var/stratum
|
||||
|
||||
CMD ["./stratum", "config/lbry"]
|
||||
|
||||
EXPOSE 3334
|
||||
+1
-1
@@ -9,4 +9,4 @@ mips*
|
||||
arm*
|
||||
aarch64*
|
||||
riscv32*
|
||||
riscv64*
|
||||
riscv64*
|
||||
+2
-2
@@ -122,8 +122,8 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
|
||||
$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id)
|
||||
$(AT)@mkdir -p $(@D)
|
||||
$(AT)sed -e 's|@HOST@|$(host)|' \
|
||||
-e 's|@CC@|$(toolchain_path)$(host_CC)|' \
|
||||
-e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \
|
||||
-e 's|@CC@|$(host_CC)|' \
|
||||
-e 's|@CXX@|$(host_CXX)|' \
|
||||
-e 's|@AR@|$(toolchain_path)$(host_AR)|' \
|
||||
-e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \
|
||||
-e 's|@NM@|$(toolchain_path)$(host_NM)|' \
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ For linux RISC-V 64-bit cross compilation (there are no packages for 32-bit):
|
||||
|
||||
sudo apt-get install curl g++-riscv64-linux-gnu binutils-riscv64-linux-gnu
|
||||
|
||||
RISC-V known issue: gcc-7.3.0 and gcc-7.3.1 result in a broken `test_bitcoin` executable (see https://github.com/bitcoin/bitcoin/pull/13543),
|
||||
RISC-V known issue: gcc-7.3.0 and gcc-7.3.1 result in a broken `test_lbrycrd` executable (see https://github.com/bitcoin/bitcoin/pull/13543),
|
||||
this is apparently fixed in gcc-8.1.0.
|
||||
|
||||
Dependency Options:
|
||||
@@ -67,7 +67,7 @@ The following can be set when running make: make FOO=bar
|
||||
BUILD_ID_SALT: Optional salt to use when generating build package ids
|
||||
|
||||
If some packages are not built, for example `make NO_WALLET=1`, the appropriate
|
||||
options will be passed to bitcoin's configure. In this case, `--disable-wallet`.
|
||||
options will be passed to lbrycrd's configure. In this case, `--disable-wallet`.
|
||||
|
||||
Additional targets:
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
build_darwin_CC: = $(shell xcrun -f clang)
|
||||
build_darwin_CXX: = $(shell xcrun -f clang++)
|
||||
build_darwin_AR: = $(shell xcrun -f ar)
|
||||
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
|
||||
build_darwin_STRIP: = $(shell xcrun -f strip)
|
||||
build_darwin_OTOOL: = $(shell xcrun -f otool)
|
||||
build_darwin_NM: = $(shell xcrun -f nm)
|
||||
build_darwin_CC:=$(shell xcrun -f clang)
|
||||
build_darwin_CXX:=$(shell xcrun -f clang++)
|
||||
build_darwin_AR:=$(shell xcrun -f ar)
|
||||
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
|
||||
build_darwin_STRIP:=$(shell xcrun -f strip)
|
||||
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) -o
|
||||
build_darwin_SHA256SUM=shasum -a 256
|
||||
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)
|
||||
|
||||
+2
-2
@@ -174,7 +174,7 @@ $($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted)
|
||||
$(AT)echo Preprocessing $(1)...
|
||||
$(AT)mkdir -p $$(@D) $($(1)_patch_dir)
|
||||
$(AT)$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;)
|
||||
$(AT)cd $$(@D); $(call $(1)_preprocess_cmds, $(1))
|
||||
$(AT)+cd $$(@D); $(call $(1)_preprocess_cmds, $(1))
|
||||
$(AT)touch $$@
|
||||
$($(1)_configured): | $($(1)_preprocessed)
|
||||
$(AT)echo Configuring $(1)...
|
||||
@@ -190,7 +190,7 @@ $($(1)_built): | $($(1)_configured)
|
||||
$($(1)_staged): | $($(1)_built)
|
||||
$(AT)echo Staging $(1)...
|
||||
$(AT)mkdir -p $($(1)_staging_dir)/$(host_prefix)
|
||||
$(AT)cd $($(1)_build_dir); $($(1)_stage_env) $(call $(1)_stage_cmds, $(1))
|
||||
$(AT)+cd $($(1)_build_dir); $($(1)_stage_env) $(call $(1)_stage_cmds, $(1))
|
||||
$(AT)rm -rf $($(1)_extract_dir)
|
||||
$(AT)touch $$@
|
||||
$($(1)_postprocessed): | $($(1)_staged)
|
||||
|
||||
@@ -2,8 +2,9 @@ OSX_MIN_VERSION=10.10
|
||||
OSX_SDK_VERSION=10.11
|
||||
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
|
||||
LD64_VERSION=253.9
|
||||
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
|
||||
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -stdlib=libc++
|
||||
|
||||
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) -isysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B $(host_prefix)/native/bin
|
||||
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) -isysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B $(host_prefix)/native/bin
|
||||
|
||||
darwin_CFLAGS=-pipe
|
||||
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||
@@ -11,7 +12,7 @@ darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||
darwin_release_CFLAGS=-O2
|
||||
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
|
||||
|
||||
darwin_debug_CFLAGS=-O1
|
||||
darwin_debug_CFLAGS=-Og
|
||||
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
|
||||
|
||||
darwin_native_toolchain=native_cctools
|
||||
darwin_native_toolchain=native_cctools
|
||||
@@ -4,28 +4,28 @@ linux_CXXFLAGS=$(linux_CFLAGS)
|
||||
linux_release_CFLAGS=-O2
|
||||
linux_release_CXXFLAGS=$(linux_release_CFLAGS)
|
||||
|
||||
linux_debug_CFLAGS=-O1
|
||||
linux_debug_CFLAGS=-Og
|
||||
linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
|
||||
|
||||
linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
|
||||
|
||||
ifeq (86,$(findstring 86,$(build_arch)))
|
||||
i686_linux_CC=gcc -m32
|
||||
i686_linux_CXX=g++ -m32
|
||||
i686_linux_CC=cc -m32
|
||||
i686_linux_CXX=c++ -m32
|
||||
i686_linux_AR=ar
|
||||
i686_linux_RANLIB=ranlib
|
||||
i686_linux_NM=nm
|
||||
i686_linux_STRIP=strip
|
||||
|
||||
x86_64_linux_CC=gcc -m64
|
||||
x86_64_linux_CXX=g++ -m64
|
||||
x86_64_linux_CC=cc -m64
|
||||
x86_64_linux_CXX=c++ -m64
|
||||
x86_64_linux_AR=ar
|
||||
x86_64_linux_RANLIB=ranlib
|
||||
x86_64_linux_NM=nm
|
||||
x86_64_linux_STRIP=strip
|
||||
else
|
||||
i686_linux_CC=$(default_host_CC) -m32
|
||||
i686_linux_CXX=$(default_host_CXX) -m32
|
||||
x86_64_linux_CC=$(default_host_CC) -m64
|
||||
x86_64_linux_CXX=$(default_host_CXX) -m64
|
||||
i686_linux_CC=cc -m32
|
||||
i686_linux_CXX=c++ -m32
|
||||
x86_64_linux_CC=cc -m64
|
||||
x86_64_linux_CXX=c++ -m64
|
||||
endif
|
||||
@@ -1,14 +1,19 @@
|
||||
package=boost
|
||||
$(package)_version=1_64_0
|
||||
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/
|
||||
$(package)_version=1_69_0
|
||||
$(package)_download_path=https://dl.bintray.com/boostorg/release/1.69.0/source/
|
||||
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
|
||||
$(package)_sha256_hash=8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406
|
||||
$(package)_dependencies=icu
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts_release=variant=release
|
||||
$(package)_config_opts_debug=variant=debug
|
||||
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam
|
||||
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
|
||||
$(package)_config_opts+=boost.locale.iconv=off boost.locale.posix=off boost.locale.icu=on boost.locale.std=off -sICU_PATH="$(host_prefix)"
|
||||
# The stupid ICU_LINK handling reorders the dependencies alphabetically, thus making it impossible to get the link order correct.
|
||||
# To work around this we're using the ldflags below but we need ICU_LINK to be non-blank so that we don't get an auto-generated conflict with ldflags.
|
||||
$(package)_config_opts+=-sICU_LINK="-time"
|
||||
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
|
||||
$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared
|
||||
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
|
||||
@@ -19,9 +24,15 @@ $(package)_toolset_$(host_os)=gcc
|
||||
$(package)_archiver_$(host_os)=$($(package)_ar)
|
||||
$(package)_toolset_darwin=darwin
|
||||
$(package)_archiver_darwin=$($(package)_libtool)
|
||||
$(package)_config_libraries=chrono,filesystem,system,thread,test
|
||||
$(package)_cxxflags=-std=c++11 -fvisibility=hidden
|
||||
$(package)_config_libraries=chrono,filesystem,system,locale,thread,test
|
||||
$(package)_cxxflags=-std=c++11 -fvisibility=hidden -Wno-deprecated
|
||||
$(package)_cxxflags_linux=-fPIC
|
||||
# The ideal doesn't work because vars are evaluated before any dependency is processed:
|
||||
# $(package)_ldflags=$$(shell PKG_CONFIG_SYSROOT_DIR=/ PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig pkg-config icu-io icu-uc icu-i18n --libs)
|
||||
# So we substitute poorly (as these may not actually match all scenarios):
|
||||
$(package)_ldflags_mingw32=-L$(host_prefix)/lib -lsicuio -lsicuuc -lsicudt
|
||||
$(package)_ldflags_linux=-L$(host_prefix)/lib -licuio -licuuc -licudata -licui18n
|
||||
$(package)_ldflags_darwin=-L$(host_prefix)/lib -licuio -licuuc -licudata -licui18n
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
@@ -29,13 +40,13 @@ define $(package)_preprocess_cmds
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
./bootstrap.sh --without-icu --with-libraries=$(boost_config_libraries)
|
||||
./bootstrap.sh --with-icu="$(host_prefix)" --with-libraries="$(boost_config_libraries)"
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
./b2 -d2 -j2 -d1 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) stage
|
||||
./b2 -d2 -j`getconf _NPROCESSORS_ONLN` -d1 --reconfigure --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) stage
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install
|
||||
./b2 -d0 -j`getconf _NPROCESSORS_ONLN` --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install
|
||||
endef
|
||||
@@ -0,0 +1,44 @@
|
||||
package=icu
|
||||
$(package)_version=63_2
|
||||
$(package)_download_path=https://github.com/unicode-org/icu/releases/download/release-63-2/
|
||||
$(package)_file_name=$(package)4c-$($(package)_version)-src.tgz
|
||||
$(package)_sha256_hash=4671e985b5c11252bff3c2374ab84fd73c609f2603bb6eb23b8b154c69ea4215
|
||||
$(package)_build_subdir=source
|
||||
$(package)_standard_opts=--disable-extras --disable-strict --enable-static --disable-shared --disable-tests --disable-samples --disable-dyload --disable-layoutex
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=$($(package)_standard_opts)
|
||||
$(package)_config_opts_debug=--enable-debug --disable-release
|
||||
$(package)_config_opts_release=--disable-debug --enable-release
|
||||
$(package)_config_opts_mingw32=--with-cross-build="$($(package)_extract_dir)/build"
|
||||
$(package)_config_opts_darwin=--with-cross-build="$($(package)_extract_dir)/build" LIBTOOL="$($(package)_libtool)"
|
||||
$(package)_archiver_darwin=$($(package)_libtool)
|
||||
$(package)_cflags_linux=-fPIC
|
||||
$(package)_cppflags_linux=-fPIC
|
||||
$(package)_cxxflags=-std=c++11
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
PKG_CONFIG_SYSROOT_DIR=/ \
|
||||
PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig \
|
||||
PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig \
|
||||
sed -i.old 's/^GEN_DEPS.cc.*/& $(CXXFLAGS)/' source/config/mh-mingw* && \
|
||||
mkdir -p build && cd build && \
|
||||
../source/runConfigureICU Linux $($(package)_standard_opts) CXXFLAGS=-std=c++11 && \
|
||||
$(MAKE) && cd ..
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
PKG_CONFIG_SYSROOT_DIR=/ \
|
||||
PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig \
|
||||
PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig \
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
||||
@@ -4,37 +4,12 @@ $(package)_download_path=https://github.com/theuni/cctools-port/archive
|
||||
$(package)_file_name=$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=a09c9ba4684670a0375e42d9d67e7f12c1f62581a27f28f7c825d6d7032ccc6a
|
||||
$(package)_build_subdir=cctools
|
||||
$(package)_clang_version=3.7.1
|
||||
$(package)_clang_download_path=http://llvm.org/releases/$($(package)_clang_version)
|
||||
$(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
||||
$(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
||||
$(package)_clang_sha256_hash=99b28a6b48e793705228a390471991386daa33a9717cd9ca007fcdde69608fd9
|
||||
$(package)_extra_sources=$($(package)_clang_file_name)
|
||||
|
||||
define $(package)_fetch_cmds
|
||||
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
|
||||
$(call fetch_file,$(package),$($(package)_clang_download_path),$($(package)_clang_download_file),$($(package)_clang_file_name),$($(package)_clang_sha256_hash))
|
||||
endef
|
||||
|
||||
define $(package)_extract_cmds
|
||||
mkdir -p $($(package)_extract_dir) && \
|
||||
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
echo "$($(package)_clang_sha256_hash) $($(package)_source_dir)/$($(package)_clang_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
|
||||
mkdir -p toolchain/bin toolchain/lib/clang/3.5/include && \
|
||||
tar --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \
|
||||
rm -f toolchain/lib/libc++abi.so* && \
|
||||
echo "#!/bin/sh" > toolchain/bin/$(host)-dsymutil && \
|
||||
echo "exit 0" >> toolchain/bin/$(host)-dsymutil && \
|
||||
chmod +x toolchain/bin/$(host)-dsymutil && \
|
||||
tar --strip-components=1 -xf $($(package)_source)
|
||||
endef
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--target=$(host) --disable-lto-support
|
||||
$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
|
||||
$(package)_cc=$($(package)_extract_dir)/toolchain/bin/clang
|
||||
$(package)_cxx=$($(package)_extract_dir)/toolchain/bin/clang++
|
||||
$(package)_config_opts=--target=$(host) --disable-lto-support --prefix=/
|
||||
$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
|
||||
$(package)_cc=cc
|
||||
$(package)_cxx=c++
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
@@ -51,15 +26,6 @@ define $(package)_build_cmds
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install && \
|
||||
cd $($(package)_extract_dir)/toolchain && \
|
||||
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include && \
|
||||
mkdir -p $($(package)_staging_prefix_dir)/bin $($(package)_staging_prefix_dir)/include && \
|
||||
cp bin/clang $($(package)_staging_prefix_dir)/bin/ &&\
|
||||
cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin/ &&\
|
||||
cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \
|
||||
cp -rf lib/clang/$($(package)_clang_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include/ && \
|
||||
cp bin/llvm-dsymutil $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \
|
||||
if `test -d include/c++/`; then cp -rf include/c++/ $($(package)_staging_prefix_dir)/include/; fi && \
|
||||
if `test -d lib/c++/`; then cp -rf lib/c++/ $($(package)_staging_prefix_dir)/lib/; fi
|
||||
mkdir -p $($(package)_staging_prefix_dir) && \
|
||||
$(MAKE) DESTDIR=$($(package)_staging_prefix_dir) install
|
||||
endef
|
||||
@@ -1,4 +1,4 @@
|
||||
packages:=boost openssl libevent zeromq
|
||||
packages:=icu boost openssl libevent zeromq
|
||||
|
||||
qt_native_packages = native_protobuf
|
||||
qt_packages = qrencode protobuf zlib
|
||||
|
||||
@@ -2,13 +2,16 @@ PACKAGE=qt
|
||||
$(package)_version=5.9.6
|
||||
$(package)_download_path=https://download.qt.io/official_releases/qt/5.9/$($(package)_version)/submodules
|
||||
$(package)_suffix=opensource-src-$($(package)_version).tar.xz
|
||||
#$(package)_version=5.12.3
|
||||
#$(package)_download_path=http://download.qt.io/official_releases/qt/5.12/$($(package)_version)/submodules
|
||||
#$(package)_suffix=opensource-src-$($(package)_version).tar.gz
|
||||
$(package)_file_name=qtbase-$($(package)_suffix)
|
||||
$(package)_sha256_hash=eed620cb268b199bd83b3fc6a471c51d51e1dc2dbb5374fc97a0cc75facbe36f
|
||||
$(package)_dependencies=openssl zlib
|
||||
$(package)_linux_dependencies=freetype fontconfig libxcb libX11 xproto libXext
|
||||
$(package)_build_subdir=qtbase
|
||||
$(package)_qt_libs=corelib network widgets gui plugins testlib
|
||||
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch
|
||||
$(package)_patches=fix_qt_pkgconfig.patch mac-qmake.conf fix_configure_mac.patch fix_no_printer.patch fix_rcc_determinism.patch xkb-default.patch
|
||||
|
||||
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
|
||||
$(package)_qttranslations_sha256_hash=9822084f8e2d2939ba39f4af4c0c2320e45d5996762a9423f833055607604ed8
|
||||
@@ -83,7 +86,7 @@ $(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
|
||||
$(package)_config_opts_darwin += -device-option MAC_LD64_VERSION=$(LD64_VERSION)
|
||||
endif
|
||||
|
||||
$(package)_config_opts_linux = -qt-xkbcommon
|
||||
$(package)_config_opts_linux = -qt-xkbcommon-x11
|
||||
$(package)_config_opts_linux += -qt-xcb
|
||||
$(package)_config_opts_linux += -system-freetype
|
||||
$(package)_config_opts_linux += -no-feature-sessionmanager
|
||||
@@ -119,6 +122,7 @@ define $(package)_extract_cmds
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
sed -i.old "s|FT_Get_Font_Format|FT_Get_X11_Font_Format|" qtbase/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp && \
|
||||
sed -i.old "s|updateqm.commands = \$$$$\$$$$LRELEASE|updateqm.commands = $($(package)_extract_dir)/qttools/bin/lrelease|" qttranslations/translations/translations.pro && \
|
||||
sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \
|
||||
sed -i.old "s/src_plugins.depends = src_sql src_network/src_plugins.depends = src_network/" qtbase/src/src.pro && \
|
||||
@@ -136,6 +140,7 @@ define $(package)_preprocess_cmds
|
||||
patch -p1 -i $($(package)_patch_dir)/fix_configure_mac.patch &&\
|
||||
patch -p1 -i $($(package)_patch_dir)/fix_no_printer.patch &&\
|
||||
patch -p1 -i $($(package)_patch_dir)/fix_rcc_determinism.patch &&\
|
||||
patch -p1 -i $($(package)_patch_dir)/xkb-default.patch &&\
|
||||
echo "!host_build: QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
||||
echo "!host_build: QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
||||
echo "!host_build: QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=zeromq
|
||||
$(package)_version=4.2.3
|
||||
$(package)_version=4.3.1
|
||||
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=8f1e2b2aade4dbfde98d82366d61baef2f62e812530160d2e6d0a5bb24e40bc0
|
||||
$(package)_sha256_hash=bcbabe1e2c7d0eec4ed612e10b94b112dd5f06fcefa994a0c79a45d835cd21eb
|
||||
$(package)_patches=0001-fix-build-with-older-mingw64.patch 0002-disable-pthread_set_name_np.patch
|
||||
|
||||
define $(package)_set_vars
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
--- old/qtbase/src/gui/configure.pri 2018-06-06 17:28:10.000000000 -0400
|
||||
+++ new/qtbase/src/gui/configure.pri 2018-08-17 18:43:01.589384567 -0400
|
||||
@@ -43,18 +43,11 @@
|
||||
}
|
||||
|
||||
defineTest(qtConfTest_xkbConfigRoot) {
|
||||
- qtConfTest_getPkgConfigVariable($${1}): return(true)
|
||||
-
|
||||
- for (dir, $$list("/usr/share/X11/xkb", "/usr/local/share/X11/xkb")) {
|
||||
- exists($$dir) {
|
||||
- $${1}.value = $$dir
|
||||
- export($${1}.value)
|
||||
- $${1}.cache += value
|
||||
- export($${1}.cache)
|
||||
- return(true)
|
||||
- }
|
||||
- }
|
||||
- return(false)
|
||||
+ $${1}.value = "/usr/share/X11/xkb"
|
||||
+ export($${1}.value)
|
||||
+ $${1}.cache += value
|
||||
+ export($${1}.cache)
|
||||
+ return(true)
|
||||
}
|
||||
|
||||
defineTest(qtConfTest_qpaDefaultPlatform) {
|
||||
@@ -75,6 +75,7 @@ The Bitcoin repo's [root README](/README.md) contains relevant information on th
|
||||
- [Tor Support](tor.md)
|
||||
- [Init Scripts (systemd/upstart/openrc)](init.md)
|
||||
- [ZMQ](zmq.md)
|
||||
- [PSBT support](psbt.md)
|
||||
|
||||
License
|
||||
---------------------
|
||||
|
||||
@@ -17,10 +17,16 @@ Given a transaction hash: returns a transaction in binary, hex-encoded binary, o
|
||||
For full TX query capability, one must enable the transaction index via "txindex=1" command line / configuration option.
|
||||
|
||||
#### Blocks
|
||||
`GET /rest/block/tip.<bin|hex|json>`
|
||||
`GET /rest/block/<BLOCK-HASH>.<bin|hex|json>`
|
||||
`GET /rest/block/<BLOCK-HEIGHT>.<bin|hex|json>`
|
||||
`GET /rest/block/notxdetails/tip.<bin|hex|json>`
|
||||
`GET /rest/block/notxdetails/<BLOCK-HASH>.<bin|hex|json>`
|
||||
`GET /rest/block/notxdetails/<BLOCK-HEIGHT>.<bin|hex|json>`
|
||||
|
||||
Given a block hash: returns a block, in binary, hex-encoded binary or JSON formats.
|
||||
You can give a block height instead of a hash. Height 0 is not available,
|
||||
but can be negative to go back that many blocks from the tip.
|
||||
|
||||
The HTTP request and response are both handled entirely in-memory, thus making maximum memory usage at least 2.66MB (1 MB max block, plus hex encoding) per request.
|
||||
|
||||
|
||||
+41
-11
@@ -1,6 +1,6 @@
|
||||
NetBSD build guide
|
||||
======================
|
||||
(updated for NetBSD 7.0)
|
||||
(updated for NetBSD 8.0)
|
||||
|
||||
This guide describes how to build bitcoind and command-line utilities on NetBSD.
|
||||
|
||||
@@ -15,21 +15,38 @@ You will need the following modules, which can be installed via pkgsrc or pkgin:
|
||||
autoconf
|
||||
automake
|
||||
boost
|
||||
db4
|
||||
git
|
||||
gmake
|
||||
libevent
|
||||
libtool
|
||||
python27
|
||||
```
|
||||
pkg-config
|
||||
python37
|
||||
|
||||
Download the source code:
|
||||
```
|
||||
git clone https://github.com/bitcoin/bitcoin
|
||||
git clone https://github.com/bitcoin/bitcoin.git
|
||||
```
|
||||
|
||||
See [dependencies.md](dependencies.md) for a complete overview.
|
||||
|
||||
### Building BerkeleyDB
|
||||
|
||||
BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
|
||||
`--disable-wallet` to `./configure` and skip to the next section.
|
||||
|
||||
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
|
||||
from ports, for the same reason as boost above (g++/libstd++ incompatibility).
|
||||
If you have to build it yourself, you can use [the installation script included
|
||||
in contrib/](/contrib/install_db4.sh) like so:
|
||||
|
||||
```shell
|
||||
./contrib/install_db4.sh `pwd`
|
||||
```
|
||||
|
||||
from the root of the repository. Then set `BDB_PREFIX` for the next section:
|
||||
|
||||
```shell
|
||||
export BDB_PREFIX="$PWD/db4"
|
||||
```
|
||||
|
||||
### Building Bitcoin Core
|
||||
|
||||
**Important**: Use `gmake` (the non-GNU `make` will exit with an error).
|
||||
@@ -37,13 +54,26 @@ See [dependencies.md](dependencies.md) for a complete overview.
|
||||
With wallet:
|
||||
```
|
||||
./autogen.sh
|
||||
./configure CPPFLAGS="-I/usr/pkg/include" LDFLAGS="-L/usr/pkg/lib" BOOST_CPPFLAGS="-I/usr/pkg/include" BOOST_LDFLAGS="-L/usr/pkg/lib"
|
||||
gmake
|
||||
./configure --with-gui=no CPPFLAGS="-I/usr/pkg/include" \
|
||||
LDFLAGS="-L/usr/pkg/lib" \
|
||||
BOOST_CPPFLAGS="-I/usr/pkg/include" \
|
||||
BOOST_LDFLAGS="-L/usr/pkg/lib" \
|
||||
BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \
|
||||
BDB_CFLAGS="-I${BDB_PREFIX}/include"
|
||||
```
|
||||
|
||||
Without wallet:
|
||||
```
|
||||
./autogen.sh
|
||||
./configure --disable-wallet CPPFLAGS="-I/usr/pkg/include" LDFLAGS="-L/usr/pkg/lib" BOOST_CPPFLAGS="-I/usr/pkg/include" BOOST_LDFLAGS="-L/usr/pkg/lib"
|
||||
gmake
|
||||
./configure --with-gui=no --disable-wallet \
|
||||
CPPFLAGS="-I/usr/pkg/include" \
|
||||
LDFLAGS="-L/usr/pkg/lib" \
|
||||
BOOST_CPPFLAGS="-I/usr/pkg/include" \
|
||||
BOOST_LDFLAGS="-L/usr/pkg/lib"
|
||||
```
|
||||
|
||||
Build and run the tests:
|
||||
```bash
|
||||
gmake # use -jX here for parallelism
|
||||
gmake check
|
||||
```
|
||||
@@ -279,6 +279,7 @@ To build executables for ARM:
|
||||
cd depends
|
||||
make HOST=arm-linux-gnueabihf NO_QT=1
|
||||
cd ..
|
||||
./autogen.sh
|
||||
./configure --prefix=$PWD/depends/arm-linux-gnueabihf --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++
|
||||
make
|
||||
|
||||
|
||||
+1
-1
@@ -26,5 +26,5 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
|
||||
| Qt | [5.9.6](https://download.qt.io/official_releases/qt/) | 5.x | No | | |
|
||||
| XCB | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L87) (Linux only) |
|
||||
| xkbcommon | | | | | [Yes](https://github.com/bitcoin/bitcoin/blob/master/depends/packages/qt.mk#L86) (Linux only) |
|
||||
| ZeroMQ | [4.2.3](https://github.com/zeromq/libzmq/releases) | | No | | |
|
||||
| ZeroMQ | [4.3.1](https://github.com/zeromq/libzmq/releases) | | No | | |
|
||||
| zlib | [1.2.11](https://zlib.net/) | | | | No |
|
||||
@@ -0,0 +1,133 @@
|
||||
# Support for Output Descriptors in Bitcoin Core
|
||||
|
||||
Since Bitcoin Core v0.17, there is support for Output Descriptors in the
|
||||
`scantxoutset` RPC call. This is a simple language which can be used to
|
||||
describe collections of output scripts.
|
||||
|
||||
This document describes the language. For the specifics on usage for scanning
|
||||
the UTXO set, see the `scantxoutset` RPC help.
|
||||
|
||||
## Features
|
||||
|
||||
Output descriptors currently support:
|
||||
- Pay-to-pubkey scripts (P2PK), through the `pk` function.
|
||||
- Pay-to-pubkey-hash scripts (P2PKH), through the `pkh` function.
|
||||
- Pay-to-witness-pubkey-hash scripts (P2WPKH), through the `wpkh` function.
|
||||
- Pay-to-script-hash scripts (P2SH), through the `sh` function.
|
||||
- Pay-to-witness-script-hash scripts (P2WSH), through the `wsh` function.
|
||||
- Multisig scripts, through the `multi` function.
|
||||
- Any type of supported address through the `addr` function.
|
||||
- Raw hex scripts through the `raw` function.
|
||||
- Public keys (compressed and uncompressed) in hex notation, or BIP32 extended pubkeys with derivation paths.
|
||||
|
||||
## Examples
|
||||
|
||||
- `pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)` describes a P2PK output with the specified public key.
|
||||
- `pkh(02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5)` describes a P2PKH output with the specified public key.
|
||||
- `wpkh(02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9)` describes a P2WPKH output with the specified public key.
|
||||
- `sh(wpkh(03fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556))` describes a P2SH-P2WPKH output with the specified public key.
|
||||
- `combo(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)` describes any P2PK, P2PKH, P2WPKH, or P2SH-P2WPKH output with the specified public key.
|
||||
- `sh(wsh(pkh(02e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13)))` describes an (overly complicated) P2SH-P2WSH-P2PKH output with the specified public key.
|
||||
- `multi(1,022f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4,025cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc)` describes a bare *1-of-2* multisig output with keys in the specified order.
|
||||
- `sh(multi(2,022f01e5e15cca351daff3843fb70f3c2f0a1bdd05e5af888a67784ef3e10a2a01,03acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe))` describes a P2SH *2-of-2* multisig output with keys in the specified order.
|
||||
- `wsh(multi(2,03a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7,03774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb,03d01115d548e7561b15c38f004d734633687cf4419620095bc5b0f47070afe85a))` describes a P2WSH *2-of-3* multisig output with keys in the specified order.
|
||||
- `sh(wsh(multi(1,03f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8,03499fdf9e895e719cfd64e67f07d38e3226aa7b63678949e6e49b241a60e823e4,02d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e)))` describes a P2SH-P2WSH *1-of-3* multisig output with keys in the specified order.
|
||||
- `pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8)` describes a P2PK output with the public key of the specified xpub.
|
||||
- `pkh(xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw/1'/2)` describes a P2PKH output with child key *1'/2* of the specified xpub.
|
||||
- `wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))` describes a set of *1-of-2* P2WSH multisig outputs where the first multisig key is the *1/0/`i`* child of the first specified xpub and the second multisig key is the *0/0/`i`* child of the second specified xpub, and `i` is any number in a configurable range (`0-1000` by default).
|
||||
|
||||
## Reference
|
||||
|
||||
Descriptors consist of several types of expressions. The top level expression is always a `SCRIPT`.
|
||||
|
||||
`SCRIPT` expressions:
|
||||
- `sh(SCRIPT)` (top level only): P2SH embed the argument.
|
||||
- `wsh(SCRIPT)` (not inside another 'wsh'): P2WSH embed the argument.
|
||||
- `pk(KEY)` (anywhere): P2PK output for the given public key.
|
||||
- `pkh(KEY)` (anywhere): P2PKH output for the given public key (use `addr` if you only know the pubkey hash).
|
||||
- `wpkh(KEY)` (not inside `wsh`): P2WPKH output for the given compressed pubkey.
|
||||
- `combo(KEY)` (top level only): an alias for the collection of `pk(KEY)` and `pkh(KEY)`. If the key is compressed, it also includes `wpkh(KEY)` and `sh(wpkh(KEY))`.
|
||||
- `multi(k,KEY_1,KEY_2,...,KEY_n)` (anywhere): k-of-n multisig script.
|
||||
- `addr(ADDR)` (top level only): the script which ADDR expands to.
|
||||
- `raw(HEX)` (top level only): the script whose hex encoding is HEX.
|
||||
|
||||
`KEY` expressions:
|
||||
- Hex encoded public keys (66 characters starting with `02` or `03`, or 130 characters starting with `04`).
|
||||
- Inside `wpkh` and `wsh`, only compressed public keys are permitted.
|
||||
- [WIF](https://en.bitcoin.it/wiki/Wallet_import_format) encoded private keys may be specified instead of the corresponding public key, with the same meaning.
|
||||
-`xpub` encoded extended public key or `xprv` encoded private key (as defined in [BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)).
|
||||
- Followed by zero or more `/NUM` unhardened and `/NUM'` hardened BIP32 derivation steps.
|
||||
- Optionally followed by a single `/*` or `/*'` final step to denote all (direct) unhardened or hardened children.
|
||||
- The usage of hardened derivation steps requires providing the private key.
|
||||
- Instead of a `'`, the suffix `h` can be used to denote hardened derivation.
|
||||
|
||||
`ADDR` expressions are any type of supported address:
|
||||
- P2PKH addresses (base58, of the form `1...`). Note that P2PKH addresses in descriptors cannot be used for P2PK outputs (use the `pk` function instead).
|
||||
- P2SH addresses (base58, of the form `3...`, defined in [BIP 13](https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki)).
|
||||
- Segwit addresses (bech32, of the form `bc1...`, defined in [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)).
|
||||
|
||||
## Explanation
|
||||
|
||||
### Single-key scripts
|
||||
|
||||
Many single-key constructions are used in practice, generally including
|
||||
P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH. Many more combinations are
|
||||
imaginable, though they may not be optimal: P2SH-P2PK, P2SH-P2PKH,
|
||||
P2WSH-P2PK, P2WSH-P2PKH, P2SH-P2WSH-P2PK, P2SH-P2WSH-P2PKH.
|
||||
|
||||
To describe these, we model these as functions. The functions `pk`
|
||||
(P2PK), `pkh` (P2PKH) and `wpkh` (P2WPKH) take as input a public key in
|
||||
hexadecimal notation (which will be extended later), and return the
|
||||
corresponding *scriptPubKey*. The functions `sh` (P2SH) and `wsh` (P2WSH)
|
||||
take as input a script, and return the script describing P2SH and P2WSH
|
||||
outputs with the input as embedded script. The names of the functions do
|
||||
not contain "p2" for brevity.
|
||||
|
||||
### Multisig
|
||||
|
||||
Several pieces of software use multi-signature (multisig) scripts based
|
||||
on Bitcoin's OP_CHECKMULTISIG opcode. To support these, we introduce the
|
||||
`multi(k,key_1,key_2,...,key_n)` function. It represents a *k-of-n*
|
||||
multisig policy, where any *k* out of the *n* provided public keys must
|
||||
sign.
|
||||
|
||||
Key order is significant. A `multi()` expression describes a multisig script
|
||||
with keys in the specified order, and in a search for TXOs, it will not match
|
||||
outputs with multisig scriptPubKeys that have the same keys in a different
|
||||
order. Also, to prevent a combinatorial explosion of the search space, if more
|
||||
than one of the `multi()` key arguments is a BIP32 wildcard path ending in `/*`
|
||||
or `*'`, the `multi()` expression only matches multisig scripts with the `i`th
|
||||
child key from each wildcard path in lockstep, rather than scripts with any
|
||||
combination of child keys from each wildcard path.
|
||||
|
||||
### BIP32 derived keys and chains
|
||||
|
||||
Most modern wallet software and hardware uses keys that are derived using
|
||||
BIP32 ("HD keys"). We support these directly by permitting strings
|
||||
consisting of an extended public key (commonly referred to as an *xpub*)
|
||||
plus derivation path anywhere a public key is expected. The derivation
|
||||
path consists of a sequence of 0 or more integers (in the range
|
||||
*0..2<sup>31</sup>-1*) each optionally followed by `'` or `h`, and
|
||||
separated by `/` characters. The string may optionally end with the
|
||||
literal `/*` or `/*'` (or `/*h`) to refer to all unhardened or hardened
|
||||
child keys in a configurable range (by default `0-1000`, inclusive).
|
||||
|
||||
Whenever a public key is described using a hardened derivation step, the
|
||||
script cannot be computed without access to the corresponding private
|
||||
key.
|
||||
|
||||
### Including private keys
|
||||
|
||||
Often it is useful to communicate a description of scripts along with the
|
||||
necessary private keys. For this reason, anywhere a public key or xpub is
|
||||
supported, a private key in WIF format or xprv may be provided instead.
|
||||
This is useful when private keys are necessary for hardened derivation
|
||||
steps, or for dumping wallet descriptors including private key material.
|
||||
|
||||
### Compatibility with old wallets
|
||||
|
||||
In order to easily represent the sets of scripts currently supported by
|
||||
existing Bitcoin Core wallets, a convenience function `combo` is
|
||||
provided, which takes as input a public key, and describes a set of P2PK,
|
||||
P2PKH, P2WPKH, and P2SH-P2WPH scripts for that key. In case the key is
|
||||
uncompressed, the set only includes P2PK and P2PKH scripts.
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
dist_man1_MANS=
|
||||
|
||||
if BUILD_BITCOIND
|
||||
dist_man1_MANS+=bitcoind.1
|
||||
dist_man1_MANS+=lbrycrdd.1
|
||||
endif
|
||||
|
||||
if ENABLE_QT
|
||||
dist_man1_MANS+=bitcoin-qt.1
|
||||
dist_man1_MANS+=lbrycrd-qt.1
|
||||
endif
|
||||
|
||||
if BUILD_BITCOIN_UTILS
|
||||
dist_man1_MANS+=bitcoin-cli.1 bitcoin-tx.1
|
||||
dist_man1_MANS+=lbrycrd-cli.1 lbrycrd-tx.1
|
||||
endif
|
||||
@@ -1,17 +1,21 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
|
||||
.TH BITCOIN-CLI "1" "July 2018" "bitcoin-cli v0.16.99.0" "User Commands"
|
||||
.TH BITCOIN-CLI "1" "December 2018" "lbrycrd-cli v0.17.1.0" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-cli \- manual page for bitcoin-cli v0.16.99.0
|
||||
lbrycrd-cli \- manual page for lbrycrd-cli v0.17.1.0
|
||||
.SH SYNOPSIS
|
||||
.B lbrycrd-cli
|
||||
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to LBRYcrd Core\/\fR
|
||||
.br
|
||||
.B lbrycrd-cli
|
||||
[\fI\,options\/\fR] \fI\,-named <command> \/\fR[\fI\,name=value\/\fR]... \fI\,Send command to LBRYcrd Core (with named arguments)\/\fR
|
||||
.br
|
||||
.B lbrycrd-cli
|
||||
[\fI\,options\/\fR] \fI\,help List commands\/\fR
|
||||
.br
|
||||
.B lbrycrd-cli
|
||||
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core RPC client version v0.16.99.0
|
||||
.SS "Usage:"
|
||||
.TP
|
||||
bitcoin\-cli [options] <command> [params]
|
||||
Send command to Bitcoin Core
|
||||
.IP
|
||||
bitcoin\-cli [options] \fB\-named\fR <command> [name=value] ... Send command to Bitcoin Core (with named arguments)
|
||||
bitcoin\-cli [options] help List commands
|
||||
bitcoin\-cli [options] help <command> Get help for a command
|
||||
LBRYcrd Core RPC client version v0.17.1.0
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
@@ -21,7 +25,7 @@ This help message
|
||||
\fB\-conf=\fR<file>
|
||||
.IP
|
||||
Specify configuration file. Relative paths will be prefixed by datadir
|
||||
location. (default: bitcoin.conf)
|
||||
location. (default: lbrycrd.conf)
|
||||
.HP
|
||||
\fB\-datadir=\fR<dir>
|
||||
.IP
|
||||
@@ -72,20 +76,18 @@ Wait for RPC server to start
|
||||
\fB\-rpcwallet=\fR<walletname>
|
||||
.IP
|
||||
Send RPC for non\-default wallet on RPC server (needs to exactly match
|
||||
corresponding \fB\-wallet\fR option passed to bitcoind)
|
||||
corresponding \fB\-wallet\fR option passed to lbrycrdd)
|
||||
.HP
|
||||
\fB\-stdin\fR
|
||||
.IP
|
||||
Read extra arguments from standard input, one per line until EOF/Ctrl\-D
|
||||
(recommended for sensitive information such as passphrases).
|
||||
When combined with \fB\-stdinrpcpass\fR, the first line from standard
|
||||
input is used for the RPC password.
|
||||
(recommended for sensitive information such as passphrases). When
|
||||
combined with \fB\-stdinrpcpass\fR, the first line from standard input
|
||||
is used for the RPC password.
|
||||
.HP
|
||||
\fB\-stdinrpcpass\fR
|
||||
.TP
|
||||
Read RPC password from standard input as a single line.
|
||||
When combined
|
||||
.IP
|
||||
Read RPC password from standard input as a single line. When combined
|
||||
with \fB\-stdin\fR, the first line from standard input is used for the
|
||||
RPC password.
|
||||
.HP
|
||||
@@ -99,11 +101,11 @@ Chain selection options:
|
||||
.IP
|
||||
Use the test chain
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2009-2018 The Bitcoin Core developers
|
||||
Copyright (C) 2009-2018 The LBRYcrd Core developers
|
||||
|
||||
Please contribute if you find Bitcoin Core useful. Visit
|
||||
<https://bitcoincore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/bitcoin/bitcoin>.
|
||||
Please contribute if you find LBRYcrd Core useful. Visit
|
||||
<https://lbrycrdcore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/lbrycrd/lbrycrd>.
|
||||
|
||||
This is experimental software.
|
||||
Distributed under the MIT software license, see the accompanying file COPYING
|
||||
@@ -1,12 +1,12 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
|
||||
.TH BITCOIN-QT "1" "July 2018" "bitcoin-qt v0.16.99.0" "User Commands"
|
||||
.TH BITCOIN-QT "1" "December 2018" "lbrycrd-qt v0.17.1.0" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-qt \- manual page for bitcoin-qt v0.16.99.0
|
||||
lbrycrd-qt \- manual page for lbrycrd-qt v0.17.1.0
|
||||
.SH SYNOPSIS
|
||||
.B lbrycrd-qt
|
||||
[\fI\,command-line options\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core version v0.16.99.0 (64\-bit)
|
||||
Usage:
|
||||
.IP
|
||||
bitcoin\-qt [command\-line options]
|
||||
LBRYcrd Core version v0.17.1.0 (64\-bit)
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
@@ -23,9 +23,9 @@ long fork (%s in cmd is replaced by message)
|
||||
If this block is in the chain assume that it and its ancestors are valid
|
||||
and potentially skip their script verification (0 to verify all,
|
||||
default:
|
||||
0000000000000000005214481d2d96f898e3d5416e43359c145944a909d242e0,
|
||||
0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8,
|
||||
testnet:
|
||||
0000000002e9e7b00e1f6dc5123a04aad68dd0f0968d8c7aa45f6640795c37b1)
|
||||
0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75)
|
||||
.HP
|
||||
\fB\-blocknotify=\fR<cmd>
|
||||
.IP
|
||||
@@ -44,7 +44,7 @@ Specify blocks directory (default: <datadir>/blocks)
|
||||
\fB\-conf=\fR<file>
|
||||
.IP
|
||||
Specify configuration file. Relative paths will be prefixed by datadir
|
||||
location. (default: bitcoin.conf)
|
||||
location. (default: lbrycrd.conf)
|
||||
.HP
|
||||
\fB\-daemon\fR
|
||||
.IP
|
||||
@@ -61,7 +61,8 @@ Set database cache size in megabytes (4 to 16384, default: 450)
|
||||
\fB\-debuglogfile=\fR<file>
|
||||
.IP
|
||||
Specify location of debug log file. Relative paths will be prefixed by a
|
||||
net\-specific datadir location. (0 to disable; default: debug.log)
|
||||
net\-specific datadir location. (\fB\-nodebuglogfile\fR to disable;
|
||||
default: debug.log)
|
||||
.HP
|
||||
\fB\-includeconf=\fR<file>
|
||||
.IP
|
||||
@@ -87,7 +88,7 @@ Do not keep transactions in the mempool longer than <n> hours (default:
|
||||
.HP
|
||||
\fB\-par=\fR<n>
|
||||
.IP
|
||||
Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 =
|
||||
Set the number of script verification threads (\fB\-6\fR to 16, 0 = auto, <0 =
|
||||
leave that many cores free, default: 0)
|
||||
.HP
|
||||
\fB\-persistmempool\fR
|
||||
@@ -97,7 +98,7 @@ Whether to save the mempool on shutdown and load on restart (default: 1)
|
||||
\fB\-pid=\fR<file>
|
||||
.IP
|
||||
Specify pid file. Relative paths will be prefixed by a net\-specific
|
||||
datadir location. (default: bitcoind.pid)
|
||||
datadir location. (default: lbrycrdd.pid)
|
||||
.HP
|
||||
\fB\-prune=\fR<n>
|
||||
.IP
|
||||
@@ -108,7 +109,7 @@ blocks if a target size in MiB is provided. This mode is
|
||||
incompatible with \fB\-txindex\fR and \fB\-rescan\fR. Warning: Reverting this
|
||||
setting requires re\-downloading the entire blockchain. (default:
|
||||
0 = disable pruning blocks, 1 = allow manual pruning via RPC,
|
||||
>550 = automatically prune block files to stay under the
|
||||
>=550 = automatically prune block files to stay under the
|
||||
specified target size in MiB)
|
||||
.HP
|
||||
\fB\-reindex\fR
|
||||
@@ -157,7 +158,7 @@ for IPv6
|
||||
.HP
|
||||
\fB\-connect=\fR<ip>
|
||||
.IP
|
||||
Connect only to the specified node; \fB\-connect\fR=\fI\,0\/\fR disables automatic
|
||||
Connect only to the specified node; \fB\-noconnect\fR disables automatic
|
||||
connections (the rules for this peer are the same as for
|
||||
\fB\-addnode\fR). This option can be specified multiple times to connect
|
||||
to multiple nodes.
|
||||
@@ -221,8 +222,8 @@ Tries to keep outbound traffic under the given target (in MiB per 24h),
|
||||
.HP
|
||||
\fB\-onion=\fR<ip:port>
|
||||
.IP
|
||||
Use separate SOCKS5 proxy to reach peers via Tor hidden services
|
||||
(default: \fB\-proxy\fR)
|
||||
Use separate SOCKS5 proxy to reach peers via Tor hidden services, set
|
||||
\fB\-noonion\fR to disable (default: \fB\-proxy\fR)
|
||||
.HP
|
||||
\fB\-onlynet=\fR<net>
|
||||
.IP
|
||||
@@ -246,7 +247,8 @@ Listen for connections on <port> (default: 8333 or testnet: 18333)
|
||||
.HP
|
||||
\fB\-proxy=\fR<ip:port>
|
||||
.IP
|
||||
Connect through SOCKS5 proxy
|
||||
Connect through SOCKS5 proxy, set \fB\-noproxy\fR to disable (default:
|
||||
disabled)
|
||||
.HP
|
||||
\fB\-proxyrandomize\fR
|
||||
.IP
|
||||
@@ -418,7 +420,7 @@ Debugging/Testing options:
|
||||
.HP
|
||||
\fB\-debug=\fR<category>
|
||||
.IP
|
||||
Output debugging information (default: 0, supplying <category> is
|
||||
Output debugging information (default: \fB\-nodebug\fR, supplying <category> is
|
||||
optional). If <category> is not supplied or if <category> = 1,
|
||||
output all debugging information. <category> can be: net, tor,
|
||||
mempool, http, bench, zmq, db, rpc, estimatefee, addrman,
|
||||
@@ -452,7 +454,7 @@ transaction; setting this too low may abort large transactions
|
||||
\fB\-printtoconsole\fR
|
||||
.IP
|
||||
Send trace/debug info to console (default: 1 when no \fB\-daemon\fR. To disable
|
||||
logging to file, set debuglogfile=0)
|
||||
logging to file, set \fB\-nodebuglogfile\fR)
|
||||
.HP
|
||||
\fB\-shrinkdebugfile\fR
|
||||
.IP
|
||||
@@ -602,11 +604,11 @@ Set SSL root certificates for payment request (default: \fB\-system\-\fR)
|
||||
.IP
|
||||
Show splash screen on startup (default: 1)
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2009-2018 The Bitcoin Core developers
|
||||
Copyright (C) 2009-2018 The LBRYcrd Core developers
|
||||
|
||||
Please contribute if you find Bitcoin Core useful. Visit
|
||||
<https://bitcoincore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/bitcoin/bitcoin>.
|
||||
Please contribute if you find LBRYcrd Core useful. Visit
|
||||
<https://lbrycrdcore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/lbrycrd/lbrycrd>.
|
||||
|
||||
This is experimental software.
|
||||
Distributed under the MIT software license, see the accompanying file COPYING
|
||||
@@ -1,16 +1,15 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
|
||||
.TH BITCOIN-TX "1" "July 2018" "bitcoin-tx v0.16.99.0" "User Commands"
|
||||
.TH BITCOIN-TX "1" "December 2018" "lbrycrd-tx v0.17.1.0" "User Commands"
|
||||
.SH NAME
|
||||
bitcoin-tx \- manual page for bitcoin-tx v0.16.99.0
|
||||
lbrycrd-tx \- manual page for lbrycrd-tx v0.17.1.0
|
||||
.SH SYNOPSIS
|
||||
.B lbrycrd-tx
|
||||
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded lbrycrd transaction\/\fR
|
||||
.br
|
||||
.B lbrycrd-tx
|
||||
[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded lbrycrd transaction\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core bitcoin\-tx utility version v0.16.99.0
|
||||
.SS "Usage:"
|
||||
.TP
|
||||
bitcoin\-tx [options] <hex\-tx> [commands]
|
||||
Update hex\-encoded bitcoin transaction
|
||||
.TP
|
||||
bitcoin\-tx [options] \fB\-create\fR [commands]
|
||||
Create hex\-encoded bitcoin transaction
|
||||
LBRYcrd Core lbrycrd\-tx utility version v0.17.1.0
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
@@ -106,11 +105,11 @@ set=NAME:JSON\-STRING
|
||||
.IP
|
||||
Set register NAME to given JSON\-STRING
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2009-2018 The Bitcoin Core developers
|
||||
Copyright (C) 2009-2018 The LBRYcrd Core developers
|
||||
|
||||
Please contribute if you find Bitcoin Core useful. Visit
|
||||
<https://bitcoincore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/bitcoin/bitcoin>.
|
||||
Please contribute if you find LBRYcrd Core useful. Visit
|
||||
<https://lbrycrdcore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/lbrycrd/lbrycrd>.
|
||||
|
||||
This is experimental software.
|
||||
Distributed under the MIT software license, see the accompanying file COPYING
|
||||
@@ -1,13 +1,12 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
|
||||
.TH BITCOIND "1" "July 2018" "bitcoind v0.16.99.0" "User Commands"
|
||||
.TH BITCOIND "1" "December 2018" "lbrycrdd v0.17.1.0" "User Commands"
|
||||
.SH NAME
|
||||
bitcoind \- manual page for bitcoind v0.16.99.0
|
||||
lbrycrdd \- manual page for lbrycrdd v0.17.1.0
|
||||
.SH SYNOPSIS
|
||||
.B lbrycrdd
|
||||
[\fI\,options\/\fR] \fI\,Start LBRYcrd Core Daemon\/\fR
|
||||
.SH DESCRIPTION
|
||||
Bitcoin Core Daemon version v0.16.99.0
|
||||
.SS "Usage:"
|
||||
.TP
|
||||
bitcoind [options]
|
||||
Start Bitcoin Core Daemon
|
||||
LBRYcrd Core Daemon version v0.17.1.0
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\-?
|
||||
@@ -24,9 +23,9 @@ long fork (%s in cmd is replaced by message)
|
||||
If this block is in the chain assume that it and its ancestors are valid
|
||||
and potentially skip their script verification (0 to verify all,
|
||||
default:
|
||||
0000000000000000005214481d2d96f898e3d5416e43359c145944a909d242e0,
|
||||
0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8,
|
||||
testnet:
|
||||
0000000002e9e7b00e1f6dc5123a04aad68dd0f0968d8c7aa45f6640795c37b1)
|
||||
0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75)
|
||||
.HP
|
||||
\fB\-blocknotify=\fR<cmd>
|
||||
.IP
|
||||
@@ -45,7 +44,7 @@ Specify blocks directory (default: <datadir>/blocks)
|
||||
\fB\-conf=\fR<file>
|
||||
.IP
|
||||
Specify configuration file. Relative paths will be prefixed by datadir
|
||||
location. (default: bitcoin.conf)
|
||||
location. (default: lbrycrd.conf)
|
||||
.HP
|
||||
\fB\-daemon\fR
|
||||
.IP
|
||||
@@ -62,7 +61,8 @@ Set database cache size in megabytes (4 to 16384, default: 450)
|
||||
\fB\-debuglogfile=\fR<file>
|
||||
.IP
|
||||
Specify location of debug log file. Relative paths will be prefixed by a
|
||||
net\-specific datadir location. (0 to disable; default: debug.log)
|
||||
net\-specific datadir location. (\fB\-nodebuglogfile\fR to disable;
|
||||
default: debug.log)
|
||||
.HP
|
||||
\fB\-includeconf=\fR<file>
|
||||
.IP
|
||||
@@ -88,7 +88,7 @@ Do not keep transactions in the mempool longer than <n> hours (default:
|
||||
.HP
|
||||
\fB\-par=\fR<n>
|
||||
.IP
|
||||
Set the number of script verification threads (\fB\-8\fR to 16, 0 = auto, <0 =
|
||||
Set the number of script verification threads (\fB\-6\fR to 16, 0 = auto, <0 =
|
||||
leave that many cores free, default: 0)
|
||||
.HP
|
||||
\fB\-persistmempool\fR
|
||||
@@ -98,7 +98,7 @@ Whether to save the mempool on shutdown and load on restart (default: 1)
|
||||
\fB\-pid=\fR<file>
|
||||
.IP
|
||||
Specify pid file. Relative paths will be prefixed by a net\-specific
|
||||
datadir location. (default: bitcoind.pid)
|
||||
datadir location. (default: lbrycrdd.pid)
|
||||
.HP
|
||||
\fB\-prune=\fR<n>
|
||||
.IP
|
||||
@@ -109,7 +109,7 @@ blocks if a target size in MiB is provided. This mode is
|
||||
incompatible with \fB\-txindex\fR and \fB\-rescan\fR. Warning: Reverting this
|
||||
setting requires re\-downloading the entire blockchain. (default:
|
||||
0 = disable pruning blocks, 1 = allow manual pruning via RPC,
|
||||
>550 = automatically prune block files to stay under the
|
||||
>=550 = automatically prune block files to stay under the
|
||||
specified target size in MiB)
|
||||
.HP
|
||||
\fB\-reindex\fR
|
||||
@@ -158,7 +158,7 @@ for IPv6
|
||||
.HP
|
||||
\fB\-connect=\fR<ip>
|
||||
.IP
|
||||
Connect only to the specified node; \fB\-connect\fR=\fI\,0\/\fR disables automatic
|
||||
Connect only to the specified node; \fB\-noconnect\fR disables automatic
|
||||
connections (the rules for this peer are the same as for
|
||||
\fB\-addnode\fR). This option can be specified multiple times to connect
|
||||
to multiple nodes.
|
||||
@@ -222,8 +222,8 @@ Tries to keep outbound traffic under the given target (in MiB per 24h),
|
||||
.HP
|
||||
\fB\-onion=\fR<ip:port>
|
||||
.IP
|
||||
Use separate SOCKS5 proxy to reach peers via Tor hidden services
|
||||
(default: \fB\-proxy\fR)
|
||||
Use separate SOCKS5 proxy to reach peers via Tor hidden services, set
|
||||
\fB\-noonion\fR to disable (default: \fB\-proxy\fR)
|
||||
.HP
|
||||
\fB\-onlynet=\fR<net>
|
||||
.IP
|
||||
@@ -247,7 +247,8 @@ Listen for connections on <port> (default: 8333 or testnet: 18333)
|
||||
.HP
|
||||
\fB\-proxy=\fR<ip:port>
|
||||
.IP
|
||||
Connect through SOCKS5 proxy
|
||||
Connect through SOCKS5 proxy, set \fB\-noproxy\fR to disable (default:
|
||||
disabled)
|
||||
.HP
|
||||
\fB\-proxyrandomize\fR
|
||||
.IP
|
||||
@@ -419,7 +420,7 @@ Debugging/Testing options:
|
||||
.HP
|
||||
\fB\-debug=\fR<category>
|
||||
.IP
|
||||
Output debugging information (default: 0, supplying <category> is
|
||||
Output debugging information (default: \fB\-nodebug\fR, supplying <category> is
|
||||
optional). If <category> is not supplied or if <category> = 1,
|
||||
output all debugging information. <category> can be: net, tor,
|
||||
mempool, http, bench, zmq, db, rpc, estimatefee, addrman,
|
||||
@@ -453,7 +454,7 @@ transaction; setting this too low may abort large transactions
|
||||
\fB\-printtoconsole\fR
|
||||
.IP
|
||||
Send trace/debug info to console (default: 1 when no \fB\-daemon\fR. To disable
|
||||
logging to file, set debuglogfile=0)
|
||||
logging to file, set \fB\-nodebuglogfile\fR)
|
||||
.HP
|
||||
\fB\-shrinkdebugfile\fR
|
||||
.IP
|
||||
@@ -577,11 +578,11 @@ Username for JSON\-RPC connections
|
||||
.IP
|
||||
Accept command line and JSON\-RPC commands
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2009-2018 The Bitcoin Core developers
|
||||
Copyright (C) 2009-2018 The LBRYcrd Core developers
|
||||
|
||||
Please contribute if you find Bitcoin Core useful. Visit
|
||||
<https://bitcoincore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/bitcoin/bitcoin>.
|
||||
Please contribute if you find LBRYcrd Core useful. Visit
|
||||
<https://lbrycrdcore.org> for further information about the software.
|
||||
The source code is available from <https://github.com/lbrycrd/lbrycrd>.
|
||||
|
||||
This is experimental software.
|
||||
Distributed under the MIT software license, see the accompanying file COPYING
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
# PSBT Howto for Bitcoin Core
|
||||
|
||||
Since Bitcoin Core 0.17, an RPC interface exists for Partially Signed Bitcoin
|
||||
Transactions (PSBTs, as specified in
|
||||
[BIP 174](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki)).
|
||||
|
||||
This document describes the overall workflow for producing signed transactions
|
||||
through the use of PSBT, and the specific RPC commands used in typical
|
||||
scenarios.
|
||||
|
||||
## PSBT in general
|
||||
|
||||
PSBT is an interchange format for Bitcoin transactions that are not fully signed
|
||||
yet, together with relevant metadata to help entities work towards signing it.
|
||||
It is intended to simplify workflows where multiple parties need to cooperate to
|
||||
produce a transaction. Examples include hardware wallets, multisig setups, and
|
||||
[CoinJoin](https://bitcointalk.org/?topic=279249) transactions.
|
||||
|
||||
### Overall workflow
|
||||
|
||||
Overall, the construction of a fully signed Bitcoin transaction goes through the
|
||||
following steps:
|
||||
|
||||
- A **Creator** proposes a particular transaction to be created. They construct
|
||||
a PSBT that contains certain inputs and outputs, but no additional metadata.
|
||||
- For each input, an **Updater** adds information about the UTXOs being spent by
|
||||
the transaction to the PSBT. They also add information about the scripts and
|
||||
public keys involved in each of the inputs (and possibly outputs) of the PSBT.
|
||||
- **Signers** inspect the transaction and its metadata to decide whether they
|
||||
agree with the transaction. They can use amount information from the UTXOs
|
||||
to assess the values and fees involved. If they agree, they produce a
|
||||
partial signature for the inputs for which they have relevant key(s).
|
||||
- A **Finalizer** is run for each input to convert the partial signatures and
|
||||
possibly script information into a final `scriptSig` and/or `scriptWitness`.
|
||||
- An **Extractor** produces a valid Bitcoin transaction (in network format)
|
||||
from a PSBT for which all inputs are finalized.
|
||||
|
||||
Generally, each of the above (excluding Creator and Extractor) will simply
|
||||
add more and more data to a particular PSBT, until all inputs are fully signed.
|
||||
In a naive workflow, they all have to operate sequentially, passing the PSBT
|
||||
from one to the next, until the Extractor can convert it to a real transaction.
|
||||
In order to permit parallel operation, **Combiners** can be employed which merge
|
||||
metadata from different PSBTs for the same unsigned transaction.
|
||||
|
||||
The names above in bold are the names of the roles defined in BIP174. They're
|
||||
useful in understanding the underlying steps, but in practice, software and
|
||||
hardware implementations will typically implement multiple roles simultaneously.
|
||||
|
||||
## PSBT in Bitcoin Core
|
||||
|
||||
### RPCs
|
||||
|
||||
- **`converttopsbt` (Creator)** is a utility RPC that converts an
|
||||
unsigned raw transaction to PSBT format. It ignores existing signatures.
|
||||
- **`createpsbt` (Creator)** is a utility RPC that takes a list of inputs and
|
||||
outputs and converts them to a PSBT with no additional information. It is
|
||||
equivalent to calling `createrawtransaction` followed by `converttopsbt`.
|
||||
- **`walletcreatefundedpsbt` (Creator, Updater)** is a wallet RPC that creates a
|
||||
PSBT with the specified inputs and outputs, adds additional inputs and change
|
||||
to it to balance it out, and adds relevant metadata. In particular, for inputs
|
||||
that the wallet knows about (counting towards its normal or watch-only
|
||||
balance), UTXO information will be added. For outputs and inputs with UTXO
|
||||
information present, key and script information will be added which the wallet
|
||||
knows about. It is equivalent to running `createrawtransaction`, followed by
|
||||
`fundrawtransaction`, and `converttopsbt`.
|
||||
- **`walletprocesspsbt` (Updater, Signer, Finalizer)** is a wallet RPC that takes as
|
||||
input a PSBT, adds UTXO, key, and script data to inputs and outputs that miss
|
||||
it, and optionally signs inputs. Where possible it also finalizes the partial
|
||||
signatures.
|
||||
- **`finalizepsbt` (Finalizer, Extractor)** is a utility RPC that finalizes any
|
||||
partial signatures, and if all inputs are finalized, converts the result to a
|
||||
fully signed transaction which can be broadcast with `sendrawtransaction`.
|
||||
- **`combinepsbt` (Combiner)** is a utility RPC that implements a Combiner. It
|
||||
can be used at any point in the workflow to merge information added to
|
||||
different versions of the same PSBT. In particular it is useful to combine the
|
||||
output of multiple Updaters or Signers.
|
||||
- **`decodepsbt`** is a diagnostic utility RPC which will show all information in
|
||||
a PSBT in human-readable form, as well as compute its eventual fee if known.
|
||||
|
||||
### Workflows
|
||||
|
||||
#### Multisig with multiple Bitcoin Core instances
|
||||
|
||||
Alice, Bob, and Carol want to create a 2-of-3 multisig address. They're all using
|
||||
Bitcoin Core. We assume their wallets only contain the multisig funds. In case
|
||||
they also have a personal wallet, this can be accomplished through the
|
||||
multiwallet feature - possibly resulting in a need to add `-rpcwallet=name` to
|
||||
the command line in case `bitcoin-cli` is used.
|
||||
|
||||
Setup:
|
||||
- All three call `getnewaddress` to create a new address; call these addresses
|
||||
*Aalice*, *Abob*, and *Acarol*.
|
||||
- All three call `getaddressinfo "X"`, with *X* their respective address, and
|
||||
remember the corresponding public keys. Call these public keys *Kalice*,
|
||||
*Kbob*, and *Kcarol*.
|
||||
- All three now run `addmultisigaddress 2 ["Kalice","Kbob","Kcarol"]` to teach
|
||||
their wallet about the multisig script. Call the address produced by this
|
||||
command *Amulti*. They may be required to explicitly specify the same
|
||||
addresstype option each, to avoid constructing different versions due to
|
||||
differences in configuration.
|
||||
- They also run `importaddress "Amulti" "" false` to make their wallets treat
|
||||
payments to *Amulti* as contributing to the watch-only balance.
|
||||
- Others can verify the produced address by running
|
||||
`createmultisig 2 ["Kalice","Kbob","Kcarol"]`, and expecting *Amulti* as
|
||||
output. Again, it may be necessary to explicitly specify the addresstype
|
||||
in order to get a result that matches. This command won't enable them to
|
||||
initiate transactions later, however.
|
||||
- They can now give out *Amulti* as address others can pay to.
|
||||
|
||||
Later, when *V* BTC has been received on *Amulti*, and Bob and Carol want to
|
||||
move the coins in their entirety to address *Asend*, with no change. Alice
|
||||
does not need to be involved.
|
||||
- One of them - let's assume Carol here - initiates the creation. She runs
|
||||
`walletcreatefundedpsbt [] {"Asend":V} 0 {"subtractFeeFromOutputs":[0], "includeWatching":true}`.
|
||||
We call the resulting PSBT *P*. *P* does not contain any signatures.
|
||||
- Carol needs to sign the transaction herself. In order to do so, she runs
|
||||
`walletprocesspsbt "P"`, and gives the resulting PSBT *P2* to Bob.
|
||||
- Bob inspects the PSBT using `decodepsbt "P2"` to determine if the transaction
|
||||
has indeed just the expected input, and an output to *Asend*, and the fee is
|
||||
reasonable. If he agrees, he calls `walletprocesspsbt "P2"` to sign. The
|
||||
resulting PSBT *P3* contains both Carol's and Bob's signature.
|
||||
- Now anyone can call `finalizepsbt "P3"` to extract a fully signed transaction
|
||||
*T*.
|
||||
- Finally anyone can broadcast the transaction using `sendrawtransaction "T"`.
|
||||
|
||||
In case there are more signers, it may be advantageous to let them all sign in
|
||||
parallel, rather than passing the PSBT from one signer to the next one. In the
|
||||
above example this would translate to Carol handing a copy of *P* to each signer
|
||||
separately. They can then all invoke `walletprocesspsbt "P"`, and end up with
|
||||
their individually-signed PSBT structures. They then all send those back to
|
||||
Carol (or anyone) who can combine them using `combinepsbt`. The last two steps
|
||||
(`finalizepsbt` and `sendrawtransaction`) remain unchanged.
|
||||
+21
-207
@@ -1,11 +1,8 @@
|
||||
(note: this is a temporary file, to be added-to by anybody, and moved to
|
||||
release-notes at release time)
|
||||
Bitcoin Core version 0.17.x is now available from:
|
||||
|
||||
Bitcoin Core version *version* is now available from:
|
||||
<https://bitcoincore.org/bin/bitcoin-core-0.17.x/>
|
||||
|
||||
<https://bitcoincore.org/bin/bitcoin-core-*version*/>
|
||||
|
||||
This is a new major version release, including new features, various bugfixes
|
||||
This is a new minor version release, including new features, various bugfixes
|
||||
and performance improvements, as well as updated translations.
|
||||
|
||||
Please report bugs using the issue tracker at GitHub:
|
||||
@@ -24,7 +21,11 @@ shut down (which might take a few minutes for older versions), then run the
|
||||
installer (on Windows) or just copy over `/Applications/Bitcoin-Qt` (on Mac)
|
||||
or `bitcoind`/`bitcoin-qt` (on Linux).
|
||||
|
||||
The first time you run version 0.15.0, your chainstate database will be converted to a
|
||||
If your node has a txindex, the txindex db will be migrated the first time you
|
||||
run 0.17.0 or newer, which may take up to a few hours. Your node will not be
|
||||
functional until this migration completes.
|
||||
|
||||
The first time you run version 0.15.0 or newer, your chainstate database will be converted to a
|
||||
new format, which will take anywhere from a few minutes to half an hour,
|
||||
depending on the speed of your machine.
|
||||
|
||||
@@ -59,214 +60,27 @@ support versions of macOS older than 10.10.
|
||||
Notable changes
|
||||
===============
|
||||
|
||||
Changed command-line options
|
||||
----------------------------
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
- `-includeconf=<file>` can be used to include additional configuration files.
|
||||
Only works inside the `bitcoin.conf` file, not inside included files or from
|
||||
command-line. Multiple files may be included. Can be disabled from command-
|
||||
line via `-noincludeconf`. Note that multi-argument commands like
|
||||
`-includeconf` will override preceding `-noincludeconf`, i.e.
|
||||
- A new document introduces Bitcoin Core's BIP174
|
||||
[Partially-Signed Bitcoin Transactions (PSBT)](https://github.com/bitcoin/bitcoin/blob/0.17/doc/psbt.md)
|
||||
interface, which is used to allow multiple programs to collaboratively
|
||||
work to create, sign, and broadcast new transactions. This is useful
|
||||
for offline (cold storage) wallets, multisig wallets, coinjoin
|
||||
implementations, and many other cases where two or more programs need
|
||||
to interact to generate a complete transaction.
|
||||
|
||||
noincludeconf=1
|
||||
includeconf=relative.conf
|
||||
0.17.x change log
|
||||
=================
|
||||
|
||||
as bitcoin.conf will still include `relative.conf`.
|
||||
|
||||
GUI changes
|
||||
-----------
|
||||
|
||||
- Block storage can be limited under Preferences, in the Main tab. Undoing this setting requires downloading the full blockchain again. This mode is incompatible with -txindex and -rescan.
|
||||
|
||||
RPC changes
|
||||
------------
|
||||
|
||||
### Low-level changes
|
||||
|
||||
- The `createrawtransaction` RPC will now accept an array or dictionary (kept for compatibility) for the `outputs` parameter. This means the order of transaction outputs can be specified by the client.
|
||||
- The `fundrawtransaction` RPC will reject the previously deprecated `reserveChangeKey` option.
|
||||
- `sendmany` now shuffles outputs to improve privacy, so any previously expected behavior with regards to output ordering can no longer be relied upon.
|
||||
- The new RPC `testmempoolaccept` can be used to test acceptance of a transaction to the mempool without adding it.
|
||||
- JSON transaction decomposition now includes a `weight` field which provides
|
||||
the transaction's exact weight. This is included in REST /rest/tx/ and
|
||||
/rest/block/ endpoints when in json mode. This is also included in `getblock`
|
||||
(with verbosity=2), `listsinceblock`, `listtransactions`, and
|
||||
`getrawtransaction` RPC commands.
|
||||
- New `fees` field introduced in `getrawmempool`, `getmempoolancestors`, `getmempooldescendants` and
|
||||
`getmempoolentry` when verbosity is set to `true` with sub-fields `ancestor`, `base`, `modified`
|
||||
and `descendant` denominated in BTC. This new field deprecates previous fee fields, such as
|
||||
`fee`, `modifiedfee`, `ancestorfee` and `descendantfee`.
|
||||
- The new RPC `getzmqnotifications` returns information about active ZMQ
|
||||
notifications.
|
||||
|
||||
External wallet files
|
||||
---------------------
|
||||
|
||||
The `-wallet=<path>` option now accepts full paths instead of requiring wallets
|
||||
to be located in the -walletdir directory.
|
||||
|
||||
Newly created wallet format
|
||||
---------------------------
|
||||
|
||||
If `-wallet=<path>` is specified with a path that does not exist, it will now
|
||||
create a wallet directory at the specified location (containing a wallet.dat
|
||||
data file, a db.log file, and database/log.?????????? files) instead of just
|
||||
creating a data file at the path and storing log files in the parent
|
||||
directory. This should make backing up wallets more straightforward than
|
||||
before because the specified wallet path can just be directly archived without
|
||||
having to look in the parent directory for transaction log files.
|
||||
|
||||
For backwards compatibility, wallet paths that are names of existing data files
|
||||
in the `-walletdir` directory will continue to be accepted and interpreted the
|
||||
same as before.
|
||||
|
||||
Dynamic loading and creation of wallets
|
||||
---------------------------------------
|
||||
|
||||
Previously, wallets could only be loaded or created at startup, by specifying `-wallet` parameters on the command line or in the bitcoin.conf file. It is now possible to load, create and unload wallets dynamically at runtime:
|
||||
|
||||
- Existing wallets can be loaded by calling the `loadwallet` RPC. The wallet can be specified as file/directory basename (which must be located in the `walletdir` directory), or as an absolute path to a file/directory.
|
||||
- New wallets can be created (and loaded) by calling the `createwallet` RPC. The provided name must not match a wallet file in the `walletdir` directory or the name of a wallet that is currently loaded.
|
||||
- Loaded wallets can be unloaded by calling the `unloadwallet` RPC.
|
||||
|
||||
This feature is currently only available through the RPC interface.
|
||||
|
||||
Coin selection
|
||||
--------------
|
||||
- A new `-avoidpartialspends` flag has been added (default=false). If enabled, the wallet will try to spend UTXO's that point at the same destination
|
||||
together. This is a privacy increase, as there will no longer be cases where a wallet will inadvertently spend only parts of the coins sent to
|
||||
the same address (note that if someone were to send coins to that address after it was used, those coins will still be included in future
|
||||
coin selections).
|
||||
|
||||
Configuration sections for testnet and regtest
|
||||
----------------------------------------------
|
||||
|
||||
It is now possible for a single configuration file to set different
|
||||
options for different networks. This is done by using sections or by
|
||||
prefixing the option with the network, such as:
|
||||
|
||||
main.uacomment=bitcoin
|
||||
test.uacomment=bitcoin-testnet
|
||||
regtest.uacomment=regtest
|
||||
[main]
|
||||
mempoolsize=300
|
||||
[test]
|
||||
mempoolsize=100
|
||||
[regtest]
|
||||
mempoolsize=20
|
||||
|
||||
The `addnode=`, `connect=`, `port=`, `bind=`, `rpcport=`, `rpcbind=`
|
||||
and `wallet=` options will only apply to mainnet when specified in the
|
||||
configuration file, unless a network is specified.
|
||||
|
||||
'label' and 'account' APIs for wallet
|
||||
-------------------------------------
|
||||
|
||||
A new 'label' API has been introduced for the wallet. This is intended as a
|
||||
replacement for the deprecated 'account' API. The 'account' can continue to
|
||||
be used in V0.17 by starting bitcoind with the '-deprecatedrpc=accounts'
|
||||
argument, and will be fully removed in V0.18.
|
||||
|
||||
The label RPC methods mirror the account functionality, with the following functional differences:
|
||||
|
||||
- Labels can be set on any address, not just receiving addresses. This functionality was previously only available through the GUI.
|
||||
- Labels can be deleted by reassigning all addresses using the `setlabel` RPC method.
|
||||
- There isn't support for sending transactions _from_ a label, or for determining which label a transaction was sent from.
|
||||
- Labels do not have a balance.
|
||||
|
||||
Here are the changes to RPC methods:
|
||||
|
||||
| Deprecated Method | New Method | Notes |
|
||||
| :---------------------- | :-------------------- | :-----------|
|
||||
| `getaccount` | `getaddressinfo` | `getaddressinfo` returns a json object with address information instead of just the name of the account as a string. |
|
||||
| `getaccountaddress` | n/a | There is no replacement for `getaccountaddress` since labels do not have an associated receive address. |
|
||||
| `getaddressesbyaccount` | `getaddressesbylabel` | `getaddressesbylabel` returns a json object with the addresses as keys, instead of a list of strings. |
|
||||
| `getreceivedbyaccount` | `getreceivedbylabel` | _no change in behavior_ |
|
||||
| `listaccounts` | `listlabels` | `listlabels` does not return a balance or accept `minconf` and `watchonly` arguments. |
|
||||
| `listreceivedbyaccount` | `listreceivedbylabel` | Both methods return new `label` fields, along with `account` fields for backward compatibility. |
|
||||
| `move` | n/a | _no replacement_ |
|
||||
| `sendfrom` | n/a | _no replacement_ |
|
||||
| `setaccount` | `setlabel` | Both methods now: <ul><li>allow assigning labels to any address, instead of raising an error if the address is not receiving address.<li>delete the previous label associated with an address when the final address using that label is reassigned to a different label, instead of making an implicit `getaccountaddress` call to ensure the previous label still has a receiving address. |
|
||||
|
||||
| Changed Method | Notes |
|
||||
| :--------------------- | :------ |
|
||||
| `addmultisigaddress` | Renamed `account` named parameter to `label`. Still accepts `account` for backward compatibility if running with '-deprecatedrpc=accounts'. |
|
||||
| `getnewaddress` | Renamed `account` named parameter to `label`. Still accepts `account` for backward compatibility. if running with '-deprecatedrpc=accounts' |
|
||||
| `listunspent` | Returns new `label` fields. `account` field will be returned for backward compatibility if running with '-deprecatedrpc=accounts' |
|
||||
| `sendmany` | The `account` named parameter has been renamed to `dummy`. If provided, the `dummy` parameter must be set to the empty string, unless running with the `-deprecatedrpc=accounts` argument (in which case functionality is unchanged). |
|
||||
| `listtransactions` | The `account` named parameter has been renamed to `dummy`. If provided, the `dummy` parameter must be set to the string `*`, unless running with the `-deprecatedrpc=accounts` argument (in which case functionality is unchanged). |
|
||||
| `getbalance` | `account`, `minconf` and `include_watchonly` parameters are deprecated, and can only be used if running with '-deprecatedrpc=accounts' |
|
||||
|
||||
Low-level RPC changes
|
||||
---------------------
|
||||
|
||||
- When bitcoin is not started with any `-wallet=<path>` options, the name of
|
||||
the default wallet returned by `getwalletinfo` and `listwallets` RPCs is
|
||||
now the empty string `""` instead of `"wallet.dat"`. If bitcoin is started
|
||||
with any `-wallet=<path>` options, there is no change in behavior, and the
|
||||
name of any wallet is just its `<path>` string.
|
||||
- Passing an empty string (`""`) as the `address_type` parameter to
|
||||
`getnewaddress`, `getrawchangeaddress`, `addmultisigaddress`,
|
||||
`fundrawtransaction` RPCs is now an error. Previously, this would fall back
|
||||
to using the default address type. It is still possible to pass null or leave
|
||||
the parameter unset to use the default address type.
|
||||
|
||||
- Bare multisig outputs to our keys are no longer automatically treated as
|
||||
incoming payments. As this feature was only available for multisig outputs for
|
||||
which you had all private keys in your wallet, there was generally no use for
|
||||
them compared to single-key schemes. Furthermore, no address format for such
|
||||
outputs is defined, and wallet software can't easily send to it. These outputs
|
||||
will no longer show up in `listtransactions`, `listunspent`, or contribute to
|
||||
your balance, unless they are explicitly watched (using `importaddress` or
|
||||
`importmulti` with hex script argument). `signrawtransaction*` also still
|
||||
works for them.
|
||||
|
||||
- The `getwalletinfo` RPC method now returns an `hdseedid` value, which is always the same as the incorrectly-named `hdmasterkeyid` value. `hdmasterkeyid` will be removed in V0.18.
|
||||
- The `getaddressinfo` RPC method now returns an `hdseedid` value, which is always the same as the incorrectly-named `hdmasterkeyid` value. `hdmasterkeyid` will be removed in V0.18.
|
||||
|
||||
Other API changes
|
||||
-----------------
|
||||
|
||||
- The `inactivehdmaster` property in the `dumpwallet` output has been corrected to `inactivehdseed`
|
||||
|
||||
### Logging
|
||||
|
||||
- The log timestamp format is now ISO 8601 (e.g. "2018-02-28T12:34:56Z").
|
||||
|
||||
- When running bitcoind with `-debug` but without `-daemon`, logging to stdout
|
||||
is now the default behavior. Setting `-printtoconsole=1` no longer implicitly
|
||||
disables logging to debug.log. Instead, logging to file can be explicitly disabled
|
||||
by setting `-debuglogfile=0`.
|
||||
|
||||
Transaction index changes
|
||||
-------------------------
|
||||
|
||||
The transaction index is now built separately from the main node procedure,
|
||||
meaning the `-txindex` flag can be toggled without a full reindex. If bitcoind
|
||||
is run with `-txindex` on a node that is already partially or fully synced
|
||||
without one, the transaction index will be built in the background and become
|
||||
available once caught up. When switching from running `-txindex` to running
|
||||
without the flag, the transaction index database will *not* be deleted
|
||||
automatically, meaning it could be turned back on at a later time without a full
|
||||
resync.
|
||||
|
||||
Miner block size removed
|
||||
------------------------
|
||||
|
||||
The `-blockmaxsize` option for miners to limit their blocks' sizes was
|
||||
deprecated in V0.15.1, and has now been removed. Miners should use the
|
||||
`-blockmaxweight` option if they want to limit the weight of their blocks'
|
||||
weights.
|
||||
|
||||
Python Support
|
||||
--------------
|
||||
|
||||
Support for Python 2 has been discontinued for all test files and tools.
|
||||
(todo)
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Thanks to everyone who directly contributed to this release:
|
||||
|
||||
(todo)
|
||||
|
||||
As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/).
|
||||
@@ -0,0 +1,10 @@
|
||||
.git
|
||||
.gitignore
|
||||
.travis.yml
|
||||
README.md
|
||||
LICENSE
|
||||
hooks
|
||||
Dockerfile
|
||||
Makefile
|
||||
*.sh
|
||||
*.patch
|
||||
@@ -0,0 +1,43 @@
|
||||
FROM ubuntu:16.04
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
RUN set -xe; \
|
||||
apt-get update; \
|
||||
apt-get install --no-install-recommends -y build-essential libtool autotools-dev automake pkg-config git wget apt-utils \
|
||||
librsvg2-bin libtiff-tools cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools xz-utils ccache g++-multilib \
|
||||
g++-mingw-w64-i686 mingw-w64-i686-dev bsdmainutils curl ca-certificates g++-mingw-w64-x86-64 mingw-w64-x86-64-dev; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -; \
|
||||
echo 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main' >> /etc/apt/sources.list; \
|
||||
apt-get update; \
|
||||
apt-get install --no-install-recommends -y clang-8 lldb-8 lld-8 libc++-8-dev; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang-cpp-8 80; \
|
||||
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 80; \
|
||||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 80; \
|
||||
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 80; \
|
||||
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; \
|
||||
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix; \
|
||||
/usr/sbin/update-ccache-symlinks; \
|
||||
cd /usr/include/c++ && ln -s /usr/lib/llvm-8/include/c++/v1; \
|
||||
cd /usr/lib/llvm-8/lib && ln -s libc++abi.so.1 libc++abi.so;
|
||||
|
||||
ARG VCS_REF
|
||||
ARG BUILD_DATE
|
||||
LABEL maintainer="blockchain@lbry.com" \
|
||||
decription="build_lbrycrd" \
|
||||
version="1.1" \
|
||||
org.label-schema.name="build_lbrycrd" \
|
||||
org.label-schema.description="Use this to generate a reproducible build of LBRYcrd" \
|
||||
org.label-schema.build-date=$BUILD_DATE \
|
||||
org.label-schema.vcs-ref=$VCS_REF \
|
||||
org.label-schema.vcs-url="https://github.com/lbryio/lbrycrd" \
|
||||
org.label-schema.schema-version="1.0.0-rc1" \
|
||||
org.label-schema.vendor="LBRY" \
|
||||
org.label-schema.docker.cmd="docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` -t lbry/build_lbrycrd packaging"
|
||||
|
||||
ENV PATH "/usr/lib/ccache:$PATH"
|
||||
WORKDIR /home
|
||||
CMD ["/bin/bash"]
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# NOTE: this requires that you get the MacOS SDK separately.
|
||||
# To acquire it, you will need to log into the Apple dev portal.
|
||||
# From there, you download an Xcode package. Recommended: 7.3.1
|
||||
# You can extract the SDK from that using contrib/macdeploy/extract
|
||||
# you will need a folder like this: depends/SDKs/MacOSOSX10.11.sdk
|
||||
# and ensure that the darwin.mk file version correspondes to the SDK.
|
||||
|
||||
if which dpkg-query >/dev/null; then
|
||||
if dpkg-query -W librsvg2-bin libtiff-tools cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools \
|
||||
build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates; then
|
||||
echo "All dependencies satisfied."
|
||||
else
|
||||
echo "Missing dependencies detected. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e depends/SDKs/MacOSX10.11.sdk ]; then
|
||||
echo "Missing depends/SDKs/MacOSX10.11.sdk"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache config:"
|
||||
ccache -ps
|
||||
fi
|
||||
|
||||
pushd depends
|
||||
make -j`getconf _NPROCESSORS_ONLN` HOST=x86_64-apple-darwin14 NO_QT=1 V=1
|
||||
popd
|
||||
|
||||
./autogen.sh
|
||||
DEPS_DIR=`pwd`/depends/x86_64-apple-darwin14
|
||||
CONFIG_SITE=${DEPS_DIR}/share/config.site ./configure --enable-reduce-exports --without-gui --with-icu="${DEPS_DIR}" --enable-static --disable-shared
|
||||
make -j`getconf _NPROCESSORS_ONLN`
|
||||
${DEPS_DIR}/native/bin/x86_64-apple-darwin14-strip src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache stats:"
|
||||
ccache -s
|
||||
fi
|
||||
|
||||
echo "OSX 64bit build is complete"
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if which dpkg-query >/dev/null; then
|
||||
if dpkg-query -W libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates; then
|
||||
echo "All dependencies satisfied."
|
||||
else
|
||||
echo "Missing dependencies detected. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache config:"
|
||||
ccache -ps
|
||||
fi
|
||||
|
||||
export CXXFLAGS="${CXXFLAGS:--frecord-gcc-switches}"
|
||||
echo "CXXFLAGS set to $CXXFLAGS"
|
||||
|
||||
cd depends
|
||||
make -j`getconf _NPROCESSORS_ONLN` HOST=x86_64-pc-linux-gnu NO_QT=1 V=1
|
||||
cd ..
|
||||
|
||||
./autogen.sh
|
||||
DEPS_DIR=`pwd`/depends/x86_64-pc-linux-gnu
|
||||
CONFIG_SITE=${DEPS_DIR}/share/config.site ./configure --enable-static --disable-shared --with-pic --without-gui
|
||||
make -j`getconf _NPROCESSORS_ONLN`
|
||||
strip src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache stats:"
|
||||
ccache -s
|
||||
fi
|
||||
|
||||
echo "Linux 64bit build is complete"
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if which dpkg-query >/dev/null; then
|
||||
if dpkg-query -W g++-mingw-w64-i686 mingw-w64-i686-dev \
|
||||
build-essential libtool autotools-dev automake pkg-config \
|
||||
bsdmainutils curl ca-certificates; then
|
||||
echo "All dependencies satisfied."
|
||||
else
|
||||
echo "Missing dependencies detected. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
# sudo update-alternatives --config i686-w64-mingw32-g++ # you have to select posix
|
||||
fi
|
||||
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache config:"
|
||||
ccache -ps
|
||||
fi
|
||||
|
||||
export CXXFLAGS="${CXXFLAGS:--frecord-gcc-switches}"
|
||||
echo "CXXFLAGS set to $CXXFLAGS"
|
||||
|
||||
pushd depends
|
||||
make -j`getconf _NPROCESSORS_ONLN` HOST=i686-w64-mingw32 NO_QT=1 V=1
|
||||
popd
|
||||
|
||||
./autogen.sh
|
||||
DEPS_DIR=`pwd`/depends/i686-w64-mingw32
|
||||
CONFIG_SITE=${DEPS_DIR}/share/config.site ./configure --prefix=/ --without-gui --with-icu="$DEPS_DIR" --enable-static --disable-shared
|
||||
make -j`getconf _NPROCESSORS_ONLN`
|
||||
i686-w64-mingw32-strip src/lbrycrdd.exe src/lbrycrd-cli.exe src/lbrycrd-tx.exe
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache stats:"
|
||||
ccache -s
|
||||
fi
|
||||
|
||||
echo "Windows 32bit build is complete"
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if which dpkg-query >/dev/null; then
|
||||
if dpkg-query -W g++-mingw-w64-x86-64 mingw-w64-x86-64-dev \
|
||||
build-essential libtool autotools-dev automake pkg-config \
|
||||
bsdmainutils curl ca-certificates; then
|
||||
echo "All dependencies satisfied."
|
||||
else
|
||||
echo "Missing dependencies detected. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
#sudo update-alternatives --config x86_64-w64-mingw32-g++ # you have to select posix
|
||||
fi
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache config:"
|
||||
ccache -ps
|
||||
fi
|
||||
|
||||
export CXXFLAGS="${CXXFLAGS:--frecord-gcc-switches}"
|
||||
echo "CXXFLAGS set to $CXXFLAGS"
|
||||
|
||||
pushd depends
|
||||
make -j`getconf _NPROCESSORS_ONLN` HOST=x86_64-w64-mingw32 NO_QT=1 V=1
|
||||
popd
|
||||
|
||||
./autogen.sh
|
||||
DEPS_DIR=`pwd`/depends/x86_64-w64-mingw32
|
||||
CONFIG_SITE=${DEPS_DIR}/share/config.site ./configure --prefix=/ --without-gui --with-icu="$DEPS_DIR" --enable-static --disable-shared
|
||||
make -j`getconf _NPROCESSORS_ONLN`
|
||||
x86_64-w64-mingw32-strip src/lbrycrdd.exe src/lbrycrd-cli.exe src/lbrycrd-tx.exe
|
||||
|
||||
if which ccache >/dev/null; then
|
||||
echo "ccache stats:"
|
||||
ccache -s
|
||||
fi
|
||||
|
||||
echo "Windows 64bit build is complete"
|
||||
@@ -99,6 +99,9 @@
|
||||
|
||||
<key>LSAppNapIsDisabled</key>
|
||||
<string>True</string>
|
||||
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<string>True</string>
|
||||
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.finance</string>
|
||||
|
||||
+2
-1
@@ -80,8 +80,9 @@ Section -Main SEC0000
|
||||
SetOutPath $INSTDIR\daemon
|
||||
File @abs_top_srcdir@/release/@BITCOIN_DAEMON_NAME@@EXEEXT@
|
||||
File @abs_top_srcdir@/release/@BITCOIN_CLI_NAME@@EXEEXT@
|
||||
File @abs_top_srcdir@/release/@BITCOIN_TX_NAME@@EXEEXT@
|
||||
SetOutPath $INSTDIR\doc
|
||||
File /r @abs_top_srcdir@/doc\*.*
|
||||
File /r /x Makefile* @abs_top_srcdir@/doc\*.*
|
||||
SetOutPath $INSTDIR
|
||||
WriteRegStr HKCU "${REGKEY}\Components" Main 1
|
||||
SectionEnd
|
||||
|
||||
+48
-30
@@ -19,7 +19,7 @@ else
|
||||
LIBUNIVALUE = $(UNIVALUE_LIBS)
|
||||
endif
|
||||
|
||||
BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
|
||||
BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(ICU_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(ICU_CFLAGS)
|
||||
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
|
||||
BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
|
||||
@@ -80,11 +80,11 @@ TESTS =
|
||||
BENCHMARKS =
|
||||
|
||||
if BUILD_BITCOIND
|
||||
bin_PROGRAMS += bitcoind
|
||||
bin_PROGRAMS += lbrycrdd
|
||||
endif
|
||||
|
||||
if BUILD_BITCOIN_UTILS
|
||||
bin_PROGRAMS += bitcoin-cli bitcoin-tx
|
||||
bin_PROGRAMS += lbrycrd-cli lbrycrd-tx
|
||||
endif
|
||||
|
||||
.PHONY: FORCE check-symbols check-security
|
||||
@@ -102,6 +102,8 @@ BITCOIN_CORE_H = \
|
||||
chainparamsseeds.h \
|
||||
checkpoints.h \
|
||||
checkqueue.h \
|
||||
claimscriptop.h \
|
||||
claimtrie.h \
|
||||
clientversion.h \
|
||||
coins.h \
|
||||
compat.h \
|
||||
@@ -127,12 +129,14 @@ BITCOIN_CORE_H = \
|
||||
key.h \
|
||||
key_io.h \
|
||||
keystore.h \
|
||||
lbry.h \
|
||||
dbwrapper.h \
|
||||
limitedmap.h \
|
||||
logging.h \
|
||||
memusage.h \
|
||||
merkleblock.h \
|
||||
miner.h \
|
||||
nameclaim.h \
|
||||
net.h \
|
||||
net_processing.h \
|
||||
netaddress.h \
|
||||
@@ -145,6 +149,7 @@ BITCOIN_CORE_H = \
|
||||
policy/policy.h \
|
||||
policy/rbf.h \
|
||||
pow.h \
|
||||
prefixtrie.h \
|
||||
protocol.h \
|
||||
random.h \
|
||||
reverse_iterator.h \
|
||||
@@ -178,10 +183,12 @@ BITCOIN_CORE_H = \
|
||||
txdb.h \
|
||||
txmempool.h \
|
||||
ui_interface.h \
|
||||
uint256.h \
|
||||
undo.h \
|
||||
util.h \
|
||||
utilmemory.h \
|
||||
utilmoneystr.h \
|
||||
utilstrencodings.h \
|
||||
utiltime.h \
|
||||
validation.h \
|
||||
validationinterface.h \
|
||||
@@ -211,7 +218,7 @@ obj/build.h: FORCE
|
||||
"$(abs_top_srcdir)"
|
||||
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
|
||||
|
||||
# server: shared between bitcoind and bitcoin-qt
|
||||
# server: shared between lbrycrdd and lbrycrd-qt
|
||||
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
|
||||
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_server_a_SOURCES = \
|
||||
@@ -221,6 +228,9 @@ libbitcoin_server_a_SOURCES = \
|
||||
blockencodings.cpp \
|
||||
chain.cpp \
|
||||
checkpoints.cpp \
|
||||
claimscriptop.cpp \
|
||||
claimtrie.cpp \
|
||||
claimtrieforks.cpp \
|
||||
consensus/tx_verify.cpp \
|
||||
httprpc.cpp \
|
||||
httpserver.cpp \
|
||||
@@ -228,8 +238,10 @@ libbitcoin_server_a_SOURCES = \
|
||||
index/txindex.cpp \
|
||||
init.cpp \
|
||||
dbwrapper.cpp \
|
||||
lbry.cpp \
|
||||
merkleblock.cpp \
|
||||
miner.cpp \
|
||||
nameclaim.cpp \
|
||||
net.cpp \
|
||||
net_processing.cpp \
|
||||
noui.cpp \
|
||||
@@ -238,8 +250,10 @@ libbitcoin_server_a_SOURCES = \
|
||||
policy/policy.cpp \
|
||||
policy/rbf.cpp \
|
||||
pow.cpp \
|
||||
prefixtrie.cpp \
|
||||
rest.cpp \
|
||||
rpc/blockchain.cpp \
|
||||
rpc/claimtrie.cpp \
|
||||
rpc/mining.cpp \
|
||||
rpc/misc.cpp \
|
||||
rpc/net.cpp \
|
||||
@@ -253,6 +267,8 @@ libbitcoin_server_a_SOURCES = \
|
||||
txdb.cpp \
|
||||
txmempool.cpp \
|
||||
ui_interface.cpp \
|
||||
uint256.cpp \
|
||||
utilstrencodings.cpp \
|
||||
validation.cpp \
|
||||
validationinterface.cpp \
|
||||
versionbits.cpp \
|
||||
@@ -269,7 +285,7 @@ libbitcoin_zmq_a_SOURCES = \
|
||||
endif
|
||||
|
||||
|
||||
# wallet: shared between bitcoind and bitcoin-qt, but only linked
|
||||
# wallet: shared between lbrycrdd and lbrycrd-qt, but only linked
|
||||
# when wallet enabled
|
||||
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
@@ -369,7 +385,7 @@ libbitcoin_consensus_a_SOURCES = \
|
||||
utilstrencodings.h \
|
||||
version.h
|
||||
|
||||
# common: shared between bitcoind, and bitcoin-qt and non-server tools
|
||||
# common: shared between lbrycrdd, and lbrycrd-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 = \
|
||||
@@ -383,6 +399,7 @@ libbitcoin_common_a_SOURCES = \
|
||||
key.cpp \
|
||||
key_io.cpp \
|
||||
keystore.cpp \
|
||||
nameclaim.cpp \
|
||||
netaddress.cpp \
|
||||
netbase.cpp \
|
||||
policy/feerate.cpp \
|
||||
@@ -399,7 +416,7 @@ libbitcoin_common_a_SOURCES = \
|
||||
# This library *must* be included to make sure that the glibc
|
||||
# backward-compatibility objects and their sanity checks are linked.
|
||||
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) $(CRYPTO_CFLAGS)
|
||||
libbitcoin_util_a_SOURCES = \
|
||||
support/lockedpool.cpp \
|
||||
chainparamsbase.cpp \
|
||||
@@ -416,6 +433,7 @@ libbitcoin_util_a_SOURCES = \
|
||||
support/cleanse.cpp \
|
||||
sync.cpp \
|
||||
threadinterrupt.cpp \
|
||||
uint256.cpp \
|
||||
util.cpp \
|
||||
utilmoneystr.cpp \
|
||||
utilstrencodings.cpp \
|
||||
@@ -427,7 +445,7 @@ libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
|
||||
AM_LDFLAGS += $(COMPAT_LDFLAGS)
|
||||
endif
|
||||
|
||||
# cli: shared between bitcoin-cli and bitcoin-qt
|
||||
# cli: shared between lbrycrd-cli and lbrycrd-qt
|
||||
libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_cli_a_SOURCES = \
|
||||
@@ -438,16 +456,16 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
|
||||
#
|
||||
|
||||
# bitcoind binary #
|
||||
bitcoind_SOURCES = bitcoind.cpp
|
||||
bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
lbrycrdd_SOURCES = bitcoind.cpp
|
||||
lbrycrdd_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
lbrycrdd_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
lbrycrdd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
if TARGET_WINDOWS
|
||||
bitcoind_SOURCES += bitcoind-res.rc
|
||||
lbrycrdd_SOURCES += bitcoind-res.rc
|
||||
endif
|
||||
|
||||
bitcoind_LDADD = \
|
||||
lbrycrdd_LDADD = \
|
||||
$(LIBBITCOIN_SERVER) \
|
||||
$(LIBBITCOIN_WALLET) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
@@ -461,38 +479,38 @@ bitcoind_LDADD = \
|
||||
$(LIBMEMENV) \
|
||||
$(LIBSECP256K1)
|
||||
|
||||
bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
|
||||
lbrycrdd_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
|
||||
|
||||
# bitcoin-cli binary #
|
||||
bitcoin_cli_SOURCES = bitcoin-cli.cpp
|
||||
bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
|
||||
bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
# lbrycrd-cli binary #
|
||||
lbrycrd_cli_SOURCES = bitcoin-cli.cpp
|
||||
lbrycrd_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
|
||||
lbrycrd_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
lbrycrd_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
if TARGET_WINDOWS
|
||||
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
|
||||
lbrycrd_cli_SOURCES += bitcoin-cli-res.rc
|
||||
endif
|
||||
|
||||
bitcoin_cli_LDADD = \
|
||||
lbrycrd_cli_LDADD = \
|
||||
$(LIBBITCOIN_CLI) \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CRYPTO)
|
||||
|
||||
bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
|
||||
lbrycrd_cli_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(EVENT_LIBS)
|
||||
#
|
||||
|
||||
# bitcoin-tx binary #
|
||||
bitcoin_tx_SOURCES = bitcoin-tx.cpp
|
||||
bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
lbrycrd_tx_SOURCES = bitcoin-tx.cpp
|
||||
lbrycrd_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
lbrycrd_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
lbrycrd_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
if TARGET_WINDOWS
|
||||
bitcoin_tx_SOURCES += bitcoin-tx-res.rc
|
||||
lbrycrd_tx_SOURCES += bitcoin-tx-res.rc
|
||||
endif
|
||||
|
||||
bitcoin_tx_LDADD = \
|
||||
lbrycrd_tx_LDADD = \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
@@ -500,7 +518,7 @@ bitcoin_tx_LDADD = \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBSECP256K1)
|
||||
|
||||
bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
||||
lbrycrd_tx_LDADD += $(BOOST_LIBS) $(ICU_LIBS) $(CRYPTO_LIBS)
|
||||
#
|
||||
|
||||
# bitcoinconsensus library #
|
||||
|
||||
@@ -32,7 +32,7 @@ bench_bench_bitcoin_SOURCES = \
|
||||
|
||||
nodist_bench_bench_bitcoin_SOURCES = $(GENERATED_BENCH_FILES)
|
||||
|
||||
bench_bench_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CLFAGS) $(EVENT_PTHREADS_CFLAGS) -I$(builddir)/bench/
|
||||
bench_bench_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CLFAGS) $(EVENT_PTHREADS_CFLAGS) $(BOOST_CPPFLAGS) -I$(builddir)/bench/
|
||||
bench_bench_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bench_bench_bitcoin_LDADD = \
|
||||
$(LIBBITCOIN_WALLET) \
|
||||
@@ -55,7 +55,7 @@ if ENABLE_WALLET
|
||||
bench_bench_bitcoin_SOURCES += bench/coin_selection.cpp
|
||||
endif
|
||||
|
||||
bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES)
|
||||
|
||||
+18
-18
@@ -2,7 +2,7 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
bin_PROGRAMS += qt/bitcoin-qt
|
||||
bin_PROGRAMS += qt/lbrycrd-qt
|
||||
EXTRA_LIBRARIES += qt/libbitcoinqt.a
|
||||
|
||||
# bitcoin qt core #
|
||||
@@ -366,7 +366,7 @@ BITCOIN_RC = qt/res/bitcoin-qt-res.rc
|
||||
BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS
|
||||
|
||||
qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
|
||||
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS) $(SSL_CFLAGS)
|
||||
qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
|
||||
qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)
|
||||
|
||||
@@ -382,37 +382,37 @@ QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:
|
||||
# Most files will depend on the forms and moc files as includes. Generate them
|
||||
# before anything else.
|
||||
$(QT_MOC): $(QT_FORMS_H)
|
||||
$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) : | $(QT_MOC)
|
||||
$(qt_libbitcoinqt_a_OBJECTS) $(qt_lbrycrd_qt_OBJECTS) : | $(QT_MOC)
|
||||
|
||||
#Generating these with a half-written protobuf header leads to wacky results.
|
||||
#This makes sure it's done.
|
||||
$(QT_MOC): $(PROTOBUF_H)
|
||||
$(QT_MOC_CPP): $(PROTOBUF_H)
|
||||
|
||||
# bitcoin-qt binary #
|
||||
qt_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
# lbrycrd-qt binary #
|
||||
qt_lbrycrd_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
$(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
|
||||
qt_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
|
||||
qt_lbrycrd_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
|
||||
|
||||
qt_bitcoin_qt_SOURCES = qt/bitcoin.cpp
|
||||
qt_lbrycrd_qt_SOURCES = qt/bitcoin.cpp
|
||||
if TARGET_DARWIN
|
||||
qt_bitcoin_qt_SOURCES += $(BITCOIN_MM)
|
||||
qt_lbrycrd_qt_SOURCES += $(BITCOIN_MM)
|
||||
endif
|
||||
if TARGET_WINDOWS
|
||||
qt_bitcoin_qt_SOURCES += $(BITCOIN_RC)
|
||||
qt_lbrycrd_qt_SOURCES += $(BITCOIN_RC)
|
||||
endif
|
||||
qt_bitcoin_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
|
||||
qt_lbrycrd_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
|
||||
if ENABLE_WALLET
|
||||
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
|
||||
qt_lbrycrd_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
if ENABLE_ZMQ
|
||||
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
qt_lbrycrd_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
endif
|
||||
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
|
||||
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
|
||||
qt_lbrycrd_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
|
||||
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(ICU_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
|
||||
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
qt_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
qt_bitcoin_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX
|
||||
qt_lbrycrd_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
qt_lbrycrd_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX
|
||||
|
||||
#locale/foo.ts -> locale/foo.qm
|
||||
QT_QM=$(QT_TS:.ts=.qm)
|
||||
@@ -444,9 +444,9 @@ CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda
|
||||
CLEANFILES += $(CLEAN_QT)
|
||||
|
||||
bitcoin_qt_clean: FORCE
|
||||
rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT)
|
||||
rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_lbrycrd_qt_OBJECTS) qt/lbrycrd-qt$(EXEEXT) $(LIBBITCOINQT)
|
||||
|
||||
bitcoin_qt : qt/bitcoin-qt$(EXEEXT)
|
||||
bitcoin_qt : qt/lbrycrd-qt$(EXEEXT)
|
||||
|
||||
ui_%.h: %.ui
|
||||
@test -f $(UIC)
|
||||
|
||||
+17
-17
@@ -2,8 +2,8 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
bin_PROGRAMS += qt/test/test_bitcoin-qt
|
||||
TESTS += qt/test/test_bitcoin-qt
|
||||
bin_PROGRAMS += qt/test/test_lbrycrd-qt
|
||||
TESTS += qt/test/test_lbrycrd-qt
|
||||
|
||||
TEST_QT_MOC_CPP = \
|
||||
qt/test/moc_compattests.cpp \
|
||||
@@ -33,10 +33,10 @@ TEST_BITCOIN_CPP = \
|
||||
TEST_BITCOIN_H = \
|
||||
test/test_bitcoin.h
|
||||
|
||||
qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
qt_test_test_lbrycrd_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
$(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS)
|
||||
|
||||
qt_test_test_bitcoin_qt_SOURCES = \
|
||||
qt_test_test_lbrycrd_qt_SOURCES = \
|
||||
qt/test/compattests.cpp \
|
||||
qt/test/rpcnestedtests.cpp \
|
||||
qt/test/test_main.cpp \
|
||||
@@ -46,37 +46,37 @@ qt_test_test_bitcoin_qt_SOURCES = \
|
||||
$(TEST_BITCOIN_CPP) \
|
||||
$(TEST_BITCOIN_H)
|
||||
if ENABLE_WALLET
|
||||
qt_test_test_bitcoin_qt_SOURCES += \
|
||||
qt_test_test_lbrycrd_qt_SOURCES += \
|
||||
qt/test/addressbooktests.cpp \
|
||||
qt/test/paymentservertests.cpp \
|
||||
qt/test/wallettests.cpp \
|
||||
wallet/test/wallet_test_fixture.cpp
|
||||
endif
|
||||
|
||||
nodist_qt_test_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP)
|
||||
nodist_qt_test_test_lbrycrd_qt_SOURCES = $(TEST_QT_MOC_CPP)
|
||||
|
||||
qt_test_test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER)
|
||||
qt_test_test_lbrycrd_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER)
|
||||
if ENABLE_WALLET
|
||||
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
|
||||
qt_test_test_lbrycrd_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
if ENABLE_ZMQ
|
||||
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
qt_test_test_lbrycrd_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
endif
|
||||
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
|
||||
qt_test_test_lbrycrd_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
|
||||
$(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
|
||||
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
|
||||
$(QR_LIBS) $(PROTOBUF_LIBS) $(ICU_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
|
||||
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
|
||||
qt_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
qt_test_test_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
|
||||
qt_test_test_lbrycrd_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
qt_test_test_lbrycrd_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
|
||||
|
||||
CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno
|
||||
|
||||
CLEANFILES += $(CLEAN_BITCOIN_QT_TEST)
|
||||
|
||||
test_bitcoin_qt : qt/test/test_bitcoin-qt$(EXEEXT)
|
||||
test_lbrycrd_qt : qt/test/test_bitcoin-qt$(EXEEXT)
|
||||
|
||||
test_bitcoin_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE
|
||||
test_lbrycrd_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE
|
||||
$(MAKE) check-TESTS TESTS=$^
|
||||
|
||||
test_bitcoin_qt_clean: FORCE
|
||||
rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_bitcoin_qt_OBJECTS)
|
||||
test_lbrycrd_qt_clean: FORCE
|
||||
rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_lbrycrd_qt_OBJECTS)
|
||||
+41
-24
@@ -2,13 +2,14 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
bin_PROGRAMS += test/test_bitcoin
|
||||
noinst_PROGRAMS += test/test_bitcoin_fuzzy
|
||||
bin_PROGRAMS += test/test_lbrycrd
|
||||
noinst_PROGRAMS += test/test_lbrycrd_fuzzy
|
||||
TEST_SRCDIR = test
|
||||
TEST_BINARY=test/test_bitcoin$(EXEEXT)
|
||||
TEST_BINARY=test/test_lbrycrd$(EXEEXT)
|
||||
|
||||
JSON_TEST_FILES = \
|
||||
test/data/base58_encode_decode.json \
|
||||
test/data/base58_keys_valid.json \
|
||||
test/data/key_io_valid.json \
|
||||
test/data/key_io_invalid.json \
|
||||
test/data/script_tests.json \
|
||||
@@ -40,9 +41,11 @@ BITCOIN_TESTS =\
|
||||
test/blockchain_tests.cpp \
|
||||
test/blockencodings_tests.cpp \
|
||||
test/bloom_tests.cpp \
|
||||
test/Checkpoints_tests.cpp \
|
||||
test/bswap_tests.cpp \
|
||||
test/checkqueue_tests.cpp \
|
||||
test/coins_tests.cpp \
|
||||
test/compilerbug_tests.cpp \
|
||||
test/compress_tests.cpp \
|
||||
test/crypto_tests.cpp \
|
||||
test/cuckoocache_tests.cpp \
|
||||
@@ -61,10 +64,14 @@ BITCOIN_TESTS =\
|
||||
test/miner_tests.cpp \
|
||||
test/multisig_tests.cpp \
|
||||
test/net_tests.cpp \
|
||||
test/claimtriecache_tests.cpp \
|
||||
test/claimtriebranching_tests.cpp \
|
||||
test/nameclaim_tests.cpp \
|
||||
test/netbase_tests.cpp \
|
||||
test/pmt_tests.cpp \
|
||||
test/policyestimator_tests.cpp \
|
||||
test/pow_tests.cpp \
|
||||
test/prefixtrie_tests.cpp \
|
||||
test/prevector_tests.cpp \
|
||||
test/raii_event_tests.cpp \
|
||||
test/random_tests.cpp \
|
||||
@@ -95,6 +102,8 @@ BITCOIN_TESTS =\
|
||||
if ENABLE_WALLET
|
||||
BITCOIN_TESTS += \
|
||||
wallet/test/accounting_tests.cpp \
|
||||
wallet/test/claim_rpc_tests.cpp \
|
||||
wallet/test/db_tests.cpp \
|
||||
wallet/test/psbt_wallet_tests.cpp \
|
||||
wallet/test/wallet_tests.cpp \
|
||||
wallet/test/wallet_crypto_tests.cpp \
|
||||
@@ -105,32 +114,32 @@ BITCOIN_TEST_SUITE += \
|
||||
wallet/test/wallet_test_fixture.h
|
||||
endif
|
||||
|
||||
test_test_bitcoin_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
|
||||
test_test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(EVENT_CFLAGS)
|
||||
test_test_bitcoin_LDADD =
|
||||
test_test_lbrycrd_SOURCES = $(BITCOIN_TEST_SUITE) $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
|
||||
test_test_lbrycrd_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(TESTDEFS) $(EVENT_CFLAGS) $(ICU_CPPFLAGS)
|
||||
test_test_lbrycrd_LDADD =
|
||||
if ENABLE_WALLET
|
||||
test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
|
||||
test_test_lbrycrd_LDADD += $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
|
||||
test_test_bitcoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \
|
||||
test_test_lbrycrd_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \
|
||||
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
|
||||
test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
test_test_lbrycrd_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
|
||||
test_test_bitcoin_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
|
||||
test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
test_test_lbrycrd_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS) $(MINIUPNPC_LIBS)
|
||||
test_test_lbrycrd_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||
|
||||
if ENABLE_ZMQ
|
||||
test_test_bitcoin_LDADD += $(ZMQ_LIBS)
|
||||
test_test_lbrycrd_LDADD += $(ZMQ_LIBS)
|
||||
endif
|
||||
#
|
||||
|
||||
# test_bitcoin_fuzzy binary #
|
||||
test_test_bitcoin_fuzzy_SOURCES = test/test_bitcoin_fuzzy.cpp
|
||||
test_test_bitcoin_fuzzy_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
test_test_bitcoin_fuzzy_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
test_test_bitcoin_fuzzy_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
test_test_lbrycrd_fuzzy_SOURCES = test/test_bitcoin_fuzzy.cpp
|
||||
test_test_lbrycrd_fuzzy_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
test_test_lbrycrd_fuzzy_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
test_test_lbrycrd_fuzzy_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
test_test_bitcoin_fuzzy_LDADD = \
|
||||
test_test_lbrycrd_fuzzy_LDADD = \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_SERVER) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
@@ -142,10 +151,9 @@ test_test_bitcoin_fuzzy_LDADD = \
|
||||
$(LIBBITCOIN_CRYPTO_SHANI) \
|
||||
$(LIBSECP256K1)
|
||||
|
||||
test_test_bitcoin_fuzzy_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
||||
#
|
||||
test_test_lbrycrd_fuzzy_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) $(ICU_LIBS)
|
||||
|
||||
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
||||
nodist_test_test_lbrycrd_SOURCES = $(GENERATED_TEST_FILES)
|
||||
|
||||
$(BITCOIN_TESTS): $(GENERATED_TEST_FILES)
|
||||
|
||||
@@ -153,13 +161,13 @@ CLEAN_BITCOIN_TEST = test/*.gcda test/*.gcno $(GENERATED_TEST_FILES)
|
||||
|
||||
CLEANFILES += $(CLEAN_BITCOIN_TEST)
|
||||
|
||||
bitcoin_test: $(TEST_BINARY)
|
||||
lbrycrd_test: $(TEST_BINARY)
|
||||
|
||||
bitcoin_test_check: $(TEST_BINARY) FORCE
|
||||
lbrycrd_test_check: $(TEST_BINARY) FORCE
|
||||
$(MAKE) check-TESTS TESTS=$^
|
||||
|
||||
bitcoin_test_clean : FORCE
|
||||
rm -f $(CLEAN_BITCOIN_TEST) $(test_test_bitcoin_OBJECTS) $(TEST_BINARY)
|
||||
lbrycrd_test_clean : FORCE
|
||||
rm -f $(CLEAN_BITCOIN_TEST) $(test_test_lbrycrd_OBJECTS) $(TEST_BINARY)
|
||||
|
||||
check-local: $(BITCOIN_TESTS:.cpp=.cpp.test)
|
||||
@echo "Running test/util/bitcoin-util-test.py..."
|
||||
@@ -184,3 +192,12 @@ endif
|
||||
echo "};};"; \
|
||||
} > "$@.new" && mv -f "$@.new" "$@"
|
||||
@echo "Generated $@"
|
||||
|
||||
%.raw.h: %.raw
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo "namespace alert_tests{" > $@
|
||||
@echo "static unsigned const char $(*F)[] = {" >> $@
|
||||
@$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' >> $@
|
||||
@echo "};};" >> $@
|
||||
@echo "Generated $@"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ static const CAmount CENT = 1000000;
|
||||
* critical; in unusual circumstances like a(nother) overflow bug that allowed
|
||||
* for the creation of coins out of thin air modification could lead to a fork.
|
||||
* */
|
||||
static const CAmount MAX_MONEY = 21000000 * COIN;
|
||||
static const CAmount MAX_MONEY = 21000000000 * COIN;
|
||||
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
|
||||
|
||||
#endif // BITCOIN_AMOUNT_H
|
||||
@@ -41,7 +41,8 @@ static CTxIn MineBlock(const CScript& coinbase_scriptPubKey)
|
||||
auto block = PrepareBlock(coinbase_scriptPubKey);
|
||||
|
||||
while (!CheckProofOfWork(block->GetHash(), block->nBits, Params().GetConsensus())) {
|
||||
assert(++block->nNonce);
|
||||
++block->nNonce;
|
||||
assert(block->nNonce);
|
||||
}
|
||||
|
||||
bool processed{ProcessNewBlock(Params(), block, true, nullptr)};
|
||||
|
||||
@@ -33,7 +33,7 @@ static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector<Ou
|
||||
// (https://github.com/bitcoin/bitcoin/issues/7883#issuecomment-224807484)
|
||||
static void CoinSelection(benchmark::State& state)
|
||||
{
|
||||
const CWallet wallet("dummy", WalletDatabase::CreateDummy());
|
||||
const CWallet wallet(WalletLocation(), WalletDatabase::CreateDummy());
|
||||
LOCK(wallet.cs_wallet);
|
||||
|
||||
// Add coins.
|
||||
@@ -57,7 +57,7 @@ static void CoinSelection(benchmark::State& state)
|
||||
}
|
||||
|
||||
typedef std::set<CInputCoin> CoinSet;
|
||||
static const CWallet testWallet("dummy", WalletDatabase::CreateDummy());
|
||||
static const CWallet testWallet(WalletLocation(), WalletDatabase::CreateDummy());
|
||||
std::vector<std::unique_ptr<CWalletTx>> wtxn;
|
||||
|
||||
// Copied from src/wallet/test/coinselector_tests.cpp
|
||||
|
||||
@@ -16,14 +16,14 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bitcoin"
|
||||
VALUE "FileDescription", "bitcoin-cli (JSON-RPC client for " PACKAGE_NAME ")"
|
||||
VALUE "CompanyName", "LBRY"
|
||||
VALUE "FileDescription", "lbrycrd-cli (JSON-RPC client for " PACKAGE_NAME ")"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "bitcoin-cli"
|
||||
VALUE "InternalName", "lbrycrd-cli"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||
VALUE "OriginalFilename", "bitcoin-cli.exe"
|
||||
VALUE "ProductName", "bitcoin-cli"
|
||||
VALUE "OriginalFilename", "lbrycrd-cli.exe"
|
||||
VALUE "ProductName", "lbrycrd-cli"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
+7
-7
@@ -48,7 +48,7 @@ static void SetupCliArgs()
|
||||
gArgs.AddArg("-rpcport=<port>", strprintf("Connect to JSON-RPC on <port> (default: %u or testnet: %u)", defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort()), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-rpcwait", "Wait for RPC server to start", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to bitcoind)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to lbrycrdd)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-stdin", "Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases). When combined with -stdinrpcpass, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-stdinrpcpass", "Read RPC password from standard input as a single line. When combined with -stdin, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
|
||||
|
||||
@@ -107,10 +107,10 @@ static int AppInitRPC(int argc, char* argv[])
|
||||
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
|
||||
if (!gArgs.IsArgSet("-version")) {
|
||||
strUsage += "\n"
|
||||
"Usage: bitcoin-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
|
||||
"or: bitcoin-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
|
||||
"or: bitcoin-cli [options] help List commands\n"
|
||||
"or: bitcoin-cli [options] help <command> Get help for a command\n";
|
||||
"Usage: lbrycrd-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
|
||||
"or: lbrycrd-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
|
||||
"or: lbrycrd-cli [options] help List commands\n"
|
||||
"or: lbrycrd-cli [options] help <command> Get help for a command\n";
|
||||
strUsage += "\n" + gArgs.GetHelpMessage();
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co
|
||||
if (response.error != -1) {
|
||||
responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error));
|
||||
}
|
||||
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the bitcoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
|
||||
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the lbrycrdd server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
|
||||
} else if (response.status == HTTP_UNAUTHORIZED) {
|
||||
if (failedToGetAuthCookie) {
|
||||
throw std::runtime_error(strprintf(
|
||||
@@ -470,7 +470,7 @@ static int CommandLineRPC(int argc, char *argv[])
|
||||
strPrint += "error message:\n"+errMsg.get_str();
|
||||
|
||||
if (errCode.isNum() && errCode.get_int() == RPC_WALLET_NOT_SPECIFIED) {
|
||||
strPrint += "\nTry adding \"-rpcwallet=<filename>\" option to bitcoin-cli command line.";
|
||||
strPrint += "\nTry adding \"-rpcwallet=<filename>\" option to lbrycrd-cli command line.";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -16,14 +16,14 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bitcoin"
|
||||
VALUE "FileDescription", "bitcoin-tx (CLI Bitcoin transaction editor utility)"
|
||||
VALUE "CompanyName", "LBRY"
|
||||
VALUE "FileDescription", "lbrycrd-tx (CLI LBRYcrd transaction editor utility)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "bitcoin-tx"
|
||||
VALUE "InternalName", "lbrycrd-tx"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||
VALUE "OriginalFilename", "bitcoin-tx.exe"
|
||||
VALUE "ProductName", "bitcoin-tx"
|
||||
VALUE "OriginalFilename", "lbrycrd-tx.exe"
|
||||
VALUE "ProductName", "lbrycrd-tx"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
+3
-3
@@ -98,9 +98,9 @@ static int AppInitRawTx(int argc, char* argv[])
|
||||
|
||||
if (argc < 2 || HelpRequested(gArgs)) {
|
||||
// First part of help message is specific to this utility
|
||||
std::string strUsage = PACKAGE_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n\n" +
|
||||
"Usage: bitcoin-tx [options] <hex-tx> [commands] Update hex-encoded bitcoin transaction\n" +
|
||||
"or: bitcoin-tx [options] -create [commands] Create hex-encoded bitcoin transaction\n" +
|
||||
std::string strUsage = PACKAGE_NAME " lbrycrd-tx utility version " + FormatFullVersion() + "\n\n" +
|
||||
"Usage: lbrycrd-tx [options] <hex-tx> [commands] Update hex-encoded lbrycrd transaction\n" +
|
||||
"or: lbrycrd-tx [options] -create [commands] Create hex-encoded lbrycrd transaction\n" +
|
||||
"\n";
|
||||
strUsage += gArgs.GetHelpMessage();
|
||||
|
||||
|
||||
+5
-5
@@ -16,14 +16,14 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bitcoin"
|
||||
VALUE "FileDescription", "bitcoind (Bitcoin node with a JSON-RPC server)"
|
||||
VALUE "CompanyName", "LBRY"
|
||||
VALUE "FileDescription", "lbrycrdd (LBRYcrd node with a JSON-RPC server)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "bitcoind"
|
||||
VALUE "InternalName", "lbrycrdd"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||
VALUE "OriginalFilename", "bitcoind.exe"
|
||||
VALUE "ProductName", "bitcoind"
|
||||
VALUE "OriginalFilename", "lbrycrdd.exe"
|
||||
VALUE "ProductName", "lbrycrdd"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
+6
-6
@@ -61,7 +61,7 @@ static bool AppInit(int argc, char* argv[])
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
|
||||
// If Qt is used, parameters/lbrycrd.conf are parsed in qt/bitcoin.cpp's main()
|
||||
SetupServerArgs();
|
||||
std::string error;
|
||||
if (!gArgs.ParseParameters(argc, argv, error)) {
|
||||
@@ -79,7 +79,7 @@ static bool AppInit(int argc, char* argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME " Daemon\n";
|
||||
strUsage += "\nUsage: lbrycrdd [options] Start " PACKAGE_NAME " Daemon\n";
|
||||
strUsage += "\n" + gArgs.GetHelpMessage();
|
||||
}
|
||||
|
||||
@@ -109,12 +109,12 @@ static bool AppInit(int argc, char* argv[])
|
||||
// Error out when loose non-argument tokens are encountered on command line
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (!IsSwitchChar(argv[i][0])) {
|
||||
fprintf(stderr, "Error: Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i]);
|
||||
fprintf(stderr, "Error: Command line contains unexpected token '%s', see lbrycrdd -h for a list of options.\n", argv[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// -server defaults to true for bitcoind but not for the GUI so do this here
|
||||
// -server defaults to true for lbrycrdd but not for the GUI so do this here
|
||||
gArgs.SoftSetBoolArg("-server", true);
|
||||
// Set this early so that parameter interactions go to console
|
||||
InitLogging();
|
||||
@@ -141,7 +141,7 @@ static bool AppInit(int argc, char* argv[])
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
fprintf(stdout, "Bitcoin server starting\n");
|
||||
fprintf(stdout, "LBRYcrd server starting\n");
|
||||
|
||||
// Daemonize
|
||||
if (daemon(1, 0)) { // don't chdir (1), do close FDs (0)
|
||||
@@ -185,7 +185,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
SetupEnvironment();
|
||||
|
||||
// Connect bitcoind signal handlers
|
||||
// Connect lbrycrdd signal handlers
|
||||
noui_connect();
|
||||
|
||||
return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
@@ -52,12 +52,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t offset = 0;
|
||||
int32_t offset = 0;
|
||||
for (size_t j = 0; j < indexes.size(); j++) {
|
||||
if (uint64_t(indexes[j]) + uint64_t(offset) > std::numeric_limits<uint16_t>::max())
|
||||
if (int32_t(indexes[j]) + offset > std::numeric_limits<uint16_t>::max())
|
||||
throw std::ios_base::failure("indexes overflowed 16 bits");
|
||||
indexes[j] = indexes[j] + offset;
|
||||
offset = indexes[j] + 1;
|
||||
offset = int32_t(indexes[j]) + 1;
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < indexes.size(); i++) {
|
||||
@@ -186,6 +186,9 @@ public:
|
||||
|
||||
READWRITE(prefilledtxn);
|
||||
|
||||
if (BlockTxCount() > std::numeric_limits<uint16_t>::max())
|
||||
throw std::ios_base::failure("indexes overflowed 16 bits");
|
||||
|
||||
if (ser_action.ForRead())
|
||||
FillShortTxIDSelector();
|
||||
}
|
||||
|
||||
+15
-3
@@ -209,6 +209,7 @@ public:
|
||||
//! block header
|
||||
int32_t nVersion;
|
||||
uint256 hashMerkleRoot;
|
||||
uint256 hashClaimTrie;
|
||||
uint32_t nTime;
|
||||
uint32_t nBits;
|
||||
uint32_t nNonce;
|
||||
@@ -237,6 +238,7 @@ public:
|
||||
|
||||
nVersion = 0;
|
||||
hashMerkleRoot = uint256();
|
||||
hashClaimTrie = uint256();
|
||||
nTime = 0;
|
||||
nBits = 0;
|
||||
nNonce = 0;
|
||||
@@ -253,6 +255,7 @@ public:
|
||||
|
||||
nVersion = block.nVersion;
|
||||
hashMerkleRoot = block.hashMerkleRoot;
|
||||
hashClaimTrie = block.hashClaimTrie;
|
||||
nTime = block.nTime;
|
||||
nBits = block.nBits;
|
||||
nNonce = block.nNonce;
|
||||
@@ -283,6 +286,7 @@ public:
|
||||
if (pprev)
|
||||
block.hashPrevBlock = pprev->GetBlockHash();
|
||||
block.hashMerkleRoot = hashMerkleRoot;
|
||||
block.hashClaimTrie = hashClaimTrie;
|
||||
block.nTime = nTime;
|
||||
block.nBits = nBits;
|
||||
block.nNonce = nNonce;
|
||||
@@ -294,6 +298,11 @@ public:
|
||||
return *phashBlock;
|
||||
}
|
||||
|
||||
uint256 GetBlockPoWHash() const
|
||||
{
|
||||
return GetBlockHeader().GetPoWHash();
|
||||
}
|
||||
|
||||
int64_t GetBlockTime() const
|
||||
{
|
||||
return (int64_t)nTime;
|
||||
@@ -322,9 +331,10 @@ public:
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
|
||||
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, claimtrie=%s, hashBlock=%s)",
|
||||
pprev, nHeight,
|
||||
hashMerkleRoot.ToString(),
|
||||
hashClaimTrie.ToString(),
|
||||
GetBlockHash().ToString());
|
||||
}
|
||||
|
||||
@@ -402,6 +412,7 @@ public:
|
||||
READWRITE(this->nVersion);
|
||||
READWRITE(hashPrev);
|
||||
READWRITE(hashMerkleRoot);
|
||||
READWRITE(hashClaimTrie);
|
||||
READWRITE(nTime);
|
||||
READWRITE(nBits);
|
||||
READWRITE(nNonce);
|
||||
@@ -413,19 +424,20 @@ public:
|
||||
block.nVersion = nVersion;
|
||||
block.hashPrevBlock = hashPrev;
|
||||
block.hashMerkleRoot = hashMerkleRoot;
|
||||
block.hashClaimTrie = hashClaimTrie;
|
||||
block.nTime = nTime;
|
||||
block.nBits = nBits;
|
||||
block.nNonce = nNonce;
|
||||
return block.GetHash();
|
||||
}
|
||||
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
std::string str = "CDiskBlockIndex(";
|
||||
str += CBlockIndex::ToString();
|
||||
str += strprintf("\n hashBlock=%s, hashPrev=%s)",
|
||||
str += strprintf("\n hashBlock=%s, hashClaimTrie=%s, hashPrev=%s)",
|
||||
GetBlockHash().ToString(),
|
||||
hashClaimTrie.ToString(),
|
||||
hashPrev.ToString());
|
||||
return str;
|
||||
}
|
||||
|
||||
+183
-99
@@ -14,6 +14,38 @@
|
||||
|
||||
#include <chainparamsseeds.h>
|
||||
|
||||
//#define FIND_GENESIS
|
||||
|
||||
#define GENESIS_MERKLE_ROOT "b8211c82c3d15bcd78bba57005b86fed515149a53a425eb592c07af99fe559cc"
|
||||
|
||||
#define MAINNET_GENESIS_HASH "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463"
|
||||
#define MAINNET_GENESIS_NONCE 1287
|
||||
|
||||
#define TESTNET_GENESIS_HASH "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463"
|
||||
#define TESTNET_GENESIS_NONCE 1287
|
||||
|
||||
#define REGTEST_GENESIS_HASH "6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556"
|
||||
#define REGTEST_GENESIS_NONCE 1
|
||||
|
||||
bool CheckProofOfWork2(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
||||
{
|
||||
bool fNegative;
|
||||
bool fOverflow;
|
||||
arith_uint256 bnTarget;
|
||||
|
||||
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
|
||||
|
||||
// Check range
|
||||
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
|
||||
return error("CheckProofOfWork(): nBits below minimum work");
|
||||
|
||||
// Check proof of work matches claimed amount
|
||||
if (UintToArith256(hash) > bnTarget)
|
||||
return error("CheckProofOfWork(): hash doesn't match nBits");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
||||
{
|
||||
CMutableTransaction txNew;
|
||||
@@ -22,6 +54,9 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
|
||||
txNew.vout.resize(1);
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
txNew.vout[0].nValue = genesisReward;
|
||||
//txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
||||
//txNew.vout[0].scriptPubKey = CScript() << ParseHex("0425caecb9fbf6cf50979644e85c11e3ec9007fd477fab9683648c6539e59b59c3a4d9b9c0b552c37eee6476f3e0d8425ac0346fe69ad61628b8c340d42fbfa3fd") << OP_CHECKSIG;
|
||||
//txNew.vout[0].scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ParseHex("e5ff2d9e3a254622ae493573169c0fa94c82fe4f") << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
txNew.vout[0].scriptPubKey = genesisOutputScript;
|
||||
|
||||
CBlock genesis;
|
||||
@@ -32,6 +67,21 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
|
||||
genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
|
||||
genesis.hashPrevBlock.SetNull();
|
||||
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
|
||||
genesis.hashClaimTrie = uint256S("0x0000000000000000000000000000000000000000000000000000000000000001");
|
||||
|
||||
#ifdef FIND_GENESIS
|
||||
while (true)
|
||||
{
|
||||
genesis.nNonce += 1;
|
||||
if (CheckProofOfWork2(genesis.GetPoWHash(), nBits, consensus))
|
||||
{
|
||||
std::cout << "nonce: " << genesis.nNonce << std::endl;
|
||||
std::cout << "hex: " << genesis.GetHash().GetHex() << std::endl;
|
||||
std::cout << "pow hash: " << genesis.GetPoWHash().GetHex() << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return genesis;
|
||||
}
|
||||
|
||||
@@ -48,8 +98,8 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
|
||||
*/
|
||||
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
||||
{
|
||||
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
|
||||
const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
||||
const char* pszTimestamp = "insert timestamp string";//"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
|
||||
const CScript genesisOutputScript = CScript() << OP_DUP << OP_HASH160 << ParseHex("345991dbf57bfb014b87006acdfafbfc5fe8292f") << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
||||
}
|
||||
|
||||
@@ -73,20 +123,32 @@ void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64
|
||||
class CMainParams : public CChainParams {
|
||||
public:
|
||||
CMainParams() {
|
||||
strNetworkID = "main";
|
||||
consensus.nSubsidyHalvingInterval = 210000;
|
||||
strNetworkID = "lbrycrd";
|
||||
consensus.nSubsidyLevelInterval = 1<<5;
|
||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||
consensus.nMajorityRejectBlockOutdated = 950;
|
||||
consensus.nMajorityWindow = 1000;
|
||||
consensus.BIP16Exception = uint256S("0x00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22");
|
||||
consensus.BIP34Height = 227931;
|
||||
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
|
||||
consensus.BIP65Height = 388381; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
|
||||
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
|
||||
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
consensus.BIP34Height = 1;
|
||||
consensus.BIP34Hash = uint256S("0xdecb9e2cca03a419fd9cca0cb2b1d5ad11b088f22f8f38556d93ac4358b86c24");
|
||||
// FIXME: adjust heights
|
||||
consensus.BIP65Height = 200000;
|
||||
consensus.BIP66Height = 200000;
|
||||
consensus.powLimit = uint256S("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 150; //retarget every block
|
||||
consensus.nPowTargetSpacing = 150;
|
||||
consensus.nOriginalClaimExpirationTime = 262974;
|
||||
consensus.nExtendedClaimExpirationTime = 2102400;
|
||||
consensus.nExtendedClaimExpirationForkHeight = 400155;
|
||||
consensus.nAllowMinDiffMinHeight = -1;
|
||||
consensus.nAllowMinDiffMaxHeight = -1;
|
||||
consensus.nNormalizedNameForkHeight = 539940; // targeting 21 March 2019
|
||||
consensus.nMinTakeoverWorkaroundHeight = 496850;
|
||||
consensus.nMaxTakeoverWorkaroundHeight = 10000000;
|
||||
consensus.fPowAllowMinDifficultyBlocks = false;
|
||||
consensus.fPowNoRetargeting = false;
|
||||
consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
|
||||
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
|
||||
consensus.nRuleChangeActivationThreshold = 1916; // 95% of a half week
|
||||
consensus.nMinerConfirmationWindow = 2016;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
|
||||
@@ -98,82 +160,73 @@ public:
|
||||
|
||||
// Deployment of SegWit (BIP141, BIP143, and BIP147)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1479168000; // November 15th, 2016.
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1510704000; // November 15th, 2017.
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1547942400; // Jan 20, 2019
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1548288000; // Jan 24, 2019
|
||||
|
||||
// The best chain should have at least this much work.
|
||||
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000028822fef1c230963535a90d");
|
||||
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000607ca7e806c4c1e9"); //400000
|
||||
|
||||
// By default assume that the signatures in ancestors of this block are valid.
|
||||
consensus.defaultAssumeValid = uint256S("0x0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8"); //534292
|
||||
//consensus.defaultAssumeValid = uint256S("0xf0e56e70782af63ccb49c76e852540688755869ba59ec68cac9c04a6b4d9f5ca"); //400000
|
||||
consensus.defaultAssumeValid = uint256S("0xa6bbb48f5343eb9b0287c22f3ea8b29f36cf10794a37f8a925a894d6f4519913"); //4000
|
||||
|
||||
/**
|
||||
* The message start string is designed to be unlikely to occur in normal data.
|
||||
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
|
||||
* a large 32-bit integer with any alignment.
|
||||
*/
|
||||
pchMessageStart[0] = 0xf9;
|
||||
pchMessageStart[1] = 0xbe;
|
||||
pchMessageStart[2] = 0xb4;
|
||||
pchMessageStart[3] = 0xd9;
|
||||
nDefaultPort = 8333;
|
||||
pchMessageStart[0] = 0xfa;
|
||||
pchMessageStart[1] = 0xe4;
|
||||
pchMessageStart[2] = 0xaa;
|
||||
pchMessageStart[3] = 0xf1;
|
||||
nDefaultPort = 9246;
|
||||
nPruneAfterHeight = 100000;
|
||||
|
||||
genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
|
||||
genesis = CreateGenesisBlock(1446058291, MAINNET_GENESIS_NONCE, 0x1f00ffff, 1, 400000000 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
|
||||
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
||||
#ifdef FIND_GENESIS
|
||||
std::cout << "hex: " << consensus.hashGenesisBlock.GetHex() << std::endl;
|
||||
std::cout << "merkle root: " << genesis.hashMerkleRoot.GetHex() << std::endl;
|
||||
#else
|
||||
assert(consensus.hashGenesisBlock == uint256S(MAINNET_GENESIS_HASH));
|
||||
assert(genesis.hashMerkleRoot == uint256S(GENESIS_MERKLE_ROOT));
|
||||
#endif
|
||||
vSeeds.clear();
|
||||
vFixedSeeds.clear();
|
||||
|
||||
// Note that of those which support the service bits prefix, most only support a subset of
|
||||
// possible options.
|
||||
// This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
|
||||
// service bits we want, but we should get them updated to support all service bits wanted by any
|
||||
// release ASAP to avoid it where possible.
|
||||
vSeeds.emplace_back("seed.bitcoin.sipa.be"); // Pieter Wuille, only supports x1, x5, x9, and xd
|
||||
vSeeds.emplace_back("dnsseed.bluematt.me"); // Matt Corallo, only supports x9
|
||||
vSeeds.emplace_back("dnsseed.bitcoin.dashjr.org"); // Luke Dashjr
|
||||
vSeeds.emplace_back("seed.bitcoinstats.com"); // Christian Decker, supports x1 - xf
|
||||
vSeeds.emplace_back("seed.bitcoin.jonasschnelli.ch"); // Jonas Schnelli, only supports x1, x5, x9, and xd
|
||||
vSeeds.emplace_back("seed.btc.petertodd.org"); // Peter Todd, only supports x1, x5, x9, and xd
|
||||
vSeeds.emplace_back("seed.bitcoin.sprovoost.nl"); // Sjors Provoost
|
||||
vSeeds.emplace_back("dnsseed1.lbry.io"); // lbry.io
|
||||
vSeeds.emplace_back("dnsseed2.lbry.io"); // lbry.io
|
||||
vSeeds.emplace_back("dnsseed3.lbry.io"); // lbry.io
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 0x55);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 0x7a);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, 0x1c);
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
|
||||
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
|
||||
|
||||
bech32_hrp = "bc";
|
||||
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
|
||||
|
||||
bech32_hrp = "lbc";
|
||||
|
||||
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
|
||||
|
||||
fMiningRequiresPeers = true;
|
||||
fDefaultConsistencyChecks = false;
|
||||
fRequireStandard = true;
|
||||
fMineBlocksOnDemand = false;
|
||||
|
||||
checkpointData = {
|
||||
{
|
||||
{ 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")},
|
||||
{ 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")},
|
||||
{ 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")},
|
||||
{105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")},
|
||||
{134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")},
|
||||
{168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")},
|
||||
{193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")},
|
||||
{210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")},
|
||||
{216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")},
|
||||
{225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")},
|
||||
{250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")},
|
||||
{279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")},
|
||||
{295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")},
|
||||
{ 4000, uint256S("0xa6bbb48f5343eb9b0287c22f3ea8b29f36cf10794a37f8a925a894d6f4519913") },
|
||||
}
|
||||
};
|
||||
|
||||
chainTxData = ChainTxData{
|
||||
// Data from rpc: getchaintxstats 4096 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8
|
||||
/* nTime */ 1532884444,
|
||||
/* nTxCount */ 331282217,
|
||||
/* dTxRate */ 2.4
|
||||
1467272478, 4146, 600.0
|
||||
/* // Data from rpc: getchaintxstats 4096 0000000000000000002e63058c023a9a1de233554f28c7b21380b6c9003f36a8 */
|
||||
/* /\* nTime *\/ 1532884444, */
|
||||
/* /\* nTxCount *\/ 331282217, */
|
||||
/* /\* dTxRate *\/ 2.4 */
|
||||
};
|
||||
|
||||
/* disable fallback fee on mainnet */
|
||||
@@ -187,16 +240,28 @@ public:
|
||||
class CTestNetParams : public CChainParams {
|
||||
public:
|
||||
CTestNetParams() {
|
||||
strNetworkID = "test";
|
||||
consensus.nSubsidyHalvingInterval = 210000;
|
||||
strNetworkID = "lbrycrdtest";
|
||||
consensus.nSubsidyLevelInterval = 1 << 5;
|
||||
consensus.nMajorityEnforceBlockUpgrade = 51;
|
||||
consensus.nMajorityRejectBlockOutdated = 75;
|
||||
consensus.nMajorityWindow = 100;
|
||||
consensus.BIP16Exception = uint256S("0x00000000dd30457c001f4095d208cc1296b0eed002427aa599874af7a432b105");
|
||||
consensus.BIP34Height = 21111;
|
||||
consensus.BIP34Hash = uint256S("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8");
|
||||
consensus.BIP65Height = 581885; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6
|
||||
consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
|
||||
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
// FIXME: adjust heights
|
||||
consensus.BIP65Height = 1200000;
|
||||
consensus.BIP66Height = 1200000;
|
||||
consensus.powLimit = uint256S("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 150;
|
||||
consensus.nPowTargetSpacing = 150;
|
||||
consensus.nOriginalClaimExpirationTime = 262974;
|
||||
consensus.nExtendedClaimExpirationTime = 2102400;
|
||||
consensus.nExtendedClaimExpirationForkHeight = 278160;
|
||||
consensus.nAllowMinDiffMinHeight = 277299;
|
||||
consensus.nAllowMinDiffMaxHeight = 1100000;
|
||||
consensus.nNormalizedNameForkHeight = 993380; // targeting, 21 Feb 2019
|
||||
consensus.nMinTakeoverWorkaroundHeight = 99;
|
||||
consensus.nMaxTakeoverWorkaroundHeight = 10000000;
|
||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||
consensus.fPowNoRetargeting = false;
|
||||
consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
|
||||
@@ -216,30 +281,32 @@ public:
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1493596800; // May 1st 2017
|
||||
|
||||
// The best chain should have at least this much work.
|
||||
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000007dbe94253893cbd463");
|
||||
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000a0c3931735170");
|
||||
|
||||
// By default assume that the signatures in ancestors of this block are valid.
|
||||
consensus.defaultAssumeValid = uint256S("0x0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75"); //1354312
|
||||
consensus.defaultAssumeValid = uint256S("9812b0bcb7e889e58d999c897e9eaddb2dab98122ff1cfb238ebeef5351bd48c"); // 1
|
||||
|
||||
pchMessageStart[0] = 0x0b;
|
||||
pchMessageStart[1] = 0x11;
|
||||
pchMessageStart[2] = 0x09;
|
||||
pchMessageStart[3] = 0x07;
|
||||
nDefaultPort = 18333;
|
||||
pchMessageStart[0] = 0xfa;
|
||||
pchMessageStart[1] = 0xe4;
|
||||
pchMessageStart[2] = 0xaa;
|
||||
pchMessageStart[3] = 0xe1;
|
||||
nDefaultPort = 19246;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN);
|
||||
genesis = CreateGenesisBlock(1446058291, TESTNET_GENESIS_NONCE, 0x1f00ffff, 1, 400000000 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
assert(consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
||||
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
||||
#ifdef FIND_GENESIS
|
||||
std::cout << "testnet genesis hash: " << genesis.GetHash().GetHex() << std::endl;
|
||||
std::cout << "testnet merkle hash: " << genesis.hashMerkleRoot.GetHex() << std::endl;
|
||||
#else
|
||||
assert(consensus.hashGenesisBlock == uint256S(TESTNET_GENESIS_HASH));
|
||||
assert(genesis.hashMerkleRoot == uint256S(GENESIS_MERKLE_ROOT));
|
||||
#endif
|
||||
|
||||
vFixedSeeds.clear();
|
||||
vSeeds.clear();
|
||||
// nodes with support for servicebits filtering should be at the top
|
||||
vSeeds.emplace_back("testnet-seed.bitcoin.jonasschnelli.ch");
|
||||
vSeeds.emplace_back("seed.tbtc.petertodd.org");
|
||||
vSeeds.emplace_back("seed.testnet.bitcoin.sprovoost.nl");
|
||||
vSeeds.emplace_back("testnet-seed.bluematt.me"); // Just a static list of stable node(s), only supports x9
|
||||
vSeeds.emplace_back("testdnsseed1.lbry.io");
|
||||
vSeeds.emplace_back("testdnsseed2.lbry.io");
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
|
||||
@@ -247,18 +314,19 @@ public:
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
|
||||
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
|
||||
|
||||
bech32_hrp = "tb";
|
||||
bech32_hrp = "tlbc";
|
||||
|
||||
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
|
||||
|
||||
fMiningRequiresPeers = true;
|
||||
fDefaultConsistencyChecks = false;
|
||||
fRequireStandard = false;
|
||||
fMineBlocksOnDemand = false;
|
||||
|
||||
fTestnetToBeDeprecatedFieldRPC = true;
|
||||
|
||||
checkpointData = {
|
||||
{
|
||||
{546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")},
|
||||
{0, uint256S(TESTNET_GENESIS_HASH)},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -280,18 +348,27 @@ public:
|
||||
class CRegTestParams : public CChainParams {
|
||||
public:
|
||||
CRegTestParams() {
|
||||
strNetworkID = "regtest";
|
||||
consensus.nSubsidyHalvingInterval = 150;
|
||||
strNetworkID = "lbrycrdreg";
|
||||
consensus.nSubsidyLevelInterval = 1 << 5;
|
||||
consensus.BIP16Exception = uint256();
|
||||
consensus.BIP34Height = 100000000; // BIP34 has not activated on regtest (far in the future so block v1 are not rejected in tests)
|
||||
consensus.BIP34Height = 1000; // BIP34 is needed for validation_block_tests
|
||||
consensus.BIP34Hash = uint256();
|
||||
// FIXME: update heights and add activation tests
|
||||
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
|
||||
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
|
||||
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 10 * 60;
|
||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||
consensus.fPowNoRetargeting = true;
|
||||
consensus.nPowTargetTimespan = 1;//14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacing = 1;
|
||||
consensus.nOriginalClaimExpirationTime = 500;
|
||||
consensus.nExtendedClaimExpirationTime = 600;
|
||||
consensus.nExtendedClaimExpirationForkHeight = 8000;
|
||||
consensus.nAllowMinDiffMinHeight = -1;
|
||||
consensus.nAllowMinDiffMaxHeight = -1;
|
||||
consensus.nNormalizedNameForkHeight = 250; // SDK depends upon this number
|
||||
consensus.nMinTakeoverWorkaroundHeight = -1;
|
||||
consensus.nMaxTakeoverWorkaroundHeight = -1;
|
||||
consensus.fPowAllowMinDifficultyBlocks = false;
|
||||
consensus.fPowNoRetargeting = false;
|
||||
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
|
||||
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
|
||||
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
|
||||
@@ -311,27 +388,34 @@ public:
|
||||
consensus.defaultAssumeValid = uint256S("0x00");
|
||||
|
||||
pchMessageStart[0] = 0xfa;
|
||||
pchMessageStart[1] = 0xbf;
|
||||
pchMessageStart[2] = 0xb5;
|
||||
pchMessageStart[3] = 0xda;
|
||||
nDefaultPort = 18444;
|
||||
pchMessageStart[1] = 0xe4;
|
||||
pchMessageStart[2] = 0xaa;
|
||||
pchMessageStart[3] = 0xd1;
|
||||
nDefaultPort = 29246;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
|
||||
genesis = CreateGenesisBlock(1446058291, REGTEST_GENESIS_NONCE, 0x207fffff, 1, 400000000 * COIN);
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
assert(consensus.hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
|
||||
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
||||
#ifdef FIND_GENESIS
|
||||
std::cout << "regtest genensis hash: " << genesis.GetHash().GetHex() << std::endl;
|
||||
std::cout << "regtest hashmerkleroot: " << genesis.hashMerkleRoot.GetHex() << std::endl;
|
||||
#else
|
||||
assert(consensus.hashGenesisBlock == uint256S(REGTEST_GENESIS_HASH));
|
||||
assert(genesis.hashMerkleRoot == uint256S(GENESIS_MERKLE_ROOT));
|
||||
#endif
|
||||
|
||||
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
|
||||
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
|
||||
|
||||
fMiningRequiresPeers = false;
|
||||
fDefaultConsistencyChecks = true;
|
||||
fRequireStandard = false;
|
||||
fMineBlocksOnDemand = true;
|
||||
fTestnetToBeDeprecatedFieldRPC = false;
|
||||
|
||||
checkpointData = {
|
||||
{
|
||||
{0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")},
|
||||
{0, uint256S(REGTEST_GENESIS_HASH)},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -347,7 +431,7 @@ public:
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
|
||||
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
|
||||
|
||||
bech32_hrp = "bcrt";
|
||||
bech32_hrp = "rlbc";
|
||||
|
||||
/* enable fallback fee on regtest */
|
||||
m_fallback_fee_enabled = true;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef BITCOIN_CHAINPARAMS_H
|
||||
#define BITCOIN_CHAINPARAMS_H
|
||||
|
||||
#include <arith_uint256.h>
|
||||
#include <chainparamsbase.h>
|
||||
#include <consensus/params.h>
|
||||
#include <primitives/block.h>
|
||||
@@ -94,9 +95,11 @@ protected:
|
||||
std::string strNetworkID;
|
||||
CBlock genesis;
|
||||
std::vector<SeedSpec6> vFixedSeeds;
|
||||
bool fMiningRequiresPeers;
|
||||
bool fDefaultConsistencyChecks;
|
||||
bool fRequireStandard;
|
||||
bool fMineBlocksOnDemand;
|
||||
bool fTestnetToBeDeprecatedFieldRPC;
|
||||
CCheckpointData checkpointData;
|
||||
ChainTxData chainTxData;
|
||||
bool m_fallback_fee_enabled;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
const std::string CBaseChainParams::MAIN = "main";
|
||||
const std::string CBaseChainParams::TESTNET = "test";
|
||||
const std::string CBaseChainParams::MAIN = "lbrycrd";
|
||||
const std::string CBaseChainParams::TESTNET = "lbrycrdtest";
|
||||
const std::string CBaseChainParams::REGTEST = "regtest";
|
||||
|
||||
void SetupChainParamsBaseOptions()
|
||||
@@ -33,11 +33,11 @@ const CBaseChainParams& BaseParams()
|
||||
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
|
||||
{
|
||||
if (chain == CBaseChainParams::MAIN)
|
||||
return MakeUnique<CBaseChainParams>("", 8332);
|
||||
return MakeUnique<CBaseChainParams>("", 9245);
|
||||
else if (chain == CBaseChainParams::TESTNET)
|
||||
return MakeUnique<CBaseChainParams>("testnet3", 18332);
|
||||
return MakeUnique<CBaseChainParams>("testnet3", 19245);
|
||||
else if (chain == CBaseChainParams::REGTEST)
|
||||
return MakeUnique<CBaseChainParams>("regtest", 18443);
|
||||
return MakeUnique<CBaseChainParams>("regtest", 29245);
|
||||
else
|
||||
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain
|
||||
*/
|
||||
void SetupChainParamsBaseOptions();
|
||||
|
||||
/**
|
||||
* Append the help messages for the chainparams options to the
|
||||
* parameter string.
|
||||
*/
|
||||
void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp=true);
|
||||
|
||||
/**
|
||||
* Return the currently selected parameters. This won't change after app
|
||||
* startup, except for unit tests.
|
||||
@@ -53,4 +59,16 @@ const CBaseChainParams& BaseParams();
|
||||
/** Sets the params returned by Params() to those for the given network. */
|
||||
void SelectBaseParams(const std::string& chain);
|
||||
|
||||
/**
|
||||
* Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
|
||||
* @return CBaseChainParams::MAX_NETWORK_TYPES if an invalid combination is given. CBaseChainParams::MAIN by default.
|
||||
*/
|
||||
std::string ChainNameFromCommandLine();
|
||||
|
||||
/**
|
||||
* Return true if SelectBaseParamsFromCommandLine() has been called to select
|
||||
* a network.
|
||||
*/
|
||||
bool AreBaseParamsConfigured();
|
||||
|
||||
#endif // BITCOIN_CHAINPARAMSBASE_H
|
||||
+3
-1275
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,211 @@
|
||||
// Copyright (c) 2018 The LBRY developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "claimscriptop.h"
|
||||
#include "nameclaim.h"
|
||||
|
||||
CClaimScriptAddOp::CClaimScriptAddOp(const COutPoint& point, CAmount nValue, int nHeight)
|
||||
: point(point), nValue(nValue), nHeight(nHeight)
|
||||
{
|
||||
}
|
||||
|
||||
bool CClaimScriptAddOp::claimName(CClaimTrieCache& trieCache, const std::string& name)
|
||||
{
|
||||
return addClaim(trieCache, name, ClaimIdHash(point.hash, point.n));
|
||||
}
|
||||
|
||||
bool CClaimScriptAddOp::updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
return addClaim(trieCache, name, claimId);
|
||||
}
|
||||
|
||||
bool CClaimScriptAddOp::addClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
return trieCache.addClaim(name, point, claimId, nValue, nHeight);
|
||||
}
|
||||
|
||||
bool CClaimScriptAddOp::supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
return trieCache.addSupport(name, point, nValue, claimId, nHeight);
|
||||
}
|
||||
|
||||
CClaimScriptUndoAddOp::CClaimScriptUndoAddOp(const COutPoint& point, int nHeight) : point(point), nHeight(nHeight)
|
||||
{
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoAddOp::claimName(CClaimTrieCache& trieCache, const std::string& name)
|
||||
{
|
||||
auto claimId = ClaimIdHash(point.hash, point.n);
|
||||
LogPrintf("--- [%lu]: OP_CLAIM_NAME \"%s\" with claimId %s and tx prevout %s at index %d\n", nHeight, name, claimId.GetHex(), point.hash.ToString(), point.n);
|
||||
return undoAddClaim(trieCache, name, claimId);
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoAddOp::updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("--- [%lu]: OP_UPDATE_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n", nHeight, name, claimId.GetHex(), point.hash.ToString(), point.n);
|
||||
return undoAddClaim(trieCache, name, claimId);
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoAddOp::undoAddClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("%s: (txid: %s, nOut: %d) Removing %s, claimId: %s, from the claim trie due to block disconnect\n", __func__, point.hash.ToString(), point.n, name, claimId.ToString());
|
||||
bool res = trieCache.undoAddClaim(name, point, nHeight);
|
||||
if (!res)
|
||||
LogPrintf("%s: Removing fails\n", __func__);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoAddOp::supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("--- [%lu]: OP_SUPPORT_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n", nHeight, name, claimId.GetHex(), point.hash.ToString(), point.n);
|
||||
LogPrintf("%s: (txid: %s, nOut: %d) Removing support for %s, claimId: %s, from the claim trie due to block disconnect\n", __func__, point.hash.ToString(), point.n, name, claimId.ToString());
|
||||
bool res = trieCache.undoAddSupport(name, point, nHeight);
|
||||
if (!res)
|
||||
LogPrintf("%s: Removing support fails\n", __func__);
|
||||
return res;
|
||||
}
|
||||
|
||||
CClaimScriptSpendOp::CClaimScriptSpendOp(const COutPoint& point, int nHeight, int& nValidHeight)
|
||||
: point(point), nHeight(nHeight), nValidHeight(nValidHeight)
|
||||
{
|
||||
}
|
||||
|
||||
bool CClaimScriptSpendOp::claimName(CClaimTrieCache& trieCache, const std::string& name)
|
||||
{
|
||||
auto claimId = ClaimIdHash(point.hash, point.n);
|
||||
LogPrintf("+++ [%lu]: OP_CLAIM_NAME \"%s\" with claimId %s and tx prevout %s at index %d\n", nHeight, name, claimId.GetHex(), point.hash.ToString(), point.n);
|
||||
return spendClaim(trieCache, name, claimId);
|
||||
}
|
||||
|
||||
bool CClaimScriptSpendOp::updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("+++ [%lu]: OP_UPDATE_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n", nHeight, name, claimId.GetHex(), point.hash.ToString(), point.n);
|
||||
return spendClaim(trieCache, name, claimId);
|
||||
}
|
||||
|
||||
bool CClaimScriptSpendOp::spendClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("%s: (txid: %s, nOut: %d) Removing %s, claimId: %s, from the claim trie\n", __func__, point.hash.ToString(), point.n, name, claimId.ToString());
|
||||
bool res = trieCache.spendClaim(name, point, nHeight, nValidHeight);
|
||||
if (!res)
|
||||
LogPrintf("%s: Removing fails\n", __func__);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CClaimScriptSpendOp::supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("+++ [%lu]: OP_SUPPORT_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n", nHeight, name, claimId.GetHex(), point.hash.ToString(), point.n);
|
||||
LogPrintf("%s: (txid: %s, nOut: %d) Restoring support for %s, claimId: %s, to the claim trie\n", __func__, point.hash.ToString(), point.n, name, claimId.ToString());
|
||||
bool res = trieCache.spendSupport(name, point, nHeight, nValidHeight);
|
||||
if (!res)
|
||||
LogPrintf("%s: Removing support fails\n", __func__);
|
||||
return res;
|
||||
}
|
||||
|
||||
CClaimScriptUndoSpendOp::CClaimScriptUndoSpendOp(const COutPoint& point, CAmount nValue, int nHeight, int nValidHeight)
|
||||
: point(point), nValue(nValue), nHeight(nHeight), nValidHeight(nValidHeight)
|
||||
{
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoSpendOp::claimName(CClaimTrieCache& trieCache, const std::string& name)
|
||||
{
|
||||
return undoSpendClaim(trieCache, name, ClaimIdHash(point.hash, point.n));
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoSpendOp::updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
return undoSpendClaim(trieCache, name, claimId);
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoSpendOp::undoSpendClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("%s: (txid: %s, nOut: %d) Restoring %s, claimId: %s, to the claim trie due to block disconnect\n", __func__, point.hash.ToString(), point.n, name, claimId.ToString());
|
||||
return trieCache.undoSpendClaim(name, point, claimId, nValue, nHeight, nValidHeight);
|
||||
}
|
||||
|
||||
bool CClaimScriptUndoSpendOp::supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId)
|
||||
{
|
||||
LogPrintf("%s: (txid: %s, nOut: %d) Restoring support for %s, claimId: %s, to the claim trie due to block disconnect\n", __func__, point.hash.ToString(), point.n, name, claimId.ToString());
|
||||
return trieCache.undoSpendSupport(name, point, claimId, nValue, nHeight, nValidHeight);
|
||||
}
|
||||
|
||||
static std::string vchToString(const std::vector<unsigned char>& name)
|
||||
{
|
||||
return std::string(name.begin(), name.end());
|
||||
}
|
||||
|
||||
bool ProcessClaim(CClaimScriptOp& claimOp, CClaimTrieCache& trieCache, const CScript& scriptPubKey)
|
||||
{
|
||||
int op;
|
||||
std::vector<std::vector<unsigned char> > vvchParams;
|
||||
if (!DecodeClaimScript(scriptPubKey, op, vvchParams))
|
||||
return false;
|
||||
|
||||
switch (op) {
|
||||
case OP_CLAIM_NAME:
|
||||
return claimOp.claimName(trieCache, vchToString(vvchParams[0]));
|
||||
case OP_SUPPORT_CLAIM:
|
||||
return claimOp.supportClaim(trieCache, vchToString(vvchParams[0]), uint160(vvchParams[1]));
|
||||
case OP_UPDATE_CLAIM:
|
||||
return claimOp.updateClaim(trieCache, vchToString(vvchParams[0]), uint160(vvchParams[1]));
|
||||
}
|
||||
throw std::runtime_error("Unimplemented OP handler.");
|
||||
}
|
||||
|
||||
bool SpendClaim(CClaimTrieCache& trieCache, const CScript& scriptPubKey, const COutPoint& point, int nHeight, int& nValidHeight, spentClaimsType& spentClaims)
|
||||
{
|
||||
class CSpendClaimHistory : public CClaimScriptSpendOp
|
||||
{
|
||||
public:
|
||||
CSpendClaimHistory(spentClaimsType& spentClaims, const COutPoint& point, int nHeight, int& nValidHeight)
|
||||
: CClaimScriptSpendOp(point, nHeight, nValidHeight), spentClaims(spentClaims)
|
||||
{
|
||||
}
|
||||
|
||||
bool spendClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override
|
||||
{
|
||||
if (CClaimScriptSpendOp::spendClaim(trieCache, name, claimId)) {
|
||||
spentClaims.emplace_back(name, claimId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
spentClaimsType& spentClaims;
|
||||
};
|
||||
|
||||
CSpendClaimHistory spendClaim(spentClaims, point, nHeight, nValidHeight);
|
||||
return ProcessClaim(spendClaim, trieCache, scriptPubKey);
|
||||
}
|
||||
|
||||
bool AddSpendClaim(CClaimTrieCache& trieCache, const CScript& scriptPubKey, const COutPoint& point, CAmount nValue, int nHeight, spentClaimsType& spentClaims)
|
||||
{
|
||||
class CAddSpendClaim : public CClaimScriptAddOp
|
||||
{
|
||||
public:
|
||||
CAddSpendClaim(spentClaimsType& spentClaims, const COutPoint& point, CAmount nValue, int nHeight)
|
||||
: CClaimScriptAddOp(point, nValue, nHeight), spentClaims(spentClaims)
|
||||
{
|
||||
}
|
||||
|
||||
bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override
|
||||
{
|
||||
spentClaimsType::iterator itSpent = spentClaims.begin();
|
||||
for (; itSpent != spentClaims.end(); ++itSpent) {
|
||||
if (itSpent->second == claimId && trieCache.normalizeClaimName(name) == trieCache.normalizeClaimName(itSpent->first)) {
|
||||
spentClaims.erase(itSpent);
|
||||
return CClaimScriptAddOp::updateClaim(trieCache, name, claimId);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
spentClaimsType& spentClaims;
|
||||
};
|
||||
|
||||
CAddSpendClaim addClaim(spentClaims, point, nValue, nHeight);
|
||||
return ProcessClaim(addClaim, trieCache, scriptPubKey);
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
// Copyright (c) 2018 The LBRY developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef CLAIMSCRIPTOP_H
|
||||
#define CLAIMSCRIPTOP_H
|
||||
|
||||
#include "amount.h"
|
||||
#include "claimtrie.h"
|
||||
#include "hash.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "script/script.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* Claim script operation base class
|
||||
*/
|
||||
class CClaimScriptOp
|
||||
{
|
||||
public:
|
||||
virtual ~CClaimScriptOp() {}
|
||||
/**
|
||||
* Pure virtual, OP_CLAIM_NAME handler
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
*/
|
||||
virtual bool claimName(CClaimTrieCache& trieCache, const std::string& name) = 0;
|
||||
/**
|
||||
* Pure virtual, OP_UPDATE_CLAIM handler
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
* @param[in] claimId id of the claim
|
||||
*/
|
||||
virtual bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) = 0;
|
||||
/**
|
||||
* Pure virtual, OP_SUPPORT_CLAIM handler
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
* @param[in] claimId id of the claim
|
||||
*/
|
||||
virtual bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class to add claim in trie
|
||||
*/
|
||||
class CClaimScriptAddOp : public CClaimScriptOp
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param[in] point pair of transaction hash and its index
|
||||
* @param[in] nValue value of the claim
|
||||
* @param[in] nHeight entry height of the claim
|
||||
*/
|
||||
CClaimScriptAddOp(const COutPoint& point, CAmount nValue, int nHeight);
|
||||
/**
|
||||
* Implamention of OP_CLAIM_NAME handler
|
||||
* @see CClaimScriptOp::claimName
|
||||
*/
|
||||
bool claimName(CClaimTrieCache& trieCache, const std::string& name) override;
|
||||
/**
|
||||
* Implamention of OP_UPDATE_CLAIM handler
|
||||
* @see CClaimScriptOp::updateClaim
|
||||
*/
|
||||
bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
/**
|
||||
* Implamention of OP_SUPPORT_CLAIM handler
|
||||
* @see CClaimScriptOp::supportClaim
|
||||
*/
|
||||
bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Reimplement to handle OP_CLAIM_NAME and OP_UPDATE_CLAIM at once
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
* @param[in] claimId id of the claim
|
||||
*/
|
||||
virtual bool addClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId);
|
||||
const COutPoint point;
|
||||
const CAmount nValue;
|
||||
const int nHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class to undo added claim in trie
|
||||
*/
|
||||
class CClaimScriptUndoAddOp : public CClaimScriptOp
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param[in] point pair of transaction hash and its index
|
||||
* @param[in] nHeight entry height of the claim
|
||||
*/
|
||||
CClaimScriptUndoAddOp(const COutPoint& point, int nHeight);
|
||||
/**
|
||||
* Implamention of OP_CLAIM_NAME handler
|
||||
* @see CClaimScriptOp::claimName
|
||||
*/
|
||||
bool claimName(CClaimTrieCache& trieCache, const std::string& name) override;
|
||||
/**
|
||||
* Implamention of OP_UPDATE_CLAIM handler
|
||||
* @see CClaimScriptOp::updateClaim
|
||||
*/
|
||||
bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
/**
|
||||
* Implamention of OP_SUPPORT_CLAIM handler
|
||||
* @see CClaimScriptOp::supportClaim
|
||||
*/
|
||||
bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Reimplement to handle OP_CLAIM_NAME and OP_UPDATE_CLAIM at once
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
* @param[in] claimId id of the claim
|
||||
*/
|
||||
virtual bool undoAddClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId);
|
||||
const COutPoint point;
|
||||
const int nHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class to spend claim from trie
|
||||
*/
|
||||
class CClaimScriptSpendOp : public CClaimScriptOp
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param[in] point pair of transaction hash and its index
|
||||
* @param[in] nHeight entry height of the claim
|
||||
* @param[out] nValidHeight valid height of the claim
|
||||
*/
|
||||
CClaimScriptSpendOp(const COutPoint& point, int nHeight, int& nValidHeight);
|
||||
/**
|
||||
* Implamention of OP_CLAIM_NAME handler
|
||||
* @see CClaimScriptOp::claimName
|
||||
*/
|
||||
bool claimName(CClaimTrieCache& trieCache, const std::string& name) override;
|
||||
/**
|
||||
* Implamention of OP_UPDATE_CLAIM handler
|
||||
* @see CClaimScriptOp::updateClaim
|
||||
*/
|
||||
bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
/**
|
||||
* Implamention of OP_SUPPORT_CLAIM handler
|
||||
* @see CClaimScriptOp::supportClaim
|
||||
*/
|
||||
bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Reimplement to handle OP_CLAIM_NAME and OP_UPDATE_CLAIM at once
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
* @param[in] claimId id of the claim
|
||||
*/
|
||||
virtual bool spendClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId);
|
||||
const COutPoint point;
|
||||
const int nHeight;
|
||||
int& nValidHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class to undo spent claim from trie
|
||||
*/
|
||||
class CClaimScriptUndoSpendOp : public CClaimScriptOp
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param[in] point pair of transaction hash and its index
|
||||
* @param[in] nValue value of the claim
|
||||
* @param[in] nHeight entry height of the claim
|
||||
* @param[in] nValidHeight valid height of the claim
|
||||
*/
|
||||
CClaimScriptUndoSpendOp(const COutPoint& point, CAmount nValue, int nHeight, int nValidHeight);
|
||||
/**
|
||||
* Implamention of OP_CLAIM_NAME handler
|
||||
* @see CClaimScriptOp::claimName
|
||||
*/
|
||||
bool claimName(CClaimTrieCache& trieCache, const std::string& name) override;
|
||||
/**
|
||||
* Implamention of OP_UPDATE_CLAIM handler
|
||||
* @see CClaimScriptOp::updateClaim
|
||||
*/
|
||||
bool updateClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
/**
|
||||
* Implamention of OP_SUPPORT_CLAIM handler
|
||||
* @see CClaimScriptOp::supportClaim
|
||||
*/
|
||||
bool supportClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Reimplement to handle OP_CLAIM_NAME and OP_UPDATE_CLAIM at once
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] name name of the claim
|
||||
* @param[in] claimId id of the claim
|
||||
*/
|
||||
virtual bool undoSpendClaim(CClaimTrieCache& trieCache, const std::string& name, const uint160& claimId);
|
||||
const COutPoint point;
|
||||
const CAmount nValue;
|
||||
const int nHeight;
|
||||
const int nValidHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to process operation on claim
|
||||
* @param[in] claimOp operation to be performed
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] scriptPubKey claim script to be decoded
|
||||
*/
|
||||
bool ProcessClaim(CClaimScriptOp& claimOp, CClaimTrieCache& trieCache, const CScript& scriptPubKey);
|
||||
|
||||
typedef std::pair<std::string, uint160> spentClaimType;
|
||||
|
||||
typedef std::vector<spentClaimType> spentClaimsType;
|
||||
|
||||
/**
|
||||
* Function to spend claim from tie, keeping the successful list on
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] scriptPubKey claim script to be decoded
|
||||
* @param[in] point pair of transaction hash and its index
|
||||
* @param[in] nHeight entry height of the claim
|
||||
* @param[out] nValidHeight valid height of the claim
|
||||
* @param[out] spentClaims inserts successfully spent claim
|
||||
*/
|
||||
bool SpendClaim(CClaimTrieCache& trieCache, const CScript& scriptPubKey, const COutPoint& point, int nHeight, int& nValidHeight, spentClaimsType& spentClaims);
|
||||
|
||||
/**
|
||||
* Function to add / update (that present in spent list) claim in trie
|
||||
* @param[in] trieCache trie to operate on
|
||||
* @param[in] scriptPubKey claim script to be decoded
|
||||
* @param[in] point pair of transaction hash and its index
|
||||
* @param[in] nValue ` value of the claim
|
||||
* @param[in] nHeight entry height of the claim
|
||||
* @param[out] spentClaims erases successfully added claim
|
||||
*/
|
||||
bool AddSpendClaim(CClaimTrieCache& trieCache, const CScript& scriptPubKey, const COutPoint& point, CAmount nValue, int nHeight, spentClaimsType& spentClaims);
|
||||
|
||||
#endif // CLAIMSCRIPTOP_H
|
||||
+1420
File diff suppressed because it is too large.
Load diff
+612
@@ -0,0 +1,612 @@
|
||||
#ifndef BITCOIN_CLAIMTRIE_H
|
||||
#define BITCOIN_CLAIMTRIE_H
|
||||
|
||||
#include <amount.h>
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <prefixtrie.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <serialize.h>
|
||||
#include <uint256.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
// leveldb keys
|
||||
#define TRIE_NODE 'n'
|
||||
#define CLAIM_BY_ID 'i'
|
||||
#define CLAIM_QUEUE_ROW 'r'
|
||||
#define CLAIM_QUEUE_NAME_ROW 'm'
|
||||
#define EXP_QUEUE_ROW 'e'
|
||||
#define SUPPORT 's'
|
||||
#define SUPPORT_QUEUE_ROW 'u'
|
||||
#define SUPPORT_QUEUE_NAME_ROW 'p'
|
||||
#define SUPPORT_EXP_QUEUE_ROW 'x'
|
||||
|
||||
uint256 getValueHash(const COutPoint& outPoint, int nHeightOfLastTakeover);
|
||||
|
||||
struct CClaimValue
|
||||
{
|
||||
COutPoint outPoint;
|
||||
uint160 claimId;
|
||||
CAmount nAmount;
|
||||
CAmount nEffectiveAmount;
|
||||
int nHeight;
|
||||
int nValidAtHeight;
|
||||
|
||||
CClaimValue()
|
||||
{
|
||||
}
|
||||
|
||||
CClaimValue(const COutPoint& outPoint, const uint160& claimId, CAmount nAmount, int nHeight, int nValidAtHeight)
|
||||
: outPoint(outPoint), claimId(claimId), nAmount(nAmount), nEffectiveAmount(nAmount), nHeight(nHeight), nValidAtHeight(nValidAtHeight)
|
||||
{
|
||||
}
|
||||
|
||||
CClaimValue(CClaimValue&&) = default;
|
||||
CClaimValue(const CClaimValue&) = default;
|
||||
CClaimValue& operator=(CClaimValue&&) = default;
|
||||
CClaimValue& operator=(const CClaimValue&) = default;
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(outPoint);
|
||||
READWRITE(claimId);
|
||||
READWRITE(nAmount);
|
||||
READWRITE(nHeight);
|
||||
READWRITE(nValidAtHeight);
|
||||
}
|
||||
|
||||
bool operator<(const CClaimValue& other) const
|
||||
{
|
||||
if (nEffectiveAmount < other.nEffectiveAmount)
|
||||
return true;
|
||||
if (nEffectiveAmount != other.nEffectiveAmount)
|
||||
return false;
|
||||
if (nHeight > other.nHeight)
|
||||
return true;
|
||||
if (nHeight != other.nHeight)
|
||||
return false;
|
||||
return outPoint != other.outPoint && !(outPoint < other.outPoint);
|
||||
}
|
||||
|
||||
bool operator==(const CClaimValue& other) const
|
||||
{
|
||||
return outPoint == other.outPoint && claimId == other.claimId && nAmount == other.nAmount && nHeight == other.nHeight && nValidAtHeight == other.nValidAtHeight;
|
||||
}
|
||||
|
||||
bool operator!=(const CClaimValue& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
struct CSupportValue
|
||||
{
|
||||
COutPoint outPoint;
|
||||
uint160 supportedClaimId;
|
||||
CAmount nAmount;
|
||||
int nHeight;
|
||||
int nValidAtHeight;
|
||||
|
||||
CSupportValue()
|
||||
{
|
||||
}
|
||||
|
||||
CSupportValue(const COutPoint& outPoint, const uint160& supportedClaimId, CAmount nAmount, int nHeight, int nValidAtHeight)
|
||||
: outPoint(outPoint), supportedClaimId(supportedClaimId), nAmount(nAmount), nHeight(nHeight), nValidAtHeight(nValidAtHeight)
|
||||
{
|
||||
}
|
||||
|
||||
CSupportValue(CSupportValue&&) = default;
|
||||
CSupportValue(const CSupportValue&) = default;
|
||||
CSupportValue& operator=(CSupportValue&&) = default;
|
||||
CSupportValue& operator=(const CSupportValue&) = default;
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(outPoint);
|
||||
READWRITE(supportedClaimId);
|
||||
READWRITE(nAmount);
|
||||
READWRITE(nHeight);
|
||||
READWRITE(nValidAtHeight);
|
||||
}
|
||||
|
||||
bool operator==(const CSupportValue& other) const
|
||||
{
|
||||
return outPoint == other.outPoint && supportedClaimId == other.supportedClaimId && nAmount == other.nAmount && nHeight == other.nHeight && nValidAtHeight == other.nValidAtHeight;
|
||||
}
|
||||
|
||||
bool operator!=(const CSupportValue& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<CClaimValue> claimEntryType;
|
||||
typedef std::vector<CSupportValue> supportEntryType;
|
||||
|
||||
struct CClaimTrieData
|
||||
{
|
||||
uint256 hash;
|
||||
claimEntryType claims;
|
||||
int nHeightOfLastTakeover = 0;
|
||||
|
||||
CClaimTrieData() = default;
|
||||
CClaimTrieData(CClaimTrieData&&) = default;
|
||||
CClaimTrieData(const CClaimTrieData&) = default;
|
||||
CClaimTrieData& operator=(CClaimTrieData&&) = default;
|
||||
CClaimTrieData& operator=(const CClaimTrieData& d) = default;
|
||||
|
||||
bool insertClaim(const CClaimValue& claim);
|
||||
bool removeClaim(const COutPoint& outPoint, CClaimValue& claim);
|
||||
bool getBestClaim(CClaimValue& claim) const;
|
||||
bool haveClaim(const COutPoint& outPoint) const;
|
||||
void reorderClaims(const supportEntryType& support);
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(hash);
|
||||
|
||||
if (ser_action.ForRead()) {
|
||||
if (s.eof()) {
|
||||
claims.clear();
|
||||
nHeightOfLastTakeover = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (claims.empty())
|
||||
return;
|
||||
|
||||
READWRITE(claims);
|
||||
READWRITE(nHeightOfLastTakeover);
|
||||
}
|
||||
|
||||
bool operator==(const CClaimTrieData& other) const
|
||||
{
|
||||
return hash == other.hash && nHeightOfLastTakeover == other.nHeightOfLastTakeover && claims == other.claims;
|
||||
}
|
||||
|
||||
bool operator!=(const CClaimTrieData& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return claims.empty();
|
||||
}
|
||||
};
|
||||
|
||||
struct COutPointHeightType
|
||||
{
|
||||
COutPoint outPoint;
|
||||
int nHeight;
|
||||
|
||||
COutPointHeightType()
|
||||
{
|
||||
}
|
||||
|
||||
COutPointHeightType(const COutPoint& outPoint, int nHeight)
|
||||
: outPoint(outPoint), nHeight(nHeight)
|
||||
{
|
||||
}
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(outPoint);
|
||||
READWRITE(nHeight);
|
||||
}
|
||||
};
|
||||
|
||||
struct CNameOutPointHeightType
|
||||
{
|
||||
std::string name;
|
||||
COutPoint outPoint;
|
||||
int nHeight;
|
||||
|
||||
CNameOutPointHeightType()
|
||||
{
|
||||
}
|
||||
|
||||
CNameOutPointHeightType(std::string name, const COutPoint& outPoint, int nHeight)
|
||||
: name(std::move(name)), outPoint(outPoint), nHeight(nHeight)
|
||||
{
|
||||
}
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(name);
|
||||
READWRITE(outPoint);
|
||||
READWRITE(nHeight);
|
||||
}
|
||||
};
|
||||
|
||||
struct CNameOutPointType
|
||||
{
|
||||
std::string name;
|
||||
COutPoint outPoint;
|
||||
|
||||
CNameOutPointType()
|
||||
{
|
||||
}
|
||||
|
||||
CNameOutPointType(std::string name, const COutPoint& outPoint)
|
||||
: name(std::move(name)), outPoint(outPoint)
|
||||
{
|
||||
}
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(name);
|
||||
READWRITE(outPoint);
|
||||
}
|
||||
};
|
||||
|
||||
struct CClaimIndexElement
|
||||
{
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action)
|
||||
{
|
||||
READWRITE(name);
|
||||
READWRITE(claim);
|
||||
}
|
||||
|
||||
std::string name;
|
||||
CClaimValue claim;
|
||||
};
|
||||
|
||||
struct CClaimsForNameType
|
||||
{
|
||||
claimEntryType claims;
|
||||
supportEntryType supports;
|
||||
int nLastTakeoverHeight;
|
||||
std::string name;
|
||||
|
||||
CClaimsForNameType(claimEntryType claims, supportEntryType supports, int nLastTakeoverHeight, const std::string& name)
|
||||
: claims(std::move(claims)), supports(std::move(supports)), nLastTakeoverHeight(nLastTakeoverHeight), name(name)
|
||||
{
|
||||
}
|
||||
|
||||
CClaimsForNameType(CClaimsForNameType&&) = default;
|
||||
CClaimsForNameType(const CClaimsForNameType&) = default;
|
||||
CClaimsForNameType& operator=(CClaimsForNameType&&) = default;
|
||||
CClaimsForNameType& operator=(const CClaimsForNameType&) = default;
|
||||
};
|
||||
|
||||
class CClaimTrie : public CPrefixTrie<std::string, CClaimTrieData>
|
||||
{
|
||||
int nNextHeight = 0;
|
||||
int nExpirationTime = 0;
|
||||
int nProportionalDelayFactor = 0;
|
||||
std::unique_ptr<CDBWrapper> db;
|
||||
|
||||
public:
|
||||
CClaimTrie() = default;
|
||||
CClaimTrie(CClaimTrie&&) = delete;
|
||||
CClaimTrie(const CClaimTrie&) = delete;
|
||||
CClaimTrie(bool fMemory, bool fWipe, int proportionalDelayFactor = 32);
|
||||
|
||||
CClaimTrie& operator=(CClaimTrie&&) = delete;
|
||||
CClaimTrie& operator=(const CClaimTrie&) = delete;
|
||||
|
||||
bool SyncToDisk();
|
||||
|
||||
friend class CClaimTrieCacheBase;
|
||||
friend struct ClaimTrieChainFixture;
|
||||
friend class CClaimTrieCacheExpirationFork;
|
||||
friend class CClaimTrieCacheNormalizationFork;
|
||||
};
|
||||
|
||||
class CClaimTrieProofNode
|
||||
{
|
||||
public:
|
||||
CClaimTrieProofNode(std::vector<std::pair<unsigned char, uint256>> children, bool hasValue, const uint256& valHash)
|
||||
: children(std::move(children)), hasValue(hasValue), valHash(valHash)
|
||||
{
|
||||
}
|
||||
|
||||
CClaimTrieProofNode(CClaimTrieProofNode&&) = default;
|
||||
CClaimTrieProofNode(const CClaimTrieProofNode&) = default;
|
||||
CClaimTrieProofNode& operator=(CClaimTrieProofNode&&) = default;
|
||||
CClaimTrieProofNode& operator=(const CClaimTrieProofNode&) = default;
|
||||
|
||||
std::vector<std::pair<unsigned char, uint256>> children;
|
||||
bool hasValue;
|
||||
uint256 valHash;
|
||||
};
|
||||
|
||||
class CClaimTrieProof
|
||||
{
|
||||
public:
|
||||
CClaimTrieProof()
|
||||
{
|
||||
}
|
||||
|
||||
CClaimTrieProof(std::vector<CClaimTrieProofNode> nodes, bool hasValue, const COutPoint& outPoint, int nHeightOfLastTakeover)
|
||||
: nodes(std::move(nodes)), hasValue(hasValue), outPoint(outPoint), nHeightOfLastTakeover(nHeightOfLastTakeover)
|
||||
{
|
||||
}
|
||||
|
||||
CClaimTrieProof(CClaimTrieProof&&) = default;
|
||||
CClaimTrieProof(const CClaimTrieProof&) = default;
|
||||
CClaimTrieProof& operator=(CClaimTrieProof&&) = default;
|
||||
CClaimTrieProof& operator=(const CClaimTrieProof&) = default;
|
||||
|
||||
std::vector<CClaimTrieProofNode> nodes;
|
||||
bool hasValue;
|
||||
COutPoint outPoint;
|
||||
int nHeightOfLastTakeover;
|
||||
};
|
||||
|
||||
typedef std::pair<std::string, CClaimValue> claimQueueEntryType;
|
||||
typedef std::vector<claimQueueEntryType> claimQueueRowType;
|
||||
typedef std::map<int, claimQueueRowType> claimQueueType;
|
||||
|
||||
typedef std::pair<std::string, CSupportValue> supportQueueEntryType;
|
||||
typedef std::vector<supportQueueEntryType> supportQueueRowType;
|
||||
typedef std::map<int, supportQueueRowType> supportQueueType;
|
||||
|
||||
typedef std::vector<COutPointHeightType> queueNameRowType;
|
||||
typedef std::map<std::string, queueNameRowType> queueNameType;
|
||||
|
||||
typedef std::vector<CNameOutPointHeightType> insertUndoType;
|
||||
|
||||
typedef std::vector<CNameOutPointType> expirationQueueRowType;
|
||||
typedef std::map<int, expirationQueueRowType> expirationQueueType;
|
||||
|
||||
typedef std::set<CClaimValue> claimIndexClaimListType;
|
||||
typedef std::vector<CClaimIndexElement> claimIndexElementListType;
|
||||
|
||||
class CClaimTrieCacheBase
|
||||
{
|
||||
public:
|
||||
explicit CClaimTrieCacheBase(CClaimTrie* base, bool fRequireTakeoverHeights = true);
|
||||
virtual ~CClaimTrieCacheBase() = default;
|
||||
|
||||
uint256 getMerkleHash();
|
||||
bool checkConsistency(int minimumHeight = 1) const;
|
||||
|
||||
bool getClaimById(const uint160& claimId, std::string& name, CClaimValue& claim) const;
|
||||
|
||||
bool flush();
|
||||
bool empty() const;
|
||||
bool ReadFromDisk(const CBlockIndex* tip);
|
||||
|
||||
bool haveClaim(const std::string& name, const COutPoint& outPoint) const;
|
||||
bool haveClaimInQueue(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight);
|
||||
|
||||
bool haveSupport(const std::string& name, const COutPoint& outPoint) const;
|
||||
bool haveSupportInQueue(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight);
|
||||
|
||||
std::size_t getTotalNamesInTrie() const;
|
||||
std::size_t getTotalClaimsInTrie() const;
|
||||
CAmount getTotalValueOfClaimsInTrie(bool fControllingOnly) const;
|
||||
|
||||
bool addClaim(const std::string& name, const COutPoint& outPoint, const uint160& claimId, CAmount nAmount, int nHeight);
|
||||
bool undoAddClaim(const std::string& name, const COutPoint& outPoint, int nHeight);
|
||||
|
||||
bool spendClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight);
|
||||
bool undoSpendClaim(const std::string& name, const COutPoint& outPoint, const uint160& claimId, CAmount nAmount, int nHeight, int nValidAtHeight);
|
||||
|
||||
bool addSupport(const std::string& name, const COutPoint& outPoint, CAmount nAmount, const uint160& supportedClaimId, int nHeight);
|
||||
bool undoAddSupport(const std::string& name, const COutPoint& outPoint, int nHeight);
|
||||
|
||||
bool spendSupport(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight);
|
||||
bool undoSpendSupport(const std::string& name, const COutPoint& outPoint, const uint160& supportedClaimId, CAmount nAmount, int nHeight, int nValidAtHeight);
|
||||
|
||||
virtual bool incrementBlock(insertUndoType& insertUndo,
|
||||
claimQueueRowType& expireUndo,
|
||||
insertUndoType& insertSupportUndo,
|
||||
supportQueueRowType& expireSupportUndo,
|
||||
std::vector<std::pair<std::string, int>>& takeoverHeightUndo);
|
||||
|
||||
virtual bool decrementBlock(insertUndoType& insertUndo,
|
||||
claimQueueRowType& expireUndo,
|
||||
insertUndoType& insertSupportUndo,
|
||||
supportQueueRowType& expireSupportUndo);
|
||||
|
||||
virtual bool getProofForName(const std::string& name, CClaimTrieProof& proof);
|
||||
virtual bool getInfoForName(const std::string& name, CClaimValue& claim) const;
|
||||
|
||||
bool finalizeDecrement(std::vector<std::pair<std::string, int>>& takeoverHeightUndo);
|
||||
|
||||
virtual CClaimsForNameType getClaimsForName(const std::string& name) const;
|
||||
|
||||
CAmount getEffectiveAmountForClaim(const std::string& name, const uint160& claimId, std::vector<CSupportValue>* supports = nullptr) const;
|
||||
CAmount getEffectiveAmountForClaim(const CClaimsForNameType& claims, const uint160& claimId, std::vector<CSupportValue>* supports = nullptr) const;
|
||||
|
||||
void setExpirationTime(int time);
|
||||
int expirationTime();
|
||||
|
||||
CClaimTrie::const_iterator begin() const;
|
||||
CClaimTrie::const_iterator end() const;
|
||||
CClaimTrie::const_iterator find(const std::string& name) const;
|
||||
|
||||
void dumpToLog(CClaimTrie::const_iterator it, bool diffFromBase = true) const;
|
||||
|
||||
protected:
|
||||
CClaimTrie* base;
|
||||
CClaimTrie cache;
|
||||
std::unordered_set<std::string> namesToCheckForTakeover;
|
||||
|
||||
uint256 recursiveComputeMerkleHash(CClaimTrie::iterator& it);
|
||||
|
||||
virtual bool insertClaimIntoTrie(const std::string& name, const CClaimValue& claim, bool fCheckTakeover);
|
||||
virtual bool removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, CClaimValue& claim, bool fCheckTakeover);
|
||||
|
||||
virtual bool insertSupportIntoMap(const std::string& name, const CSupportValue& support, bool fCheckTakeover);
|
||||
virtual bool removeSupportFromMap(const std::string& name, const COutPoint& outPoint, CSupportValue& support, bool fCheckTakeover);
|
||||
|
||||
virtual bool addClaimToQueues(const std::string& name, const CClaimValue& claim);
|
||||
|
||||
virtual bool addSupportToQueues(const std::string& name, const CSupportValue& support);
|
||||
virtual bool removeSupportFromQueue(const std::string& name, const COutPoint& outPoint, CSupportValue& support);
|
||||
|
||||
virtual std::string adjustNameForValidHeight(const std::string& name, int validHeight) const;
|
||||
|
||||
void addToExpirationQueue(int nExpirationHeight, CNameOutPointType& entry);
|
||||
void removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int nHeight);
|
||||
|
||||
void addSupportToExpirationQueue(int nExpirationHeight, CNameOutPointType& entry);
|
||||
void removeSupportFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int nHeight);
|
||||
|
||||
supportEntryType getSupportsForName(const std::string& name) const;
|
||||
|
||||
int getDelayForName(const std::string& name);
|
||||
virtual int getDelayForName(const std::string& name, const uint160& claimId);
|
||||
|
||||
CClaimTrie::iterator cacheData(const std::string& name, bool create = true);
|
||||
|
||||
bool getLastTakeoverForName(const std::string& name, uint160& claimId, int& takeoverHeight) const;
|
||||
|
||||
int getNumBlocksOfContinuousOwnership(const std::string& name);
|
||||
|
||||
expirationQueueType expirationQueueCache;
|
||||
expirationQueueType supportExpirationQueueCache;
|
||||
|
||||
int nNextHeight; // Height of the block that is being worked on, which is
|
||||
// one greater than the height of the chain's tip
|
||||
|
||||
private:
|
||||
uint256 hashBlock;
|
||||
|
||||
std::unordered_map<std::string, std::pair<uint160, int>> takeoverCache;
|
||||
|
||||
bool fRequireTakeoverHeights;
|
||||
|
||||
claimQueueType claimQueueCache;
|
||||
queueNameType claimQueueNameCache;
|
||||
supportQueueType supportQueueCache;
|
||||
queueNameType supportQueueNameCache;
|
||||
claimIndexElementListType claimsToAdd;
|
||||
claimIndexClaimListType claimsToDelete;
|
||||
|
||||
std::unordered_map<std::string, supportEntryType> cacheSupports;
|
||||
std::unordered_set<std::string> nodesToDelete;
|
||||
std::unordered_set<std::string> alreadyCachedNodes;
|
||||
std::unordered_map<std::string, bool> takeoverWorkaround;
|
||||
std::unordered_set<std::string> removalWorkaround;
|
||||
|
||||
bool shouldUseTakeoverWorkaround(const std::string& key) const;
|
||||
void addTakeoverWorkaroundPotential(const std::string& key);
|
||||
void confirmTakeoverWorkaroundNeeded(const std::string& key);
|
||||
|
||||
bool clear();
|
||||
|
||||
void markAsDirty(const std::string& name, bool fCheckTakeover);
|
||||
bool removeSupport(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight, bool fCheckTakeover);
|
||||
bool removeClaim(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight, bool fCheckTakeover);
|
||||
bool removeClaimFromQueue(const std::string& name, const COutPoint& outPoint, CClaimValue& claim);
|
||||
|
||||
typename claimQueueType::value_type* getQueueCacheRow(int nHeight, bool createIfNotExists = false);
|
||||
typename queueNameType::value_type* getQueueCacheNameRow(const std::string& name, bool createIfNotExists = false);
|
||||
typename expirationQueueType::value_type* getExpirationQueueCacheRow(int nHeight, bool createIfNotExists = false);
|
||||
typename supportQueueType::value_type* getSupportQueueCacheRow(int nHeight, bool createIfNotExists = false);
|
||||
typename queueNameType::value_type* getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists = false);
|
||||
typename expirationQueueType::value_type* getSupportExpirationQueueCacheRow(int nHeight, bool createIfNotExists = false);
|
||||
|
||||
// for unit test
|
||||
friend struct ClaimTrieChainFixture;
|
||||
friend class CClaimTrieCacheTest;
|
||||
};
|
||||
|
||||
class CClaimTrieCacheExpirationFork : public CClaimTrieCacheBase
|
||||
{
|
||||
public:
|
||||
explicit CClaimTrieCacheExpirationFork(CClaimTrie* base, bool fRequireTakeoverHeights = true)
|
||||
: CClaimTrieCacheBase(base, fRequireTakeoverHeights)
|
||||
{
|
||||
}
|
||||
|
||||
bool forkForExpirationChange(bool increment);
|
||||
|
||||
// TODO: move the expiration fork code from main.cpp to overrides of increment/decrement block
|
||||
|
||||
private:
|
||||
void removeAndAddSupportToExpirationQueue(expirationQueueRowType& row, int height, bool increment);
|
||||
void removeAndAddToExpirationQueue(expirationQueueRowType& row, int height, bool increment);
|
||||
};
|
||||
|
||||
class CClaimTrieCacheNormalizationFork : public CClaimTrieCacheExpirationFork
|
||||
{
|
||||
public:
|
||||
explicit CClaimTrieCacheNormalizationFork(CClaimTrie* base, bool fRequireTakeoverHeights = true)
|
||||
: CClaimTrieCacheExpirationFork(base, fRequireTakeoverHeights), overrideInsertNormalization(false), overrideRemoveNormalization(false)
|
||||
{
|
||||
}
|
||||
|
||||
bool shouldNormalize() const;
|
||||
|
||||
// lower-case and normalize any input string name
|
||||
// see: https://unicode.org/reports/tr15/#Norm_Forms
|
||||
std::string normalizeClaimName(const std::string& name, bool force = false) const; // public only for validating name field on update op
|
||||
|
||||
bool incrementBlock(insertUndoType& insertUndo,
|
||||
claimQueueRowType& expireUndo,
|
||||
insertUndoType& insertSupportUndo,
|
||||
supportQueueRowType& expireSupportUndo,
|
||||
std::vector<std::pair<std::string, int>>& takeoverHeightUndo) override;
|
||||
|
||||
bool decrementBlock(insertUndoType& insertUndo,
|
||||
claimQueueRowType& expireUndo,
|
||||
insertUndoType& insertSupportUndo,
|
||||
supportQueueRowType& expireSupportUndo) override;
|
||||
|
||||
bool getProofForName(const std::string& name, CClaimTrieProof& proof) override;
|
||||
bool getInfoForName(const std::string& name, CClaimValue& claim) const override;
|
||||
CClaimsForNameType getClaimsForName(const std::string& name) const override;
|
||||
|
||||
protected:
|
||||
bool insertClaimIntoTrie(const std::string& name, const CClaimValue& claim, bool fCheckTakeover = false) override;
|
||||
bool removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, CClaimValue& claim, bool fCheckTakeover = false) override;
|
||||
|
||||
bool insertSupportIntoMap(const std::string& name, const CSupportValue& support, bool fCheckTakeover) override;
|
||||
bool removeSupportFromMap(const std::string& name, const COutPoint& outPoint, CSupportValue& support, bool fCheckTakeover) override;
|
||||
|
||||
int getDelayForName(const std::string& name, const uint160& claimId) override;
|
||||
|
||||
bool addClaimToQueues(const std::string& name, const CClaimValue& claim) override;
|
||||
bool addSupportToQueues(const std::string& name, const CSupportValue& support) override;
|
||||
|
||||
std::string adjustNameForValidHeight(const std::string& name, int validHeight) const override;
|
||||
|
||||
private:
|
||||
bool overrideInsertNormalization;
|
||||
bool overrideRemoveNormalization;
|
||||
|
||||
bool normalizeAllNamesInTrieIfNecessary(insertUndoType& insertUndo,
|
||||
claimQueueRowType& removeUndo,
|
||||
insertUndoType& insertSupportUndo,
|
||||
supportQueueRowType& expireSupportUndo,
|
||||
std::vector<std::pair<std::string, int>>& takeoverHeightUndo);
|
||||
};
|
||||
|
||||
typedef CClaimTrieCacheNormalizationFork CClaimTrieCache;
|
||||
|
||||
#endif // BITCOIN_CLAIMTRIE_H
|
||||
@@ -0,0 +1,234 @@
|
||||
#include "claimtrie.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/locale/conversion.hpp>
|
||||
#include <boost/locale/localization_backend.hpp>
|
||||
#include <boost/scope_exit.hpp>
|
||||
|
||||
void CClaimTrieCacheExpirationFork::removeAndAddToExpirationQueue(expirationQueueRowType& row, int height, bool increment)
|
||||
{
|
||||
for (auto e = row.begin(); e != row.end(); ++e) {
|
||||
// remove and insert with new expiration time
|
||||
removeFromExpirationQueue(e->name, e->outPoint, height);
|
||||
int extend_expiration = Params().GetConsensus().nExtendedClaimExpirationTime - Params().GetConsensus().nOriginalClaimExpirationTime;
|
||||
int new_expiration_height = increment ? height + extend_expiration : height - extend_expiration;
|
||||
CNameOutPointType entry(e->name, e->outPoint);
|
||||
addToExpirationQueue(new_expiration_height, entry);
|
||||
}
|
||||
}
|
||||
|
||||
void CClaimTrieCacheExpirationFork::removeAndAddSupportToExpirationQueue(expirationQueueRowType& row, int height, bool increment)
|
||||
{
|
||||
for (auto e = row.begin(); e != row.end(); ++e) {
|
||||
// remove and insert with new expiration time
|
||||
removeSupportFromExpirationQueue(e->name, e->outPoint, height);
|
||||
int extend_expiration = Params().GetConsensus().nExtendedClaimExpirationTime - Params().GetConsensus().nOriginalClaimExpirationTime;
|
||||
int new_expiration_height = increment ? height + extend_expiration : height - extend_expiration;
|
||||
CNameOutPointType entry(e->name, e->outPoint);
|
||||
addSupportToExpirationQueue(new_expiration_height, entry);
|
||||
}
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheExpirationFork::forkForExpirationChange(bool increment)
|
||||
{
|
||||
/*
|
||||
If increment is True, we have forked to extend the expiration time, thus items in the expiration queue
|
||||
will have their expiration extended by "new expiration time - original expiration time"
|
||||
|
||||
If increment is False, we are decremented a block to reverse the fork. Thus items in the expiration queue
|
||||
will have their expiration extension removed.
|
||||
*/
|
||||
|
||||
//look through db for expiration queues, if we haven't already found it in dirty expiration queue
|
||||
boost::scoped_ptr<CDBIterator> pcursor(base->db->NewIterator());
|
||||
for (pcursor->SeekToFirst(); pcursor->Valid(); pcursor->Next()) {
|
||||
std::pair<uint8_t, int> key;
|
||||
if (!pcursor->GetKey(key))
|
||||
continue;
|
||||
int height = key.second;
|
||||
if (key.first == EXP_QUEUE_ROW) {
|
||||
expirationQueueRowType row;
|
||||
if (pcursor->GetValue(row)) {
|
||||
removeAndAddToExpirationQueue(row, height, increment);
|
||||
} else {
|
||||
return error("%s(): error reading expiration queue rows from disk", __func__);
|
||||
}
|
||||
} else if (key.first == SUPPORT_EXP_QUEUE_ROW) {
|
||||
expirationQueueRowType row;
|
||||
if (pcursor->GetValue(row)) {
|
||||
removeAndAddSupportToExpirationQueue(row, height, increment);
|
||||
} else {
|
||||
return error("%s(): error reading support expiration queue rows from disk", __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::shouldNormalize() const
|
||||
{
|
||||
return nNextHeight > Params().GetConsensus().nNormalizedNameForkHeight;
|
||||
}
|
||||
|
||||
std::string CClaimTrieCacheNormalizationFork::normalizeClaimName(const std::string& name, bool force) const
|
||||
{
|
||||
if (!force && !shouldNormalize())
|
||||
return name;
|
||||
|
||||
static std::locale utf8;
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
static boost::locale::localization_backend_manager manager =
|
||||
boost::locale::localization_backend_manager::global();
|
||||
manager.select("icu");
|
||||
|
||||
static boost::locale::generator curLocale(manager);
|
||||
utf8 = curLocale("en_US.UTF8");
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
std::string normalized;
|
||||
try {
|
||||
// Check if it is a valid utf-8 string. If not, it will throw a
|
||||
// boost::locale::conv::conversion_error exception which we catch later
|
||||
normalized = boost::locale::conv::to_utf<char>(name, "UTF-8", boost::locale::conv::stop);
|
||||
if (normalized.empty())
|
||||
return name;
|
||||
|
||||
// these methods supposedly only use the "UTF8" portion of the locale object:
|
||||
normalized = boost::locale::normalize(normalized, boost::locale::norm_nfd, utf8);
|
||||
normalized = boost::locale::fold_case(normalized, utf8);
|
||||
} catch (const boost::locale::conv::conversion_error& e) {
|
||||
return name;
|
||||
} catch (const std::bad_cast& e) {
|
||||
LogPrintf("%s() is invalid or dependencies are missing: %s\n", __func__, e.what());
|
||||
throw;
|
||||
} catch (const std::exception& e) { // TODO: change to use ... with current_exception() in c++11
|
||||
LogPrintf("%s() had an unexpected exception: %s\n", __func__, e.what());
|
||||
return name;
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::insertClaimIntoTrie(const std::string& name, const CClaimValue& claim, bool fCheckTakeover)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::insertClaimIntoTrie(normalizeClaimName(name, overrideInsertNormalization), claim, fCheckTakeover);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::removeClaimFromTrie(const std::string& name, const COutPoint& outPoint, CClaimValue& claim, bool fCheckTakeover)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::removeClaimFromTrie(normalizeClaimName(name, overrideRemoveNormalization), outPoint, claim, fCheckTakeover);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::insertSupportIntoMap(const std::string& name, const CSupportValue& support, bool fCheckTakeover)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::insertSupportIntoMap(normalizeClaimName(name, overrideInsertNormalization), support, fCheckTakeover);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::removeSupportFromMap(const std::string& name, const COutPoint& outPoint, CSupportValue& support, bool fCheckTakeover)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::removeSupportFromMap(normalizeClaimName(name, overrideRemoveNormalization), outPoint, support, fCheckTakeover);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::normalizeAllNamesInTrieIfNecessary(insertUndoType& insertUndo, claimQueueRowType& removeUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector<std::pair<std::string, int>>& takeoverHeightUndo)
|
||||
{
|
||||
if (nNextHeight != Params().GetConsensus().nNormalizedNameForkHeight)
|
||||
return false;
|
||||
|
||||
// run the one-time upgrade of all names that need to change
|
||||
// it modifies the (cache) trie as it goes, so we need to grab everything to be modified first
|
||||
|
||||
for (auto it = base->begin(); it != base->end(); ++it) {
|
||||
const std::string normalized = normalizeClaimName(it.key(), true);
|
||||
if (normalized == it.key())
|
||||
continue;
|
||||
|
||||
auto supports = getSupportsForName(it.key());
|
||||
for (auto& support : supports) {
|
||||
// if it's already going to expire just skip it
|
||||
if (support.nHeight + base->nExpirationTime <= nNextHeight)
|
||||
continue;
|
||||
|
||||
CSupportValue removed;
|
||||
assert(removeSupportFromMap(it.key(), support.outPoint, removed, false));
|
||||
expireSupportUndo.emplace_back(it.key(), removed);
|
||||
assert(insertSupportIntoMap(normalized, support, false));
|
||||
insertSupportUndo.emplace_back(it.key(), support.outPoint, -1);
|
||||
}
|
||||
|
||||
namesToCheckForTakeover.insert(normalized);
|
||||
|
||||
auto cached = cacheData(it.key(), false);
|
||||
if (!cached || cached->claims.empty())
|
||||
continue;
|
||||
|
||||
for (auto& claim : it->claims) {
|
||||
if (claim.nHeight + base->nExpirationTime <= nNextHeight)
|
||||
continue;
|
||||
|
||||
CClaimValue removed;
|
||||
assert(removeClaimFromTrie(it.key(), claim.outPoint, removed, false));
|
||||
removeUndo.emplace_back(it.key(), removed);
|
||||
assert(insertClaimIntoTrie(normalized, claim, false));
|
||||
insertUndo.emplace_back(it.key(), claim.outPoint, -1);
|
||||
}
|
||||
|
||||
takeoverHeightUndo.emplace_back(it.key(), it->nHeightOfLastTakeover);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::incrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector<std::pair<std::string, int>>& takeoverHeightUndo)
|
||||
{
|
||||
overrideInsertNormalization = normalizeAllNamesInTrieIfNecessary(insertUndo, expireUndo, insertSupportUndo, expireSupportUndo, takeoverHeightUndo);
|
||||
BOOST_SCOPE_EXIT(&overrideInsertNormalization) { overrideInsertNormalization = false; }
|
||||
BOOST_SCOPE_EXIT_END
|
||||
return CClaimTrieCacheExpirationFork::incrementBlock(insertUndo, expireUndo, insertSupportUndo, expireSupportUndo, takeoverHeightUndo);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::decrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo)
|
||||
{
|
||||
overrideRemoveNormalization = shouldNormalize();
|
||||
BOOST_SCOPE_EXIT(&overrideRemoveNormalization) { overrideRemoveNormalization = false; }
|
||||
BOOST_SCOPE_EXIT_END
|
||||
return CClaimTrieCacheExpirationFork::decrementBlock(insertUndo, expireUndo, insertSupportUndo, expireSupportUndo);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::getProofForName(const std::string& name, CClaimTrieProof& proof)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::getProofForName(normalizeClaimName(name), proof);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::getInfoForName(const std::string& name, CClaimValue& claim) const
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::getInfoForName(normalizeClaimName(name), claim);
|
||||
}
|
||||
|
||||
CClaimsForNameType CClaimTrieCacheNormalizationFork::getClaimsForName(const std::string& name) const
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::getClaimsForName(normalizeClaimName(name));
|
||||
}
|
||||
|
||||
int CClaimTrieCacheNormalizationFork::getDelayForName(const std::string& name, const uint160& claimId)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::getDelayForName(normalizeClaimName(name), claimId);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::addClaimToQueues(const std::string& name, const CClaimValue& claim)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::addClaimToQueues(normalizeClaimName(name, claim.nValidAtHeight > Params().GetConsensus().nNormalizedNameForkHeight), claim);
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::addSupportToQueues(const std::string& name, const CSupportValue& support)
|
||||
{
|
||||
return CClaimTrieCacheExpirationFork::addSupportToQueues(normalizeClaimName(name, support.nValidAtHeight > Params().GetConsensus().nNormalizedNameForkHeight), support);
|
||||
}
|
||||
|
||||
std::string CClaimTrieCacheNormalizationFork::adjustNameForValidHeight(const std::string& name, int validHeight) const
|
||||
{
|
||||
return normalizeClaimName(name, validHeight > Params().GetConsensus().nNormalizedNameForkHeight);
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
* for both bitcoind and bitcoin-qt, to make it harder for attackers to
|
||||
* target servers or GUI users specifically.
|
||||
*/
|
||||
const std::string CLIENT_NAME("Satoshi");
|
||||
const std::string CLIENT_NAME("LBRY");
|
||||
|
||||
/**
|
||||
* Client version number
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@ public:
|
||||
uint32_t nHeight : 31;
|
||||
|
||||
//! construct a Coin from a CTxOut and height/coinbase information.
|
||||
Coin(CTxOut&& outIn, int nHeightIn, bool fCoinBaseIn) : out(std::move(outIn)), fCoinBase(fCoinBaseIn), nHeight(nHeightIn) {}
|
||||
Coin(const CTxOut& outIn, int nHeightIn, bool fCoinBaseIn) : out(outIn), fCoinBase(fCoinBaseIn),nHeight(nHeightIn) {}
|
||||
Coin(CTxOut&& outIn, int nHeightIn, bool fCoinBaseIn) : out(std::move(outIn)), fCoinBase(fCoinBaseIn), nHeight(nHeightIn) {}
|
||||
Coin(const CTxOut& outIn, int nHeightIn, bool fCoinBaseIn) : out(outIn), fCoinBase(fCoinBaseIn), nHeight(nHeightIn) {}
|
||||
|
||||
void Clear() {
|
||||
out.SetNull();
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include <stdint.h>
|
||||
|
||||
/** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */
|
||||
static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 4000000;
|
||||
static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 8000000;
|
||||
/** The maximum allowed weight for a block, see BIP 141 (network rule) */
|
||||
static const unsigned int MAX_BLOCK_WEIGHT = 4000000;
|
||||
static const unsigned int MAX_BLOCK_WEIGHT = 8000000;
|
||||
/** The maximum allowed number of signature check operations in a block (network rule) */
|
||||
static const int64_t MAX_BLOCK_SIGOPS_COST = 80000;
|
||||
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
|
||||
|
||||
+23
-1
@@ -48,7 +48,11 @@ struct BIP9Deployment {
|
||||
*/
|
||||
struct Params {
|
||||
uint256 hashGenesisBlock;
|
||||
int nSubsidyHalvingInterval;
|
||||
int nSubsidyLevelInterval;
|
||||
/** Used to check majorities for block version upgrade */
|
||||
int nMajorityEnforceBlockUpgrade;
|
||||
int nMajorityRejectBlockOutdated;
|
||||
int nMajorityWindow;
|
||||
/* Block hash that is excepted from BIP16 enforcement */
|
||||
uint256 BIP16Exception;
|
||||
/** Block height and hash at which BIP34 becomes active */
|
||||
@@ -70,8 +74,26 @@ struct Params {
|
||||
uint256 powLimit;
|
||||
bool fPowAllowMinDifficultyBlocks;
|
||||
bool fPowNoRetargeting;
|
||||
int nAllowMinDiffMinHeight;
|
||||
int nAllowMinDiffMaxHeight;
|
||||
int nNormalizedNameForkHeight;
|
||||
|
||||
int nMinTakeoverWorkaroundHeight;
|
||||
int nMaxTakeoverWorkaroundHeight;
|
||||
|
||||
int64_t nPowTargetSpacing;
|
||||
int64_t nPowTargetTimespan;
|
||||
/** how long it took claims to expire before the hard fork */
|
||||
int64_t nOriginalClaimExpirationTime;
|
||||
/** how long it takes claims to expire after the hard fork */
|
||||
int64_t nExtendedClaimExpirationTime;
|
||||
/** blocks before the hard fork that changed the expiration time */
|
||||
int64_t nExtendedClaimExpirationForkHeight;
|
||||
int64_t GetExpirationTime(int64_t nHeight) const {
|
||||
return nHeight < nExtendedClaimExpirationForkHeight ?
|
||||
nOriginalClaimExpirationTime :
|
||||
nExtendedClaimExpirationTime;
|
||||
}
|
||||
int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
|
||||
uint256 nMinimumChainWork;
|
||||
uint256 defaultAssumeValid;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <script/interpreter.h>
|
||||
#include <consensus/validation.h>
|
||||
|
||||
#include <nameclaim.h>
|
||||
|
||||
// TODO remove the following dependencies
|
||||
#include <chain.h>
|
||||
#include <coins.h>
|
||||
@@ -129,8 +131,9 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in
|
||||
const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout);
|
||||
assert(!coin.IsSpent());
|
||||
const CTxOut &prevout = coin.out;
|
||||
if (prevout.scriptPubKey.IsPayToScriptHash())
|
||||
nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
|
||||
const CScript& scriptPubKey = StripClaimScriptPrefix(prevout.scriptPubKey);
|
||||
if (scriptPubKey.IsPayToScriptHash())
|
||||
nSigOps += scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
|
||||
}
|
||||
return nSigOps;
|
||||
}
|
||||
@@ -178,6 +181,12 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
|
||||
nValueOut += txout.nValue;
|
||||
if (!MoneyRange(nValueOut))
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-txouttotal-toolarge");
|
||||
|
||||
// check claimtrie transactions
|
||||
if (ClaimScriptSize(txout.scriptPubKey) > MAX_CLAIM_SCRIPT_SIZE)
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-claimscriptsize-toolarge");
|
||||
if (ClaimNameSize(txout.scriptPubKey) > MAX_CLAIM_NAME_SIZE)
|
||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-claimscriptname-toolarge");
|
||||
}
|
||||
|
||||
// Check for duplicate inputs - note that this check is slow so we skip it in CheckBlock
|
||||
|
||||
@@ -18,7 +18,7 @@ static const unsigned char REJECT_INVALID = 0x10;
|
||||
static const unsigned char REJECT_OBSOLETE = 0x11;
|
||||
static const unsigned char REJECT_DUPLICATE = 0x12;
|
||||
static const unsigned char REJECT_NONSTANDARD = 0x40;
|
||||
// static const unsigned char REJECT_DUST = 0x41; // part of BIP 61
|
||||
static const unsigned char REJECT_DUST = 0x41; // part of BIP 61
|
||||
static const unsigned char REJECT_INSUFFICIENTFEE = 0x42;
|
||||
static const unsigned char REJECT_CHECKPOINT = 0x43;
|
||||
|
||||
|
||||
+7
-1
@@ -77,6 +77,10 @@ std::string SighashToStr(unsigned char sighash_type)
|
||||
return it->second;
|
||||
}
|
||||
|
||||
bool IsClaimOpCode(opcodetype code) {
|
||||
return code == opcodetype::OP_CLAIM_NAME || code == opcodetype::OP_SUPPORT_CLAIM || code == opcodetype::OP_UPDATE_CLAIM;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the assembly string representation of a CScript object.
|
||||
* @param[in] script CScript object to convert into the asm string representation.
|
||||
@@ -90,6 +94,7 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
|
||||
opcodetype opcode;
|
||||
std::vector<unsigned char> vch;
|
||||
CScript::const_iterator pc = script.begin();
|
||||
bool isClaimScript = false;
|
||||
while (pc < script.end()) {
|
||||
if (!str.empty()) {
|
||||
str += " ";
|
||||
@@ -98,8 +103,9 @@ std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDeco
|
||||
str += "[error]";
|
||||
return str;
|
||||
}
|
||||
isClaimScript |= IsClaimOpCode(opcode);
|
||||
if (0 <= opcode && opcode <= OP_PUSHDATA4) {
|
||||
if (vch.size() <= static_cast<std::vector<unsigned char>::size_type>(4)) {
|
||||
if (vch.size() <= static_cast<std::vector<unsigned char>::size_type>(4) && !isClaimScript) {
|
||||
str += strprintf("%d", CScriptNum(vch, false).getint());
|
||||
} else {
|
||||
// the IsUnspendable check makes sure not to try to decode OP_RETURN data that may match the format of a signature
|
||||
|
||||
+3
-2
@@ -100,8 +100,9 @@ static void SetMaxOpenFiles(leveldb::Options *options) {
|
||||
static leveldb::Options GetOptions(size_t nCacheSize)
|
||||
{
|
||||
leveldb::Options options;
|
||||
options.block_cache = leveldb::NewLRUCache(nCacheSize / 2);
|
||||
options.write_buffer_size = nCacheSize / 4; // up to two write buffers may be held in memory simultaneously
|
||||
auto write_cache = std::min(nCacheSize / 4, size_t(16) << 20U); // cap write_cache at 16MB (4x default)
|
||||
options.block_cache = leveldb::NewLRUCache(nCacheSize - write_cache * 2);
|
||||
options.write_buffer_size = write_cache; // up to two write buffers may be held in memory simultaneously
|
||||
options.filter_policy = leveldb::NewBloomFilterPolicy(10);
|
||||
options.compression = leveldb::kNoCompression;
|
||||
options.info_log = new CBitcoinLevelDBLogger();
|
||||
|
||||
+1
-1
@@ -225,7 +225,7 @@ public:
|
||||
~CDBWrapper();
|
||||
|
||||
CDBWrapper(const CDBWrapper&) = delete;
|
||||
CDBWrapper& operator=(const CDBWrapper&) = delete;
|
||||
/* CDBWrapper& operator=(const CDBWrapper&) = delete; */
|
||||
|
||||
template <typename K, typename V>
|
||||
bool Read(const K& key, V& value) const
|
||||
|
||||
@@ -12,6 +12,43 @@ inline uint32_t ROTL32(uint32_t x, int8_t r)
|
||||
return (x << r) | (x >> (32 - r));
|
||||
}
|
||||
|
||||
uint256 PoWHash(const std::vector<unsigned char>& input)
|
||||
{
|
||||
CHash256 h256;
|
||||
CSHA512 h512;
|
||||
CRIPEMD160 h160;
|
||||
|
||||
std::vector<unsigned char> out;
|
||||
out.resize(h512.OUTPUT_SIZE);
|
||||
|
||||
std::vector<unsigned char> out_small;
|
||||
out_small.resize(h160.OUTPUT_SIZE);
|
||||
|
||||
h256.Write(input.data(), input.size());
|
||||
h256.Finalize(&out[0]);
|
||||
h256.Reset();
|
||||
|
||||
h512.Write(out.data(), h256.OUTPUT_SIZE);
|
||||
h512.Finalize(&out[0]);
|
||||
|
||||
h160.Write(out.data(), h512.OUTPUT_SIZE / 2);
|
||||
h160.Finalize(&out_small[0]);
|
||||
h160.Reset();
|
||||
|
||||
h256.Write(out_small.data(), h160.OUTPUT_SIZE);
|
||||
|
||||
h160.Write(out.data() + h512.OUTPUT_SIZE / 2, h512.OUTPUT_SIZE / 2);
|
||||
h160.Finalize(&out_small[0]);
|
||||
|
||||
out.resize(h256.OUTPUT_SIZE);
|
||||
h256.Write(out_small.data(), h160.OUTPUT_SIZE);
|
||||
h256.Finalize(&out[0]);
|
||||
|
||||
uint256 result(out);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
|
||||
{
|
||||
// The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp
|
||||
|
||||
@@ -190,6 +190,8 @@ uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL
|
||||
return ss.GetHash();
|
||||
}
|
||||
|
||||
uint256 PoWHash(const std::vector<unsigned char>& input);
|
||||
|
||||
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash);
|
||||
|
||||
void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64]);
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ static bool InitRPCAuthentication()
|
||||
LogPrintf("No rpcpassword set - using random cookie authentication.\n");
|
||||
if (!GenerateAuthCookie(&strRPCUserColonPass)) {
|
||||
uiInterface.ThreadSafeMessageBox(
|
||||
_("Error: A fatal internal error occurred, see debug.log for details"), // Same message as AbortNode
|
||||
_("Error: A fatal internal error occurred generating the cookie, see debug.log for details"), // Same message as AbortNode
|
||||
"", CClientUIInterface::MSG_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
+7
-3
@@ -224,21 +224,25 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
||||
}
|
||||
std::unique_ptr<HTTPRequest> hreq(new HTTPRequest(req));
|
||||
|
||||
LogPrint(BCLog::HTTP, "Received a %s request for %s from %s\n",
|
||||
RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString());
|
||||
|
||||
// Early address-based allow check
|
||||
if (!ClientAllowed(hreq->GetPeer())) {
|
||||
LogPrint(BCLog::HTTP, "HTTP request from %s rejected: Client network is not allowed RPC access\n",
|
||||
hreq->GetPeer().ToString());
|
||||
hreq->WriteReply(HTTP_FORBIDDEN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Early reject unknown HTTP methods
|
||||
if (hreq->GetRequestMethod() == HTTPRequest::UNKNOWN) {
|
||||
LogPrint(BCLog::HTTP, "HTTP request from %s rejected: Unknown HTTP request method\n",
|
||||
hreq->GetPeer().ToString());
|
||||
hreq->WriteReply(HTTP_BADMETHOD);
|
||||
return;
|
||||
}
|
||||
|
||||
LogPrint(BCLog::HTTP, "Received a %s request for %s from %s\n",
|
||||
RequestMethodString(hreq->GetRequestMethod()), SanitizeString(hreq->GetURI(), SAFE_CHARS_URI).substr(0, 100), hreq->GetPeer().ToString());
|
||||
|
||||
// Find registered handler for prefix
|
||||
std::string strURI = hreq->GetURI();
|
||||
std::string path;
|
||||
|
||||
@@ -16,31 +16,6 @@ constexpr char DB_TXINDEX_BLOCK = 'T';
|
||||
|
||||
std::unique_ptr<TxIndex> g_txindex;
|
||||
|
||||
struct CDiskTxPos : public CDiskBlockPos
|
||||
{
|
||||
unsigned int nTxOffset; // after header
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITEAS(CDiskBlockPos, *this);
|
||||
READWRITE(VARINT(nTxOffset));
|
||||
}
|
||||
|
||||
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
|
||||
}
|
||||
|
||||
CDiskTxPos() {
|
||||
SetNull();
|
||||
}
|
||||
|
||||
void SetNull() {
|
||||
CDiskBlockPos::SetNull();
|
||||
nTxOffset = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Access to the txindex database (indexes/txindex/)
|
||||
*
|
||||
|
||||
@@ -9,6 +9,31 @@
|
||||
#include <index/base.h>
|
||||
#include <txdb.h>
|
||||
|
||||
struct CDiskTxPos : public CDiskBlockPos
|
||||
{
|
||||
unsigned int nTxOffset; // after header
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITEAS(CDiskBlockPos, *this);
|
||||
READWRITE(VARINT(nTxOffset));
|
||||
}
|
||||
|
||||
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {
|
||||
}
|
||||
|
||||
CDiskTxPos() {
|
||||
SetNull();
|
||||
}
|
||||
|
||||
void SetNull() {
|
||||
CDiskBlockPos::SetNull();
|
||||
nTxOffset = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* TxIndex is used to look up transactions included in the blockchain by hash.
|
||||
* The index is written to a LevelDB database and records the filesystem
|
||||
|
||||
+30
-13
@@ -14,6 +14,7 @@
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <checkpoints.h>
|
||||
#include <claimtrie.h>
|
||||
#include <compat/sanity.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <fs.h>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <txmempool.h>
|
||||
#include <torcontrol.h>
|
||||
#include <ui_interface.h>
|
||||
#include <uint256.h>
|
||||
#include <util.h>
|
||||
#include <utilmoneystr.h>
|
||||
#include <validationinterface.h>
|
||||
@@ -195,7 +197,7 @@ void Shutdown()
|
||||
/// for example if the data directory was found to be locked.
|
||||
/// Be sure that anything that writes files or flushes caches only does this if the respective
|
||||
/// module was initialized.
|
||||
RenameThread("bitcoin-shutoff");
|
||||
RenameThread("lbrycrd-shutoff");
|
||||
mempool.AddTransactionsUpdated(1);
|
||||
|
||||
StopHTTPRPC();
|
||||
@@ -264,6 +266,8 @@ void Shutdown()
|
||||
pcoinscatcher.reset();
|
||||
pcoinsdbview.reset();
|
||||
pblocktree.reset();
|
||||
delete pclaimTrie;
|
||||
pclaimTrie = nullptr;
|
||||
}
|
||||
g_wallet_init_interface.Stop();
|
||||
|
||||
@@ -282,10 +286,10 @@ void Shutdown()
|
||||
LogPrintf("%s: Unable to remove pidfile: %s\n", __func__, e.what());
|
||||
}
|
||||
#endif
|
||||
g_wallet_init_interface.Close();
|
||||
UnregisterAllValidationInterfaces();
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
GetMainSignals().UnregisterWithMempoolSignals(mempool);
|
||||
g_wallet_init_interface.Close();
|
||||
globalVerifyHandle.reset();
|
||||
ECC_Stop();
|
||||
LogPrintf("%s: done\n", __func__);
|
||||
@@ -366,7 +370,7 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-datadir=<dir>", "Specify data directory", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-dbbatchsize", strprintf("Maximum database write batch size in bytes (default: %u)", nDefaultDbBatchSize), true, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-dbcache=<n>", strprintf("Set database cache size in megabytes (%d to %d, default: %d)", nMinDbCache, nMaxDbCache, nDefaultDbCache), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-debuglogfile=<file>", strprintf("Specify location of debug log file. Relative paths will be prefixed by a net-specific datadir location. (0 to disable; default: %s)", DEFAULT_DEBUGLOGFILE), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-debuglogfile=<file>", strprintf("Specify location of debug log file. Relative paths will be prefixed by a net-specific datadir location. (-nodebuglogfile to disable; default: %s)", DEFAULT_DEBUGLOGFILE), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-feefilter", strprintf("Tell other nodes to filter invs to us by our mempool min fee (default: %u)", DEFAULT_FEEFILTER), true, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-includeconf=<file>", "Specify additional configuration file, relative to the -datadir path (only useable from configuration file, not command line)", false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-loadblock=<file>", "Imports blocks from external blk000??.dat file on startup", false, OptionsCategory::OPTIONS);
|
||||
@@ -398,7 +402,7 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-banscore=<n>", strprintf("Threshold for disconnecting misbehaving peers (default: %u)", DEFAULT_BANSCORE_THRESHOLD), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-bantime=<n>", strprintf("Number of seconds to keep misbehaving peers from reconnecting (default: %u)", DEFAULT_MISBEHAVING_BANTIME), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-bind=<addr>", "Bind to given address and always listen on it. Use [host]:port notation for IPv6", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-connect=<ip>", "Connect only to the specified node; -connect=0 disables automatic connections (the rules for this peer are the same as for -addnode). This option can be specified multiple times to connect to multiple nodes.", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-connect=<ip>", "Connect only to the specified node; -noconnect disables automatic connections (the rules for this peer are the same as for -addnode). This option can be specified multiple times to connect to multiple nodes.", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-discover", "Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-dns", strprintf("Allow DNS lookups for -addnode, -seednode and -connect (default: %u)", DEFAULT_NAME_LOOKUP), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-dnsseed", "Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect used)", false, OptionsCategory::CONNECTION);
|
||||
@@ -412,12 +416,12 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-maxsendbuffer=<n>", strprintf("Maximum per-connection send buffer, <n>*1000 bytes (default: %u)", DEFAULT_MAXSENDBUFFER), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-maxtimeadjustment", strprintf("Maximum allowed median peer time offset adjustment. Local perspective of time may be influenced by peers forward or backward by this amount. (default: %u seconds)", DEFAULT_MAX_TIME_ADJUSTMENT), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-maxuploadtarget=<n>", strprintf("Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)", DEFAULT_MAX_UPLOAD_TARGET), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-onion=<ip:port>", "Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: -proxy)", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-onion=<ip:port>", "Use separate SOCKS5 proxy to reach peers via Tor hidden services, set -noonion to disable (default: -proxy)", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-onlynet=<net>", "Make outgoing connections only through network <net> (ipv4, ipv6 or onion). Incoming connections are not affected by this option. This option can be specified multiple times to allow multiple networks.", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-peerbloomfilters", strprintf("Support filtering of blocks and transaction with bloom filters (default: %u)", DEFAULT_PEERBLOOMFILTERS), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-permitbaremultisig", strprintf("Relay non-P2SH multisig (default: %u)", DEFAULT_PERMIT_BAREMULTISIG), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-port=<port>", strprintf("Listen for connections on <port> (default: %u or testnet: %u)", defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort()), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-proxy=<ip:port>", "Connect through SOCKS5 proxy", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-proxy=<ip:port>", "Connect through SOCKS5 proxy, set -noproxy to disable (default: disabled)", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-proxyrandomize", strprintf("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)", DEFAULT_PROXYRANDOMIZE), false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-seednode=<ip>", "Connect to a node to retrieve peer addresses, and disconnect. This option can be specified multiple times to connect to multiple nodes.", false, OptionsCategory::CONNECTION);
|
||||
gArgs.AddArg("-timeout=<n>", strprintf("Specify connection timeout in milliseconds (minimum: 1, default: %d)", DEFAULT_CONNECT_TIMEOUT), false, OptionsCategory::CONNECTION);
|
||||
@@ -465,7 +469,7 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT), true, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest-only)", true, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-addrmantest", "Allows to test address relay on localhost", true, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-debug=<category>", strprintf("Output debugging information (default: %u, supplying <category> is optional)", 0) + ". " +
|
||||
gArgs.AddArg("-debug=<category>", "Output debugging information (default: -nodebug, supplying <category> is optional). "
|
||||
"If <category> is not supplied or if <category> = 1, output all debugging information. <category> can be: " + ListLogCategories() + ".", false, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-debugexclude=<category>", strprintf("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."), false, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-help-debug", "Show all debugging options (usage: --help -help-debug)", false, OptionsCategory::DEBUG_TEST);
|
||||
@@ -478,7 +482,7 @@ void SetupServerArgs()
|
||||
gArgs.AddArg("-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)), false, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-printpriority", strprintf("Log transaction fee per kB when mining blocks (default: %u)", DEFAULT_PRINTPRIORITY), true, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -daemon. To disable logging to file, set debuglogfile=0)", false, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -daemon. To disable logging to file, set -nodebuglogfile)", false, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-shrinkdebugfile", "Shrink debug.log file on client startup (default: 1 when no -debug)", false, OptionsCategory::DEBUG_TEST);
|
||||
gArgs.AddArg("-uacomment=<cmt>", "Append comment to the user agent string", false, OptionsCategory::DEBUG_TEST);
|
||||
|
||||
@@ -527,8 +531,8 @@ void SetupServerArgs()
|
||||
|
||||
std::string LicenseInfo()
|
||||
{
|
||||
const std::string URL_SOURCE_CODE = "<https://github.com/bitcoin/bitcoin>";
|
||||
const std::string URL_WEBSITE = "<https://bitcoincore.org>";
|
||||
const std::string URL_SOURCE_CODE = "<https://github.com/lbryio/lbrycrd>";
|
||||
const std::string URL_WEBSITE = "<https://lbry.com>";
|
||||
|
||||
return CopyrightHolders(strprintf(_("Copyright (C) %i-%i"), 2009, COPYRIGHT_YEAR) + " ") + "\n" +
|
||||
"\n" +
|
||||
@@ -633,7 +637,7 @@ static void CleanupBlockRevFiles()
|
||||
static void ThreadImport(std::vector<fs::path> vImportFiles)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
RenameThread("bitcoin-loadblk");
|
||||
RenameThread("lbrycrd-loadblk");
|
||||
ScheduleBatchPriority();
|
||||
|
||||
{
|
||||
@@ -1250,9 +1254,9 @@ bool AppInitMain()
|
||||
// Warn about relative -datadir path.
|
||||
if (gArgs.IsArgSet("-datadir") && !fs::path(gArgs.GetArg("-datadir", "")).is_absolute()) {
|
||||
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
|
||||
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
|
||||
"current working directory '%s'. This is fragile, because if lbrycrd is started in the future "
|
||||
"from a different location, it will be unable to locate the current data files. There could "
|
||||
"also be data loss if bitcoin is started while in a temporary directory.\n",
|
||||
"also be data loss if lbrycrd is started while in a temporary directory.\n",
|
||||
gArgs.GetArg("-datadir", ""), fs::current_path().string());
|
||||
}
|
||||
|
||||
@@ -1426,6 +1430,7 @@ bool AppInitMain()
|
||||
nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); // cap total coins db cache
|
||||
nTotalCache -= nCoinDBCache;
|
||||
nCoinCacheUsage = nTotalCache; // the rest goes to in-memory cache
|
||||
std::cout << "nTotalCache: " << nTotalCache << ", nCoinCacheUsage: " << nCoinCacheUsage << ", nCoinDBCache: " << nCoinDBCache << std::endl;
|
||||
int64_t nMempoolSizeMax = gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
|
||||
LogPrintf("Cache configuration:\n");
|
||||
LogPrintf("* Using %.1fMiB for block index database\n", nBlockTreeDBCache * (1.0 / 1024 / 1024));
|
||||
@@ -1455,6 +1460,8 @@ bool AppInitMain()
|
||||
// fails if it's still open from the previous loop. Close it first:
|
||||
pblocktree.reset();
|
||||
pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset));
|
||||
delete pclaimTrie;
|
||||
pclaimTrie = new CClaimTrie(false, fReindex);
|
||||
|
||||
if (fReset) {
|
||||
pblocktree->WriteReindexing(true);
|
||||
@@ -1528,6 +1535,13 @@ bool AppInitMain()
|
||||
assert(chainActive.Tip() != nullptr);
|
||||
}
|
||||
|
||||
CClaimTrieCache trieCache(pclaimTrie);
|
||||
if (!trieCache.ReadFromDisk(chainActive.Tip()))
|
||||
{
|
||||
strLoadError = _("Error loading the claim trie from disk");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fReset) {
|
||||
// Note that RewindBlockIndex MUST run even if we're about to -reindex-chainstate.
|
||||
// It both disconnects blocks based on chainActive, and drops block data in
|
||||
@@ -1688,6 +1702,9 @@ bool AppInitMain()
|
||||
}
|
||||
LogPrintf("nBestHeight = %d\n", chain_active_height);
|
||||
|
||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||
CClaimTrieCache(pclaimTrie).setExpirationTime(consensusParams.GetExpirationTime(chain_active_height));
|
||||
|
||||
if (gArgs.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
|
||||
StartTorControl();
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <lbry.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
unsigned int CalculateLbryNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
|
||||
{
|
||||
if (params.fPowNoRetargeting)
|
||||
return pindexLast->nBits;
|
||||
|
||||
const int64_t retargetTimespan = params.nPowTargetTimespan;
|
||||
const int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
|
||||
int64_t nModulatedTimespan = nActualTimespan;
|
||||
int64_t nMaxTimespan;
|
||||
int64_t nMinTimespan;
|
||||
|
||||
nModulatedTimespan = retargetTimespan + (nModulatedTimespan - retargetTimespan) / 8;
|
||||
|
||||
nMinTimespan = retargetTimespan - (retargetTimespan / 8); //(150 - 18 = 132)
|
||||
nMaxTimespan = retargetTimespan + (retargetTimespan / 2); //(150 + 75 = 225)
|
||||
|
||||
// Limit adjustment step
|
||||
if (nModulatedTimespan < nMinTimespan)
|
||||
nModulatedTimespan = nMinTimespan;
|
||||
else if (nModulatedTimespan > nMaxTimespan)
|
||||
nModulatedTimespan = nMaxTimespan;
|
||||
|
||||
// Retarget
|
||||
const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);
|
||||
arith_uint256 bnNew;
|
||||
bnNew.SetCompact(pindexLast->nBits);
|
||||
bnNew *= nModulatedTimespan;
|
||||
bnNew /= retargetTimespan;
|
||||
if (bnNew > bnPowLimit)
|
||||
bnNew = bnPowLimit;
|
||||
|
||||
return bnNew.GetCompact();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef LBRY_H
|
||||
#define LBRY_H
|
||||
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
|
||||
unsigned int CalculateLbryNextWorkRequired(const CBlockIndex* pindexLast, int64_t nLastRetargetTime, const Consensus::Params& params);
|
||||
|
||||
#endif
|
||||
Loaded 100 of 352 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user