From 8b7d8191679ec7b79a9df939d49e9e9ae8150222 Mon Sep 17 00:00:00 2001 From: ca333 Date: Mon, 2 Jul 2018 23:44:59 +0200 Subject: [PATCH 0001/4463] add travis CI --- .travis.yml | 82 ----------------------------------------------------- 1 file changed, 82 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac331dcf9..250756396 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -<<<<<<< HEAD language: cpp compiler: @@ -22,84 +21,3 @@ notifications: - "Alt Message : %{repository_slug} - (%{commit} - %{author}): %{message}, Build Time: %{duration}" - "Change view : %{compare_url}" - "Build details : %{build_url}" -======= -# errata: -# - A travis bug causes caches to trample eachother when using the same -# compiler key (which we don't use anyway). This is worked around for now by -# replacing the "compilers" with a build name prefixed by the no-op ":" -# command. See: https://github.com/travis-ci/travis-ci/issues/4393 -# - sudo/dist/group are set so as to get Blue Box VMs, necessary for [loopback] -# IPv6 support - -sudo: required -dist: precise -group: legacy - -os: linux -language: cpp -compiler: gcc -env: - global: - - MAKEJOBS=-j3 - - RUN_TESTS=false - - BOOST_TEST_RANDOM=1$TRAVIS_BUILD_ID - - CCACHE_SIZE=100M - - CCACHE_TEMPDIR=/tmp/.ccache-temp - - CCACHE_COMPRESS=1 - - BASE_OUTDIR=$TRAVIS_BUILD_DIR/out - - SDK_URL=https://bitcoincore.org/depends-sources/sdks - - PYTHON_DEBUG=1 - - WINEDEBUG=fixme-all -cache: - apt: true - directories: - - depends/built - - depends/sdk-sources - - $HOME/.ccache -matrix: - fast_finish: true - include: - - compiler: ": ARM" - env: HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="" GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" - - compiler: ": Win32" - env: HOST=i686-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-i686 g++-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-reduce-exports" MAKEJOBS="-j2" - - compiler: ": 32-bit + dash" - env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc python-zmq" PPA="ppa:chris-lea/zeromq" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" USE_SHELL="/bin/dash" - - compiler: ": Win64" - env: HOST=x86_64-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-reduce-exports" MAKEJOBS="-j2" - - compiler: ": bitcoind" - env: HOST=x86_64-unknown-linux-gnu PACKAGES="bc python-zmq" PPA="ppa:chris-lea/zeromq" DEP_OPTS="DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER" - - compiler: ": No wallet" - env: HOST=x86_64-unknown-linux-gnu DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" - - compiler: ": Cross-Mac" - env: HOST=x86_64-apple-darwin11 PACKAGES="cmake libcap-dev libz-dev libbz2-dev" BITCOIN_CONFIG="--enable-reduce-exports" OSX_SDK=10.9 GOAL="deploy" - exclude: - - compiler: gcc -install: - - if [ -n "$PACKAGES" ]; then sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list; fi - - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get update; fi - - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES; fi -before_script: - - unset CC; unset CXX - - 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 - - make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS -script: - - if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi - - 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" - - depends/$HOST/native/bin/ccache --max-size=$CCACHE_SIZE - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export CCACHE_READONLY=1; fi - - test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh - - ./configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false) - - make distdir PACKAGE=bitcoin VERSION=$HOST - - cd bitcoin-$HOST - - ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false) - - make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false ) - - export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib - - if [ "$RUN_TESTS" = "true" ]; then make check; fi - - if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.sh; fi -after_script: - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then (echo "Upload goes here. Something like: scp -r $BASE_OUTDIR server" || echo "upload failed"); fi ->>>>>>> zcash/master From 1c95172918220a3f713c095a984225bbd9c8d2e4 Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 3 Jul 2018 14:43:11 +0200 Subject: [PATCH 0002/4463] test --- .travis.yml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 250756396..547c74092 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,28 @@ language: cpp - compiler: - - gcc - +- gcc before_install: - - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa - - sudo apt-get update -qq - - sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate -#install: - -script: - - ./zcutil/build.sh -j 5 - +- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa +- sudo apt-get update -qq +- sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev + m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils + automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate +script: +- "./zcutil/build.sh -j 5" notifications: irc: channels: - - "chat.freenode.net#komodoplatform" + - chat.freenode.net#komodoplatform template: - - "%{repository}/%{branch} (%{commit} - %{author}): %{message}" - - "Alt Message : %{repository_slug} - (%{commit} - %{author}): %{message}, Build Time: %{duration}" - - "Change view : %{compare_url}" - - "Build details : %{build_url}" + - "%{repository}/%{branch} (%{commit} - %{author}): %{message}" + - 'Alt Message : %{repository_slug} - (%{commit} - %{author}): %{message}, Build + Time: %{duration}' + - 'Change view : %{compare_url}' + - 'Build details : %{build_url}' +deploy: + provider: releases + api_key: + secure: oyMB9JDSoL/val/d80Em3sd3mSJY+PPkiclUb3ktizNz7DgYZbBiStUOZIJo95GUYADEvm9RVrP0JmBiDuqneEjfFRzME9/MnpY/LmRCiYGgprMDR80ZqbLgOzSKpE10RE2XM3vZkZeXT/JcGGayUm0faElep2qx62S4ozsAxSvFJ5l/PG+wEltrlnp1z8uYdXV3PBChbjzXJ0BdMVxMrrU39kwzqwu2Ge9PnNjVv0AVxn/oZpf+bzYa7vkSuGTRe2Jcs8U9AABYnZ22wu+tdlD76pdOJzGEwR70e8CjUJmdSn+M+wwAPPHStPW/JHFwSaWsKZtUyB5EWQW2kqq6P+M1Fe7yo6srznsaAcZRWeCrbUO/k44bEfnj7HMGmxfjDJOwbxVEoHg7im+l3HLUiG8rcw5dM/TAnrmgjH/OEj/EM1lbwV2C+PdDGOjdguljEhjBABGRbRABMZjwW8w+uBFVlKlcn7y+zJbMB3mGd+FNGo/OgAcsFzRcpaN8SrC/kzUF2SeEwJjTKvAqRgA66yl7CzDPBtUv2NtoPUz/8YO9rsdGElcWfmDIVacuIEjo1CizlbDzeS7zPiFPW5MRCGryLFLt0WjA/s8lkLO+DbGYXPa4rG6+7ZNUDLfziM+lFqZH8b382/bhv+a6ctpWjaazjiW6yWemsuN8QhByuGw= + file: src/komodod + on: + repo: KomodoPlatform/komodo From 1297265374f8a2fb2b1546f878dde92a1d6d494e Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 3 Jul 2018 14:45:35 +0200 Subject: [PATCH 0003/4463] change travis CI distro --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 547c74092..305e42294 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ +dist: xenial language: cpp compiler: - gcc before_install: - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa - sudo apt-get update -qq +- sudo apt-get install libgnutls28-dev - sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate From 2ab1a322f3f4a7c33aea20c6716d7077a936c71d Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 3 Jul 2018 20:21:22 +0200 Subject: [PATCH 0004/4463] test --- .travis.yml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 305e42294..0b2ae6a4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,20 @@ +os: + - linux + - osx dist: xenial language: cpp compiler: - gcc before_install: -- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa -- sudo apt-get update -qq -- sudo apt-get install libgnutls28-dev -- sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev - m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils - automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc5; fi script: -- "./zcutil/build.sh -j 5" +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi notifications: irc: channels: @@ -21,10 +25,16 @@ notifications: Time: %{duration}' - 'Change view : %{compare_url}' - 'Build details : %{build_url}' +before_deploy: + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)"; fi deploy: provider: releases api_key: secure: oyMB9JDSoL/val/d80Em3sd3mSJY+PPkiclUb3ktizNz7DgYZbBiStUOZIJo95GUYADEvm9RVrP0JmBiDuqneEjfFRzME9/MnpY/LmRCiYGgprMDR80ZqbLgOzSKpE10RE2XM3vZkZeXT/JcGGayUm0faElep2qx62S4ozsAxSvFJ5l/PG+wEltrlnp1z8uYdXV3PBChbjzXJ0BdMVxMrrU39kwzqwu2Ge9PnNjVv0AVxn/oZpf+bzYa7vkSuGTRe2Jcs8U9AABYnZ22wu+tdlD76pdOJzGEwR70e8CjUJmdSn+M+wwAPPHStPW/JHFwSaWsKZtUyB5EWQW2kqq6P+M1Fe7yo6srznsaAcZRWeCrbUO/k44bEfnj7HMGmxfjDJOwbxVEoHg7im+l3HLUiG8rcw5dM/TAnrmgjH/OEj/EM1lbwV2C+PdDGOjdguljEhjBABGRbRABMZjwW8w+uBFVlKlcn7y+zJbMB3mGd+FNGo/OgAcsFzRcpaN8SrC/kzUF2SeEwJjTKvAqRgA66yl7CzDPBtUv2NtoPUz/8YO9rsdGElcWfmDIVacuIEjo1CizlbDzeS7zPiFPW5MRCGryLFLt0WjA/s8lkLO+DbGYXPa4rG6+7ZNUDLfziM+lFqZH8b382/bhv+a6ctpWjaazjiW6yWemsuN8QhByuGw= - file: src/komodod + file: + - src/komodod + - src/komodo-cli + skip_cleanup: true on: repo: KomodoPlatform/komodo From 9a66a8bf5da6d2c86b2e219cd2695337df56b65c Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 3 Jul 2018 20:54:08 +0200 Subject: [PATCH 0005/4463] test --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0b2ae6a4d..4770f7016 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc5; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@5; fi script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi From a6a437652ef5f55047d0f21596abde93fc0aefaa Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 4 Aug 2018 20:22:57 +0200 Subject: [PATCH 0006/4463] update travis --- .travis.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4770f7016..d9237a104 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,12 @@ -os: - - linux - - osx -dist: xenial language: cpp + +matrix: + include: + - os: linux + dist: xenial + sudo: required + - os: osx + osx_image: xcode8 compiler: - gcc before_install: @@ -10,9 +14,10 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc5; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@5; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi @@ -27,12 +32,12 @@ notifications: - 'Change view : %{compare_url}' - 'Build details : %{build_url}' before_deploy: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)"; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi deploy: provider: releases api_key: - secure: oyMB9JDSoL/val/d80Em3sd3mSJY+PPkiclUb3ktizNz7DgYZbBiStUOZIJo95GUYADEvm9RVrP0JmBiDuqneEjfFRzME9/MnpY/LmRCiYGgprMDR80ZqbLgOzSKpE10RE2XM3vZkZeXT/JcGGayUm0faElep2qx62S4ozsAxSvFJ5l/PG+wEltrlnp1z8uYdXV3PBChbjzXJ0BdMVxMrrU39kwzqwu2Ge9PnNjVv0AVxn/oZpf+bzYa7vkSuGTRe2Jcs8U9AABYnZ22wu+tdlD76pdOJzGEwR70e8CjUJmdSn+M+wwAPPHStPW/JHFwSaWsKZtUyB5EWQW2kqq6P+M1Fe7yo6srznsaAcZRWeCrbUO/k44bEfnj7HMGmxfjDJOwbxVEoHg7im+l3HLUiG8rcw5dM/TAnrmgjH/OEj/EM1lbwV2C+PdDGOjdguljEhjBABGRbRABMZjwW8w+uBFVlKlcn7y+zJbMB3mGd+FNGo/OgAcsFzRcpaN8SrC/kzUF2SeEwJjTKvAqRgA66yl7CzDPBtUv2NtoPUz/8YO9rsdGElcWfmDIVacuIEjo1CizlbDzeS7zPiFPW5MRCGryLFLt0WjA/s8lkLO+DbGYXPa4rG6+7ZNUDLfziM+lFqZH8b382/bhv+a6ctpWjaazjiW6yWemsuN8QhByuGw= + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= file: - src/komodod - src/komodo-cli From f97c46158fed7d2488f1fa6cafe4c02d46052908 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 4 Aug 2018 21:01:13 +0200 Subject: [PATCH 0007/4463] update builder darwin specific --- depends/builders/darwin.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index 0028d3f6f..f9b066fcf 100644 --- a/depends/builders/darwin.mk +++ b/depends/builders/darwin.mk @@ -1,5 +1,5 @@ -build_darwin_CC = gcc-5 -build_darwin_CXX = g++-5 +build_darwin_CC = gcc-6 +build_darwin_CXX = g++-6 build_darwin_AR: = $(shell xcrun -f ar) build_darwin_RANLIB: = $(shell xcrun -f ranlib) build_darwin_STRIP: = $(shell xcrun -f strip) @@ -10,8 +10,8 @@ build_darwin_SHA256SUM = shasum -a 256 build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o #darwin host on darwin builder. overrides darwin host preferences. -darwin_CC= gcc-5 -darwin_CXX= g++-5 +darwin_CC= gcc-6 +darwin_CXX= g++-6 darwin_AR:=$(shell xcrun -f ar) darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_STRIP:=$(shell xcrun -f strip) From fd928880a60601a5d2b48c448af2919ccf1639fb Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 4 Aug 2018 21:01:48 +0200 Subject: [PATCH 0008/4463] update host config use gcc/g++ v6 --- depends/hosts/darwin.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 70211078b..bb04d62ec 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,9 +1,9 @@ -OSX_MIN_VERSION=10.8 +OSX_MIN_VERSION=10.11 OSX_SDK_VERSION=10.11 OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk LD64_VERSION=253.9 -darwin_CC=gcc-5 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -darwin_CXX=g++-5 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) +darwin_CC=gcc-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) +darwin_CXX=g++-6 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) From 10f0bdc03a56fc85e8d69a5c224c86c668c42e11 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 4 Aug 2018 21:03:57 +0200 Subject: [PATCH 0009/4463] update darwin makefile use gcc/g++ v6 include correct gcc libs v6.4.0 --- zcutil/build-mac.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zcutil/build-mac.sh b/zcutil/build-mac.sh index cf2af5a2a..138508cb5 100755 --- a/zcutil/build-mac.sh +++ b/zcutil/build-mac.sh @@ -1,6 +1,6 @@ #!/bin/bash -export CC=gcc-5 -export CXX=g++-5 +export CC=gcc-6 +export CXX=g++-6 export LIBTOOL=libtool export AR=ar export RANLIB=ranlib @@ -44,7 +44,7 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1 ./autogen.sh CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \ -CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc5/5.4.0/include/c++/5.4.0 -I$PREFIX/include -fwrapv -fno-strict-aliasing -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \ +CXXFLAGS='-arch x86_64 -I/usr/local/Cellar/gcc\@6/6.4.0_2/include/c++/6.4.0/ -I$PREFIX/include -fwrapv -fno-strict-aliasing -Werror -g -Wl,-undefined -Wl,dynamic_lookup' \ ./configure --prefix="${PREFIX}" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" make "$@" V=1 NO_GTEST=1 STATIC=1 From afd50b9e11c33e6b67a417359ddf975d201f4a16 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 4 Aug 2018 23:03:34 +0200 Subject: [PATCH 0010/4463] update apikey travisCI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d9237a104..3e6d9a0f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ before_deploy: deploy: provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: Ko7UZqZMQMyVhoyovtAlhxY8wSWdeaLoMn9g7LDD+HwMfMhyMb5zJnsMjUalS/T+8a7Oymphj0mpbC1Q9w8hcOCwW4J8QYzlTJ7fKtIFeuJUSHhG0LTUu/oM/eR3Kw4E2INiemEemUc9RPBeyFFW55FmPyLZsRcAyQuTOTR0cmvAFpLARm7cRD2P0oZEIMM+HJOcfZIY7ly8S1CluZ88Zb0h92eHEE3oVf8qBYUS8Wstn8M4GjnGNrCb4RHKr528BemWMmLT5FD8kpvmp3dluyYK66rLT3nva3LyC63LhXbivQaJILWphVh1J0Hq0TfC8zN8tqh+A8mcqtcVXSps9wfSXVRxx+A5/ZRcuy3QXuqOq2xTdk5DJPVUZYwd75nX9GAPV6H5fYviiAe3KZVZdExpF/Tfsj+Y5L/YpwRYnq/c/eGG37YqXC2dj4FsL3ZR627JB6olFHvHXG5nEwMperSKT/aiWB73Du7hs5ICO6UPzY+3UQvPmSX6ISIWHRgrqOVvf2aw06YZFbhu3GFLbI6+y1pF2DeabfCuqKKI4w/Iqnp7yd1L9CK+S4YGVwJ5iIvE/Ou8tqeUqW5pImyEvkd/kMtlo+G4maz42m2Jaea5uIIxPVutTzten1KSInblHhF34z8hurVFjm8n6sEO4UOJNp+mMm8gPxlgIC45fcg= file: - src/komodod - src/komodo-cli From 06955861024f548bb38452ad049a5c5a790a9d6f Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 4 Aug 2018 23:10:37 +0200 Subject: [PATCH 0011/4463] test travisCI build thread incr --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e6d9a0f6..c238da584 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,8 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j5; fi +- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j6; fi notifications: irc: channels: From 4e7f0c5e5a192e97ddbf97373d61792f25414b60 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 5 Aug 2018 11:09:06 +0200 Subject: [PATCH 0012/4463] test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c238da584..0ffda964f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ matrix: dist: xenial sudo: required - os: osx - osx_image: xcode8 + osx_image: xcode8.3 compiler: - gcc before_install: From cb9bbcdd70636d0b1d54820df936b7cbdc57d958 Mon Sep 17 00:00:00 2001 From: ca333 Date: Wed, 8 Aug 2018 15:42:03 +0200 Subject: [PATCH 0013/4463] test --- .travis.yml | 65 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ffda964f..994476d0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ + language: cpp matrix: @@ -6,21 +7,24 @@ matrix: dist: xenial sudo: required - os: osx - osx_image: xcode8.3 + osx_image: xcode8 compiler: -- gcc + - gcc before_install: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j5; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j6; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux.tar.gz src/komodod src/komodo-cli; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./makeRelease.sh; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi notifications: irc: channels: @@ -32,15 +36,30 @@ notifications: - 'Change view : %{compare_url}' - 'Build details : %{build_url}' before_deploy: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi deploy: - provider: releases - api_key: - secure: Ko7UZqZMQMyVhoyovtAlhxY8wSWdeaLoMn9g7LDD+HwMfMhyMb5zJnsMjUalS/T+8a7Oymphj0mpbC1Q9w8hcOCwW4J8QYzlTJ7fKtIFeuJUSHhG0LTUu/oM/eR3Kw4E2INiemEemUc9RPBeyFFW55FmPyLZsRcAyQuTOTR0cmvAFpLARm7cRD2P0oZEIMM+HJOcfZIY7ly8S1CluZ88Zb0h92eHEE3oVf8qBYUS8Wstn8M4GjnGNrCb4RHKr528BemWMmLT5FD8kpvmp3dluyYK66rLT3nva3LyC63LhXbivQaJILWphVh1J0Hq0TfC8zN8tqh+A8mcqtcVXSps9wfSXVRxx+A5/ZRcuy3QXuqOq2xTdk5DJPVUZYwd75nX9GAPV6H5fYviiAe3KZVZdExpF/Tfsj+Y5L/YpwRYnq/c/eGG37YqXC2dj4FsL3ZR627JB6olFHvHXG5nEwMperSKT/aiWB73Du7hs5ICO6UPzY+3UQvPmSX6ISIWHRgrqOVvf2aw06YZFbhu3GFLbI6+y1pF2DeabfCuqKKI4w/Iqnp7yd1L9CK+S4YGVwJ5iIvE/Ou8tqeUqW5pImyEvkd/kMtlo+G4maz42m2Jaea5uIIxPVutTzten1KSInblHhF34z8hurVFjm8n6sEO4UOJNp+mMm8gPxlgIC45fcg= - file: - - src/komodod - - src/komodo-cli - skip_cleanup: true - on: - repo: KomodoPlatform/komodo + - provider: releases + api_key: + secure: Ko7UZqZMQMyVhoyovtAlhxY8wSWdeaLoMn9g7LDD+HwMfMhyMb5zJnsMjUalS/T+8a7Oymphj0mpbC1Q9w8hcOCwW4J8QYzlTJ7fKtIFeuJUSHhG0LTUu/oM/eR3Kw4E2INiemEemUc9RPBeyFFW55FmPyLZsRcAyQuTOTR0cmvAFpLARm7cRD2P0oZEIMM+HJOcfZIY7ly8S1CluZ88Zb0h92eHEE3oVf8qBYUS8Wstn8M4GjnGNrCb4RHKr528BemWMmLT5FD8kpvmp3dluyYK66rLT3nva3LyC63LhXbivQaJILWphVh1J0Hq0TfC8zN8tqh+A8mcqtcVXSps9wfSXVRxx+A5/ZRcuy3QXuqOq2xTdk5DJPVUZYwd75nX9GAPV6H5fYviiAe3KZVZdExpF/Tfsj+Y5L/YpwRYnq/c/eGG37YqXC2dj4FsL3ZR627JB6olFHvHXG5nEwMperSKT/aiWB73Du7hs5ICO6UPzY+3UQvPmSX6ISIWHRgrqOVvf2aw06YZFbhu3GFLbI6+y1pF2DeabfCuqKKI4w/Iqnp7yd1L9CK+S4YGVwJ5iIvE/Ou8tqeUqW5pImyEvkd/kMtlo+G4maz42m2Jaea5uIIxPVutTzten1KSInblHhF34z8hurVFjm8n6sEO4UOJNp+mMm8gPxlgIC45fcg= + name: komodo_linux + prerelease: true + file: + - komodo_linux.tar.gz + skip_cleanup: true + on: + repo: ca333/dsec + branch: master + condition: "$TRAVIS_OS_NAME = linux" + - provider: releases + api_key: + secure: Ko7UZqZMQMyVhoyovtAlhxY8wSWdeaLoMn9g7LDD+HwMfMhyMb5zJnsMjUalS/T+8a7Oymphj0mpbC1Q9w8hcOCwW4J8QYzlTJ7fKtIFeuJUSHhG0LTUu/oM/eR3Kw4E2INiemEemUc9RPBeyFFW55FmPyLZsRcAyQuTOTR0cmvAFpLARm7cRD2P0oZEIMM+HJOcfZIY7ly8S1CluZ88Zb0h92eHEE3oVf8qBYUS8Wstn8M4GjnGNrCb4RHKr528BemWMmLT5FD8kpvmp3dluyYK66rLT3nva3LyC63LhXbivQaJILWphVh1J0Hq0TfC8zN8tqh+A8mcqtcVXSps9wfSXVRxx+A5/ZRcuy3QXuqOq2xTdk5DJPVUZYwd75nX9GAPV6H5fYviiAe3KZVZdExpF/Tfsj+Y5L/YpwRYnq/c/eGG37YqXC2dj4FsL3ZR627JB6olFHvHXG5nEwMperSKT/aiWB73Du7hs5ICO6UPzY+3UQvPmSX6ISIWHRgrqOVvf2aw06YZFbhu3GFLbI6+y1pF2DeabfCuqKKI4w/Iqnp7yd1L9CK+S4YGVwJ5iIvE/Ou8tqeUqW5pImyEvkd/kMtlo+G4maz42m2Jaea5uIIxPVutTzten1KSInblHhF34z8hurVFjm8n6sEO4UOJNp+mMm8gPxlgIC45fcg= + name: komodo_osx + prerelease: true + file: + - komodo_osx.tar.gz + skip_cleanup: true + on: + repo: ca333/dsec + branch: master + condition: "$TRAVIS_OS_NAME = osx" From 6dd7c4ef34f7a2ff8dc22cfe2011815828372ef4 Mon Sep 17 00:00:00 2001 From: ca333 Date: Wed, 8 Aug 2018 16:06:35 +0200 Subject: [PATCH 0014/4463] test --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 994476d0c..6f613ad22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ deploy: - komodo_linux.tar.gz skip_cleanup: true on: - repo: ca333/dsec + repo: KomodoPlatform/komodo branch: master condition: "$TRAVIS_OS_NAME = linux" - provider: releases @@ -60,6 +60,6 @@ deploy: - komodo_osx.tar.gz skip_cleanup: true on: - repo: ca333/dsec + repo: KomodoPlatform/komodo branch: master condition: "$TRAVIS_OS_NAME = osx" From cc0e1e13e4e3f688e534848236108062523fefb3 Mon Sep 17 00:00:00 2001 From: ca333 Date: Thu, 9 Aug 2018 23:13:14 +0200 Subject: [PATCH 0015/4463] update travis --- .travis.yml | 91 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9237a104..6792e41bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,22 +5,32 @@ matrix: - os: linux dist: xenial sudo: required + env: LINUX_DEPLOY="true" OSX_DEPLOY="false" - os: osx - osx_image: xcode8 + osx_image: xcode8 + env: OSX_DEPLOY="true" LINUX_DEPLOY="false" +branches: + only: + - master + - dev + - cctests compiler: -- gcc + - gcc before_install: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux.tar.gz src/komodod src/komodo-cli; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./makeRelease.sh; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi notifications: irc: channels: @@ -32,15 +42,50 @@ notifications: - 'Change view : %{compare_url}' - 'Build details : %{build_url}' before_deploy: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "$TRAVIS_BRANCH-linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "$TRAVIS_BRANCH-osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi deploy: - provider: releases - api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= - file: - - src/komodod - - src/komodo-cli - skip_cleanup: true - on: - repo: KomodoPlatform/komodo + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_linux-$TRAVIS_BRANCH + prerelease: true + file: komodo_linux.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: master + condition: $LINUX_DEPLOY = "true" + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_linux-$TRAVIS_BRANCH + prerelease: true + file: komodo_linux.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: dev + condition: $LINUX_DEPLOY = "true" + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_osx-$TRAVIS_BRANCH + prerelease: true + file: komodo_osx.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: master + condition: $OSX_DEPLOY = "true" + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_osx-$TRAVIS_BRANCH + prerelease: true + file: komodo_osx.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: dev + condition: $OSX_DEPLOY = "true" From 951d0abada71519e371f5e714ede06282c15448f Mon Sep 17 00:00:00 2001 From: ca333 Date: Thu, 9 Aug 2018 23:13:17 +0200 Subject: [PATCH 0016/4463] update travis --- .travis.yml | 91 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9237a104..6792e41bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,22 +5,32 @@ matrix: - os: linux dist: xenial sudo: required + env: LINUX_DEPLOY="true" OSX_DEPLOY="false" - os: osx - osx_image: xcode8 + osx_image: xcode8 + env: OSX_DEPLOY="true" LINUX_DEPLOY="false" +branches: + only: + - master + - dev + - cctests compiler: -- gcc + - gcc before_install: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgnutls28-dev; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then rm '/usr/local/include/c++'; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc@6; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: -- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi -- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux.tar.gz src/komodod src/komodo-cli; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./makeRelease.sh; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi notifications: irc: channels: @@ -32,15 +42,50 @@ notifications: - 'Change view : %{compare_url}' - 'Build details : %{build_url}' before_deploy: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git tag "$TRAVIS_BRANCH-linux-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git tag "$TRAVIS_BRANCH-osx-$(date +'%Y%m%d%H%M')-$(git log --format=%h -1)"; fi deploy: - provider: releases - api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= - file: - - src/komodod - - src/komodo-cli - skip_cleanup: true - on: - repo: KomodoPlatform/komodo + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_linux-$TRAVIS_BRANCH + prerelease: true + file: komodo_linux.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: master + condition: $LINUX_DEPLOY = "true" + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_linux-$TRAVIS_BRANCH + prerelease: true + file: komodo_linux.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: dev + condition: $LINUX_DEPLOY = "true" + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_osx-$TRAVIS_BRANCH + prerelease: true + file: komodo_osx.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: master + condition: $OSX_DEPLOY = "true" + - provider: releases + api_key: + secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + name: komodo_osx-$TRAVIS_BRANCH + prerelease: true + file: komodo_osx.tar.gz + skip_cleanup: true + on: + repo: KomodoPlatform/komodo + branch: dev + condition: $OSX_DEPLOY = "true" From 53bcb42e5853844a1d23b9c9f1267241618e6591 Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 10 Aug 2018 00:11:20 +0200 Subject: [PATCH 0017/4463] update deployment keys --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6792e41bb..93307b3a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ before_deploy: deploy: - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true file: komodo_linux.tar.gz @@ -58,7 +58,7 @@ deploy: condition: $LINUX_DEPLOY = "true" - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true file: komodo_linux.tar.gz @@ -69,7 +69,7 @@ deploy: condition: $LINUX_DEPLOY = "true" - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true file: komodo_osx.tar.gz @@ -80,7 +80,7 @@ deploy: condition: $OSX_DEPLOY = "true" - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true file: komodo_osx.tar.gz From 22ba373414d719eb0e65f2bbf8ff8399ee733860 Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 10 Aug 2018 00:11:23 +0200 Subject: [PATCH 0018/4463] update deployment keys --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6792e41bb..93307b3a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ before_deploy: deploy: - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true file: komodo_linux.tar.gz @@ -58,7 +58,7 @@ deploy: condition: $LINUX_DEPLOY = "true" - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true file: komodo_linux.tar.gz @@ -69,7 +69,7 @@ deploy: condition: $LINUX_DEPLOY = "true" - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true file: komodo_osx.tar.gz @@ -80,7 +80,7 @@ deploy: condition: $OSX_DEPLOY = "true" - provider: releases api_key: - secure: Jms7dz5GMZmuXUCHl5u6iZUtAybv86oW3x36DCJfdzbDiO4B9EWB04z7zA0qvoomefyujHTmQUHxyOKfd4h9/rVMFFv9hgmUxWkrcg7KyLNisOQRaovVOuNtu2lRNXTOSF16Cy+xFGkVh1ObBRhAoMsVKPhMl6PCDiKhNWIekRR9pBtjafKsClQ2ieknUYfqhuvgj7zmqCedeyVaVQyt2W/J65leD0BkfCUESTpANSprHs4bQB65VuQIKKMi+URKx2VgpDdUcWJySt9jAHVPIbI5cT5maAT6RUMnE4oha7Ca1Ox8StBqjQ/hkkMyDbN0keIlN7RjZlwdZQf/qUnT/dPQhsyUCdPXOxmEJ2jekezEK/LGr4Fb+v+vjd9dhLNkD5nVn9zp36biGSCjiMpffQ3fjMeM0YGmVEVRP9kZXLWVRYQoVKrzjyzg5dY8iChbiQEfYpTeBuU+e2rqj4mns+Jvy0zjUbMy6Tyva+iqdZ/PdsBDbiB7c+FIgB1IUTVOD+GgKx6dhCtBZEccn5EyWFwZF9IdQJHZCYV4PA7nuzfm1Ol9SDdZkGHd2OgRCqK/sTwyfTHv8exNqZ1k+epGJp2a0q4IOEknc9aPCAF+m9pHahk7s7VO5gmhO6pvbvuKoeEtEXRZHRzCkGkXfzJlBk+23X5gBexKb6inRdBlj6M= + secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true file: komodo_osx.tar.gz From d3c2d1ac34c67459845d897ac6bc576310cb4075 Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 10 Aug 2018 09:43:22 +0200 Subject: [PATCH 0019/4463] test --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93307b3a5..5490f0f08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ matrix: - os: linux dist: xenial sudo: required - env: LINUX_DEPLOY="true" OSX_DEPLOY="false" + env: LINUX_DEPLOY="true" OSX_DEPLOY="false" $TRAVIS_OS_NAME="linux" - os: osx osx_image: xcode8 - env: OSX_DEPLOY="true" LINUX_DEPLOY="false" + env: OSX_DEPLOY="true" LINUX_DEPLOY="false" $TRAVIS_OS_NAME="osx" branches: only: - master @@ -27,10 +27,10 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux.tar.gz src/komodod src/komodo-cli; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux_$TRAVIS_BRANCH.tar.gz src/komodod src/komodo-cli; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./makeRelease.sh; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx_$TRAVIS_BRANCH.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi notifications: irc: channels: @@ -50,7 +50,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -61,7 +61,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -72,7 +72,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -83,7 +83,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo From 49c6cb313a5ea94bb385aa89ca420b3bce607b9c Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 10 Aug 2018 10:32:20 +0200 Subject: [PATCH 0020/4463] test --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5490f0f08..bfc8b8b4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -61,7 +61,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -72,7 +72,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -83,7 +83,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo From 1fd0b9a823b04ca1574e0ceb30ee127ccd519bef Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 10 Aug 2018 14:00:24 +0200 Subject: [PATCH 0021/4463] test --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93307b3a5..5490f0f08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ matrix: - os: linux dist: xenial sudo: required - env: LINUX_DEPLOY="true" OSX_DEPLOY="false" + env: LINUX_DEPLOY="true" OSX_DEPLOY="false" $TRAVIS_OS_NAME="linux" - os: osx osx_image: xcode8 - env: OSX_DEPLOY="true" LINUX_DEPLOY="false" + env: OSX_DEPLOY="true" LINUX_DEPLOY="false" $TRAVIS_OS_NAME="osx" branches: only: - master @@ -27,10 +27,10 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --overwrite gcc@6; fi script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./zcutil/build.sh -j 5; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux.tar.gz src/komodod src/komodo-cli; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar cvfz komodo_linux_$TRAVIS_BRANCH.tar.gz src/komodod src/komodo-cli; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./zcutil/build-mac.sh -j 5; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./makeRelease.sh; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar cvfz komodo_osx_$TRAVIS_BRANCH.tar.gz src/komodod src/komodo-cli src/libgcc_s.1.dylib src/libgomp.1.dylib src/libstdc++.6.dylib; fi notifications: irc: channels: @@ -50,7 +50,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -61,7 +61,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -72,7 +72,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -83,7 +83,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo From 32f6814d7e40d1b1fcfea12ac476c991a9795c00 Mon Sep 17 00:00:00 2001 From: ca333 Date: Fri, 10 Aug 2018 14:01:31 +0200 Subject: [PATCH 0022/4463] test --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5490f0f08..bfc8b8b4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -61,7 +61,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_linux-$TRAVIS_BRANCH prerelease: true - file: komodo_linux_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_linux_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -72,7 +72,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo @@ -83,7 +83,7 @@ deploy: secure: id69KBVsY0p41WFlqd5cGrAIksJAkUempmdrQwHtfqIbB6es7MVfXuxfmTxk7lZNEItSvLGilYtqhBMNVAVjRRPvk90hveGDMkbpjFz3XBbFEFqtrAr2GdIcpGtII2T3T/TG7j11TMtJ6GvBVt4OcatHFVsKBCFDIx0fB0fd1oLrEAwgRdBO2Jq7bMzoLdzGx3mVtdW5dSRBQzG/Z0yvx+R9mQHSvyPGh6oNPD6mvXPzEaCeRW6Y8g8y1SW/6zDJR6sSdOKA0jsHkr/hM8st3Qkr5Cu3roEbL8598uvfBahjxVHVT8+lu/nJnQyrvtWZKu/uUefybqgZl7UpGvZVFxbNwAB/ZNn0pBKIpZlX/kh6rdGF0XrAG7g+Ths6iklh7wDefYP2JeGwHWJ38YcdF8T/VcSdOXz7EiWwEeZO5sGcTRSl5Ql8mcU3YyyB7BTdViYNTHf5VFFJ/baLZG+shZ/0tb1Ntx5mLDbV8vcYXJpUNTJcXbhcUDSF3QuSz04ftkzgpcsODzcTzD6+2sezV1vlOAlxK04C+zzxG96Md/TegvZYYns78RSgrP/UH1qwEbgxTo3xpErGllzntzZfHJ887Goez+DeB9ga7pUBc5AXGpfRhYqJP66wR10zqfWuWYvjAwRBRNySjr3pUvaA3T1iSZ5HLrpKBfcHXJOTg8M= name: komodo_osx-$TRAVIS_BRANCH prerelease: true - file: komodo_osx_$TRAVIS_BRANCH.tar.gz.tar.gz + file: komodo_osx_$TRAVIS_BRANCH.tar.gz skip_cleanup: true on: repo: KomodoPlatform/komodo From cbb14226569d8815137524c672fde8250b3327c4 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Tue, 4 Sep 2018 17:12:04 -0300 Subject: [PATCH 0023/4463] fix for TXSCL data leak --- src/crosschain.cpp | 7 +++++-- src/notarisationdb.cpp | 7 ++++++- src/notarisationdb.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 197390e59..831c7bcae 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -50,6 +50,8 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh int seenOwnNotarisations = 0; + bool txscl = IsTXSCL(symbol); + for (int i=0; i kmdHeight) break; NotarisationsInBlock notarisations; @@ -72,8 +74,9 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh if (seenOwnNotarisations == 1) { BOOST_FOREACH(Notarisation& nota, notarisations) { - if (nota.second.ccId == targetCCid) - moms.push_back(nota.second.MoM); + if (IsTXSCL(nota.second.symbol) == txscl) + if (nota.second.ccId == targetCCid) + moms.push_back(nota.second.MoM); } } } diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index cdfbb82c1..de3dd75f2 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -26,7 +26,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) { NotarisationData data; if (ParseNotarisationOpReturn(tx, data)) - if (strlen(data.symbol) >= 5 && strncmp(data.symbol, "TXSCL", 5) == 0) + if (IsTXSCL(data.symbol)) isTxscl = 1; } @@ -46,6 +46,11 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) return vNotarisations; } +bool IsTXSCL(const char* symbol) +{ + return strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0; +} + bool GetBlockNotarisations(uint256 blockHash, NotarisationsInBlock &nibs) { diff --git a/src/notarisationdb.h b/src/notarisationdb.h index b8cd93691..f01a5a587 100644 --- a/src/notarisationdb.h +++ b/src/notarisationdb.h @@ -24,5 +24,6 @@ bool GetBackNotarisation(uint256 notarisationHash, Notarisation &n); void WriteBackNotarisations(const NotarisationsInBlock notarisations, CLevelDBBatch &batch); void EraseBackNotarisations(const NotarisationsInBlock notarisations, CLevelDBBatch &batch); int ScanNotarisationsDB(int height, std::string symbol, int scanLimitBlocks, Notarisation& out); +bool IsTXSCL(const char* symbol); #endif /* NOTARISATIONDB_H */ From 538de2ee49fe3b3531c6a09dd9ac6f08bb090287 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Wed, 5 Sep 2018 00:19:12 -0300 Subject: [PATCH 0024/4463] multiple authorities --- src/Makefile.am | 1 + src/cc/eval.cpp | 36 ++---------------- src/crosschain.cpp | 4 +- src/crosschain.h | 14 +++++++ src/crosschain_authority.cpp | 72 ++++++++++++++++++++++++++++++++++++ src/notarisationdb.cpp | 44 ++++++++++------------ 6 files changed, 113 insertions(+), 58 deletions(-) create mode 100644 src/crosschain_authority.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 8b10c06e0..7a9f660e6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -272,6 +272,7 @@ libbitcoin_server_a_SOURCES = \ chain.cpp \ checkpoints.cpp \ crosschain.cpp \ + crosschain_authority.cpp \ deprecation.cpp \ httprpc.cpp \ httpserver.cpp \ diff --git a/src/cc/eval.cpp b/src/cc/eval.cpp index b6fcf57dd..cb9774a7a 100644 --- a/src/cc/eval.cpp +++ b/src/cc/eval.cpp @@ -140,45 +140,17 @@ int32_t Eval::GetNotaries(uint8_t pubkeys[64][33], int32_t height, uint32_t time return komodo_notaries(pubkeys, height, timestamp); } - bool Eval::CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t timestamp) const { if (tx.vin.size() < 11) return false; - uint8_t seenNotaries[64] = {0}; - uint8_t notaries[64][33]; - int nNotaries = GetNotaries(notaries, height, timestamp); + CrosschainAuthority auth; + auth.requiredSigs = 11; + auth.size = GetNotaries(auth.notaries, height, timestamp); - BOOST_FOREACH(const CTxIn &txIn, tx.vin) - { - // Get notary pubkey - CTransaction tx; - uint256 hashBlock; - if (!GetTxUnconfirmed(txIn.prevout.hash, tx, hashBlock)) return false; - if (tx.vout.size() < txIn.prevout.n) return false; - CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; - if (spk.size() != 35) return false; - const unsigned char *pk = spk.data(); - if (pk++[0] != 33) return false; - if (pk[33] != OP_CHECKSIG) return false; - - // Check it's a notary - for (int i=0; i kmdHeight) break; @@ -74,7 +74,7 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh if (seenOwnNotarisations == 1) { BOOST_FOREACH(Notarisation& nota, notarisations) { - if (IsTXSCL(nota.second.symbol) == txscl) + if (GetSymbolAuthority(nota.second.symbol) == authority) if (nota.second.ccId == targetCCid) moms.push_back(nota.second.MoM); } diff --git a/src/crosschain.h b/src/crosschain.h index 15452ac63..65be53f92 100644 --- a/src/crosschain.h +++ b/src/crosschain.h @@ -3,6 +3,20 @@ #include "cc/eval.h" +const int CROSSCHAIN_KOMODO = 1; +const int CROSSCHAIN_TXSCL = 2; +const int CROSSCHAIN_STAKED = 3; + +typedef struct CrosschainAuthority { + uint8_t notaries[64][33]; + size_t size; + size_t requiredSigs; +} CrosschainAuthority; + +extern const CrosschainAuthority auth_STAKED; + +int GetSymbolAuthority(const char* symbol); +bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth); /* On assetchain */ TxProof GetAssetchainProof(uint256 hash); diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp new file mode 100644 index 000000000..5ea277387 --- /dev/null +++ b/src/crosschain_authority.cpp @@ -0,0 +1,72 @@ +#include "cc/eval.h" +#include "crosschain.h" +#include "notarisationdb.h" + + +int GetSymbolAuthority(const char* symbol) +{ + if (strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0) + return CROSSCHAIN_TXSCL; + if (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) + return CROSSCHAIN_STAKED; + return CROSSCHAIN_KOMODO; +} + + +bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) +{ + EvalRef eval; + + if (tx.vin.size() < auth.requiredSigs) return false; + + uint8_t seesize[64]; + + BOOST_FOREACH(const CTxIn &txIn, tx.vin) + { + // Get notary pubkey + CTransaction tx; + uint256 hashBlock; + if (!eval->GetTxUnconfirmed(txIn.prevout.hash, tx, hashBlock)) return false; + if (tx.vout.size() < txIn.prevout.n) return false; + CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; + if (spk.size() != 35) return false; + const unsigned char *pk = spk.data(); + if (pk++[0] != 33) return false; + if (pk[33] != OP_CHECKSIG) return false; + + // Check it's a notary + for (int i=0; i @@ -21,36 +22,31 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) for (unsigned int i = 0; i < block.vtx.size(); i++) { CTransaction tx = block.vtx[i]; - // Special case for TXSCL. Should prob be removed at some point. - bool isTxscl = 0; - { - NotarisationData data; - if (ParseNotarisationOpReturn(tx, data)) - if (IsTXSCL(data.symbol)) - isTxscl = 1; + NotarisationData data; + bool parsed = ParseNotarisationOpReturn(tx, data); + if (!parsed) data = NotarisationData(); + int authority = GetSymbolAuthority(data.symbol); + + if (authority == CROSSCHAIN_KOMODO) { + if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime)) + continue; + } else if (authority == CROSSCHAIN_STAKED) { + if (!CheckTxAuthority(tx, auth_STAKED)) + continue; } - if (isTxscl || eval->CheckNotaryInputs(tx, nHeight, block.nTime)) { - NotarisationData data; - if (ParseNotarisationOpReturn(tx, data)) { - vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); - //printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n", - // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); - //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); - } - else - LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", - tx.GetHash().GetHex().data(), nHeight); - } + if (parsed) { + vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); + //printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n", + // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); + //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); + } else + LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", + tx.GetHash().GetHex().data(), nHeight); } return vNotarisations; } -bool IsTXSCL(const char* symbol) -{ - return strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0; -} - bool GetBlockNotarisations(uint256 blockHash, NotarisationsInBlock &nibs) { From 64a4efaa700e5682096998a741116b140178799a Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Wed, 5 Sep 2018 00:22:38 -0300 Subject: [PATCH 0025/4463] put clarifying comment --- src/crosschain_authority.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 5ea277387..d9d75632a 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -59,6 +59,11 @@ const char *notaries_STAKED[4][2] = {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"} }; +/* + * TO EDIT: + * 1) Edit sigs above + * 2) Update size and requiredSigs below + */ const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; From 040078433fd6f2e5db76fddf86b44efa5a91a214 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Wed, 5 Sep 2018 00:27:06 -0300 Subject: [PATCH 0026/4463] fix outrageous typo --- src/crosschain_authority.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index d9d75632a..0eeb8ad27 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -19,7 +19,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vin.size() < auth.requiredSigs) return false; - uint8_t seesize[64]; + uint8_t seen[64]; BOOST_FOREACH(const CTxIn &txIn, tx.vin) { @@ -36,9 +36,9 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) // Check it's a notary for (int i=0; i Date: Wed, 5 Sep 2018 20:47:22 +0000 Subject: [PATCH 0027/4463] temp add test pubkeys --- src/crosschain_authority.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 0eeb8ad27..a75016770 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -54,9 +54,9 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const char *notaries_STAKED[4][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"} + {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, + {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, + {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"} }; /* From 062b77092772a7dc96c8009010d22aa363ab2617 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Thu, 6 Sep 2018 00:14:45 -0300 Subject: [PATCH 0028/4463] bugfix; seen members not zeroed --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 0eeb8ad27..33c1d1d3e 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -19,7 +19,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vin.size() < auth.requiredSigs) return false; - uint8_t seen[64]; + uint8_t seen[64] = {0}; BOOST_FOREACH(const CTxIn &txIn, tx.vin) { From 489eb6710d8216aedba89d20c4140267bbf20000 Mon Sep 17 00:00:00 2001 From: blackjok3rtt Date: Fri, 7 Sep 2018 04:02:17 +0800 Subject: [PATCH 0029/4463] Test modification to allow STAKED* chains to have their own notary pubkeys. --- src/komodo_notary.h | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 4711a9afc..8d1b6d582 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -198,6 +198,20 @@ const char *Notaries_elected1[][2] = {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, }; +const char *Notaries_staked[][2] = +{ + {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, + {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, + {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, + {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, + {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; + + int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; @@ -226,13 +240,24 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - n1 = (int32_t)(sizeof(Notaries_elected1)/sizeof(*Notaries_elected1)); - for (i=0; i Date: Sat, 8 Sep 2018 09:29:00 +0800 Subject: [PATCH 0030/4463] Test, use single array, dynamically sized for crosschain auth --- src/crosschain_authority.cpp | 20 +++----------------- src/komodo_notary.h | 8 ++++---- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 12a44d8ce..7a153b7ff 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -1,6 +1,7 @@ #include "cc/eval.h" #include "crosschain.h" #include "notarisationdb.h" +#include "komodo_notary.h" int GetSymbolAuthority(const char* symbol) @@ -51,27 +52,12 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) } -const char *notaries_STAKED[4][2] = -{ - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, - {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, - {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"} -}; - -/* - * TO EDIT: - * 1) Edit sigs above - * 2) Update size and requiredSigs below - */ - const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.size = 4; - auth.requiredSigs = 2; + auth.size = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); + auth.requiredSigs = (auth.size/5); for (int n=0; n Date: Sat, 8 Sep 2018 09:35:26 +0800 Subject: [PATCH 0031/4463] try again --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 7a153b7ff..fc8752db1 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -1,7 +1,7 @@ #include "cc/eval.h" #include "crosschain.h" #include "notarisationdb.h" -#include "komodo_notary.h" +#include "notaries_STAKED.h" int GetSymbolAuthority(const char* symbol) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 6334af56b..6246fca52 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,6 +18,8 @@ #include "komodo_cJSON.h" +#include "notaries_STAKED.h" + #define KOMODO_MAINNET_START 178999 const char *Notaries_genesis[][2] = @@ -198,20 +200,6 @@ const char *Notaries_elected1[][2] = {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, }; -const char notaries_STAKED[][2] = -{ - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, - {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, - {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, - {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 - {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, -}; - - int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; From e18e04bed7bfd8296dda21fb0489311cf31aa326 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 09:38:12 +0800 Subject: [PATCH 0032/4463] LOL im drunk --- notaries_STAKED.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 notaries_STAKED.h diff --git a/notaries_STAKED.h b/notaries_STAKED.h new file mode 100644 index 000000000..8891a92fa --- /dev/null +++ b/notaries_STAKED.h @@ -0,0 +1,14 @@ +# notaries_STAKED + +const char notaries_STAKED[][2] = +{ + {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, + {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, + {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, + {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, + {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; From c069525a77da1d84a6c9dc9f4e2db07aed381dd8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 09:49:50 +0800 Subject: [PATCH 0033/4463] fix stupidity --- notaries_STAKED.h => src/notaries_STAKED.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename notaries_STAKED.h => src/notaries_STAKED.h (100%) diff --git a/notaries_STAKED.h b/src/notaries_STAKED.h similarity index 100% rename from notaries_STAKED.h rename to src/notaries_STAKED.h From 9f93a0de963896d317a83095cc1c6c808f5be583 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 09:52:08 +0800 Subject: [PATCH 0034/4463] poofish --- src/notaries_STAKED.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 8891a92fa..a53cb3e27 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,5 +1,3 @@ -# notaries_STAKED - const char notaries_STAKED[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, From d5b43746be0dd22d09cdd9d71118d8e91a4164fb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 09:58:29 +0800 Subject: [PATCH 0035/4463] fingers crossed --- src/notaries_STAKED.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index a53cb3e27..b5454d2f4 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,4 +1,4 @@ -const char notaries_STAKED[][2] = +const char *notaries_STAKED[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, From 1ab289383976c956d1714b048aa85e0615d8d17c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 12:08:07 +0800 Subject: [PATCH 0036/4463] test --- src/notaries_STAKED.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index b5454d2f4..94f20acd2 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,3 +1,4 @@ +#pragma once const char *notaries_STAKED[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, From 14f27f2e498235b3b616706ab02d062a56cef7dc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 12:26:32 +0800 Subject: [PATCH 0037/4463] test --- src/notaries_STAKED.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 94f20acd2..ed21cd2bd 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,4 +1,5 @@ #pragma once +#define notaries_STAKED const char *notaries_STAKED[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, From 1049d013b78bafd35ef38cef6c22f6c4217438f0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 12:28:02 +0800 Subject: [PATCH 0038/4463] test --- src/notaries_STAKED.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index ed21cd2bd..7c540c9a4 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,5 +1,5 @@ #pragma once -#define notaries_STAKED +#define *notaries_STAKED[][2] const char *notaries_STAKED[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, From f04396d2c0497a7c2c6a5256aad102745155841e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 12:30:47 +0800 Subject: [PATCH 0039/4463] a --- src/crosschain_authority.cpp | 2 +- src/notaries_STAKED.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index fc8752db1..6c60d9f97 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -1,7 +1,7 @@ #include "cc/eval.h" #include "crosschain.h" #include "notarisationdb.h" -#include "notaries_STAKED.h" +//#include "notaries_STAKED.h" int GetSymbolAuthority(const char* symbol) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 7c540c9a4..f75c453b6 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,5 +1,5 @@ #pragma once -#define *notaries_STAKED[][2] + const char *notaries_STAKED[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, From ead6f50464ca7d91f70a2c40447802ada993daad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 12:38:29 +0800 Subject: [PATCH 0040/4463] testing --- src/crosschain_authority.cpp | 13 +++++++++++++ src/komodo_notary.h | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 6c60d9f97..48162ad24 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,6 +3,19 @@ #include "notarisationdb.h" //#include "notaries_STAKED.h" +const char *notaries_STAKED[][2] = +{ + {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, + {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, + {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, + {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, + {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; + int GetSymbolAuthority(const char* symbol) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 6246fca52..5e63a4648 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,7 +18,20 @@ #include "komodo_cJSON.h" -#include "notaries_STAKED.h" +//#include "notaries_STAKED.h" + +const char *notaries_STAKED[][2] = +{ + {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, + {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, + {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, + {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, + {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; #define KOMODO_MAINNET_START 178999 From b20459fee2dcb4504f21ccd39d1b1ad79c6f156b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 13:01:02 +0800 Subject: [PATCH 0041/4463] test again --- src/crosschain_authority.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 48162ad24..eaeb010b4 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,7 +3,7 @@ #include "notarisationdb.h" //#include "notaries_STAKED.h" -const char *notaries_STAKED[][2] = +const char *notaries_STAKEDcc[][2] = { {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, @@ -67,10 +67,10 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.size = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); + auth.size = (int32_t)(sizeof(notaries_STAKEDcc)/sizeof(*notaries_STAKEDcc)); auth.requiredSigs = (auth.size/5); for (int n=0; n Date: Sat, 8 Sep 2018 21:25:55 +0800 Subject: [PATCH 0042/4463] update pubkeys --- src/crosschain_authority.cpp | 20 +++++++++++--------- src/komodo_notary.h | 19 ++++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index eaeb010b4..c8108608c 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -5,15 +5,17 @@ const char *notaries_STAKEDcc[][2] = { - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, - {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, - {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, - {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 - {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, + {"alright", "037fa9d151c8bafd67c1829707b9d72e193e8c27c7b284fef1ffe2070601e508be"}, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"CrisF", "03921b5e03b3b4d31f94f6ad40b21170a524ab9f2f344bb575811aeca059ca174b"}, + {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, + {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f"}, + {"jorian","02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3"}, + {"gcharang","024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d"}, + {"nabob","03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf"}, + {"TonyL","02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622"}, + {"blackjok3r","021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e"} }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 5e63a4648..43c6805c6 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -21,16 +21,17 @@ //#include "notaries_STAKED.h" const char *notaries_STAKED[][2] = -{ - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, - {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, - {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, - {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 - {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"alright", "037fa9d151c8bafd67c1829707b9d72e193e8c27c7b284fef1ffe2070601e508be"}, {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, + {"CrisF", "03921b5e03b3b4d31f94f6ad40b21170a524ab9f2f344bb575811aeca059ca174b"}, + {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, + {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f"}, + {"jorian","02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3"}, + {"gcharang","024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d"}, + {"nabob","03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf"}, + {"TonyL","02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622"}, + {"blackjok3r","021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e"}, }; #define KOMODO_MAINNET_START 178999 From a8e94f86c5e1ee15b747b74cab90e1ee878fff58 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 21:28:31 +0800 Subject: [PATCH 0043/4463] pubkeys update --- src/crosschain_authority.cpp | 4 ++-- src/komodo_notary.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index c8108608c..a2fb95cff 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -5,9 +5,9 @@ const char *notaries_STAKEDcc[][2] = { - {"alright", "037fa9d151c8bafd67c1829707b9d72e193e8c27c7b284fef1ffe2070601e508be"}, + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"CrisF", "03921b5e03b3b4d31f94f6ad40b21170a524ab9f2f344bb575811aeca059ca174b"}, + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f"}, diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 43c6805c6..d377de319 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -21,9 +21,9 @@ //#include "notaries_STAKED.h" const char *notaries_STAKED[][2] = - {"alright", "037fa9d151c8bafd67c1829707b9d72e193e8c27c7b284fef1ffe2070601e508be"}, + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"CrisF", "03921b5e03b3b4d31f94f6ad40b21170a524ab9f2f344bb575811aeca059ca174b"}, + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f"}, From fa9fd0a1e32f2623cbc2c5d682fe0c76aa32d688 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 21:40:20 +0800 Subject: [PATCH 0044/4463] drunk again --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index a2fb95cff..1960d7c32 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -15,7 +15,7 @@ const char *notaries_STAKEDcc[][2] = {"gcharang","024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d"}, {"nabob","03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf"}, {"TonyL","02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622"}, - {"blackjok3r","021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e"} + {"blackjok3r","021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e"}, }; From e84001da53303bf8f18fe06ec9909cdb06cc80e8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 21:44:19 +0800 Subject: [PATCH 0045/4463] soooo drunk --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 1960d7c32..ffb3048ea 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -6,7 +6,7 @@ const char *notaries_STAKEDcc[][2] = { {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d377de319..e64024a19 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,7 +22,7 @@ const char *notaries_STAKED[][2] = {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, From 362c398046dad7c89fb84189ff6beecf03093b42 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 21:52:50 +0800 Subject: [PATCH 0046/4463] more beer --- src/crosschain_authority.cpp | 21 ++++++++++----------- src/komodo_notary.h | 18 +++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index ffb3048ea..492b5149b 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -5,17 +5,16 @@ const char *notaries_STAKEDcc[][2] = { - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, - {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, - {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, - {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f"}, - {"jorian","02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3"}, - {"gcharang","024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d"}, - {"nabob","03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf"}, - {"TonyL","02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622"}, - {"blackjok3r","021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e"}, + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, + {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // 60 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, + {"gcharang", "024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d" }, + {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, + {"TonyL", "02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622" }, + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e64024a19..a49ceeda9 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,20 +18,20 @@ #include "komodo_cJSON.h" -//#include "notaries_STAKED.h" +#include "notaries_STAKED.h" const char *notaries_STAKED[][2] = +{ {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, - {"Emman", "038F642DCDACBDF510B7869D74544DBC6792548D9D1F8D73A999DD9F45F513C935"}, - {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, - {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f"}, - {"jorian","02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3"}, - {"gcharang","024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d"}, - {"nabob","03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf"}, - {"TonyL","02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622"}, - {"blackjok3r","021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e"}, + {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // 60 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, + {"gcharang", "024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d" }, + {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, + {"TonyL", "02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622" }, + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, }; #define KOMODO_MAINNET_START 178999 From fe6f552be66ee806db2ff922a541eed06ee61d79 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 8 Sep 2018 21:55:32 +0800 Subject: [PATCH 0047/4463] LOL lol --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index a49ceeda9..e9570db6a 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,7 +18,7 @@ #include "komodo_cJSON.h" -#include "notaries_STAKED.h" +//include "notaries_STAKED.h" const char *notaries_STAKED[][2] = { From 89223d139888ea373896d53c1b33d6f1217c9a98 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Sat, 8 Sep 2018 14:39:26 +0000 Subject: [PATCH 0048/4463] add pubkey --- src/crosschain_authority.cpp | 1 + src/komodo_notary.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 492b5149b..ccac930f7 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -15,6 +15,7 @@ const char *notaries_STAKEDcc[][2] = {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, {"TonyL", "02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622" }, {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e9570db6a..c46fb22dd 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -32,6 +32,7 @@ const char *notaries_STAKED[][2] = {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, {"TonyL", "02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622" }, {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, }; #define KOMODO_MAINNET_START 178999 From a35ead4321925533f2c8dd8ff2638b35321576ab Mon Sep 17 00:00:00 2001 From: tonymorony Date: Sat, 8 Sep 2018 21:25:03 +0000 Subject: [PATCH 0049/4463] changed pubket TonyL --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index ccac930f7..b726c034d 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -13,7 +13,7 @@ const char *notaries_STAKEDcc[][2] = {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, {"gcharang", "024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d" }, {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, - {"TonyL", "02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622" }, + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index c46fb22dd..bfcdcfba5 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -30,7 +30,7 @@ const char *notaries_STAKED[][2] = {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, {"gcharang", "024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d" }, {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, - {"TonyL", "02f5988bda204b42fd451163257ff409d11dcbd818eb2d96ab6a72382eff2b2622" }, + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, }; From 2f358266f8acb5d495c088ec0afbdb6b39d09dcf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 9 Sep 2018 07:18:39 +0800 Subject: [PATCH 0050/4463] fix webworker --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 492b5149b..883bd886f 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -6,7 +6,7 @@ const char *notaries_STAKEDcc[][2] = { {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, + {"webworker01_NA", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // 60 diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e9570db6a..d20ae6912 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -23,7 +23,7 @@ const char *notaries_STAKED[][2] = { {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7"}, + {"webworker01_NA", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // 60 From ce77a270483eba8924473477d565a25cdc48e033 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 10 Sep 2018 05:08:48 +0000 Subject: [PATCH 0051/4463] finalize pubkeys --- src/crosschain_authority.cpp | 8 +++----- src/komodo_notary.h | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index f169c47b3..4913a4ea0 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -5,16 +5,14 @@ const char *notaries_STAKEDcc[][2] = { + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, + {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // 60 + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, - {"gcharang", "024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d" }, - {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index db0aeb988..3fbcb25ff 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,16 +22,14 @@ const char *notaries_STAKED[][2] = { + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01_NA", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, + {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // 60 + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, - {"gcharang", "024ce12f3423345350d8535e402803da30abee3c2941840b5002bf05e88b7f6e2d" }, - {"nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, }; From d33fc13c596c3e2960b37009a1166586a2858076 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 10 Sep 2018 05:17:20 +0000 Subject: [PATCH 0052/4463] add titomane --- src/crosschain_authority.cpp | 1 + src/komodo_notary.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 4913a4ea0..4b5f7f62d 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -14,6 +14,7 @@ const char *notaries_STAKEDcc[][2] = {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, + {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 3fbcb25ff..acbff97c7 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -31,6 +31,7 @@ const char *notaries_STAKED[][2] = {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, + {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, }; #define KOMODO_MAINNET_START 178999 From fdae4d44e9c0d606d1fdcbe3c5e482e41771145b Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 10 Sep 2018 05:40:41 +0000 Subject: [PATCH 0053/4463] add CHMEX, add addresses --- src/crosschain_authority.cpp | 1 + src/komodo_notary.h | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 4b5f7f62d..772558268 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -15,6 +15,7 @@ const char *notaries_STAKEDcc[][2] = {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index acbff97c7..9214ee3e0 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,16 +22,17 @@ const char *notaries_STAKED[][2] = { - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, // RKjJctJfaExgzcUgbrZDTqzzhxeaC5HP3G + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, - {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, }; #define KOMODO_MAINNET_START 178999 From 31b6db4b4187a94bbc2666dbcc998d917c25ad63 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 10 Sep 2018 13:53:47 +0800 Subject: [PATCH 0054/4463] fix spaces just incase --- src/crosschain_authority.cpp | 6 +++--- src/komodo_notary.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 772558268..e191fec84 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -6,9 +6,9 @@ const char *notaries_STAKEDcc[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, - {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, + {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4" }, + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9214ee3e0..131fc2438 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -23,9 +23,9 @@ const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8"}, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4"}, // RKjJctJfaExgzcUgbrZDTqzzhxeaC5HP3G - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3"}, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4" }, // RKjJctJfaExgzcUgbrZDTqzzhxeaC5HP3G + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 From a86d6f81ad9f740f458440eff77f8dcfd2d16c0b Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 10 Sep 2018 07:36:17 +0000 Subject: [PATCH 0055/4463] add metaphilibert --- src/crosschain_authority.cpp | 1 + src/komodo_notary.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 772558268..1c2c2146b 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -16,6 +16,7 @@ const char *notaries_STAKEDcc[][2] = {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9214ee3e0..23fa61b9c 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -32,7 +32,8 @@ const char *notaries_STAKED[][2] = {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 }; #define KOMODO_MAINNET_START 178999 From 48d531894933bc11ce137d6c4dc75fd6f2603876 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 10 Sep 2018 07:43:05 +0000 Subject: [PATCH 0056/4463] add address --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index bd3e5acd1..9e6f17097 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -29,7 +29,7 @@ const char *notaries_STAKED[][2] = {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL From de3377d94467495223f753ea479472653bae86d2 Mon Sep 17 00:00:00 2001 From: webworker01 Date: Mon, 10 Sep 2018 07:52:10 +0000 Subject: [PATCH 0057/4463] update webworker keys --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 1b82c32af..39579811c 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -7,7 +7,7 @@ const char *notaries_STAKEDcc[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, - {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4" }, + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9e6f17097..d42d3e17e 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -24,7 +24,7 @@ const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4" }, // RKjJctJfaExgzcUgbrZDTqzzhxeaC5HP3G + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, From e3f69857503c5ed0e205ee1b4d99eb047a4d12a0 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 10 Sep 2018 09:07:43 +0000 Subject: [PATCH 0058/4463] add jusoaresf, add mylo --- src/crosschain_authority.cpp | 2 ++ src/komodo_notary.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 1b82c32af..6c92cfe07 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -17,6 +17,8 @@ const char *notaries_STAKEDcc[][2] = {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9e6f17097..105f4a5b1 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -34,6 +34,8 @@ const char *notaries_STAKED[][2] = {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx }; #define KOMODO_MAINNET_START 178999 From b3c526f9c667aa14f49b1c7028f77f558f632526 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 10 Sep 2018 20:28:20 +0800 Subject: [PATCH 0059/4463] add placeholder 15th pubkey --- src/crosschain_authority.cpp | 1 + src/komodo_notary.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 6c92cfe07..33b868e3a 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -19,6 +19,7 @@ const char *notaries_STAKEDcc[][2] = {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, + {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, }; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 105f4a5b1..a08e7fc97 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -36,6 +36,7 @@ const char *notaries_STAKED[][2] = {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. }; #define KOMODO_MAINNET_START 178999 From 63fe933da5c566dd772918bc0e5726dbee048584 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 10 Sep 2018 20:30:04 +0800 Subject: [PATCH 0060/4463] notaries_staked.h bounty to fix this is valid --- src/notaries_STAKED.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index f75c453b6..a92d71684 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -2,13 +2,19 @@ const char *notaries_STAKED[][2] = { - {"alright", "03b4f49a1c22087e0a9dfaa87aef98ef496c544f9f86038f6c9fea4550543a7679"}, - {"test1", "0323b1271dceb046a91e79bf80fc5874fb51b9a5ad572c50ca5f58ee9444b32965"}, - {"test2", "027b45bc21781c287b06b4af48081b49c9ff42cf9e925a8b32dc28a9e85edd2ccd"}, - {"test3", "023142dd900025a812c985e0c8d8730cbe7791126b8ceac71a506eeee1cb4d2633"}, - {"test4", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 - {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "03d01b559004b88fe71f9034ca25c7da0c142e4428afc969473dfbd101c984e7b4" }, // RKjJctJfaExgzcUgbrZDTqzzhxeaC5HP3G + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, + {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. }; From b22e7d44f43f2a3247d14a34478d13e28d4a5e72 Mon Sep 17 00:00:00 2001 From: blackjok3rtt Date: Tue, 11 Sep 2018 14:09:04 +0000 Subject: [PATCH 0061/4463] add modofication to stop normal komodo repo using staked chains --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d98418c82..4856931ac 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1554,7 +1554,7 @@ void komodo_args(char *argv0) if ( name.c_str()[0] != 0 ) { MAX_BLOCK_SIGOPS = 60000; - ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); + ASSETCHAINS_SUPPLY = ( GetArg("-ac_supply",10) + 1 ); ASSETCHAINS_ENDSUBSIDY = GetArg("-ac_end",0); ASSETCHAINS_REWARD = GetArg("-ac_reward",0); ASSETCHAINS_HALVING = GetArg("-ac_halving",0); From 139aca9821e857775ba2962c5f8970e82667345b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 12 Sep 2018 21:22:05 +0800 Subject: [PATCH 0062/4463] Add smk762 --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 21d824f9e..f5eed2fb0 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -10,7 +10,7 @@ const char *notaries_STAKEDcc[][2] = {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, + {"smk762", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 15932378b..ddea06e2c 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -27,7 +27,7 @@ const char *notaries_STAKED[][2] = {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"xrobesx", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, + {"smk762", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 From 2333d409375d4a1ab2d6b71aee4aeebf507ea735 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 12 Sep 2018 23:34:28 +0800 Subject: [PATCH 0063/4463] FIX STKD != STAKED --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index f5eed2fb0..6553b66d3 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -27,7 +27,7 @@ int GetSymbolAuthority(const char* symbol) { if (strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) + if (strlen(symbol) >= 6 && strncmp(symbol, "STKD", 4) == 0) return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } diff --git a/src/komodo_notary.h b/src/komodo_notary.h index ddea06e2c..618cecd5d 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -247,7 +247,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - if ( strncmp("STAKED",ASSETCHAINS_SYMBOL,6) == 0 ) + if ( strncmp("STKD",ASSETCHAINS_SYMBOL,4) == 0 ) { n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); for (i=0; i Date: Wed, 12 Sep 2018 23:51:25 +0800 Subject: [PATCH 0064/4463] Fix --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 6553b66d3..af8f82b6f 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -27,7 +27,7 @@ int GetSymbolAuthority(const char* symbol) { if (strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (strlen(symbol) >= 6 && strncmp(symbol, "STKD", 4) == 0) + if (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } From 55215da21811a10871eab3d45c28321dc5c481b9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 00:03:41 +0800 Subject: [PATCH 0065/4463] not sure --- src/crosschain_authority.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index af8f82b6f..e383272cb 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -5,24 +5,25 @@ const char *notaries_STAKEDcc[][2] = { - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"smk762", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, - {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, - {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, + {"smk762", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. }; + int GetSymbolAuthority(const char* symbol) { if (strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0) From 4aa70c42538d5f3898e570deba0d45e1e308dbd7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 02:07:47 +0800 Subject: [PATCH 0066/4463] put metaphillibert back in ... etf happened there LOL --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index e383272cb..ec8a286ce 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -16,7 +16,7 @@ const char *notaries_STAKEDcc[][2] = {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 618cecd5d..fd7e31864 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -33,7 +33,7 @@ const char *notaries_STAKED[][2] = {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. From a025b6f4e707c314a18de0667050101f757aea83 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 02:13:14 +0800 Subject: [PATCH 0067/4463] fix smk WTF?!? --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index ec8a286ce..75bb3d516 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -10,7 +10,7 @@ const char *notaries_STAKEDcc[][2] = {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"smk762", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 diff --git a/src/komodo_notary.h b/src/komodo_notary.h index fd7e31864..0c010a962 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -27,7 +27,7 @@ const char *notaries_STAKED[][2] = {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, - {"smk762", "020a403b030211c87c77fc3d397db91313d96b3b43b86ca15cb08481508a7f754f" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 From bd2169b57dc5adcdc5276c3202724fe4e3d76988 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 13 Sep 2018 12:37:28 +0800 Subject: [PATCH 0068/4463] Add some keys, and change to use STKD and STAKED. --- src/crosschain_authority.cpp | 7 +++---- src/komodo_notary.h | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 75bb3d516..13f27fb4c 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -9,7 +9,6 @@ const char *notaries_STAKEDcc[][2] = {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev @@ -19,16 +18,16 @@ const char *notaries_STAKEDcc[][2] = {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN }; - int GetSymbolAuthority(const char* symbol) { if (strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) + if ( (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) || (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) ) return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 0c010a962..1872d49ca 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -26,7 +26,6 @@ const char *notaries_STAKED[][2] = {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev @@ -36,7 +35,8 @@ const char *notaries_STAKED[][2] = {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"ca333", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - placeholder, blackjok3r has a privkey for this if needed to be used. + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN }; #define KOMODO_MAINNET_START 178999 @@ -247,7 +247,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - if ( strncmp("STKD",ASSETCHAINS_SYMBOL,4) == 0 ) + if ( (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) || (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) ) { n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); for (i=0; i Date: Thu, 13 Sep 2018 13:50:47 +0800 Subject: [PATCH 0069/4463] fix stupid mistake --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 1872d49ca..28797a003 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -247,7 +247,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - if ( (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) || (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) ) + if ( (strlen(ASSETCHAINS_SYMBOL) >= 4 && strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strlen(ASSETCHAINS_SYMBOL) >= 6 && strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) { n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); for (i=0; i Date: Thu, 13 Sep 2018 19:10:52 +0800 Subject: [PATCH 0070/4463] remove one pubkey just incase --- src/crosschain_authority.cpp | 1 - src/komodo_notary.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 13f27fb4c..b6b6c22e7 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -13,7 +13,6 @@ const char *notaries_STAKEDcc[][2] = {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 28797a003..05c7f0f42 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -30,7 +30,6 @@ const char *notaries_STAKED[][2] = {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"titomane", "0222d144bbf15280c574a0ccdc4f390f87779504692fef6e567543c03aa057dfcf" }, //RUS5jcf55AupeEDjotmKLeXnLZye2rwoUg {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu From c0128ed414fda99c0b9193776a399e582dc0dea1 Mon Sep 17 00:00:00 2001 From: blackjok3rtt <30971146+blackjok3rtt@users.noreply.github.com> Date: Sat, 15 Sep 2018 14:17:18 +0800 Subject: [PATCH 0071/4463] fix issue where if there are not two notarisations the MoMoM is indeterninate --- src/crosschain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 76771b186..16fc5e854 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -80,6 +80,11 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh } } } + + // Not enough own notarisations found to return determinate MoMoM + destNotarisationTxid = uint256(); + moms.clear(); + return uint256(); end: return GetMerkleRoot(moms); From 1444ed4e2d92d3d74e5f01a27ac01f2652127b83 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 19 Sep 2018 14:51:41 +0800 Subject: [PATCH 0072/4463] add print of MoMoM data each time it is called. --- src/cc/import.cpp | 6 +++--- src/crosschain.cpp | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index ffc94ac43..988264aa6 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -37,7 +37,7 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!UnmarshalImportTx(importTx, proof, burnTx, payouts)) return Invalid("invalid-params"); - + // Control all aspects of this transaction // It should not be at all malleable if (MakeImportCoinTransaction(proof, burnTx, payouts).GetHash() != importTx.GetHash()) @@ -79,6 +79,8 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); + printf("momom: %s\n", momom.GetHex().data()) + target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) return Invalid("momom-check-fail"); @@ -86,5 +88,3 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp return Valid(); } - - diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 8d886ece6..97e6d9823 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -80,7 +80,7 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh } } } - + // Not enough own notarisations found to return determinate MoMoM destNotarisationTxid = uint256(); moms.clear(); @@ -162,6 +162,8 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ if (MoMoM.IsNull()) throw std::runtime_error("No MoMs found"); + printf("momom: %s\n", MoMoM.GetHex().data()) + // Find index of source MoM in MoMoM int nIndex; for (nIndex=0; nIndex Date: Wed, 19 Sep 2018 14:52:22 +0800 Subject: [PATCH 0073/4463] ; --- src/cc/import.cpp | 4 ++-- src/crosschain.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index 988264aa6..7224c40cd 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -79,8 +79,8 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - printf("momom: %s\n", momom.GetHex().data()) - + printf("momom: %s\n", momom.GetHex().data()); + target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) return Invalid("momom-check-fail"); diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 97e6d9823..82d4be193 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -162,8 +162,8 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ if (MoMoM.IsNull()) throw std::runtime_error("No MoMs found"); - printf("momom: %s\n", MoMoM.GetHex().data()) - + printf("momom: %s\n", MoMoM.GetHex().data()); + // Find index of source MoM in MoMoM int nIndex; for (nIndex=0; nIndex Date: Wed, 19 Sep 2018 15:31:09 +0800 Subject: [PATCH 0074/4463] make it so prints are diffrent. --- src/cc/import.cpp | 2 +- src/crosschain.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index 7224c40cd..cc0c3b61f 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -79,7 +79,7 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - printf("momom: %s\n", momom.GetHex().data()); + printf("IMPORT momom: %s\n", momom.GetHex().data()); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 82d4be193..23416c682 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -162,7 +162,7 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ if (MoMoM.IsNull()) throw std::runtime_error("No MoMs found"); - printf("momom: %s\n", MoMoM.GetHex().data()); + printf("GetCrossChainProof MoMoM: %s\n", MoMoM.GetHex().data()); // Find index of source MoM in MoMoM int nIndex; From d1b74ce6d19ecfad8a2e4ac404e27a43bef20e1b Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Wed, 19 Sep 2018 18:50:38 +0200 Subject: [PATCH 0075/4463] hard fork mandatory update --- src/komodo_notary.h | 3 +++ src/version.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index c2645b3f2..e0851b209 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -36,6 +36,9 @@ const char *notaries_STAKED[][2] = {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; #define KOMODO_MAINNET_START 178999 diff --git a/src/version.h b/src/version.h index 25527895d..1efbecdf8 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170003; +static const int PROTOCOL_VERSION = 170004; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -18,7 +18,7 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 170002; +static const int MIN_PEER_PROTO_VERSION = 170004; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this From 3a9b05001400575cd6f54deca233ac12d84873fb Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Wed, 19 Sep 2018 18:52:22 +0200 Subject: [PATCH 0076/4463] whoops --- src/crosschain_authority.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index b6b6c22e7..d635e6e22 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -19,6 +19,9 @@ const char *notaries_STAKEDcc[][2] = {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; From c2059876c3a13c60d4d41c0c31b0e2417dd005af Mon Sep 17 00:00:00 2001 From: Alrighttt <36680730+Alrighttt@users.noreply.github.com> Date: Wed, 19 Sep 2018 13:38:33 -0400 Subject: [PATCH 0077/4463] Update version.h --- src/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.h b/src/version.h index 1efbecdf8..25527895d 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170004; +static const int PROTOCOL_VERSION = 170003; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -18,7 +18,7 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 170004; +static const int MIN_PEER_PROTO_VERSION = 170002; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this From 3330881171f284e9edc2b578e681237f551aedd3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 20 Sep 2018 22:44:41 +0800 Subject: [PATCH 0078/4463] Use min sigs = 3 for staked chains, so we can add more pubkeys. --- src/crosschain_authority.cpp | 2 +- src/komodo.h | 5 +++-- src/komodo_notary.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index b6b6c22e7..30e4e725a 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -73,7 +73,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; auth.size = (int32_t)(sizeof(notaries_STAKEDcc)/sizeof(*notaries_STAKEDcc)); - auth.requiredSigs = (auth.size/5); + auth.requiredSigs = 3; for (int n=0; n= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || - numvalid > (numnotaries/5)) ) + numvalid > (numnotaries/5)) || + ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) && numvalid > 3 ) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index c2645b3f2..c2e7ed631 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -246,7 +246,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - if ( (strlen(ASSETCHAINS_SYMBOL) >= 4 && strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strlen(ASSETCHAINS_SYMBOL) >= 6 && strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) + if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) { n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); for (i=0; i Date: Thu, 20 Sep 2018 23:15:00 +0800 Subject: [PATCH 0079/4463] Change min protcol version so STAKED chains have their own value, so KMD can still work. --- src/main.cpp | 1128 +++++++++++++++++++++++++------------------------ src/version.h | 3 +- 2 files changed, 573 insertions(+), 558 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4edb4f604..73a1ff364 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -114,30 +114,30 @@ const string strMessageMagic = "Komodo Signed Message:\n"; // Internal stuff namespace { - + struct CBlockIndexWorkComparator { bool operator()(CBlockIndex *pa, CBlockIndex *pb) const { // First sort by most total work, ... if (pa->nChainWork > pb->nChainWork) return false; if (pa->nChainWork < pb->nChainWork) return true; - + // ... then by earliest time received, ... if (pa->nSequenceId < pb->nSequenceId) return false; if (pa->nSequenceId > pb->nSequenceId) return true; - + // Use pointer address as tie breaker (should only happen with blocks // loaded from disk, as those all have id 0). if (pa < pb) return false; if (pa > pb) return true; - + // Identical blocks. return false; } }; - + CBlockIndex *pindexBestInvalid; - + /** * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be @@ -150,7 +150,7 @@ namespace { * Pruned nodes may have entries where B is missing data. */ multimap mapBlocksUnlinked; - + CCriticalSection cs_LastBlockFile; std::vector vinfoBlockFile; int nLastBlockFile = 0; @@ -159,7 +159,7 @@ namespace { * or if we allocate more file space when we're in prune mode */ bool fCheckForPruning = false; - + /** * Every received block is assigned a unique and increasing identifier, so we * know which one to give priority in case of a fork. @@ -167,14 +167,14 @@ namespace { CCriticalSection cs_nBlockSequenceId; /** Blocks loaded from disk are assigned id 0, so start the counter at 1. */ uint32_t nBlockSequenceId = 1; - + /** * Sources of received blocks, saved to be able to send them reject * messages or ban them when processing happens afterwards. Protected by * cs_main. */ map mapBlockSource; - + /** * Filter for transactions that were recently rejected by * AcceptToMemoryPool. These are not rerequested until the chain tip @@ -197,7 +197,7 @@ namespace { */ boost::scoped_ptr recentRejects; uint256 hashRecentRejectsChainTip; - + /** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ struct QueuedBlock { uint256 hash; @@ -207,16 +207,16 @@ namespace { int64_t nTimeDisconnect; //! The timeout for this block request (for disconnecting a slow peer) }; map::iterator> > mapBlocksInFlight; - + /** Number of blocks in flight with validated headers. */ int nQueuedValidatedHeaders = 0; - + /** Number of preferable block download peers. */ int nPreferredDownload = 0; - + /** Dirty block index entries. */ set setDirtyBlockIndex; - + /** Dirty block file entries. */ set setDirtyFileInfo; } // anon namespace @@ -227,13 +227,13 @@ namespace { // namespace { - + struct CBlockReject { unsigned char chRejectCode; string strRejectReason; uint256 hashBlock; }; - + /** * Maintain validation-specific state about nodes, protected by cs_main, instead * by CNode's own locks. This simplifies asynchronous operation, where @@ -268,7 +268,7 @@ namespace { int nBlocksInFlightValidHeaders; //! Whether we consider this a preferred download peer. bool fPreferredDownload; - + CNodeState() { fCurrentlyConnected = false; nMisbehavior = 0; @@ -283,10 +283,10 @@ namespace { fPreferredDownload = false; } }; - + /** Map maintaining per-node state. Requires cs_main. */ map mapNodeState; - + // Requires cs_main. CNodeState *State(NodeId pnode) { map::iterator it = mapNodeState.find(pnode); @@ -294,67 +294,67 @@ namespace { return NULL; return &it->second; } - + int GetHeight() { LOCK(cs_main); return chainActive.Height(); } - + void UpdatePreferredDownload(CNode* node, CNodeState* state) { nPreferredDownload -= state->fPreferredDownload; - + // Whether this node should be marked as a preferred download node. state->fPreferredDownload = (!node->fInbound || node->fWhitelisted) && !node->fOneShot && !node->fClient; - + nPreferredDownload += state->fPreferredDownload; } - + // Returns time at which to timeout block request (nTime in microseconds) int64_t GetBlockTimeout(int64_t nTime, int nValidatedQueuedBefore, const Consensus::Params &consensusParams) { return nTime + 500000 * consensusParams.nPowTargetSpacing * (4 + nValidatedQueuedBefore); } - + void InitializeNode(NodeId nodeid, const CNode *pnode) { LOCK(cs_main); CNodeState &state = mapNodeState.insert(std::make_pair(nodeid, CNodeState())).first->second; state.name = pnode->addrName; state.address = pnode->addr; } - + void FinalizeNode(NodeId nodeid) { LOCK(cs_main); CNodeState *state = State(nodeid); - + if (state->fSyncStarted) nSyncStarted--; - + if (state->nMisbehavior == 0 && state->fCurrentlyConnected) { AddressCurrentlyConnected(state->address); } - + BOOST_FOREACH(const QueuedBlock& entry, state->vBlocksInFlight) mapBlocksInFlight.erase(entry.hash); EraseOrphansFor(nodeid); nPreferredDownload -= state->fPreferredDownload; - + mapNodeState.erase(nodeid); } - + void LimitMempoolSize(CTxMemPool& pool, size_t limit, unsigned long age) { /* int expired = pool.Expire(GetTime() - age); if (expired != 0) LogPrint("mempool", "Expired %i transactions from the memory pool\n", expired); - + std::vector vNoSpendsRemaining; pool.TrimToSize(limit, &vNoSpendsRemaining); BOOST_FOREACH(const uint256& removed, vNoSpendsRemaining) pcoinsTip->Uncache(removed);*/ } - + // Requires cs_main. // Returns a bool indicating whether we requested this block. bool MarkBlockAsReceived(const uint256& hash) { @@ -371,15 +371,15 @@ namespace { } return false; } - + // Requires cs_main. void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const Consensus::Params& consensusParams, CBlockIndex *pindex = NULL) { CNodeState *state = State(nodeid); assert(state != NULL); - + // Make sure it's not listed somewhere already. MarkBlockAsReceived(hash); - + int64_t nNow = GetTimeMicros(); QueuedBlock newentry = {hash, pindex, nNow, pindex != NULL, GetBlockTimeout(nNow, nQueuedValidatedHeaders, consensusParams)}; nQueuedValidatedHeaders += newentry.fValidatedHeaders; @@ -388,12 +388,12 @@ namespace { state->nBlocksInFlightValidHeaders += newentry.fValidatedHeaders; mapBlocksInFlight[hash] = std::make_pair(nodeid, it); } - + /** Check whether the last unknown block a peer advertized is not yet known. */ void ProcessBlockAvailability(NodeId nodeid) { CNodeState *state = State(nodeid); assert(state != NULL); - + if (!state->hashLastUnknownBlock.IsNull()) { BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock); if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) @@ -404,14 +404,14 @@ namespace { } } } - + /** Update tracking information about which blocks a peer is assumed to have. */ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) { CNodeState *state = State(nodeid); assert(state != NULL); - + /*ProcessBlockAvailability(nodeid); - + BlockMap::iterator it = mapBlockIndex.find(hash); if (it != mapBlockIndex.end() && it->second->nChainWork > 0) { // An actually better block was announced. @@ -423,7 +423,7 @@ namespace { state->hashLastUnknownBlock = hash; } } - + /** Find the last common ancestor two blocks have. * Both pa and pb must be non-NULL. */ CBlockIndex* LastCommonAncestor(CBlockIndex* pa, CBlockIndex* pb) { @@ -432,47 +432,47 @@ namespace { } else if (pb->nHeight > pa->nHeight) { pb = pb->GetAncestor(pa->nHeight); } - + while (pa != pb && pa && pb) { pa = pa->pprev; pb = pb->pprev; } - + // Eventually all chain branches meet at the genesis block. assert(pa == pb); return pa; } - + /** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has * at most count entries. */ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector& vBlocks, NodeId& nodeStaller) { if (count == 0) return; - + vBlocks.reserve(vBlocks.size() + count); CNodeState *state = State(nodeid); assert(state != NULL); - + // Make sure pindexBestKnownBlock is up to date, we'll need it. ProcessBlockAvailability(nodeid); - + if (state->pindexBestKnownBlock == NULL || state->pindexBestKnownBlock->nChainWork < chainActive.Tip()->nChainWork) { // This peer has nothing interesting. return; } - + if (state->pindexLastCommonBlock == NULL) { // Bootstrap quickly by guessing a parent of our best tip is the forking point. // Guessing wrong in either direction is not a problem. state->pindexLastCommonBlock = chainActive[std::min(state->pindexBestKnownBlock->nHeight, chainActive.Height())]; } - + // If the peer reorganized, our previous pindexLastCommonBlock may not be an ancestor // of its current tip anymore. Go back enough to fix that. state->pindexLastCommonBlock = LastCommonAncestor(state->pindexLastCommonBlock, state->pindexBestKnownBlock); if (state->pindexLastCommonBlock == state->pindexBestKnownBlock) return; - + std::vector vToFetch; CBlockIndex *pindexWalk = state->pindexLastCommonBlock; // Never fetch further than the best block we know the peer has, or more than BLOCK_DOWNLOAD_WINDOW + 1 beyond the last @@ -492,7 +492,7 @@ namespace { for (unsigned int i = nToFetch - 1; i > 0; i--) { vToFetch[i - 1] = vToFetch[i]->pprev; } - + // Iterate over those blocks in vToFetch (in forward direction), adding the ones that // are not yet downloaded and not in flight to vBlocks. In the meantime, update // pindexLastCommonBlock as long as all ancestors are already downloaded, or if it's @@ -526,7 +526,7 @@ namespace { } } } - + } // anon namespace bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { @@ -616,7 +616,7 @@ bool AddOrphanTx(const CTransaction& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(c uint256 hash = tx.GetHash(); if (mapOrphanTransactions.count(hash)) return false; - + // Ignore big transactions, to avoid a // send-big-orphans memory exhaustion attack. If a peer has a legitimate // large transaction with a missing parent then we assume @@ -630,12 +630,12 @@ bool AddOrphanTx(const CTransaction& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(c LogPrint("mempool", "ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString()); return false; } - + mapOrphanTransactions[hash].tx = tx; mapOrphanTransactions[hash].fromPeer = peer; BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); - + LogPrint("mempool", "stored orphan tx %s (mapsz %u prevsz %u)\n", hash.ToString(), mapOrphanTransactions.size(), mapOrphanTransactionsByPrev.size()); return true; @@ -695,7 +695,7 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight) { bool isOverwinter = NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER); - + if (isOverwinter) { // Overwinter standard rules apply if (tx.nVersion > CTransaction::OVERWINTER_MAX_CURRENT_VERSION || tx.nVersion < CTransaction::OVERWINTER_MIN_CURRENT_VERSION) { @@ -709,7 +709,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight) return false; } } - + BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed @@ -728,7 +728,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight) return false; } } - + unsigned int v=0,nDataOut = 0; txnouttype whichType; BOOST_FOREACH(const CTxOut& txout, tx.vout) @@ -739,7 +739,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight) //fprintf(stderr,">>>>>>>>>>>>>>> vout.%d nDataout.%d\n",v,nDataOut); return false; } - + if (whichType == TX_NULL_DATA) { if ( txout.scriptPubKey.size() > IGUANA_MAXSCRIPTSIZE ) @@ -759,13 +759,13 @@ bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight) } v++; } - + // only one OP_RETURN txout is permitted if (nDataOut > 1) { reason = "multi-op-return"; return false; } - + return true; } @@ -780,7 +780,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) { if ( txin.nSequence == 0xfffffffe && (((int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime > nBlockTime) || ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime > nBlockHeight)) ) { - + } else if (!txin.IsFinal()) { @@ -802,7 +802,7 @@ bool IsExpiredTx(const CTransaction &tx, int nBlockHeight) bool CheckFinalTx(const CTransaction &tx, int flags) { AssertLockHeld(cs_main); - + // By convention a negative value for flags indicates that the // current network-enforced consensus rules should be used. In // a future soft-fork scenario that would mean checking which @@ -810,7 +810,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags) // appropriate flags. At the present time no soft-forks are // scheduled, so no flags are set. flags = std::max(flags, 0); - + // CheckFinalTx() uses chainActive.Height()+1 to evaluate // nLockTime because when IsFinalTx() is called within // CBlock::AcceptBlock(), the height of the block *being* @@ -818,7 +818,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags) // transaction can be part of the *next* block, we need to call // IsFinalTx() with one more than chainActive.Height(). const int nBlockHeight = chainActive.Height() + 1; - + // Timestamps on the other hand don't get any special treatment, // because we can't know what timestamp the next block will have, // and there aren't timestamp applications where it matters. @@ -826,7 +826,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags) const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime(); - + return IsFinalTx(tx, nBlockHeight, nBlockTime); } @@ -850,7 +850,7 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, for (unsigned int i = 0; i < tx.vin.size(); i++) { const CTxOut& prev = mapInputs.GetOutputFor(tx.vin[i]); - + vector > vSolutions; txnouttype whichType; // get the scriptPubKey corresponding to this input: @@ -860,7 +860,7 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions); if (nArgsExpected < 0) return false; - + // Transactions with extra stuff in their scriptSigs are // non-standard. Note that this EvalScript() call will // be quick, because if there are any operations @@ -870,7 +870,7 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, vector > stack; if (!EvalScript(stack, tx.vin[i].scriptSig, SCRIPT_VERIFY_NONE, BaseSignatureChecker(), consensusBranchId)) return false; - + if (whichType == TX_SCRIPTHASH) { if (stack.empty()) @@ -893,11 +893,11 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, return (sigops <= MAX_P2SH_SIGOPS); } } - + if (stack.size() != (unsigned int)nArgsExpected) return false; } - + return true; } @@ -919,7 +919,7 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in { if (tx.IsCoinBase() || tx.IsCoinImport()) return 0; - + unsigned int nSigOps = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) { @@ -942,13 +942,13 @@ bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state, { bool isOverwinter = NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER); bool isSprout = !isOverwinter; - + // If Sprout rules apply, reject transactions which are intended for Overwinter and beyond if (isSprout && tx.fOverwintered) { return state.DoS(dosLevel, error("ContextualCheckTransaction(): overwinter is not active yet"), REJECT_INVALID, "tx-overwinter-not-active"); } - + // If Overwinter rules apply: if (isOverwinter) { // Reject transactions with valid version but missing overwinter flag @@ -956,19 +956,19 @@ bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state, return state.DoS(dosLevel, error("ContextualCheckTransaction(): overwinter flag must be set"), REJECT_INVALID, "tx-overwinter-flag-not-set"); } - + // Reject transactions with invalid version if (tx.fOverwintered && tx.nVersion > OVERWINTER_MAX_TX_VERSION ) { return state.DoS(100, error("CheckTransaction(): overwinter version too high"), REJECT_INVALID, "bad-tx-overwinter-version-too-high"); } - + // Reject transactions intended for Sprout if (!tx.fOverwintered) { return state.DoS(dosLevel, error("ContextualCheckTransaction: overwinter is active"), REJECT_INVALID, "tx-overwinter-active"); } - + // Check that all transactions are unexpired if (IsExpiredTx(tx, nHeight)) { return state.DoS(dosLevel, error("ContextualCheckTransaction(): transaction is expired"), REJECT_INVALID, "tx-overwinter-expired"); @@ -986,9 +986,9 @@ bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state, return state.DoS(100, error("CheckTransaction(): error computing signature hash"), REJECT_INVALID, "error-computing-signature-hash"); } - + BOOST_STATIC_ASSERT(crypto_sign_PUBLICKEYBYTES == 32); - + // We rely on libsodium to check that the signature is canonical. // https://github.com/jedisct1/libsodium/commit/62911edb7ff2275cccd74bf1c8aefcc4d76924e0 if (crypto_sign_verify_detached(&tx.joinSplitSig[0], @@ -1026,7 +1026,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, if (!tx.IsCoinBase()) { transactionsValidated.increment(); } - + if (!CheckTransactionWithoutProofVerification(tx, state)) { return false; } else { @@ -1044,7 +1044,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidationState &state) { // Basic checks that don't depend on any context - + /** * Previously: * 1. The consensus rule below was: @@ -1085,7 +1085,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio REJECT_INVALID, "bad-tx-expiry-height-too-high"); } } - + // Transactions can contain empty `vin` and `vout` so long as // `vjoinsplit` is non-empty. // Migrations may also have empty `vin` @@ -1095,13 +1095,13 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio if (tx.vout.empty() && tx.vjoinsplit.empty()) return state.DoS(10, error("CheckTransaction(): vout empty"), REJECT_INVALID, "bad-txns-vout-empty"); - + // Size limits BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE > MAX_TX_SIZE); // sanity if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_TX_SIZE) return state.DoS(100, error("CheckTransaction(): size limits failed"), REJECT_INVALID, "bad-txns-oversize"); - + // Check for negative or overflow output values CAmount nValueOut = 0; int32_t iscoinbase = tx.IsCoinBase(); @@ -1128,7 +1128,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio return state.DoS(100, error("CheckTransaction(): txout total out of range"), REJECT_INVALID, "bad-txns-txouttotal-toolarge"); } - + // Ensure that joinsplit values are well-formed BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit) { @@ -1141,34 +1141,34 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_old negative"), REJECT_INVALID, "bad-txns-vpub_old-negative"); } - + if (joinsplit.vpub_new < 0) { return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_new negative"), REJECT_INVALID, "bad-txns-vpub_new-negative"); } - + if (joinsplit.vpub_old > MAX_MONEY) { return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_old too high"), REJECT_INVALID, "bad-txns-vpub_old-toolarge"); } - + if (joinsplit.vpub_new > MAX_MONEY) { return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_new too high"), REJECT_INVALID, "bad-txns-vpub_new-toolarge"); } - + if (joinsplit.vpub_new != 0 && joinsplit.vpub_old != 0) { return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_new and joinsplit.vpub_old both nonzero"), REJECT_INVALID, "bad-txns-vpubs-both-nonzero"); } - + nValueOut += joinsplit.vpub_old; if (!MoneyRange(nValueOut)) { return state.DoS(100, error("CheckTransaction(): txout total out of range"), REJECT_INVALID, "bad-txns-txouttotal-toolarge"); } } - + // Ensure input values do not exceed MAX_MONEY // We have not resolved the txin values at this stage, // but we do know what the joinsplits claim to add @@ -1178,15 +1178,15 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio for (std::vector::const_iterator it(tx.vjoinsplit.begin()); it != tx.vjoinsplit.end(); ++it) { nValueIn += it->vpub_new; - + if (!MoneyRange(it->vpub_new) || !MoneyRange(nValueIn)) { return state.DoS(100, error("CheckTransaction(): txin total out of range"), REJECT_INVALID, "bad-txns-txintotal-toolarge"); } } } - - + + // Check for duplicate inputs set vInOutPoints; BOOST_FOREACH(const CTxIn& txin, tx.vin) @@ -1196,7 +1196,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio REJECT_INVALID, "bad-txns-inputs-duplicate"); vInOutPoints.insert(txin.prevout); } - + // Check for duplicate joinsplit nullifiers in this transaction set vJoinSplitNullifiers; BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit) @@ -1206,18 +1206,18 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio if (vJoinSplitNullifiers.count(nf)) return state.DoS(100, error("CheckTransaction(): duplicate nullifiers"), REJECT_INVALID, "bad-joinsplits-nullifiers-duplicate"); - + vJoinSplitNullifiers.insert(nf); } } - + if (tx.IsMint()) { // There should be no joinsplits in a coinbase transaction if (tx.vjoinsplit.size() > 0) return state.DoS(100, error("CheckTransaction(): coinbase has joinsplits"), REJECT_INVALID, "bad-cb-has-joinsplits"); - + if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100) return state.DoS(100, error("CheckTransaction(): coinbase script size"), REJECT_INVALID, "bad-cb-length"); @@ -1229,7 +1229,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio return state.DoS(10, error("CheckTransaction(): prevout is null"), REJECT_INVALID, "bad-txns-prevout-null"); } - + return true; } @@ -1245,9 +1245,9 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF if (dPriorityDelta > 0 || nFeeDelta > 0) return 0; } - + CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes); - + if (fAllowFree) { // There is a free transaction area in blocks created by most miners, @@ -1257,7 +1257,7 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF if (nBytes < (DEFAULT_BLOCK_PRIORITY_SIZE - 1000)) nMinFee = 0; } - + if (!MoneyRange(nMinFee)) nMinFee = MAX_MONEY; return nMinFee; @@ -1269,10 +1269,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa AssertLockHeld(cs_main); if (pfMissingInputs) *pfMissingInputs = false; - + int flag=0,nextBlockHeight = chainActive.Height() + 1; auto consensusBranchId = CurrentEpochBranchId(nextBlockHeight, Params().GetConsensus()); - + // Node operator can choose to reject tx by number of transparent inputs static_assert(std::numeric_limits::max() >= std::numeric_limits::max(), "size_t too small"); size_t limit = (size_t) GetArg("-mempooltxinputlimit", 0); @@ -1283,7 +1283,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa return false; } } - + auto verifier = libzcash::ProofVerifier::Strict(); if ( komodo_validate_interest(tx,chainActive.LastTip()->nHeight+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 ) { @@ -1300,7 +1300,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa { return error("AcceptToMemoryPool: ContextualCheckTransaction failed"); } - + // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) { @@ -1329,7 +1329,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa //fprintf(stderr,"already in mempool\n"); return state.Invalid(false, REJECT_DUPLICATE, "already in mempool"); } - + // Check for conflicts with in-memory transactions { LOCK(pool.cs); // protect pool.mapNextTx @@ -1357,7 +1357,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } } } - + { CCoinsView dummy; CCoinsViewCache view(&dummy); @@ -1367,14 +1367,14 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa LOCK(pool.cs); CCoinsViewMemPool viewMemPool(pcoinsTip, pool); view.SetBackend(viewMemPool); - + // do we already have it? if (view.HaveCoins(hash)) { //fprintf(stderr,"view.HaveCoins(hash) error\n"); return state.Invalid(false, REJECT_DUPLICATE, "already have coins"); } - + if (tx.IsCoinImport()) { // Inverse of normal case; if input exists, it's been spent @@ -1396,7 +1396,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa return false; } } - + // are the actual inputs available? if (!view.HaveInputs(tx)) { @@ -1410,21 +1410,21 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa //fprintf(stderr,"accept failure.2\n"); return state.Invalid(error("AcceptToMemoryPool: joinsplit requirements not met"),REJECT_DUPLICATE, "bad-txns-joinsplit-requirements-not-met"); } - + // Bring the best block into scope view.GetBestBlock(); - + nValueIn = view.GetValueIn(chainActive.LastTip()->nHeight,&interest,tx,chainActive.LastTip()->nTime); if ( 0 && interest != 0 ) fprintf(stderr,"add interest %.8f\n",(double)interest/COIN); // we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool view.SetBackend(dummy); } - + // Check for non-standard pay-to-script-hash in inputs if (Params().RequireStandard() && !AreInputsStandard(tx, view, consensusBranchId)) return error("AcceptToMemoryPool: reject nonstandard transaction input"); - + // Check that the transaction doesn't have an excessive number of // sigops, making it impossible to mine. Since the coinbase transaction // itself can contain sigops MAX_STANDARD_TX_SIGOPS is less than @@ -1437,11 +1437,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa fprintf(stderr,"accept failure.4\n"); return state.DoS(0, error("AcceptToMemoryPool: too many sigops %s, %d > %d", hash.ToString(), nSigOps, MAX_STANDARD_TX_SIGOPS),REJECT_NONSTANDARD, "bad-txns-too-many-sigops"); } - + CAmount nValueOut = tx.GetValueOut(); CAmount nFees = nValueIn-nValueOut; double dPriority = view.GetPriority(tx, chainActive.Height()); - + // Keep track of transactions that spend a coinbase, which we re-scan // during reorgs to ensure COINBASE_MATURITY is still met. bool fSpendsCoinbase = false; @@ -1454,15 +1454,15 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } } } - + // Grab the branch ID we expect this transaction to commit to. We don't // yet know if it does, but if the entry gets added to the mempool, then // it has passed ContextualCheckInputs and therefore this is correct. auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus()); - + CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx), fSpendsCoinbase, consensusBranchId); unsigned int nSize = entry.GetTxSize(); - + // Accept a tx if it contains joinsplits and has at least the default fee specified by z_sendmany. if (tx.vjoinsplit.size() > 0 && nFees >= ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE) { // In future we will we have more accurate and dynamic computation of fees for tx with joinsplits. @@ -1475,13 +1475,13 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa return state.DoS(0, error("AcceptToMemoryPool: not enough fees %s, %d < %d",hash.ToString(), nFees, txMinFee),REJECT_INSUFFICIENTFEE, "insufficient fee"); } } - + // Require that free transactions have sufficient priority to be mined in the next block. if (GetBoolArg("-relaypriority", false) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))) { fprintf(stderr,"accept failure.6\n"); return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority"); } - + // Continuously rate-limit free (really, very-low-fee) transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make others' transactions take longer to confirm. @@ -1491,9 +1491,9 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa static double dFreeCount; static int64_t nLastTime; int64_t nNow = GetTime(); - + LOCK(csFreeLimiter); - + // Use an exponentially decaying ~10-minute window: dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime)); nLastTime = nNow; @@ -1507,13 +1507,13 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize); dFreeCount += nSize; } - + if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000 && nFees > nValueOut/19 ) { fprintf(stderr,"accept failure.8\n"); return error("AcceptToMemoryPool: absurdly high fees %s, %d > %d",hash.ToString(), nFees, ::minRelayTxFee.GetFee(nSize) * 10000); } - + // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. PrecomputedTransactionData txdata(tx); @@ -1522,7 +1522,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa //fprintf(stderr,"accept failure.9\n"); return error("AcceptToMemoryPool: ConnectInputs failed %s", hash.ToString()); } - + // Check again against just the consensus-critical mandatory script // verification flags, in case of bugs in the standard flags that cause // transactions to pass as valid when they're actually invalid. For @@ -1565,9 +1565,9 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } } } - + SyncWithWallets(tx, NULL); - + return true; } @@ -1685,14 +1685,14 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { CBlockIndex *pindexSlow = NULL; - + LOCK(cs_main); - + if (mempool.lookup(hash, txOut)) { return true; } - + if (fTxIndex) { CDiskTxPos postx; if (pblocktree->ReadTxIndex(hash, postx)) { @@ -1713,7 +1713,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock return true; } } - + if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it int nHeight = -1; { @@ -1725,7 +1725,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock if (nHeight > 0) pindexSlow = chainActive[nHeight]; } - + if (pindexSlow) { CBlock block; if (ReadBlockFromDisk(block, pindexSlow,1)) { @@ -1738,7 +1738,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock } } } - + return false; } @@ -1768,18 +1768,18 @@ bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos, const CMessageHeader::M CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) return error("WriteBlockToDisk: OpenBlockFile failed"); - + // Write index header unsigned int nSize = fileout.GetSerializeSize(block); fileout << FLATDATA(messageStart) << nSize; - + // Write block long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) return error("WriteBlockToDisk: ftell failed"); pos.nPos = (unsigned int)fileOutPos; fileout << block; - + return true; } @@ -1787,7 +1787,7 @@ bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos,bo { uint8_t pubkey33[33]; block.SetNull(); - + // Open history file to read CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) @@ -1795,7 +1795,7 @@ bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos,bo //fprintf(stderr,"readblockfromdisk err A\n"); return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString()); } - + // Read block try { filein >> block; @@ -1813,7 +1813,7 @@ bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos,bo int32_t i; for (i=0; i<33; i++) fprintf(stderr,"%02x",pubkey33[i]); fprintf(stderr," warning unexpected diff at ht.%d\n",height); - + return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString()); } } @@ -1911,14 +1911,14 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) nSubsidy *= (nHeight+1); return nSubsidy; } - + assert(nHeight > consensusParams.SubsidySlowStartShift()); int halvings = (nHeight - consensusParams.SubsidySlowStartShift()) / consensusParams.nSubsidyHalvingInterval;*/ // Force block reward to zero when right shift is undefined. //int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; //if (halvings >= 64) // return 0; - + // Subsidy is cut in half every 840,000 blocks which will occur approximately every 4 years. //nSubsidy >>= halvings; return nSubsidy; @@ -1972,12 +1972,12 @@ void CheckForkWarningConditions() // (we assume we don't get stuck on a fork before the last checkpoint) if (IsInitialBlockDownload()) return; - + // If our best fork is no longer within 288 blocks (+/- 12 hours if no one mines it) // of our head, drop it if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->nHeight >= 288) pindexBestForkTip = NULL; - + if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.LastTip()->nChainWork + (GetBlockProof(*chainActive.LastTip()) * 6))) { if (!fLargeWorkForkFound && pindexBestForkBase) @@ -2022,7 +2022,7 @@ void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) break; pfork = pfork->pprev; } - + // We define a condition where we should warn the user about as a fork of at least 7 blocks // with a tip within 72 blocks (+/- 3 hours if no one mines it) of ours // We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network @@ -2037,7 +2037,7 @@ void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) pindexBestForkTip = pindexNewForkTip; pindexBestForkBase = pfork; } - + CheckForkWarningConditions(); } @@ -2046,11 +2046,11 @@ void Misbehaving(NodeId pnode, int howmuch) { if (howmuch == 0) return; - + CNodeState *state = State(pnode); if (state == NULL) return; - + state->nMisbehavior += howmuch; int banscore = GetArg("-banscore", 101); if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore) @@ -2065,7 +2065,7 @@ void static InvalidChainFound(CBlockIndex* pindexNew) { if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork) pindexBestInvalid = pindexNew; - + LogPrintf("%s: invalid block=%s height=%d log2_work=%.8g date=%s\n", __func__, pindexNew->GetBlockHash().ToString(), pindexNew->nHeight, log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", @@ -2105,7 +2105,7 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund BOOST_FOREACH(const CTxIn &txin, tx.vin) { CCoinsModifier coins = inputs.ModifyCoins(txin.prevout.hash); unsigned nPos = txin.prevout.n; - + if (nPos >= coins->vout.size() || coins->vout[nPos].IsNull()) assert(false); // mark an outpoint spent, and construct undo information @@ -2125,7 +2125,7 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund } } inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight); // add outputs - + // Unorthodox state if (tx.IsCoinImport()) { // add a tombstone for the burnTx @@ -2163,11 +2163,11 @@ namespace Consensus { // for an attacker to attempt to split the network. if (!inputs.HaveInputs(tx)) return state.Invalid(error("CheckInputs(): %s inputs unavailable", tx.GetHash().ToString())); - + // are the JoinSplit's requirements met? if (!inputs.HaveJoinSplitRequirements(tx)) return state.Invalid(error("CheckInputs(): %s JoinSplit requirements not met", tx.GetHash().ToString())); - + CAmount nValueIn = 0; CAmount nFees = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) @@ -2175,7 +2175,7 @@ namespace Consensus { const COutPoint &prevout = tx.vin[i].prevout; const CCoins *coins = inputs.AccessCoins(prevout.hash); assert(coins); - + if (coins->IsCoinBase()) { // Ensure that coinbases are matured if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) { @@ -2183,7 +2183,7 @@ namespace Consensus { error("CheckInputs(): tried to spend coinbase at depth %d", nSpendHeight - coins->nHeight), REJECT_INVALID, "bad-txns-premature-spend-of-coinbase"); } - + // Ensure that coinbases cannot be spent to transparent outputs // Disabled on regtest if (fCoinbaseEnforcedProtectionEnabled && @@ -2194,7 +2194,7 @@ namespace Consensus { REJECT_INVALID, "bad-txns-coinbase-spend-has-transparent-outputs"); } } - + // Check for negative or overflow input values nValueIn += coins->vout[prevout.n].nValue; #ifdef KOMODO_ENABLE_INTEREST @@ -2214,14 +2214,14 @@ namespace Consensus { if (!MoneyRange(coins->vout[prevout.n].nValue) || !MoneyRange(nValueIn)) return state.DoS(100, error("CheckInputs(): txin values out of range"), REJECT_INVALID, "bad-txns-inputvalues-outofrange"); - + } - + nValueIn += tx.GetJoinSplitValueIn(); if (!MoneyRange(nValueIn)) return state.DoS(100, error("CheckInputs(): vpub_old values out of range"), REJECT_INVALID, "bad-txns-inputvalues-outofrange"); - + if (nValueIn < tx.GetValueOut()) { fprintf(stderr,"spentheight.%d valuein %s vs %s error\n",nSpendHeight,FormatMoney(nValueIn).c_str(), FormatMoney(tx.GetValueOut()).c_str()); @@ -2258,14 +2258,14 @@ bool ContextualCheckInputs( if (!Consensus::CheckTxInputs(tx, state, inputs, GetSpendHeight(inputs), consensusParams)) { return false; } - + if (pvChecks) pvChecks->reserve(tx.vin.size()); - + // The first loop above does all the inexpensive checks. // Only if ALL inputs pass do we perform expensive ECDSA signature checks. // Helps prevent CPU exhaustion attacks. - + // Skip ECDSA signature verification when connecting blocks // before the last block chain checkpoint. This is safe because block merkle hashes are // still computed and checked, and any change will be caught at the next checkpoint. @@ -2274,7 +2274,7 @@ bool ContextualCheckInputs( const COutPoint &prevout = tx.vin[i].prevout; const CCoins* coins = inputs.AccessCoins(prevout.hash); assert(coins); - + // Verify signature CScriptCheck check(*coins, tx, i, flags, cacheStore, consensusBranchId, &txdata); if (pvChecks) { @@ -2322,7 +2322,7 @@ bool ContextualCheckInputs( fprintf(stderr,"ContextualCheckInputs failure.0\n"); return false; } - + if (!tx.IsCoinBase()) { // While checking, GetBestBlock() refers to the parent block. @@ -2336,60 +2336,60 @@ bool ContextualCheckInputs( // Assertion is okay because NonContextualCheckInputs ensures the inputs // are available. assert(coins); - + // If prev is coinbase, check that it's matured if (coins->IsCoinBase()) { if ( ASSETCHAINS_SYMBOL[0] == 0 ) COINBASE_MATURITY = _COINBASE_MATURITY; if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) { fprintf(stderr,"ContextualCheckInputs failure.1 i.%d of %d\n",i,(int32_t)tx.vin.size()); - + return state.Invalid( error("CheckInputs(): tried to spend coinbase at depth %d", nSpendHeight - coins->nHeight),REJECT_INVALID, "bad-txns-premature-spend-of-coinbase"); } } } } - + return true; }*/ namespace { - + bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock, const CMessageHeader::MessageStartChars& messageStart) { // Open history file to append CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) return error("%s: OpenUndoFile failed", __func__); - + // Write index header unsigned int nSize = fileout.GetSerializeSize(blockundo); fileout << FLATDATA(messageStart) << nSize; - + // Write undo data long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) return error("%s: ftell failed", __func__); pos.nPos = (unsigned int)fileOutPos; fileout << blockundo; - + // calculate & write checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; hasher << blockundo; fileout << hasher.GetHash(); - + return true; } - + bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock) { // Open history file to read CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) return error("%s: OpenBlockFile failed", __func__); - + // Read block uint256 hashChecksum; try { @@ -2405,10 +2405,10 @@ namespace { hasher << blockundo; if (hashChecksum != hasher.GetHash()) return error("%s: Checksum mismatch", __func__); - + return true; } - + /** Abort with a message */ bool AbortNode(const std::string& strMessage, const std::string& userMessage="") { @@ -2420,13 +2420,13 @@ namespace { StartShutdown(); return false; } - + bool AbortNode(CValidationState& state, const std::string& strMessage, const std::string& userMessage="") { AbortNode(strMessage, userMessage); return state.Error(strMessage); } - + } // anon namespace /** @@ -2439,7 +2439,7 @@ namespace { static bool ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const COutPoint& out) { bool fClean = true; - + CCoinsModifier coins = view.ModifyCoins(out.hash); if (undo.nHeight != 0) { // undo data contains height: this is the last output of the prevout tx being spent @@ -2458,7 +2458,7 @@ static bool ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const CO if (coins->vout.size() < out.n+1) coins->vout.resize(out.n+1); coins->vout[out.n] = undo.txout; - + return fClean; } @@ -2496,10 +2496,10 @@ void DisconnectNotarisations(const CBlock &block) bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) { assert(pindex->GetBlockHash() == view.GetBestBlock()); - + if (pfClean) *pfClean = false; - + bool fClean = true; komodo_disconnect(pindex,block); CBlockUndo blockUndo; @@ -2508,7 +2508,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex return error("DisconnectBlock(): no undo data available"); if (!UndoReadFromDisk(blockUndo, pos, pindex->pprev->GetBlockHash())) return error("DisconnectBlock(): failure reading undo data"); - + if (blockUndo.vtxundo.size() + 1 != block.vtx.size()) return error("DisconnectBlock(): block and undo data inconsistent"); std::vector > addressIndex; @@ -2546,23 +2546,23 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex } else if (out.scriptPubKey.IsPayToPublicKey()) { vector hashBytes(out.scriptPubKey.begin()+1, out.scriptPubKey.begin()+34); - + // undo receiving activity addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, hash, k, false), out.nValue)); - + // undo unspent index addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), hash, k), CAddressUnspentValue())); - + } else if (out.scriptPubKey.IsPayToCryptoCondition()) { vector hashBytes(out.scriptPubKey.begin(), out.scriptPubKey.end()); - + // undo receiving activity addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, hash, k, false), out.nValue)); - + // undo unspent index addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), hash, k), CAddressUnspentValue())); - + } else { continue; @@ -2577,7 +2577,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex { CCoinsModifier outs = view.ModifyCoins(hash); outs->ClearUnspendable(); - + CCoins outsBlock(tx, pindex->nHeight); // The CCoins serialization does not serialize negative numbers. // No network rules currently depend on the version here, so an inconsistency is harmless @@ -2586,18 +2586,18 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex outs->nVersion = outsBlock.nVersion; if (*outs != outsBlock) fClean = fClean && error("DisconnectBlock(): added transaction mismatch? database corrupted"); - + // remove outputs outs->Clear(); } - + // unspend nullifiers BOOST_FOREACH(const JSDescription &joinsplit, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &nf, joinsplit.nullifiers) { view.SetNullifier(nf, false); } } - + // restore inputs if (!tx.IsMint()) { const CTxUndo &txundo = blockUndo.vtxundo[i-1]; @@ -2641,23 +2641,23 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex } else if (prevout.scriptPubKey.IsPayToPublicKey()) { vector hashBytes(prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.begin()+34); - + // undo spending activity addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, hash, j, true), prevout.nValue * -1)); - + // restore unspent index addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), input.prevout.hash, input.prevout.n), CAddressUnspentValue(prevout.nValue, prevout.scriptPubKey, undo.nHeight))); - + } else if (prevout.scriptPubKey.IsPayToCryptoCondition()) { vector hashBytes(prevout.scriptPubKey.begin(), prevout.scriptPubKey.end()); - + // undo spending activity addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, hash, j, true), prevout.nValue * -1)); - + // restore unspent index addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), input.prevout.hash, input.prevout.n), CAddressUnspentValue(prevout.nValue, prevout.scriptPubKey, undo.nHeight))); - + } else { continue; @@ -2673,10 +2673,10 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex // set the old best anchor back view.PopAnchor(blockUndo.old_tree_root); - + // move best block pointer to prevout block view.SetBestBlock(pindex->pprev->GetBlockHash()); - + if (pfClean) { *pfClean = fClean; return true; @@ -2697,9 +2697,9 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex void static FlushBlockFile(bool fFinalize = false) { LOCK(cs_LastBlockFile); - + CDiskBlockPos posOld(nLastBlockFile, 0); - + FILE *fileOld = OpenBlockFile(posOld); if (fileOld) { if (fFinalize) @@ -2707,7 +2707,7 @@ void static FlushBlockFile(bool fFinalize = false) FileCommit(fileOld); fclose(fileOld); } - + fileOld = OpenUndoFile(posOld); if (fileOld) { if (fFinalize) @@ -2735,20 +2735,20 @@ void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const int64_t nPowTargetSpacing) { if (bestHeader == NULL || initialDownloadCheck()) return; - + static int64_t lastAlertTime = 0; int64_t now = GetAdjustedTime(); if (lastAlertTime > now-60*60*24) return; // Alert at most once per day - + const int SPAN_HOURS=4; const int SPAN_SECONDS=SPAN_HOURS*60*60; int BLOCKS_EXPECTED = SPAN_SECONDS / nPowTargetSpacing; - + boost::math::poisson_distribution poisson(BLOCKS_EXPECTED); - + std::string strWarning; int64_t startTime = GetAdjustedTime()-SPAN_SECONDS; - + LOCK(cs); const CBlockIndex* i = bestHeader; int nBlocks = 0; @@ -2757,17 +2757,17 @@ void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const i = i->pprev; if (i == NULL) return; // Ran out of chain, we must not be fully synced } - + // How likely is it to find that many by chance? double p = boost::math::pdf(poisson, nBlocks); - + LogPrint("partitioncheck", "%s : Found %d blocks in the last %d hours\n", __func__, nBlocks, SPAN_HOURS); LogPrint("partitioncheck", "%s : likelihood: %g\n", __func__, p); - + // Aim for one false-positive about every fifty years of normal running: const int FIFTY_YEARS = 50*365*24*60*60; double alertThreshold = 1.0 / (FIFTY_YEARS / SPAN_SECONDS); - + if (p <= alertThreshold && nBlocks < BLOCKS_EXPECTED) { // Many fewer blocks than expected: alert! @@ -2819,7 +2819,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin //fprintf(stderr,"checkblock failure in connectblock futureblock.%d\n",futureblock); return false; } - + // verify that the view's current state corresponds to the previous block uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash(); if ( hashPrevBlock != view.GetBestBlock() ) @@ -2829,7 +2829,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin REJECT_INVALID, "hashPrevBlock-not-bestblock"); } assert(hashPrevBlock == view.GetBestBlock()); - + // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (block.GetHash() == chainparams.GetConsensus().hashGenesisBlock) { @@ -2843,7 +2843,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } return true; } - + bool fScriptChecks = (!fCheckpointsEnabled || pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints())); //if ( KOMODO_TESTNET_EXPIRATION != 0 && pindex->nHeight > KOMODO_TESTNET_EXPIRATION ) // "testnet" // return(false); @@ -2855,13 +2855,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin return state.DoS(100, error("ConnectBlock(): tried to overwrite transaction"), REJECT_INVALID, "bad-txns-BIP30"); } - + unsigned int flags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY; - + // DERSIG (BIP66) is also always enforced, but does not have a flag. - + CBlockUndo blockundo; - + if ( ASSETCHAINS_CC != 0 ) { if ( scriptcheckqueue.IsIdle() == 0 ) @@ -2871,7 +2871,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } } CCheckQueueControl control(fExpensiveChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); - + int64_t nTimeStart = GetTimeMicros(); CAmount nFees = 0; int nInputs = 0; @@ -2895,16 +2895,16 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin // This should never fail: we should always be able to get the root // that is on the tip of our chain assert(view.GetAnchorAt(old_tree_root, tree)); - + { // Consistency check: the root of the tree we're given should // match what we asked for. assert(tree.root() == old_tree_root); } - + // Grab the consensus branch ID for the block's height auto consensusBranchId = CurrentEpochBranchId(pindex->nHeight, Params().GetConsensus()); - + std::vector txdata; txdata.reserve(block.vtx.size()); // Required so that pointers to individual PrecomputedTransactionData don't get invalidated for (unsigned int i = 0; i < block.vtx.size(); i++) @@ -2982,14 +2982,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin return state.DoS(100, error("ConnectBlock(): too many sigops"), REJECT_INVALID, "bad-blk-sigops"); } - + txdata.emplace_back(tx); - + if (!tx.IsCoinBase()) { nFees += view.GetValueIn(chainActive.LastTip()->nHeight,&interest,tx,chainActive.LastTip()->nTime) - tx.GetValueOut(); sum += interest; - + std::vector vChecks; if (!ContextualCheckInputs(tx, state, view, fExpensiveChecks, flags, false, txdata[i], chainparams.GetConsensus(), consensusBranchId, nScriptCheckThreads ? &vChecks : NULL)) return false; @@ -3022,23 +3022,23 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } else if (out.scriptPubKey.IsPayToPublicKey()) { vector hashBytes(out.scriptPubKey.begin()+1, out.scriptPubKey.begin()+34); - + // record receiving activity addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, txhash, k, false), out.nValue)); - + // record unspent output addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), txhash, k), CAddressUnspentValue(out.nValue, out.scriptPubKey, pindex->nHeight))); - + } else if (out.scriptPubKey.IsPayToCryptoCondition()) { vector hashBytes(out.scriptPubKey.begin(), out.scriptPubKey.end()); - + // record receiving activity addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, txhash, k, false), out.nValue)); - + // record unspent output addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), txhash, k), CAddressUnspentValue(out.nValue, out.scriptPubKey, pindex->nHeight))); - + } else { continue; @@ -3054,28 +3054,28 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin blockundo.vtxundo.push_back(CTxUndo()); } UpdateCoins(tx, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight); - + BOOST_FOREACH(const JSDescription &joinsplit, tx.vjoinsplit) { BOOST_FOREACH(const uint256 ¬e_commitment, joinsplit.commitments) { // Insert the note commitments into our temporary tree. - + tree.append(note_commitment); } } - + vPos.push_back(std::make_pair(tx.GetHash(), pos)); pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); } - + view.PushAnchor(tree); if (!fJustCheck) { pindex->hashAnchorEnd = tree.root(); } blockundo.old_tree_root = old_tree_root; - + int64_t nTime1 = GetTimeMicros(); nTimeConnect += nTime1 - nTimeStart; LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime1 - nTimeStart) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart) / (nInputs-1), nTimeConnect * 0.000001); - + CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, chainparams.GetConsensus()) + sum; if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 ) { @@ -3102,10 +3102,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin return state.DoS(100, false); int64_t nTime2 = GetTimeMicros(); nTimeVerify += nTime2 - nTimeStart; LogPrint("bench", " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n", nInputs - 1, 0.001 * (nTime2 - nTimeStart), nInputs <= 1 ? 0 : 0.001 * (nTime2 - nTimeStart) / (nInputs-1), nTimeVerify * 0.000001); - + if (fJustCheck) return true; - + // Write undo information to disk if (pindex->GetUndoPos().IsNull() || !pindex->IsValid(BLOCK_VALID_SCRIPTS)) { @@ -3115,12 +3115,12 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin return error("ConnectBlock(): FindUndoPos failed"); if (!UndoWriteToDisk(blockundo, pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart())) return AbortNode(state, "Failed to write undo data"); - + // update nUndoPos in block index pindex->nUndoPos = pos.nPos; pindex->nStatus |= BLOCK_HAVE_UNDO; } - + // Now that all consensus rules have been validated, set nCachedBranchId. // Move this if BLOCK_VALID_CONSENSUS is ever altered. static_assert(BLOCK_VALID_CONSENSUS == BLOCK_VALID_SCRIPTS, @@ -3131,13 +3131,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } else if (pindex->pprev) { pindex->nCachedBranchId = pindex->pprev->nCachedBranchId; } - + pindex->RaiseValidity(BLOCK_VALID_SCRIPTS); setDirtyBlockIndex.insert(pindex); } ConnectNotarisations(block, pindex->nHeight); - + if (fTxIndex) if (!pblocktree->WriteTxIndex(vPos)) return AbortNode(state, "Failed to write transaction index"); @@ -3178,18 +3178,18 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin // add this block to the view's block chain view.SetBestBlock(pindex->GetBlockHash()); - + int64_t nTime3 = GetTimeMicros(); nTimeIndex += nTime3 - nTime2; LogPrint("bench", " - Index writing: %.2fms [%.2fs]\n", 0.001 * (nTime3 - nTime2), nTimeIndex * 0.000001); - + // Watch for changes to the previous coinbase transaction. static uint256 hashPrevBestCoinBase; GetMainSignals().UpdatedTransaction(hashPrevBestCoinBase); hashPrevBestCoinBase = block.vtx[0].GetHash(); - + int64_t nTime4 = GetTimeMicros(); nTimeCallbacks += nTime4 - nTime3; LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime3), nTimeCallbacks * 0.000001); - + //FlushStateToDisk(); komodo_connectblock(pindex,*(CBlock *)&block); return true; @@ -3319,7 +3319,7 @@ void PruneAndFlush() { void static UpdateTip(CBlockIndex *pindexNew) { const CChainParams& chainParams = Params(); chainActive.SetTip(pindexNew); - + // New best block nTimeBestReceived = GetTime(); mempool.AddTransactionsUpdated(1); @@ -3337,9 +3337,9 @@ void static UpdateTip(CBlockIndex *pindexNew) { log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)chainActive.LastTip()->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.LastTip()->GetBlockTime()), progress, pcoinsTip->DynamicMemoryUsage() * (1.0 / (1<<20)), pcoinsTip->GetCacheSize()); - + cvBlockChange.notify_all(); - + // Check the version of the last 100 blocks to see if we need to upgrade: static bool fWarned = false; if (!IsInitialBlockDownload() && !fWarned) @@ -3403,7 +3403,7 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) { // Write the chain state to disk, if necessary. if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) return false; - + if (!fBare) { // Resurrect mempool transactions from the disconnected block. @@ -3423,7 +3423,7 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) { mempool.removeWithAnchor(anchorBeforeDisconnect); } } - + // Update chainActive and related variables. UpdateTip(pindexDelete->pprev); // Get the current commitment tree @@ -3464,7 +3464,7 @@ static int64_t nTimePostConnect = 0; * You probably want to call mempool.removeWithoutBranchId after this, with cs_main held. */ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *pblock) { - + assert(pindexNew->pprev == chainActive.Tip()); // Read block from disk. int64_t nTime1 = GetTimeMicros(); @@ -3507,10 +3507,10 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * // Remove conflicting transactions from the mempool. list txConflicted; mempool.removeForBlock(pblock->vtx, pindexNew->nHeight, txConflicted, !IsInitialBlockDownload()); - + // Remove transactions that expire at new block height from mempool mempool.removeExpired(pindexNew->nHeight); - + // Update chainActive & related variables. UpdateTip(pindexNew); // Tell wallet about transactions that went from mempool @@ -3525,9 +3525,9 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * // Update cached incremental witnesses //fprintf(stderr,"chaintip true\n"); GetMainSignals().ChainTip(pindexNew, pblock, oldTree, true); - + EnforceNodeDeprecation(pindexNew->nHeight); - + int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1; LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); @@ -3547,7 +3547,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * static CBlockIndex* FindMostWorkChain() { do { CBlockIndex *pindexNew = NULL; - + // Find the best candidate header. { std::set::reverse_iterator it = setBlockIndexCandidates.rbegin(); @@ -3555,14 +3555,14 @@ static CBlockIndex* FindMostWorkChain() { return NULL; pindexNew = *it; } - + // Check whether all blocks on the path between the currently active chain and the candidate are valid. // Just going until the active chain is an optimization, as we know all blocks in it are valid already. CBlockIndex *pindexTest = pindexNew; bool fInvalidAncestor = false; while (pindexTest && !chainActive.Contains(pindexTest)) { assert(pindexTest->nChainTx || pindexTest->nHeight == 0); - + // Pruned nodes may have entries in setBlockIndexCandidates for // which block files have been deleted. Remove those as candidates // for the most work chain if we come across them; we can't switch @@ -3619,7 +3619,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo bool fInvalidFound = false; const CBlockIndex *pindexOldTip = chainActive.Tip(); const CBlockIndex *pindexFork = chainActive.FindFork(pindexMostWork); - + // - On ChainDB initialization, pindexOldTip will be null, so there are no removable blocks. // - If pindexMostWork is in a chain that doesn't have the same genesis block as our chain, // then pindexFork will be null, and we would need to remove the entire chain including @@ -3644,7 +3644,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo StartShutdown(); return false; } - + // Disconnect active blocks which are no longer in the best chain. bool fBlocksDisconnected = false; while (chainActive.Tip() && chainActive.Tip() != pindexFork) { @@ -3686,7 +3686,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo pindexIter = pindexIter->pprev; } nHeight = nTargetHeight; - + // Connect new blocks. BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) { if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL)) { @@ -3712,20 +3712,20 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo } } } - + if (fBlocksDisconnected) { mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); } mempool.removeWithoutBranchId( CurrentEpochBranchId(chainActive.Tip()->nHeight + 1, Params().GetConsensus())); mempool.check(pcoinsTip); - + // Callbacks/notifications for a new best chain. if (fInvalidFound) CheckForkWarningConditionsOnNewFork(vpindexToConnect.back()); else CheckForkWarningConditions(); - + return true; } @@ -3740,23 +3740,23 @@ bool ActivateBestChain(CValidationState &state, CBlock *pblock) { const CChainParams& chainParams = Params(); do { boost::this_thread::interruption_point(); - + bool fInitialDownload; { LOCK(cs_main); pindexMostWork = FindMostWorkChain(); - + // Whether we have anything to do at all. if (pindexMostWork == NULL || pindexMostWork == chainActive.Tip()) return true; - + if (!ActivateBestChainStep(state, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL)) return false; pindexNewTip = chainActive.Tip(); fInitialDownload = IsInitialBlockDownload(); } // When we reach this point, we switched to a new tip (stored in pindexNewTip). - + // Notifications/callbacks that can run without cs_main if (!fInitialDownload) { uint256 hashNewTip = pindexNewTip->GetBlockHash(); @@ -3778,23 +3778,23 @@ bool ActivateBestChain(CValidationState &state, CBlock *pblock) { } //else fprintf(stderr,"initial download skips propagation\n"); } while(pindexMostWork != chainActive.Tip()); CheckBlockIndex(); - + // Write changes periodically to disk, after relay. if (!FlushStateToDisk(state, FLUSH_STATE_PERIODIC)) { return false; } - + return true; } bool InvalidateBlock(CValidationState& state, CBlockIndex *pindex) { AssertLockHeld(cs_main); - + // Mark the block itself as invalid. pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); setBlockIndexCandidates.erase(pindex); - + while (chainActive.Contains(pindex)) { CBlockIndex *pindexWalk = chainActive.Tip(); pindexWalk->nStatus |= BLOCK_FAILED_CHILD; @@ -3810,7 +3810,7 @@ bool InvalidateBlock(CValidationState& state, CBlockIndex *pindex) { } } //LimitMempoolSize(mempool, GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60); - + // The resulting new best tip may not be in setBlockIndexCandidates anymore, so // add it again. BlockMap::iterator it = mapBlockIndex.begin(); @@ -3820,7 +3820,7 @@ bool InvalidateBlock(CValidationState& state, CBlockIndex *pindex) { } it++; } - + InvalidChainFound(pindex); mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); mempool.removeWithoutBranchId( @@ -3830,9 +3830,9 @@ bool InvalidateBlock(CValidationState& state, CBlockIndex *pindex) { bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex) { AssertLockHeld(cs_main); - + int nHeight = pindex->nHeight; - + // Remove the invalidity flag from this block and all its descendants. BlockMap::iterator it = mapBlockIndex.begin(); while (it != mapBlockIndex.end()) { @@ -3849,7 +3849,7 @@ bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex) { } it++; } - + // Remove the invalidity flag from all ancestors too. while (pindex != NULL) { if (pindex->nStatus & BLOCK_FAILED_MASK) { @@ -3901,7 +3901,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block) pindexNew->RaiseValidity(BLOCK_VALID_TREE); if (pindexBestHeader == NULL || pindexBestHeader->nChainWork < pindexNew->nChainWork) pindexBestHeader = pindexNew; - + setDirtyBlockIndex.insert(pindexNew); //fprintf(stderr,"added to block index %s %p\n",hash.ToString().c_str(),pindexNew); mi->second = pindexNew; @@ -3928,12 +3928,12 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl pindexNew->nStatus |= BLOCK_HAVE_DATA; pindexNew->RaiseValidity(BLOCK_VALID_TRANSACTIONS); setDirtyBlockIndex.insert(pindexNew); - + if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) { // If pindexNew is the genesis block or all parents are BLOCK_VALID_TRANSACTIONS. deque queue; queue.push_back(pindexNew); - + // Recursively process any descendant blocks that now may be eligible to be connected. while (!queue.empty()) { CBlockIndex *pindex = queue.front(); @@ -3968,19 +3968,19 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl mapBlocksUnlinked.insert(std::make_pair(pindexNew->pprev, pindexNew)); } } - + return true; } bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false) { LOCK(cs_LastBlockFile); - + unsigned int nFile = fKnown ? pos.nFile : nLastBlockFile; if (vinfoBlockFile.size() <= nFile) { vinfoBlockFile.resize(nFile + 1); } - + if (!fKnown) { while (vinfoBlockFile[nFile].nSize + nAddSize >= MAX_BLOCKFILE_SIZE) { nFile++; @@ -3991,7 +3991,7 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd pos.nFile = nFile; pos.nPos = vinfoBlockFile[nFile].nSize; } - + if (nFile != nLastBlockFile) { if (!fKnown) { LogPrintf("Leaving block file %i: %s\n", nFile, vinfoBlockFile[nFile].ToString()); @@ -3999,13 +3999,13 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd FlushBlockFile(!fKnown); nLastBlockFile = nFile; } - + vinfoBlockFile[nFile].AddBlock(nHeight, nTime); if (fKnown) vinfoBlockFile[nFile].nSize = std::max(pos.nPos + nAddSize, vinfoBlockFile[nFile].nSize); else vinfoBlockFile[nFile].nSize += nAddSize; - + if (!fKnown) { unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; unsigned int nNewChunks = (vinfoBlockFile[nFile].nSize + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; @@ -4024,7 +4024,7 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd return state.Error("out of disk space"); } } - + setDirtyFileInfo.insert(nFile); return true; } @@ -4032,14 +4032,14 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize) { pos.nFile = nFile; - + LOCK(cs_LastBlockFile); - + unsigned int nNewSize; pos.nPos = vinfoBlockFile[nFile].nUndoSize; nNewSize = vinfoBlockFile[nFile].nUndoSize += nAddSize; setDirtyFileInfo.insert(nFile); - + unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; unsigned int nNewChunks = (nNewSize + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { @@ -4056,7 +4056,7 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne else return state.Error("out of disk space"); } - + return true; } @@ -4101,7 +4101,7 @@ bool CheckBlockHeader(int32_t *futureblockp,int32_t height,CBlockIndex *pindex, // Check block version if (height > 0 && blockhdr.nVersion < MIN_BLOCK_VERSION) return state.DoS(100, error("CheckBlockHeader(): block version too low"),REJECT_INVALID, "version-too-low"); - + // Check Equihash solution is valid if ( fCheckPOW ) { @@ -4156,7 +4156,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C if (block.hashMerkleRoot != hashMerkleRoot2) return state.DoS(100, error("CheckBlock: hashMerkleRoot mismatch"), REJECT_INVALID, "bad-txnmrklroot", true); - + // Check for merkle tree malleability (CVE-2012-2459): repeating sequences // of transactions in a block without affecting the merkle root of a block, // while still invalidating it. @@ -4164,16 +4164,16 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C return state.DoS(100, error("CheckBlock: duplicate transaction"), REJECT_INVALID, "bad-txns-duplicate", true); } - + // All potential-corruption validation must be done before we do any // transaction validation, as otherwise we may mark the header as invalid // because we receive the wrong transactions for it. - + // Size limits if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) return state.DoS(100, error("CheckBlock: size limits failed"), REJECT_INVALID, "bad-blk-length"); - + // First transaction must be coinbase, the rest must not be if (block.vtx.empty() || !block.vtx[0].IsCoinBase()) return state.DoS(100, error("CheckBlock: first tx is not coinbase"), @@ -4182,7 +4182,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C if (block.vtx[i].IsCoinBase()) return state.DoS(100, error("CheckBlock: more than one coinbase"), REJECT_INVALID, "bad-cb-multiple"); - + // Check transactions if ( ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order { @@ -4246,11 +4246,11 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta uint256 hash = block.GetHash(); if (hash == consensusParams.hashGenesisBlock) return true; - + assert(pindexPrev); - + int nHeight = pindexPrev->nHeight+1; - + // Check proof of work if ( (ASSETCHAINS_SYMBOL[0] != 0 || nHeight < 235300 || nHeight > 236000) && block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams)) { @@ -4258,12 +4258,12 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta return state.DoS(100, error("%s: incorrect proof of work", __func__), REJECT_INVALID, "bad-diffbits"); } - + // Check timestamp against prev if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) return state.Invalid(error("%s: block's timestamp is too early", __func__), REJECT_INVALID, "time-too-old"); - + if (fCheckpointsEnabled) { // Check that the block chain matches the known block chain up to a checkpoint @@ -4306,7 +4306,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta if (block.nVersion < 4) return state.Invalid(error("%s : rejected nVersion<4 block", __func__), REJECT_OBSOLETE, "bad-version"); - + return true; } @@ -4314,15 +4314,15 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn { const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1; const Consensus::Params& consensusParams = Params().GetConsensus(); - + // Check that all transactions are finalized BOOST_FOREACH(const CTransaction& tx, block.vtx) { - + // Check transaction contextually against consensus rules at block height if (!ContextualCheckTransaction(tx, state, nHeight, 100)) { return false; // Failure reason has been set in validation state object } - + int nLockTimeFlags = 0; int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() @@ -4331,7 +4331,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } - + // Enforce BIP 34 rule that the coinbase starts with serialized block height. // In Zcash this has been enforced since launch, except that the genesis // block didn't include the height in the coinbase (see Zcash protocol spec @@ -4344,7 +4344,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn return state.DoS(100, error("%s: block height mismatch in coinbase", __func__), REJECT_INVALID, "bad-cb-height"); } } - + return true; } @@ -4437,7 +4437,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C { const CChainParams& chainparams = Params(); AssertLockHeld(cs_main); - + CBlockIndex *&pindex = *ppindex; if (!AcceptBlockHeader(futureblockp,block, state, &pindex)) { @@ -4464,7 +4464,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C // regardless of whether pruning is enabled; it should generally be safe to // not process unrequested blocks. bool fTooFarAhead = (pindex->nHeight > int(chainActive.Height() + BLOCK_DOWNLOAD_WINDOW)); //MIN_BLOCKS_TO_KEEP)); - + // TODO: deal better with return value and error conditions for duplicate // and unrequested blocks. //fprintf(stderr,"Accept %s flags already.%d requested.%d morework.%d farahead.%d\n",pindex->GetBlockHash().ToString().c_str(),fAlreadyHave,fRequested,fHasMoreWork,fTooFarAhead); @@ -4474,7 +4474,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C if (!fHasMoreWork) return true; // Don't process less-work chains if (fTooFarAhead) return true; // Block height is too high } - + // See method docstring for why this is always disabled auto verifier = libzcash::ProofVerifier::Disabled(); if ((!CheckBlock(futureblockp,pindex->nHeight,pindex,block, state, verifier,0)) || !ContextualCheckBlock(block, state, pindex->pprev)) @@ -4489,7 +4489,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C return false; } } - + int nHeight = pindex->nHeight; // Write block to history file try { @@ -4507,7 +4507,7 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C } catch (const std::runtime_error& e) { return AbortNode(state, std::string("System error: ") + e.what()); } - + if (fCheckForPruning) FlushStateToDisk(state, FLUSH_STATE_NONE); // we just allocated more disk space for block files if ( *futureblockp == 0 ) @@ -4653,7 +4653,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo return error("%s: AcceptBlock FAILED", __func__); //else fprintf(stderr,"added block %s %p\n",pindex->GetBlockHash().ToString().c_str(),pindex->pprev); } - + if (futureblock == 0 && !ActivateBestChain(state, pblock)) return error("%s: ActivateBestChain failed", __func__); //fprintf(stderr,"finished ProcessBlock %d\n",(int32_t)chainActive.LastTip()->nHeight); @@ -4665,7 +4665,7 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex { AssertLockHeld(cs_main); assert(pindexPrev == chainActive.Tip()); - + CCoinsViewCache viewNew(pcoinsTip); CBlockIndex indexDummy(block); indexDummy.pprev = pindexPrev; @@ -4726,7 +4726,7 @@ void PruneOneBlockFile(const int fileNumber) pindex->nDataPos = 0; pindex->nUndoPos = 0; setDirtyBlockIndex.insert(pindex); - + // Prune from mapBlocksUnlinked -- any block we prune would have // to be downloaded again in order to consider its chain, at which // point it would be considered as a candidate for @@ -4741,7 +4741,7 @@ void PruneOneBlockFile(const int fileNumber) } } } - + vinfoBlockFile[fileNumber].SetNull(); setDirtyFileInfo.insert(fileNumber); } @@ -4775,21 +4775,21 @@ void FindFilesToPrune(std::set& setFilesToPrune) uint64_t nBuffer = BLOCKFILE_CHUNK_SIZE + UNDOFILE_CHUNK_SIZE; uint64_t nBytesToPrune; int count=0; - + if (nCurrentUsage + nBuffer >= nPruneTarget) { for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) { nBytesToPrune = vinfoBlockFile[fileNumber].nSize + vinfoBlockFile[fileNumber].nUndoSize; - + if (vinfoBlockFile[fileNumber].nSize == 0) continue; - + if (nCurrentUsage + nBuffer < nPruneTarget) // are we below our target? break; - + // don't prune files that could have a block within MIN_BLOCKS_TO_KEEP of the main chain's tip but keep scanning if (vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune) continue; - + PruneOneBlockFile(fileNumber); // Queue up the files for removal setFilesToPrune.insert(fileNumber); @@ -4797,7 +4797,7 @@ void FindFilesToPrune(std::set& setFilesToPrune) count++; } } - + LogPrint("prune", "Prune: target=%dMiB actual=%dMiB diff=%dMiB max_prune_height=%d removed %d blk/rev pairs\n", nPruneTarget/1024/1024, nCurrentUsage/1024/1024, ((int64_t)nPruneTarget - (int64_t)nCurrentUsage)/1024/1024, @@ -4807,11 +4807,11 @@ void FindFilesToPrune(std::set& setFilesToPrune) bool CheckDiskSpace(uint64_t nAdditionalBytes) { uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available; - + // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) return AbortNode("Disk space is low!", _("Error: Disk space is low!")); - + return true; } @@ -4861,12 +4861,12 @@ CBlockIndex * InsertBlockIndex(uint256 hash) { if (hash.IsNull()) return NULL; - + // Return existing BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) return (*mi).second; - + // Create new CBlockIndex* pindexNew = new CBlockIndex(); if (!pindexNew) @@ -4888,7 +4888,7 @@ bool static LoadBlockIndexDB() return false; LogPrintf("%s: loaded guts\n", __func__); boost::this_thread::interruption_point(); - + // Calculate nChainWork vector > vSortedByHeight; vSortedByHeight.reserve(mapBlockIndex.size()); @@ -4967,7 +4967,7 @@ bool static LoadBlockIndexDB() break; } } - + // Check presence of blk files LogPrintf("Checking all blk files are present...\n"); set setBlkDataFiles; @@ -4987,17 +4987,17 @@ bool static LoadBlockIndexDB() return false; } } - + // Check whether we have ever pruned block & undo files pblocktree->ReadFlag("prunedblockfiles", fHavePruned); if (fHavePruned) LogPrintf("LoadBlockIndexDB(): Block files have previously been pruned\n"); - + // Check whether we need to continue reindexing bool fReindexing = false; pblocktree->ReadReindexing(fReindexing); fReindex |= fReindexing; - + // Check whether we have a transaction index pblocktree->ReadFlag("txindex", fTxIndex); LogPrintf("%s: transaction index %s\n", __func__, fTxIndex ? "enabled" : "disabled"); @@ -5027,7 +5027,7 @@ bool static LoadBlockIndexDB() } //komodo_pindex_init(pindex,(int32_t)pindex->nHeight); } - + // Load pointer to end of best chain BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); if (it == mapBlockIndex.end()) @@ -5035,7 +5035,7 @@ bool static LoadBlockIndexDB() chainActive.SetTip(it->second); // Set hashAnchorEnd for the end of best chain it->second->hashAnchorEnd = pcoinsTip->GetBestAnchor(); - + PruneBlockIndexCandidates(); double progress; @@ -5047,14 +5047,14 @@ bool static LoadBlockIndexDB() // runs, which makes it return 0, so we guess 50% for now progress = (longestchain > 0 ) ? (double) chainActive.Height() / longestchain : 0.5; } - + LogPrintf("%s: hashBestChain=%s height=%d date=%s progress=%f\n", __func__, chainActive.LastTip()->GetBlockHash().ToString(), chainActive.Height(), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.LastTip()->GetBlockTime()), progress); - + EnforceNodeDeprecation(chainActive.Height(), true); - + return true; } @@ -5073,7 +5073,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth LOCK(cs_main); if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL) return true; - + // Verify blocks in the best chain if (nCheckDepth <= 0) nCheckDepth = 1000000000; // suffices until the year 19000 @@ -5130,7 +5130,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth //fprintf(stderr,"end VerifyDB %u\n",(uint32_t)time(NULL)); if (pindexFailure) return error("VerifyDB(): *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainActive.Height() - pindexFailure->nHeight + 1, nGoodTransactions); - + // check level 4: try reconnecting blocks if (nCheckLevel >= 4) { CBlockIndex *pindex = pindexState; @@ -5145,16 +5145,16 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth return error("VerifyDB(): *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString()); } } - + LogPrintf("No coin database inconsistencies in last %i blocks (%i transactions)\n", chainActive.Height() - pindexState->nHeight, nGoodTransactions); - + return true; } bool RewindBlockIndex(const CChainParams& params) { LOCK(cs_main); - + // RewindBlockIndex is called after LoadBlockIndex, so at this point every block // index will have nCachedBranchId set based on the values previously persisted // to disk. By definition, a set nCachedBranchId means that the block was @@ -5172,7 +5172,7 @@ bool RewindBlockIndex(const CChainParams& params) pindex->nCachedBranchId && *pindex->nCachedBranchId == CurrentEpochBranchId(pindex->nHeight, consensus); }; - + int nHeight = 1; while (nHeight <= chainActive.Height()) { if (!sufficientlyValidated(chainActive[nHeight])) { @@ -5180,7 +5180,7 @@ bool RewindBlockIndex(const CChainParams& params) } nHeight++; } - + // nHeight is now the height of the first insufficiently-validated block, or tipheight + 1 auto rewindLength = chainActive.Height() - nHeight; if (rewindLength > 0 && rewindLength > MAX_REORG_LENGTH) { @@ -5201,7 +5201,7 @@ bool RewindBlockIndex(const CChainParams& params) StartShutdown(); return false; } - + CValidationState state; CBlockIndex* pindex = chainActive.Tip(); while (chainActive.Height() >= nHeight) { @@ -5220,13 +5220,13 @@ bool RewindBlockIndex(const CChainParams& params) if (!FlushStateToDisk(state, FLUSH_STATE_PERIODIC)) return false; } - + // Reduce validity flag and have-data flags. // We do this after actual disconnecting, otherwise we'll end up writing the lack of data // to disk before writing the chainstate, resulting in a failure to continue if interrupted. for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { CBlockIndex* pindexIter = it->second; - + // Note: If we encounter an insufficiently validated block that // is on chainActive, it must be because we are a pruning node, and // this block or some successor doesn't HAVE_DATA, so we were unable to @@ -5259,7 +5259,7 @@ bool RewindBlockIndex(const CChainParams& params) //fprintf(stderr,"Reset invalid block marker if it was pointing to this block\n"); pindexBestInvalid = NULL; } - + // Update indices setBlockIndexCandidates.erase(pindexIter); auto ret = mapBlocksUnlinked.equal_range(pindexIter->pprev); @@ -5274,15 +5274,15 @@ bool RewindBlockIndex(const CChainParams& params) setBlockIndexCandidates.insert(pindexIter); } } - + PruneBlockIndexCandidates(); - + CheckBlockIndex(); - + if (!FlushStateToDisk(state, FLUSH_STATE_ALWAYS)) { return false; } - + return true; } @@ -5309,7 +5309,7 @@ void UnloadBlockIndex() setDirtyFileInfo.clear(); mapNodeState.clear(); recentRejects.reset(NULL); - + BOOST_FOREACH(BlockMap::value_type& entry, mapBlockIndex) { delete entry.second; } @@ -5334,7 +5334,7 @@ bool LoadBlockIndex() bool InitBlockIndex() { const CChainParams& chainparams = Params(); LOCK(cs_main); - + // Initialize global variables that cannot be constructed at startup. recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); // Check whether we're already initialized @@ -5352,12 +5352,12 @@ bool InitBlockIndex() { // Use the provided setting for -timestampindex in the new database fTimestampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX); pblocktree->WriteFlag("timestampindex", fTimestampIndex); - + fSpentIndex = GetBoolArg("-spentindex", DEFAULT_SPENTINDEX); pblocktree->WriteFlag("spentindex", fSpentIndex); fprintf(stderr,"fAddressIndex.%d/%d fSpentIndex.%d/%d\n",fAddressIndex,DEFAULT_ADDRESSINDEX,fSpentIndex,DEFAULT_SPENTINDEX); LogPrintf("Initializing databases...\n"); - + // Only add the genesis block if not reindexing (in which case we reuse the one already on disk) if (!fReindex) { try { @@ -5383,7 +5383,7 @@ bool InitBlockIndex() { return error("LoadBlockIndex(): failed to initialize block database: %s", e.what()); } } - + return true; } @@ -5395,7 +5395,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) // Map of disk positions for blocks with unknown parent (only used for reindex) static std::multimap mapBlocksUnknownParent; int64_t nStart = GetTimeMillis(); - + int nLoaded = 0; try { // This takes over fileIn and calls fclose() on it in the CBufferedFile destructor @@ -5404,7 +5404,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) uint64_t nRewind = blkdat.GetPos(); while (!blkdat.eof()) { boost::this_thread::interruption_point(); - + blkdat.SetPos(nRewind); nRewind++; // start one byte further next time, in case of failure blkdat.SetLimit(); // remove former limit @@ -5435,7 +5435,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) CBlock block; blkdat >> block; nRewind = blkdat.GetPos(); - + // detect out of order blocks, and store them for later uint256 hash = block.GetHash(); if (hash != chainparams.GetConsensus().hashGenesisBlock && mapBlockIndex.find(block.hashPrevBlock) == mapBlockIndex.end()) { @@ -5445,7 +5445,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) mapBlocksUnknownParent.insert(std::make_pair(block.hashPrevBlock, *dbp)); continue; } - + // process in case the block isn't known yet if (mapBlockIndex.count(hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0) { CValidationState state; @@ -5456,7 +5456,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) } else if (hash != chainparams.GetConsensus().hashGenesisBlock && mapBlockIndex[hash]->nHeight % 1000 == 0) { LogPrintf("Block Import: already had block %s at height %d\n", hash.ToString(), mapBlockIndex[hash]->nHeight); } - + // Recursively process earlier encountered successors of this block deque queue; queue.push_back(hash); @@ -5499,9 +5499,9 @@ void static CheckBlockIndex() if (!fCheckBlockIndex) { return; } - + LOCK(cs_main); - + // During a reindex, we read the genesis block and call CheckBlockIndex before ActivateBestChain, // so we have the genesis block in mapBlockIndex but no active chain. (A few of the tests when // iterating the block tree require that chainActive has been initialized.) @@ -5509,7 +5509,7 @@ void static CheckBlockIndex() assert(mapBlockIndex.size() <= 1); return; } - + // Build forward-pointing map of the entire block tree. std::multimap forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { @@ -5518,12 +5518,12 @@ void static CheckBlockIndex() } if ( Params().NetworkIDString() != "regtest" ) assert(forward.size() == mapBlockIndex.size()); - + std::pair::iterator,std::multimap::iterator> rangeGenesis = forward.equal_range(NULL); CBlockIndex *pindex = rangeGenesis.first->second; rangeGenesis.first++; assert(rangeGenesis.first == rangeGenesis.second); // There is only one index entry with parent NULL. - + // Iterate over the entire block tree, using depth-first search. // Along the way, remember whether there are blocks on the path from genesis // block being explored which are the first to have certain properties. @@ -5545,7 +5545,7 @@ void static CheckBlockIndex() if (pindex->pprev != NULL && pindexFirstNotTransactionsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TRANSACTIONS) pindexFirstNotTransactionsValid = pindex; if (pindex->pprev != NULL && pindexFirstNotChainValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_CHAIN) pindexFirstNotChainValid = pindex; if (pindex->pprev != NULL && pindexFirstNotScriptsValid == NULL && (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS) pindexFirstNotScriptsValid = pindex; - + // Begin: actual consistency checks. if (pindex->pprev == NULL) { // Genesis block checks. @@ -5631,7 +5631,7 @@ void static CheckBlockIndex() } // assert(pindex->GetBlockHash() == pindex->GetBlockHeader().GetHash()); // Perhaps too slow // End: actual consistency checks. - + // Try descending into the first subnode. std::pair::iterator,std::multimap::iterator> range = forward.equal_range(pindex); if (range.first != range.second) { @@ -5674,7 +5674,7 @@ void static CheckBlockIndex() } } } - + // Check that we actually traversed the entire map. assert(nNodes == forward.size()); } @@ -5689,20 +5689,20 @@ std::string GetWarnings(const std::string& strFor) int nPriority = 0; string strStatusBar; string strRPC; - + if (!CLIENT_VERSION_IS_RELEASE) strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); - + if (GetBoolArg("-testsafemode", false)) strStatusBar = strRPC = "testsafemode enabled"; - + // Misc warnings like out of disk space and clock is wrong if (strMiscWarning != "") { nPriority = 1000; strStatusBar = strMiscWarning; } - + if (fLargeWorkForkFound) { nPriority = 2000; @@ -5713,7 +5713,7 @@ std::string GetWarnings(const std::string& strFor) nPriority = 2000; strStatusBar = strRPC = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."); } - + // Alerts { LOCK(cs_mapAlerts); @@ -5730,7 +5730,7 @@ std::string GetWarnings(const std::string& strFor) } } } - + if (strFor == "statusbar") return strStatusBar; else if (strFor == "rpc") @@ -5768,7 +5768,7 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) hashRecentRejectsChainTip = chainActive.Tip()->GetBlockHash(); recentRejects->reset(); } - + return recentRejects->contains(inv.hash) || mempool.exists(inv.hash) || mapOrphanTransactions.count(inv.hash) || @@ -5784,21 +5784,21 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) void static ProcessGetData(CNode* pfrom) { std::deque::iterator it = pfrom->vRecvGetData.begin(); - + vector vNotFound; - + LOCK(cs_main); - + while (it != pfrom->vRecvGetData.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; - + const CInv &inv = *it; { boost::this_thread::interruption_point(); it++; - + if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) { bool send = false; @@ -5902,17 +5902,17 @@ void static ProcessGetData(CNode* pfrom) vNotFound.push_back(inv); } } - + // Track requests for our stuff. GetMainSignals().Inventory(inv.hash); - + if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) break; } } - + pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it); - + if (!vNotFound.empty()) { // Let the peer know that we didn't find what it asked for, so it doesn't // have to wait around forever. Currently only SPV clients actually care @@ -5935,10 +5935,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n"); return true; } - - - - + + + + if (strCommand == "version") { // Each connection can only send one version message @@ -5948,22 +5948,36 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), 1); return false; } - + int64_t nTime; CAddress addrMe; CAddress addrFrom; uint64_t nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; - if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) + if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) { - // disconnect from peers older than this proto version - LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); - pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)); - pfrom->fDisconnect = true; - return false; + if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) + { + // disconnect from peers older than this proto version + LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); + pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE, + strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)); + pfrom->fDisconnect = true; + return false; + } + } else + { + if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) + { + // disconnect from peers older than this proto version + LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); + pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE, + strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)); + pfrom->fDisconnect = true; + return false; + } } - + // When Overwinter is active, reject incoming connections from non-Overwinter nodes const Consensus::Params& params = Params().GetConsensus(); if (NetworkUpgradeActive(GetHeight(), params, Consensus::UPGRADE_OVERWINTER) @@ -5976,7 +5990,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->fDisconnect = true; return false; } - + if (pfrom->nVersion == 10300) pfrom->nVersion = 300; if (!vRecv.empty()) @@ -5991,7 +6005,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message else pfrom->fRelayTxes = true; - + // Disconnect if we connected to ourself if (nNonce == nLocalHostNonce && nNonce > 1) { @@ -5999,26 +6013,26 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->fDisconnect = true; return true; } - + pfrom->addrLocal = addrMe; if (pfrom->fInbound && addrMe.IsRoutable()) { SeenLocal(addrMe); } - + // Be shy and don't send version until we hear if (pfrom->fInbound) pfrom->PushVersion(); - + pfrom->fClient = !(pfrom->nServices & NODE_NETWORK); - + // Potentially mark this peer as a preferred download peer. UpdatePreferredDownload(pfrom, State(pfrom->GetId())); - + // Change version pfrom->PushMessage("verack"); pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); - + if (!pfrom->fInbound) { // Advertise our address @@ -6035,7 +6049,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->PushAddress(addr); } } - + // Get recent addresses if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || addrman.size() < 1000) { @@ -6050,51 +6064,51 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, addrman.Good(addrFrom); } } - + // Relay alerts { LOCK(cs_mapAlerts); BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) item.second.RelayTo(pfrom); } - + pfrom->fSuccessfullyConnected = true; - + string remoteAddr; if (fLogIPs) remoteAddr = ", peeraddr=" + pfrom->addr.ToString(); - + LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n", pfrom->cleanSubVer, pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString(), pfrom->id, remoteAddr); - + int64_t nTimeOffset = nTime - GetTime(); pfrom->nTimeOffset = nTimeOffset; AddTimeData(pfrom->addr, nTimeOffset); } - - + + else if (pfrom->nVersion == 0) { // Must have a version message before anything else Misbehaving(pfrom->GetId(), 1); return false; } - - + + else if (strCommand == "verack") { pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); - + // Mark this node as currently connected, so we update its timestamp later. if (pfrom->fNetworkNode) { LOCK(cs_main); State(pfrom->GetId())->fCurrentlyConnected = true; } } - - + + // Disconnect existing peer connection when: // 1. The version message has been received // 2. Overwinter is active @@ -6109,13 +6123,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->fDisconnect = true; return false; } - - + + else if (strCommand == "addr") { vector vAddr; vRecv >> vAddr; - + // Don't want addr from older versions unless seeding if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000) return true; @@ -6124,7 +6138,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), 20); return error("message addr size() = %u", vAddr.size()); } - + // Store the new addresses vector vAddrOk; int64_t nNow = GetAdjustedTime(); @@ -6132,7 +6146,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, BOOST_FOREACH(CAddress& addr, vAddr) { boost::this_thread::interruption_point(); - + if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) addr.nTime = nNow - 5 * 24 * 60 * 60; pfrom->AddAddressKnown(addr); @@ -6176,8 +6190,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (pfrom->fOneShot) pfrom->fDisconnect = true; } - - + + else if (strCommand == "inv") { vector vInv; @@ -6187,24 +6201,24 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), 20); return error("message inv size() = %u", vInv.size()); } - + LOCK(cs_main); - + std::vector vToFetch; - + for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) { const CInv &inv = vInv[nInv]; - + boost::this_thread::interruption_point(); pfrom->AddInventoryKnown(inv); - + bool fAlreadyHave = AlreadyHave(inv); LogPrint("net", "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->id); - + if (!fAlreadyHave && !fImporting && !fReindex && inv.type != MSG_BLOCK) pfrom->AskFor(inv); - + if (inv.type == MSG_BLOCK) { UpdateBlockAvailability(pfrom->GetId(), inv.hash); if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) { @@ -6228,21 +6242,21 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, LogPrint("net", "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id); } } - + // Track requests for our stuff GetMainSignals().Inventory(inv.hash); - + if (pfrom->nSendSize > (SendBufferSize() * 2)) { Misbehaving(pfrom->GetId(), 50); return error("send buffer size() = %u", pfrom->nSendSize); } } - + if (!vToFetch.empty()) pfrom->PushMessage("getdata", vToFetch); } - - + + else if (strCommand == "getdata") { vector vInv; @@ -6252,29 +6266,29 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), 20); return error("message getdata size() = %u", vInv.size()); } - + if (fDebug || (vInv.size() != 1)) LogPrint("net", "received getdata (%u invsz) peer=%d\n", vInv.size(), pfrom->id); - + if ((fDebug && vInv.size() > 0) || (vInv.size() == 1)) LogPrint("net", "received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->id); - + pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end()); ProcessGetData(pfrom); } - - + + else if (strCommand == "getblocks") { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; - + LOCK(cs_main); - + // Find the last block the caller has in the main chain CBlockIndex* pindex = FindForkInGlobalIndex(chainActive, locator); - + // Send the rest of the chain if (pindex) pindex = chainActive.Next(pindex); @@ -6298,19 +6312,19 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } } } - - + + else if (strCommand == "getheaders") { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; - + LOCK(cs_main); - + if (IsInitialBlockDownload()) return true; - + CBlockIndex* pindex = NULL; if (locator.IsNull()) { @@ -6327,7 +6341,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (pindex) pindex = chainActive.Next(pindex); } - + // we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end vector vHeaders; int nLimit = MAX_HEADERS_RESULTS; @@ -6350,37 +6364,37 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, fprintf(stderr,"you can ignore redundant getheaders from peer.%d %d prev.%d\n",(int32_t)pfrom->id,(int32_t)(pindex ? pindex->nHeight : -1),pfrom->lasthdrsreq); }*/ } - - + + else if (strCommand == "tx") { vector vWorkQueue; vector vEraseQueue; CTransaction tx; vRecv >> tx; - + CInv inv(MSG_TX, tx.GetHash()); pfrom->AddInventoryKnown(inv); - + LOCK(cs_main); - + bool fMissingInputs = false; CValidationState state; - + pfrom->setAskFor.erase(inv.hash); mapAlreadyAskedFor.erase(inv); - + if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs)) { mempool.check(pcoinsTip); RelayTransaction(tx); vWorkQueue.push_back(inv.hash); - + LogPrint("mempool", "AcceptToMemoryPool: peer=%d %s: accepted %s (poolsz %u)\n", pfrom->id, pfrom->cleanSubVer, tx.GetHash().ToString(), mempool.mapTx.size()); - + // Recursively process any orphan transactions that depended on this one set setMisbehaving; for (unsigned int i = 0; i < vWorkQueue.size(); i++) @@ -6400,8 +6414,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get // anyone relaying LegitTxX banned) CValidationState stateDummy; - - + + if (setMisbehaving.count(fromPeer)) continue; if (AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2)) @@ -6431,7 +6445,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, mempool.check(pcoinsTip); } } - + BOOST_FOREACH(uint256 hash, vEraseQueue) EraseOrphanTx(hash); } @@ -6439,7 +6453,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, else if (fMissingInputs && tx.vjoinsplit.size() == 0) { AddOrphanTx(tx, pfrom->GetId()); - + // DoS prevention: do not allow mapOrphanTransactions to grow unbounded unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS)); unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx); @@ -6448,7 +6462,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } else { assert(recentRejects); recentRejects->insert(tx.GetHash()); - + if (pfrom->fWhitelisted) { // Always relay transactions received from whitelisted peers, even // if they were already in the mempool or rejected from it due @@ -6480,12 +6494,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), nDoS); } } - - + + else if (strCommand == "headers" && !fImporting && !fReindex) // Ignore headers received while importing { std::vector headers; - + // Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks. unsigned int nCount = ReadCompactSize(vRecv); if (nCount > MAX_HEADERS_RESULTS) { @@ -6497,14 +6511,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, vRecv >> headers[n]; ReadCompactSize(vRecv); // ignore tx count; assume it is 0. } - + LOCK(cs_main); - + if (nCount == 0) { // Nothing interesting. Stop asking this peers for more headers. return true; } - + CBlockIndex *pindexLast = NULL; BOOST_FOREACH(const CBlockHeader& header, headers) { CValidationState state; @@ -6523,10 +6537,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } } } - + if (pindexLast) UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash()); - + if (nCount == MAX_HEADERS_RESULTS && pindexLast) { // Headers message had its maximum size; the peer may have more headers. // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue @@ -6538,20 +6552,20 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); } } - + CheckBlockIndex(); } - + else if (strCommand == "block" && !fImporting && !fReindex) // Ignore blocks received while importing { CBlock block; vRecv >> block; - + CInv inv(MSG_BLOCK, block.GetHash()); LogPrint("net", "received block %s peer=%d\n", inv.hash.ToString(), pfrom->id); - + pfrom->AddInventoryKnown(inv); - + CValidationState state; // Process all blocks from whitelisted peers, even if not requested, // unless we're still syncing with the network. @@ -6568,10 +6582,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), nDoS); } } - + } - - + + // This asymmetric behavior for inbound and outbound connections was introduced // to prevent a fingerprinting attack: an attacker can send specific fake addresses // to users' AddrMan and later request them by sending getaddr messages. @@ -6586,18 +6600,18 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, return true; } pfrom->fSentAddr = true; - + pfrom->vAddrToSend.clear(); vector vAddr = addrman.GetAddr(); BOOST_FOREACH(const CAddress &addr, vAddr) pfrom->PushAddress(addr); } - - + + else if (strCommand == "mempool") { LOCK2(cs_main, pfrom->cs_filter); - + std::vector vtxid; mempool.queryHashes(vtxid); vector vInv; @@ -6617,8 +6631,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (vInv.size() > 0) pfrom->PushMessage("inv", vInv); } - - + + else if (strCommand == "ping") { if (pfrom->nVersion > BIP0031_VERSION) @@ -6639,8 +6653,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->PushMessage("pong", nonce); } } - - + + else if (strCommand == "pong") { int64_t pingUsecEnd = nTimeReceived; @@ -6648,10 +6662,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, size_t nAvail = vRecv.in_avail(); bool bPingFinished = false; std::string sProblem; - + if (nAvail >= sizeof(nonce)) { vRecv >> nonce; - + // Only process pong message if there is an outstanding ping (old ping without nonce should never pong) if (pfrom->nPingNonceSent != 0) { if (nonce == pfrom->nPingNonceSent) { @@ -6683,7 +6697,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, bPingFinished = true; sProblem = "Short payload"; } - + if (!(sProblem.empty())) { LogPrint("net", "pong peer=%d %s: %s, %x expected, %x received, %u bytes\n", pfrom->id, @@ -6697,13 +6711,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->nPingNonceSent = 0; } } - - + + else if (fAlerts && strCommand == "alert") { CAlert alert; vRecv >> alert; - + uint256 alertHash = alert.GetHash(); if (pfrom->setKnown.count(alertHash) == 0) { @@ -6728,13 +6742,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } } } - - + + else if (strCommand == "filterload") { CBloomFilter filter; vRecv >> filter; - + if (!filter.IsWithinSizeConstraints()) // There is no excuse for sending a too-large filter Misbehaving(pfrom->GetId(), 100); @@ -6747,13 +6761,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } pfrom->fRelayTxes = true; } - - + + else if (strCommand == "filteradd") { vector vData; vRecv >> vData; - + // Nodes must NEVER send a data item > 520 bytes (the max size for a script data object, // and thus, the maximum size any matched object can have) in a filteradd message if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) @@ -6767,8 +6781,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, Misbehaving(pfrom->GetId(), 100); } } - - + + else if (strCommand == "filterclear") { LOCK(pfrom->cs_filter); @@ -6776,18 +6790,18 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->pfilter = new CBloomFilter(); pfrom->fRelayTxes = true; } - - + + else if (strCommand == "reject") { if (fDebug) { try { string strMsg; unsigned char ccode; string strReason; vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, MAX_REJECT_MESSAGE_LENGTH); - + ostringstream ss; ss << strMsg << " code " << itostr(ccode) << ": " << strReason; - + if (strMsg == "block" || strMsg == "tx") { uint256 hash; @@ -6805,14 +6819,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // We do not care about the NOTFOUND message, but logging an Unknown Command // message would be undesirable as we transmit it ourselves. } - + else { // Ignore unknown commands for extensibility LogPrint("net", "Unknown command \"%s\" from peer=%d\n", SanitizeString(strCommand), pfrom->id); } - - - + + + return true; } @@ -6821,7 +6835,7 @@ bool ProcessMessages(CNode* pfrom) { //if (fDebug) // LogPrintf("%s(%u messages)\n", __func__, pfrom->vRecvMsg.size()); - + // // Message format // (4) message start @@ -6831,41 +6845,41 @@ bool ProcessMessages(CNode* pfrom) // (x) data // bool fOk = true; - + if (!pfrom->vRecvGetData.empty()) ProcessGetData(pfrom); - + // this maintains the order of responses if (!pfrom->vRecvGetData.empty()) return fOk; - + std::deque::iterator it = pfrom->vRecvMsg.begin(); while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; - + // get next message CNetMessage& msg = *it; - + //if (fDebug) // LogPrintf("%s(message %u msgsz, %u bytes, complete:%s)\n", __func__, // msg.hdr.nMessageSize, msg.vRecv.size(), // msg.complete() ? "Y" : "N"); - + // end, if an incomplete message is found if (!msg.complete()) break; - + // at this point, any failure means we can delete the current message it++; - + // Scan for message start if (memcmp(msg.hdr.pchMessageStart, Params().MessageStart(), MESSAGE_START_SIZE) != 0) { LogPrintf("PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.hdr.GetCommand()), pfrom->id); fOk = false; break; } - + // Read header CMessageHeader& hdr = msg.hdr; if (!hdr.IsValid(Params().MessageStart())) @@ -6874,10 +6888,10 @@ bool ProcessMessages(CNode* pfrom) continue; } string strCommand = hdr.GetCommand(); - + // Message size unsigned int nMessageSize = hdr.nMessageSize; - + // Checksum CDataStream& vRecv = msg.vRecv; uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize); @@ -6888,7 +6902,7 @@ bool ProcessMessages(CNode* pfrom) SanitizeString(strCommand), nMessageSize, nChecksum, hdr.nChecksum); continue; } - + // Process message bool fRet = false; try @@ -6922,17 +6936,17 @@ bool ProcessMessages(CNode* pfrom) } catch (...) { PrintExceptionContinue(NULL, "ProcessMessages()"); } - + if (!fRet) LogPrintf("%s(%s, %u bytes) FAILED peer=%d\n", __func__, SanitizeString(strCommand), nMessageSize, pfrom->id); - + break; } - + // In case the connection got shut down, its receive buffer was wiped if (!pfrom->fDisconnect) pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin(), it); - + return fOk; } @@ -6944,7 +6958,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) // Don't send anything until we get its version message if (pto->nVersion == 0) return true; - + // // Message: ping // @@ -6973,11 +6987,11 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pto->PushMessage("ping"); } } - + TRY_LOCK(cs_main, lockMain); // Acquire cs_main for IsInitialBlockDownload() and CNodeState() if (!lockMain) return true; - + // Address refresh broadcast static int64_t nLastRebroadcast; if (!IsInitialBlockDownload() && (GetTime() - nLastRebroadcast > 24 * 60 * 60)) @@ -6988,14 +7002,14 @@ bool SendMessages(CNode* pto, bool fSendTrickle) // Periodically clear addrKnown to allow refresh broadcasts if (nLastRebroadcast) pnode->addrKnown.reset(); - + // Rebroadcast our address AdvertizeLocal(pnode); } if (!vNodes.empty()) nLastRebroadcast = GetTime(); } - + // // Message: addr // @@ -7021,7 +7035,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) if (!vAddr.empty()) pto->PushMessage("addr", vAddr); } - + CNodeState &state = *State(pto->GetId()); if (state.fShouldBan) { if (pto->fWhitelisted) @@ -7037,11 +7051,11 @@ bool SendMessages(CNode* pto, bool fSendTrickle) } state.fShouldBan = false; } - + BOOST_FOREACH(const CBlockReject& reject, state.rejects) pto->PushMessage("reject", (string)"block", reject.chRejectCode, reject.strRejectReason, reject.hashBlock); state.rejects.clear(); - + // Start block sync if (pindexBestHeader == NULL) pindexBestHeader = chainActive.Tip(); @@ -7056,7 +7070,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256()); } } - + // Resend wallet transactions that haven't gotten in a block yet // Except during reindex, importing and IBD, when old wallet // transactions become unconfirmed and spams other nodes. @@ -7064,7 +7078,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) { GetMainSignals().Broadcast(nTimeBestReceived); } - + // // Message: inventory // @@ -7078,7 +7092,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) { if (pto->setInventoryKnown.count(inv)) continue; - + // trickle out tx inv to protect privacy if (inv.type == MSG_TX && !fSendTrickle) { @@ -7089,14 +7103,14 @@ bool SendMessages(CNode* pto, bool fSendTrickle) uint256 hashRand = ArithToUint256(UintToArith256(inv.hash) ^ UintToArith256(hashSalt)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); bool fTrickleWait = ((UintToArith256(hashRand) & 3) != 0); - + if (fTrickleWait) { vInvWait.push_back(inv); continue; } } - + // returns true if wasn't already contained in the set if (pto->setInventoryKnown.insert(inv).second) { @@ -7112,7 +7126,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) } if (!vInv.empty()) pto->PushMessage("inv", vInv); - + // Detect whether we're stalling int64_t nNow = GetTimeMicros(); if (!pto->fDisconnect && state.nStallingSince && state.nStallingSince < nNow - 1000000 * BLOCK_STALLING_TIMEOUT) { @@ -7144,7 +7158,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pto->fDisconnect = true; } } - + // // Message: getdata (blocks) // @@ -7181,7 +7195,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) komodo_requestedcount = 0; } }*/ - + // // Message: getdata (non-blocks) // @@ -7206,7 +7220,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) } if (!vGetData.empty()) pto->PushMessage("getdata", vGetData); - + } return true; } @@ -7227,7 +7241,7 @@ public: for (; it1 != mapBlockIndex.end(); it1++) delete (*it1).second; mapBlockIndex.clear(); - + // orphan transactions mapOrphanTransactions.clear(); mapOrphanTransactionsByPrev.clear(); @@ -7244,14 +7258,14 @@ extern "C" const char* getDataDir() CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight) { CMutableTransaction mtx; - + bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER); if (isOverwintered) { mtx.fOverwintered = true; mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID; mtx.nVersion = 3; // Expiry height is not set. Only fields required for a parser to treat as a valid Overwinter V3 tx. - + // TODO: In future, when moving from Overwinter to Sapling, it will be useful // to set the expiry height to: min(activation_height - 1, default_expiry_height) } diff --git a/src/version.h b/src/version.h index 25527895d..b28225df4 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170003; +static const int PROTOCOL_VERSION = 170004; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -19,6 +19,7 @@ static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version static const int MIN_PEER_PROTO_VERSION = 170002; +static const int STAKEDMIN_PEER_PROTO_VERSION = 170004; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this From 47cd790436985fd93b253337b58ffc8caf5c89e0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 01:46:02 +0800 Subject: [PATCH 0080/4463] try staked.h again --- src/crosschain_authority.cpp | 29 ++++++----------------------- src/komodo_notary.h | 22 +++------------------- src/notaries_STAKED.h | 14 ++++++++------ 3 files changed, 17 insertions(+), 48 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 30e4e725a..3c257c4a7 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -1,32 +1,15 @@ #include "cc/eval.h" #include "crosschain.h" #include "notarisationdb.h" -//#include "notaries_STAKED.h" - -const char *notaries_STAKEDcc[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN -}; +#include "notaries_STAKED.h" +extern char *notaries_STAKED int GetSymbolAuthority(const char* symbol) { - if (strlen(symbol) >= 5 && strncmp(symbol, "TXSCL", 5) == 0) + if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if ( (strlen(symbol) >= 4 && strncmp(symbol, "STKD", 4) == 0) || (strlen(symbol) >= 6 && strncmp(symbol, "STAKED", 6) == 0) ) + if ( (strncmp(symbol, "STKD", 4) == 0) || (strncmp(symbol, "STAKED", 6) == 0) ) return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } @@ -72,10 +55,10 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.size = (int32_t)(sizeof(notaries_STAKEDcc)/sizeof(*notaries_STAKEDcc)); + auth.size = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); auth.requiredSigs = 3; for (int n=0; n Date: Fri, 21 Sep 2018 01:48:37 +0800 Subject: [PATCH 0081/4463] ; --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 3c257c4a7..046abff82 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,7 +3,7 @@ #include "notarisationdb.h" #include "notaries_STAKED.h" -extern char *notaries_STAKED +extern char *notaries_STAKED; int GetSymbolAuthority(const char* symbol) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 37fa6b1ac..08ed1a91a 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,7 +22,7 @@ #define KOMODO_MAINNET_START 178999 -extern char *notaries_STAKED +extern char *notaries_STAKED; const char *Notaries_genesis[][2] = { From 9a241aa9c29c40bf75da075cccc9ecb69233d8ec Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 02:10:11 +0800 Subject: [PATCH 0082/4463] try again --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- src/notaries_STAKED.cpp | 22 ++++++++++++++++++++++ src/notaries_STAKED.h | 26 +++++--------------------- 4 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 src/notaries_STAKED.cpp diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 046abff82..10145013b 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,7 +3,7 @@ #include "notarisationdb.h" #include "notaries_STAKED.h" -extern char *notaries_STAKED; +//extern char *notaries_STAKED; int GetSymbolAuthority(const char* symbol) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 08ed1a91a..7bec772b1 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,7 +22,7 @@ #define KOMODO_MAINNET_START 178999 -extern char *notaries_STAKED; +//extern char *notaries_STAKED; const char *Notaries_genesis[][2] = { diff --git a/src/notaries_STAKED.cpp b/src/notaries_STAKED.cpp new file mode 100644 index 000000000..e34100eff --- /dev/null +++ b/src/notaries_STAKED.cpp @@ -0,0 +1,22 @@ +#include "notaries_STAKED.h" + +const char *notaries_STAKED[][2] = +{ + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s +}; diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 99169f1a6..b6e209733 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,22 +1,6 @@ -#pragma once +#ifndef NOTARIES_STAKED +#define NOTARIES_STAKED -const char *notaries_STAKED[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; +extern char *notaries_STAKED[][2]; + +#endif From 550e9a54ac185935bb1b87ed53546182fb0c8467 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 02:19:24 +0800 Subject: [PATCH 0083/4463] i --- src/notaries_STAKED.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index b6e209733..479979a57 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,6 +1,26 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED -extern char *notaries_STAKED[][2]; +//extern char *notaries_STAKED[][2]; +const char *notaries_STAKED[][2] = +{ + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s +}; #endif From 9b97cb1a5dadef69047f6ebf39ad84828098a61b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 02:54:13 +0800 Subject: [PATCH 0084/4463] one more time --- src/notaries_STAKED.cpp | 7 +++++++ src/notaries_STAKED.h | 12 +++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/notaries_STAKED.cpp b/src/notaries_STAKED.cpp index e34100eff..a012bc08c 100644 --- a/src/notaries_STAKED.cpp +++ b/src/notaries_STAKED.cpp @@ -20,3 +20,10 @@ const char *notaries_STAKED[][2] = {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; + +bool is_STAKED() { + int32_t STAKED = 0; + if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) + STAKED = 1; + return(STAKED) +} diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 479979a57..f6be14222 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,9 +1,11 @@ -#ifndef NOTARIES_STAKED -#define NOTARIES_STAKED +#ifndef NOTARIES_STAKED_H +#define NOTARIES_STAKED_H -//extern char *notaries_STAKED[][2]; +extern const char *notaries_STAKED[][2]; -const char *notaries_STAKED[][2] = +bool is_STAKED(); + +/*const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -22,5 +24,5 @@ const char *notaries_STAKED[][2] = {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; +};*/ #endif From f58cc01b5e0451e1c8f3182523d3639c3a17d559 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 02:58:53 +0800 Subject: [PATCH 0085/4463] ; --- src/notaries_STAKED.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_STAKED.cpp b/src/notaries_STAKED.cpp index a012bc08c..2038f6897 100644 --- a/src/notaries_STAKED.cpp +++ b/src/notaries_STAKED.cpp @@ -26,4 +26,4 @@ bool is_STAKED() { if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) STAKED = 1; return(STAKED) -} +}; From 75a86d88a299c8251193b09ae4cb3894832ae4df Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 03:10:28 +0800 Subject: [PATCH 0086/4463] ? --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- src/notaries_STAKED.cpp | 4 +++- src/notaries_STAKED.h | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 10145013b..6b4f1d7ad 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -55,7 +55,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.size = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); + auth.size = num_notaries_STAKED; auth.requiredSigs = 3; for (int n=0; n Date: Fri, 21 Sep 2018 03:12:24 +0800 Subject: [PATCH 0087/4463] ? --- src/notaries_STAKED.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 23e58e1ee..814cc0a7a 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,5 +1,5 @@ -#ifndef NOTARIES_STAKED_H -#define NOTARIES_STAKED_H +//#ifndef NOTARIES_STAKED_H +//#define NOTARIES_STAKED_H extern const char *notaries_STAKED[][2]; extern int num_notaries_STAKED; @@ -26,4 +26,4 @@ bool is_STAKED(); {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s };*/ -#endif +//#endif From 41c25e89db3dc730229e07b578dfe96a90265309 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 03:16:35 +0800 Subject: [PATCH 0088/4463] ? --- src/notaries_STAKED.cpp | 2 +- src/notaries_STAKED.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_STAKED.cpp b/src/notaries_STAKED.cpp index 41b106066..b3c97020a 100644 --- a/src/notaries_STAKED.cpp +++ b/src/notaries_STAKED.cpp @@ -28,4 +28,4 @@ bool is_STAKED() { return(STAKED) }; -int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 814cc0a7a..4b2f8ba90 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -2,7 +2,7 @@ //#define NOTARIES_STAKED_H extern const char *notaries_STAKED[][2]; -extern int num_notaries_STAKED; +extern const int num_notaries_STAKED; bool is_STAKED(); From 24f0f84417bd0dc89d48f741c91a01cf36953c03 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 11:20:09 +0800 Subject: [PATCH 0089/4463] try this --- src/notaries_STAKED.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_STAKED.h b/src/notaries_STAKED.h index 4b2f8ba90..7bf13b8c9 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_STAKED.h @@ -1,5 +1,5 @@ -//#ifndef NOTARIES_STAKED_H -//#define NOTARIES_STAKED_H +#ifndef NOTARIES_STAKED_H +#define NOTARIES_STAKED_H extern const char *notaries_STAKED[][2]; extern const int num_notaries_STAKED; @@ -26,4 +26,4 @@ bool is_STAKED(); {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s };*/ -//#endif +#endif From b7a3348ed19dde86b3dbc174d3f48db39aa703bd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 11:43:32 +0800 Subject: [PATCH 0090/4463] change some stuff --- src/crosschain_authority.cpp | 3 ++- src/komodo_notary.h | 3 ++- src/{notaries_STAKED.cpp => notaries_staked.cpp} | 5 +++-- src/{notaries_STAKED.h => notaries_staked.h} | 11 +++++++---- 4 files changed, 14 insertions(+), 8 deletions(-) rename src/{notaries_STAKED.cpp => notaries_staked.cpp} (94%) rename src/{notaries_STAKED.h => notaries_staked.h} (91%) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 6b4f1d7ad..6ccf631dc 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,7 +3,8 @@ #include "notarisationdb.h" #include "notaries_STAKED.h" -//extern char *notaries_STAKED; +extern const char *notaries_STAKED[][2]; +extern const int num_notaries_STAKED; int GetSymbolAuthority(const char* symbol) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index cf485e41f..cab36642d 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,7 +22,8 @@ #define KOMODO_MAINNET_START 178999 -//extern char *notaries_STAKED; +extern const char *notaries_STAKED[][2]; +extern const int num_notaries_STAKED; const char *Notaries_genesis[][2] = { diff --git a/src/notaries_STAKED.cpp b/src/notaries_staked.cpp similarity index 94% rename from src/notaries_STAKED.cpp rename to src/notaries_staked.cpp index b3c97020a..daab6fe3d 100644 --- a/src/notaries_STAKED.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,6 @@ #include "notaries_STAKED.h" -const char *notaries_STAKED[][2] = +/*const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -20,6 +20,7 @@ const char *notaries_STAKED[][2] = {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; +*/ bool is_STAKED() { bool STAKED = 0; @@ -28,4 +29,4 @@ bool is_STAKED() { return(STAKED) }; -const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +//const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_STAKED.h b/src/notaries_staked.h similarity index 91% rename from src/notaries_STAKED.h rename to src/notaries_staked.h index 7bf13b8c9..ba491dd95 100644 --- a/src/notaries_STAKED.h +++ b/src/notaries_staked.h @@ -1,12 +1,12 @@ #ifndef NOTARIES_STAKED_H #define NOTARIES_STAKED_H -extern const char *notaries_STAKED[][2]; -extern const int num_notaries_STAKED; +//extern const char *notaries_STAKED[][2]; +//extern const int num_notaries_STAKED; bool is_STAKED(); -/*const char *notaries_STAKED[][2] = +const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -25,5 +25,8 @@ bool is_STAKED(); {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -};*/ +}; + +const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); + #endif From 6f3af3ff83c717689b3ed1551b0dcaffbf69bd7b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 11:46:25 +0800 Subject: [PATCH 0091/4463] Change minsigs to 4, remove supply hack. --- src/crosschain_authority.cpp | 2 +- src/komodo.h | 2 +- src/komodo_utils.h | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 7cec5f382..a010126a1 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -76,7 +76,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; auth.size = (int32_t)(sizeof(notaries_STAKEDcc)/sizeof(*notaries_STAKEDcc)); - auth.requiredSigs = 3; + auth.requiredSigs = 4; for (int n=0; n= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) || - ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) && numvalid > 3 ) + ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) && numvalid > 4 ) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 4856931ac..44516ba6b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1554,7 +1554,7 @@ void komodo_args(char *argv0) if ( name.c_str()[0] != 0 ) { MAX_BLOCK_SIGOPS = 60000; - ASSETCHAINS_SUPPLY = ( GetArg("-ac_supply",10) + 1 ); + ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); ASSETCHAINS_ENDSUBSIDY = GetArg("-ac_end",0); ASSETCHAINS_REWARD = GetArg("-ac_reward",0); ASSETCHAINS_HALVING = GetArg("-ac_halving",0); @@ -1752,4 +1752,3 @@ void komodo_prefetch(FILE *fp) } fseek(fp,fpos,SEEK_SET); } - From 95918c6402d806a7d6793bec58370db1ee0f361d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 12:29:39 +0800 Subject: [PATCH 0092/4463] fix dumbness --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 27 +-------------------------- src/notaries_staked.cpp | 2 +- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 849c083bc..b382b4fc9 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -1,7 +1,7 @@ #include "cc/eval.h" #include "crosschain.h" #include "notarisationdb.h" -#include "notaries_STAKED.h" +#include "notaries_staked.h" extern const char *notaries_STAKED[][2]; extern const int num_notaries_STAKED; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index b5e147855..7b041f8b9 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,32 +18,7 @@ #include "komodo_cJSON.h" -<<<<<<< HEAD -//include "notaries_STAKED.h" -//{"kmdcrazy", "02da444a2627d420f1f622fcdfb9bddb67d6d4241ad6b4d5054716ddbde8a25dfb"} // RJPJBbHcm5mkAxhkkERHRfEE9Cvkr4Euoi -const char *notaries_STAKED[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; -======= -#include "notaries_STAKED.h" ->>>>>>> blackjok3r +#include "notaries_staked.h" #define KOMODO_MAINNET_START 178999 diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index daab6fe3d..9f6301f80 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,4 +1,4 @@ -#include "notaries_STAKED.h" +#include "notaries_staked.h" /*const char *notaries_STAKED[][2] = { From 9f1e5ad6c0ffd3d11f667e262c28f1c553fda919 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 12:41:10 +0800 Subject: [PATCH 0093/4463] runnign around in circles here, little sense! --- src/notaries_staked.cpp | 6 +++--- src/notaries_staked.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 9f6301f80..a3b3844d3 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,6 @@ #include "notaries_staked.h" -/*const char *notaries_STAKED[][2] = +const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -20,7 +20,7 @@ {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; -*/ + bool is_STAKED() { bool STAKED = 0; @@ -29,4 +29,4 @@ bool is_STAKED() { return(STAKED) }; -//const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index ba491dd95..59e083a41 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,12 +1,12 @@ #ifndef NOTARIES_STAKED_H #define NOTARIES_STAKED_H -//extern const char *notaries_STAKED[][2]; -//extern const int num_notaries_STAKED; +extern const char *notaries_STAKED[][2]; +extern const int num_notaries_STAKED; bool is_STAKED(); -const char *notaries_STAKED[][2] = +/*const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -28,5 +28,5 @@ const char *notaries_STAKED[][2] = }; const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); - +*/ #endif From 3dcbdcb85c3c441fbacc3916c8f8bfeaaaca6e19 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:08:13 +0800 Subject: [PATCH 0094/4463] try something else --- src/notaries_staked.cpp | 4 ++-- src/notaries_staked.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index a3b3844d3..9350ecdf2 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,6 @@ #include "notaries_staked.h" -const char *notaries_STAKED[][2] = +extern const char *const notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -29,4 +29,4 @@ bool is_STAKED() { return(STAKED) }; -const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +extern const int const num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 59e083a41..a3d3599b7 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,8 +1,8 @@ #ifndef NOTARIES_STAKED_H #define NOTARIES_STAKED_H -extern const char *notaries_STAKED[][2]; -extern const int num_notaries_STAKED; +extern const char *const notaries_STAKED[][2]; +extern const int const num_notaries_STAKED; bool is_STAKED(); From bb7815b05bd650fefb8e89051f4e9c9fa795f8ef Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:09:53 +0800 Subject: [PATCH 0095/4463] that didnt work --- src/notaries_staked.cpp | 4 ++-- src/notaries_staked.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 9350ecdf2..0a9db207d 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,6 @@ #include "notaries_staked.h" -extern const char *const notaries_STAKED[][2] = +extern const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -29,4 +29,4 @@ bool is_STAKED() { return(STAKED) }; -extern const int const num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +extern const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index a3d3599b7..59e083a41 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,8 +1,8 @@ #ifndef NOTARIES_STAKED_H #define NOTARIES_STAKED_H -extern const char *const notaries_STAKED[][2]; -extern const int const num_notaries_STAKED; +extern const char *notaries_STAKED[][2]; +extern const int num_notaries_STAKED; bool is_STAKED(); From 158d7befbc384c5d45ecada1c35d5e373ecb4858 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:11:12 +0800 Subject: [PATCH 0096/4463] WTF!??!? --- src/notaries_staked.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 59e083a41..9b843f2c5 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,6 +1,3 @@ -#ifndef NOTARIES_STAKED_H -#define NOTARIES_STAKED_H - extern const char *notaries_STAKED[][2]; extern const int num_notaries_STAKED; @@ -29,4 +26,3 @@ bool is_STAKED(); const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); */ -#endif From 14acb852d578d8ca39da6834bed7124449c439f4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:23:00 +0800 Subject: [PATCH 0097/4463] try again --- src/notaries_staked.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 0a9db207d..a3b3844d3 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,6 @@ #include "notaries_staked.h" -extern const char *notaries_STAKED[][2] = +const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -29,4 +29,4 @@ bool is_STAKED() { return(STAKED) }; -extern const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); From 1183a043b2a561327b09eac8b11d62edd7a7b30e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:28:25 +0800 Subject: [PATCH 0098/4463] try again --- src/crosschain_authority.cpp | 4 ++-- src/komodo_notary.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index b382b4fc9..31ea0b547 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,8 +3,8 @@ #include "notarisationdb.h" #include "notaries_staked.h" -extern const char *notaries_STAKED[][2]; -extern const int num_notaries_STAKED; +//extern const char *notaries_STAKED[][2]; +//extern const int num_notaries_STAKED; int GetSymbolAuthority(const char* symbol) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 7b041f8b9..d8b25a0ef 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,8 +22,8 @@ #define KOMODO_MAINNET_START 178999 -extern const char *notaries_STAKED[][2]; -extern const int num_notaries_STAKED; +//extern const char *notaries_STAKED[][2]; +//extern const int num_notaries_STAKED; const char *Notaries_genesis[][2] = { From 9a469cda6f4c03c8dd136ab4089bd28db913be6b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:37:26 +0800 Subject: [PATCH 0099/4463] try hardcode of array length --- src/notaries_staked.cpp | 4 ++-- src/notaries_staked.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index a3b3844d3..24c8562df 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,6 @@ #include "notaries_staked.h" -const char *notaries_STAKED[][2] = +const char *notaries_STAKED[17][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -29,4 +29,4 @@ bool is_STAKED() { return(STAKED) }; -const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 9b843f2c5..ef54eb6aa 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,5 +1,5 @@ -extern const char *notaries_STAKED[][2]; -extern const int num_notaries_STAKED; +extern const char *notaries_STAKED[17[2]; +extern int num_notaries_STAKED; bool is_STAKED(); From 3539848b6031b76204a2a0e2675c26b478eaec38 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 13:41:40 +0800 Subject: [PATCH 0100/4463] typo --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index ef54eb6aa..3defe851c 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,4 +1,4 @@ -extern const char *notaries_STAKED[17[2]; +extern const char *notaries_STAKED[17][2]; extern int num_notaries_STAKED; bool is_STAKED(); From bb33491657b778b6e9bc02bde8c8a8b9ae3ecc87 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 15:11:36 +0800 Subject: [PATCH 0101/4463] thanks mike --- src/notaries_staked.cpp | 12 ++++++++---- src/notaries_staked.h | 5 +++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 24c8562df..735136b7d 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,10 @@ -#include "notaries_staked.h" -const char *notaries_STAKED[17][2] = +#include "notaries_staked.h" +#include + +extern char ASSETCHAINS_SYMBOL[65]; + +const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg @@ -26,7 +30,7 @@ bool is_STAKED() { bool STAKED = 0; if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) STAKED = 1; - return(STAKED) + return(STAKED); }; -int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +int num_notaries_STAKED = (sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 3defe851c..d7ea4c4fd 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -1,3 +1,7 @@ + +#ifndef NOTARIES_STAKED +#define NOTARIES_STAKED + extern const char *notaries_STAKED[17][2]; extern int num_notaries_STAKED; @@ -26,3 +30,4 @@ bool is_STAKED(); const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); */ +#endif From c83285ffe2dcfe09cfa637121da2fb5d6548b447 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 15:24:53 +0800 Subject: [PATCH 0102/4463] add include file to makefile ... Please work?! --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile.am b/src/Makefile.am index 7113a1e42..de476385e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -291,6 +291,7 @@ libbitcoin_server_a_SOURCES = \ metrics.cpp \ miner.cpp \ net.cpp \ + notaries_staked.cpp \ noui.cpp \ notarisationdb.cpp \ paymentdisclosure.cpp \ From 77ee7feec84a9e91f7d7532f0c06340da4d10d61 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 15:43:16 +0800 Subject: [PATCH 0103/4463] about to blow it up --- src/bitcoin-cli.cpp | 3 ++- src/komodo_notary.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index bf189e483..db99b6a67 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -74,11 +74,12 @@ public: #include "komodo_globals.h" #include "komodo_utils.h" #include "komodo_cJSON.c" +#include "notaries_staked.h" #include "komodo_notary.h" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { - + } uint32_t komodo_heightstamp(int32_t height) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d8b25a0ef..45f325648 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,7 +18,7 @@ #include "komodo_cJSON.h" -#include "notaries_staked.h" +//#include "notaries_staked.h" #define KOMODO_MAINNET_START 178999 From 7384746b72d090a32f92e8d69fe85f7277292828 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 15:48:26 +0800 Subject: [PATCH 0104/4463] WTFWTFW --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 45f325648..d8b25a0ef 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -18,7 +18,7 @@ #include "komodo_cJSON.h" -//#include "notaries_staked.h" +#include "notaries_staked.h" #define KOMODO_MAINNET_START 178999 From 3b210ee00cbd89399088c3dadb4eda43b4740b0f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 15:57:30 +0800 Subject: [PATCH 0105/4463] WTFTWTFEWIDlknPI --- src/bitcoin-cli.cpp | 1 - src/notaries_staked.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index db99b6a67..60a185284 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -74,7 +74,6 @@ public: #include "komodo_globals.h" #include "komodo_utils.h" #include "komodo_cJSON.c" -#include "notaries_staked.h" #include "komodo_notary.h" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index d7ea4c4fd..b8243513d 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -2,7 +2,7 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED -extern const char *notaries_STAKED[17][2]; +extern const char *notaries_STAKED[][2]; extern int num_notaries_STAKED; bool is_STAKED(); From 5f2b70662553a62518d9bd680bb43cafe911f21e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 16:09:51 +0800 Subject: [PATCH 0106/4463] meh --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile.am b/src/Makefile.am index de476385e..0559230c0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -179,6 +179,7 @@ BITCOIN_CORE_H = \ mruset.h \ net.h \ netbase.h \ + notaries_staked.h \ noui.h \ paymentdisclosure.h \ paymentdisclosuredb.h \ From 263c24b266e9e4537772064da62c0725f0d6a152 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 16:56:34 +0800 Subject: [PATCH 0107/4463] maybe --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 60a185284..6164cf463 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -75,6 +75,7 @@ public: #include "komodo_utils.h" #include "komodo_cJSON.c" #include "komodo_notary.h" +#include "notaries_staked.cpp" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From c85b1ace10f684a7e92282011231f6a858529377 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 17:02:22 +0800 Subject: [PATCH 0108/4463] hmmmm --- src/notaries_staked.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 735136b7d..01e09bf07 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -25,7 +25,6 @@ const char *notaries_STAKED[][2] = {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; - bool is_STAKED() { bool STAKED = 0; if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) From 90f50a9ee705766c3bc369f83e2677d2defdac92 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 17:15:21 +0800 Subject: [PATCH 0109/4463] add is_staked function --- src/crosschain_authority.cpp | 7 ++----- src/komodo.h | 3 ++- src/komodo_notary.h | 2 +- src/main.cpp | 4 ++-- src/notaries_staked.h | 25 ++----------------------- 5 files changed, 9 insertions(+), 32 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 31ea0b547..cca6d6b21 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -3,14 +3,11 @@ #include "notarisationdb.h" #include "notaries_staked.h" -//extern const char *notaries_STAKED[][2]; -//extern const int num_notaries_STAKED; - int GetSymbolAuthority(const char* symbol) { if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if ( (strncmp(symbol, "STKD", 4) == 0) || (strncmp(symbol, "STAKED", 6) == 0) ) + if (is_STAKED() == 1) return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } @@ -56,7 +53,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.requiredSigs = 4; + auth.requiredSigs = STAKED_MIN_SIGS; auth.size = num_notaries_STAKED; for (int n=0; n= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) || - ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) && numvalid > 4 ) + ( (is_STAKED == 1) && (numvalid > STAKED_MIN_SIGS) ) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d8b25a0ef..6cb69ef0c 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -231,7 +231,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) + if (is_STAKED == 1) { n1 = num_notaries_STAKED; for (i=0; i> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; - if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) + if ( is_STAKED == 1 ) { if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) { diff --git a/src/notaries_staked.h b/src/notaries_staked.h index b8243513d..eac34e0d0 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -5,29 +5,8 @@ extern const char *notaries_STAKED[][2]; extern int num_notaries_STAKED; +static const int STAKED_MIN_SIGS = 4; + bool is_STAKED(); -/*const char *notaries_STAKED[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; - -const int num_notaries_STAKED = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); -*/ #endif From 0233e249cf1cd2079b69553ded79a594717d5697 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 17:19:16 +0800 Subject: [PATCH 0110/4463] change to int --- src/notaries_staked.cpp | 2 +- src/notaries_staked.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 01e09bf07..323ec094f 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -25,7 +25,7 @@ const char *notaries_STAKED[][2] = {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; -bool is_STAKED() { +int is_STAKED() { bool STAKED = 0; if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) STAKED = 1; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index eac34e0d0..bf8c3c58e 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,6 +7,6 @@ extern int num_notaries_STAKED; static const int STAKED_MIN_SIGS = 4; -bool is_STAKED(); +int is_STAKED(); #endif From c2ec9c54688da5386af23959e29256bb0d90d0e9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 17:21:30 +0800 Subject: [PATCH 0111/4463] syntax --- src/komodo.h | 2 +- src/komodo_notary.h | 2 +- src/main.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 7c8a226df..4ff65fa18 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -858,7 +858,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) || - ( (is_STAKED == 1) && (numvalid > STAKED_MIN_SIGS) ) + ( (is_STAKED() == 1) && (numvalid > STAKED_MIN_SIGS) ) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 6cb69ef0c..d4f3e4ead 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -231,7 +231,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { if ( did1 == 0 ) { - if (is_STAKED == 1) + if (is_STAKED() == 1) { n1 = num_notaries_STAKED; for (i=0; i> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; - if ( is_STAKED == 1 ) + if ( is_STAKED() == 1 ) { if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) { From d35a88824596927ed36405b9d322f3d03250d522 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 21 Sep 2018 17:23:26 +0800 Subject: [PATCH 0112/4463] ) --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 4ff65fa18..cdf660189 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -858,7 +858,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) || - ( (is_STAKED() == 1) && (numvalid > STAKED_MIN_SIGS) ) + ( (is_STAKED() == 1) && (numvalid > STAKED_MIN_SIGS) )) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { From b076f0ed148421a8ff06860ac1d6ce710670ddd5 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Sat, 22 Sep 2018 23:58:55 +0000 Subject: [PATCH 0113/4463] edit assetchains.json STAKED chains --- src/assetchains.json | 195 +++++++++++-------------------------------- 1 file changed, 51 insertions(+), 144 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index ceda4cce1..9faa54f16 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -1,149 +1,56 @@ [ { - "ac_name": "REVS", - "ac_supply": "1300000" - }, - { - "ac_name": "SUPERNET", - "ac_supply": "816061" - }, - { - "ac_name": "DEX", - "ac_supply": "999999" - }, - { - "ac_name": "PANGEA", - "ac_supply": "999999" - }, - { - "ac_name": "JUMBLR", - "ac_supply": "999999" - }, - { - "ac_name": "BET", - "ac_supply": "999999" - }, - { - "ac_name": "CRYPTO", - "ac_supply": "999999" - }, - { - "ac_name": "HODL", - "ac_supply": "9999999" - }, - { - "ac_name": "MSHARK", - "ac_supply": "1400000" - }, - { - "ac_name": "BOTS", - "ac_supply": "999999" - }, - { - "ac_name": "MGW", - "ac_supply": "999999" - }, - { - "ac_name": "COQUI", - "ac_supply": "72000000", - "ac_ccactivate": "200000" - }, - { - "ac_name": "WLC", - "ac_supply": "210000000" - }, - { - "ac_name": "KV", - "ac_supply": "1000000" - }, - { - "ac_name": "CEAL", - "ac_supply": "366666666" - }, - { - "ac_name": "MESH", - "ac_supply": "1000007" - }, - { - "ac_name": "MNZ", - "ac_supply": "257142858" - }, - { - "ac_name": "AXO", - "ac_supply": "200000000" - }, - { - "ac_name": "ETOMIC", - "ac_supply": "100000000" - }, - { - "ac_name": "BTCH", - "ac_supply": "20998641" - }, - { - "ac_name": "PIZZA", - "ac_supply": "100000000" - }, - { - "ac_name": "BEER", - "ac_supply": "100000000" - }, - { - "ac_name": "NINJA", - "ac_supply": "100000000" - }, - { - "ac_name": "OOT", - "ac_supply": "216000000" - }, - { - "ac_name": "BNTN", - "ac_supply": "500000000" - }, - { - "ac_name": "CHAIN", - "ac_supply": "999999" - }, - { - "ac_name": "PRLPAY", - "ac_supply": "500000000" - }, - { - "ac_name": "DSEC", - "ac_supply": "7000000" - }, - { - "ac_name": "GLXT", - "ac_supply": "10000000000" - }, - { - "ac_name": "EQL", - "ac_supply": "500000000" - }, - { - "ac_name": "ZILLA", - "ac_supply": "11000000" - }, - { - "ac_name": "RFOX", - "ac_supply": "1000000000", - "ac_reward": "100000000" - }, - { - "ac_name": "SEC", - "ac_supply": "1000000000", - "ac_cc": "333" - }, - { - "ac_name": "CCL", - "ac_supply": "200000000", - "ac_end": "1", - "ac_cc": "2", - "addressindex": "1", - "spentindex": "1", + "ac_name": "STAKEDB1", + "ac_supply": "100000", + "ac_reward" : "1000000000", + "ac_cc": "667", "addnode": [ - "142.93.136.89", - "195.201.22.89" + "195.201.137.5", + "195.201.20.230" ] - } + }, + { + "ac_name": "STAKEDW1", + "ac_supply": "100000", + "ac_reward" : "1000000000", + "ac_cc": "667", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] + }, + { + "ac_name": "STAKEDPERC", + "ac_supply": "1000000", + "ac_reward" : "1000000000", + "ac_cc": "667", + "ac_perc": "10000000", + "ac_pubkey": "03bd221868abc063b54a3fceafb9898b1931ed767298a17ac0c9923500a7c60e4b", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] + }, + { + "ac_name": "STAKEDS1", + "ac_supply": "1000000", + "ac_reward" : "1000000000", + "ac_cc": "667", + "ac_staked": "10", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] + }, + { + "ac_name": "STAKEDS9", + "ac_supply": "1000000", + "ac_reward" : "1000000000", + "ac_cc": "667", + "ac_staked": "90", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] + } ] From 44f2c39adae28a792dd3fef97b688373f09939ae Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 15:27:14 +0800 Subject: [PATCH 0114/4463] try and add eras, for notaries, with timestamp activation --- src/crosschain_authority.cpp | 2 +- src/komodo.h | 3 +- src/komodo_notary.h | 132 ++++++++++++++++++++++++----------- src/main.cpp | 2 +- src/notaries_staked.cpp | 91 +++++++++++++++++++++++- src/notaries_staked.h | 15 +++- 6 files changed, 199 insertions(+), 46 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index cca6d6b21..1d9ba93f4 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -7,7 +7,7 @@ int GetSymbolAuthority(const char* symbol) { if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (is_STAKED() == 1) + if (is_STAKED() != 0) return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } diff --git a/src/komodo.h b/src/komodo.h index cdf660189..d1587fbb4 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -857,8 +857,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) numvalid = bitweight(signedmask); if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || - numvalid > (numnotaries/5)) || - ( (is_STAKED() == 1) && (numvalid > STAKED_MIN_SIGS) )) + numvalid > (numnotaries/5)) ) { if ( ASSETCHAINS_SYMBOL[0] != 0 ) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d4f3e4ead..87947a9b8 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -206,53 +206,107 @@ const char *Notaries_elected1[][2] = int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; + static uint8_t staked_pubkeys[64][33],staked_pubkeys1[64][33],didstaked,didstaked1; static int32_t ns,ns1; + static uint8_t staked_pubkeys2[64][33],staked_pubkeys3[64][33],didstaked2,didstaked3; static int32_t ns2,ns3; + int staked_era; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) timestamp = komodo_heightstamp(height); else if ( ASSETCHAINS_SYMBOL[0] == 0 ) timestamp = 0; - if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. + if (is_STAKED() == 0) { - if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) - { - if ( did0 == 0 ) - { - n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); - for (i=0; i= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) + { + if ( did0 == 0 ) + { + n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; diff --git a/src/main.cpp b/src/main.cpp index e86fe47bc..596518ecf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5954,7 +5954,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, CAddress addrFrom; uint64_t nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; - if ( is_STAKED() == 1 ) + if ( is_STAKED() != 0 ) { if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) { diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 323ec094f..4f335a444 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -4,6 +4,7 @@ extern char ASSETCHAINS_SYMBOL[65]; +// Era 0 set of pubkeys const char *notaries_STAKED[][2] = { {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x @@ -25,11 +26,97 @@ const char *notaries_STAKED[][2] = {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s }; +int num_notaries_STAKED = (sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); + +// Era 1 set of pubkeys +const char *notaries_STAKED1[][2] = +{ + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s +}; + +int num_notaries_STAKED1 = (sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1)); + +// Era 2 set of pubkeys +const char *notaries_STAKED2[][2] = +{ + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s +}; + +int num_notaries_STAKED2 = (sizeof(notaries_STAKED2)/sizeof(*notaries_STAKED2)); + +// Era 3 set of pubkeys +const char *notaries_STAKED3[][2] = +{ + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s +}; + +int num_notaries_STAKED3 = (sizeof(notaries_STAKED3)/sizeof(*notaries_STAKED3)); + int is_STAKED() { - bool STAKED = 0; + int STAKED = 0; if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) STAKED = 1; return(STAKED); }; -int num_notaries_STAKED = (sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); +int STAKED_era(uint32_t timestamp) +{ + int era; + if (timestamp <= STAKED_NOTARIES_TIMESTAMP) + era = 0; + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP1 && timestamp >= STAKED_NOTARIES_TIMESTAMP) + era = 1; + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= STAKED_NOTARIES_TIMESTAMP1) + era = 2; + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= STAKED_NOTARIES_TIMESTAMP2) + era = 3; + return(era); +} diff --git a/src/notaries_staked.h b/src/notaries_staked.h index bf8c3c58e..201f8cb40 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -2,11 +2,24 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED +static const uint32_t STAKED_NOTARIES_TIMESTAMP = 1537780949; +static const uint32_t STAKED_NOTARIES_TIMESTAMP1 = 1537791749; +static const uint32_t STAKED_NOTARIES_TIMESTAMP2 = 1537802549; +static const uint32_t STAKED_NOTARIES_TIMESTAMP3 = 1537813349; + extern const char *notaries_STAKED[][2]; extern int num_notaries_STAKED; -static const int STAKED_MIN_SIGS = 4; +extern const char *notaries_STAKED1[][2]; +extern int num_notaries_STAKED1; + +extern const char *notaries_STAKED2[][2]; +extern int num_notaries_STAKED2; + +extern const char *notaries_STAKED3[][2]; +extern int num_notaries_STAKED3; int is_STAKED(); +int STAKED_era(uint32_t timestamp); #endif From 91c308014611e1b9edb5b8bf423d8a533fc9e85c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 15:37:15 +0800 Subject: [PATCH 0115/4463] hmmm need to have height activation for MoMoM aswell, as uses a diffrent array for its pubkeys,disable this for now to test. --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 1d9ba93f4..06a01dbd5 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -53,7 +53,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.requiredSigs = STAKED_MIN_SIGS; + auth.requiredSigs = 4; auth.size = num_notaries_STAKED; for (int n=0; n Date: Mon, 24 Sep 2018 15:43:43 +0800 Subject: [PATCH 0116/4463] change to just int, compiler was mad --- src/notaries_staked.cpp | 2 +- src/notaries_staked.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 4f335a444..81d249d96 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -107,7 +107,7 @@ int is_STAKED() { return(STAKED); }; -int STAKED_era(uint32_t timestamp) +int STAKED_era(int timestamp) { int era; if (timestamp <= STAKED_NOTARIES_TIMESTAMP) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 201f8cb40..84296d4e5 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -2,10 +2,10 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED -static const uint32_t STAKED_NOTARIES_TIMESTAMP = 1537780949; -static const uint32_t STAKED_NOTARIES_TIMESTAMP1 = 1537791749; -static const uint32_t STAKED_NOTARIES_TIMESTAMP2 = 1537802549; -static const uint32_t STAKED_NOTARIES_TIMESTAMP3 = 1537813349; +static const int STAKED_NOTARIES_TIMESTAMP = 1537780949; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537791749; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537802549; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537813349; extern const char *notaries_STAKED[][2]; extern int num_notaries_STAKED; @@ -20,6 +20,6 @@ extern const char *notaries_STAKED3[][2]; extern int num_notaries_STAKED3; int is_STAKED(); -int STAKED_era(uint32_t timestamp); +int STAKED_era(int timestamp); #endif From 5ef1dc51272e4c036c4d23fe492029c03286ebde Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 15:45:03 +0800 Subject: [PATCH 0117/4463] ; --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 87947a9b8..5c85c0885 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -303,7 +303,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam memcpy(pubkeys,staked_pubkeys3,ns1 * 33); return(ns3); } - free(staked_era) + free(staked_era); } } From 533cb0369c9daab7a387d7096ac4a1019fd8ee1b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 15:46:38 +0800 Subject: [PATCH 0118/4463] pointless line remove --- src/komodo_notary.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 5c85c0885..8be1c2feb 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -303,7 +303,6 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam memcpy(pubkeys,staked_pubkeys3,ns1 * 33); return(ns3); } - free(staked_era); } } From fdf332d9abcf8be292dc573620da298c59d38a11 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 16:24:25 +0800 Subject: [PATCH 0119/4463] fix silly --- src/komodo_notary.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 8be1c2feb..af84287b4 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -264,7 +264,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam didstaked = 1; printf("THIS CHAIN IS A STAKED CHAIN and is era 0 \n"); } - memcpy(pubkeys,staked_pubkeys,n1 * 33); + memcpy(pubkeys,staked_pubkeys,ns * 33); return(ns); } else if (staked_era == 1) { @@ -288,7 +288,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam didstaked2 = 1; printf("THIS CHAIN IS A STAKED CHAIN and is era 2 \n"); } - memcpy(pubkeys,staked_pubkeys2,ns1 * 33); + memcpy(pubkeys,staked_pubkeys2,ns2 * 33); return(ns2); } else if (staked_era == 3) { @@ -300,7 +300,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam didstaked2 = 1; printf("THIS CHAIN IS A STAKED CHAIN and is era 3 \n"); } - memcpy(pubkeys,staked_pubkeys3,ns1 * 33); + memcpy(pubkeys,staked_pubkeys3,ns3 * 33); return(ns3); } } From 6120642eb124099c2b0b63f1104eaa84e412809d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 18:58:38 +0800 Subject: [PATCH 0120/4463] add a print for isstaked --- src/crosschain_authority.cpp | 3 ++- src/komodo_notary.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 06a01dbd5..049b97cd4 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -8,6 +8,7 @@ int GetSymbolAuthority(const char* symbol) if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; if (is_STAKED() != 0) + printf("RETURNED CROSSCHAIN STAKED AS TRUE"); return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } @@ -53,7 +54,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; - auth.requiredSigs = 4; + auth.requiredSigs = (num_notaries_STAKED / 5); auth.size = num_notaries_STAKED; for (int n=0; n Date: Mon, 24 Sep 2018 19:14:59 +0800 Subject: [PATCH 0121/4463] fix format --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 049b97cd4..aa2188457 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -8,7 +8,7 @@ int GetSymbolAuthority(const char* symbol) if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; if (is_STAKED() != 0) - printf("RETURNED CROSSCHAIN STAKED AS TRUE"); + printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; } From b2c4fd58ecc344f9f92c34fdcf9a90d447b5f5a8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 19:45:17 +0800 Subject: [PATCH 0122/4463] add another print --- src/notarisationdb.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 779489fd8..0df999e53 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -24,6 +24,8 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) NotarisationData data; bool parsed = ParseNotarisationOpReturn(tx, data); + printf("Parsed notarisation data for %s",data.symbol); + if (!parsed) data = NotarisationData(); int authority = GetSymbolAuthority(data.symbol); From 8496fdbeeded2173d0493448880938419ffb7587 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 19:49:10 +0800 Subject: [PATCH 0123/4463] better? --- src/notarisationdb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 0df999e53..45aff2ac7 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -24,9 +24,10 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) NotarisationData data; bool parsed = ParseNotarisationOpReturn(tx, data); - printf("Parsed notarisation data for %s",data.symbol); + printf("Parsed notarisation data for %s \n",data.symbol); if (!parsed) data = NotarisationData(); + printf("Parsed notarisation data for %s \n",data.symbol); int authority = GetSymbolAuthority(data.symbol); if (authority == CROSSCHAIN_KOMODO) { From d75be221a0b256e3d60750b8fa5339bcce74d4bd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 19:55:23 +0800 Subject: [PATCH 0124/4463] fux stupid error --- src/crosschain_authority.cpp | 2 +- src/komodo_notary.h | 2 +- src/main.cpp | 2 +- src/notaries_staked.cpp | 6 ++---- src/notaries_staked.h | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index aa2188457..1b41c2aad 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -7,7 +7,7 @@ int GetSymbolAuthority(const char* symbol) { if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (is_STAKED() != 0) + if (is_STAKED(symbol) != 0) printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); return CROSSCHAIN_STAKED; return CROSSCHAIN_KOMODO; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 4f1645f98..1b572b17c 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -215,7 +215,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam else if ( ASSETCHAINS_SYMBOL[0] == 0 ) timestamp = 0; // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. - if (is_STAKED() == 0) + if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) { if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) { diff --git a/src/main.cpp b/src/main.cpp index 596518ecf..89aea8360 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5954,7 +5954,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, CAddress addrFrom; uint64_t nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; - if ( is_STAKED() != 0 ) + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) { if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) { diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 81d249d96..33dfa8bb5 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -2,8 +2,6 @@ #include "notaries_staked.h" #include -extern char ASSETCHAINS_SYMBOL[65]; - // Era 0 set of pubkeys const char *notaries_STAKED[][2] = { @@ -100,9 +98,9 @@ const char *notaries_STAKED3[][2] = int num_notaries_STAKED3 = (sizeof(notaries_STAKED3)/sizeof(*notaries_STAKED3)); -int is_STAKED() { +int is_STAKED(const *char chain_name) { int STAKED = 0; - if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) + if ( (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) STAKED = 1; return(STAKED); }; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 84296d4e5..7d3748d4e 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -19,7 +19,7 @@ extern int num_notaries_STAKED2; extern const char *notaries_STAKED3[][2]; extern int num_notaries_STAKED3; -int is_STAKED(); +int is_STAKED(const *char chain_name); int STAKED_era(int timestamp); #endif From 267745130baca8ddbd6db732f06ea7ca9e126643 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 19:58:56 +0800 Subject: [PATCH 0125/4463] ok --- src/notaries_staked.cpp | 2 +- src/notaries_staked.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 33dfa8bb5..0741ecd58 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -98,7 +98,7 @@ const char *notaries_STAKED3[][2] = int num_notaries_STAKED3 = (sizeof(notaries_STAKED3)/sizeof(*notaries_STAKED3)); -int is_STAKED(const *char chain_name) { +int is_STAKED(const char *chain_name) { int STAKED = 0; if ( (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) STAKED = 1; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 7d3748d4e..d0df3906c 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -19,7 +19,7 @@ extern int num_notaries_STAKED2; extern const char *notaries_STAKED3[][2]; extern int num_notaries_STAKED3; -int is_STAKED(const *char chain_name); +int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); #endif From 108c04eaf6bec0725bf1dc48074ff4936b571c12 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:03:01 +0800 Subject: [PATCH 0126/4463] more prints --- src/notarisationdb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 45aff2ac7..9243cd17f 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -27,7 +27,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) printf("Parsed notarisation data for %s \n",data.symbol); if (!parsed) data = NotarisationData(); - printf("Parsed notarisation data for %s \n",data.symbol); + printf("Checked notarisation data for %s \n",data.symbol); int authority = GetSymbolAuthority(data.symbol); if (authority == CROSSCHAIN_KOMODO) { @@ -47,6 +47,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", tx.GetHash().GetHex().data(), nHeight); } + printf("Authorised and added notarisation data for %s \n",data.symbol); return vNotarisations; } From 6f610e9bdd2cc400b082c833dceed8859cdd427e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:06:33 +0800 Subject: [PATCH 0127/4463] things --- src/notarisationdb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 9243cd17f..b79527cca 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -35,6 +35,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) continue; } else if (authority == CROSSCHAIN_STAKED) { if (!CheckTxAuthority(tx, auth_STAKED)) + printf("Authorised notarisation data for %s \n",data.symbol); continue; } @@ -47,7 +48,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", tx.GetHash().GetHex().data(), nHeight); } - printf("Authorised and added notarisation data for %s \n",data.symbol); + printf("Added notarisation data\n"); return vNotarisations; } From 250cb3ffd4d0f47a5c4e81dce2e5ac911b91ed88 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:14:35 +0800 Subject: [PATCH 0128/4463] try again --- src/notarisationdb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index b79527cca..20b412979 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -34,13 +34,14 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime)) continue; } else if (authority == CROSSCHAIN_STAKED) { + printf("Authorised notarisation data for %s \n",data.symbol); if (!CheckTxAuthority(tx, auth_STAKED)) - printf("Authorised notarisation data for %s \n",data.symbol); continue; } if (parsed) { vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); + printf("Added notarisation data for %s \n",data.symbol); //printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n", // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); @@ -48,7 +49,6 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", tx.GetHash().GetHex().data(), nHeight); } - printf("Added notarisation data\n"); return vNotarisations; } From 93381421e1ca4ffc8c54a6ea390dae037c1a0190 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:21:31 +0800 Subject: [PATCH 0129/4463] more --- src/notarisationdb.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 20b412979..d9f1b2aeb 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -31,6 +31,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) int authority = GetSymbolAuthority(data.symbol); if (authority == CROSSCHAIN_KOMODO) { + printf("Authorised notarisation data for %s \n",data.symbol); if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime)) continue; } else if (authority == CROSSCHAIN_STAKED) { @@ -38,7 +39,8 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) if (!CheckTxAuthority(tx, auth_STAKED)) continue; } - + printf("Authorised notarisation data for %s \n",data.symbol); + if (parsed) { vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); printf("Added notarisation data for %s \n",data.symbol); From f7826be127553d469211c0c9cc97cdbdc65e6ad6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:41:19 +0800 Subject: [PATCH 0130/4463] test --- src/crosschain_authority.cpp | 4 +++- src/notarisationdb.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 1b41c2aad..7f95d1533 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -7,9 +7,11 @@ int GetSymbolAuthority(const char* symbol) { if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (is_STAKED(symbol) != 0) + if (is_STAKED(symbol) != 0) { printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); return CROSSCHAIN_STAKED; + } + printf("RETURNED CROSSCHAIN KOMODO AS TRUE\n"); return CROSSCHAIN_KOMODO; } diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index d9f1b2aeb..51b692270 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -40,7 +40,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) continue; } printf("Authorised notarisation data for %s \n",data.symbol); - + if (parsed) { vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); printf("Added notarisation data for %s \n",data.symbol); From 43de331bef672f00acd64d9cbf4baa5f28afac55 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:46:52 +0800 Subject: [PATCH 0131/4463] make staked chains not authorised to test if notarizations are still added --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 7f95d1533..5c0897512 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -7,7 +7,7 @@ int GetSymbolAuthority(const char* symbol) { if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (is_STAKED(symbol) != 0) { + if (is_STAKED("TEST") != 0) { printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); return CROSSCHAIN_STAKED; } From a8412c31cea05d6dc9a1e50998a725b9036965f3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 20:58:30 +0800 Subject: [PATCH 0132/4463] bail from check notarization if there is no valid notarization --- src/notarisationdb.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 51b692270..ee99a8020 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -24,9 +24,13 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) NotarisationData data; bool parsed = ParseNotarisationOpReturn(tx, data); + printf("Parsed notarisation data for %s \n",data.symbol); if (!parsed) data = NotarisationData(); + if (strlen(data.symbol) == 0) + continue; + printf("Checked notarisation data for %s \n",data.symbol); int authority = GetSymbolAuthority(data.symbol); From 8010a2567c55c4ab28a4af4853a7af50084c4779 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:04:26 +0800 Subject: [PATCH 0133/4463] check --- src/notarisationdb.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index ee99a8020..916a5a185 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -30,7 +30,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) if (!parsed) data = NotarisationData(); if (strlen(data.symbol) == 0) continue; - + printf("Checked notarisation data for %s \n",data.symbol); int authority = GetSymbolAuthority(data.symbol); @@ -43,7 +43,6 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) if (!CheckTxAuthority(tx, auth_STAKED)) continue; } - printf("Authorised notarisation data for %s \n",data.symbol); if (parsed) { vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); From 7aea99c1a4abe7ef5893be07f37cc319d9be810c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:24:48 +0800 Subject: [PATCH 0134/4463] try and get timesstamp for crosschain auth height activation --- src/crosschain_authority.cpp | 1 - src/notarisationdb.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 5c0897512..78958b362 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -53,7 +53,6 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) return true; } - const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; auth.requiredSigs = (num_notaries_STAKED / 5); diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 916a5a185..ee6b4d267 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -4,6 +4,7 @@ #include "cc/eval.h" #include "crosschain.h" #include "main.h" +#include "notaries_staked.h" #include @@ -18,6 +19,9 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) { EvalRef eval; NotarisationsInBlock vNotarisations; + //CrosschainAuthority auth_STAKED; + int timestamp = komodo_heightstamp(nHeight); + printf("timestamp = %d",timestamp) for (unsigned int i = 0; i < block.vtx.size(); i++) { CTransaction tx = block.vtx[i]; @@ -40,6 +44,8 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) continue; } else if (authority == CROSSCHAIN_STAKED) { printf("Authorised notarisation data for %s \n",data.symbol); + // We need to create auth_STAKED dynamically here based on timestamp + if (!CheckTxAuthority(tx, auth_STAKED)) continue; } From 2b91c1d732801f90a9e9d20f4dfcbd1f15e989d0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:29:20 +0800 Subject: [PATCH 0135/4463] try this instead --- src/notarisationdb.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index ee6b4d267..1b459e363 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -39,15 +39,14 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) int authority = GetSymbolAuthority(data.symbol); if (authority == CROSSCHAIN_KOMODO) { - printf("Authorised notarisation data for %s \n",data.symbol); if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime)) continue; - } else if (authority == CROSSCHAIN_STAKED) { printf("Authorised notarisation data for %s \n",data.symbol); + } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp - if (!CheckTxAuthority(tx, auth_STAKED)) continue; + printf("Authorised notarisation data for %s \n",data.symbol); } if (parsed) { From f541d4a7d5b27c91b34b1d17dc72c11a18e1e4c7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:40:51 +0800 Subject: [PATCH 0136/4463] try pull from cBlock --- src/notarisationdb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 1b459e363..8ec508e21 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -20,7 +20,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) EvalRef eval; NotarisationsInBlock vNotarisations; //CrosschainAuthority auth_STAKED; - int timestamp = komodo_heightstamp(nHeight); + int timestamp = block.nTime; printf("timestamp = %d",timestamp) for (unsigned int i = 0; i < block.vtx.size(); i++) { From 360925ac6a238c592589ee99e0df18e66dd92afd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:42:22 +0800 Subject: [PATCH 0137/4463] ; --- src/notarisationdb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 8ec508e21..a2052c8bf 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -21,7 +21,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) NotarisationsInBlock vNotarisations; //CrosschainAuthority auth_STAKED; int timestamp = block.nTime; - printf("timestamp = %d",timestamp) + printf("timestamp = %d",timestamp); for (unsigned int i = 0; i < block.vtx.size(); i++) { CTransaction tx = block.vtx[i]; From 7d8a97e1f98ae9d72f56ba62a123409248c4f9e9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:51:13 +0800 Subject: [PATCH 0138/4463] reactivate staked auth, and try to fetch era from auto function --- src/crosschain_authority.cpp | 2 +- src/notarisationdb.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 78958b362..8dc8fc77f 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -7,7 +7,7 @@ int GetSymbolAuthority(const char* symbol) { if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; - if (is_STAKED("TEST") != 0) { + if (is_STAKED(symbol) != 0) { printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); return CROSSCHAIN_STAKED; } diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index a2052c8bf..f4ba4dfe7 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -21,7 +21,6 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) NotarisationsInBlock vNotarisations; //CrosschainAuthority auth_STAKED; int timestamp = block.nTime; - printf("timestamp = %d",timestamp); for (unsigned int i = 0; i < block.vtx.size(); i++) { CTransaction tx = block.vtx[i]; @@ -44,6 +43,9 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) printf("Authorised notarisation data for %s \n",data.symbol); } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp + printf("timestamp = %d\n",timestamp); + int staked_era = STAKED_era(timestamp); + printf("ERA = %d \n", ); if (!CheckTxAuthority(tx, auth_STAKED)) continue; printf("Authorised notarisation data for %s \n",data.symbol); From 9cdde9ca1257cbab6801beae2eae86ed2f24b88e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 21:53:00 +0800 Subject: [PATCH 0139/4463] oops --- src/notarisationdb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index f4ba4dfe7..3811ccb8f 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -45,7 +45,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) // We need to create auth_STAKED dynamically here based on timestamp printf("timestamp = %d\n",timestamp); int staked_era = STAKED_era(timestamp); - printf("ERA = %d \n", ); + printf("ERA = %d \n",staked_era); if (!CheckTxAuthority(tx, auth_STAKED)) continue; printf("Authorised notarisation data for %s \n",data.symbol); From bb5402c9a9199db1ea64b7931e50eb2965445f02 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 22:10:37 +0800 Subject: [PATCH 0140/4463] add eras for cross chain auth? --- src/crosschain_authority.cpp | 2 ++ src/notarisationdb.cpp | 42 +++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 8dc8fc77f..ed7457e23 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -53,6 +53,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) return true; } +/* const CrosschainAuthority auth_STAKED = [&](){ CrosschainAuthority auth; auth.requiredSigs = (num_notaries_STAKED / 5); @@ -62,3 +63,4 @@ const CrosschainAuthority auth_STAKED = [&](){ sscanf(notaries_STAKED[n][1]+(i*2), "%2hhx", auth.notaries[n]+i); return auth; }(); +*/ diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 3811ccb8f..3c5234089 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -19,7 +19,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) { EvalRef eval; NotarisationsInBlock vNotarisations; - //CrosschainAuthority auth_STAKED; + CrosschainAuthority auth_STAKED; int timestamp = block.nTime; for (unsigned int i = 0; i < block.vtx.size(); i++) { @@ -43,9 +43,45 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) printf("Authorised notarisation data for %s \n",data.symbol); } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp - printf("timestamp = %d\n",timestamp); int staked_era = STAKED_era(timestamp); - printf("ERA = %d \n",staked_era); + printf("ERA.(%d) \n",staked_era); + if (staked_era == 0) + { + // era 0 + auth_STAKED.requiredSigs = (num_notaries_STAKED / 5); + auth_STAKED.size = num_notaries_STAKED; + for (int n=0; n 3) { + printf("Invalid ERA.(%d), this should not happen",staked_era); + continue; + } + } if (!CheckTxAuthority(tx, auth_STAKED)) continue; printf("Authorised notarisation data for %s \n",data.symbol); From 3ae25942127ee7a1cfd8548c8bdba5adc2e0b208 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 22:13:38 +0800 Subject: [PATCH 0141/4463] } --- src/notarisationdb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 3c5234089..685440d1a 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -81,7 +81,6 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) printf("Invalid ERA.(%d), this should not happen",staked_era); continue; } - } if (!CheckTxAuthority(tx, auth_STAKED)) continue; printf("Authorised notarisation data for %s \n",data.symbol); From 475e8bc5cb8c163cfa6b447af5321b759d9da6e4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 23:22:38 +0800 Subject: [PATCH 0142/4463] add era gap, and change to start at era 1 instead of 0. --- src/komodo_notary.h | 41 ++++++++++++++++----------- src/notaries_staked.cpp | 61 +++++++++++++++++++++-------------------- src/notaries_staked.h | 14 ++++++---- src/notarisationdb.cpp | 20 ++++++++------ 4 files changed, 76 insertions(+), 60 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 1b572b17c..3dc0c05f3 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -206,8 +206,9 @@ const char *Notaries_elected1[][2] = int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; - static uint8_t staked_pubkeys[64][33],staked_pubkeys1[64][33],didstaked,didstaked1; static int32_t ns,ns1; - static uint8_t staked_pubkeys2[64][33],staked_pubkeys3[64][33],didstaked2,didstaked3; static int32_t ns2,ns3; + static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; + static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; + static uint8_t null_pubkeys[64][33]; int staked_era; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) @@ -250,23 +251,11 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam } } else - { // here we can activate our pubkeys. + { // here we can activate our pubkeys for STAKED chains by era. if (timestamp != 0) { staked_era = STAKED_era(timestamp); - if (staked_era == 0) - { - if (didstaked == 0) - { - ns = num_notaries_STAKED; - for (i=0; i -// Era 0 set of pubkeys -const char *notaries_STAKED[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; - -int num_notaries_STAKED = (sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); - // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = { @@ -98,6 +74,30 @@ const char *notaries_STAKED3[][2] = int num_notaries_STAKED3 = (sizeof(notaries_STAKED3)/sizeof(*notaries_STAKED3)); +// Era 4 set of pubkeys +const char *notaries_STAKED4[][2] = +{ + {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x + {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg + {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 + {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ + {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 + {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev + {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 + {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL + {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu + {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx + {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 + {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s +}; + +int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4)); + int is_STAKED(const char *chain_name) { int STAKED = 0; if ( (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) @@ -108,13 +108,16 @@ int is_STAKED(const char *chain_name) { int STAKED_era(int timestamp) { int era; - if (timestamp <= STAKED_NOTARIES_TIMESTAMP) - era = 0; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP1 && timestamp >= STAKED_NOTARIES_TIMESTAMP) + if (timestamp <= STAKED_NOTARIES_TIMESTAMP1 era = 1; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= STAKED_NOTARIES_TIMESTAMP1) + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) era = 2; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= STAKED_NOTARIES_TIMESTAMP2) + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= (STAKED_NOTARIES_TIMESTAMP2 + STAKED_ERA_GAP)) era = 3; + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) + era = 4; + else + era = 0; + // if we are in a gap, return era 0, so any notarizations submitted are invalid. return(era); } diff --git a/src/notaries_staked.h b/src/notaries_staked.h index d0df3906c..6c51a0050 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -2,13 +2,12 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED -static const int STAKED_NOTARIES_TIMESTAMP = 1537780949; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537791749; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537802549; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537813349; +static const int STAKED_ERA_GAP = 777; -extern const char *notaries_STAKED[][2]; -extern int num_notaries_STAKED; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537780949; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537791749; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537802549; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537813349; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; @@ -19,6 +18,9 @@ extern int num_notaries_STAKED2; extern const char *notaries_STAKED3[][2]; extern int num_notaries_STAKED3; +extern const char *notaries_STAKED4[][2]; +extern int num_notaries_STAKED4; + int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 685440d1a..9f2610feb 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -47,12 +47,9 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) printf("ERA.(%d) \n",staked_era); if (staked_era == 0) { - // era 0 - auth_STAKED.requiredSigs = (num_notaries_STAKED / 5); - auth_STAKED.size = num_notaries_STAKED; - for (int n=0; n 3) { - printf("Invalid ERA.(%d), this should not happen",staked_era); - continue; + } else if (staked_era == 4) + { + // era 4 + auth_STAKED.requiredSigs = (num_notaries_STAKED4 / 5); + auth_STAKED.size = num_notaries_STAKED4; + for (int n=0; n Date: Mon, 24 Sep 2018 23:25:33 +0800 Subject: [PATCH 0143/4463] ) --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 2c45b5dbd..f7d64a168 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -108,7 +108,7 @@ int is_STAKED(const char *chain_name) { int STAKED_era(int timestamp) { int era; - if (timestamp <= STAKED_NOTARIES_TIMESTAMP1 + if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) era = 1; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) era = 2; From 595f3d7a5fbb7efd47d6e1c5d68eb4b1ed29e769 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 23:27:45 +0800 Subject: [PATCH 0144/4463] fix pointless print --- src/notarisationdb.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 9f2610feb..4e0be704a 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -27,9 +27,6 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) NotarisationData data; bool parsed = ParseNotarisationOpReturn(tx, data); - - printf("Parsed notarisation data for %s \n",data.symbol); - if (!parsed) data = NotarisationData(); if (strlen(data.symbol) == 0) continue; From 01b6ef666a5da230a6ab73ade08c052ac7e83d9c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 23:46:08 +0800 Subject: [PATCH 0145/4463] add check for num vins over 2 for all AC --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index d1587fbb4..3fef07475 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -859,7 +859,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) ) { - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 && numvins >= 2) // check numvins, because on STAKED during ERA GAP, it counts every TX as notarized. { static FILE *signedfp; if ( signedfp == 0 ) From 6368a83fe3c921581dd20fb32ac518515f938bec Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 24 Sep 2018 23:51:38 +0800 Subject: [PATCH 0146/4463] retest gap --- src/komodo.h | 2 +- src/notaries_staked.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 3fef07475..ead20f034 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -859,7 +859,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) ) { - if ( ASSETCHAINS_SYMBOL[0] != 0 && numvins >= 2) // check numvins, because on STAKED during ERA GAP, it counts every TX as notarized. + if ( ASSETCHAINS_SYMBOL[0] != 0 && numvins >= 2) // check numvins, because on STAKED during ERA GAP, it counts every TX as notarized.u { static FILE *signedfp; if ( signedfp == 0 ) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 6c51a0050..aab392301 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,7 +7,7 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1537780949; static const int STAKED_NOTARIES_TIMESTAMP2 = 1537791749; static const int STAKED_NOTARIES_TIMESTAMP3 = 1537802549; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537813349; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537805431; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From b60948261bf96b7acfd3a9d83795987811583e3a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 00:03:00 +0800 Subject: [PATCH 0147/4463] reset eras, try from reqync --- src/notaries_staked.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index aab392301..f1af9595a 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -4,10 +4,10 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537780949; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537791749; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537802549; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537805431; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537807474; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537818274; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537839874; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537850674; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From 2cf2e5f83ed27dcf45b1b98d57683819b7b93f49 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 01:17:49 +0800 Subject: [PATCH 0148/4463] try to zero array of pubkeys --- src/komodo.h | 2 +- src/komodo_notary.h | 18 +++++++++--------- src/notarisationdb.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index ead20f034..d8376d15c 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -859,7 +859,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) ) { - if ( ASSETCHAINS_SYMBOL[0] != 0 && numvins >= 2) // check numvins, because on STAKED during ERA GAP, it counts every TX as notarized.u + if ( ASSETCHAINS_SYMBOL[0] != 0) { static FILE *signedfp; if ( signedfp == 0 ) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 3dc0c05f3..352316e77 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -208,7 +208,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; - static uint8_t null_pubkeys[64][33]; + static uint8_t null_pubkeys[64][33] = {0}; int staked_era; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) @@ -263,7 +263,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam for (i=0; i Date: Tue, 25 Sep 2018 10:16:05 +0800 Subject: [PATCH 0149/4463] that didnt work, try another way --- src/komodo.h | 5 ++++- src/komodo_notary.h | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index d8376d15c..3c708989f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -831,6 +831,9 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) txn_count = block.vtx.size(); for (i=0; iGetBlockTime()) != 0)) + printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); + continue; txhash = block.vtx[i].GetHash(); numvouts = block.vtx[i].vout.size(); notaryid = -1; @@ -857,7 +860,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) numvalid = bitweight(signedmask); if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || - numvalid > (numnotaries/5)) ) + numvalid > (numnotaries/5))) { if ( ASSETCHAINS_SYMBOL[0] != 0) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 352316e77..de343e184 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -305,12 +305,12 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam return(ns4); } else if (staked_era == 0) { - // this means we are in a gap, so we set the array of pubkeys to zero, so all notarizations are invalid. + // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell. for (i=0; i<1; i++) decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); - printf("%s IS A STAKED CHAIN and is in an ERA GAP, so we ignored it.\n",ASSETCHAINS_SYMBOL); + printf("%s IS A STAKED CHAIN and is in an ERA GAP, so we zeroed the pubkeys.\n",ASSETCHAINS_SYMBOL); memcpy(pubkeys,null_pubkeys,64 * 33); - return(2); + return(64); } } } From 2e82dcdf8efccdbc3c2c3787f0d1b91276ed4cd2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 10:19:27 +0800 Subject: [PATCH 0150/4463] change eras --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index f1af9595a..5545f8714 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -4,9 +4,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537807474; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537818274; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537839874; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537839874; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537843474; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537847074; static const int STAKED_NOTARIES_TIMESTAMP4 = 1537850674; extern const char *notaries_STAKED1[][2]; From 582b359c15385428800f7eb75661510d5690e3f7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 10:24:15 +0800 Subject: [PATCH 0151/4463] == 0 --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 3c708989f..7c927a3d8 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -831,7 +831,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) txn_count = block.vtx.size(); for (i=0; iGetBlockTime()) != 0)) + if ((is_STAKED(ASSETCHAINS_SYMBOL) != 0) && (STAKED_era(pindex->GetBlockTime()) == 0)) printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; txhash = block.vtx[i].GetHash(); From 3e86777927d5bf04a5064248659ca11eb2994f3d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 13:49:15 +0800 Subject: [PATCH 0152/4463] try move crosschain auth to a function, and clean up code a bit. --- src/crosschain_authority.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index ed7457e23..6c8df2219 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -53,6 +53,15 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) return true; } +CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen,int num_notaries){ + CrosschainAuthority auth; + auth.requiredSigs = (num_notaries / 5); + auth.size = num_notaries; + for (int n=0; n Date: Tue, 25 Sep 2018 14:16:39 +0800 Subject: [PATCH 0153/4463] timstaps --- src/notaries_staked.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 5545f8714..5d2450f0b 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -4,10 +4,10 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537839874; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537843474; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537847074; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537850674; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537859688; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537863288; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537866888; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537870488; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From 562d0132f7a532a8c1c1ce78707fe58e23ce803c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 14:20:21 +0800 Subject: [PATCH 0154/4463] test --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 6c8df2219..be54f2a43 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -53,7 +53,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) return true; } -CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen,int num_notaries){ +CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries){ CrosschainAuthority auth; auth.requiredSigs = (num_notaries / 5); auth.size = num_notaries; From 84f0f23626ec988d8726b688816fdc9ee95fbdf0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 14:25:27 +0800 Subject: [PATCH 0155/4463] try call function --- src/notarisationdb.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index fd2d9cac0..1867aa748 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -50,11 +50,14 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) } else if (staked_era == 1) { // era 1 + auth_STAKED = auth_STAKED_chosen(notaries_STAKED,num_notaries_STAKED); + /* auth_STAKED.requiredSigs = (num_notaries_STAKED1 / 5); auth_STAKED.size = num_notaries_STAKED1; for (int n=0; n Date: Tue, 25 Sep 2018 14:27:08 +0800 Subject: [PATCH 0156/4463] 1 --- src/notarisationdb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 1867aa748..be1ae5dfa 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -50,7 +50,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) } else if (staked_era == 1) { // era 1 - auth_STAKED = auth_STAKED_chosen(notaries_STAKED,num_notaries_STAKED); + auth_STAKED = auth_STAKED_chosen(notaries_STAKED1,num_notaries_STAKED1); /* auth_STAKED.requiredSigs = (num_notaries_STAKED1 / 5); auth_STAKED.size = num_notaries_STAKED1; From f16893312fe10e00eec9f88fd9b07eb1a6a346a7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 14:29:22 +0800 Subject: [PATCH 0157/4463] try that --- src/crosschain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain.h b/src/crosschain.h index 65be53f92..75c0b2e9f 100644 --- a/src/crosschain.h +++ b/src/crosschain.h @@ -13,7 +13,7 @@ typedef struct CrosschainAuthority { size_t requiredSigs; } CrosschainAuthority; -extern const CrosschainAuthority auth_STAKED; +CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); int GetSymbolAuthority(const char* symbol); bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth); From 07f90f985292e2991ad1e0c5db0202b34475c27e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 15:17:51 +0800 Subject: [PATCH 0158/4463] move cross chain choose to staked.cpp --- src/crosschain.h | 2 -- src/crosschain_authority.cpp | 10 +--------- src/notaries_staked.cpp | 11 +++++++++++ src/notaries_staked.h | 3 +++ src/notarisationdb.cpp | 7 ------- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/crosschain.h b/src/crosschain.h index 75c0b2e9f..29b6bec4b 100644 --- a/src/crosschain.h +++ b/src/crosschain.h @@ -13,8 +13,6 @@ typedef struct CrosschainAuthority { size_t requiredSigs; } CrosschainAuthority; -CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); - int GetSymbolAuthority(const char* symbol); bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth); diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index be54f2a43..ef09c5e00 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -53,15 +53,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) return true; } -CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries){ - CrosschainAuthority auth; - auth.requiredSigs = (num_notaries / 5); - auth.size = num_notaries; - for (int n=0; n // Era 1 set of pubkeys @@ -121,3 +122,13 @@ int STAKED_era(int timestamp) // if we are in a gap, return era 0, so any notarizations submitted are invalid. return(era); } + +CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries){ + CrosschainAuthority auth; + auth.requiredSigs = (num_notaries / 5); + auth.size = num_notaries; + for (int n=0; n Date: Tue, 25 Sep 2018 15:19:21 +0800 Subject: [PATCH 0159/4463] opps --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index f6139cc98..375077cac 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -24,7 +24,7 @@ extern int num_notaries_STAKED4; int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); -CrosschainAuthority Choose_auth_STAKED(staked_era) +//CrosschainAuthority Choose_auth_STAKED(staked_era); CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); #endif From a2d3bd9f849129a37d0d85820d2211d52a24d257 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 15:21:04 +0800 Subject: [PATCH 0160/4463] try --- src/notaries_staked.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 375077cac..c5ffe5219 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -2,6 +2,8 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED +#include "crosschain.h" + static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1537859688; From 211f57fb452943fe44ece0be3f6a513a52c3c942 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 15:40:44 +0800 Subject: [PATCH 0161/4463] tidy up --- src/notaries_staked.cpp | 27 +++++++++++++++++++++++---- src/notaries_staked.h | 2 +- src/notarisationdb.cpp | 38 ++++++-------------------------------- 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index d2cc0bafb..489a9ea78 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -115,15 +115,34 @@ int STAKED_era(int timestamp) era = 2; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= (STAKED_NOTARIES_TIMESTAMP2 + STAKED_ERA_GAP)) era = 3; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) + else if timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) era = 4; else era = 0; - // if we are in a gap, return era 0, so any notarizations submitted are invalid. + // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. return(era); -} +}; -CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries){ +CrosschainAuthority Choose_auth_STAKED(int chosen_era) { + CrosschainAuthority auth; + switch (chosen_era) { + case 1: + auth = auth_STAKED_chosen(notaries_STAKED1,num_notaries_STAKED1); + break; + case 2: + auth = auth_STAKED_chosen(notaries_STAKED2,num_notaries_STAKED2); + break; + case 3: + auth = auth_STAKED_chosen(notaries_STAKED3,num_notaries_STAKED3); + break; + case 4: + auth = auth_STAKED_chosen(notaries_STAKED4,num_notaries_STAKED4); + break; + } + return(auth); +}; + +CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries) { CrosschainAuthority auth; auth.requiredSigs = (num_notaries / 5); auth.size = num_notaries; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index c5ffe5219..3776c6828 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -26,7 +26,7 @@ extern int num_notaries_STAKED4; int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); -//CrosschainAuthority Choose_auth_STAKED(staked_era); +CrosschainAuthority Choose_auth_STAKED(int chosen_era); CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); #endif diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index acd1d2287..68c00546b 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -31,50 +31,24 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) if (strlen(data.symbol) == 0) continue; - printf("Checked notarisation data for %s \n",data.symbol); + //printf("Checked notarisation data for %s \n",data.symbol); int authority = GetSymbolAuthority(data.symbol); if (authority == CROSSCHAIN_KOMODO) { if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime)) continue; - printf("Authorised notarisation data for %s \n",data.symbol); + //printf("Authorised notarisation data for %s \n",data.symbol); } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp int staked_era = STAKED_era(timestamp); printf("ERA.(%d) \n",staked_era); - if (staked_era == 0) - { + if (staked_era == 0) { // this is an ERA GAP, so we will ignore this notarization printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); continue; - } else if (staked_era == 1) - { - // era 1 - auth_STAKED = auth_STAKED_chosen(notaries_STAKED1,num_notaries_STAKED1); - } else if (staked_era == 2) - { - // era 2 - auth_STAKED.requiredSigs = (num_notaries_STAKED2 / 5); - auth_STAKED.size = num_notaries_STAKED2; - for (int n=0; n Date: Tue, 25 Sep 2018 15:41:55 +0800 Subject: [PATCH 0162/4463] ) --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 489a9ea78..9a91b9d84 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -115,7 +115,7 @@ int STAKED_era(int timestamp) era = 2; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= (STAKED_NOTARIES_TIMESTAMP2 + STAKED_ERA_GAP)) era = 3; - else if timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) + else if (timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) era = 4; else era = 0; From 1a948db4fda982931c763e62b847d3a54ab35a7e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 16:38:39 +0800 Subject: [PATCH 0163/4463] who knows --- src/crosschain_authority.cpp | 4 ++-- src/komodo_notary.h | 2 +- src/notaries_staked.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index ef09c5e00..8116b2887 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -8,10 +8,10 @@ int GetSymbolAuthority(const char* symbol) if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_TXSCL; if (is_STAKED(symbol) != 0) { - printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); + //printf("RETURNED CROSSCHAIN STAKED AS TRUE\n"); return CROSSCHAIN_STAKED; } - printf("RETURNED CROSSCHAIN KOMODO AS TRUE\n"); + //printf("RETURNED CROSSCHAIN KOMODO AS TRUE\n"); return CROSSCHAIN_KOMODO; } diff --git a/src/komodo_notary.h b/src/komodo_notary.h index de343e184..4f5f7aea7 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -305,7 +305,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam return(ns4); } else if (staked_era == 0) { - // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell. + // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell, fix here welcome. for (i=0; i<1; i++) decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); printf("%s IS A STAKED CHAIN and is in an ERA GAP, so we zeroed the pubkeys.\n",ASSETCHAINS_SYMBOL); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 3776c6828..c87f27f98 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -6,10 +6,10 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537859688; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537863288; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537866888; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537870488; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537868073; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537871673; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537875273; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537878873; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From 75979d037a877904965ae852a012d6713c2ad970 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 17:27:10 +0800 Subject: [PATCH 0164/4463] increse era wtf happened there lol --- src/notaries_staked.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 5545f8714..0a722f512 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -2,12 +2,14 @@ #ifndef NOTARIES_STAKED #define NOTARIES_STAKED +#include "crosschain.h" + static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537839874; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537843474; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537847074; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537850674; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537871673; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537875273; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537878873; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537895873; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; @@ -24,4 +26,7 @@ extern int num_notaries_STAKED4; int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); +CrosschainAuthority Choose_auth_STAKED(int chosen_era); +CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); + #endif From 3aee2fae5e4125627b692d013d119a9284445082 Mon Sep 17 00:00:00 2001 From: blackjok3rtt <30971146+blackjok3rtt@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:38:18 +0800 Subject: [PATCH 0165/4463] hopefully fixed that lol --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 9a91b9d84..e2170ba94 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -115,7 +115,7 @@ int STAKED_era(int timestamp) era = 2; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= (STAKED_NOTARIES_TIMESTAMP2 + STAKED_ERA_GAP)) era = 3; - else if (timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) era = 4; else era = 0; From 15fe2fb59dada5d57d36b4413be7f271fb44aa90 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 17:50:51 +0800 Subject: [PATCH 0166/4463] I think this might be it --- src/komodo_notary.h | 4 ++-- src/notaries_staked.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 4f5f7aea7..a4e673b79 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -306,8 +306,8 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam } else if (staked_era == 0) { // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell, fix here welcome. - for (i=0; i<1; i++) - decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); + //for (i=0; i<1; i++) + // decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); printf("%s IS A STAKED CHAIN and is in an ERA GAP, so we zeroed the pubkeys.\n",ASSETCHAINS_SYMBOL); memcpy(pubkeys,null_pubkeys,64 * 33); return(64); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index c87f27f98..03ed5f306 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -6,10 +6,10 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537868073; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537871673; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537875273; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537878873; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537872577; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537876177; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537879777; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537883377; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From 8abbd8e183bb4b431f0488e96fb93bf63fc9ab55 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 17:56:49 +0800 Subject: [PATCH 0167/4463] meh --- src/komodo.h | 4 ++-- src/komodo_notary.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 7c927a3d8..66374f6fe 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -858,9 +858,9 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); - if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || + if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || - numvalid > (numnotaries/5))) + numvalid > (numnotaries/5) ) { if ( ASSETCHAINS_SYMBOL[0] != 0) { diff --git a/src/komodo_notary.h b/src/komodo_notary.h index a4e673b79..84d0cbed1 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -308,9 +308,9 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell, fix here welcome. //for (i=0; i<1; i++) // decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); - printf("%s IS A STAKED CHAIN and is in an ERA GAP, so we zeroed the pubkeys.\n",ASSETCHAINS_SYMBOL); - memcpy(pubkeys,null_pubkeys,64 * 33); - return(64); + printf("%s IS A STAKED CHAIN and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); + //memcpy(pubkeys,null_pubkeys,64 * 33); + return(0); } } } From 7422645f78c5c4d7998861e4f7fb5fb4a02a4fa0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:08:30 +0800 Subject: [PATCH 0168/4463] add print for numvalid --- src/komodo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo.h b/src/komodo.h index 7c927a3d8..6fc219c32 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -858,6 +858,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); + printf("numvalid.%d \n",numvalid); if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5))) From b9673a33a8a62cc443ff840255cdce87989b65af Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:14:13 +0800 Subject: [PATCH 0169/4463] more rpints --- src/komodo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo.h b/src/komodo.h index 6fc219c32..b0056f6c7 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -810,6 +810,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); numnotaries = komodo_notaries(pubkeys,pindex->nHeight,pindex->GetBlockTime()); + printf("numnotaries.%d\n",numnotaries); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) hwmheight = pindex->nHeight; From ad98d05ba1938404adf32223fee9e82fd1e0265f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:26:47 +0800 Subject: [PATCH 0170/4463] more prints --- src/komodo.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index b0056f6c7..e7ea104aa 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -810,7 +810,6 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); numnotaries = komodo_notaries(pubkeys,pindex->nHeight,pindex->GetBlockTime()); - printf("numnotaries.%d\n",numnotaries); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) hwmheight = pindex->nHeight; @@ -826,8 +825,10 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) komodo_stateupdate(pindex->nHeight,0,0,0,zero,0,0,0,0,-pindex->nHeight,pindex->nTime,0,0,0,0,zero,0); } komodo_currentheight_set(chainActive.LastTip()->nHeight); + printf("BEFORE pindex != 0 check.\n", ); if ( pindex != 0 ) { + printf("AFTER pindex != 0 check.\n", ); height = pindex->nHeight; txn_count = block.vtx.size(); for (i=0; i 0 ) { @@ -860,9 +862,9 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } numvalid = bitweight(signedmask); printf("numvalid.%d \n",numvalid); - if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || + if (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || - numvalid > (numnotaries/5))) + numvalid > (numnotaries/5)) { if ( ASSETCHAINS_SYMBOL[0] != 0) { From aeeec99a0b3830a23e1e756f652f2caafcbd00cf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:28:50 +0800 Subject: [PATCH 0171/4463] oops --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e7ea104aa..937e1f788 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -825,10 +825,10 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) komodo_stateupdate(pindex->nHeight,0,0,0,zero,0,0,0,0,-pindex->nHeight,pindex->nTime,0,0,0,0,zero,0); } komodo_currentheight_set(chainActive.LastTip()->nHeight); - printf("BEFORE pindex != 0 check.\n", ); + printf("BEFORE pindex != 0 check.\n"); if ( pindex != 0 ) { - printf("AFTER pindex != 0 check.\n", ); + printf("AFTER pindex != 0 check.\n"); height = pindex->nHeight; txn_count = block.vtx.size(); for (i=0; i Date: Tue, 25 Sep 2018 18:29:52 +0800 Subject: [PATCH 0172/4463] opps --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 937e1f788..7d2a75b4e 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -845,7 +845,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (j=0; j 0 ) { From 233666172a91564fc01b1c445a4f29bdb13b7e95 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:33:28 +0800 Subject: [PATCH 0173/4463] maybe this lol --- src/komodo.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 7d2a75b4e..0425a5002 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -825,17 +825,17 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) komodo_stateupdate(pindex->nHeight,0,0,0,zero,0,0,0,0,-pindex->nHeight,pindex->nTime,0,0,0,0,zero,0); } komodo_currentheight_set(chainActive.LastTip()->nHeight); - printf("BEFORE pindex != 0 check.\n"); if ( pindex != 0 ) { - printf("AFTER pindex != 0 check.\n"); height = pindex->nHeight; txn_count = block.vtx.size(); for (i=0; iGetBlockTime()) == 0)) + if ((is_STAKED(ASSETCHAINS_SYMBOL) != 0) && (STAKED_era(pindex->GetBlockTime()) == 0)) { printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; + } + printf("we working now?\n"); txhash = block.vtx[i].GetHash(); numvouts = block.vtx[i].vout.size(); notaryid = -1; From b3cb6ec56de629090cb986902b8bc6c315d537e0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:37:02 +0800 Subject: [PATCH 0174/4463] fix --- src/komodo.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 0425a5002..c4200a1e8 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -835,7 +835,6 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; } - printf("we working now?\n"); txhash = block.vtx[i].GetHash(); numvouts = block.vtx[i].vout.size(); notaryid = -1; @@ -845,7 +844,6 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (j=0; j 0 ) { From 5b1b6887ecdec3f463d4318d1bc1176d828c02c4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:41:08 +0800 Subject: [PATCH 0175/4463] good --- src/komodo.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index c4200a1e8..cc2a5dd3d 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -859,7 +859,6 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); - printf("numvalid.%d \n",numvalid); if (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || (numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) From 4becb91f8e90fca4e31becf2e683e6f99e99b53d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:42:30 +0800 Subject: [PATCH 0176/4463] fix silly mistake --- src/komodo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 66374f6fe..fb40c1e09 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -831,9 +831,10 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) txn_count = block.vtx.size(); for (i=0; iGetBlockTime()) == 0)) + if ((is_STAKED(ASSETCHAINS_SYMBOL) != 0) && (STAKED_era(pindex->GetBlockTime()) == 0)) { printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; + } txhash = block.vtx[i].GetHash(); numvouts = block.vtx[i].vout.size(); notaryid = -1; From 6ecc2a17bf75b6847dcd2a0ea99c443add9a944d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 25 Sep 2018 18:53:32 +0800 Subject: [PATCH 0177/4463] new timestamps try again lol --- src/komodo_notary.h | 4 ++-- src/notaries_staked.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 84d0cbed1..1e764a603 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -309,8 +309,8 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam //for (i=0; i<1; i++) // decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); printf("%s IS A STAKED CHAIN and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); - //memcpy(pubkeys,null_pubkeys,64 * 33); - return(0); + memcpy(pubkeys,null_pubkeys,64 * 33); + return(64); } } } diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 03ed5f306..12aae29d3 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -6,10 +6,10 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537872577; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537876177; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537879777; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537883377; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1537876325; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537879925; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1537883525; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1537983525; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From 2e25cdf0a4958f156d62eaf6105dafa0402c7e32 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Wed, 26 Sep 2018 02:26:48 +0000 Subject: [PATCH 0178/4463] add STAKEDED --- src/assetchains.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/assetchains.json b/src/assetchains.json index 9faa54f16..00c491935 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -52,5 +52,15 @@ "195.201.137.5", "195.201.20.230" ] + }, + { + "ac_name": "STAKEDED", + "ac_supply": "1072452", + "ac_reward" : "1000000000", + "ac_cc": "667", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] } ] From dcffb1c796c151fe528a3c600c6d3be68bb8b11a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 11:30:31 +0800 Subject: [PATCH 0179/4463] change ERA's --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 12aae29d3..526ad5f9b 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1537876325; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537879925; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1537883525; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1537983525; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1537983525; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1538083525; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1548083525; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From dee9067adc99f3d677417bf40aa5b83c770522e9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 14:53:41 +0800 Subject: [PATCH 0180/4463] modified: src/komodo_notary.h --- src/komodo_notary.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index de343e184..0365a1faf 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -306,9 +306,9 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam } else if (staked_era == 0) { // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell. - for (i=0; i<1; i++) - decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); - printf("%s IS A STAKED CHAIN and is in an ERA GAP, so we zeroed the pubkeys.\n",ASSETCHAINS_SYMBOL); + //for (i=0; i<1; i++) + // decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]); + printf("%s IS A STAKED CHAIN and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); memcpy(pubkeys,null_pubkeys,64 * 33); return(64); } From 79171fa13b55fcb4445e5dbb5a0255bf8489839b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 15:03:55 +0800 Subject: [PATCH 0181/4463] try to add error check if export/import chain is the same --- src/rpccrosschain.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 09f1b21d1..baa4d4984 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -50,7 +50,7 @@ UniValue assetchainproof(const UniValue& params, bool fHelp) UniValue crosschainproof(const UniValue& params, bool fHelp) { - + } @@ -90,7 +90,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp) ret.push_back(Pair("kmdendi",kmdendi)); } } else ret.push_back(Pair("error",(char *)"no MoM for height")); - + return ret; } @@ -169,6 +169,9 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); + if (strncmp(ASSETCHAINS_SYMBOL,targetSymbol) == 0) + throw runtime_error("cant send a coin to the same chain"); + CAmount burnAmount = AmountFromValue(params[2]); if (burnAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for export"); @@ -220,8 +223,8 @@ UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp) CTransaction burnTx; if (!E_UNMARSHAL(txData, ss >> burnTx)) throw runtime_error("Couldn't parse burnTx"); - - + + vector payouts; if (!E_UNMARSHAL(ParseHexV(params[1], "argument 2"), ss >> payouts)) throw runtime_error("Couldn't parse payouts"); @@ -240,7 +243,7 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp) throw runtime_error("migrate_completeimporttransaction importTx\n\n" "Takes a cross chain import tx with proof generated on assetchain " "and extends proof to target chain proof root"); - + if (ASSETCHAINS_SYMBOL[0] != 0) throw runtime_error("Must be called on KMD"); @@ -294,7 +297,7 @@ UniValue scanNotarisationsDB(const UniValue& params, bool fHelp) if (height == 0) { height = chainActive.Height(); } - + Notarisation nota; int matchedHeight = ScanNotarisationsDB(height, symbol, limit, nota); if (!matchedHeight) return NullUniValue; From 054eb923f9c4266f085edd04e47c1a08e5ebee55 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 15:56:38 +0800 Subject: [PATCH 0182/4463] n --- src/rpccrosschain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index baa4d4984..15e7a0393 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,7 +169,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); - if (strncmp(ASSETCHAINS_SYMBOL,targetSymbol) == 0) + if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol) == 0) throw runtime_error("cant send a coin to the same chain"); CAmount burnAmount = AmountFromValue(params[2]); From 7d7b68dc6fe6b42a3207474055ea5929021e5db1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 15:58:23 +0800 Subject: [PATCH 0183/4463] maybe thos willl work --- src/rpccrosschain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 15e7a0393..eaa059ec8 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,7 +169,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); - if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol) == 0) + if (ASSETCHAINS_SYMBOL == targetSymbol) throw runtime_error("cant send a coin to the same chain"); CAmount burnAmount = AmountFromValue(params[2]); From 66874998de55e44ffbcda4c750b05fb2ee99466d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 16:02:36 +0800 Subject: [PATCH 0184/4463] or this --- src/rpccrosschain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index eaa059ec8..52df5efaf 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,7 +169,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); - if (ASSETCHAINS_SYMBOL == targetSymbol) + if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0) throw runtime_error("cant send a coin to the same chain"); CAmount burnAmount = AmountFromValue(params[2]); From 3e94e0a37bd3e0b1980d7f6c4328d47645e08e8b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 16:59:52 +0800 Subject: [PATCH 0185/4463] hmmm --- src/rpccrosschain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 52df5efaf..83554d1f6 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,6 +169,8 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); + printf("source.%s target.%s",ASSETCHAINS_SYMBOL,targetSymbol.c_str()) + if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0) throw runtime_error("cant send a coin to the same chain"); From dc43d728486b5b5b550b23204fbddcb0372877be Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 17:04:02 +0800 Subject: [PATCH 0186/4463] ; --- src/rpccrosschain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 83554d1f6..e991de71e 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,8 +169,8 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); - printf("source.%s target.%s",ASSETCHAINS_SYMBOL,targetSymbol.c_str()) - + printf("source.%s target.%s",ASSETCHAINS_SYMBOL,targetSymbol.c_str()); + if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0) throw runtime_error("cant send a coin to the same chain"); From 42df9ee0602ef7d63716bb7c9da9de8c87749289 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 17:19:17 +0800 Subject: [PATCH 0187/4463] try this --- src/rpccrosschain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index e991de71e..f92632c8b 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,7 +169,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); - printf("source.%s target.%s",ASSETCHAINS_SYMBOL,targetSymbol.c_str()); + fprintf(stderr,"source.%s target.%s",ASSETCHAINS_SYMBOL,targetSymbol.c_str()); if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0) throw runtime_error("cant send a coin to the same chain"); From 1a0749e538df926521b6eeda6820e4d15d77410c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 17:24:06 +0800 Subject: [PATCH 0188/4463] remove non wokring print --- src/rpccrosschain.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index f92632c8b..52df5efaf 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -169,8 +169,6 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); - fprintf(stderr,"source.%s target.%s",ASSETCHAINS_SYMBOL,targetSymbol.c_str()); - if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0) throw runtime_error("cant send a coin to the same chain"); From 396d4e42099cdad584573935e8d7c8fad7635eb2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 26 Sep 2018 17:25:02 +0800 Subject: [PATCH 0189/4463] Add error for sending coin to source chain --- src/rpccrosschain.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 09f1b21d1..52df5efaf 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -50,7 +50,7 @@ UniValue assetchainproof(const UniValue& params, bool fHelp) UniValue crosschainproof(const UniValue& params, bool fHelp) { - + } @@ -90,7 +90,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp) ret.push_back(Pair("kmdendi",kmdendi)); } } else ret.push_back(Pair("error",(char *)"no MoM for height")); - + return ret; } @@ -169,6 +169,9 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) if (targetSymbol.size() == 0 || targetSymbol.size() > 32) throw runtime_error("targetSymbol length must be >0 and <=32"); + if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0) + throw runtime_error("cant send a coin to the same chain"); + CAmount burnAmount = AmountFromValue(params[2]); if (burnAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for export"); @@ -220,8 +223,8 @@ UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp) CTransaction burnTx; if (!E_UNMARSHAL(txData, ss >> burnTx)) throw runtime_error("Couldn't parse burnTx"); - - + + vector payouts; if (!E_UNMARSHAL(ParseHexV(params[1], "argument 2"), ss >> payouts)) throw runtime_error("Couldn't parse payouts"); @@ -240,7 +243,7 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp) throw runtime_error("migrate_completeimporttransaction importTx\n\n" "Takes a cross chain import tx with proof generated on assetchain " "and extends proof to target chain proof root"); - + if (ASSETCHAINS_SYMBOL[0] != 0) throw runtime_error("Must be called on KMD"); @@ -294,7 +297,7 @@ UniValue scanNotarisationsDB(const UniValue& params, bool fHelp) if (height == 0) { height = chainActive.Height(); } - + Notarisation nota; int matchedHeight = ScanNotarisationsDB(height, symbol, limit, nota); if (!matchedHeight) return NullUniValue; From e5eda68dbd79448bef5a9ec3700014ff585a6dbe Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 18:00:28 +0800 Subject: [PATCH 0190/4463] remove all prints that are not momom that we normally see --- src/komodo.h | 18 +++++++++--------- src/komodo_bitcoind.h | 34 +++++++++++++++++----------------- src/notarisationdb.cpp | 6 +++--- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index fb40c1e09..dcb5f63de 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -832,7 +832,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; iGetBlockTime()) == 0)) { - printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); + //printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); @@ -856,7 +856,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) printf("%02x",scriptPubKey[k]); printf(" scriptPubKey doesnt match any notary vini.%d of %d\n",j,numvins); } - } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); + } //else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || @@ -880,7 +880,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) fwrite(&signedmask,1,sizeof(signedmask),signedfp); fflush(signedfp); } - printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + //printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); } notarized = 1; } @@ -917,20 +917,20 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { for (k=0; k 2 ) { @@ -959,8 +959,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { memset(&txhash,0,sizeof(txhash)); komodo_stateupdate(height,pubkeys,numvalid,0,txhash,0,0,0,0,0,0,0,0,0,0,zero,0); - printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height); - } else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries); + //printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height); + } //else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries); } } } diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 13501d2a9..4a2a9fc41 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -169,7 +169,7 @@ try_again: curl_handle = curl_easy_init(); init_string(&s); headers = curl_slist_append(0,"Expect:"); - + curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl_handle,CURLOPT_URL, url); @@ -198,7 +198,7 @@ try_again: bracket0 = (char *)"["; bracket1 = (char *)"]"; } - + databuf = (char *)malloc(256 + strlen(command) + strlen(params)); sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1); //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); @@ -238,7 +238,7 @@ try_again: free(s.ptr); sleep((1<= 10000 sats PoS stake must be without txfee and in the last tx in the block at vout[0] */ @@ -1303,24 +1303,24 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he { n++; percPoS++; - if ( ASSETCHAINS_STAKED < 100 ) - fprintf(stderr,"0"); + //if ( ASSETCHAINS_STAKED < 100 ) + // fprintf(stderr,"0"); } else { - if ( ASSETCHAINS_STAKED < 100 ) - fprintf(stderr,"1"); + //if ( ASSETCHAINS_STAKED < 100 ) + // fprintf(stderr,"1"); sum += UintToArith256(pindex->GetBlockHash()); m++; } } - if ( ASSETCHAINS_STAKED < 100 && (i % 10) == 9 ) - fprintf(stderr," %d, ",percPoS); + //if ( ASSETCHAINS_STAKED < 100 && (i % 10) == 9 ) + // fprintf(stderr," %d, ",percPoS); } if ( m+n < 100 ) percPoS = ((percPoS * n) + (goalperc * (100-n))) / 100; if ( ASSETCHAINS_STAKED < 100 ) - fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height); + //fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height); *percPoSp = percPoS; if ( m > 0 ) { @@ -1337,7 +1337,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he if ( oldflag != 0 ) bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS); else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS); - if ( ASSETCHAINS_STAKED < 100 ) + /*if ( ASSETCHAINS_STAKED < 100 ) { for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); @@ -1348,7 +1348,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&target)[i]); fprintf(stderr," ht.%d percPoS.%d vs goal.%d -> diff %d\n",height,percPoS,goalperc,goalperc - percPoS); - } + }*/ } else if ( percPoS > goalperc ) // decrease PoW diff -> raise bnTarget { @@ -1367,7 +1367,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he if ( bnTarget < ave ) bnTarget = ave; } - if ( 1 ) + /*if ( 1 ) { for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); @@ -1378,7 +1378,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&target)[i]); fprintf(stderr," ht.%d percPoS.%d vs goal.%d -> diff %d\n",height,percPoS,goalperc,goalperc - percPoS); - } + }*/ } else bnTarget = ave; // recent ave is perfect return(bnTarget); diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 68c00546b..426cdb806 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -44,7 +44,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) printf("ERA.(%d) \n",staked_era); if (staked_era == 0) { // this is an ERA GAP, so we will ignore this notarization - printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); + //printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); continue; } else { // pass era slection off to notaries_staked.cpp file @@ -52,12 +52,12 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) } if (!CheckTxAuthority(tx, auth_STAKED)) continue; - printf("Authorised notarisation data for %s \n",data.symbol); + //printf("Authorised notarisation data for %s \n",data.symbol); } if (parsed) { vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); - printf("Added notarisation data for %s \n",data.symbol); + //printf("Added notarisation data for %s \n",data.symbol); //printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n", // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); From f0587239fa5fe099f9d6b9b7d3bc004e5fc2aef1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 19:04:24 +0800 Subject: [PATCH 0191/4463] found more --- src/komodo.h | 16 ++++++++-------- src/notarisationdb.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index dcb5f63de..1846fd25c 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -620,8 +620,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr notarized = 1; if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 ) notarized = 1; - if ( 0 && opretlen != 149 ) - printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset); + //if ( 0 && opretlen != 149 ) + // printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset); len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&srchash); len += iguana_rwnum(0,&scriptbuf[len],sizeof(*notarizedheightp),(uint8_t *)notarizedheightp); if ( matched != 0 ) @@ -685,8 +685,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr else { komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata); - if ( matched != 0 ) - printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff); + //if ( matched != 0 ) + // printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff); } if ( MoMoMdata.pairs != 0 ) free(MoMoMdata.pairs); @@ -706,8 +706,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr sp->MoMdepth = MoMdepth; } komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->MoMdepth); - if ( ASSETCHAINS_SYMBOL[0] != 0 ) - printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); + //if ( ASSETCHAINS_SYMBOL[0] != 0 ) + // printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { if ( signedfp == 0 ) @@ -733,8 +733,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } } } - } else if ( opretlen != 149 && height > 600000 && matched != 0 ) - printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen); + } //else if ( opretlen != 149 && height > 600000 && matched != 0 ) + //printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen); } else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 ) { diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 426cdb806..df17de2c7 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -41,7 +41,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp int staked_era = STAKED_era(timestamp); - printf("ERA.(%d) \n",staked_era); + //printf("ERA.(%d) \n",staked_era); if (staked_era == 0) { // this is an ERA GAP, so we will ignore this notarization //printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); From a5c1bc3360cfcae92204e36d575c25fb77b10233 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 19:50:45 +0800 Subject: [PATCH 0192/4463] add target to MoMoM print --- src/cc/import.cpp | 4 ++-- src/crosschain.cpp | 2 +- src/komodo_bitcoind.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index cc0c3b61f..dc5eff440 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -79,11 +79,11 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - printf("IMPORT momom: %s\n", momom.GetHex().data()); + printf("[%s] IMPORT momom: %s\n", targetSymbol,momom.GetHex().data()); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) - return Invalid("momom-check-fail"); + return Invalid("momom-check-fai"); } return Valid(); diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 23416c682..335bcc6c8 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -162,7 +162,7 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ if (MoMoM.IsNull()) throw std::runtime_error("No MoMs found"); - printf("GetCrossChainProof MoMoM: %s\n", MoMoM.GetHex().data()); + printf("[%s] GetCrossChainProof MoMoM: %s\n", targetSymbol,MoMoM.GetHex().data()); // Find index of source MoM in MoMoM int nIndex; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 4a2a9fc41..4a354830d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1445,7 +1445,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ { if ( isPoS != 2 ) { - fprintf(stderr,"ht.%d isPoS.%d utxo not validated -> must be PoW fake\n",height,isPoS); + //fprintf(stderr,"ht.%d isPoS.%d utxo not validated -> must be PoW fake\n",height,isPoS); isPoS = 0; } else From eddc4d53952181123454a5fe991e0290c65c62fb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 20:00:40 +0800 Subject: [PATCH 0193/4463] remove for import, compile angry --- src/cc/import.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index dc5eff440..578e6a52b 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -79,7 +79,7 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - printf("[%s] IMPORT momom: %s\n", targetSymbol,momom.GetHex().data()); + printf("IMPORT momom: %s\n", momom.GetHex().data()); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) From 32ed8b04441f1ed1e2419a2691e0822ae8e5b62e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 20:32:37 +0800 Subject: [PATCH 0194/4463] another one --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 4a354830d..5afb549cc 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1453,7 +1453,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); if ( bhash < bnTarget ) { - fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); + //fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); isPoS = 0; } } From 97a59fc2c62aa2452b79c1abb19951e6e2d0d704 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 20:57:58 +0800 Subject: [PATCH 0195/4463] fprintf? --- src/cc/import.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index 578e6a52b..fd0126ad4 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -78,8 +78,8 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp uint256 momom, target; if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - - printf("IMPORT momom: %s\n", momom.GetHex().data()); + + fprintf(stderr,"IMPORT momom: %s\n", momom.GetHex().data()); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) From 985808cbb40f0b8fb5c66e5c3d99579a14bc2d0a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 27 Sep 2018 21:38:00 +0800 Subject: [PATCH 0196/4463] try print momom to file --- src/cc/import.cpp | 6 +++++- src/crosschain.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index fd0126ad4..1f96a5d29 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -78,8 +78,12 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp uint256 momom, target; if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - + fprintf(stderr,"IMPORT momom: %s\n", momom.GetHex().data()); + FILE * fptr; + fptr = fopen("/home/cc/kmdmomom", "a+"); + fprintf(fptr, "%s\n", momom.GetHex().data()); + fclose(fptr); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 335bcc6c8..137e823ab 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -163,6 +163,10 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ throw std::runtime_error("No MoMs found"); printf("[%s] GetCrossChainProof MoMoM: %s\n", targetSymbol,MoMoM.GetHex().data()); + FILE * fptr; + fptr = fopen("/home/cc/acmomom", "a+"); + fprintf(fptr, "%s\n", MoMoM.GetHex().data()); + fclose(fptr); // Find index of source MoM in MoMoM int nIndex; From 2782c1fb5b9a3afd70a8bb2ec9dd9a968feed195 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 30 Sep 2018 12:31:16 +0800 Subject: [PATCH 0197/4463] fix error typo --- src/cc/import.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index 1f96a5d29..b72124735 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -87,7 +87,7 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) - return Invalid("momom-check-fai"); + return Invalid("momom-check-fail"); } return Valid(); From f56c91238afddd751cd34158f6aa8d2a0748ed42 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 30 Sep 2018 12:49:40 +0800 Subject: [PATCH 0198/4463] change ac_private pubkeys to use STAKED notaries instead of elected --- src/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4fabaeb29..5a4d5c152 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,8 @@ #include "wallet/asyncrpcoperation_sendmany.h" #include "wallet/asyncrpcoperation_shieldcoinbase.h" +#include "notaries_staked.h" + #include #include @@ -1045,21 +1047,21 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - static int32_t didinit; static char notaryaddrs[sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) + 1][64]; + static int32_t didinit; static char notaryaddrs[sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1) + 1][64]; int32_t i; if ( didinit == 0 ) { uint8_t pubkey33[33]; - for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) + for (i=0; i<=sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1); i++) { - if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) ) - decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]); + if ( i < sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1) ) + decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); } didinit = 1; } - for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) + for (i=0; i<=sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1); i++) if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) return(1); return(0); From c6fb1e911760c72a40447342c7da24937d1c9580 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 30 Sep 2018 13:00:09 +0800 Subject: [PATCH 0199/4463] try this instead --- src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5a4d5c152..90dac54aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1047,21 +1047,21 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - static int32_t didinit; static char notaryaddrs[sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1) + 1][64]; + static int32_t didinit; static char notaryaddrs[num_notaries_STAKED1 + 1][64]; int32_t i; if ( didinit == 0 ) { uint8_t pubkey33[33]; - for (i=0; i<=sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1); i++) + for (i=0; i<=num_notaries_STAKED1; i++) { - if ( i < sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1) ) + if ( i < num_notaries_STAKED1 ) decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); } didinit = 1; } - for (i=0; i<=sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1); i++) + for (i=0; i<=num_notaries_STAKED1; i++) if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) return(1); return(0); From d5f8644985e50469a3efebe57c4033dfcef3551a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 30 Sep 2018 13:07:38 +0800 Subject: [PATCH 0200/4463] change array to non static and remove init --- src/main.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 90dac54aa..b3e31681c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1047,20 +1047,16 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - static int32_t didinit; static char notaryaddrs[num_notaries_STAKED1 + 1][64]; + char notaryaddrs[num_notaries_STAKED1 + 1][64]; int32_t i; - if ( didinit == 0 ) - { - uint8_t pubkey33[33]; - for (i=0; i<=num_notaries_STAKED1; i++) - { - if ( i < num_notaries_STAKED1 ) - decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); - else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); - pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); - } - didinit = 1; - } + uint8_t pubkey33[33]; + for (i=0; i<=num_notaries_STAKED1; i++) + { + if ( i < num_notaries_STAKED1 ) + decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); + else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); + pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); + } for (i=0; i<=num_notaries_STAKED1; i++) if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) return(1); From 220df8ac00ab64f44d3acc6708e68d63a3744353 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 30 Sep 2018 13:12:33 +0800 Subject: [PATCH 0201/4463] hard code number of notaries --- src/main.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b3e31681c..f432eca29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1047,17 +1047,21 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - char notaryaddrs[num_notaries_STAKED1 + 1][64]; + static int32_t didinit; static char notaryaddrs[17 + 1][64]; int32_t i; - uint8_t pubkey33[33]; - for (i=0; i<=num_notaries_STAKED1; i++) - { - if ( i < num_notaries_STAKED1 ) - decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); - else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); - pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); - } - for (i=0; i<=num_notaries_STAKED1; i++) + if ( didinit == 0 ) + { + uint8_t pubkey33[33]; + for (i=0; i<=17; i++) + { + if ( i < 17 ) + decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); + else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); + pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); + } + didinit = 1; + } + for (i=0; i<=17; i++) if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) return(1); return(0); From 03327034480ce73196a49e1df10a447804e36a76 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Sun, 30 Sep 2018 11:32:39 +0000 Subject: [PATCH 0202/4463] add ac_priv chains --- src/assetchains.json | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/assetchains.json b/src/assetchains.json index 00c491935..4b3247d48 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -62,5 +62,27 @@ "195.201.137.5", "195.201.20.230" ] - } + }, + { + "ac_name": "STAKEDPRIV", + "ac_supply": "1000000", + "ac_reward" : "10000000000", + "ac_private": "1", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] + }, + { + "ac_name": "STAKEDCCP", + "ac_supply": "1000000", + "ac_reward" : "10000000000", + "ac_private": "1", + "ac_cc": "667", + "addnode": [ + "195.201.137.5", + "195.201.20.230" + ] + } +] ] From ae33616fc4d933e0b5319d97667bbaab04b44242 Mon Sep 17 00:00:00 2001 From: SHossain Date: Mon, 1 Oct 2018 10:53:12 +0100 Subject: [PATCH 0203/4463] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e8ed8c3cb..2285e8827 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,16 @@ This is the official Komodo sourcecode repository based on https://github.com/jl777/komodo. ## Development Resources - -- Komodo Website: [https://komodoplatform.com/](https://komodoplatform.com/) -- Komodo Blockexplorer: [https://kmdexplorer.io//](https://https://kmdexplorer.io/) -- Forum: [https://forum.komodoplatform.com/](https://forum.komodoplatform.com/) +- Komodo Website: [https://komodoplatform.com](https://komodoplatform.com/) +- Komodo Blockexplorer: [https://kmdexplorer.io](https://kmdexplorer.io/) +- Komodo Discord: [https://komodoplatform.com/discord](https://komodoplatform.com/discord) +- Forum: [https://forum.komodoplatform.com](https://forum.komodoplatform.com/) - Mail: [info@komodoplatform.com](mailto:info@komodoplatform.com) - Support: [https://support.komodoplatform.com/support/home](https://support.komodoplatform.com/support/home) -- Knowledgebase & How-to: [https://komodoplatform.atlassian.net/wiki/spaces/KPSD/pages](https://komodoplatform.atlassian.net/wiki/spaces/KPSD/pages) -- API references: [http://docs.komodoplatform.com/](http://docs.komodoplatform.com/) -- Blog: [http://blog.komodoplatform.com/](http://blog.komodoplatform.com/) -- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/wp-content/uploads/2018/03/2018-03-12-Komodo-White-Paper-Full.pdf) +- Knowledgebase & How-to: [https://support.komodoplatform.com/en/support/solutions](https://support.komodoplatform.com/en/support/solutions) +- API references & Dev Documentation: [https://docs.komodoplatform.com](https://docs.komodoplatform.com/) +- Blog: [https://blog.komodoplatform.com](https://blog.komodoplatform.com/) +- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/whitepaper) - Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) ## List of Komodo Platform Technologies From 71fc062672b1e6d1e419fc35652a89c6dfd2f1a1 Mon Sep 17 00:00:00 2001 From: SHossain Date: Mon, 1 Oct 2018 10:53:44 +0100 Subject: [PATCH 0204/4463] Update README.md --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e8ed8c3cb..92a7014f4 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,16 @@ This is the official Komodo sourcecode repository based on https://github.com/jl ## Development Resources -- Komodo Website: [https://komodoplatform.com/](https://komodoplatform.com/) -- Komodo Blockexplorer: [https://kmdexplorer.io//](https://https://kmdexplorer.io/) -- Forum: [https://forum.komodoplatform.com/](https://forum.komodoplatform.com/) +- Komodo Website: [https://komodoplatform.com](https://komodoplatform.com/) +- Komodo Blockexplorer: [https://kmdexplorer.io](https://kmdexplorer.io/) +- Komodo Discord: [https://komodoplatform.com/discord](https://komodoplatform.com/discord) +- Forum: [https://forum.komodoplatform.com](https://forum.komodoplatform.com/) - Mail: [info@komodoplatform.com](mailto:info@komodoplatform.com) - Support: [https://support.komodoplatform.com/support/home](https://support.komodoplatform.com/support/home) -- Knowledgebase & How-to: [https://komodoplatform.atlassian.net/wiki/spaces/KPSD/pages](https://komodoplatform.atlassian.net/wiki/spaces/KPSD/pages) -- API references: [http://docs.komodoplatform.com/](http://docs.komodoplatform.com/) -- Blog: [http://blog.komodoplatform.com/](http://blog.komodoplatform.com/) -- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/wp-content/uploads/2018/03/2018-03-12-Komodo-White-Paper-Full.pdf) +- Knowledgebase & How-to: [https://support.komodoplatform.com/en/support/solutions](https://support.komodoplatform.com/en/support/solutions) +- API references & Dev Documentation: [https://docs.komodoplatform.com](https://docs.komodoplatform.com/) +- Blog: [https://blog.komodoplatform.com](https://blog.komodoplatform.com/) +- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/whitepaper) - Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) ## List of Komodo Platform Technologies From 644ae923c06f8334c88aca48d55ccd2a76d896d1 Mon Sep 17 00:00:00 2001 From: Alrighttt <36680730+Alrighttt@users.noreply.github.com> Date: Mon, 1 Oct 2018 08:09:21 -0400 Subject: [PATCH 0205/4463] derp --- src/assetchains.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/assetchains.json b/src/assetchains.json index 4b3247d48..aa7c8bfb4 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -85,4 +85,3 @@ ] } ] -] From 12e14f15a0972a866975b8c089a5169d36f877d1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:13:35 +0800 Subject: [PATCH 0206/4463] add some prints to see where values are --- src/wallet/rpcwallet.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 055352973..e5433d4ff 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -398,7 +398,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr // Parse Zcash address CScript scriptPubKey = GetScriptForDestination(address); - + // Create and send the transaction CReserveKey reservekey(pwalletMain); CAmount nFeeRequired; @@ -4133,7 +4133,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) strDisabledMsg = "\nWARNING: z_mergetoaddress is DISABLED but can be enabled as an experimental feature.\n"; } - if (fHelp || params.size() < 2 || params.size() > 6) + if (fHelp || params.size() < 2 || params.size() > 7) throw runtime_error( "z_mergetoaddress [\"fromaddress\", ... ] \"toaddress\" ( fee ) ( transparent_limit ) ( shielded_limit ) ( memo )\n" + strDisabledMsg + @@ -4165,6 +4165,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) "4. shielded_limit (numeric, optional, default=" + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_SHIELDED_LIMIT) + ") Limit on the maximum number of notes to merge. Set to 0 to merge as many as will fit in the transaction.\n" "5. \"memo\" (string, optional) Encoded as hex. When toaddress is a z-addr, this will be stored in the memo field of the new note.\n" + "6. maximum_utxo_size (int, optional) eg, 10000 anything under 10000 satoshies will be merged.\n" "\nResult:\n" "{\n" " \"remainingUTXOs\": xxx (numeric) Number of UTXOs still available for merging.\n" @@ -4295,6 +4296,16 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) } } + if (params.size() > 6) { + maximum_utxo_size = params[6].get_int() + printf("maximum utxo size = %d\n", maximum_utxo_size); + if (maximum_utxo_size < 10) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); + } + } else { + maximum_utxo_size = 0; + } + MergeToAddressRecipient recipient(destaddress, memo); // Prepare to get UTXOs and notes @@ -4343,6 +4354,11 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) utxoCounter++; CAmount nValue = out.tx->vout[out.i].nValue; + if (maximum_utxo_size != 0) { + printf("maximum utxo size = %d \n", maximum_utxo_size); + printf("nValue = %s\n", nValue); + } + if (!maxedOutUTXOsFlag) { CBitcoinAddress ba(address); size_t increase = (ba.IsScript()) ? CTXIN_SPEND_P2SH_SIZE : CTXIN_SPEND_DUST_SIZE; @@ -5669,7 +5685,7 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp) UniValue oraclessamples(const UniValue& params, bool fHelp) { - UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num; + UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num; if ( fHelp || params.size() != 3 ) throw runtime_error("oraclessamples oracletxid batonutxo num\n"); if ( ensure_CCrequirements() < 0 ) From d411178c7e0fa3df85e47776e1c0b63112a0207f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:18:05 +0800 Subject: [PATCH 0207/4463] syntax --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e5433d4ff..b1261c695 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4296,6 +4296,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) } } + std::int maximum_utxo_size if (params.size() > 6) { maximum_utxo_size = params[6].get_int() printf("maximum utxo size = %d\n", maximum_utxo_size); @@ -4356,7 +4357,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) if (maximum_utxo_size != 0) { printf("maximum utxo size = %d \n", maximum_utxo_size); - printf("nValue = %s\n", nValue); + printf("nValue = %lld\n", nValue); } if (!maxedOutUTXOsFlag) { From 4f1650383a88438d961d4847101ad3ef90f3ccb4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:21:49 +0800 Subject: [PATCH 0208/4463] test --- src/wallet/rpcwallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b1261c695..e005eec5b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4296,10 +4296,10 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) } } - std::int maximum_utxo_size + CAmount maximum_utxo_size if (params.size() > 6) { maximum_utxo_size = params[6].get_int() - printf("maximum utxo size = %d\n", maximum_utxo_size); + printf("maximum utxo size = %ld\n", maximum_utxo_size); if (maximum_utxo_size < 10) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); } @@ -4357,7 +4357,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) if (maximum_utxo_size != 0) { printf("maximum utxo size = %d \n", maximum_utxo_size); - printf("nValue = %lld\n", nValue); + printf("nValue = %ld\n", nValue); } if (!maxedOutUTXOsFlag) { From 57d237b5bc68a88e25c0078b373194dca63152f5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:24:04 +0800 Subject: [PATCH 0209/4463] ; --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e005eec5b..81383d992 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4296,7 +4296,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) } } - CAmount maximum_utxo_size + CAmount maximum_utxo_size; if (params.size() > 6) { maximum_utxo_size = params[6].get_int() printf("maximum utxo size = %ld\n", maximum_utxo_size); From 2499a4fef8fa8f846b8fd89edaaf2843917ee115 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:25:17 +0800 Subject: [PATCH 0210/4463] ld --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 81383d992..1cd38bca2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4356,7 +4356,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) CAmount nValue = out.tx->vout[out.i].nValue; if (maximum_utxo_size != 0) { - printf("maximum utxo size = %d \n", maximum_utxo_size); + printf("maximum utxo size = %ld \n", maximum_utxo_size); printf("nValue = %ld\n", nValue); } From 2b81045e2ba5193127a582e629c808ff49e28f66 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:27:58 +0800 Subject: [PATCH 0211/4463] ; --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1cd38bca2..f407710c7 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4298,7 +4298,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) CAmount maximum_utxo_size; if (params.size() > 6) { - maximum_utxo_size = params[6].get_int() + maximum_utxo_size = params[6].get_int(); printf("maximum utxo size = %ld\n", maximum_utxo_size); if (maximum_utxo_size < 10) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); From 93253d38ea755bca797d8acff08646ba880675db Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:43:03 +0800 Subject: [PATCH 0212/4463] make memo last feild again --- src/wallet/rpcwallet.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f407710c7..01dabc4cc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4164,8 +4164,9 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_TRANSPARENT_LIMIT) + ") Limit on the maximum number of UTXOs to merge. Set to 0 to use node option -mempooltxinputlimit.\n" "4. shielded_limit (numeric, optional, default=" + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_SHIELDED_LIMIT) + ") Limit on the maximum number of notes to merge. Set to 0 to merge as many as will fit in the transaction.\n" - "5. \"memo\" (string, optional) Encoded as hex. When toaddress is a z-addr, this will be stored in the memo field of the new note.\n" - "6. maximum_utxo_size (int, optional) eg, 10000 anything under 10000 satoshies will be merged.\n" + "5. maximum_utxo_size (int, optional) eg, 10000 anything under 10000 satoshies will be merged.\n" + "6. \"memo\" (string, optional) Encoded as hex. When toaddress is a z-addr, this will be stored in the memo field of the new note.\n" + "\nResult:\n" "{\n" " \"remainingUTXOs\": xxx (numeric) Number of UTXOs still available for merging.\n" @@ -4283,9 +4284,20 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) } } - std::string memo; + CAmount maximum_utxo_size; if (params.size() > 5) { - memo = params[5].get_str(); + maximum_utxo_size = params[5].get_int(); + printf("maximum utxo size = %ld\n", maximum_utxo_size); + if (maximum_utxo_size < 10) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); + } + } else { + maximum_utxo_size = 0; + } + + std::string memo; + if (params.size() > 6) { + memo = params[6].get_str(); if (!isToZaddr) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Memo can not be used with a taddr. It can only be used with a zaddr."); } else if (!IsHex(memo)) { @@ -4296,17 +4308,6 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) } } - CAmount maximum_utxo_size; - if (params.size() > 6) { - maximum_utxo_size = params[6].get_int(); - printf("maximum utxo size = %ld\n", maximum_utxo_size); - if (maximum_utxo_size < 10) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); - } - } else { - maximum_utxo_size = 0; - } - MergeToAddressRecipient recipient(destaddress, memo); // Prepare to get UTXOs and notes From a0c1d43977433cfabf79292d5f12acbc9bc23053 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:48:24 +0800 Subject: [PATCH 0213/4463] long --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 01dabc4cc..f69e9eb4b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4286,7 +4286,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) CAmount maximum_utxo_size; if (params.size() > 5) { - maximum_utxo_size = params[5].get_int(); + maximum_utxo_size = params[5].get_real(); printf("maximum utxo size = %ld\n", maximum_utxo_size); if (maximum_utxo_size < 10) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); From 4bdd7e26cd5ed9e64c87118bf4eb9992eeab210d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 22:58:42 +0800 Subject: [PATCH 0214/4463] try --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f69e9eb4b..b147d4307 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4286,7 +4286,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) CAmount maximum_utxo_size; if (params.size() > 5) { - maximum_utxo_size = params[5].get_real(); + maximum_utxo_size = AmountFromValue( params[5] ); printf("maximum utxo size = %ld\n", maximum_utxo_size); if (maximum_utxo_size < 10) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); From dfba8357f375f599bf641c09dea73af64f75d04c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 23:09:36 +0800 Subject: [PATCH 0215/4463] fingers crossed --- src/wallet/rpcwallet.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b147d4307..e0efa9cb4 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4164,7 +4164,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_TRANSPARENT_LIMIT) + ") Limit on the maximum number of UTXOs to merge. Set to 0 to use node option -mempooltxinputlimit.\n" "4. shielded_limit (numeric, optional, default=" + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_SHIELDED_LIMIT) + ") Limit on the maximum number of notes to merge. Set to 0 to merge as many as will fit in the transaction.\n" - "5. maximum_utxo_size (int, optional) eg, 10000 anything under 10000 satoshies will be merged.\n" + "5. maximum_utxo_size (numeric, optional) eg, 0.0001 anything under 10000 satoshies will be merged.\n" "6. \"memo\" (string, optional) Encoded as hex. When toaddress is a z-addr, this will be stored in the memo field of the new note.\n" "\nResult:\n" @@ -4289,7 +4289,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) maximum_utxo_size = AmountFromValue( params[5] ); printf("maximum utxo size = %ld\n", maximum_utxo_size); if (maximum_utxo_size < 10) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 10 satoshies."); + throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 0.00000010."); } } else { maximum_utxo_size = 0; @@ -4358,7 +4358,12 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) if (maximum_utxo_size != 0) { printf("maximum utxo size = %ld \n", maximum_utxo_size); - printf("nValue = %ld\n", nValue); + if (nValue > maximum_utxo_size) { + printf("nValue = %ld which is over maximum size so we will ignore it!\n", nValue); + continue; + } else { + printf("utxo found under maximum size so we will add it!\n", ); + } } if (!maxedOutUTXOsFlag) { From 743131799fb25db2145a450aa59d1bfb52e224e8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 23:10:53 +0800 Subject: [PATCH 0216/4463] , --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e0efa9cb4..cb81244ae 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4362,7 +4362,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) printf("nValue = %ld which is over maximum size so we will ignore it!\n", nValue); continue; } else { - printf("utxo found under maximum size so we will add it!\n", ); + printf("utxo found under maximum size so we will add it!\n"); } } From cd6fbe09777fbef8a5b6f9a130c3bb71a4f334a9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 23:25:24 +0800 Subject: [PATCH 0217/4463] add exeption for iguana utxo --- src/wallet/rpcwallet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index cb81244ae..a05aed988 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4362,7 +4362,11 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) printf("nValue = %ld which is over maximum size so we will ignore it!\n", nValue); continue; } else { - printf("utxo found under maximum size so we will add it!\n"); + if (out.tx->vout[out.i].scriptPubKey.size() != 35) { + printf("utxo is an iguana utxo so we will ingore it!\n"); + continue; + } + printf("utxo found under maximum size that is not p2pk so we will add it!\n"); } } From 41fddfc0bf860d178a9b5328a4c8c69924cfa91d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 23:31:05 +0800 Subject: [PATCH 0218/4463] fix --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a05aed988..def79e51d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4357,12 +4357,12 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) CAmount nValue = out.tx->vout[out.i].nValue; if (maximum_utxo_size != 0) { - printf("maximum utxo size = %ld \n", maximum_utxo_size); + //printf("maximum utxo size = %ld \n", maximum_utxo_size); if (nValue > maximum_utxo_size) { printf("nValue = %ld which is over maximum size so we will ignore it!\n", nValue); continue; } else { - if (out.tx->vout[out.i].scriptPubKey.size() != 35) { + if (out.tx->vout[out.i].scriptPubKey.size() = 35) { printf("utxo is an iguana utxo so we will ingore it!\n"); continue; } From 30c320d1f66032ca1e02a505982a0940f362a94e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 23:32:21 +0800 Subject: [PATCH 0219/4463] = --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index def79e51d..e766e6bf6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4362,7 +4362,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) printf("nValue = %ld which is over maximum size so we will ignore it!\n", nValue); continue; } else { - if (out.tx->vout[out.i].scriptPubKey.size() = 35) { + if (out.tx->vout[out.i].scriptPubKey.size() == 35) { printf("utxo is an iguana utxo so we will ingore it!\n"); continue; } From 5d8a1637ae63b3aa38e60e1ac18ac42298462683 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 1 Oct 2018 23:43:20 +0800 Subject: [PATCH 0220/4463] remove prints to speed it up --- src/wallet/rpcwallet.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e766e6bf6..a429b81ac 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4164,7 +4164,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_TRANSPARENT_LIMIT) + ") Limit on the maximum number of UTXOs to merge. Set to 0 to use node option -mempooltxinputlimit.\n" "4. shielded_limit (numeric, optional, default=" + strprintf("%d", MERGE_TO_ADDRESS_DEFAULT_SHIELDED_LIMIT) + ") Limit on the maximum number of notes to merge. Set to 0 to merge as many as will fit in the transaction.\n" - "5. maximum_utxo_size (numeric, optional) eg, 0.0001 anything under 10000 satoshies will be merged.\n" + "5. maximum_utxo_size (numeric, optional) eg, 0.0001 anything under 10000 satoshies will be merged, ignores p2pk utxo!\n" "6. \"memo\" (string, optional) Encoded as hex. When toaddress is a z-addr, this will be stored in the memo field of the new note.\n" "\nResult:\n" @@ -4287,7 +4287,6 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) CAmount maximum_utxo_size; if (params.size() > 5) { maximum_utxo_size = AmountFromValue( params[5] ); - printf("maximum utxo size = %ld\n", maximum_utxo_size); if (maximum_utxo_size < 10) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Maximum size must be bigger than 0.00000010."); } @@ -4366,7 +4365,6 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) printf("utxo is an iguana utxo so we will ingore it!\n"); continue; } - printf("utxo found under maximum size that is not p2pk so we will add it!\n"); } } From f882623570959e3566ae0dca500272d4ebdf5de4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 2 Oct 2018 00:42:14 +0800 Subject: [PATCH 0221/4463] remove prints and fix utxo counter in wrong place --- src/wallet/rpcwallet.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a429b81ac..641a42f04 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4352,22 +4352,20 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) continue; } - utxoCounter++; CAmount nValue = out.tx->vout[out.i].nValue; if (maximum_utxo_size != 0) { - //printf("maximum utxo size = %ld \n", maximum_utxo_size); if (nValue > maximum_utxo_size) { - printf("nValue = %ld which is over maximum size so we will ignore it!\n", nValue); continue; } else { if (out.tx->vout[out.i].scriptPubKey.size() == 35) { - printf("utxo is an iguana utxo so we will ingore it!\n"); continue; } } } + utxoCounter++; + if (!maxedOutUTXOsFlag) { CBitcoinAddress ba(address); size_t increase = (ba.IsScript()) ? CTXIN_SPEND_P2SH_SIZE : CTXIN_SPEND_DUST_SIZE; From 478370fd6c3322dc6a2e65960d2ac8ed27d08450 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 2 Oct 2018 00:52:12 +0800 Subject: [PATCH 0222/4463] numutxos < 2 instead of 0... cant merge 1 utxo --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 641a42f04..7ef43e5db 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4429,7 +4429,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) #endif - if (numUtxos == 0 && numNotes == 0) { + if (numUtxos > 2 && numNotes == 0) { throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Could not find any funds to merge."); } From 0367b1a6856da6f5176f76ff11f15023d97ca3d8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 2 Oct 2018 00:53:28 +0800 Subject: [PATCH 0223/4463] < --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 7ef43e5db..7de29528f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4429,7 +4429,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) #endif - if (numUtxos > 2 && numNotes == 0) { + if (numUtxos < 2 && numNotes == 0) { throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Could not find any funds to merge."); } From b9b7f12d84dad450d80cac7834a81321bfb6e0b1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 12 Oct 2018 14:06:26 +0800 Subject: [PATCH 0224/4463] fix edgcase where eras before current get chosen out of order and prevent later ones being activated. --- src/komodo_notary.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d0ab8c078..a9750369a 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -264,6 +264,9 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam for (i=0; i Date: Tue, 16 Oct 2018 12:58:43 +0800 Subject: [PATCH 0225/4463] give this a go --- src/komodo_bitcoind.h | 48 +++++++++-------- src/komodo_globals.h | 2 +- src/komodo_utils.h | 6 ++- src/main.cpp | 16 +++++- src/miner.cpp | 117 +++++++++++++++++++++--------------------- src/pow.cpp | 48 +++++++++-------- 6 files changed, 135 insertions(+), 102 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 86ed8f7b3..8bfca7dc4 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -169,7 +169,7 @@ try_again: curl_handle = curl_easy_init(); init_string(&s); headers = curl_slist_append(0,"Expect:"); - + curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl_handle,CURLOPT_URL, url); @@ -198,7 +198,7 @@ try_again: bracket0 = (char *)"["; bracket1 = (char *)"]"; } - + databuf = (char *)malloc(256 + strlen(command) + strlen(params)); sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1); //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); @@ -238,7 +238,7 @@ try_again: free(s.ptr); sleep((1<= 10000 sats PoS stake must be without txfee and in the last tx in the block at vout[0] */ +extern int32_t ASSETCHAINS_STREAM; uint64_t komodo_commission(const CBlock *pblock) { - int32_t i,j,n=0,txn_count; uint64_t commission,total = 0; - txn_count = pblock->vtx.size(); - for (i=0; ivtx[i].vout.size(); - for (j=0; jvtx[i].vout[j].nValue; - } + int32_t i,j,n=0,txn_count; uint64_t commission,total = 0; + txn_count = pblock->vtx.size(); + for (i=0; ivtx[i].vout.size(); + for (j=0; jvtx[i].vout[j].nValue; + } + } + //fprintf(stderr,"txn.%d n.%d commission total %.8f -> %.8f\n",txn_count,n,dstr(total),dstr((total * ASSETCHAINS_COMMISSION) / COIN)); + commission = ((total * ASSETCHAINS_COMMISSION) / COIN); + if ( commission < 10000 ) + commission = 0; + } + else + { + commission = 10000; } - //fprintf(stderr,"txn.%d n.%d commission total %.8f -> %.8f\n",txn_count,n,dstr(total),dstr((total * ASSETCHAINS_COMMISSION) / COIN)); - commission = ((total * ASSETCHAINS_COMMISSION) / COIN); - if ( commission < 10000 ) - commission = 0; return(commission); } diff --git a/src/komodo_globals.h b/src/komodo_globals.h index f352b5333..c456d3e44 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -45,7 +45,7 @@ struct komodo_state KOMODO_STATES[34]; #define _COINBASE_MATURITY 100 int COINBASE_MATURITY = _COINBASE_MATURITY;//100; -int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,KOMODO_CONNECTING = -1; +int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index bfd59fd57..50b0e3020 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1561,6 +1561,7 @@ void komodo_args(char *argv0) ASSETCHAINS_DECAY = GetArg("-ac_decay",0); ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); + ASSETCHAINS_STREAM = GetArg("-ac_stream",0); if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 ) ASSETCHAINS_STAKED = 100; if ( ASSETCHAINS_STAKED != 0 && ASSETCHAINS_PRIVATE != 0 ) @@ -1589,7 +1590,10 @@ void komodo_args(char *argv0) { ASSETCHAINS_COMMISSION = 0; printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); - } + } else if ( ASSETCHAINS_STREAM != 0) { + ASSETCHAINS_STREAM = 0; + printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n"); + } if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 ) { fprintf(stderr,"end.%llu blocks, reward %.8f halving.%llu blocks, decay.%llu perc %.4f%% ac_pub=[%02x...]\n",(long long)ASSETCHAINS_ENDSUBSIDY,dstr(ASSETCHAINS_REWARD),(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0]); diff --git a/src/main.cpp b/src/main.cpp index 1ff5f8012..39270a0b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1866,6 +1866,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) //uint64_t komodo_moneysupply(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint32_t ASSETCHAINS_MAGIC; +extern int32_t ASSETCHAINS_STREAM; extern uint64_t ASSETCHAINS_STAKED,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY; extern uint8_t ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; @@ -1895,7 +1896,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { if ( ASSETCHAINS_REWARD == 0 ) return(10000); - else if ( ASSETCHAINS_ENDSUBSIDY != 0 && nHeight >= ASSETCHAINS_ENDSUBSIDY ) + else if ( ( ASSETCHAINS_ENDSUBSIDY != 0 && nHeight >= ASSETCHAINS_ENDSUBSIDY )|| ASSETCHAINS_STREAM != 0) return(0); else { @@ -2961,6 +2962,19 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin if (!view.HaveJoinSplitRequirements(tx)) return state.DoS(100, error("ConnectBlock(): JoinSplit requirements not met"), REJECT_INVALID, "bad-txns-joinsplit-requirements-not-met"); + + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( ASSETCHAINS_STREAM != 0 ) + { + if ( block.vtx.size() == 1 && block.vtx[0].vout.size() == 2 && pindex->nHeight > ASSETCHAINS_MINHEIGHT) + { + return state.DoS(100, error("ConnectBlock(): There are no TX in this block, it is invalid!"), + REJECT_INVALID, "bad-block-no-transactions"); + } + } + } + if (fAddressIndex || fSpentIndex) { for (size_t j = 0; j < tx.vin.size(); j++) { diff --git a/src/miner.cpp b/src/miner.cpp index 874c1b4f8..8fbfcff05 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -64,7 +64,7 @@ public: set setDependsOn; CFeeRate feeRate; double dPriority; - + COrphan(const CTransaction* ptxIn) : ptx(ptxIn), feeRate(0), dPriority(0) { } @@ -78,10 +78,10 @@ typedef boost::tuple TxPriority; class TxPriorityCompare { bool byFee; - + public: TxPriorityCompare(bool _byFee) : byFee(_byFee) { } - + bool operator()(const TxPriority& a, const TxPriority& b) { if (byFee) @@ -106,7 +106,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, #include "komodo_defs.h" -extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; +extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY; @@ -141,27 +141,27 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) // -blockversion=N to test forking scenarios if (Params().MineBlocksOnDemand()) pblock->nVersion = GetArg("-blockversion", pblock->nVersion); - + // Add dummy coinbase tx as first transaction pblock->vtx.push_back(CTransaction()); pblocktemplate->vTxFees.push_back(-1); // updated at end pblocktemplate->vTxSigOps.push_back(-1); // updated at end - + // Largest block you're willing to create: unsigned int nBlockMaxSize = GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE); // Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity: nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(MAX_BLOCK_SIZE-1000), nBlockMaxSize)); - + // How much of the block should be dedicated to high-priority transactions, // included regardless of the fees they pay unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE); nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize); - + // Minimum block size you want to create; block will be filled with free transactions // until there are no more or the block reaches this size: unsigned int nBlockMinSize = GetArg("-blockminsize", DEFAULT_BLOCK_MIN_SIZE); nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize); - + // Collect memory pool transactions into the block CAmount nFees = 0; CBlockIndex* pindexPrev = 0; @@ -174,12 +174,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) const int64_t nMedianTimePast = pindexPrev->GetMedianTimePast(); CCoinsViewCache view(pcoinsTip); uint32_t expired; uint64_t commission; - + // Priority order to process transactions list vOrphan; // list memory doesn't move map > mapDependers; bool fPrintPriority = GetBoolArg("-printpriority", false); - + // This vector will be sorted into a priority queue: vector vecPriority; vecPriority.reserve(mempool.mapTx.size()); @@ -187,11 +187,11 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) mi != mempool.mapTx.end(); ++mi) { const CTransaction& tx = mi->GetTx(); - + int64_t nLockTimeCutoff = (STANDARD_LOCKTIME_VERIFY_FLAGS & LOCKTIME_MEDIAN_TIME_PAST) ? nMedianTimePast : pblock->GetBlockTime(); - + if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight)) { //fprintf(stderr,"coinbase.%d finaltx.%d expired.%d\n",tx.IsCoinBase(),IsFinalTx(tx, nHeight, nLockTimeCutoff),IsExpiredTx(tx, nHeight)); @@ -256,16 +256,16 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) } if (fMissingInputs) continue; - + // Priority is sum(valuein * age) / modified_txsize unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); dPriority = tx.ComputePriority(dPriority, nTxSize); - + uint256 hash = tx.GetHash(); mempool.ApplyDeltas(hash, dPriority, nTotalIn); - + CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize); - + if (porphan) { porphan->dPriority = dPriority; @@ -274,27 +274,27 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) else vecPriority.push_back(TxPriority(dPriority, feeRate, &(mi->GetTx()))); } - + // Collect transactions into block uint64_t nBlockSize = 1000; uint64_t nBlockTx = 0; int64_t interest; int nBlockSigOps = 100; bool fSortedByFee = (nBlockPrioritySize <= 0); - + TxPriorityCompare comparer(fSortedByFee); std::make_heap(vecPriority.begin(), vecPriority.end(), comparer); - + while (!vecPriority.empty()) { // Take highest priority transaction off the priority queue: double dPriority = vecPriority.front().get<0>(); CFeeRate feeRate = vecPriority.front().get<1>(); const CTransaction& tx = *(vecPriority.front().get<2>()); - + std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer); vecPriority.pop_back(); - + // Size limits unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); if (nBlockSize + nTxSize >= nBlockMaxSize-512) // room for extra autotx @@ -302,7 +302,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) //fprintf(stderr,"nBlockSize %d + %d nTxSize >= %d nBlockMaxSize\n",(int32_t)nBlockSize,(int32_t)nTxSize,(int32_t)nBlockMaxSize); continue; } - + // Legacy limits on sigOps: unsigned int nTxSigOps = GetLegacySigOpCount(tx); if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1) @@ -329,14 +329,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) comparer = TxPriorityCompare(fSortedByFee); std::make_heap(vecPriority.begin(), vecPriority.end(), comparer); } - + if (!view.HaveInputs(tx)) { //fprintf(stderr,"dont have inputs\n"); continue; } CAmount nTxFees = view.GetValueIn(chainActive.LastTip()->nHeight,&interest,tx,chainActive.LastTip()->nTime)-tx.GetValueOut(); - + nTxSigOps += GetP2SHSigOpCount(tx, view); if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS-1) { @@ -354,7 +354,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) continue; } UpdateCoins(tx, view, nHeight); - + // Added pblock->vtx.push_back(tx); pblocktemplate->vTxFees.push_back(nTxFees); @@ -363,12 +363,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) ++nBlockTx; nBlockSigOps += nTxSigOps; nFees += nTxFees; - + if (fPrintPriority) { LogPrintf("priority %.1f fee %s txid %s\n",dPriority, feeRate.ToString(), tx.GetHash().ToString()); } - + // Add transactions that depend on this one to the priority queue if (mapDependers.count(hash)) { @@ -386,7 +386,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) } } } - + nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); @@ -411,7 +411,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) //printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.LastTip()->nHeight+1,blocktime,(uint32_t)(GetAdjustedTime() - (blocktime-13))); } else return(0); //fprintf(stderr,"no utxos eligible for staking\n"); } - + // Create coinbase tx CMutableTransaction txNew = CreateNewContextualCMutableTransaction(chainparams.GetConsensus(), nHeight); txNew.vin.resize(1); @@ -426,9 +426,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) // Add fees txNew.vout[0].nValue += nFees; txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; - + pblock->vtx[0] = txNew; - if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 ) + if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 ) { int32_t i; uint8_t *ptr; txNew.vout.resize(2); @@ -449,7 +449,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) nonce <<= 32; nonce >>= 16; pblock->nNonce = ArithToUint256(nonce); - + // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); pblock->hashReserved = uint256(); @@ -527,7 +527,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) return pblocktemplate.release(); } - + /* #ifdef ENABLE_WALLET boost::optional GetMinerScriptPubKey(CReserveKey& reservekey) @@ -550,11 +550,11 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) return boost::optional(); #endif } - + CScript scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG; return scriptPubKey; } - + #ifdef ENABLE_WALLET CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { @@ -564,7 +564,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) { boost::optional scriptPubKey = GetMinerScriptPubKey(); #endif - + if (!scriptPubKey) { return NULL; } @@ -592,7 +592,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& CMutableTransaction txCoinbase(pblock->vtx[0]); txCoinbase.vin[0].scriptSig = (CScript() << nHeight << CScriptNum(nExtraNonce)) + COINBASE_FLAGS; assert(txCoinbase.vin[0].scriptSig.size() <= 100); - + pblock->vtx[0] = txCoinbase; pblock->hashMerkleRoot = pblock->BuildMerkleTree(); } @@ -606,7 +606,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,int32_t gpucount) { CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i; - if ( nHeight == 1 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) + if ( (nHeight == 1 || ASSETCHAINS_STREAM != 0 ) && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; } @@ -615,7 +615,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in //fprintf(stderr,"use notary pubkey\n"); scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG; } - else { if (!reservekey.GetReservedKey(pubkey)) { @@ -661,7 +660,7 @@ static bool ProcessBlockFound(CBlock* pblock) { LogPrintf("%s\n", pblock->ToString()); LogPrintf("generated %s height.%d\n", FormatMoney(pblock->vtx[0].vout[0].nValue),chainActive.LastTip()->nHeight+1); - + // Found a solution { //LOCK(cs_main); @@ -676,11 +675,11 @@ static bool ProcessBlockFound(CBlock* pblock) for (i=31; i>=0; i--) fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); fprintf(stderr," <- chainTip (stale)\n"); - + return error("KomodoMiner: generated block is stale"); } } - + #ifdef ENABLE_WALLET // Remove key from key pool if ( IS_KOMODO_NOTARY == 0 ) @@ -704,7 +703,7 @@ static bool ProcessBlockFound(CBlock* pblock) CValidationState state; if (!ProcessNewBlock(1,chainActive.LastTip()->nHeight+1,state, NULL, pblock, true, NULL)) return error("KomodoMiner: ProcessNewBlock, block not accepted"); - + TrackMinedBlock(pblock->GetHash()); komodo_broadcast(pblock,16); return true; @@ -728,15 +727,15 @@ void static BitcoinMiner() SetThreadPriority(THREAD_PRIORITY_LOWEST); RenameThread("komodo-miner"); const CChainParams& chainparams = Params(); - + #ifdef ENABLE_WALLET // Each thread has its own key CReserveKey reservekey(pwallet); #endif - + // Each thread has its own counter unsigned int nExtraNonce = 0; - + unsigned int n = chainparams.EquihashN(); unsigned int k = chainparams.EquihashK(); uint8_t *script; uint64_t total,checktoshis; int32_t i,j,gpucount=KOMODO_MAXGPUCOUNT,notaryid = -1; @@ -767,7 +766,7 @@ void static BitcoinMiner() } ); miningTimer.start(); - + try { if ( ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str()); @@ -790,7 +789,7 @@ void static BitcoinMiner() break; MilliSleep(15000); //fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,ASSETCHAINS_SYMBOL,(int32_t)IsInitialBlockDownload()); - + } while (true); //fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL); miningTimer.start(); @@ -1054,13 +1053,13 @@ void static BitcoinMiner() std::lock_guard lock{m_cs}; return cancelSolver; }; - + // TODO: factor this out into a function with the same API for each solver. if (solver == "tromp" ) { //&& notaryid >= 0 ) { // Create solver and initialize it. equi eq(1); eq.setstate(&curr_state); - + // Initialization done, start algo driver. eq.digit0(0); eq.xfull = eq.bfull = eq.hfull = 0; @@ -1072,7 +1071,7 @@ void static BitcoinMiner() } eq.digitK(0); ehSolverRuns.increment(); - + // Convert solution indices to byte array (decompress) and pass it to validBlock method. for (size_t s = 0; s < eq.nsols; s++) { LogPrint("pow", "Checking solution %d\n", s+1); @@ -1081,7 +1080,7 @@ void static BitcoinMiner() index_vector[i] = eq.sols[s][i]; } std::vector sol_char = GetMinimalFromIndices(index_vector, DIGITBITS); - + if (validBlock(sol_char)) { // If we find a POW solution, do not try other solutions // because they become invalid as we created a new block in blockchain. @@ -1108,7 +1107,7 @@ void static BitcoinMiner() cancelSolver = false; } } - + // Check for stop or if block needs to be rebuilt boost::this_thread::interruption_point(); // Regtest mode doesn't require peers @@ -1178,7 +1177,7 @@ void static BitcoinMiner() miningTimer.stop(); c.disconnect(); } - + #ifdef ENABLE_WALLET void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads) #else @@ -1186,10 +1185,10 @@ void static BitcoinMiner() #endif { static boost::thread_group* minerThreads = NULL; - + if (nThreads < 0) nThreads = GetNumCores(); - + if (minerThreads != NULL) { minerThreads->interrupt_all(); @@ -1201,7 +1200,7 @@ void static BitcoinMiner() nThreads = 1; if (nThreads == 0 || !fGenerate) return; - + minerThreads = new boost::thread_group(); for (int i = 0; i < nThreads; i++) { #ifdef ENABLE_WALLET @@ -1211,5 +1210,5 @@ void static BitcoinMiner() #endif } } - + #endif // ENABLE_MINING diff --git a/src/pow.cpp b/src/pow.cpp index 1291e445e..9c8f68586 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -20,31 +20,39 @@ #include "librustzcash.h" #endif // ENABLE_RUST uint32_t komodo_chainactive_timestamp(); +extern int32_t ASSETCHAINS_STREAM; unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { - unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); - // Genesis block - if (pindexLast == NULL ) - return nProofOfWorkLimit; + if ( ASSETCHAINS_STREAM == 0) + { + unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); + // Genesis block + if (pindexLast == NULL ) + return nProofOfWorkLimit; - // Find the first block in the averaging interval - const CBlockIndex* pindexFirst = pindexLast; - arith_uint256 bnTot {0}; - for (int i = 0; pindexFirst && i < params.nPowAveragingWindow; i++) { - arith_uint256 bnTmp; - bnTmp.SetCompact(pindexFirst->nBits); - bnTot += bnTmp; - pindexFirst = pindexFirst->pprev; + // Find the first block in the averaging interval + const CBlockIndex* pindexFirst = pindexLast; + arith_uint256 bnTot {0}; + for (int i = 0; pindexFirst && i < params.nPowAveragingWindow; i++) { + arith_uint256 bnTmp; + bnTmp.SetCompact(pindexFirst->nBits); + bnTot += bnTmp; + pindexFirst = pindexFirst->pprev; + } + + // Check we have enough blocks + if (pindexFirst == NULL) + return nProofOfWorkLimit; + + arith_uint256 bnAvg {bnTot / params.nPowAveragingWindow}; + + return CalculateNextWorkRequired(bnAvg, pindexLast->GetMedianTimePast(), pindexFirst->GetMedianTimePast(), params); + } + else + { + return 537857807; } - - // Check we have enough blocks - if (pindexFirst == NULL) - return nProofOfWorkLimit; - - arith_uint256 bnAvg {bnTot / params.nPowAveragingWindow}; - - return CalculateNextWorkRequired(bnAvg, pindexLast->GetMedianTimePast(), pindexFirst->GetMedianTimePast(), params); } unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg, From 4e9596efeab6fa2426960c338b1dc72576143e98 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 13:02:16 +0800 Subject: [PATCH 0226/4463] fix commission --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 8bfca7dc4..1b8daf3a7 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1109,9 +1109,9 @@ extern int32_t ASSETCHAINS_STREAM; uint64_t komodo_commission(const CBlock *pblock) { + int32_t i,j,n=0,txn_count; uint64_t commission,total = 0; if ( ASSETCHAINS_STREAM == 0 ) { - int32_t i,j,n=0,txn_count; uint64_t commission,total = 0; txn_count = pblock->vtx.size(); for (i=0; i Date: Tue, 16 Oct 2018 13:07:30 +0800 Subject: [PATCH 0227/4463] prevent STREAM and PERC being used at the same time --- src/komodo_utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 50b0e3020..4c4827f6d 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1562,6 +1562,11 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); ASSETCHAINS_STREAM = GetArg("-ac_stream",0); + if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_COMMISSION != 0 ) { + printf("ASSETCHAINS_STREAM cannot be used with ASSETCHAINS_COMMISSION setting both to 0! \n"); + ASSETCHAINS_STREAM = 0; + ASSETCHAINS_COMMISSION = 0; + } if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 ) ASSETCHAINS_STAKED = 100; if ( ASSETCHAINS_STAKED != 0 && ASSETCHAINS_PRIVATE != 0 ) From c175848729fa19799d0910a6bac236c2123e1d4c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 13:12:53 +0800 Subject: [PATCH 0228/4463] set minimum supply for ac_stream to 100k --- src/komodo_utils.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 4c4827f6d..b60328c54 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1599,6 +1599,10 @@ void komodo_args(char *argv0) ASSETCHAINS_STREAM = 0; printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n"); } + if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SUPPLY == 10 ) { + ASSETCHAINS_SUPPLY = 100000; + printf("ASSETCHAINS_STREAM is set with no supply, setting supply at 100,000 coins. \n"); + } if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 ) { fprintf(stderr,"end.%llu blocks, reward %.8f halving.%llu blocks, decay.%llu perc %.4f%% ac_pub=[%02x...]\n",(long long)ASSETCHAINS_ENDSUBSIDY,dstr(ASSETCHAINS_REWARD),(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0]); From 0d63c1f908db9bcd68e2dddb89d9eae7f01cd966 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 13:36:24 +0800 Subject: [PATCH 0229/4463] add some prints --- src/komodo_bitcoind.h | 5 ++++- src/miner.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 1b8daf3a7..83b8399b8 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1577,9 +1577,12 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) { if ( height == 1 ) { + fprintf(stderr, "checking override pubkey thingo \n"); script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); - if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) + if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { + fprintf(stderr, "failed the check\n"); return(-1); + } } else { diff --git a/src/miner.cpp b/src/miner.cpp index 8fbfcff05..79a3c1eec 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -609,6 +609,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in if ( (nHeight == 1 || ASSETCHAINS_STREAM != 0 ) && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; + fprintf(stderr, "assechains stream should be mining to override pubkey\n"); } else if ( USE_EXTERNAL_PUBKEY != 0 ) { From 497f834d1f1d81ef89f99c9e84b57d8640b310e3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 13:49:38 +0800 Subject: [PATCH 0230/4463] disable check to see what block is being created --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 83b8399b8..d0ee426b8 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1575,7 +1575,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { - if ( height == 1 ) + /*if ( height == 1 ) { fprintf(stderr, "checking override pubkey thingo \n"); script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); @@ -1585,10 +1585,10 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } } else - { + {*/ if ( komodo_checkcommission(pblock,height) < 0 ) return(-1); - } + //} } //fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed); if ( failed != 0 && possible == 0 && notaryid < 0 ) From 45ef1a21c7552c5dfe9a722104b777c9ea0aeb56 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 14:21:23 +0800 Subject: [PATCH 0231/4463] try this --- src/komodo_bitcoind.h | 8 ++++---- src/komodo_gateway.h | 13 ++++++------- src/komodo_utils.h | 2 +- src/main.cpp | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d0ee426b8..f1f5b8efd 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1472,7 +1472,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ int64_t komodo_checkcommission(CBlock *pblock,int32_t height) { int64_t checktoshis=0; uint8_t *script; - if ( ASSETCHAINS_COMMISSION != 0 ) + if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) { checktoshis = komodo_commission(pblock); if ( checktoshis > 10000 && pblock->vtx[0].vout.size() != 2 ) @@ -1575,7 +1575,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { - /*if ( height == 1 ) + if ( height == 1 ) { fprintf(stderr, "checking override pubkey thingo \n"); script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); @@ -1585,10 +1585,10 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } } else - {*/ + { if ( komodo_checkcommission(pblock,height) < 0 ) return(-1); - //} + } } //fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed); if ( failed != 0 && possible == 0 && notaryid < 0 ) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 379224b48..233f87fcf 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -90,7 +90,7 @@ struct pax_transaction *komodo_paxmark(int32_t height,uint256 txid,uint16_t vout pax->marked = mark; //if ( height > 214700 || pax->height > 214700 ) // printf("mark ht.%d %.8f %.8f\n",pax->height,dstr(pax->komodoshis),dstr(pax->fiatoshis)); - + } pthread_mutex_unlock(&komodo_mutex); return(pax); @@ -203,9 +203,9 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t // return(0); incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4)); //41e77b91cb68dc2aa02fa88550eae6b6d44db676a7e935337b6d1392d9718f03cb0200305c90660400000000fbcbeb1f000000bde801006201000058e7945ad08ddba1eac9c9b6c8e1e97e8016a2d152 - + // 41e94d736ec69d88c08b5d238abeeca609c02357a8317e0d56c328bcb1c259be5d0200485bc80200000000404b4c000000000059470200b80b000061f22ba7d19fe29ac3baebd839af8b7127d1f9075553440046bb4cc7a3b5cd39dffe7206507a3482a00780e617f68b273cce9817ed69298d02001069ca1b0000000080f0fa02000000005b470200b90b000061f22ba7d19fe29ac3baebd839af8b7127d1f90755 - + //for (i=0; i 1 ) + if ( (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && height > 1 ) { if ( (checktoshis= komodo_checkcommission((CBlock *)&block,height)) < 0 ) { @@ -772,7 +772,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout,char *source) { - uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; + uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; const char *typestr = "unknown"; if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 && opretbuf[0] != 'K' ) { @@ -1185,7 +1185,7 @@ void komodo_stateind_set(struct komodo_state *sp,uint32_t *inds,int32_t n,uint8_ printf("numR.%d numV.%d numN.%d count.%d\n",numR,numV,numN,count); /*else if ( func == 'K' ) // KMD height: stop after 1st else if ( func == 'T' ) // KMD height+timestamp: stop after 1st - + else if ( func == 'N' ) // notarization, scan backwards 1440+ blocks; else if ( func == 'V' ) // price feed: can stop after 1440+ else if ( func == 'R' ) // opreturn:*/ @@ -1518,4 +1518,3 @@ void komodo_passport_iteration() printf("READY for %s RPC calls at %u! done PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,(uint32_t)time(NULL),ASSETCHAINS_SYMBOL,refid); } } - diff --git a/src/komodo_utils.h b/src/komodo_utils.h index b60328c54..ebeb8324f 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1597,7 +1597,7 @@ void komodo_args(char *argv0) printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); } else if ( ASSETCHAINS_STREAM != 0) { ASSETCHAINS_STREAM = 0; - printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n"); + printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n %s",ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); } if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SUPPLY == 10 ) { ASSETCHAINS_SUPPLY = 100000; diff --git a/src/main.cpp b/src/main.cpp index 39270a0b9..42f1d624d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3124,7 +3124,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime1 - nTimeStart) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart) / (nInputs-1), nTimeConnect * 0.000001); CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, chainparams.GetConsensus()) + sum; - if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 ) + if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) ) { uint64_t checktoshis; if ( (checktoshis= komodo_commission((CBlock *)&block)) != 0 ) From 8ca9133eb4c7ef0735cf93d6e3721d12160dcbb4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 14:44:55 +0800 Subject: [PATCH 0232/4463] fix --- src/komodo_utils.h | 2 +- src/miner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ebeb8324f..5dc218d76 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1603,7 +1603,7 @@ void komodo_args(char *argv0) ASSETCHAINS_SUPPLY = 100000; printf("ASSETCHAINS_STREAM is set with no supply, setting supply at 100,000 coins. \n"); } - if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 ) + if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_STREAM != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 ) { fprintf(stderr,"end.%llu blocks, reward %.8f halving.%llu blocks, decay.%llu perc %.4f%% ac_pub=[%02x...]\n",(long long)ASSETCHAINS_ENDSUBSIDY,dstr(ASSETCHAINS_REWARD),(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0]); extraptr = extrabuf; diff --git a/src/miner.cpp b/src/miner.cpp index 79a3c1eec..b058a7c7d 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -439,7 +439,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) for (i=0; i<33; i++) ptr[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i]; ptr[34] = OP_CHECKSIG; - //printf("autocreate commision vout\n"); + printf("autocreate commission vout\n"); pblock->vtx[0] = txNew; } pblocktemplate->vTxFees[0] = -nFees; From 3793c6386097185cd973b6823e55c208564228e8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 15:33:09 +0800 Subject: [PATCH 0233/4463] oops LOL --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index b058a7c7d..36ed84f05 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -615,7 +615,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in { //fprintf(stderr,"use notary pubkey\n"); scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG; - } + } else { if (!reservekey.GetReservedKey(pubkey)) { From b66f366d5cb4ca6a6c009ed928a3b93dad627b91 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 16:06:49 +0800 Subject: [PATCH 0234/4463] next try --- src/komodo_bitcoind.h | 2 -- src/main.cpp | 9 +++++++-- src/miner.cpp | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index f1f5b8efd..b13a2c36e 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1577,10 +1577,8 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) { if ( height == 1 ) { - fprintf(stderr, "checking override pubkey thingo \n"); script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { - fprintf(stderr, "failed the check\n"); return(-1); } } diff --git a/src/main.cpp b/src/main.cpp index 42f1d624d..c6d2ee9e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1895,8 +1895,13 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) else if ( ASSETCHAINS_ENDSUBSIDY == 0 || nHeight < ASSETCHAINS_ENDSUBSIDY ) { if ( ASSETCHAINS_REWARD == 0 ) - return(10000); - else if ( ( ASSETCHAINS_ENDSUBSIDY != 0 && nHeight >= ASSETCHAINS_ENDSUBSIDY )|| ASSETCHAINS_STREAM != 0) + { + if ( ASSETCHAINS_STREAM != 0 && nHeight > 128 ) + return(0); + else + return(10000); + } + else if ( ASSETCHAINS_ENDSUBSIDY != 0 && nHeight >= ASSETCHAINS_ENDSUBSIDY ) return(0); else { diff --git a/src/miner.cpp b/src/miner.cpp index 36ed84f05..39caa35c3 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -609,7 +609,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in if ( (nHeight == 1 || ASSETCHAINS_STREAM != 0 ) && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; - fprintf(stderr, "assechains stream should be mining to override pubkey\n"); } else if ( USE_EXTERNAL_PUBKEY != 0 ) { From 68032ee5a71a557fc10a14a78f951f34d9079566 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 17:14:07 +0800 Subject: [PATCH 0235/4463] change so only ac_pubkey can mine coinbase --- src/komodo_bitcoind.h | 2 +- src/komodo_utils.h | 13 ++++++------- src/miner.cpp | 7 +++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index b13a2c36e..4051eb095 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1575,7 +1575,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { - if ( height == 1 ) + if ( height == 1 || ASSETCHAINS_STREAM != 0 ) { script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 5dc218d76..1535d5812 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1562,10 +1562,9 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); ASSETCHAINS_STREAM = GetArg("-ac_stream",0); - if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_COMMISSION != 0 ) { - printf("ASSETCHAINS_STREAM cannot be used with ASSETCHAINS_COMMISSION setting both to 0! \n"); - ASSETCHAINS_STREAM = 0; - ASSETCHAINS_COMMISSION = 0; + if ( ASSETCHAINS_STREAM != 0 && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0) { + printf("ASSETCHAINS_STREAM cannot be used with:\n ASSETCHAINS_COMMISSION \n ASSETCHAINS_ENDSUBSIDY\n ASSETCHAINS_REWARD\n ASSETCHAINS_HALVING\n ASSETCHAINS_DECAY\n ASSETCHAINS_PRIVATE\n"); + exit(0); } if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 ) ASSETCHAINS_STAKED = 100; @@ -1597,11 +1596,11 @@ void komodo_args(char *argv0) printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); } else if ( ASSETCHAINS_STREAM != 0) { ASSETCHAINS_STREAM = 0; - printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n %s",ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); + printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n"); } if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SUPPLY == 10 ) { - ASSETCHAINS_SUPPLY = 100000; - printf("ASSETCHAINS_STREAM is set with no supply, setting supply at 100,000 coins. \n"); + ASSETCHAINS_SUPPLY = 1000000; + printf("ASSETCHAINS_STREAM is set with no supply, setting supply at 1,000,000 coins. \n"); } if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_STREAM != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 ) { diff --git a/src/miner.cpp b/src/miner.cpp index 39caa35c3..1c83c5a61 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -439,7 +439,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) for (i=0; i<33; i++) ptr[i+1] = ASSETCHAINS_OVERRIDE_PUBKEY33[i]; ptr[34] = OP_CHECKSIG; - printf("autocreate commission vout\n"); + //printf("autocreate commission vout\n"); pblock->vtx[0] = txNew; } pblocktemplate->vTxFees[0] = -nFees; @@ -839,7 +839,10 @@ void static BitcoinMiner() { if ( ASSETCHAINS_REWARD == 0 ) { - if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) + int minvoutsize = 1; + if ( ASSETCHAINS_STREAM != 0 ) + minvoutsize = 2; + if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == minvoutsize && Mining_height > ASSETCHAINS_MINHEIGHT ) { static uint32_t counter; if ( counter++ < 10 ) From dc92daa03cd4f7f45dea09d07b0e82da30686909 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 17:17:44 +0800 Subject: [PATCH 0236/4463] oops --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1535d5812..aedb6d3c2 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1562,7 +1562,7 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); ASSETCHAINS_STREAM = GetArg("-ac_stream",0); - if ( ASSETCHAINS_STREAM != 0 && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0) { + if ( ASSETCHAINS_STREAM != 0 && ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0 )) { printf("ASSETCHAINS_STREAM cannot be used with:\n ASSETCHAINS_COMMISSION \n ASSETCHAINS_ENDSUBSIDY\n ASSETCHAINS_REWARD\n ASSETCHAINS_HALVING\n ASSETCHAINS_DECAY\n ASSETCHAINS_PRIVATE\n"); exit(0); } From fb0f519301b7cb105b2087e7a4364b9eaaba5de5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 21:17:27 +0800 Subject: [PATCH 0237/4463] try to make miner spend p2pk utxo --- src/miner.cpp | 20 ++++++++++++++++++++ src/wallet/rpcwallet.cpp | 14 ++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 1c83c5a61..668c5127f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -493,6 +493,26 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) return(0); } } + else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) + { + CMutableTransaction txStream = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); + if ( komodo_notaryvin(txStream,ASSETCHAINS_OVERRIDE_PUBKEY33) > 0 ) + { + CAmount txfees = 10000; + pblock->vtx.push_back(txStream); + pblocktemplate->vTxFees.push_back(txfees); + pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStream)); + nFees += txfees; + pblocktemplate->vTxFees[0] = -nFees; + //*(uint64_t *)(&pblock->vtx[0].vout[0].nValue) += txfees; + //fprintf(stderr,"added notaryvin\n"); + } + else + { + fprintf(stderr,"error adding streamer vin, the chain broke! \n"); + return(0); + } + } else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) { CValidationState state; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 936c31fd9..6359dfca5 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -44,6 +44,8 @@ using namespace std; using namespace libzcash; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; +extern std::string ASSETCHAINS_OVERRIDE_PUBKEY; +extern int32_t ASSETCHAINS_STREAM; extern UniValue TxJoinSplitToJSON(const CTransaction& tx); extern uint8_t ASSETCHAINS_PRIVATE; uint32_t komodo_segid32(char *coinaddr); @@ -4606,8 +4608,16 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) // ((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i]; txNew.vin[0].prevout.hash = utxotxid; //revtxid; txNew.vin[0].prevout.n = utxovout; - txNew.vout[0].scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; - txNew.vout[0].nValue = utxovalue - txfee; + if ( ASSETCHAINS_STREAM != 0 ) + { + txNew.vout[0].scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; + txNew.vout[0].nValue = 0; + } + else + { + txNew.vout[0].scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; + txNew.vout[0].nValue = utxovalue - txfee; + } CTransaction txNewConst(txNew); signSuccess = ProduceSignature(TransactionSignatureCreator(&keystore, &txNewConst, 0, utxovalue, SIGHASH_ALL), best_scriptPubKey, sigdata, consensusBranchId); if (!signSuccess) From a11c10fdd215ac290fdfa73da31fa86a4604a163 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 21:39:54 +0800 Subject: [PATCH 0238/4463] send 0 value utxo to CRYPTO777 address instead of ac_pubkey --- src/wallet/rpcwallet.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6359dfca5..d352c89e4 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4610,14 +4610,13 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) txNew.vin[0].prevout.n = utxovout; if ( ASSETCHAINS_STREAM != 0 ) { - txNew.vout[0].scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; txNew.vout[0].nValue = 0; } else - { - txNew.vout[0].scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; + { txNew.vout[0].nValue = utxovalue - txfee; } + txNew.vout[0].scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; CTransaction txNewConst(txNew); signSuccess = ProduceSignature(TransactionSignatureCreator(&keystore, &txNewConst, 0, utxovalue, SIGHASH_ALL), best_scriptPubKey, sigdata, consensusBranchId); if (!signSuccess) From 1f5efd44aa827003cc84aca1625ecab67df4e6d8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:02:47 +0800 Subject: [PATCH 0239/4463] not a chance this will work? --- src/komodo_bitcoind.h | 15 +++++++++++++-- src/miner.cpp | 9 ++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 4051eb095..988a8251c 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1575,14 +1575,25 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } if ( failed == 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { - if ( height == 1 || ASSETCHAINS_STREAM != 0 ) + if ( height == 1 ) { script = (uint8_t *)pblock->vtx[0].vout[0].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { return(-1); } } - else + else if ( ASSETCHAINS_STREAM != 0 ) { + int lasttx = ( pblock->vtx.size() -1 ); + uint256 hash; CTransaction tx; CTxIn& txin; + txin = pblock->vtx[lasttx]; + if (GetTransaction(txin.prevout.hash,tx,hash,false)) + { + script = (uint8_t *)tx.vout[txin.prevout.n].scriptPubKey.data(); + if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { + return(-1); + } + } + } else { if ( komodo_checkcommission(pblock,height) < 0 ) return(-1); diff --git a/src/miner.cpp b/src/miner.cpp index 668c5127f..a36a33a17 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -626,10 +626,17 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,int32_t gpucount) { CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i; - if ( (nHeight == 1 || ASSETCHAINS_STREAM != 0 ) && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) + if ( nHeight == 1 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; } + else if ( ASSETCHAINS_STREAM != 0 ) + { + if ( nHeight < 128 ) + scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; + else + scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; + } else if ( USE_EXTERNAL_PUBKEY != 0 ) { //fprintf(stderr,"use notary pubkey\n"); From 3267a72a823709b4b985ef3f19f5bec734d174f7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:05:49 +0800 Subject: [PATCH 0240/4463] try again --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 988a8251c..37f2a4411 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1584,7 +1584,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } else if ( ASSETCHAINS_STREAM != 0 ) { int lasttx = ( pblock->vtx.size() -1 ); - uint256 hash; CTransaction tx; CTxIn& txin; + uint256 hash; CTransaction tx; CTransaction txin; txin = pblock->vtx[lasttx]; if (GetTransaction(txin.prevout.hash,tx,hash,false)) { From 2e587cdae3f3903b5c231803e141d58ff94e0451 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:07:55 +0800 Subject: [PATCH 0241/4463] again --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 37f2a4411..9b1b05930 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1584,7 +1584,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } else if ( ASSETCHAINS_STREAM != 0 ) { int lasttx = ( pblock->vtx.size() -1 ); - uint256 hash; CTransaction tx; CTransaction txin; + uint256 hash; CTransaction tx; CTxIn txin; txin = pblock->vtx[lasttx]; if (GetTransaction(txin.prevout.hash,tx,hash,false)) { From 45df365f804108d2caa1ed52a097f0504270d9f8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:11:21 +0800 Subject: [PATCH 0242/4463] again --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 9b1b05930..deffb6f8a 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1584,9 +1584,9 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } else if ( ASSETCHAINS_STREAM != 0 ) { int lasttx = ( pblock->vtx.size() -1 ); - uint256 hash; CTransaction tx; CTxIn txin; - txin = pblock->vtx[lasttx]; - if (GetTransaction(txin.prevout.hash,tx,hash,false)) + uint256 hash; CTransaction tx; + //txin = ; + if (GetTransaction(pblock->vtx[lasttx].vin[0].prevout.hash,tx,hash,false)) { script = (uint8_t *)tx.vout[txin.prevout.n].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { From 2448754cc934f86ee6d1a36ac3582ac8a84c932f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:13:34 +0800 Subject: [PATCH 0243/4463] again --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index deffb6f8a..b0df98356 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1588,7 +1588,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) //txin = ; if (GetTransaction(pblock->vtx[lasttx].vin[0].prevout.hash,tx,hash,false)) { - script = (uint8_t *)tx.vout[txin.prevout.n].scriptPubKey.data(); + script = (uint8_t *)tx.vout[pblock->vtx[lasttx].vin[0].prevout.n].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { return(-1); } From 0be6e9eec81100a282e72eece790f3107470f8be Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:18:37 +0800 Subject: [PATCH 0244/4463] add prints too see if its working --- src/komodo_bitcoind.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index b0df98356..aa6f848ef 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1585,11 +1585,13 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) else if ( ASSETCHAINS_STREAM != 0 ) { int lasttx = ( pblock->vtx.size() -1 ); uint256 hash; CTransaction tx; - //txin = ; + printf("ABOUT TO CHECK LAST TX: %d\n",lasttx); if (GetTransaction(pblock->vtx[lasttx].vin[0].prevout.hash,tx,hash,false)) { + printf("CHECKING THE script pubkey\n"); script = (uint8_t *)tx.vout[pblock->vtx[lasttx].vin[0].prevout.n].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { + printf("THE PUBKEY IS WRONG!\n"); return(-1); } } From 43b535c4c8335656abd66fd1f0a4441ef10236e3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:19:16 +0800 Subject: [PATCH 0245/4463] remove the actual return --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index aa6f848ef..61d86d0d6 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1592,7 +1592,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) script = (uint8_t *)tx.vout[pblock->vtx[lasttx].vin[0].prevout.n].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { printf("THE PUBKEY IS WRONG!\n"); - return(-1); + //return(-1); } } } else From 987bed370592604a81a261978d482b4f24451fb2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:31:17 +0800 Subject: [PATCH 0246/4463] enforce check add print if passed --- src/komodo_bitcoind.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 61d86d0d6..278bba0af 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1592,8 +1592,9 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) script = (uint8_t *)tx.vout[pblock->vtx[lasttx].vin[0].prevout.n].scriptPubKey.data(); if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { printf("THE PUBKEY IS WRONG!\n"); - //return(-1); + return(-1); } + printf("THE PUBKEY IS RIGHT! \n"); } } else { From d118b457b0aa06283a1c568deb6253366649b96e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 16 Oct 2018 23:47:48 +0800 Subject: [PATCH 0247/4463] temp disable adding last tx to test consensus rule --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index a36a33a17..42d2b209b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -493,7 +493,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) return(0); } } - else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) + /* else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) { CMutableTransaction txStream = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); if ( komodo_notaryvin(txStream,ASSETCHAINS_OVERRIDE_PUBKEY33) > 0 ) @@ -512,7 +512,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) fprintf(stderr,"error adding streamer vin, the chain broke! \n"); return(0); } - } + } */ else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) { CValidationState state; From a3b0c674155ea518b63b9e836b618bf69a85d6b2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 17 Oct 2018 00:13:38 +0800 Subject: [PATCH 0248/4463] fix miner, with extra TX --- src/miner.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 42d2b209b..44fb0ba27 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -493,7 +493,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) return(0); } } - /* else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) + else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) { CMutableTransaction txStream = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); if ( komodo_notaryvin(txStream,ASSETCHAINS_OVERRIDE_PUBKEY33) > 0 ) @@ -512,7 +512,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) fprintf(stderr,"error adding streamer vin, the chain broke! \n"); return(0); } - } */ + } else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) { CValidationState state; @@ -867,16 +867,18 @@ void static BitcoinMiner() if ( ASSETCHAINS_REWARD == 0 ) { int minvoutsize = 1; + int minvtxsize = 1; if ( ASSETCHAINS_STREAM != 0 ) minvoutsize = 2; - if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == minvoutsize && Mining_height > ASSETCHAINS_MINHEIGHT ) + minvtxsize = 2; + if ( pblock->vtx.size() == minvtxsize && pblock->vtx[0].vout.size() == minvoutsize && Mining_height > ASSETCHAINS_MINHEIGHT ) { static uint32_t counter; if ( counter++ < 10 ) fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); sleep(10); continue; - } else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); + } else fprintf(stderr,"%s tx.%d vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx.size(),(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); } } IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); From b6b33147b1d85e3b736035d25ac03e5dbdb16845 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 17 Oct 2018 00:31:57 +0800 Subject: [PATCH 0249/4463] change it, might be safter this way --- src/komodo_bitcoind.h | 16 ++++++++++------ src/wallet/rpcwallet.cpp | 9 +-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 278bba0af..ad8da74d4 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1582,10 +1582,18 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) return(-1); } } - else if ( ASSETCHAINS_STREAM != 0 ) { + else + { + if ( komodo_checkcommission(pblock,height) < 0 ) + return(-1); + } + if ( ASSETCHAINS_STREAM != 0 && height > 128 ) + { int lasttx = ( pblock->vtx.size() -1 ); - uint256 hash; CTransaction tx; printf("ABOUT TO CHECK LAST TX: %d\n",lasttx); + if ( lasttx == 0 ) + return(-1); + uint256 hash; CTransaction tx; if (GetTransaction(pblock->vtx[lasttx].vin[0].prevout.hash,tx,hash,false)) { printf("CHECKING THE script pubkey\n"); @@ -1596,10 +1604,6 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) } printf("THE PUBKEY IS RIGHT! \n"); } - } else - { - if ( komodo_checkcommission(pblock,height) < 0 ) - return(-1); } } //fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d352c89e4..0e9fc8e80 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4608,14 +4608,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) // ((uint8_t *)&revtxid)[i] = ((uint8_t *)&utxotxid)[31 - i]; txNew.vin[0].prevout.hash = utxotxid; //revtxid; txNew.vin[0].prevout.n = utxovout; - if ( ASSETCHAINS_STREAM != 0 ) - { - txNew.vout[0].nValue = 0; - } - else - { - txNew.vout[0].nValue = utxovalue - txfee; - } + txNew.vout[0].nValue = utxovalue - txfee; txNew.vout[0].scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; CTransaction txNewConst(txNew); signSuccess = ProduceSignature(TransactionSignatureCreator(&keystore, &txNewConst, 0, utxovalue, SIGHASH_ALL), best_scriptPubKey, sigdata, consensusBranchId); From af7ee589436c5050266573867bd3dc70ea4ff376 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 17 Oct 2018 09:58:42 +0800 Subject: [PATCH 0250/4463] disable miner TX to test again --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 44fb0ba27..3f3175e2a 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -492,7 +492,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n"); return(0); } - } + } /* else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) { CMutableTransaction txStream = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); @@ -512,7 +512,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) fprintf(stderr,"error adding streamer vin, the chain broke! \n"); return(0); } - } + } */ else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) { CValidationState state; From 4da719819f298b4ff6f99632d200f38415d5e099 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 17 Oct 2018 10:57:19 +0800 Subject: [PATCH 0251/4463] disable need for extra TX under 128 blocks --- src/miner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 3f3175e2a..4af7383c3 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -492,8 +492,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n"); return(0); } - } /* - else if (( ASSETCHAINS_STREAM != 0 ) && ( ASSETCHAINS_SYMBOL[0] != 0 )) + } + else if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SYMBOL[0] != 0 && nHeight > 128 ) { CMutableTransaction txStream = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); if ( komodo_notaryvin(txStream,ASSETCHAINS_OVERRIDE_PUBKEY33) > 0 ) @@ -512,7 +512,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) fprintf(stderr,"error adding streamer vin, the chain broke! \n"); return(0); } - } */ + } else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) { CValidationState state; From 167047c7d975c17bf8913aae0572d3913e7ce7e3 Mon Sep 17 00:00:00 2001 From: Asher Dawes Date: Thu, 18 Oct 2018 01:09:03 -0700 Subject: [PATCH 0252/4463] Introducing gitlab-ci configuration for komodo builds. Modifying makeRelease.sh to add additional dynamic libraries to the mac artifact package to support MacOS Sierra systems. --- .gitlab-ci.yml | 162 +++++++++++++++++++++++++++++++++++++++++++++++++ makeRelease.sh | 65 +++++++++++++++++--- 2 files changed, 218 insertions(+), 9 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..6f867ad6b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,162 @@ +stages: +- build +- test +######################################################################################################################## +####START#### PROJECT LEVEL VARIABLES ####START#### +######################################################################################################################## +variables: + PACKAGE_DIR_LINUX: linux64 + PACKAGE_DIR_WINDOWS: win64 + PACKAGE_DIR_MACOS: macos + AGAMA_ARTIFACTS_LINUX: ${PACKAGE_DIR_LINUX}.tar.gz + AGAMA_ARTIFACTS_WINDOWS: ${PACKAGE_DIR_WINDOWS}.zip + AGAMA_ARTIFACTS_MACOS: ${PACKAGE_DIR_MACOS}.tar.gz + AGAMA_ARTIFACTS_LINUX_CHECKSUM: ${AGAMA_ARTIFACTS_LINUX}.md5 + AGAMA_ARTIFACTS_WINDOWS_CHECKSUM: ${AGAMA_ARTIFACTS_WINDOWS}.md5 + AGAMA_ARTIFACTS_MACOS_CHECKSUM: ${AGAMA_ARTIFACTS_MACOS}.md5 + ARTIFACT_EXPIRATION: 1 week +######################################################################################################################## +####END#### PROJECT LEVEL VARIABLES ####END#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####START#### Build Stage: compile and package komodo binaries for the Agama Wallet. ####START##### +######################################################################################################################## +######################################################################################################################## +####START#### LINUX ####START#### +######################################################################################################################## +build:ubuntu: + stage: build + image: asherd/komodo-builders:komodo-ubuntu + variables: + DOCKER_DRIVER: overlay2 + cache: + key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}" + paths: + - depends/built + script: + - zcutil/build.sh -j$(nproc) + - mkdir ${PACKAGE_DIR_LINUX} + - cp src/komodod + src/komodo-cli + ${PACKAGE_DIR_LINUX} + - chmod +x ${PACKAGE_DIR_LINUX}/komodod + - chmod +x ${PACKAGE_DIR_LINUX}/komodo-cli + - tar -czvf ${AGAMA_ARTIFACTS_LINUX} ${PACKAGE_DIR_LINUX} + - md5sum ${AGAMA_ARTIFACTS_LINUX} > ${AGAMA_ARTIFACTS_LINUX_CHECKSUM} + artifacts: + paths: + - ${AGAMA_ARTIFACTS_LINUX} + - ${AGAMA_ARTIFACTS_LINUX_CHECKSUM} + expire_in: ${ARTIFACT_EXPIRATION} +######################################################################################################################## +####END#### LINUX ####END#### +######################################################################################################################## +####START#### WINDOWS ####START#### +######################################################################################################################## +build:windows: + stage: build + image: asherd/komodo-builders:komodo-windows + variables: + DOCKER_DRIVER: overlay2 + cache: + key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}" + paths: + - depends/built + script: + - zcutil/build-win.sh -j$(nproc) + - mkdir ${PACKAGE_DIR_WINDOWS}. + - cp src/komodod.exe + src/komodo-cli.exe + src/komodo-tx.exe + ${PACKAGE_DIR_WINDOWS} + - zip -r ${PACKAGE_DIR_WINDOWS} + - md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} + artifacts: + paths: + - ${AGAMA_ARTIFACTS_WINDOWS} + - ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} + expire_in: ${ARTIFACT_EXPIRATION} +######################################################################################################################## +####END#### WINDOWS ####END#### +######################################################################################################################## +####START#### MACOS ####START#### +######################################################################################################################## +build:macos: + stage: build + tags: ["High Sierra"] + cache: + key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}" + paths: + - depends/built + script: + - zcutil/build-mac.sh -j$(sysctl -n hw.physicalcpu) + - ./makeRelease.sh ${PACKAGE_DIR_MACOS} + - tar -czvf ${AGAMA_ARTIFACTS_MACOS} ${PACKAGE_DIR_MACOS} + - md5sum ${AGAMA_ARTIFACTS_MACOS} > ${AGAMA_ARTIFACTS_MACOS_CHECKSUM} + artifacts: + paths: + - ${AGAMA_ARTIFACTS_MACOS} + - ${AGAMA_ARTIFACTS_MACOS_CHECKSUM} + expire_in: ${ARTIFACT_EXPIRATION} +######################################################################################################################## +####END#### MACOS ####END#### +######################################################################################################################## +######################################################################################################################## +####END#### Build Stage ####END#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####START#### Test stage: Produce code quality and static application security test reports. ####START#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####START#### Code Quality ####START#### +######################################################################################################################## +code_quality: + image: docker:stable + variables: + DOCKER_DRIVER: overlay2 + allow_failure: true + services: + - docker:stable-dind + script: + - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + - docker run + --env SOURCE_CODE="$PWD" + --volume "$PWD":/code + --volume /var/run/docker.sock:/var/run/docker.sock + "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code + artifacts: + paths: [gl-code-quality-report.json] +######################################################################################################################## +####END#### Code Quality ####END#### +######################################################################################################################## +######################################################################################################################## +####START#### Static Application Security Tests ####START#### +######################################################################################################################## +sast: + image: docker:stable + variables: + DOCKER_DRIVER: overlay2 + allow_failure: true + services: + - docker:stable-dind + script: + - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + - docker run + --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" + --volume "$PWD:/code" + --volume /var/run/docker.sock:/var/run/docker.sock + "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code + artifacts: + paths: [gl-sast-report.json] +######################################################################################################################## +####END#### Static Application Security Tests ####END#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####END#### Test stage ####END#### +######################################################################################################################## +######################################################################################################################## \ No newline at end of file diff --git a/makeRelease.sh b/makeRelease.sh index 5d68f0b03..e20df75aa 100755 --- a/makeRelease.sh +++ b/makeRelease.sh @@ -1,17 +1,64 @@ #!/bin/sh +PACKAGE_DIR="$@" +mkdir ${PACKAGE_DIR} + binaries=("komodo-cli" "komodod") +alllibs=() +for binary in "${binaries[@]}"; +do + # do the work in the destination directory + cp src/${binary} ${PACKAGE_DIR} + # find the dylibs to copy for komodod + DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'` + echo "copying ${DYLIBS} to ${PACKAGE_DIR}" + # copy the dylibs to the srcdir + for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; done +done + +libraries=("libgcc_s.1.dylib" "libgomp.1.dylib" "libidn2.0.dylib" "libstdc++.6.dylib") + +for binary in "${libraries[@]}"; +do + # find the dylibs to copy for komodod + DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'` + echo "copying ${DYLIBS} to ${PACKAGE_DIR}" + # copy the dylibs to the srcdir + for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; alllibs+=(${dylib}); done +done + +indirectlibraries=("libintl.8.dylib" "libunistring.2.dylib") + +for binary in "${indirectlibraries[@]}"; +do + # Need to undo this for the dylibs when we are done + chmod 755 src/${binary} + # find the dylibs to copy for komodod + DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'` + echo "copying indirect ${DYLIBS} to ${PACKAGE_DIR}" + # copy the dylibs to the dest dir + for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; alllibs+=(${dylib}); done +done for binary in "${binaries[@]}"; do - # find the dylibs to copy for komodod - DYLIBS=`otool -L src/$binary | grep "/usr/local" | awk -F' ' '{ print $1 }'` - echo "copying $DYLIBS to $src" - # copy the dylibs to the srcdir - for dylib in $DYLIBS; do cp -rf $dylib src/; done - # modify komodod to point to dylibs - echo "modifying $binary to use local libraries" - for dylib in $DYLIBS; do install_name_tool -change $dylib @executable_path/`basename $dylib` src/$binary; done; - chmod +x src/$binary + echo "modifying ${binary} to use local libraries" + for dylib in "${alllibs[@]}" + do + echo "Next lib is ${dylib} " + install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${PACKAGE_DIR}/${binary} + done + chmod +x ${PACKAGE_DIR}/${binary} +done + +for binary in "${libraries[@]}"; +do + # modify libraries to point to dylibs + echo "modifying ${binary} to use local libraries" + for dylib in "${alllibs[@]}" + do + echo "Next lib is ${dylib} " + install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${PACKAGE_DIR}/${binary} + done done From 3448cd83bbcf3ebe995ba83aadcf0a426a50d9c1 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Fri, 19 Oct 2018 23:03:20 +0200 Subject: [PATCH 0253/4463] comment out spamming print --- src/cc/oracles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 7cccad0f6..0c7d9e6e2 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -666,7 +666,7 @@ int64_t AddOracleInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPub std::vector > unspentOutputs; GetCCaddress(cp,coinaddr,pk); SetCCunspents(unspentOutputs,coinaddr); - fprintf(stderr,"addoracleinputs from (%s)\n",coinaddr); + //fprintf(stderr,"addoracleinputs from (%s)\n",coinaddr); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash; From 5418cd4ad7b7d35e7d2f46c14c0b9983960f0dd9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 22 Oct 2018 17:11:27 +0800 Subject: [PATCH 0254/4463] disaable longestchain check in miner under 128 blocks --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 4af7383c3..7ebf9bc27 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -957,7 +957,7 @@ void static BitcoinMiner() } while (true) { - if ( KOMODO_INSYNC == 0 ) + if ( KOMODO_INSYNC == 0 && Mining_height > ASSETCHAINS_MINHEIGHT ) { fprintf(stderr,"Mining when blockchain might not be in sync longest.%d vs %d\n",KOMODO_LONGESTCHAIN,Mining_height); if ( KOMODO_LONGESTCHAIN != 0 && Mining_height >= KOMODO_LONGESTCHAIN ) From 62c220a9c2c603dbefbf92bb44f0ea4c8b50d8a4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 22 Oct 2018 22:16:16 +0800 Subject: [PATCH 0255/4463] remove insync check all together, slowing it down too much --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 7ebf9bc27..2e26cf6cd 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -957,13 +957,13 @@ void static BitcoinMiner() } while (true) { - if ( KOMODO_INSYNC == 0 && Mining_height > ASSETCHAINS_MINHEIGHT ) + /*if ( KOMODO_INSYNC == 0 && Mining_height > ASSETCHAINS_MINHEIGHT ) { fprintf(stderr,"Mining when blockchain might not be in sync longest.%d vs %d\n",KOMODO_LONGESTCHAIN,Mining_height); if ( KOMODO_LONGESTCHAIN != 0 && Mining_height >= KOMODO_LONGESTCHAIN ) KOMODO_INSYNC = 1; sleep(3); - } + } */ // Hash state KOMODO_CHOSEN_ONE = 0; crypto_generichash_blake2b_state state; From 0aa4f46cccfb3c0f066b7134eec5c439b16df32f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 23 Oct 2018 23:29:49 +0800 Subject: [PATCH 0256/4463] add getblockdata RPC --- src/rpcblockchain.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++- src/rpcserver.cpp | 25 +++++++------- src/rpcserver.h | 1 + 3 files changed, 89 insertions(+), 13 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e9cf54bb4..ccbf4a6dd 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,6 +257,80 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } +UniValue getdatafromblock(const UniValue& params, bool fHelp) +{ + if (fHelp || params.size() < 1 || params.size() > 2) + throw runtime_error( + "getdatafromblock \"hash|height\"\n" + "\nReturns all the data sent via streamer in block if there was any data in it.\n" + "\nArguments:\n" + "1. \"hash|height\" (string, required) The block hash or height\n" + "\nResult (for verbose=false):\n" + "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n" + "\nExamples:\n" + + HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + + HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + + HelpExampleCli("getblock", "12800") + + HelpExampleRpc("getblock", "12800") + ); + + LOCK(cs_main); + + std::string strHash = params[0].get_str(); + + // If height is supplied, find the hash + if (strHash.size() < (2 * sizeof(uint256))) { + // std::stoi allows characters, whereas we want to be strict + regex r("[[:digit:]]+"); + if (!regex_match(strHash, r)) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block height parameter"); + } + + int nHeight = -1; + try { + nHeight = std::stoi(strHash); + } + catch (const std::exception &e) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block height parameter"); + } + + if (nHeight < 0 || nHeight > chainActive.Height()) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); + } + strHash = chainActive[nHeight]->GetBlockHash().GetHex(); + } + + uint256 hash(uint256S(strHash)); + + if (mapBlockIndex.count(hash) == 0) + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); + + CBlock block; + CBlockIndex* pblockindex = mapBlockIndex[hash]; + + if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0) + throw JSONRPCError(RPC_INTERNAL_ERROR, "Block not available (pruned data)"); + + if(!ReadBlockFromDisk(block, pblockindex,1)) + throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); + + BOOST_FOREACH(const CTransaction&tx, block.vtx) + { + fprintf(stderr, "%s\n",tx.GetHash().GetHex()); + } + return chainActive.Height(); + /* + UniValue result(UniValue::VOBJ); + UniValue txs(UniValue::VARR); + BOOST_FOREACH(const CTransaction&tx, block.vtx) + { + txs.push_back(tx.GetHash().GetHex()); + } + result.push_back(Pair("tx", txs)); + return result; + */ +} + UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) { UniValue result(UniValue::VOBJ); @@ -816,7 +890,7 @@ UniValue kvsearch(const UniValue& params, bool fHelp) " \"currentheight\": xxxxx, (numeric) current height of the chain\n" " \"key\": \"xxxxx\", (string) key\n" " \"keylen\": xxxxx, (string) length of the key \n" - " \"owner\": \"xxxxx\" (string) hex string representing the owner of the key \n" + " \"owner\": \"xxxxx\" (string) hex string representing the owner of the key \n" " \"height\": xxxxx, (numeric) height the key was stored at\n" " \"expiration\": xxxxx, (numeric) height the key will expire\n" " \"flags\": x (numeric) 1 if the key was created with a password; 0 otherwise.\n" diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 7d2eab1e3..b23dbc826 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -285,6 +285,7 @@ static const CRPCCommand vRPCCommands[] = { "blockchain", "getbestblockhash", &getbestblockhash, true }, { "blockchain", "getblockcount", &getblockcount, true }, { "blockchain", "getblock", &getblock, true }, + { "blockchain", "getdatafromblock", &getdatafromblock, true }, { "blockchain", "getblockdeltas", &getblockdeltas, false }, { "blockchain", "getblockhashes", &getblockhashes, true }, { "blockchain", "getblockhash", &getblockhash, true }, @@ -350,16 +351,16 @@ static const CRPCCommand vRPCCommands[] = #endif /* auction */ { "auction", "auctionaddress", &auctionaddress, true }, - + /* lotto */ { "lotto", "lottoaddress", &lottoaddress, true }, - + /* fsm */ { "FSM", "FSMaddress", &FSMaddress, true }, { "FSM", "FSMcreate", &FSMcreate, true }, { "FSM", "FSMlist", &FSMlist, true }, { "FSM", "FSMinfo", &FSMinfo, true }, - + /* rewards */ { "rewards", "rewardslist", &rewardslist, true }, { "rewards", "rewardsinfo", &rewardsinfo, true }, @@ -368,16 +369,16 @@ static const CRPCCommand vRPCCommands[] = { "rewards", "rewardslock", &rewardslock, true }, { "rewards", "rewardsunlock", &rewardsunlock, true }, { "rewards", "rewardsaddress", &rewardsaddress, true }, - + /* faucet */ { "faucet", "faucetinfo", &faucetinfo, true }, { "faucet", "faucetfund", &faucetfund, true }, { "faucet", "faucetget", &faucetget, true }, { "faucet", "faucetaddress", &faucetaddress, true }, - + /* MofN */ { "MofN", "mofnaddress", &mofnaddress, true }, - + /* Channels */ { "channels", "channelsaddress", &channelsaddress, true }, { "channels", "channelsinfo", &channelsinfo, true }, @@ -385,7 +386,7 @@ static const CRPCCommand vRPCCommands[] = { "channels", "channelspayment", &channelspayment, true }, { "channels", "channelsclose", &channelsclose, true }, { "channels", "channelsrefund", &channelsrefund, true }, - + /* Oracles */ { "oracles", "oraclesaddress", &oraclesaddress, true }, { "oracles", "oracleslist", &oracleslist, true }, @@ -395,7 +396,7 @@ static const CRPCCommand vRPCCommands[] = { "oracles", "oraclessubscribe", &oraclessubscribe, true }, { "oracles", "oraclesdata", &oraclesdata, true }, { "oracles", "oraclessamples", &oraclessamples, true }, - + /* Prices */ { "prices", "pricesaddress", &pricesaddress, true }, { "prices", "priceslist", &priceslist, true }, @@ -405,16 +406,16 @@ static const CRPCCommand vRPCCommands[] = { "prices", "pricesbet", &pricesbet, true }, { "prices", "pricesstatus", &pricesstatus, true }, { "prices", "pricesfinish", &pricesfinish, true }, - + /* Pegs */ { "pegs", "pegsaddress", &pegsaddress, true }, - + /* Triggers */ { "triggers", "triggersaddress", &triggersaddress, true }, - + /* Payments */ { "payments", "paymentsaddress", &paymentsaddress, true }, - + /* Gateways */ { "gateways", "gatewaysaddress", &gatewaysaddress, true }, { "gateways", "gatewayslist", &gatewayslist, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index a78f1b6fc..d2194db4f 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -363,6 +363,7 @@ extern UniValue getblockdeltas(const UniValue& params, bool fHelp); extern UniValue getblockhash(const UniValue& params, bool fHelp); extern UniValue getblockheader(const UniValue& params, bool fHelp); extern UniValue getblock(const UniValue& params, bool fHelp); +extern UniValue getdatafromblock(const UniValue& params, bool fHelp); extern UniValue gettxoutsetinfo(const UniValue& params, bool fHelp); extern UniValue gettxout(const UniValue& params, bool fHelp); extern UniValue verifychain(const UniValue& params, bool fHelp); From 10fbb81f2992e43e41b04b6c844d8b6aadb7ac52 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 23 Oct 2018 23:31:29 +0800 Subject: [PATCH 0257/4463] cstr --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index ccbf4a6dd..13d6d2ad9 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -316,7 +316,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) BOOST_FOREACH(const CTransaction&tx, block.vtx) { - fprintf(stderr, "%s\n",tx.GetHash().GetHex()); + fprintf(stderr, "%s\n",tx.GetHash().GetHex().cstr()); } return chainActive.Height(); /* From 4b6c433e49c7a878b4c9d8d321f118c606def0b4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 23 Oct 2018 23:34:37 +0800 Subject: [PATCH 0258/4463] try --- src/rpcblockchain.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 13d6d2ad9..a92da3b7c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -314,21 +314,22 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if(!ReadBlockFromDisk(block, pblockindex,1)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); - BOOST_FOREACH(const CTransaction&tx, block.vtx) + /*BOOST_FOREACH(const CTransaction&tx, block.vtx) { fprintf(stderr, "%s\n",tx.GetHash().GetHex().cstr()); } return chainActive.Height(); - /* + */ UniValue result(UniValue::VOBJ); UniValue txs(UniValue::VARR); BOOST_FOREACH(const CTransaction&tx, block.vtx) { - txs.push_back(tx.GetHash().GetHex()); + UniValue objTx(UniValue::VOBJ); + TxToJSON(tx, uint256(), objTx); + txs.push_back(objTx); } result.push_back(Pair("tx", txs)); return result; - */ } UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) From bbcfc72a6874b53e99e3fc7ca6c878c6223121ca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:02:23 +0800 Subject: [PATCH 0259/4463] try --- src/rpcblockchain.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a92da3b7c..9d842c0e4 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -325,11 +325,23 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) BOOST_FOREACH(const CTransaction&tx, block.vtx) { UniValue objTx(UniValue::VOBJ); - TxToJSON(tx, uint256(), objTx); + voutToJSON(tx, uint256(), objTx); txs.push_back(objTx); } result.push_back(Pair("tx", txs)); - return result; + return true; +} + +void voutToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) +{ + UniValue vout(UniValue::VARR); + for (unsigned int i = 0; i < tx.vout.size(); i++) { + const CTxOut& txout = tx.vout[i]; + UniValue out(UniValue::VOBJ); + out.push_back(Pair("hex", HexStr(txout.scriptPubKey.begin(), txout.scriptPubKey.end()))); + vout.push_back(out); + } + entry.push_back(Pair("vout", vout)); } UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) From f376020ee67c2723dcba352bf6a86f4179e7d03e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:04:04 +0800 Subject: [PATCH 0260/4463] fix --- src/rpcblockchain.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 9d842c0e4..f49902afc 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,6 +257,18 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } +void voutToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) +{ + UniValue vout(UniValue::VARR); + for (unsigned int i = 0; i < tx.vout.size(); i++) { + const CTxOut& txout = tx.vout[i]; + UniValue out(UniValue::VOBJ); + out.push_back(Pair("hex", HexStr(txout.scriptPubKey.begin(), txout.scriptPubKey.end()))); + vout.push_back(out); + } + entry.push_back(Pair("vout", vout)); +} + UniValue getdatafromblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) @@ -332,18 +344,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return true; } -void voutToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) -{ - UniValue vout(UniValue::VARR); - for (unsigned int i = 0; i < tx.vout.size(); i++) { - const CTxOut& txout = tx.vout[i]; - UniValue out(UniValue::VOBJ); - out.push_back(Pair("hex", HexStr(txout.scriptPubKey.begin(), txout.scriptPubKey.end()))); - vout.push_back(out); - } - entry.push_back(Pair("vout", vout)); -} - UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) { UniValue result(UniValue::VOBJ); From f9bc9ee1e450e984c55b465d8550fb4cf06af276 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:05:28 +0800 Subject: [PATCH 0261/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f49902afc..95ae2d1dd 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -341,7 +341,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) txs.push_back(objTx); } result.push_back(Pair("tx", txs)); - return true; + return result; } UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) From 5143ef0c76287ebe10c5689375682cda0bfd5f3b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:11:06 +0800 Subject: [PATCH 0262/4463] try --- src/rpcblockchain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 95ae2d1dd..fd520122b 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -334,11 +334,16 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) */ UniValue result(UniValue::VOBJ); UniValue txs(UniValue::VARR); + unsigned int i = 0; BOOST_FOREACH(const CTransaction&tx, block.vtx) { + if ( i != 0 || i != block.vxt.size() ) + { UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); txs.push_back(objTx); + i = i + 1; + } } result.push_back(Pair("tx", txs)); return result; From b93f04b2bd2c6c29fc6be5bb6f8d16d1c8ea319e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:12:14 +0800 Subject: [PATCH 0263/4463] xt --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index fd520122b..9bfc8c696 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -337,7 +337,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) unsigned int i = 0; BOOST_FOREACH(const CTransaction&tx, block.vtx) { - if ( i != 0 || i != block.vxt.size() ) + if ( i != 0 || i != block.vtx.size() ) { UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); From c540920d85329997400e6a18c066f09122072554 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:14:33 +0800 Subject: [PATCH 0264/4463] again --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 9bfc8c696..25853bc5b 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -337,7 +337,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) unsigned int i = 0; BOOST_FOREACH(const CTransaction&tx, block.vtx) { - if ( i != 0 || i != block.vtx.size() ) + if ( i != 0 || i != (block.vtx.size() -1) ) { UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); From f0d9eab81c29a55d8c763c44d058b3b1b239253f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:18:03 +0800 Subject: [PATCH 0265/4463] prints --- src/rpcblockchain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 25853bc5b..00db32085 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -335,8 +335,10 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) UniValue result(UniValue::VOBJ); UniValue txs(UniValue::VARR); unsigned int i = 0; + fprintf(stderr, "%d\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { + fprintf(stderr, "tx number: %d \n",i); if ( i != 0 || i != (block.vtx.size() -1) ) { UniValue objTx(UniValue::VOBJ); From 10a51db52fba6f11d52ec2ebf1290b2661abe062 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:19:24 +0800 Subject: [PATCH 0266/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 00db32085..97339ef82 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -335,7 +335,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) UniValue result(UniValue::VOBJ); UniValue txs(UniValue::VARR); unsigned int i = 0; - fprintf(stderr, "%d\n", block.vtx.size()); + fprintf(stderr, "%ld\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { fprintf(stderr, "tx number: %d \n",i); From 65453a89387c04e0f62b31394d77b3b717920b49 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:22:44 +0800 Subject: [PATCH 0267/4463] t --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 97339ef82..3d1ea7e90 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -338,9 +338,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) fprintf(stderr, "%ld\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { - fprintf(stderr, "tx number: %d \n",i); if ( i != 0 || i != (block.vtx.size() -1) ) { + fprintf(stderr, "tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); txs.push_back(objTx); From 9408ce62bd1bea34947bd1cc6b642c736203905b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:27:04 +0800 Subject: [PATCH 0268/4463] wtf --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 3d1ea7e90..00d18c4ba 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -338,14 +338,14 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) fprintf(stderr, "%ld\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { - if ( i != 0 || i != (block.vtx.size() -1) ) + if ( (i === 0) || (i == (block.vtx.size() -1)) ) { fprintf(stderr, "tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); txs.push_back(objTx); - i = i + 1; } + i = i + 1; } result.push_back(Pair("tx", txs)); return result; From b6a0c1d55ab2ca187b9cefef6d593b82cd9a8646 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:28:12 +0800 Subject: [PATCH 0269/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 00d18c4ba..a674dba2d 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -338,7 +338,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) fprintf(stderr, "%ld\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { - if ( (i === 0) || (i == (block.vtx.size() -1)) ) + if ( (i == 0) || (i == (block.vtx.size() -1)) ) { fprintf(stderr, "tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); From c465fbf0d3358425d8aac17289f58cdf9450297f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:30:58 +0800 Subject: [PATCH 0270/4463] fix --- src/rpcblockchain.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a674dba2d..ad36e2818 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -333,17 +333,16 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VOBJ); - UniValue txs(UniValue::VARR); unsigned int i = 0; - fprintf(stderr, "%ld\n", block.vtx.size()); + fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { - if ( (i == 0) || (i == (block.vtx.size() -1)) ) + if ( (i != 0) || (i != (block.vtx.size() -1)) ) { fprintf(stderr, "tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); - txs.push_back(objTx); + result.push_back(objTx); } i = i + 1; } From dc9e877b656b65a298af434fbc858efd759437ee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:32:09 +0800 Subject: [PATCH 0271/4463] fix --- src/rpcblockchain.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index ad36e2818..afc0159ba 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -346,7 +346,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } i = i + 1; } - result.push_back(Pair("tx", txs)); return result; } From 85fecb9f761cc579c88b9f7022244bc43521622d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:36:38 +0800 Subject: [PATCH 0272/4463] fix? --- src/rpcblockchain.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index afc0159ba..8ed47c140 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -332,14 +332,16 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } return chainActive.Height(); */ - UniValue result(UniValue::VOBJ); + UniValue result(UniValue::VARR); unsigned int i = 0; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); BOOST_FOREACH(const CTransaction&tx, block.vtx) { - if ( (i != 0) || (i != (block.vtx.size() -1)) ) + if ( (i == 0) || (i == (block.vtx.size() -1)) ) { - fprintf(stderr, "tx number: %d \n",i); + fprintf(stderr, "skipped tx number: %d \n",i); + } else { + fprintf(stderr, "added tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); voutToJSON(tx, uint256(), objTx); result.push_back(objTx); From 5a363fdffcf612133e218ea3f37b665fd61f03f1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 00:41:36 +0800 Subject: [PATCH 0273/4463] maybe --- src/rpcblockchain.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 8ed47c140..e54ff8fb8 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -343,7 +343,10 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else { fprintf(stderr, "added tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); - voutToJSON(tx, uint256(), objTx); + //voutToJSON(tx, uint256(), objTx); + //const CTxOut& txout = tx.vout[i]; + //UniValue out(UniValue::VOBJ); + objTx.push_back(Pair("hex", HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()))); result.push_back(objTx); } i = i + 1; From c4ee47ec3651ec29ce2a5da50ad0cbb21cee8990 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 12:12:18 +0800 Subject: [PATCH 0274/4463] add rpc to return pubkey --- src/rpcblockchain.cpp | 20 +++++--------------- src/rpcserver.cpp | 1 + src/rpcserver.h | 1 + src/wallet/rpcwallet.cpp | 29 +++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e54ff8fb8..5499ca742 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,18 +257,6 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } -void voutToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) -{ - UniValue vout(UniValue::VARR); - for (unsigned int i = 0; i < tx.vout.size(); i++) { - const CTxOut& txout = tx.vout[i]; - UniValue out(UniValue::VOBJ); - out.push_back(Pair("hex", HexStr(txout.scriptPubKey.begin(), txout.scriptPubKey.end()))); - vout.push_back(out); - } - entry.push_back(Pair("vout", vout)); -} - UniValue getdatafromblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) @@ -335,18 +323,20 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) UniValue result(UniValue::VARR); unsigned int i = 0; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); + // Iif block tx size is > 2 then we can do this BOOST_FOREACH(const CTransaction&tx, block.vtx) { + //if the vout size = 3 then its a valid TX get the data. dont use the test here! it wont work with notarisations! if ( (i == 0) || (i == (block.vtx.size() -1)) ) { fprintf(stderr, "skipped tx number: %d \n",i); } else { fprintf(stderr, "added tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); - //voutToJSON(tx, uint256(), objTx); - //const CTxOut& txout = tx.vout[i]; - //UniValue out(UniValue::VOBJ); + objTx.push_back(Pair("hex", HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()))); + // function here to extract seqid from first and last TX + // we an push the data or not depending on input from RPC. result.push_back(objTx); } i = i + 1; diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index b23dbc826..15f31d8ef 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -264,6 +264,7 @@ static const CRPCCommand vRPCCommands[] = { "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */ { "control", "help", &help, true }, { "control", "stop", &stop, true }, + { "control", "getpubkey", &getpubkey, true }, /* P2P networking */ { "network", "getnetworkinfo", &getnetworkinfo, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index d2194db4f..658102af0 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -322,6 +322,7 @@ extern UniValue walletlock(const UniValue& params, bool fHelp); extern UniValue encryptwallet(const UniValue& params, bool fHelp); extern UniValue validateaddress(const UniValue& params, bool fHelp); extern UniValue getinfo(const UniValue& params, bool fHelp); +extern UniValue getpubkey(const UniValue& params, bool fHelp); extern UniValue getwalletinfo(const UniValue& params, bool fHelp); extern UniValue getblockchaininfo(const UniValue& params, bool fHelp); extern UniValue getnetworkinfo(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 0e9fc8e80..e075a0d8b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4953,6 +4953,35 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) return(result); } +UniValue getpubkey(const UniValue& params, bool fHelp) +{ + UniValue result(UniValue::VOBJ); + if (fHelp || params.size() > 0) + throw runtime_error( + "getpubkey\n" + "\nReturns the -pubkey the daemon was started with.\n" + "\nResult:\n" + "[\n" + " {\n" + " \"pubkey\" : \"pubkey\", (string) The pubkey\n" + " }\n" + "]\n" + "\nExamples:\n" + "\nList pubkey.\n" + + HelpExampleCli("getpubkey", "") + + HelpExampleRpc("getpubkey", "") + ); + + extern uint8_t NOTARY_PUBKEY33[]; + extern std::string NOTARY_PUBKEY; + if ( NOTARY_PUBKEY33[0] == 0 ) { + result.push_back(Pair("error","pubkey was not set!"; + } else { + result.push_back(Pair("pubkey", NOTARY_PUBKEY); + } + return result; +} + UniValue oraclesaddress(const UniValue& params, bool fHelp) { struct CCcontract_info *cp,C; std::vector pubkey; From fac14d5dc4abd1c47f031596d15b2798445f14d6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 12:16:36 +0800 Subject: [PATCH 0275/4463] add pubkey to getinfo for all pubkeys, not just notary --- src/rpcmisc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index a42afbb61..a1d576d58 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -64,6 +64,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; + extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; if (fHelp || params.size() != 0) throw runtime_error( "getinfo\n" @@ -158,6 +159,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("pubkey", pubkeystr)); if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); + } else if ( NOTARY_PUBKEY33[0] != 0 ) { + obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } } if ( ASSETCHAINS_CC != 0 ) From 9920c80bde876e8b598b13ec4c3bde9c81ae801b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 12:49:12 +0800 Subject: [PATCH 0276/4463] add pubkey output to getinfo, and try setpubkey RPC --- src/rpcmisc.cpp | 3 +++ src/rpcserver.cpp | 2 +- src/rpcserver.h | 2 +- src/wallet/rpcwallet.cpp | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index a42afbb61..f104899e1 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -64,6 +64,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; + extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; if (fHelp || params.size() != 0) throw runtime_error( "getinfo\n" @@ -158,6 +159,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("pubkey", pubkeystr)); if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); + } else if ( NOTARY_PUBKEY33[0] != 0 ) { + obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } } if ( ASSETCHAINS_CC != 0 ) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 15f31d8ef..1b590c5ae 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -264,7 +264,7 @@ static const CRPCCommand vRPCCommands[] = { "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */ { "control", "help", &help, true }, { "control", "stop", &stop, true }, - { "control", "getpubkey", &getpubkey, true }, + { "control", "setpubkey", &setpubkey, true }, /* P2P networking */ { "network", "getnetworkinfo", &getnetworkinfo, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 658102af0..81ca8a8b9 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -322,7 +322,7 @@ extern UniValue walletlock(const UniValue& params, bool fHelp); extern UniValue encryptwallet(const UniValue& params, bool fHelp); extern UniValue validateaddress(const UniValue& params, bool fHelp); extern UniValue getinfo(const UniValue& params, bool fHelp); -extern UniValue getpubkey(const UniValue& params, bool fHelp); +extern UniValue setpubkey(const UniValue& params, bool fHelp); extern UniValue getwalletinfo(const UniValue& params, bool fHelp); extern UniValue getblockchaininfo(const UniValue& params, bool fHelp); extern UniValue getnetworkinfo(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e075a0d8b..acbe165c2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4953,13 +4953,13 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) return(result); } -UniValue getpubkey(const UniValue& params, bool fHelp) +UniValue setpubkey(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); - if (fHelp || params.size() > 0) + if ( fHelp || params.size() != 1 ) throw runtime_error( - "getpubkey\n" - "\nReturns the -pubkey the daemon was started with.\n" + "setpubkey\n" + "\Sets the -pubkey if the daemon was not started with it, if it was started, it returns the pubkey.\n" "\nResult:\n" "[\n" " {\n" @@ -4968,17 +4968,17 @@ UniValue getpubkey(const UniValue& params, bool fHelp) "]\n" "\nExamples:\n" "\nList pubkey.\n" - + HelpExampleCli("getpubkey", "") - + HelpExampleRpc("getpubkey", "") + + HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") + + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") ); extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; - if ( NOTARY_PUBKEY33[0] == 0 ) { - result.push_back(Pair("error","pubkey was not set!"; - } else { - result.push_back(Pair("pubkey", NOTARY_PUBKEY); + if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 )) { + NOTARY_PUBKEY = params[0].get_str(); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); } + result.push_back(Pair("pubkey", NOTARY_PUBKEY); return result; } From 07bc62d2c3dd601a14408eee62605b7a993ef592 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 13:06:51 +0800 Subject: [PATCH 0277/4463] fix --- src/wallet/rpcwallet.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index acbe165c2..19ec2a498 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4958,27 +4958,26 @@ UniValue setpubkey(const UniValue& params, bool fHelp) UniValue result(UniValue::VOBJ); if ( fHelp || params.size() != 1 ) throw runtime_error( - "setpubkey\n" - "\Sets the -pubkey if the daemon was not started with it, if it was started, it returns the pubkey.\n" - "\nResult:\n" - "[\n" - " {\n" - " \"pubkey\" : \"pubkey\", (string) The pubkey\n" - " }\n" - "]\n" - "\nExamples:\n" - "\nList pubkey.\n" - + HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") - + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") - ); + "setpubkey\n" + "\nSets the -pubkey if the daemon was not started with it, if it was started, it returns the pubkey.\n" + "\nArguments:\n" + "1. \"pubkey\" (string) pubkey to set.\n" + "\nResult:\n" + " {\n" + " \"pubkey\" : \"pubkey\", (string) The pubkey\n" + " }\n" + "\nExamples:\n" + + HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") + + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") + ); extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; - if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 )) { + if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); } - result.push_back(Pair("pubkey", NOTARY_PUBKEY); + result.push_back(Pair("pubkey", NOTARY_PUBKEY)); return result; } From 9b6bc59d958e71523db59dfc6daeac591d33cfdf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 13:34:52 +0800 Subject: [PATCH 0278/4463] set pubkey fix --- src/wallet/rpcwallet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 19ec2a498..fd51c47b6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4959,7 +4959,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if ( fHelp || params.size() != 1 ) throw runtime_error( "setpubkey\n" - "\nSets the -pubkey if the daemon was not started with it, if it was started, it returns the pubkey.\n" + "\nSets the -pubkey if the daemon was not started with it, if it was already set, it returns the pubkey.\n" "\nArguments:\n" "1. \"pubkey\" (string) pubkey to set.\n" "\nResult:\n" @@ -4974,8 +4974,12 @@ UniValue setpubkey(const UniValue& params, bool fHelp) extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { + LOCK(cs_main); NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + + } else { + result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } result.push_back(Pair("pubkey", NOTARY_PUBKEY)); return result; From 5e95a0e51f0e6c6d60f8b5888172dc32b38400e4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:13:39 +0800 Subject: [PATCH 0279/4463] add convert pubkey to address call --- src/wallet/rpcwallet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index fd51c47b6..5509a6b09 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4971,13 +4971,15 @@ UniValue setpubkey(const UniValue& params, bool fHelp) + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") ); + char *address; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { LOCK(cs_main); NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - + pubkey2addr(address,(uint8_t *)NOTARY_PUBKEY33); + result.push_back(Pair("R-address", address)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } From bec8436996ad4d495b6e6fa74799963edd3f5b93 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:16:02 +0800 Subject: [PATCH 0280/4463] try --- src/wallet/rpcwallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5509a6b09..26e9602e9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4953,6 +4953,8 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) return(result); } +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + UniValue setpubkey(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); From 064e6b67e435ff96092ab8360db6079299bf18ab Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:19:33 +0800 Subject: [PATCH 0281/4463] fix? --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 26e9602e9..1b85e2494 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4980,7 +4980,8 @@ UniValue setpubkey(const UniValue& params, bool fHelp) LOCK(cs_main); NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - pubkey2addr(address,(uint8_t *)NOTARY_PUBKEY33); + pubkey2addr((char *)address,(uint8_t *)NOTARY_PUBKEY33); + printf("%s\n",address); result.push_back(Pair("R-address", address)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); From fb13ce2e73ee2465c8d70301a8e2b8eedbca6410 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:23:43 +0800 Subject: [PATCH 0282/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1b85e2494..c69b9250e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4973,7 +4973,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") ); - char *address; + char address[20]; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { From 4e989f5d0ed25909ad31b4c9dad6bc5f90377537 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:30:30 +0800 Subject: [PATCH 0283/4463] fix? --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c69b9250e..ab9eeced1 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4982,7 +4982,8 @@ UniValue setpubkey(const UniValue& params, bool fHelp) decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); pubkey2addr((char *)address,(uint8_t *)NOTARY_PUBKEY33); printf("%s\n",address); - result.push_back(Pair("R-address", address)); + std::string str(address); + result.push_back(Pair("R-address", str)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } From 327f5aeb966f7ceced26409af97e212c4bb0065f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:35:47 +0800 Subject: [PATCH 0284/4463] hmm --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ab9eeced1..1724be26f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4983,7 +4983,8 @@ UniValue setpubkey(const UniValue& params, bool fHelp) pubkey2addr((char *)address,(uint8_t *)NOTARY_PUBKEY33); printf("%s\n",address); std::string str(address); - result.push_back(Pair("R-address", str)); + cout << str; + //result.push_back(Pair("R-address", str)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } From 7cc09a50cc13a2e13a5e4b65259c9d2b255a5c68 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:39:04 +0800 Subject: [PATCH 0285/4463] try --- src/wallet/rpcwallet.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1724be26f..9f25005c1 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4973,18 +4973,16 @@ UniValue setpubkey(const UniValue& params, bool fHelp) + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") ); - char address[20]; + char address[18]; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { - LOCK(cs_main); + //LOCK(cs_main); NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); pubkey2addr((char *)address,(uint8_t *)NOTARY_PUBKEY33); printf("%s\n",address); - std::string str(address); - cout << str; - //result.push_back(Pair("R-address", str)); + result.push_back(Pair("R-address", address)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } From 27402fecd1251487d8c2348e87b1eb4fec7959cf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:46:37 +0800 Subject: [PATCH 0286/4463] try --- src/wallet/rpcwallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9f25005c1..00b33f7e6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4974,14 +4974,17 @@ UniValue setpubkey(const UniValue& params, bool fHelp) ); char address[18]; + uint8_t pubkey33[33]; + decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); + pubkey2addr((char *)address,(uint8_t *)pubkey33); + printf("%s\n",address); + extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { //LOCK(cs_main); NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - pubkey2addr((char *)address,(uint8_t *)NOTARY_PUBKEY33); - printf("%s\n",address); result.push_back(Pair("R-address", address)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); From ecfeb9dd9c449c54c1a6893963a6a3166f85fbce Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:50:43 +0800 Subject: [PATCH 0287/4463] try --- src/wallet/rpcwallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 00b33f7e6..63e2371f6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4976,9 +4976,9 @@ UniValue setpubkey(const UniValue& params, bool fHelp) char address[18]; uint8_t pubkey33[33]; decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)address,(uint8_t *)pubkey33); - printf("%s\n",address); - + if (pubkey2addr((char *)address,(uint8_t *)pubkey33)) + printf("%s\n",address); + extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { From b412964cf243607a1aec635968ee4aecd672c409 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 14:58:07 +0800 Subject: [PATCH 0288/4463] fix --- src/wallet/rpcwallet.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 63e2371f6..9bb049371 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4967,6 +4967,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) "\nResult:\n" " {\n" " \"pubkey\" : \"pubkey\", (string) The pubkey\n" + " \"R-address\" : \"R address\", (string) The pubkey\n" " }\n" "\nExamples:\n" + HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") @@ -4975,16 +4976,14 @@ UniValue setpubkey(const UniValue& params, bool fHelp) char address[18]; uint8_t pubkey33[33]; - decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - if (pubkey2addr((char *)address,(uint8_t *)pubkey33)) - printf("%s\n",address); - extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { //LOCK(cs_main); NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); + pubkey2addr((char *)address,(uint8_t *)pubkey33) result.push_back(Pair("R-address", address)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); From 906935b4efa6e7c9c00212f84b754618e30d315e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:00:49 +0800 Subject: [PATCH 0289/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9bb049371..f32f08a84 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4983,7 +4983,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)address,(uint8_t *)pubkey33) + pubkey2addr((char *)address,(uint8_t *)pubkey33); result.push_back(Pair("R-address", address)); } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); From 6ef59e5094e3bae67ec15cf322b2241d1dba90d4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:14:54 +0800 Subject: [PATCH 0290/4463] error checks --- src/wallet/rpcwallet.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f32f08a84..77863165e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4978,13 +4978,19 @@ UniValue setpubkey(const UniValue& params, bool fHelp) uint8_t pubkey33[33]; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; - if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) { - //LOCK(cs_main); - NOTARY_PUBKEY = params[0].get_str(); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)address,(uint8_t *)pubkey33); - result.push_back(Pair("R-address", address)); + if ( NOTARY_PUBKEY33[0] == 0 ) { + if (strlen(params[0].get_str().c_str()) == 66) { + decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); + pubkey2addr((char *)address,(uint8_t *)pubkey33); + if (strncmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",address) == 0) { + result.push_back(Pair("error", "pubkey entered is invalid.")); + } else { + LOCK(cs_main); + NOTARY_PUBKEY = params[0].get_str(); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + result.push_back(Pair("R-address", address)); + } + } } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } From 841a3cc642236f0dfa045dc438a3338b7b44f8c9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:16:10 +0800 Subject: [PATCH 0291/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 77863165e..f24deadf8 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4982,7 +4982,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if (strlen(params[0].get_str().c_str()) == 66) { decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); pubkey2addr((char *)address,(uint8_t *)pubkey33); - if (strncmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",address) == 0) { + if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",address) == 0) { result.push_back(Pair("error", "pubkey entered is invalid.")); } else { LOCK(cs_main); From 021d89a826201e2719ccd1829b23dbb47df51406 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:19:05 +0800 Subject: [PATCH 0292/4463] fix --- src/wallet/rpcwallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f24deadf8..74bdf7e47 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4990,6 +4990,8 @@ UniValue setpubkey(const UniValue& params, bool fHelp) decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); result.push_back(Pair("R-address", address)); } + } else { + result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); } } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); From fc9a044c7e1be004b04ccdc890e6c995f619d0be Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:31:27 +0800 Subject: [PATCH 0293/4463] try --- src/wallet/rpcwallet.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 74bdf7e47..7a166a495 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4974,21 +4974,37 @@ UniValue setpubkey(const UniValue& params, bool fHelp) + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") ); - char address[18]; +#ifdef ENABLE_WALLET + LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); +#else + LOCK(cs_main); +#endif + + char Raddress[18]; uint8_t pubkey33[33]; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY; if ( NOTARY_PUBKEY33[0] == 0 ) { if (strlen(params[0].get_str().c_str()) == 66) { decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)address,(uint8_t *)pubkey33); - if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",address) == 0) { + pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); + if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",Raddress) == 0) { result.push_back(Pair("error", "pubkey entered is invalid.")); } else { - LOCK(cs_main); + CBitcoinAddress address(Raddress); + bool isValid = address.IsValid(); + if (isValid) + { + CTxDestination dest = address.Get(); + string currentAddress = address.ToString(); + result.push_back(Pair("address", currentAddress)); +#ifdef ENABLE_WALLET + isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; + result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); +#endif + } NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - result.push_back(Pair("R-address", address)); } } else { result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); From e3237f4a0b3d09e440ac36f369e60bf167462341 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:48:19 +0800 Subject: [PATCH 0294/4463] test adding pubkey to getinfo and setpubkey RPC --- src/rpcmisc.cpp | 3 ++ src/rpcserver.cpp | 25 ++++++++-------- src/rpcserver.h | 1 + src/wallet/rpcwallet.cpp | 62 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 12 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index a42afbb61..a1d576d58 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -64,6 +64,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; + extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; if (fHelp || params.size() != 0) throw runtime_error( "getinfo\n" @@ -158,6 +159,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("pubkey", pubkeystr)); if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); + } else if ( NOTARY_PUBKEY33[0] != 0 ) { + obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } } if ( ASSETCHAINS_CC != 0 ) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 7d2eab1e3..f724b5071 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -350,16 +350,16 @@ static const CRPCCommand vRPCCommands[] = #endif /* auction */ { "auction", "auctionaddress", &auctionaddress, true }, - + /* lotto */ { "lotto", "lottoaddress", &lottoaddress, true }, - + /* fsm */ { "FSM", "FSMaddress", &FSMaddress, true }, { "FSM", "FSMcreate", &FSMcreate, true }, { "FSM", "FSMlist", &FSMlist, true }, { "FSM", "FSMinfo", &FSMinfo, true }, - + /* rewards */ { "rewards", "rewardslist", &rewardslist, true }, { "rewards", "rewardsinfo", &rewardsinfo, true }, @@ -368,16 +368,16 @@ static const CRPCCommand vRPCCommands[] = { "rewards", "rewardslock", &rewardslock, true }, { "rewards", "rewardsunlock", &rewardsunlock, true }, { "rewards", "rewardsaddress", &rewardsaddress, true }, - + /* faucet */ { "faucet", "faucetinfo", &faucetinfo, true }, { "faucet", "faucetfund", &faucetfund, true }, { "faucet", "faucetget", &faucetget, true }, { "faucet", "faucetaddress", &faucetaddress, true }, - + /* MofN */ { "MofN", "mofnaddress", &mofnaddress, true }, - + /* Channels */ { "channels", "channelsaddress", &channelsaddress, true }, { "channels", "channelsinfo", &channelsinfo, true }, @@ -385,7 +385,7 @@ static const CRPCCommand vRPCCommands[] = { "channels", "channelspayment", &channelspayment, true }, { "channels", "channelsclose", &channelsclose, true }, { "channels", "channelsrefund", &channelsrefund, true }, - + /* Oracles */ { "oracles", "oraclesaddress", &oraclesaddress, true }, { "oracles", "oracleslist", &oracleslist, true }, @@ -395,7 +395,7 @@ static const CRPCCommand vRPCCommands[] = { "oracles", "oraclessubscribe", &oraclessubscribe, true }, { "oracles", "oraclesdata", &oraclesdata, true }, { "oracles", "oraclessamples", &oraclessamples, true }, - + /* Prices */ { "prices", "pricesaddress", &pricesaddress, true }, { "prices", "priceslist", &priceslist, true }, @@ -405,16 +405,16 @@ static const CRPCCommand vRPCCommands[] = { "prices", "pricesbet", &pricesbet, true }, { "prices", "pricesstatus", &pricesstatus, true }, { "prices", "pricesfinish", &pricesfinish, true }, - + /* Pegs */ { "pegs", "pegsaddress", &pegsaddress, true }, - + /* Triggers */ { "triggers", "triggersaddress", &triggersaddress, true }, - + /* Payments */ { "payments", "paymentsaddress", &paymentsaddress, true }, - + /* Gateways */ { "gateways", "gatewaysaddress", &gatewaysaddress, true }, { "gateways", "gatewayslist", &gatewayslist, true }, @@ -521,6 +521,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "sendmany", &sendmany, false }, { "wallet", "sendtoaddress", &sendtoaddress, false }, { "wallet", "setaccount", &setaccount, true }, + { "wallet", "setpubkey", &setpubkey, true }, { "wallet", "settxfee", &settxfee, true }, { "wallet", "signmessage", &signmessage, true }, { "wallet", "walletlock", &walletlock, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index a78f1b6fc..98c3357f9 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -322,6 +322,7 @@ extern UniValue walletlock(const UniValue& params, bool fHelp); extern UniValue encryptwallet(const UniValue& params, bool fHelp); extern UniValue validateaddress(const UniValue& params, bool fHelp); extern UniValue getinfo(const UniValue& params, bool fHelp); +extern UniValue setpubkey(const UniValue& params, bool fHelp); extern UniValue getwalletinfo(const UniValue& params, bool fHelp); extern UniValue getblockchaininfo(const UniValue& params, bool fHelp); extern UniValue getnetworkinfo(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 936c31fd9..c06477099 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4951,6 +4951,68 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) return(result); } +UniValue setpubkey(const UniValue& params, bool fHelp) +{ + UniValue result(UniValue::VOBJ); + if ( fHelp || params.size() != 1 ) + throw runtime_error( + "setpubkey\n" + "\nSets the -pubkey if the daemon was not started with it, if it was already set, it returns the pubkey.\n" + "\nArguments:\n" + "1. \"pubkey\" (string) pubkey to set.\n" + "\nResult:\n" + " {\n" + " \"pubkey\" : \"pubkey\", (string) The pubkey\n" + " \"ismine\" : \"true/false\", (bool)\n" + " \"R-address\" : \"R address\", (string) The pubkey\n" + " }\n" + "\nExamples:\n" + + HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") + + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") + ); + +#ifdef ENABLE_WALLET + LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); +#else + LOCK(cs_main); +#endif + + char Raddress[18]; + uint8_t pubkey33[33]; + extern uint8_t NOTARY_PUBKEY33[]; + extern std::string NOTARY_PUBKEY; + if ( NOTARY_PUBKEY33[0] == 0 ) { + if (strlen(params[0].get_str().c_str()) == 66) { + decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); + pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); + if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",Raddress) == 0) { + result.push_back(Pair("error", "pubkey entered is invalid.")); + } else { + CBitcoinAddress address(Raddress); + bool isValid = address.IsValid(); + if (isValid) + { + CTxDestination dest = address.Get(); + string currentAddress = address.ToString(); + result.push_back(Pair("address", currentAddress)); +#ifdef ENABLE_WALLET + isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; + result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); +#endif + } + NOTARY_PUBKEY = params[0].get_str(); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + } + } else { + result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); + } + } else { + result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); + } + result.push_back(Pair("pubkey", NOTARY_PUBKEY)); + return result; +} + UniValue oraclesaddress(const UniValue& params, bool fHelp) { struct CCcontract_info *cp,C; std::vector pubkey; From d1791de6f1b6e624c009f7d1afe583c928365d7d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 15:55:59 +0800 Subject: [PATCH 0295/4463] fix --- src/wallet/rpcwallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c06477099..3f42fb241 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4951,6 +4951,8 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) return(result); } +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + UniValue setpubkey(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); From dc28f2eb66d2552ea0856e4e4dcbf709fbcac3b5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 24 Oct 2018 23:57:26 +0800 Subject: [PATCH 0296/4463] update getdata function --- src/rpcblockchain.cpp | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 5499ca742..2212811ef 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -324,22 +324,33 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) unsigned int i = 0; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); // Iif block tx size is > 2 then we can do this - BOOST_FOREACH(const CTransaction&tx, block.vtx) - { - //if the vout size = 3 then its a valid TX get the data. dont use the test here! it wont work with notarisations! - if ( (i == 0) || (i == (block.vtx.size() -1)) ) + if ( block.vtx.size() > 2 ) { + BOOST_FOREACH(const CTransaction&tx, block.vtx) { - fprintf(stderr, "skipped tx number: %d \n",i); - } else { - fprintf(stderr, "added tx number: %d \n",i); - UniValue objTx(UniValue::VOBJ); - - objTx.push_back(Pair("hex", HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()))); - // function here to extract seqid from first and last TX - // we an push the data or not depending on input from RPC. - result.push_back(objTx); + // ignore first and last TX and any TX that does not have 3 vouts. + if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) + { + fprintf(stderr, "skipped tx number: %d \n",i); + } else { + fprintf(stderr, "added tx number: %d \n",i); + UniValue objTx(UniValue::VOBJ); + std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()) + if ( opretstr.size() > 81 ) { + std::string idstr = str.substr (8,64); // stream ID or txid + std::string seqid = str.substr (72,8); // sequence ID + std::string data = str.substr (80); // data chunk + objTx.push_back(Pair("idstr", idstr)); + objTx.push_back(Pair("seqid", seqid)); + objTx.push_back(Pair("data", data)); + result.push_back(objTx); + } + // function here to extract seqid from first and last TX + // we an push the data or not depending on input from RPC. + } + i = i + 1; } - i = i + 1; + } else { + result.push_back(Pair("error","there are no TX in this block.")) } return result; } From d89e0313cbb0fcd71a274693741386707ecf7b5e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:01:15 +0800 Subject: [PATCH 0297/4463] ; --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 2212811ef..eb0aa4675 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -334,7 +334,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else { fprintf(stderr, "added tx number: %d \n",i); UniValue objTx(UniValue::VOBJ); - std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()) + std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { std::string idstr = str.substr (8,64); // stream ID or txid std::string seqid = str.substr (72,8); // sequence ID @@ -345,7 +345,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(objTx); } // function here to extract seqid from first and last TX - // we an push the data or not depending on input from RPC. + // we an push the data or not depending on input from RPC. } i = i + 1; } From e80718809fad34d12529b19192b2325bb87c95ed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:02:31 +0800 Subject: [PATCH 0298/4463] oops --- src/rpcblockchain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index eb0aa4675..206aabfcf 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -336,9 +336,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) UniValue objTx(UniValue::VOBJ); std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { - std::string idstr = str.substr (8,64); // stream ID or txid - std::string seqid = str.substr (72,8); // sequence ID - std::string data = str.substr (80); // data chunk + std::string idstr = opretstr.substr (8,64); // stream ID or txid + std::string seqid = opretstr.substr (72,8); // sequence ID + std::string data = opretstr.substr (80); // data chunk objTx.push_back(Pair("idstr", idstr)); objTx.push_back(Pair("seqid", seqid)); objTx.push_back(Pair("data", data)); From deeb2e2d20c347557162c948ef51ad4c8446fbcb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:03:36 +0800 Subject: [PATCH 0299/4463] ; --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 206aabfcf..85c7ce343 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -350,7 +350,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) i = i + 1; } } else { - result.push_back(Pair("error","there are no TX in this block.")) + result.push_back(Pair("error","there are no TX in this block.")); } return result; } From 7566c9f1612f5bcd1bdf0c6f8ccbe5e799acf925 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:21:50 +0800 Subject: [PATCH 0300/4463] seqid as int --- src/rpcblockchain.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 85c7ce343..cfa823112 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -321,6 +321,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VARR); + unsigned int lastseqid = 0; unsigned int i = 0; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); // Iif block tx size is > 2 then we can do this @@ -337,7 +338,11 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid - std::string seqid = opretstr.substr (72,8); // sequence ID + std::string seqidstr = opretstr.substr (72,8); // sequence ID + unsigned int seqid; + std::stringstream ss; + ss << std::hex << seqidstr; + ss >> seqid; std::string data = opretstr.substr (80); // data chunk objTx.push_back(Pair("idstr", idstr)); objTx.push_back(Pair("seqid", seqid)); From f8dbd08dc8b14988ae4621b33b115a1630af127e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:24:20 +0800 Subject: [PATCH 0301/4463] ? --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index cfa823112..16316ae4e 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -345,7 +345,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) ss >> seqid; std::string data = opretstr.substr (80); // data chunk objTx.push_back(Pair("idstr", idstr)); - objTx.push_back(Pair("seqid", seqid)); + objTx.push_back(Pair("seqid", (int)seqid)); objTx.push_back(Pair("data", data)); result.push_back(objTx); } From b52da6b92141cfff32588b7e17f5a50982b25fa1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:52:33 +0800 Subject: [PATCH 0302/4463] try --- src/rpcblockchain.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 16316ae4e..a4d5d8040 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -321,8 +321,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VARR); - unsigned int lastseqid = 0; - unsigned int i = 0; + unsigned int firstdeqid = lastseqid = i = did1 = 0; + static std::string streamid,firsttxid; + std::string blockdata; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); // Iif block tx size is > 2 then we can do this if ( block.vtx.size() > 2 ) { @@ -334,26 +335,37 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) fprintf(stderr, "skipped tx number: %d \n",i); } else { fprintf(stderr, "added tx number: %d \n",i); - UniValue objTx(UniValue::VOBJ); std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid std::string seqidstr = opretstr.substr (72,8); // sequence ID + std::string data = opretstr.substr (80); // data chunk unsigned int seqid; std::stringstream ss; ss << std::hex << seqidstr; ss >> seqid; - std::string data = opretstr.substr (80); // data chunk - objTx.push_back(Pair("idstr", idstr)); - objTx.push_back(Pair("seqid", (int)seqid)); - objTx.push_back(Pair("data", data)); - result.push_back(objTx); + if ( seqid == 1 ) { + streamid = idstr; + } + if ( seqid == (lastseqid + 1 )) { + blockdata.append(data); + } + if ( did1 == 0 ) { + firstdeqid = seqid; + did1 = 1; + } + lastseqid = seqid; } // function here to extract seqid from first and last TX // we an push the data or not depending on input from RPC. } i = i + 1; } + result.push_back(Pair("streamid", streamid)); + result.push_back(Pair("firstseqid", (int)firstseqid)); + result.push_back(Pair("lastseqid", (int)lastseqid)); + result.push_back(Pair("data", blockdata)); + result.push_back(objTx); } else { result.push_back(Pair("error","there are no TX in this block.")); } From d640ffcea71a8012ec84fdfa120d1b884161f5d9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:54:11 +0800 Subject: [PATCH 0303/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a4d5d8040..c9942a5f4 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -321,7 +321,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VARR); - unsigned int firstdeqid = lastseqid = i = did1 = 0; + unsigned int firstdeqid,lastseqid,i,did1; static std::string streamid,firsttxid; std::string blockdata; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); From 04278865dc9596951bed0fb46a60ea0209b7c3d3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:54:28 +0800 Subject: [PATCH 0304/4463] fix --- src/rpcblockchain.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index c9942a5f4..674f99f42 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -365,7 +365,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); result.push_back(Pair("data", blockdata)); - result.push_back(objTx); } else { result.push_back(Pair("error","there are no TX in this block.")); } From 61cbc5257fceb7435faa3f238411a745176df961 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:55:30 +0800 Subject: [PATCH 0305/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 674f99f42..847ee13db 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -321,7 +321,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VARR); - unsigned int firstdeqid,lastseqid,i,did1; + unsigned int firstseqid,lastseqid,i,did1; static std::string streamid,firsttxid; std::string blockdata; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); From 11eccfa80bbdea7da4995e8001fb5185156c7910 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 00:56:24 +0800 Subject: [PATCH 0306/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 847ee13db..51036995d 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -351,7 +351,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) blockdata.append(data); } if ( did1 == 0 ) { - firstdeqid = seqid; + firstseqid = seqid; did1 = 1; } lastseqid = seqid; From 659f97c027ca016c0ef9224cb5dc86308cb69fca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 01:02:19 +0800 Subject: [PATCH 0307/4463] fix? --- src/rpcblockchain.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 51036995d..f3f483b5b 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -320,7 +320,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } return chainActive.Height(); */ - UniValue result(UniValue::VARR); + UniValue result(UniValue::VOBJ); unsigned int firstseqid,lastseqid,i,did1; static std::string streamid,firsttxid; std::string blockdata; @@ -332,9 +332,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) // ignore first and last TX and any TX that does not have 3 vouts. if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) { - fprintf(stderr, "skipped tx number: %d \n",i); + fprintf(stderr, "skipped tx number: %u \n",i); } else { - fprintf(stderr, "added tx number: %d \n",i); + fprintf(stderr, "added tx number: %u \n",i); std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid @@ -346,6 +346,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) ss >> seqid; if ( seqid == 1 ) { streamid = idstr; + printf("streamid: %s\n",streamid.c_str()); } if ( seqid == (lastseqid + 1 )) { blockdata.append(data); @@ -353,6 +354,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if ( did1 == 0 ) { firstseqid = seqid; did1 = 1; + printf("DID 1 first seqid = %u\n", firstseqid); } lastseqid = seqid; } From 426015aa75d50e763065e15d5c629f3ef80a9f05 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 01:09:19 +0800 Subject: [PATCH 0308/4463] WOW! it works --- src/rpcblockchain.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f3f483b5b..adaed6b2e 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -321,7 +321,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VOBJ); - unsigned int firstseqid,lastseqid,i,did1; + signed int firstseqid,lastseqid,i,did1; static std::string streamid,firsttxid; std::string blockdata; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); @@ -332,9 +332,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) // ignore first and last TX and any TX that does not have 3 vouts. if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) { - fprintf(stderr, "skipped tx number: %u \n",i); + fprintf(stderr, "skipped tx number: %d \n",i); } else { - fprintf(stderr, "added tx number: %u \n",i); + fprintf(stderr, "added tx number: %d \n",i); std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid @@ -346,7 +346,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) ss >> seqid; if ( seqid == 1 ) { streamid = idstr; - printf("streamid: %s\n",streamid.c_str()); + } else if ( seqid == 2 ) { + firsttxid = idstr; } if ( seqid == (lastseqid + 1 )) { blockdata.append(data); @@ -354,7 +355,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if ( did1 == 0 ) { firstseqid = seqid; did1 = 1; - printf("DID 1 first seqid = %u\n", firstseqid); } lastseqid = seqid; } @@ -364,6 +364,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) i = i + 1; } result.push_back(Pair("streamid", streamid)); + result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); result.push_back(Pair("data", blockdata)); From 3d29921a2562895d1634031e36400618a76aa111 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 01:13:43 +0800 Subject: [PATCH 0309/4463] fix --- src/rpcblockchain.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index adaed6b2e..56ac5f777 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -321,7 +321,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) return chainActive.Height(); */ UniValue result(UniValue::VOBJ); - signed int firstseqid,lastseqid,i,did1; + signed int firstseqid,lastseqid; + int i = 0; + int did1 = 0; static std::string streamid,firsttxid; std::string blockdata; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); @@ -332,9 +334,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) // ignore first and last TX and any TX that does not have 3 vouts. if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) { - fprintf(stderr, "skipped tx number: %d \n",i); + fprintf(stderr, "skipped tx number: %d\n,i"; } else { - fprintf(stderr, "added tx number: %d \n",i); std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid From 81ae02e649f3565bf3a285ea29de52b322c05341 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 01:14:47 +0800 Subject: [PATCH 0310/4463] oops --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 56ac5f777..a972900c1 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -334,7 +334,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) // ignore first and last TX and any TX that does not have 3 vouts. if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) { - fprintf(stderr, "skipped tx number: %d\n,i"; + fprintf(stderr, "skipped tx number: %d\n,i)"; } else { std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { From e42dcb0474697084d94ad3c1761e6a19cbfcf4f6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 10:24:19 +0800 Subject: [PATCH 0311/4463] more stuff --- src/rpcblockchain.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a972900c1..0468ace89 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,6 +257,12 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } +int convertstreamid(char *streamid_str, char *streamid_hex) { + char decodedhextest[32]; + decode_hex(streamid_str,32,streamid_hex); + printf("decoded hex: %s\n",decodedhextest); +} + UniValue getdatafromblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) @@ -314,12 +320,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if(!ReadBlockFromDisk(block, pblockindex,1)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); - /*BOOST_FOREACH(const CTransaction&tx, block.vtx) - { - fprintf(stderr, "%s\n",tx.GetHash().GetHex().cstr()); - } - return chainActive.Height(); - */ UniValue result(UniValue::VOBJ); signed int firstseqid,lastseqid; int i = 0; @@ -338,9 +338,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else { std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { - std::string idstr = opretstr.substr (8,64); // stream ID or txid + std::string idstr = opretstr.substr (8,64); // stream ID or txid std::string seqidstr = opretstr.substr (72,8); // sequence ID - std::string data = opretstr.substr (80); // data chunk + std::string data = opretstr.substr (80); // data chunk unsigned int seqid; std::stringstream ss; ss << std::hex << seqidstr; @@ -349,6 +349,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) streamid = idstr; } else if ( seqid == 2 ) { firsttxid = idstr; + } else if (firsttxid.isempty()) { + firsttxid == idstr; } if ( seqid == (lastseqid + 1 )) { blockdata.append(data); @@ -364,13 +366,24 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } i = i + 1; } - result.push_back(Pair("streamid", streamid)); + if (streamid.isempty()) { + uint256 hash,firsttxid_256; CTransaction firsttx; + firsttxid_256 = bits256_conv(firsttxid); + if (GetTransaction(firsttxid_256,firsttx,hash,false)) { + std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); + std::string streamid = firststreamid.substr (8,64); + } + } + char decodedstreamid[32]; + decode_hex(decodedstreamid,32,streamid.c_str()); + printf("decoded hex: %s\n",decodedstreamid); + result.push_back(Pair("streamid", decodedstreamid); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); result.push_back(Pair("data", blockdata)); } else { - result.push_back(Pair("error","there are no TX in this block.")); + result.push_back(Pair("error","there is no data in this block.")); } return result; } From be21e25e563456e18a6642358cb2bb80778e4a1f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 10:32:55 +0800 Subject: [PATCH 0312/4463] fix --- src/rpcblockchain.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 0468ace89..45ce9b70c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,10 +257,14 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } -int convertstreamid(char *streamid_str, char *streamid_hex) { - char decodedhextest[32]; - decode_hex(streamid_str,32,streamid_hex); - printf("decoded hex: %s\n",decodedhextest); +int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); +bits256 bits256_conv(char *hexstr) +{ + bits256 x; + memset(&x,0,sizeof(x)); + if ( strlen(hexstr) == sizeof(x)*2) + decode_hex(x.bytes,sizeof(x.bytes),hexstr); + return(x); } UniValue getdatafromblock(const UniValue& params, bool fHelp) @@ -349,7 +353,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) streamid = idstr; } else if ( seqid == 2 ) { firsttxid = idstr; - } else if (firsttxid.isempty()) { + } else if (firsttxid.empty()) { firsttxid == idstr; } if ( seqid == (lastseqid + 1 )) { @@ -366,7 +370,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } i = i + 1; } - if (streamid.isempty()) { + if (streamid.empty()) { uint256 hash,firsttxid_256; CTransaction firsttx; firsttxid_256 = bits256_conv(firsttxid); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { From aae6bbcdf263295a4fbcc7fa025c493a91716f1c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 10:35:51 +0800 Subject: [PATCH 0313/4463] fix some --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 45ce9b70c..f77f5dba7 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -338,7 +338,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) // ignore first and last TX and any TX that does not have 3 vouts. if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) { - fprintf(stderr, "skipped tx number: %d\n,i)"; + fprintf(stderr, "skipped tx number: %d\n",i); } else { std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); if ( opretstr.size() > 81 ) { @@ -381,7 +381,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) char decodedstreamid[32]; decode_hex(decodedstreamid,32,streamid.c_str()); printf("decoded hex: %s\n",decodedstreamid); - result.push_back(Pair("streamid", decodedstreamid); + result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); From 5e0dd924c6cda3f6d2f24eaa9cc8e24956ec0dcf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 10:51:28 +0800 Subject: [PATCH 0314/4463] try --- src/rpcblockchain.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f77f5dba7..e48473c1c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -258,9 +258,9 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) } int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); -bits256 bits256_conv(char *hexstr) +uint256 bits256_conv(char *hexstr) { - bits256 x; + uint256 x; memset(&x,0,sizeof(x)); if ( strlen(hexstr) == sizeof(x)*2) decode_hex(x.bytes,sizeof(x.bytes),hexstr); @@ -379,8 +379,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } } char decodedstreamid[32]; - decode_hex(decodedstreamid,32,streamid.c_str()); - printf("decoded hex: %s\n",decodedstreamid); + decode_hex((char *)decodedstreamid,32,streamid.c_str()); + printf("decoded hex: %s\n",(char *)decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); From a1141951cab2afa1c0ebeb3a3547579be9c5d884 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:05:53 +0800 Subject: [PATCH 0315/4463] try --- src/rpcblockchain.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e48473c1c..d0eb45401 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -258,14 +258,6 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) } int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); -uint256 bits256_conv(char *hexstr) -{ - uint256 x; - memset(&x,0,sizeof(x)); - if ( strlen(hexstr) == sizeof(x)*2) - decode_hex(x.bytes,sizeof(x.bytes),hexstr); - return(x); -} UniValue getdatafromblock(const UniValue& params, bool fHelp) { @@ -371,15 +363,15 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) i = i + 1; } if (streamid.empty()) { - uint256 hash,firsttxid_256; CTransaction firsttx; - firsttxid_256 = bits256_conv(firsttxid); + uint256 hash; CTransaction firsttx; + uint256 firsttxid_256 = ParseHashV(firsttxid); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); std::string streamid = firststreamid.substr (8,64); } } char decodedstreamid[32]; - decode_hex((char *)decodedstreamid,32,streamid.c_str()); + decode_hex((uint8_t)decodedstreamid,32,streamid.c_str()); printf("decoded hex: %s\n",(char *)decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); From 7768292e180714c1b980c18425a9ddb5f7d378f2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:08:15 +0800 Subject: [PATCH 0316/4463] ? --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index d0eb45401..b798cb22e 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -364,7 +364,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } if (streamid.empty()) { uint256 hash; CTransaction firsttx; - uint256 firsttxid_256 = ParseHashV(firsttxid); + uint256 firsttxid_256 = ParseHashV(firsttxid,"firsttxid"); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); std::string streamid = firststreamid.substr (8,64); From 2630e93a16851c5b6549fe2604d63ff2abe492fb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:11:42 +0800 Subject: [PATCH 0317/4463] ? --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index b798cb22e..c32e645da 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,7 +257,7 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } -int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex); +int32_t decode_hex(char *bytes,int32_t n,char *hex); UniValue getdatafromblock(const UniValue& params, bool fHelp) { @@ -371,7 +371,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } } char decodedstreamid[32]; - decode_hex((uint8_t)decodedstreamid,32,streamid.c_str()); + decode_hex(decodedstreamid,32,streamid.c_str()); printf("decoded hex: %s\n",(char *)decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); From 5b11f256aae923e98c47920000131a2b61e7b1ad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:15:07 +0800 Subject: [PATCH 0318/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index c32e645da..a009a2752 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -371,7 +371,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } } char decodedstreamid[32]; - decode_hex(decodedstreamid,32,streamid.c_str()); + decode_hex(decodedstreamid,32,(char *)streamid.c_str()); printf("decoded hex: %s\n",(char *)decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); From 89f6e171dee2c861b7928b89eca6bb8b722c74e5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:17:16 +0800 Subject: [PATCH 0319/4463] again --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a009a2752..b0dd031a9 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -257,7 +257,7 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } -int32_t decode_hex(char *bytes,int32_t n,char *hex); +int32_t decode_hex(uint8_t bytes,int32_t n,char *hex); UniValue getdatafromblock(const UniValue& params, bool fHelp) { From 5d5c1bd4738821416cbf01b57f616cbb68a62098 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:25:40 +0800 Subject: [PATCH 0320/4463] try --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index b0dd031a9..c062669a7 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -370,7 +370,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string streamid = firststreamid.substr (8,64); } } - char decodedstreamid[32]; + uint8_t decodedstreamid[32]; decode_hex(decodedstreamid,32,(char *)streamid.c_str()); printf("decoded hex: %s\n",(char *)decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); From 1e8cd9ff69ddcb4a37ff5c1d47a2d69133e9ff63 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:28:28 +0800 Subject: [PATCH 0321/4463] ? --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index c062669a7..74b3f297d 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -371,7 +371,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } } uint8_t decodedstreamid[32]; - decode_hex(decodedstreamid,32,(char *)streamid.c_str()); + decode_hex(*decodedstreamid,32,(char *)streamid.c_str()); printf("decoded hex: %s\n",(char *)decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); From e8caddfca3adfbc4f848e8c3b3da961332c02bab Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:31:20 +0800 Subject: [PATCH 0322/4463] include decode hex --- src/rpcblockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 74b3f297d..76395ca8f 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -20,6 +20,7 @@ #include "script/script_error.h" #include "script/sign.h" #include "script/standard.h" +#include "komodo_utils.h" #include From 5489c976f0c479a69997ad69b315471deebc2832 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:37:54 +0800 Subject: [PATCH 0323/4463] fix --- src/rpcblockchain.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 76395ca8f..eec2130c1 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -20,7 +20,6 @@ #include "script/script_error.h" #include "script/sign.h" #include "script/standard.h" -#include "komodo_utils.h" #include @@ -258,7 +257,30 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } -int32_t decode_hex(uint8_t bytes,int32_t n,char *hex); +unsigned char hexval(unsigned char c) +{ + if ('0' <= c && c <= '9') + return c - '0'; + else if ('a' <= c && c <= 'f') + return c - 'a' + 10; + else if ('A' <= c && c <= 'F') + return c - 'A' + 10; + else abort(); +} + +void hex2ascii(const string& in, string& out) +{ + out.clear(); + out.reserve(in.length() / 2); + for (string::const_iterator p = in.begin(); p != in.end(); p++) + { + unsigned char c = hexval(*p); + p++; + if (p == in.end()) break; // incomplete last digit - should report error + c = (c << 4) + hexval(*p); // + takes precedence over << + out.push_back(c); + } +} UniValue getdatafromblock(const UniValue& params, bool fHelp) { @@ -371,9 +393,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string streamid = firststreamid.substr (8,64); } } - uint8_t decodedstreamid[32]; - decode_hex(*decodedstreamid,32,(char *)streamid.c_str()); - printf("decoded hex: %s\n",(char *)decodedstreamid); + std::string decodedstreamid; + hex2ascii(streamid, decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); From 95992d4492aff6bdd2ce865697b357fe7e1f0192 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:50:47 +0800 Subject: [PATCH 0324/4463] add t/f flag for data --- src/rpcblockchain.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index eec2130c1..5f6142300 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -330,6 +330,10 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); + bool fVerbose = true; + if (params.size() > 1) + fVerbose = params[1].get_bool(); + CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; @@ -399,7 +403,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); - result.push_back(Pair("data", blockdata)); + if (fVerbose) { + result.push_back(Pair("data", blockdata)); + } } else { result.push_back(Pair("error","there is no data in this block.")); } From c4434400d19d42dc9fd05d767f5d9244c6c1dc40 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 11:55:29 +0800 Subject: [PATCH 0325/4463] try --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 5f6142300..612acf2bf 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -330,9 +330,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); - bool fVerbose = true; + bool fVerbose = false; if (params.size() > 1) - fVerbose = params[1].get_bool(); + fVerbose = (params[1].get_int() != 0); CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; From e8cd54ea2fbdb43b495792acf5979ac3d8851f94 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 12:02:58 +0800 Subject: [PATCH 0326/4463] ? --- src/rpcblockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 612acf2bf..0178fbf43 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -373,6 +373,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else if ( seqid == 2 ) { firsttxid = idstr; } else if (firsttxid.empty()) { + printf("firsttxid is empty: %s\n",idstr.c_str()); firsttxid == idstr; } if ( seqid == (lastseqid + 1 )) { From 6ac869140f17fbead6dff7e1e68d5315032aea8f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 12:53:05 +0800 Subject: [PATCH 0327/4463] ? --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 0178fbf43..204ea7b23 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -374,7 +374,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid = idstr; } else if (firsttxid.empty()) { printf("firsttxid is empty: %s\n",idstr.c_str()); - firsttxid == idstr; + firsttxid.append(idstr); } if ( seqid == (lastseqid + 1 )) { blockdata.append(data); @@ -392,7 +392,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } if (streamid.empty()) { uint256 hash; CTransaction firsttx; - uint256 firsttxid_256 = ParseHashV(firsttxid,"firsttxid"); + uint256 firsttxid_256(uint256S(firsttxid)); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); std::string streamid = firststreamid.substr (8,64); From ee7e3de254a836821036585c8f60ffca8a54ec7c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 12:57:07 +0800 Subject: [PATCH 0328/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 204ea7b23..0fdb17dea 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -395,7 +395,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) uint256 firsttxid_256(uint256S(firsttxid)); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); - std::string streamid = firststreamid.substr (8,64); + streamid.append(firststreamid.substr (8,64)); } } std::string decodedstreamid; From 07f2fa7b1f4a1d7a45708008df4860cf2dac563f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 13:00:29 +0800 Subject: [PATCH 0329/4463] hex --- src/rpcblockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 0fdb17dea..38c450224 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -401,6 +401,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string decodedstreamid; hex2ascii(streamid, decodedstreamid); result.push_back(Pair("streamid", decodedstreamid)); + result.push_back(Pair("streamidhex", streamid)); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); From d32cdefe7bc9b415469d407e9ea91e145a3bb68f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 13:18:23 +0800 Subject: [PATCH 0330/4463] test --- src/rpcblockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 38c450224..f013420e4 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -278,6 +278,7 @@ void hex2ascii(const string& in, string& out) p++; if (p == in.end()) break; // incomplete last digit - should report error c = (c << 4) + hexval(*p); // + takes precedence over << + printf("char: %d\n",c); out.push_back(c); } } From ed7c03730365c8cca5a77a38570eed48009d52c6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 13:26:17 +0800 Subject: [PATCH 0331/4463] try --- src/rpcblockchain.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f013420e4..655d2c906 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -278,7 +278,6 @@ void hex2ascii(const string& in, string& out) p++; if (p == in.end()) break; // incomplete last digit - should report error c = (c << 4) + hexval(*p); // + takes precedence over << - printf("char: %d\n",c); out.push_back(c); } } @@ -401,7 +400,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } std::string decodedstreamid; hex2ascii(streamid, decodedstreamid); - result.push_back(Pair("streamid", decodedstreamid)); + result.push_back(Pair("streamid", decodedstreamid.c_str())); result.push_back(Pair("streamidhex", streamid)); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); From 1ec39b2b97a7b1361303020f7048988b3466455a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:09:51 +0800 Subject: [PATCH 0332/4463] try 2 arg as str --- src/rpcblockchain.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 655d2c906..cd7167dcf 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -303,6 +303,11 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string strHash = params[0].get_str(); + if (params.size() > 1) { + std::string getdata = params[1].get_str(); + printf("%s\n",getdata.c_str()); + } + // If height is supplied, find the hash if (strHash.size() < (2 * sizeof(uint256))) { // std::stoi allows characters, whereas we want to be strict @@ -330,10 +335,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); - bool fVerbose = false; - if (params.size() > 1) - fVerbose = (params[1].get_int() != 0); - CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; @@ -360,6 +361,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) fprintf(stderr, "skipped tx number: %d\n",i); } else { std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); + // scriptPubKey is longer than 81, should mean its an OP_RETURN. if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid std::string seqidstr = opretstr.substr (72,8); // sequence ID @@ -373,11 +375,15 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else if ( seqid == 2 ) { firsttxid = idstr; } else if (firsttxid.empty()) { - printf("firsttxid is empty: %s\n",idstr.c_str()); firsttxid.append(idstr); } + if ( seqid == (lastseqid + 1 )) { blockdata.append(data); + } else { + result.push_back(Pair("error","chunck out of order in this block!")); + result.push_back(Pair("lastvalidseqid", (int)seqid)); + break; } if ( did1 == 0 ) { firstseqid = seqid; @@ -401,7 +407,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string decodedstreamid; hex2ascii(streamid, decodedstreamid); result.push_back(Pair("streamid", decodedstreamid.c_str())); - result.push_back(Pair("streamidhex", streamid)); result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); From a5c99046866f2eaae4616ae4d5a315ba93ff377a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:11:33 +0800 Subject: [PATCH 0333/4463] fix --- src/rpcblockchain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index cd7167dcf..b7def7ea6 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -410,9 +410,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); - if (fVerbose) { - result.push_back(Pair("data", blockdata)); - } + //if (fVerbose) { + // result.push_back(Pair("data", blockdata)); + //} } else { result.push_back(Pair("error","there is no data in this block.")); } From 806a8e93aa997779fd9cb5920db65d8fb78e9a62 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:15:12 +0800 Subject: [PATCH 0334/4463] fix? --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index b7def7ea6..f4ec0d1fa 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -378,7 +378,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid.append(idstr); } - if ( seqid == (lastseqid + 1 )) { + if ( (seqid == (lastseqid + 1 )) && lastseqid != 0 ) { blockdata.append(data); } else { result.push_back(Pair("error","chunck out of order in this block!")); From 9b3cd72603436b8f8e4cc0b0835388b94e49c9fa Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:23:26 +0800 Subject: [PATCH 0335/4463] wtf --- src/rpcblockchain.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f4ec0d1fa..74536a2af 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -345,7 +345,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); UniValue result(UniValue::VOBJ); - signed int firstseqid,lastseqid; + int firstseqid = 0; + int lastseqid = 0; int i = 0; int did1 = 0; static std::string streamid,firsttxid; @@ -378,12 +379,13 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid.append(idstr); } - if ( (seqid == (lastseqid + 1 )) && lastseqid != 0 ) { + if ( seqid == (lastseqid + 1 ) ) { blockdata.append(data); } else { + printf("seqid.%d lastseqid.%d\n",seqid,lastseqid); result.push_back(Pair("error","chunck out of order in this block!")); result.push_back(Pair("lastvalidseqid", (int)seqid)); - break; + //break; } if ( did1 == 0 ) { firstseqid = seqid; From 1dd2a13d7c7ea8f231be9b9cdc59d56821910ed7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:29:13 +0800 Subject: [PATCH 0336/4463] fixed --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 74536a2af..02547ac66 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -379,7 +379,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid.append(idstr); } - if ( seqid == (lastseqid + 1 ) ) { + if ( seqid == (lastseqid + 1) || did1 == 0 ) { blockdata.append(data); } else { printf("seqid.%d lastseqid.%d\n",seqid,lastseqid); From a3b73317734d4552f78175e8b1c08a57c811317a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:52:23 +0800 Subject: [PATCH 0337/4463] try --- src/rpcblockchain.cpp | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 02547ac66..5309b9536 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -286,26 +286,38 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( - "getdatafromblock \"hash|height\"\n" + "getdatafromblock \"hash|height\" true/false\n" "\nReturns all the data sent via streamer in block if there was any data in it.\n" "\nArguments:\n" "1. \"hash|height\" (string, required) The block hash or height\n" + "2. \"true/false\" (bool, optional) if false do not return the actual data. Default true.\n" + "\nResult (for verbose = true):\n" + "{\n" + " \"streamid\" : \"string\", (string) the name of the stream.\n" + " \"firsttxid\" : \"hash\", (string) the first transaction of the stream.\n" + " \"firstdeqid\" : n, (numeric) The sequence id of the first data chunk in this block\n" + " \"lastseqid\" : n, (numeric) The sequence id of the last data chunk in this block\n" + " \"data\" : \"xxxx\", (string) A hex string containing all the data chunks in this block.\n" + "}\n" "\nResult (for verbose=false):\n" - "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n" - "\nExamples:\n" - + HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + " \"streamid\" : \"string\", (string) the name of the stream.\n" + " \"firsttxid\" : \"hash\", (string) the first transaction of the stream.\n" + " \"firstdeqid\" : n, (numeric) The sequence id of the first data chunk in this block\n" + " \"lastseqid\" : n, (numeric) The sequence id of the last data chunk in this block\n" + + HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 false\"") + HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + HelpExampleCli("getblock", "12800") - + HelpExampleRpc("getblock", "12800") + + HelpExampleRpc("getblock", "12800 false") ); LOCK(cs_main); std::string strHash = params[0].get_str(); - + bool fVerbose = true; if (params.size() > 1) { - std::string getdata = params[1].get_str(); - printf("%s\n",getdata.c_str()); + std::string verboseflag = params[1].get_str(); + if ( verboseflag.compare("false") ) + fVerbose = false; } // If height is supplied, find the hash @@ -382,10 +394,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if ( seqid == (lastseqid + 1) || did1 == 0 ) { blockdata.append(data); } else { - printf("seqid.%d lastseqid.%d\n",seqid,lastseqid); result.push_back(Pair("error","chunck out of order in this block!")); - result.push_back(Pair("lastvalidseqid", (int)seqid)); - //break; + result.push_back(Pair("lastvalidseqid", (int)lastseqid)); + break; } if ( did1 == 0 ) { firstseqid = seqid; @@ -412,9 +423,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); - //if (fVerbose) { - // result.push_back(Pair("data", blockdata)); - //} + if (fVerbose) { + result.push_back(Pair("data", blockdata)); + } } else { result.push_back(Pair("error","there is no data in this block.")); } From abddda8830bf5f4df0b09f95d6b3f66b4ca6d295 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:54:50 +0800 Subject: [PATCH 0338/4463] try --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 5309b9536..31b629ac3 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -316,7 +316,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) bool fVerbose = true; if (params.size() > 1) { std::string verboseflag = params[1].get_str(); - if ( verboseflag.compare("false") ) + if ( verboseflag.compare("false") == 1 ) fVerbose = false; } From 71ee7345e5b5a03e8b03a2272d61f31e2eb9c52f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:58:22 +0800 Subject: [PATCH 0339/4463] try again --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 31b629ac3..6badd753e 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -316,7 +316,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) bool fVerbose = true; if (params.size() > 1) { std::string verboseflag = params[1].get_str(); - if ( verboseflag.compare("false") == 1 ) + if ( verboseflag == "false" ) fVerbose = false; } From ce5bf4b0811a0fe15848022d4d6a0ffb3deaac9b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 14:59:02 +0800 Subject: [PATCH 0340/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 6badd753e..0c19bcc20 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -423,7 +423,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(Pair("firsttxid", firsttxid)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); - if (fVerbose) { + if (fVerbose == true) { result.push_back(Pair("data", blockdata)); } } else { From 900f9fc8ec43a0bef74fd5d0d8423b7cc972c9cf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 16:08:39 +0800 Subject: [PATCH 0341/4463] try to print block hash --- src/rpcblockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 0c19bcc20..1edd2152c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -415,6 +415,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); streamid.append(firststreamid.substr (8,64)); + printf("block hash: %s\n",hash.ToString().c_str()); } } std::string decodedstreamid; From 8cec48894b7c16b6761a270b6d265839eb8cf2fd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 16:39:17 +0800 Subject: [PATCH 0342/4463] more error checks --- src/rpcblockchain.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 1edd2152c..f2387a691 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -361,17 +361,22 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) int lastseqid = 0; int i = 0; int did1 = 0; + int skippedtxs = 0; + int failed = 0; static std::string streamid,firsttxid; + static int firsttxnHeight; std::string blockdata; fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); // Iif block tx size is > 2 then we can do this - if ( block.vtx.size() > 2 ) { + if ( block.vtx.size() > 2 ) + { BOOST_FOREACH(const CTransaction&tx, block.vtx) { // ignore first and last TX and any TX that does not have 3 vouts. if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) { fprintf(stderr, "skipped tx number: %d\n",i); + skippedtxs = skippedtxs + 1; } else { std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); // scriptPubKey is longer than 81, should mean its an OP_RETURN. @@ -389,6 +394,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid = idstr; } else if (firsttxid.empty()) { firsttxid.append(idstr); + } else if ( firsttxid != idstr ) { + printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n",firsttxid.c_str(),idstr.c_str()); } if ( seqid == (lastseqid + 1) || did1 == 0 ) { @@ -403,6 +410,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) did1 = 1; } lastseqid = seqid; + } else { + skippedtxs = skippedtxs + 1; + fprintf(stderr, "skipped tx number: %d\n",i); } // function here to extract seqid from first and last TX // we an push the data or not depending on input from RPC. @@ -415,7 +425,14 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); streamid.append(firststreamid.substr (8,64)); - printf("block hash: %s\n",hash.ToString().c_str()); + BlockMap::iterator mi = mapBlockIndex.find(hash); + if (mi != mapBlockIndex.end() && (*mi).second) { + CBlockIndex* pindex = (*mi).second; + if (chainActive.Contains(pindex)) { + firsttxnHeight = pindex->nHeight; + printf("block hash: %s block height: %d\n",hash.ToString().c_str(),firsttxnHeight); + } + } } } std::string decodedstreamid; @@ -428,6 +445,10 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) result.push_back(Pair("data", blockdata)); } } else { + failed = 1; + } + + if ( failed == 1 || skippedtxs == i ) { result.push_back(Pair("error","there is no data in this block.")); } return result; From 2b21b2e94d534915227f58c22e2d24585ffcea40 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 16:44:01 +0800 Subject: [PATCH 0343/4463] fix --- src/rpcblockchain.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f2387a691..bbd5b6d56 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -435,21 +435,22 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } } } - std::string decodedstreamid; - hex2ascii(streamid, decodedstreamid); - result.push_back(Pair("streamid", decodedstreamid.c_str())); - result.push_back(Pair("firsttxid", firsttxid)); - result.push_back(Pair("firstseqid", (int)firstseqid)); - result.push_back(Pair("lastseqid", (int)lastseqid)); - if (fVerbose == true) { - result.push_back(Pair("data", blockdata)); - } } else { failed = 1; } if ( failed == 1 || skippedtxs == i ) { result.push_back(Pair("error","there is no data in this block.")); + } else { + std::string decodedstreamid; + hex2ascii(streamid, decodedstreamid); + result.push_back(Pair("streamid", decodedstreamid.c_str())); + result.push_back(Pair("firsttxid", firsttxid)); + result.push_back(Pair("firstseqid", (int)firstseqid)); + result.push_back(Pair("lastseqid", (int)lastseqid)); + if (fVerbose == true) { + result.push_back(Pair("data", blockdata)); + } } return result; } From 56afde8d171868f0892b25cf0f2427498bb07724 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 16:52:38 +0800 Subject: [PATCH 0344/4463] move block print --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index bbd5b6d56..94e140aa5 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -430,7 +430,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) CBlockIndex* pindex = (*mi).second; if (chainActive.Contains(pindex)) { firsttxnHeight = pindex->nHeight; - printf("block hash: %s block height: %d\n",hash.ToString().c_str(),firsttxnHeight); } } } @@ -442,6 +441,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if ( failed == 1 || skippedtxs == i ) { result.push_back(Pair("error","there is no data in this block.")); } else { + printf("block hash: %s block height: %d\n",hash.ToString().c_str(),firsttxnHeight); std::string decodedstreamid; hex2ascii(streamid, decodedstreamid); result.push_back(Pair("streamid", decodedstreamid.c_str())); From d647a00ba762de93ed5f7b63ac37fe009aa1be2b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 16:59:24 +0800 Subject: [PATCH 0345/4463] ready for a new chain --- src/rpcblockchain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 94e140aa5..a29464201 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -295,6 +295,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) "{\n" " \"streamid\" : \"string\", (string) the name of the stream.\n" " \"firsttxid\" : \"hash\", (string) the first transaction of the stream.\n" + " \"firstblockheight\" : \"n\", (numeric) the block the stream starts in.\n" " \"firstdeqid\" : n, (numeric) The sequence id of the first data chunk in this block\n" " \"lastseqid\" : n, (numeric) The sequence id of the last data chunk in this block\n" " \"data\" : \"xxxx\", (string) A hex string containing all the data chunks in this block.\n" @@ -302,6 +303,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) "\nResult (for verbose=false):\n" " \"streamid\" : \"string\", (string) the name of the stream.\n" " \"firsttxid\" : \"hash\", (string) the first transaction of the stream.\n" + " \"firstblockheight\" : \"n\", (numeric) the block the stream starts in.\n" " \"firstdeqid\" : n, (numeric) The sequence id of the first data chunk in this block\n" " \"lastseqid\" : n, (numeric) The sequence id of the last data chunk in this block\n" + HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 false\"") @@ -446,6 +448,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) hex2ascii(streamid, decodedstreamid); result.push_back(Pair("streamid", decodedstreamid.c_str())); result.push_back(Pair("firsttxid", firsttxid)); + result.push_back(Pair("firstblockheight", (int)firsttxnHeight)); result.push_back(Pair("firstseqid", (int)firstseqid)); result.push_back(Pair("lastseqid", (int)lastseqid)); if (fVerbose == true) { From 8c0de51c083f0b222340d2fb4c8a5d144dbcdb56 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 17:00:35 +0800 Subject: [PATCH 0346/4463] fix --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index a29464201..0bbba22a8 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -397,7 +397,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else if (firsttxid.empty()) { firsttxid.append(idstr); } else if ( firsttxid != idstr ) { - printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n",firsttxid.c_str(),idstr.c_str()); + printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n we are in a new stream here I think\n",firsttxid.c_str(),idstr.c_str()); } if ( seqid == (lastseqid + 1) || did1 == 0 ) { From c3a4829ba563f633ebbb72b2deb2e87ca98473ca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 25 Oct 2018 17:46:09 +0800 Subject: [PATCH 0347/4463] try fix for calling getdata out of order --- src/rpcblockchain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 0bbba22a8..6aa8ab384 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -398,6 +398,9 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid.append(idstr); } else if ( firsttxid != idstr ) { printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n we are in a new stream here I think\n",firsttxid.c_str(),idstr.c_str()); + firsttxid.clear(); + firsttxid.append(idstr); + streamid.clear(); } if ( seqid == (lastseqid + 1) || did1 == 0 ) { From 9fbf73b63255c68d80652354f25a9e73afff0856 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Fri, 26 Oct 2018 01:08:26 +0200 Subject: [PATCH 0348/4463] comment out spamming addoracleeinputs print --- src/cc/oracles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index 5a352afeb..1cd3be0d0 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -666,7 +666,7 @@ int64_t AddOracleInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPub std::vector > unspentOutputs; GetCCaddress(cp,coinaddr,pk); SetCCunspents(unspentOutputs,coinaddr); - fprintf(stderr,"addoracleinputs from (%s)\n",coinaddr); + //fprintf(stderr,"addoracleinputs from (%s)\n",coinaddr); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) { txid = it->first.txhash; From 7700741e46a3197ef252defbd3d7954d94ff131b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 26 Oct 2018 23:08:26 +0800 Subject: [PATCH 0349/4463] try? --- src/rpcblockchain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 6aa8ab384..f52b3ac7c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -401,12 +401,13 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) firsttxid.clear(); firsttxid.append(idstr); streamid.clear(); + firsttxnHeight = 0; } if ( seqid == (lastseqid + 1) || did1 == 0 ) { blockdata.append(data); } else { - result.push_back(Pair("error","chunck out of order in this block!")); + result.push_back(Pair("error","chunck out of order or missing in this block!")); result.push_back(Pair("lastvalidseqid", (int)lastseqid)); break; } From 8c552c067ccbd88c682eaaa21c3e76694e1f3c09 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 26 Oct 2018 23:23:49 +0800 Subject: [PATCH 0350/4463] debug --- src/rpcblockchain.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f52b3ac7c..ab9985b44 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -397,7 +397,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } else if (firsttxid.empty()) { firsttxid.append(idstr); } else if ( firsttxid != idstr ) { - printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n we are in a new stream here I think\n",firsttxid.c_str(),idstr.c_str()); + printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n",firsttxid.c_str(),idstr.c_str()); firsttxid.clear(); firsttxid.append(idstr); streamid.clear(); @@ -430,10 +430,12 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) uint256 firsttxid_256(uint256S(firsttxid)); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); + printf("first stream id changed to: %s\n", firststreamid.c_str()); streamid.append(firststreamid.substr (8,64)); BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; + printf("found block height: %d\n",pindex->nHeight); if (chainActive.Contains(pindex)) { firsttxnHeight = pindex->nHeight; } @@ -447,7 +449,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) if ( failed == 1 || skippedtxs == i ) { result.push_back(Pair("error","there is no data in this block.")); } else { - printf("block hash: %s block height: %d\n",hash.ToString().c_str(),firsttxnHeight); std::string decodedstreamid; hex2ascii(streamid, decodedstreamid); result.push_back(Pair("streamid", decodedstreamid.c_str())); From db0fa8d71cacf5ded3d1f137e3f19b5377cdf50f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 26 Oct 2018 23:41:49 +0800 Subject: [PATCH 0351/4463] try? --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index ab9985b44..e1877d058 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -430,8 +430,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) uint256 firsttxid_256(uint256S(firsttxid)); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); - printf("first stream id changed to: %s\n", firststreamid.c_str()); streamid.append(firststreamid.substr (8,64)); + printf("first stream id changed to: %s\n", streamid.c_str()); BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; From b1727e55cb667e6291331537cb35278cbc4a9232 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Oct 2018 00:01:24 +0800 Subject: [PATCH 0352/4463] try --- src/rpcblockchain.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e1877d058..0b6bfc713 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -432,12 +432,16 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); streamid.append(firststreamid.substr (8,64)); printf("first stream id changed to: %s\n", streamid.c_str()); - BlockMap::iterator mi = mapBlockIndex.find(hash); - if (mi != mapBlockIndex.end() && (*mi).second) { - CBlockIndex* pindex = (*mi).second; - printf("found block height: %d\n",pindex->nHeight); - if (chainActive.Contains(pindex)) { - firsttxnHeight = pindex->nHeight; + if ( firstdeqid == 1 ) { + firsttxnHeight == block.nHeight; + } else { + BlockMap::iterator mi = mapBlockIndex.find(hash); + if (mi != mapBlockIndex.end() && (*mi).second) { + CBlockIndex* pindex = (*mi).second; + printf("found block height: %d\n",pindex->nHeight); + if (chainActive.Contains(pindex)) { + firsttxnHeight = pindex->nHeight; + } } } } From 5e786e2e4cf3919ca6dfaaaa0f1f52022a3bdcbf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Oct 2018 00:07:45 +0800 Subject: [PATCH 0353/4463] fix --- src/rpcblockchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 0b6bfc713..e0597a541 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -432,8 +432,8 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); streamid.append(firststreamid.substr (8,64)); printf("first stream id changed to: %s\n", streamid.c_str()); - if ( firstdeqid == 1 ) { - firsttxnHeight == block.nHeight; + if ( firstseqid == 1 ) { + firsttxnHeight == pblockindex->nHeight; } else { BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end() && (*mi).second) { From fd8fe7b404768508463745b6606fc54b3b01c60e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Oct 2018 00:13:26 +0800 Subject: [PATCH 0354/4463] try --- src/rpcblockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e0597a541..e383a87f7 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -434,6 +434,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) printf("first stream id changed to: %s\n", streamid.c_str()); if ( firstseqid == 1 ) { firsttxnHeight == pblockindex->nHeight; + printf("first seq id is 1 and found height: %d\n",firsttxnHeight ); } else { BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end() && (*mi).second) { From baa6c490848933b036e5fcb89569807b66010f46 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Oct 2018 00:29:21 +0800 Subject: [PATCH 0355/4463] try this --- src/rpcblockchain.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index e383a87f7..53971e782 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -365,6 +365,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) int did1 = 0; int skippedtxs = 0; int failed = 0; + int getfirstblock = 0; static std::string streamid,firsttxid; static int firsttxnHeight; std::string blockdata; @@ -392,6 +393,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) ss >> seqid; if ( seqid == 1 ) { streamid = idstr; + getfirstblock = 1; } else if ( seqid == 2 ) { firsttxid = idstr; } else if (firsttxid.empty()) { @@ -403,7 +405,6 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) streamid.clear(); firsttxnHeight = 0; } - if ( seqid == (lastseqid + 1) || did1 == 0 ) { blockdata.append(data); } else { @@ -425,24 +426,22 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) } i = i + 1; } - if (streamid.empty()) { + if (streamid.empty() || getfirstblock == 1) { + if ( lastseqid == 1) { + firsttxid = block.vtx[1].GetHash().GetHex(); + } uint256 hash; CTransaction firsttx; uint256 firsttxid_256(uint256S(firsttxid)); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); streamid.append(firststreamid.substr (8,64)); printf("first stream id changed to: %s\n", streamid.c_str()); - if ( firstseqid == 1 ) { - firsttxnHeight == pblockindex->nHeight; - printf("first seq id is 1 and found height: %d\n",firsttxnHeight ); - } else { - BlockMap::iterator mi = mapBlockIndex.find(hash); - if (mi != mapBlockIndex.end() && (*mi).second) { - CBlockIndex* pindex = (*mi).second; - printf("found block height: %d\n",pindex->nHeight); - if (chainActive.Contains(pindex)) { - firsttxnHeight = pindex->nHeight; - } + BlockMap::iterator mi = mapBlockIndex.find(hash); + if (mi != mapBlockIndex.end() && (*mi).second) { + CBlockIndex* pindex = (*mi).second; + printf("found block height: %d\n",pindex->nHeight); + if (chainActive.Contains(pindex)) { + firsttxnHeight = pindex->nHeight; } } } From 99196bfb15664b1db67731259aee4d8ab4fb2432 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Oct 2018 00:35:18 +0800 Subject: [PATCH 0356/4463] fix --- src/rpcblockchain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 53971e782..07cf53ad2 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -433,8 +433,10 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) uint256 hash; CTransaction firsttx; uint256 firsttxid_256(uint256S(firsttxid)); if (GetTransaction(firsttxid_256,firsttx,hash,false)) { - std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); - streamid.append(firststreamid.substr (8,64)); + if ( streamid.empty() ) { + std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); + streamid.append(firststreamid.substr (8,64)); + } printf("first stream id changed to: %s\n", streamid.c_str()); BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end() && (*mi).second) { From 8d50000c49a41820b09a697a88b9814c68699aa3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 27 Oct 2018 01:34:24 +0800 Subject: [PATCH 0357/4463] try send in chunks --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 07cf53ad2..0a00a614c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -382,7 +382,7 @@ UniValue getdatafromblock(const UniValue& params, bool fHelp) skippedtxs = skippedtxs + 1; } else { std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); - // scriptPubKey is longer than 81, should mean its an OP_RETURN. + // scriptPubKey is longer than 81, should mean its an OP_RETURN, maybe also check vout == 0 ? if ( opretstr.size() > 81 ) { std::string idstr = opretstr.substr (8,64); // stream ID or txid std::string seqidstr = opretstr.substr (72,8); // sequence ID From 577cdc7da84b59aacdefdba9fef62d64e0e9a35f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 28 Oct 2018 04:36:20 +0800 Subject: [PATCH 0358/4463] add num entropy to diceinfo ? --- src/cc/dice.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 4271186da..95013944c 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -655,7 +655,7 @@ uint64_t AddDiceInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK return(totalinputs); } -int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbits,struct CCcontract_info *cp,CPubKey dicepk,uint256 reffundingtxid) +int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbits,struct CCcontract_info *cp,CPubKey dicepk,uint256 reffundingtxid,int64_t *entropytxs) { char coinaddr[64],str[65]; uint64_t sbits; int64_t nValue,totalinputs = 0; uint256 hash,txid,proof,hashBlock,fundingtxid; CScript fundingPubKey; CTransaction tx,vinTx; int32_t vout,first=0,n=0; uint8_t funcid; std::vector > unspentOutputs; @@ -734,6 +734,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit } } fprintf(stderr,"numentropy tx %d: %.8f\n",n,(double)totalinputs/COIN); + entropytxs = n; return(totalinputs); } @@ -826,7 +827,9 @@ UniValue DiceInfo(uint256 diceid) result.push_back(Pair("timeoutblocks",timeoutblocks)); cp = CCinit(&C,EVAL_DICE); dicepk = GetUnspendable(cp,0); - funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,diceid); + int64_t entropytxs = 0; + funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,diceid,entropytxs); + result.push_back(Pair("entropytxs",entropytxs)); sprintf(numstr,"%.8f",(double)funding/COIN); result.push_back(Pair("funding",numstr)); return(result); From 3c4a0b4f4d558f7684fcc75cce54693d6adadcb2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 28 Oct 2018 05:16:59 +0800 Subject: [PATCH 0359/4463] fix --- src/cc/dice.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 95013944c..d92a1711d 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -655,7 +655,7 @@ uint64_t AddDiceInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK return(totalinputs); } -int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbits,struct CCcontract_info *cp,CPubKey dicepk,uint256 reffundingtxid,int64_t *entropytxs) +int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbits,struct CCcontract_info *cp,CPubKey dicepk,uint256 reffundingtxid,int32_t *entropytxs) { char coinaddr[64],str[65]; uint64_t sbits; int64_t nValue,totalinputs = 0; uint256 hash,txid,proof,hashBlock,fundingtxid; CScript fundingPubKey; CTransaction tx,vinTx; int32_t vout,first=0,n=0; uint8_t funcid; std::vector > unspentOutputs; @@ -827,7 +827,7 @@ UniValue DiceInfo(uint256 diceid) result.push_back(Pair("timeoutblocks",timeoutblocks)); cp = CCinit(&C,EVAL_DICE); dicepk = GetUnspendable(cp,0); - int64_t entropytxs = 0; + int32_t entropytxs = 0; funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,diceid,entropytxs); result.push_back(Pair("entropytxs",entropytxs)); sprintf(numstr,"%.8f",(double)funding/COIN); @@ -958,7 +958,8 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet fprintf(stderr,"%s\n", CCerror.c_str() ); return(""); } - if ( (funding= DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid)) >= 2*bet*odds+txfee && entropyval != 0 ) + int32_t entropytxs; + if ( (funding= DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs)) >= 2*bet*odds+txfee && entropyval != 0 ) { if ( myIsutxo_spentinmempool(entropytxid,0) != 0 ) { From 5ff09e4e1a72b2ff6a89a56959af5180313216e4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 28 Oct 2018 05:18:47 +0800 Subject: [PATCH 0360/4463] try --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index d92a1711d..1e5446486 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -734,7 +734,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit } } fprintf(stderr,"numentropy tx %d: %.8f\n",n,(double)totalinputs/COIN); - entropytxs = n; + *entropytxs = n; return(totalinputs); } From d99b91584c2a681a292c7226db0d8f6493b2dd5d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 28 Oct 2018 05:22:11 +0800 Subject: [PATCH 0361/4463] fix --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 1e5446486..6fafaa1fd 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -655,7 +655,7 @@ uint64_t AddDiceInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK return(totalinputs); } -int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbits,struct CCcontract_info *cp,CPubKey dicepk,uint256 reffundingtxid,int32_t *entropytxs) +int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbits,struct CCcontract_info *cp,CPubKey dicepk,uint256 reffundingtxid,int32_t &entropytxs) { char coinaddr[64],str[65]; uint64_t sbits; int64_t nValue,totalinputs = 0; uint256 hash,txid,proof,hashBlock,fundingtxid; CScript fundingPubKey; CTransaction tx,vinTx; int32_t vout,first=0,n=0; uint8_t funcid; std::vector > unspentOutputs; From dc28cc1a8530096dc3d922ad49ee90f5881c9151 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 28 Oct 2018 05:23:54 +0800 Subject: [PATCH 0362/4463] fix --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 6fafaa1fd..c90ec0f06 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -734,7 +734,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit } } fprintf(stderr,"numentropy tx %d: %.8f\n",n,(double)totalinputs/COIN); - *entropytxs = n; + entropytxs = n; return(totalinputs); } From 26623a35919323754b9862b34ef3904a6e6c5f86 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 30 Oct 2018 22:43:33 +0800 Subject: [PATCH 0363/4463] remove dupe --- src/rpcserver.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index e8df01c53..653c786fe 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -264,7 +264,6 @@ static const CRPCCommand vRPCCommands[] = { "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */ { "control", "help", &help, true }, { "control", "stop", &stop, true }, - { "control", "setpubkey", &setpubkey, true }, /* P2P networking */ { "network", "getnetworkinfo", &getnetworkinfo, true }, From 53b0665f84928a97aa3f422ac27ff48bc015cb8e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 31 Oct 2018 12:08:17 +0800 Subject: [PATCH 0364/4463] start of commit --- src/komodo_globals.h | 4 ++-- src/komodo_utils.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index c456d3e44..569e29a5a 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -47,7 +47,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; -std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; +std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096]; @@ -55,7 +55,7 @@ uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT; uint32_t ASSETCHAINS_MAGIC = 2387029918; uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; -uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY = 10; +uint64_t ASSETCHAINS_FOUNDERS_REWARD,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY = 10; uint32_t KOMODO_INITDONE; char KMDUSERPASS[8192],BTCUSERPASS[8192]; uint16_t KMD_PORT = 7771,BITCOIND_RPCPORT = 7771; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index aedb6d3c2..445841596 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1561,7 +1561,10 @@ void komodo_args(char *argv0) ASSETCHAINS_DECAY = GetArg("-ac_decay",0); ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); + ASSETCHAINS_FOUNDERS_REWARD = GetArg("-ac_freward",0); + ASSETCHAINS_OVERRIDE_ADDRESS = GetArg("-ac_address",""); ASSETCHAINS_STREAM = GetArg("-ac_stream",0); + if ( ASSETCHAINS_STREAM != 0 && ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0 )) { printf("ASSETCHAINS_STREAM cannot be used with:\n ASSETCHAINS_COMMISSION \n ASSETCHAINS_ENDSUBSIDY\n ASSETCHAINS_REWARD\n ASSETCHAINS_HALVING\n ASSETCHAINS_DECAY\n ASSETCHAINS_PRIVATE\n"); exit(0); @@ -1595,8 +1598,8 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = 0; printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); } else if ( ASSETCHAINS_STREAM != 0) { - ASSETCHAINS_STREAM = 0; - printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! This parameter has been ignored! \n"); + printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! \n"); + exit(0); } if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SUPPLY == 10 ) { ASSETCHAINS_SUPPLY = 1000000; From e0235aa0367d000f37f10395a3bb9f58d4e590f2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 31 Oct 2018 12:20:06 +0800 Subject: [PATCH 0365/4463] Revert "Merge branch 'momom_printsonly' into master" This reverts commit e4e1c3874ee5e060d361489d2d75787cb093d623, reversing changes made to 9fbf73b63255c68d80652354f25a9e73afff0856. revert this stupid commit git made by accident! --- src/cc/import.cpp | 6 +----- src/crosschain.cpp | 6 +----- src/komodo.h | 34 +++++++++++++++++----------------- src/komodo_bitcoind.h | 17 ++++++++--------- src/notarisationdb.cpp | 8 ++++---- 5 files changed, 31 insertions(+), 40 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index b72124735..cc0c3b61f 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -79,11 +79,7 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - fprintf(stderr,"IMPORT momom: %s\n", momom.GetHex().data()); - FILE * fptr; - fptr = fopen("/home/cc/kmdmomom", "a+"); - fprintf(fptr, "%s\n", momom.GetHex().data()); - fclose(fptr); + printf("IMPORT momom: %s\n", momom.GetHex().data()); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 137e823ab..23416c682 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -162,11 +162,7 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ if (MoMoM.IsNull()) throw std::runtime_error("No MoMs found"); - printf("[%s] GetCrossChainProof MoMoM: %s\n", targetSymbol,MoMoM.GetHex().data()); - FILE * fptr; - fptr = fopen("/home/cc/acmomom", "a+"); - fprintf(fptr, "%s\n", MoMoM.GetHex().data()); - fclose(fptr); + printf("GetCrossChainProof MoMoM: %s\n", MoMoM.GetHex().data()); // Find index of source MoM in MoMoM int nIndex; diff --git a/src/komodo.h b/src/komodo.h index 1846fd25c..fb40c1e09 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -620,8 +620,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr notarized = 1; if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 ) notarized = 1; - //if ( 0 && opretlen != 149 ) - // printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset); + if ( 0 && opretlen != 149 ) + printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset); len += iguana_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&srchash); len += iguana_rwnum(0,&scriptbuf[len],sizeof(*notarizedheightp),(uint8_t *)notarizedheightp); if ( matched != 0 ) @@ -685,8 +685,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr else { komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata); - //if ( matched != 0 ) - // printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff); + if ( matched != 0 ) + printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff); } if ( MoMoMdata.pairs != 0 ) free(MoMoMdata.pairs); @@ -706,8 +706,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr sp->MoMdepth = MoMdepth; } komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->MoMdepth); - //if ( ASSETCHAINS_SYMBOL[0] != 0 ) - // printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { if ( signedfp == 0 ) @@ -733,8 +733,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr } } } - } //else if ( opretlen != 149 && height > 600000 && matched != 0 ) - //printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen); + } else if ( opretlen != 149 && height > 600000 && matched != 0 ) + printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen); } else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 ) { @@ -832,7 +832,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; iGetBlockTime()) == 0)) { - //printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); + printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); @@ -856,7 +856,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) printf("%02x",scriptPubKey[k]); printf(" scriptPubKey doesnt match any notary vini.%d of %d\n",j,numvins); } - } //else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); + } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || @@ -880,7 +880,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) fwrite(&signedmask,1,sizeof(signedmask),signedfp); fflush(signedfp); } - //printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); } notarized = 1; } @@ -917,20 +917,20 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { for (k=0; k 2 ) { @@ -959,8 +959,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { memset(&txhash,0,sizeof(txhash)); komodo_stateupdate(height,pubkeys,numvalid,0,txhash,0,0,0,0,0,0,0,0,0,0,zero,0); - //printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height); - } //else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries); + printf("RATIFIED! >>>>>>>>>> new notaries.%d newheight.%d from height.%d\n",numvalid,(((height+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,height); + } else printf("signedmask.%llx numvalid.%d wt.%d numnotaries.%d\n",(long long)signedmask,numvalid,bitweight(signedmask),numnotaries); } } } diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index ebc6b0c7f..86ed8f7b3 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -169,7 +169,7 @@ try_again: curl_handle = curl_easy_init(); init_string(&s); headers = curl_slist_append(0,"Expect:"); - + curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl_handle,CURLOPT_URL, url); @@ -198,7 +198,7 @@ try_again: bracket0 = (char *)"["; bracket1 = (char *)"]"; } - + databuf = (char *)malloc(256 + strlen(command) + strlen(params)); sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1); //printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf); @@ -238,7 +238,7 @@ try_again: free(s.ptr); sleep((1<= 10000 sats PoS stake must be without txfee and in the last tx in the block at vout[0] */ @@ -1336,7 +1336,6 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS); else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS); if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 ) - if ( ASSETCHAINS_STAKED < 100 ) { for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); @@ -1443,7 +1442,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ { if ( isPoS != 2 ) { - //fprintf(stderr,"ht.%d isPoS.%d utxo not validated -> must be PoW fake\n",height,isPoS); + fprintf(stderr,"ht.%d isPoS.%d utxo not validated -> must be PoW fake\n",height,isPoS); isPoS = 0; } else @@ -1451,7 +1450,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); if ( bhash < bnTarget ) { - //fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); + fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); isPoS = 0; } } diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index df17de2c7..68c00546b 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -41,10 +41,10 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp int staked_era = STAKED_era(timestamp); - //printf("ERA.(%d) \n",staked_era); + printf("ERA.(%d) \n",staked_era); if (staked_era == 0) { // this is an ERA GAP, so we will ignore this notarization - //printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); + printf("Notarization for %s occured inside an ERA GAP, we will ignore it! \n",data.symbol); continue; } else { // pass era slection off to notaries_staked.cpp file @@ -52,12 +52,12 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) } if (!CheckTxAuthority(tx, auth_STAKED)) continue; - //printf("Authorised notarisation data for %s \n",data.symbol); + printf("Authorised notarisation data for %s \n",data.symbol); } if (parsed) { vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); - //printf("Added notarisation data for %s \n",data.symbol); + printf("Added notarisation data for %s \n",data.symbol); //printf("Parsed a notarisation for: %s, txid:%s, ccid:%i, momdepth:%i\n", // data.symbol, tx.GetHash().GetHex().data(), data.ccId, data.MoMDepth); //if (!data.MoMoM.IsNull()) printf("MoMoM:%s\n", data.MoMoM.GetHex().data()); From de707f9e1fd68602e75662a99fc5c6a30639a593 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 31 Oct 2018 14:49:21 +0800 Subject: [PATCH 0366/4463] add some prints --- src/crosschain.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 23416c682..5ad4d69ee 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -68,6 +68,7 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh destNotarisationTxid = nota.first; else if (seenOwnNotarisations == 2) goto end; + fprintf(stderr, "kmd heigt notarisation added: %d\n",kmdHeight-i); break; } } @@ -75,8 +76,9 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh if (seenOwnNotarisations == 1) { BOOST_FOREACH(Notarisation& nota, notarisations) { if (GetSymbolAuthority(nota.second.symbol) == authority) - if (nota.second.ccId == targetCCid) - moms.push_back(nota.second.MoM); + if (nota.second.ccId == targetCCid) { + moms.push_back(nota.second.MoM); + fprintf(stderr, "added mom: %s\n",nota.second.MoM.GetHex().data()); } } } @@ -162,7 +164,11 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ if (MoMoM.IsNull()) throw std::runtime_error("No MoMs found"); - printf("GetCrossChainProof MoMoM: %s\n", MoMoM.GetHex().data()); + printf("[%s] GetCrossChainProof MoMoM: %s\n", targetSymbol,MoMoM.GetHex().data()); + FILE * fptr; + fptr = fopen("/home/cc/momom_on_kmd", "a+"); + fprintf(fptr, "%s\n", MoMoM.GetHex().data()); + fclose(fptr); // Find index of source MoM in MoMoM int nIndex; From f0cb2e1187d920e2b99bdf94c635474190378c3e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 31 Oct 2018 14:51:23 +0800 Subject: [PATCH 0367/4463] fix --- src/crosschain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 5ad4d69ee..37908f38e 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -79,6 +79,7 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh if (nota.second.ccId == targetCCid) { moms.push_back(nota.second.MoM); fprintf(stderr, "added mom: %s\n",nota.second.MoM.GetHex().data()); + } } } } From f46d51c08f5fbb05532c78b13abf6eb601e04b77 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 31 Oct 2018 15:16:06 +0800 Subject: [PATCH 0368/4463] fix? --- src/cc/import.cpp | 4 ++-- src/crosschain.cpp | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cc/import.cpp b/src/cc/import.cpp index cc0c3b61f..92e96fabb 100644 --- a/src/cc/import.cpp +++ b/src/cc/import.cpp @@ -78,8 +78,8 @@ bool Eval::ImportCoin(const std::vector params, const CTransaction &imp uint256 momom, target; if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); - - printf("IMPORT momom: %s\n", momom.GetHex().data()); + + fprintf(stderr,"IMPORT momom: %s\nKMD TX HASH: %s\n", momom.GetHex().data(),proof.first.GetHex().data()); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 37908f38e..2e512806e 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -166,10 +166,6 @@ TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_ throw std::runtime_error("No MoMs found"); printf("[%s] GetCrossChainProof MoMoM: %s\n", targetSymbol,MoMoM.GetHex().data()); - FILE * fptr; - fptr = fopen("/home/cc/momom_on_kmd", "a+"); - fprintf(fptr, "%s\n", MoMoM.GetHex().data()); - fclose(fptr); // Find index of source MoM in MoMoM int nIndex; From d1e85c5128866355fe7e61832aee2754692991b3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 1 Nov 2018 13:51:07 +0800 Subject: [PATCH 0369/4463] fix for notarisations in KMD more than 1 block. --- src/crosschain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index 2e512806e..982f67d8b 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -69,7 +69,7 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh else if (seenOwnNotarisations == 2) goto end; fprintf(stderr, "kmd heigt notarisation added: %d\n",kmdHeight-i); - break; + //break; } } @@ -78,7 +78,7 @@ uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeigh if (GetSymbolAuthority(nota.second.symbol) == authority) if (nota.second.ccId == targetCCid) { moms.push_back(nota.second.MoM); - fprintf(stderr, "added mom: %s\n",nota.second.MoM.GetHex().data()); + //fprintf(stderr, "added mom: %s\n",nota.second.MoM.GetHex().data()); } } } From 40fca878a2f3018f354e778da8a03648c2949dbe Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Thu, 1 Nov 2018 07:13:43 +0100 Subject: [PATCH 0370/4463] Add CFEK exception for testnet chains --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index e2170ba94..a803eeead 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -101,7 +101,7 @@ int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4)); int is_STAKED(const char *chain_name) { int STAKED = 0; - if ( (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) + if ( (strncmp(chain_name, "CFEK", 4) == 0) || (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) STAKED = 1; return(STAKED); }; From a190053bda4132347b80f49029a82817c17ed5cb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 1 Nov 2018 14:48:29 +0800 Subject: [PATCH 0371/4463] reset all eras to 2 years into future --- src/notaries_staked.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 526ad5f9b..10458d9ea 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -6,10 +6,10 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1537876325; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1537983525; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1538083525; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1548083525; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1604212834; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1604212834; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1604212834; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1604212834; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From 6055c2fe327f0d361ab20385b4f2d208b0d8dce9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 01:10:55 +0800 Subject: [PATCH 0372/4463] fix is_STAKED function --- src/notaries_staked.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index a803eeead..5a544a2e8 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -101,8 +101,12 @@ int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4)); int is_STAKED(const char *chain_name) { int STAKED = 0; - if ( (strncmp(chain_name, "CFEK", 4) == 0) || (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) + if ( (strcmp(chain_name, "STAKED") == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) STAKED = 1; + else if ( (strcmp(chain_name, "STKD") == 0) || (strncmp(chain_name, "STKD", 4) == 0) ) + STAKED = 2; + else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) + STAKED = 3; return(STAKED); }; From 427ff12734b6911843964278ba7e5e286ca89d91 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 01:42:23 +0800 Subject: [PATCH 0373/4463] add print to is_STAKED --- src/notaries_staked.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 5a544a2e8..264f2060a 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -107,6 +107,7 @@ int is_STAKED(const char *chain_name) { STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; + fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); return(STAKED); }; From 600f580dc5729efcb273d55120bfba8459602412 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 05:24:54 +0800 Subject: [PATCH 0374/4463] try --- src/notaries_staked.cpp | 2 +- src/wallet/wallet.cpp | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 264f2060a..966b41850 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -107,7 +107,7 @@ int is_STAKED(const char *chain_name) { STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; - fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); return(STAKED); }; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 47c93545b..0565d9ae4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -180,7 +180,7 @@ bool CWallet::AddKeyPubKey(const CKey& secret, const CPubKey &pubkey) bool CWallet::AddCryptedKey(const CPubKey &vchPubKey, const vector &vchCryptedSecret) { - + if (!CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret)) return false; if (!fFileBacked) @@ -520,7 +520,7 @@ bool CWallet::Verify(const string& walletFile, string& warningString, string& er } catch (const boost::filesystem::filesystem_error&) { // failure is ok (well, not really, but it's not worse than what we started with) } - + // try again if (!bitdb.Open(GetDataDir())) { // if it still fails, it probably means we can't even create the database env @@ -529,14 +529,14 @@ bool CWallet::Verify(const string& walletFile, string& warningString, string& er return true; } } - + if (GetBoolArg("-salvagewallet", false)) { // Recover readable keypairs: if (!CWalletDB::Recover(bitdb, walletFile, true)) return false; } - + if (boost::filesystem::exists(GetDataDir() / walletFile)) { CDBEnv::VerifyResult r = bitdb.Verify(walletFile, CWalletDB::Recover); @@ -550,7 +550,7 @@ bool CWallet::Verify(const string& walletFile, string& warningString, string& er if (r == CDBEnv::RECOVER_FAIL) errorString += _("wallet.dat corrupt, salvage failed"); } - + return true; } @@ -1202,6 +1202,13 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { + int64_t totalvoutvalue = 0; + for (size_t i = 0; i < tx.vout.size() ; i++) { + totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + fprintf(stderr, "total: %ld \nvout %d = %ld", totalvoutvalue, i, tx.vout[i].nValue); + } + + //if ( IsFromMe(tx) && tx.vout[0].value ) { AssertLockHeld(cs_wallet); bool fExisted = mapWallet.count(tx.GetHash()) != 0; @@ -2296,7 +2303,7 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const int nDepth = pcoin->GetDepthInMainChain(); if (nDepth < 0) continue; - + for (unsigned int i = 0; i < pcoin->vout.size(); i++) { isminetype mine = IsMine(pcoin->vout[i]); @@ -2642,7 +2649,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount &nFeeRet, int& nC CReserveKey reservekey(this); CWalletTx wtx; - + if (!CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePosRet, strFailReason, &coinControl, false)) return false; @@ -2708,7 +2715,7 @@ bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wt txNew.nExpiryHeight = nextBlockHeight + expiryDelta; } } - + { LOCK2(cs_main, cs_wallet); { @@ -3194,7 +3201,7 @@ bool CWallet::SetDefaultKey(const CPubKey &vchPubKey) /** * Mark old keypool keys as used, - * and generate all new keys + * and generate all new keys */ bool CWallet::NewKeyPool() { @@ -3902,7 +3909,7 @@ void CWallet::GetFilteredNotes( if (ignoreUnspendable && !HaveSpendingKey(pa)) { continue; } - + // skip locked notes if (IsLockedNote(jsop.hash, jsop.js, jsop.n)) { continue; From 8616d8e5f773bd16a79013bc67376aaecf3c7cbc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 05:28:55 +0800 Subject: [PATCH 0375/4463] ld --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0565d9ae4..a518674de 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1205,7 +1205,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "total: %ld \nvout %d = %ld", totalvoutvalue, i, tx.vout[i].nValue); + fprintf(stderr, "total: %ld \nvout %ld = %ld", totalvoutvalue, i, tx.vout[i].nValue); } //if ( IsFromMe(tx) && tx.vout[0].value ) From a5b17840a6b77338f083179f443accd78665048c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 05:40:58 +0800 Subject: [PATCH 0376/4463] fix --- src/wallet/wallet.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a518674de..b5fe66476 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,13 +1202,6 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { - int64_t totalvoutvalue = 0; - for (size_t i = 0; i < tx.vout.size() ; i++) { - totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "total: %ld \nvout %ld = %ld", totalvoutvalue, i, tx.vout[i].nValue); - } - - //if ( IsFromMe(tx) && tx.vout[0].value ) { AssertLockHeld(cs_wallet); bool fExisted = mapWallet.count(tx.GetHash()) != 0; @@ -1216,6 +1209,12 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl auto noteData = FindMyNotes(tx); if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { + int64_t totalvoutvalue = 0; + for (size_t i = 0; i < tx.vout.size() ; i++) { + totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + fprintf(stderr, "total: %ld \nvout %ld = %ld", totalvoutvalue, i, tx.vout[i].nValue); + } + CWalletTx wtx(this,tx); if (noteData.size() > 0) { From 3bbb29e600b5c0a7891f83f5a970cccf76b33dfd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 05:56:20 +0800 Subject: [PATCH 0377/4463] try print back --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 966b41850..264f2060a 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -107,7 +107,7 @@ int is_STAKED(const char *chain_name) { STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; - //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); return(STAKED); }; From a2cec89073a02a16700da10c8b0c118a59d1465a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 05:59:49 +0800 Subject: [PATCH 0378/4463] fix era --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 10458d9ea..fbb3506ba 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1604212834; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1604222222; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From c0fa673964ffdfb1101ab9f3bd364fcea7a96afd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 06:05:24 +0800 Subject: [PATCH 0379/4463] remove print --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 264f2060a..966b41850 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -107,7 +107,7 @@ int is_STAKED(const char *chain_name) { STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; - fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); return(STAKED); }; From 203e3004f848e9d81956ea467927a35d991b103e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 06:13:32 +0800 Subject: [PATCH 0380/4463] try --- src/wallet/wallet.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index b5fe66476..311264419 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1207,14 +1207,23 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); - if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) + bool mine = IsMine(tx); + bool isent = IsFromMe(tx); + + if ( isent ) + fprintf(stderr, "I sent this tx ?\n"); + + if (mine) + fprintf(stderr, "I reveived it ? \n"); + + if (fExisted || mine || isent || noteData.size() > 0) { int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "total: %ld \nvout %ld = %ld", totalvoutvalue, i, tx.vout[i].nValue); + fprintf(stderr, "total: %ld \nvout %ld = %ld\n", totalvoutvalue, i, tx.vout[i].nValue); } - + CWalletTx wtx(this,tx); if (noteData.size() > 0) { From 287ddc4a6b220a605d9137abd652d00a5b118bd5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 06:37:38 +0800 Subject: [PATCH 0381/4463] try --- src/wallet/wallet.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 311264419..9f7ba37c6 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1210,18 +1210,19 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl bool mine = IsMine(tx); bool isent = IsFromMe(tx); - if ( isent ) - fprintf(stderr, "I sent this tx ?\n"); - - if (mine) - fprintf(stderr, "I reveived it ? \n"); - if (fExisted || mine || isent || noteData.size() > 0) { int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "total: %ld \nvout %ld = %ld\n", totalvoutvalue, i, tx.vout[i].nValue); + if (IsChange(tx.vout[i])) { + fprintf(stderr, "tx %ld is change of: %ld\n",i, tx.vout[i].nValue ); + } else { + totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + + fprintf(stderr, "this is not change? total: %ld \nvout %ld = %ld", totalvoutvalue, i, tx.vout[i].nValue); + } + } CWalletTx wtx(this,tx); From 023ee98af06fe02dc612885b434bb0684e0030ee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 06:48:40 +0800 Subject: [PATCH 0382/4463] fix --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9f7ba37c6..9269817c4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1219,8 +1219,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl fprintf(stderr, "tx %ld is change of: %ld\n",i, tx.vout[i].nValue ); } else { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - - fprintf(stderr, "this is not change? total: %ld \nvout %ld = %ld", totalvoutvalue, i, tx.vout[i].nValue); + + fprintf(stderr, "this is not change? vout %ld = %ld\n", totalvoutvalue, i, tx.vout[i].nValue); } } From dbf49cd4d2c0d770711af73ae80fd886d8ebed49 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 06:54:50 +0800 Subject: [PATCH 0383/4463] try --- src/wallet/wallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9269817c4..396f0d167 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1207,14 +1207,14 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); - bool mine = IsMine(tx); - bool isent = IsFromMe(tx); - if (fExisted || mine || isent || noteData.size() > 0) + if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + if ( IsMine(tx.vout[i].prevout) ) + fprintf(stderr, "prevout is mine? %s\n"); if (IsChange(tx.vout[i])) { fprintf(stderr, "tx %ld is change of: %ld\n",i, tx.vout[i].nValue ); } else { From 0737f32e4d655c1c4748b224ef471281450b54c7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 07:07:32 +0800 Subject: [PATCH 0384/4463] try --- src/wallet/wallet.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 396f0d167..75d0a2d3e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1210,11 +1210,15 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { + + if ( IsMine(tx.vin[0].prevout) ) + fprintf(stderr, "prevout is mine? %s\n"); + + int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - if ( IsMine(tx.vout[i].prevout) ) - fprintf(stderr, "prevout is mine? %s\n"); + if (IsChange(tx.vout[i])) { fprintf(stderr, "tx %ld is change of: %ld\n",i, tx.vout[i].nValue ); } else { From d83243962d41be4dc31d33cabed78caa88d101f0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 07:10:39 +0800 Subject: [PATCH 0385/4463] a --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 75d0a2d3e..1b4395b9a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1211,7 +1211,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - if ( IsMine(tx.vin[0].prevout) ) + if ( IsMine(tx) ) fprintf(stderr, "prevout is mine? %s\n"); From 08241004e190867981e1b6b7d02ae172ade02fa4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 07:23:48 +0800 Subject: [PATCH 0386/4463] try --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1b4395b9a..10a46c547 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1212,7 +1212,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if ( IsMine(tx) ) - fprintf(stderr, "prevout is mine? %s\n"); + fprintf(stderr, "prevout is mine? %s\n",tx.vin[0].prevout.hash..ToString().c_str()]); int64_t totalvoutvalue = 0; From 43104ff55c4c584bdb532fda26288b498495a459 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 07:30:46 +0800 Subject: [PATCH 0387/4463] oo --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 10a46c547..4ecc12d9d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1212,7 +1212,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if ( IsMine(tx) ) - fprintf(stderr, "prevout is mine? %s\n",tx.vin[0].prevout.hash..ToString().c_str()]); + fprintf(stderr, "prevout is mine? %s\n",tx.vin[0].prevout.hash.ToString().c_str()); int64_t totalvoutvalue = 0; From 6ea2be525feb60a679d0ce241d4536ddc4fcfa69 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 07:44:34 +0800 Subject: [PATCH 0388/4463] oops --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4ecc12d9d..5b0b914ed 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1224,7 +1224,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } else { totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "this is not change? vout %ld = %ld\n", totalvoutvalue, i, tx.vout[i].nValue); + fprintf(stderr, "this is not change? vout %ld = %ld\n", i, tx.vout[i].nValue); } } From 0d9cf86b64a69c9b6b33ae8ce80910b80e0d8193 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:16:16 +0800 Subject: [PATCH 0389/4463] try --- src/wallet/wallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5b0b914ed..8b91e3c2a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1211,8 +1211,11 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - if ( IsMine(tx) ) - fprintf(stderr, "prevout is mine? %s\n",tx.vin[0].prevout.hash.ToString().c_str()); + CTransaction tx; + uint256 hashBlock; + GetTransaction(tx.vin[0].prevout.hash,tx,hashBlock,false) + + fprintf(stderr, "vin 1 script pubkey : %s\n",tx.vout[0].scriptPubKey); int64_t totalvoutvalue = 0; From 4bce36c1ade6f550a8c181ffc27208538b548f99 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:22:42 +0800 Subject: [PATCH 0390/4463] try --- src/wallet/wallet.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8b91e3c2a..096966452 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1211,12 +1211,18 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - CTransaction tx; + CTransaction txin; uint256 hashBlock; - GetTransaction(tx.vin[0].prevout.hash,tx,hashBlock,false) + GetTransaction(tx.vin[0].prevout.hash,txin,hashBlock,false); - fprintf(stderr, "vin 1 script pubkey : %s\n",tx.vout[0].scriptPubKey); + fprintf(stderr, "vin 0 script pubkey : %s\n",txin.vout[0].scriptPubKey); + CTxDestination address; + ExtractDestination(txin.vout[0].scriptPubKey, address) + + LOCK(cs_wallet); + if (!mapAddressBook.count(address)) + fprintf(stderr, "vin 0 address is in my wallet \n" ); int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { From 05b2d67fc4e439173e9d1456f3f507e49beef981 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:24:55 +0800 Subject: [PATCH 0391/4463] fix --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 096966452..335861e72 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1215,7 +1215,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl uint256 hashBlock; GetTransaction(tx.vin[0].prevout.hash,txin,hashBlock,false); - fprintf(stderr, "vin 0 script pubkey : %s\n",txin.vout[0].scriptPubKey); + fprintf(stderr, "vin 0 script pubkey : %s\n",txin.vout[0].scriptPubKey.ToString().c_str()); CTxDestination address; ExtractDestination(txin.vout[0].scriptPubKey, address) From db2460a381d0d1312462e63098983f4095048685 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:26:04 +0800 Subject: [PATCH 0392/4463] ; modified: src/wallet/wallet.cpp --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 335861e72..5b710a64c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1218,7 +1218,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl fprintf(stderr, "vin 0 script pubkey : %s\n",txin.vout[0].scriptPubKey.ToString().c_str()); CTxDestination address; - ExtractDestination(txin.vout[0].scriptPubKey, address) + ExtractDestination(txin.vout[0].scriptPubKey, address); LOCK(cs_wallet); if (!mapAddressBook.count(address)) From 750f8351063034a30fa6a1ea2dfb2f17060c79c9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:29:36 +0800 Subject: [PATCH 0393/4463] try --- src/wallet/wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5b710a64c..afe2d8565 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1215,6 +1215,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl uint256 hashBlock; GetTransaction(tx.vin[0].prevout.hash,txin,hashBlock,false); + fprintf(stderr, "vin tx hash: %s\n", tx.vin[0].prevout.hash.ToString().c_str()); + fprintf(stderr, "vin 0 script pubkey : %s\n",txin.vout[0].scriptPubKey.ToString().c_str()); CTxDestination address; From aaab9bf85d304efec6cb49ec7af3d4c2df26a744 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:40:36 +0800 Subject: [PATCH 0394/4463] try this --- src/wallet/wallet.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index afe2d8565..65121caf8 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1210,21 +1210,17 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - - CTransaction txin; - uint256 hashBlock; - GetTransaction(tx.vin[0].prevout.hash,txin,hashBlock,false); - - fprintf(stderr, "vin tx hash: %s\n", tx.vin[0].prevout.hash.ToString().c_str()); - - fprintf(stderr, "vin 0 script pubkey : %s\n",txin.vout[0].scriptPubKey.ToString().c_str()); - - CTxDestination address; - ExtractDestination(txin.vout[0].scriptPubKey, address); - - LOCK(cs_wallet); - if (!mapAddressBook.count(address)) - fprintf(stderr, "vin 0 address is in my wallet \n" ); + uint256 hash; CTransaction txin; + if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) + { + printf("CHECKING THE script pubkey\n"); + script = (uint8_t *)txin.vout[tx.vin[0].prevout.n].scriptPubKey.data(); + if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,NOTARY_PUBKEY33,33) != 0 ) { + printf("vin 0 prevout is from some other kunt!\n"); + //return(-1); + } + printf("vin 0 prevvout is from our pubkey \n"); + } int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vout.size() ; i++) { From f8e62200d09478ea43a7dd12796ade80e0622800 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:42:30 +0800 Subject: [PATCH 0395/4463] delcare --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 65121caf8..f4b1ef2a8 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1210,7 +1210,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - uint256 hash; CTransaction txin; + uint256 hash; CTransaction txin; uint8_t *script; if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) { printf("CHECKING THE script pubkey\n"); From 151847b000ac63acf1fabbdb4dc25f2cf15ef509 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:44:30 +0800 Subject: [PATCH 0396/4463] fix --- src/wallet/wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f4b1ef2a8..b3d7ac2c0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1200,6 +1200,8 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) * pblock is optional, but should be provided if the transaction is known to be in a block. * If fUpdate is true, existing transactions will be updated. */ +extern uint8_t NOTARY_PUBKEY33[33]; + bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { { From 5fdb5772a80be2321c03ebf27dc102d4c0fef524 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 08:47:31 +0800 Subject: [PATCH 0397/4463] fix --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index b3d7ac2c0..ebad28293 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1220,8 +1220,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,NOTARY_PUBKEY33,33) != 0 ) { printf("vin 0 prevout is from some other kunt!\n"); //return(-1); - } - printf("vin 0 prevvout is from our pubkey \n"); + } else + printf("vin 0 prevvout is from our pubkey \n"); } int64_t totalvoutvalue = 0; From d21d7f6c798805aa521cc9a6ee2c6b8766268dcb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 09:10:19 +0800 Subject: [PATCH 0398/4463] try --- src/wallet/wallet.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ebad28293..fcb96dcab 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1212,16 +1212,13 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - uint256 hash; CTransaction txin; uint8_t *script; - if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) + uint256 hash; CTransaction txin; CTxDestination address; + if (GetTransaction(tx.prevout.hash,txin,hash,false)) { - printf("CHECKING THE script pubkey\n"); - script = (uint8_t *)txin.vout[tx.vin[0].prevout.n].scriptPubKey.data(); - if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,NOTARY_PUBKEY33,33) != 0 ) { - printf("vin 0 prevout is from some other kunt!\n"); - //return(-1); - } else - printf("vin 0 prevvout is from our pubkey \n"); + if (ExtractDestination(txin.vout[tx.prevout.n].scriptPubKey, address)) { + if (mapAddressBook.count(address)) + fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString()); + } } int64_t totalvoutvalue = 0; From 580cea6efcad51799cf2487b75ce453a05897938 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 09:14:02 +0800 Subject: [PATCH 0399/4463] fix --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fcb96dcab..697deff97 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1213,9 +1213,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { uint256 hash; CTransaction txin; CTxDestination address; - if (GetTransaction(tx.prevout.hash,txin,hash,false)) + if (GetTransaction(tx.vout[0].prevout.hash,txin,hash,false)) { - if (ExtractDestination(txin.vout[tx.prevout.n].scriptPubKey, address)) { + if (ExtractDestination(txin.vout[tx.vout[0].prevout.n].scriptPubKey, address)) { if (mapAddressBook.count(address)) fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString()); } From 36957b0a7d9cb4491ac7a95def3138b31e2c2d22 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 09:17:09 +0800 Subject: [PATCH 0400/4463] fix vin --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 697deff97..0ca9a077d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1213,9 +1213,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { uint256 hash; CTransaction txin; CTxDestination address; - if (GetTransaction(tx.vout[0].prevout.hash,txin,hash,false)) + if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) { - if (ExtractDestination(txin.vout[tx.vout[0].prevout.n].scriptPubKey, address)) { + if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { if (mapAddressBook.count(address)) fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString()); } From 496c0b2ac6396a3eb6c62b6737a4fc05f9416c52 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 09:18:39 +0800 Subject: [PATCH 0401/4463] fix --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0ca9a077d..0f2ab284e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1217,7 +1217,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { if (mapAddressBook.count(address)) - fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString()); + fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); } } From 0ea25a07b1bcd6727395d503199f07011468ea80 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 09:22:06 +0800 Subject: [PATCH 0402/4463] try --- src/wallet/wallet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0f2ab284e..6dcd9ecc2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1216,6 +1216,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { + fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); if (mapAddressBook.count(address)) fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); } From 73c0dd2b2e9e8703ccd4941a252fa3d28baaa4b3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 09:42:53 +0800 Subject: [PATCH 0403/4463] getting close --- src/wallet/wallet.cpp | 48 ++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6dcd9ecc2..388f0e47b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1212,29 +1212,35 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - uint256 hash; CTransaction txin; CTxDestination address; - if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) - { - if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { - fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - if (mapAddressBook.count(address)) - fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - } + int numvinIsOurs, numvoutIsOurs; int64_t totalvoutvalue; + for (size_t i = 0; i < tx.vin.size(); i++) { + uint256 hash; CTransaction txin; CTxDestination address; + if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) + { + if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { + //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); + if (!mapAddressBook.count(address)) { + fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); + numvinIsOurs++; + } + } + } } - - int64_t totalvoutvalue = 0; - for (size_t i = 0; i < tx.vout.size() ; i++) { - totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - - if (IsChange(tx.vout[i])) { - fprintf(stderr, "tx %ld is change of: %ld\n",i, tx.vout[i].nValue ); - } else { - totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - - fprintf(stderr, "this is not change? vout %ld = %ld\n", i, tx.vout[i].nValue); - } - + if ( numvinIsOurs == 0 ) { + for (size_t i = 0; i < tx.vout.size() ; i++) { + CTxDestination address2; + if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { + if (!mapAddressBook.count(address2)) { + fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); + numvoutIsOurs++; + totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + } + } + } + } else if ( numvinIsOurs < tx.vin.size() ) { + fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } + fprintf(stderr, "total sent from some other kunts to us is : %ldsats\n", totalvoutvalue); CWalletTx wtx(this,tx); From b14b985d7d38d5d603ccad346e7589060982642b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:01:10 +0800 Subject: [PATCH 0404/4463] backwards --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 388f0e47b..95f36b801 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1230,7 +1230,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if (!mapAddressBook.count(address2)) { + if (mapAddressBook.count(address2)) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From 0ec91dd3a9e4ed7e757ac8d9a5a5f791a93c0242 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:23:56 +0800 Subject: [PATCH 0405/4463] try --- src/wallet/wallet.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 95f36b801..53d75c522 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,6 +1202,15 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; +bool RaddIsPubkey(char *address) { + char exaddress[18]; + pubkey2addr((char *)exaddress[i],(uint8_t *)NOTARY_PUBKEY33); + for (i=0; i<=17; i++) + if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) + return true; + return false +} + bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { { @@ -1219,10 +1228,10 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - if (!mapAddressBook.count(address)) { - fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); + if ( RaddIsPubkey(CBitcoinAddress(address).ToString().c_str()) == true ) { numvinIsOurs++; - } + fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); + } } } } @@ -1230,7 +1239,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if (mapAddressBook.count(address2)) { + if ( RaddIsPubkey(CBitcoinAddress(address).ToString().c_str()) == true ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From e836e146a3f196b0e36a38395313a341c1c15c31 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:25:22 +0800 Subject: [PATCH 0406/4463] fix --- src/wallet/wallet.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 53d75c522..77bc46304 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1205,9 +1205,8 @@ extern uint8_t NOTARY_PUBKEY33[33]; bool RaddIsPubkey(char *address) { char exaddress[18]; pubkey2addr((char *)exaddress[i],(uint8_t *)NOTARY_PUBKEY33); - for (i=0; i<=17; i++) - if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) - return true; + if ( strcmp(coinaddr,exaddress) == 0 ) + return true; return false } From dd18452d2096335d05cb3c0e8aa415b1a3fe50d3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:27:19 +0800 Subject: [PATCH 0407/4463] fix? --- src/wallet/wallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 77bc46304..fc60c4bf0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1201,10 +1201,11 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) * If fUpdate is true, existing transactions will be updated. */ extern uint8_t NOTARY_PUBKEY33[33]; +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); bool RaddIsPubkey(char *address) { char exaddress[18]; - pubkey2addr((char *)exaddress[i],(uint8_t *)NOTARY_PUBKEY33); + pubkey2addr((char *)exaddress,(uint8_t *)NOTARY_PUBKEY33); if ( strcmp(coinaddr,exaddress) == 0 ) return true; return false From 958095444dfa50662fe13634293e1539ae2cf6ab Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:28:43 +0800 Subject: [PATCH 0408/4463] fix --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fc60c4bf0..e8c0af281 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1206,7 +1206,7 @@ bool pubkey2addr(char *destaddr,uint8_t *pubkey33); bool RaddIsPubkey(char *address) { char exaddress[18]; pubkey2addr((char *)exaddress,(uint8_t *)NOTARY_PUBKEY33); - if ( strcmp(coinaddr,exaddress) == 0 ) + if ( strcmp(address,exaddress) == 0 ) return true; return false } @@ -1239,7 +1239,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if ( RaddIsPubkey(CBitcoinAddress(address).ToString().c_str()) == true ) { + if ( RaddIsPubkey(CBitcoinAddress(address2).ToString().c_str()) == true ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From f699248ef187624a223ba69c7304f2e1932030e8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:29:29 +0800 Subject: [PATCH 0409/4463] ; --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e8c0af281..ea892d2ba 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1208,7 +1208,7 @@ bool RaddIsPubkey(char *address) { pubkey2addr((char *)exaddress,(uint8_t *)NOTARY_PUBKEY33); if ( strcmp(address,exaddress) == 0 ) return true; - return false + return false; } bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) From 2d82fd3f29825265ee38ac6dd74c606ee6caded2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:30:49 +0800 Subject: [PATCH 0410/4463] fix --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ea892d2ba..538eb3d54 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1228,7 +1228,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - if ( RaddIsPubkey(CBitcoinAddress(address).ToString().c_str()) == true ) { + if ( RaddIsPubkey((char *)CBitcoinAddress(address).ToString().c_str()) == true ) { numvinIsOurs++; fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); } @@ -1239,7 +1239,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if ( RaddIsPubkey(CBitcoinAddress(address2).ToString().c_str()) == true ) { + if ( RaddIsPubkey((char *)CBitcoinAddress(address2).ToString().c_str()) == true ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From 18b9025ffc566a1debb263e8a08772bfe4bbb6d6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:38:45 +0800 Subject: [PATCH 0411/4463] try --- src/wallet/wallet.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 538eb3d54..a6c4a8486 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1201,7 +1201,7 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) * If fUpdate is true, existing transactions will be updated. */ extern uint8_t NOTARY_PUBKEY33[33]; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); +bool pubkey2addr(char destaddr,uint8_t *pubkey33); bool RaddIsPubkey(char *address) { char exaddress[18]; @@ -1228,7 +1228,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - if ( RaddIsPubkey((char *)CBitcoinAddress(address).ToString().c_str()) == true ) { + char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()) + if ( RaddIsPubkey(chraddress) == true ) { numvinIsOurs++; fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); } @@ -1239,7 +1240,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if ( RaddIsPubkey((char *)CBitcoinAddress(address2).ToString().c_str()) == true ) { + char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()) + if ( RaddIsPubkey(chraddress) == true ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From ea856ec7b3281b3ebd5a4e31a8e9dfd4c81087d7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:40:15 +0800 Subject: [PATCH 0412/4463] try --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a6c4a8486..59bbf3731 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1228,7 +1228,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()) + char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()); if ( RaddIsPubkey(chraddress) == true ) { numvinIsOurs++; fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); @@ -1240,7 +1240,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()) + char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()); if ( RaddIsPubkey(chraddress) == true ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; From 997c7844a57b200d83e302efa8ac76f1dc82ef29 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:52:39 +0800 Subject: [PATCH 0413/4463] try this --- src/komodo_globals.h | 2 +- src/wallet/rpcwallet.cpp | 4 ++-- src/wallet/wallet.cpp | 15 +++------------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 33d269793..133743c52 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -47,7 +47,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; -std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; +std::string NOTARY_ADDRESS,ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096]; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 56793f78b..d9255ce70 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4989,7 +4989,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) char Raddress[18]; uint8_t pubkey33[33]; extern uint8_t NOTARY_PUBKEY33[]; - extern std::string NOTARY_PUBKEY; + extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; if ( NOTARY_PUBKEY33[0] == 0 ) { if (strlen(params[0].get_str().c_str()) == 66) { decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); @@ -5002,7 +5002,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if (isValid) { CTxDestination dest = address.Get(); - string currentAddress = address.ToString(); + string currentAddress = address.ToString() = NOTARY_ADDRESS; result.push_back(Pair("address", currentAddress)); #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 59bbf3731..d2767fa1e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1201,16 +1201,9 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) * If fUpdate is true, existing transactions will be updated. */ extern uint8_t NOTARY_PUBKEY33[33]; +extern std::string NOTARY_ADDRESS; bool pubkey2addr(char destaddr,uint8_t *pubkey33); -bool RaddIsPubkey(char *address) { - char exaddress[18]; - pubkey2addr((char *)exaddress,(uint8_t *)NOTARY_PUBKEY33); - if ( strcmp(address,exaddress) == 0 ) - return true; - return false; -} - bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { { @@ -1228,8 +1221,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()); - if ( RaddIsPubkey(chraddress) == true ) { + if ( strcmp(CBitcoinAddress(address).ToString().c_str(),NOTARY_ADDRESS) == 0 ) { numvinIsOurs++; fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); } @@ -1240,8 +1232,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - char chraddress[18]; strcpy(chraddress,CBitcoinAddress(address).ToString().c_str()); - if ( RaddIsPubkey(chraddress) == true ) { + if ( strcmp(CBitcoinAddress(address2).ToString().c_str(),NOTARY_ADDRESS) == 0 ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From 4b044d68f0da67b361abdabd6aebb34357c9bb87 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:54:51 +0800 Subject: [PATCH 0414/4463] fix --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d2767fa1e..085ee14ce 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1221,7 +1221,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); - if ( strcmp(CBitcoinAddress(address).ToString().c_str(),NOTARY_ADDRESS) == 0 ) { + if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { numvinIsOurs++; fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); } @@ -1232,7 +1232,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if ( strcmp(CBitcoinAddress(address2).ToString().c_str(),NOTARY_ADDRESS) == 0 ) { + if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; From cddd4eebf45b30f24e8427c5355da434a7e81000 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 10:57:52 +0800 Subject: [PATCH 0415/4463] oops --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d9255ce70..2d5644ced 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5002,7 +5002,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if (isValid) { CTxDestination dest = address.Get(); - string currentAddress = address.ToString() = NOTARY_ADDRESS; + string currentAddress = NOTARY_ADDRESS = address.ToString(); result.push_back(Pair("address", currentAddress)); #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; From 5ecc6857c45998901841653710ad5bfaff828295 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 11:07:52 +0800 Subject: [PATCH 0416/4463] try --- src/wallet/wallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 085ee14ce..f27046767 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1223,7 +1223,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { numvinIsOurs++; - fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); + fprintf(stderr, "address on prev vin is in wallet: %s and numvins ours so far is: %d\n",CBitcoinAddress(address).ToString().c_str(),numvinIsOurs); } } } @@ -1233,16 +1233,16 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { - fprintf(stderr, "vout is to our address: %s\n",CBitcoinAddress(address2).ToString().c_str()); numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + fprintf(stderr, "vout is to our address: %s num vout so far is: %d and total sats: %ld\n",NOTARY_ADDRESS,numvoutIsOurs,totalvoutvalue); } } } } else if ( numvinIsOurs < tx.vin.size() ) { fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } - fprintf(stderr, "total sent from some other kunts to us is : %ldsats\n", totalvoutvalue); + //fprintf(stderr, "total sent from some other kunts to us is : %ldsats\n", totalvoutvalue); CWalletTx wtx(this,tx); From 588b53717cbe1861c0990387914b7529961a1195 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 11:14:16 +0800 Subject: [PATCH 0417/4463] poo --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f27046767..637b98448 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1214,7 +1214,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - int numvinIsOurs, numvoutIsOurs; int64_t totalvoutvalue; + int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { uint256 hash; CTransaction txin; CTxDestination address; if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) @@ -1235,7 +1235,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "vout is to our address: %s num vout so far is: %d and total sats: %ld\n",NOTARY_ADDRESS,numvoutIsOurs,totalvoutvalue); + fprintf(stderr, "vout is to our address: %s num vout so far is: %d and total sats: %ld\n",NOTARY_ADDRESS.c_str(),numvoutIsOurs,totalvoutvalue); } } } From de3bc9d0c2410ce9a4b2db43713dbec079ab04ef Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 11:33:44 +0800 Subject: [PATCH 0418/4463] fix --- src/wallet/wallet.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 637b98448..2e1664188 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1220,29 +1220,34 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) { if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { - //fprintf(stderr, "address on prev vin is in wallet: %s\n",CBitcoinAddress(address).ToString().c_str()); + // This means we sent the tx.. if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { numvinIsOurs++; - fprintf(stderr, "address on prev vin is in wallet: %s and numvins ours so far is: %d\n",CBitcoinAddress(address).ToString().c_str(),numvinIsOurs); } } } } + // No we know if it was a tx we sent, if it was all ours, we leave and let add to wallet. + fprintf(stderr, "address: %s sent vouts: %d\n",CBitcoinAddress(address).ToString().c_str(),numvinIsOurs); if ( numvinIsOurs == 0 ) { for (size_t i = 0; i < tx.vout.size() ; i++) { CTxDestination address2; if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { + // this should be a received tx.. numvoutIsOurs++; totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - fprintf(stderr, "vout is to our address: %s num vout so far is: %d and total sats: %ld\n",NOTARY_ADDRESS.c_str(),numvoutIsOurs,totalvoutvalue); } } } + fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); + // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. + + } else if ( numvinIsOurs < tx.vin.size() ) { + // this means we were in a multi sig, we wil remove the utxo we spent from our wallet and nothing else. fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } - //fprintf(stderr, "total sent from some other kunts to us is : %ldsats\n", totalvoutvalue); CWalletTx wtx(this,tx); From b9316f3b8d1e2ec6f8f16b484733d72cd3ad811a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 12:22:00 +0800 Subject: [PATCH 0419/4463] looking good --- src/wallet/wallet.cpp | 68 ++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 2e1664188..5a0014ed4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1214,39 +1214,47 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; - for (size_t i = 0; i < tx.vin.size(); i++) { - uint256 hash; CTransaction txin; CTxDestination address; - if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) - { - if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { - // This means we sent the tx.. - if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { - numvinIsOurs++; - } - } - } - } - // No we know if it was a tx we sent, if it was all ours, we leave and let add to wallet. - fprintf(stderr, "address: %s sent vouts: %d\n",CBitcoinAddress(address).ToString().c_str(),numvinIsOurs); - if ( numvinIsOurs == 0 ) { - for (size_t i = 0; i < tx.vout.size() ; i++) { - CTxDestination address2; - if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { - // this should be a received tx.. - numvoutIsOurs++; - totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; - } + if ( NOTARY_ADDRESS != "" ) + { + int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; + for (size_t i = 0; i < tx.vin.size(); i++) { + uint256 hash; CTransaction txin; CTxDestination address; + if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) + { + if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { + // This means we sent the tx.. + if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { + numvinIsOurs++; + } + } } } - fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); - // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. + // Now we know if it was a tx we sent, if it was all ours, we leave and let add to wallet. + fprintf(stderr, "address: %s sent vouts: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs); + if ( numvinIsOurs == 0 ) { + for (size_t i = 0; i < tx.vout.size() ; i++) { + CTxDestination address2; + if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { + if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { + // this should be a received tx.. + numvoutIsOurs++; + totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + } + } + } + fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); + // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. + int64_t avgVoutSize = totalvoutvalue \ numvoutIsOurs; + if ( avgVoutSize < 100000000 ) { + // average vout size is less than 1 coin, we will ignore it + fprintf(stderr, "ignored: %d vouts average size of %ld sats.\n",numvoutIsOurs, avgVoutSize); + return false; + } - - } else if ( numvinIsOurs < tx.vin.size() ) { - // this means we were in a multi sig, we wil remove the utxo we spent from our wallet and nothing else. - fprintf(stderr, "There are vins that are not ours, notarisation?\n"); + } else if ( numvinIsOurs < tx.vin.size() ) { + // this means we were in a multi sig, we wil remove the utxo we spent from our wallet and do nothing else. + fprintf(stderr, "There are vins that are not ours, notarisation?\n"); + } } CWalletTx wtx(this,tx); From 8649c79024f321e96393af9f2bcebc312b54f6d9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 12:23:01 +0800 Subject: [PATCH 0420/4463] / --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5a0014ed4..6731d40f0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1244,7 +1244,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. - int64_t avgVoutSize = totalvoutvalue \ numvoutIsOurs; + int64_t avgVoutSize = totalvoutvalue / numvoutIsOurs; if ( avgVoutSize < 100000000 ) { // average vout size is less than 1 coin, we will ignore it fprintf(stderr, "ignored: %d vouts average size of %ld sats.\n",numvoutIsOurs, avgVoutSize); From c800e8f376240d343c664d40f48281840471800b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:27:27 +0800 Subject: [PATCH 0421/4463] try add Raddress for -pubkey --- src/komodo_utils.h | 6 +++++- src/wallet/rpcwallet.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ef33bd56b..4153aebca 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1485,6 +1485,10 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) for (i=0; i<33; i++) sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]); pubkeystr[66] = 0; + char Raddress[18]; + pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + //CBitcoinAddress address(Raddress); + NOTARY_ADDRESS = Raddress.ToString(); komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } @@ -1564,7 +1568,7 @@ void komodo_args(char *argv0) ASSETCHAINS_FOUNDERS_REWARD = GetArg("-ac_freward",0); ASSETCHAINS_OVERRIDE_ADDRESS = GetArg("-ac_address",""); ASSETCHAINS_STREAM = GetArg("-ac_stream",0); - + if ( ASSETCHAINS_STREAM != 0 && ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0 )) { printf("ASSETCHAINS_STREAM cannot be used with:\n ASSETCHAINS_COMMISSION \n ASSETCHAINS_ENDSUBSIDY\n ASSETCHAINS_REWARD\n ASSETCHAINS_HALVING\n ASSETCHAINS_DECAY\n ASSETCHAINS_PRIVATE\n"); exit(0); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2d5644ced..862df0c0f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5002,8 +5002,8 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if (isValid) { CTxDestination dest = address.Get(); - string currentAddress = NOTARY_ADDRESS = address.ToString(); - result.push_back(Pair("address", currentAddress)); + NOTARY_ADDRESS = address.ToString(); + result.push_back(Pair("address", NOTARY_ADDRESS)); #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); From 0e848a2fd44847951f1439a209b41141223031eb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:30:58 +0800 Subject: [PATCH 0422/4463] nopiie --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 4153aebca..f10f4e1c1 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1487,8 +1487,8 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) pubkeystr[66] = 0; char Raddress[18]; pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); - //CBitcoinAddress address(Raddress); - NOTARY_ADDRESS = Raddress.ToString(); + CBitcoinAddress address(Raddress); + NOTARY_ADDRESS = address.ToString(); komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } From 2e750b76da4204d6b50b24ff5196e84389f1c83d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:33:31 +0800 Subject: [PATCH 0423/4463] try --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f10f4e1c1..1cede9279 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1487,8 +1487,8 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) pubkeystr[66] = 0; char Raddress[18]; pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); - CBitcoinAddress address(Raddress); - NOTARY_ADDRESS = address.ToString(); + //CBitcoinAddress address(Raddress); + NOTARY_ADDRESS.assign(Raddress); komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } From b71d83e7b01db09f5f58168f41574da7de4e8169 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:34:36 +0800 Subject: [PATCH 0424/4463] fix --- src/komodo_utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1cede9279..c484accc5 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1478,6 +1478,7 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { From b74d98e6bb6afcd5a23fe4213e4fd2ad463ba47d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:36:58 +0800 Subject: [PATCH 0425/4463] fix --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index c484accc5..6d9777b73 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1478,7 +1478,7 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); +extern bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { From 2ff5d746dc2f7f318c70b46236177ba9d1576040 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:41:56 +0800 Subject: [PATCH 0426/4463] :S --- src/komodo_utils.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 6d9777b73..2dcdd215d 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,6 +13,7 @@ * * ******************************************************************************/ #include "komodo_defs.h" +#include "komodo_globals.h" #ifdef _WIN32 #include @@ -1478,8 +1479,6 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; -extern bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { int32_t i,notaryid; From 97c7042ce83548aaec91ccc23897532fb3d3641e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:45:36 +0800 Subject: [PATCH 0427/4463] fix --- src/komodo_utils.h | 3 ++- src/wallet/wallet.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 2dcdd215d..c734e7add 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,7 +13,6 @@ * * ******************************************************************************/ #include "komodo_defs.h" -#include "komodo_globals.h" #ifdef _WIN32 #include @@ -1479,6 +1478,8 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; +bool pubkey2addr(char destaddr,uint8_t *pubkey33); + int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { int32_t i,notaryid; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6731d40f0..a8d287bac 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,7 +1202,7 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; -bool pubkey2addr(char destaddr,uint8_t *pubkey33); + bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { From 387466a273c0848131ccdda31f88da300b31d0b1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 13:48:31 +0800 Subject: [PATCH 0428/4463] try --- src/cc/utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cc/utils.h b/src/cc/utils.h index f0b91962d..8762cbaf1 100644 --- a/src/cc/utils.h +++ b/src/cc/utils.h @@ -23,6 +23,7 @@ /* * Serialisation boilerplate */ +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); template std::vector SerializeF(const T f) From c6976b687703a9a9c1f8c3f50aa80ac9a76eedea Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:03:02 +0800 Subject: [PATCH 0429/4463] try --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index c734e7add..c484accc5 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1478,7 +1478,7 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; -bool pubkey2addr(char destaddr,uint8_t *pubkey33); +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { From 0f9b4c1d8107f67ee3066602ee7ef5f629856c5f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:11:35 +0800 Subject: [PATCH 0430/4463] try --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index c484accc5..c774dba9b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,6 +13,8 @@ * * ******************************************************************************/ #include "komodo_defs.h" +#include "cc/utils.h" +#include "cc/CCutils.cpp" #ifdef _WIN32 #include @@ -1478,8 +1480,6 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { int32_t i,notaryid; From 5d64fdd67d4ef40053ae5c807884f172cf339fc9 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:18:11 +0800 Subject: [PATCH 0431/4463] try again --- src/komodo_utils.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index c774dba9b..02f226028 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -14,7 +14,6 @@ ******************************************************************************/ #include "komodo_defs.h" #include "cc/utils.h" -#include "cc/CCutils.cpp" #ifdef _WIN32 #include From 3c612cfc9e31c24ee2b2038c93806c4ba4f43325 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:19:47 +0800 Subject: [PATCH 0432/4463] try --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 6164cf463..19aa87fe4 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -9,6 +9,7 @@ #include "rpcprotocol.h" #include "util.h" #include "utilstrencodings.h" +#include "cc/utils.h" #include #include From 3b8bc700b3dcfe2877c7b56668fe39651025a5ec Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:22:51 +0800 Subject: [PATCH 0433/4463] try --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 19aa87fe4..ebf8d5660 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -9,7 +9,7 @@ #include "rpcprotocol.h" #include "util.h" #include "utilstrencodings.h" -#include "cc/utils.h" +#include "cc/CCutils.cpp" #include #include From f32a8a151e520a756b092aa6bfb4bbd0a2886fd7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:24:05 +0800 Subject: [PATCH 0434/4463] try again --- src/bitcoin-cli.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index ebf8d5660..d70638d89 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -9,7 +9,7 @@ #include "rpcprotocol.h" #include "util.h" #include "utilstrencodings.h" -#include "cc/CCutils.cpp" + #include #include @@ -24,6 +24,7 @@ using namespace std; int64_t MAX_MONEY = 200000000 * 100000000LL; uint64_t komodo_maxallowed(int32_t baseid) { return(100000000LL * 1000000); } // stub +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900; From 9da9b21de773e0e2cba8c5b0484b34cea18edebd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:27:55 +0800 Subject: [PATCH 0435/4463] try again --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index d70638d89..ea72bbc14 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -24,7 +24,6 @@ using namespace std; int64_t MAX_MONEY = 200000000 * 100000000LL; uint64_t komodo_maxallowed(int32_t baseid) { return(100000000LL * 1000000); } // stub -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900; @@ -78,6 +77,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" +#include "cc/CCutils.cpp" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From 3a20421a0553816abcd4172a4aead07576d14c57 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:30:26 +0800 Subject: [PATCH 0436/4463] again --- src/cc/CCinclude.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index 8be4bce29..ab320e58a 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -24,7 +24,7 @@ so you can pay to a pubkey, or to its hash. or to a script's hash. the last is h all of the above are the standard bitcoin vout types and there should be plenty of materials about it Encrypted by a verified device what I did with the CC contracts is created a fourth type of vout, the CC vout. this is using the cryptoconditions standard and it is even a different signature mechanism. ed25519 instead of secp256k1. it is basically a big extension to the bitcoin script. There is a special opcode that is added that says it is a CC script. - + but it gets more interesting each CC script has an evalcode this is just an arbitrary number. but what it does is allows to create a self-contained universe of CC utxo that all have the same evalcode and that is how a faucet CC differentiates itself from a dice CC, the eval code is different @@ -149,6 +149,7 @@ bool PreventCC(Eval* eval,const CTransaction &tx,int32_t preventCCvins,int32_t n bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); std::vector Mypubkey(); bool Myprivkey(uint8_t myprivkey[]); +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int64_t CCduration(int32_t &numblocks,uint256 txid); bool isCCTxNotarizedConfirmed(uint256 txid); // CCtx From c75cdae8c69a37e63e1d12a596f944477c3f7d66 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:33:52 +0800 Subject: [PATCH 0437/4463] oops --- src/bitcoin-cli.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index ea72bbc14..e44be663c 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -77,7 +77,6 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -#include "cc/CCutils.cpp" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From 0da06744056072e82fe48ddbb84be680818548b8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:35:15 +0800 Subject: [PATCH 0438/4463] try --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e44be663c..f1b75fb42 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -77,6 +77,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" +#include "cc/CCinclude.h" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From be4539034e5702a1e2d9a28d0da37219ab3d91a2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:38:23 +0800 Subject: [PATCH 0439/4463] try again --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index f1b75fb42..527765094 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -70,7 +70,7 @@ public: #include "uint256.h" #include "arith_uint256.h" -#include "komodo_structs.h" +//#include "komodo_structs.h" #include "komodo_globals.h" #include "komodo_utils.h" From 9d44f850bf567646cd6412b114eb6979aa751572 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 14:59:26 +0800 Subject: [PATCH 0440/4463] try --- src/bitcoin-cli.cpp | 2 +- src/cc/utils.h | 1 - src/komodo_globals.h | 1 - src/wallet/wallet.cpp | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 527765094..f1b75fb42 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -70,7 +70,7 @@ public: #include "uint256.h" #include "arith_uint256.h" -//#include "komodo_structs.h" +#include "komodo_structs.h" #include "komodo_globals.h" #include "komodo_utils.h" diff --git a/src/cc/utils.h b/src/cc/utils.h index 8762cbaf1..f0b91962d 100644 --- a/src/cc/utils.h +++ b/src/cc/utils.h @@ -23,7 +23,6 @@ /* * Serialisation boilerplate */ -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); template std::vector SerializeF(const T f) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 133743c52..a09008824 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -29,7 +29,6 @@ uint64_t komodo_paxtotal(); int32_t komodo_longestchain(); uint64_t komodo_maxallowed(int32_t baseid); int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max); -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); pthread_mutex_t komodo_mutex; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a8d287bac..4fea5dae7 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1203,7 +1203,6 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; - bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { { From af21a290f3743722374e3a8371b82443fd0f1dbe Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:14:11 +0800 Subject: [PATCH 0441/4463] fix --- src/bitcoin-cli.cpp | 1 - src/main.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index f1b75fb42..e44be663c 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -77,7 +77,6 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -#include "cc/CCinclude.h" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { diff --git a/src/main.cpp b/src/main.cpp index 91ec53faf..c7b0e0e9b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,6 +64,7 @@ int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block); void komodo_broadcast(CBlock *pblock,int32_t limit); void komodo_broadcast(CBlock *pblock,int32_t limit); bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); BlockMap mapBlockIndex; CChain chainActive; From b61cf9dd216af09e073458b1093538f92827c830 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:18:14 +0800 Subject: [PATCH 0442/4463] try --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e44be663c..5abc9eba3 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -77,6 +77,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From b9923c1dcae33e511e931da0c630d23f8b91e2af Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:30:11 +0800 Subject: [PATCH 0443/4463] try --- src/bitcoin-cli.cpp | 4 +++- src/komodo_utils.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 5abc9eba3..d82049cf3 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -73,11 +73,13 @@ public: #include "komodo_structs.h" #include "komodo_globals.h" +##include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + + void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 02f226028..61c2f8c6a 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -742,6 +742,8 @@ uint32_t calc_crc32(uint32_t crc,const void *buf,size_t size) return crc ^ ~0U; } +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen) { bits256 hash; From 8963872dca12d7c7a6f74b54cb0ff18ad4616c5d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:31:33 +0800 Subject: [PATCH 0444/4463] lol --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index d82049cf3..aead9fb7a 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -73,7 +73,7 @@ public: #include "komodo_structs.h" #include "komodo_globals.h" -##include "cc/utils.h" +#include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" #include "komodo_notary.h" From 02da812eb6e5e411a3007900a974d76c69ed643c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:37:11 +0800 Subject: [PATCH 0445/4463] wtf --- src/komodo_globals.h | 1 + src/komodo_utils.h | 10 ++++++++-- src/main.cpp | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index a09008824..133743c52 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -29,6 +29,7 @@ uint64_t komodo_paxtotal(); int32_t komodo_longestchain(); uint64_t komodo_maxallowed(int32_t baseid); int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max); +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); pthread_mutex_t komodo_mutex; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 61c2f8c6a..1cd7fc219 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -742,8 +742,6 @@ uint32_t calc_crc32(uint32_t crc,const void *buf,size_t size) return crc ^ ~0U; } -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - void calc_rmd160_sha256(uint8_t rmd160[20],uint8_t *data,int32_t datalen) { bits256 hash; @@ -1481,6 +1479,14 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; +bool pubkey2addr(char *destaddr,uint8_t *pubkey33) +{ + std::vectorpk; int32_t i; + for (i=0; i<33; i++) + pk.push_back(pubkey33[i]); + return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG)); +} + int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { int32_t i,notaryid; diff --git a/src/main.cpp b/src/main.cpp index c7b0e0e9b..91ec53faf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,7 +64,6 @@ int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block); void komodo_broadcast(CBlock *pblock,int32_t limit); void komodo_broadcast(CBlock *pblock,int32_t limit); bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); BlockMap mapBlockIndex; CChain chainActive; From 7a306f46f8e0097cba9a442c98f3cd390d5491b5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:42:07 +0800 Subject: [PATCH 0446/4463] try --- src/komodo_utils.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1cd7fc219..48ddd8682 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1480,12 +1480,6 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; bool pubkey2addr(char *destaddr,uint8_t *pubkey33) -{ - std::vectorpk; int32_t i; - for (i=0; i<33; i++) - pk.push_back(pubkey33[i]); - return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG)); -} int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { From 08548dc9e2ee04f15f26bfbf1dc129eede5bff53 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 15:43:43 +0800 Subject: [PATCH 0447/4463] try --- src/komodo_utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 48ddd8682..f4e03387f 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1479,10 +1479,11 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\""; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33) + int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { + bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int32_t i,notaryid; for (i=0; i<33; i++) sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]); From ce5285f7e92a6899ca46271523a6c3e05511f6f2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 16:06:49 +0800 Subject: [PATCH 0448/4463] try that --- src/komodo_utils.h | 5 ----- src/wallet/wallet.cpp | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f4e03387f..a9d16fd52 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1483,15 +1483,10 @@ char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { - bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int32_t i,notaryid; for (i=0; i<33; i++) sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]); pubkeystr[66] = 0; - char Raddress[18]; - pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); - //CBitcoinAddress address(Raddress); - NOTARY_ADDRESS.assign(Raddress); komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4fea5dae7..5a776c6e6 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,9 +1202,17 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { + static bool didNA; + if ( didNA == false && NOTARY_PUBKEY33[0] != 0 && NOTARY_PUBKEY.empty() ) { + char Raddress[18]; + pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + NOTARY_ADDRESS.assign(Raddress); + didNA == true; + } { AssertLockHeld(cs_wallet); bool fExisted = mapWallet.count(tx.GetHash()) != 0; From cfa4c9731d20ccabb721eb62055e91d4d1505f61 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 16:09:05 +0800 Subject: [PATCH 0449/4463] fix --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5a776c6e6..cf253db5f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1207,7 +1207,7 @@ bool pubkey2addr(char *destaddr,uint8_t *pubkey33); bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { static bool didNA; - if ( didNA == false && NOTARY_PUBKEY33[0] != 0 && NOTARY_PUBKEY.empty() ) { + if ( didNA == false && NOTARY_PUBKEY33[0] != 0 && NOTARY_ADDRESS.empty() ) { char Raddress[18]; pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); NOTARY_ADDRESS.assign(Raddress); From 861c5d5553eb2d9432db8fa27fe5748c6056e745 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 16:14:14 +0800 Subject: [PATCH 0450/4463] 7 --- src/wallet/wallet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cf253db5f..6b98df5d0 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1209,6 +1209,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl static bool didNA; if ( didNA == false && NOTARY_PUBKEY33[0] != 0 && NOTARY_ADDRESS.empty() ) { char Raddress[18]; + fprintf(stderr, "test thing\n"); pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); NOTARY_ADDRESS.assign(Raddress); didNA == true; From 334314cef42ca343ae2ab7b5e12f903643ad1aba Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 16:16:53 +0800 Subject: [PATCH 0451/4463] try --- src/wallet/wallet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6b98df5d0..65dc60f8d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,14 +1202,13 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); +bool pubkey2addr(char destaddr,uint8_t *pubkey33); bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { static bool didNA; if ( didNA == false && NOTARY_PUBKEY33[0] != 0 && NOTARY_ADDRESS.empty() ) { char Raddress[18]; - fprintf(stderr, "test thing\n"); pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); NOTARY_ADDRESS.assign(Raddress); didNA == true; From eba1ffb18c8ea0dc3db842c93e7d1ba6c278e6a7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 16:43:22 +0800 Subject: [PATCH 0452/4463] fix eras --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 10458d9ea..fbb3506ba 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1604212834; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1604222222; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; +static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; From f48342ba788204b1270ab3321e9026949b899a64 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 16:45:14 +0800 Subject: [PATCH 0453/4463] remove flooding print --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 264f2060a..966b41850 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -107,7 +107,7 @@ int is_STAKED(const char *chain_name) { STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; - fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); return(STAKED); }; From 85bbfadd2f94f7e6940be3a17a40319c3cd4ac63 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 18:40:04 +0800 Subject: [PATCH 0454/4463] attempt to add Raddress array --- src/komodo_globals.h | 4 ++-- src/komodo_notary.h | 40 ++++++++++++++++++++++++++++++++-------- src/main.cpp | 9 +++++---- src/notaries_staked.cpp | 35 +++++++++++++++++++++++++++++++++++ src/notaries_staked.h | 2 ++ src/wallet/wallet.cpp | 15 ++++----------- 6 files changed, 80 insertions(+), 25 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 133743c52..48071e072 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -45,12 +45,12 @@ struct komodo_state KOMODO_STATES[34]; #define _COINBASE_MATURITY 100 int COINBASE_MATURITY = _COINBASE_MATURITY;//100; -int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,KOMODO_CONNECTING = -1; +int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string NOTARY_ADDRESS,ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; -char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096]; +char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[18][64]; uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT,KOMODO_DPOWCONFS = 1; uint32_t ASSETCHAINS_MAGIC = 2387029918; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 8e2fdf6fc..033fe8bba 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,6 +22,8 @@ #define KOMODO_MAINNET_START 178999 +extern NOTARYADDRS[18][64]; + //extern const char *notaries_STAKED[][2]; //extern const int num_notaries_STAKED; @@ -226,8 +228,12 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam if ( did0 == 0 ) { n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); - for (i=0; i STAKED_ERA ) + STAKED_ERA = era; return(era); }; +extern NOTARYADDRS[18][64]; + +int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { + int8_t notaryID = -1; + if ( STAKED_ERA != 0 ) { + switch (STAKED_ERA) { + case 1: + notaryID = ScanStakedArray(notaries_STAKED1,num_notaries_STAKED1,Raddress,notaryname); + break; + case 2: + notaryID = ScanStakedArray(notaries_STAKED2,num_notaries_STAKED2,Raddress,notaryname); + break; + case 3: + notaryID = ScanStakedArray(notaries_STAKED3,num_notaries_STAKED3,Raddress,notaryname); + break; + case 4: + notaryID = ScanStakedArray(notaries_STAKED4,num_notaries_STAKED4,Raddress,notaryname); + break; + } + } + return(notaryID); +} + +int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { + for (size_t i = 0; i < num_notaries; i++) { + if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { + notaryname.assign(notaries_chosen[i][0]); + return(i); + } + } + return(-1) +} + CrosschainAuthority Choose_auth_STAKED(int chosen_era) { CrosschainAuthority auth; switch (chosen_era) { diff --git a/src/notaries_staked.h b/src/notaries_staked.h index fbb3506ba..d3927e68f 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -25,6 +25,8 @@ extern int num_notaries_STAKED4; int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); +int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); +int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname); CrosschainAuthority Choose_auth_STAKED(int chosen_era); CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 65dc60f8d..a73ea31fe 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,17 +1202,9 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; -bool pubkey2addr(char destaddr,uint8_t *pubkey33); bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { - static bool didNA; - if ( didNA == false && NOTARY_PUBKEY33[0] != 0 && NOTARY_ADDRESS.empty() ) { - char Raddress[18]; - pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); - NOTARY_ADDRESS.assign(Raddress); - didNA == true; - } { AssertLockHeld(cs_wallet); bool fExisted = mapWallet.count(tx.GetHash()) != 0; @@ -1226,9 +1218,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { uint256 hash; CTransaction txin; CTxDestination address; - if (GetTransaction(tx.vin[0].prevout.hash,txin,hash,false)) + if (GetTransaction(tx.vin[i].prevout.hash,txin,hash,false)) { - if (ExtractDestination(txin.vout[tx.vin[0].prevout.n].scriptPubKey, address)) { + if (ExtractDestination(txin.vout[tx.vin[i].prevout.n].scriptPubKey, address)) { // This means we sent the tx.. if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { numvinIsOurs++; @@ -1259,7 +1251,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } } else if ( numvinIsOurs < tx.vin.size() ) { - // this means we were in a multi sig, we wil remove the utxo we spent from our wallet and do nothing else. + // this means we were in a multi sig, we wil remove the utxo we spent from our wallet, + // IF there exisited a function for that. fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } } From 2d1a27fddf7b4c57f101a0bd6df84193ada5b6dc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 18:43:46 +0800 Subject: [PATCH 0455/4463] fix --- src/notaries_staked.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 775f9c9cd..1066d18d0 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -130,7 +130,8 @@ int STAKED_era(int timestamp) return(era); }; -extern NOTARYADDRS[18][64]; +extern char NOTARYADDRS[18][64]; +extern int32_t STAKED_ERA; int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t notaryID = -1; @@ -160,7 +161,7 @@ int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *R return(i); } } - return(-1) + return(-1); } CrosschainAuthority Choose_auth_STAKED(int chosen_era) { From 351405ce375de6eb40b81c7ab9cd5c86423c56d8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 18:47:50 +0800 Subject: [PATCH 0456/4463] more fix --- src/komodo_notary.h | 2 +- src/notaries_staked.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 033fe8bba..5f96e9145 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,7 +22,7 @@ #define KOMODO_MAINNET_START 178999 -extern NOTARYADDRS[18][64]; +extern char NOTARYADDRS[18][64]; //extern const char *notaries_STAKED[][2]; //extern const int num_notaries_STAKED; diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 1066d18d0..9d413fd5d 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -3,6 +3,9 @@ #include "crosschain.h" #include +extern char NOTARYADDRS[18][64]; +extern int32_t STAKED_ERA; + // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = { @@ -130,9 +133,6 @@ int STAKED_era(int timestamp) return(era); }; -extern char NOTARYADDRS[18][64]; -extern int32_t STAKED_ERA; - int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t notaryID = -1; if ( STAKED_ERA != 0 ) { From 234da7a784ce1b0b8822f048c7c451b1ce22d0b0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 18:51:41 +0800 Subject: [PATCH 0457/4463] fix --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index cd6cf11d6..7ea4f85e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1044,7 +1044,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, return true; } } -extern NOTARYADDRS[18][64]; +extern char NOTARYADDRS[18][64]; int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { @@ -1062,7 +1062,7 @@ int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only } didinit = 1; } */ - for (i=0; i<=64; i++) + for (int32_t i=0; i<=64; i++) if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 ) return(1); return(0); From 65c77d6ffc9157a1529e3649a4d09161c370dd55 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:13:38 +0800 Subject: [PATCH 0458/4463] fix --- src/cc/CCinclude.h | 4 +++- src/komodo_structs.h | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index ab320e58a..2e447f485 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -55,9 +55,11 @@ extern std::string CCerror; #define SMALLVAL 0.000000000000001 #define MIN_NOTARIZATION_CONFIRMS 2 +#ifndef _BITS256 +#define _BITS256 union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; }; typedef union _bits256 bits256; - +#endif struct CC_utxo { uint256 txid; diff --git a/src/komodo_structs.h b/src/komodo_structs.h index 3d8f50718..470eeda09 100644 --- a/src/komodo_structs.h +++ b/src/komodo_structs.h @@ -47,10 +47,11 @@ #define KOMODO_KVBINARY 2 #define KOMODO_KVDURATION 1440 #define KOMODO_ASSETCHAIN_MAXLEN 65 - +#ifndef _BITS256 +#define _BITS256 union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; }; typedef union _bits256 bits256; - +#endif union _bits320 { uint8_t bytes[40]; uint16_t ushorts[20]; uint32_t uints[10]; uint64_t ulongs[5]; uint64_t txid; }; typedef union _bits320 bits320; From 8207ebdaa1aee995634ba09081951bab2e79379e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:16:27 +0800 Subject: [PATCH 0459/4463] try --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index aead9fb7a..deb956a1a 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -78,7 +78,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" - +#include "cc/CCinclude.h" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) From 37c7d4108dc52d567e072f2f6e6e3f247df08c6b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:17:35 +0800 Subject: [PATCH 0460/4463] cpp include? --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index deb956a1a..717717a53 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -78,7 +78,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -#include "cc/CCinclude.h" +#include "cc/CCutils.cpp" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) From 0b8cb81d2ce86247761360c616660988318044ab Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:23:11 +0800 Subject: [PATCH 0461/4463] try --- src/cc/CCutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index 491798a98..0270a09ff 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -14,7 +14,7 @@ ******************************************************************************/ #include "CCinclude.h" - +#include "../standard.h" /* CCutils has low level functions that are universally useful for all contracts. */ From e1b67809d9432dfb3fe7d94feaef9cd844120289 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:25:12 +0800 Subject: [PATCH 0462/4463] script --- src/cc/CCutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index 0270a09ff..b586f5fcf 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -14,7 +14,7 @@ ******************************************************************************/ #include "CCinclude.h" -#include "../standard.h" +#include "../script/standard.h" /* CCutils has low level functions that are universally useful for all contracts. */ From 5f81cde8f71ca894e0ec431d425ade4ef04eabbd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:35:05 +0800 Subject: [PATCH 0463/4463] guessing --- src/bitcoin-cli.cpp | 1 - src/cc/utils.cpp | 22 ++++++++++++++++++++++ src/cc/utils.h | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 717717a53..a886c27f2 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -78,7 +78,6 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -#include "cc/CCutils.cpp" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) diff --git a/src/cc/utils.cpp b/src/cc/utils.cpp index e69de29bb..e13c6054d 100644 --- a/src/cc/utils.cpp +++ b/src/cc/utils.cpp @@ -0,0 +1,22 @@ +#include "../script/standard.h" +#include "../base58.h" + +bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey) +{ + CTxDestination address; txnouttype whichType; + if ( ExtractDestination(scriptPubKey,address) != 0 ) + { + strcpy(destaddr,(char *)CBitcoinAddress(address).ToString().c_str()); + return(true); + } + fprintf(stderr,"ExtractDestination failed\n"); + return(false); +} + +bool pubkey2addr(char *destaddr,uint8_t *pubkey33) +{ + std::vectorpk; int32_t i; + for (i=0; i<33; i++) + pk.push_back(pubkey33[i]); + return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG)); +} diff --git a/src/cc/utils.h b/src/cc/utils.h index f0b91962d..6a70b6828 100644 --- a/src/cc/utils.h +++ b/src/cc/utils.h @@ -42,6 +42,8 @@ bool DeserializeF(const std::vector vIn, T f) } catch(...) {} return false; } +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); +bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); #define E_MARSHAL(body) SerializeF([&] (CDataStream &ss) {body;}) #define E_UNMARSHAL(params, body) DeserializeF(params, [&] (CDataStream &ss) {body;}) From e75e7e21c6dea8ffeddaad5b180de405b6c1aad6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:39:58 +0800 Subject: [PATCH 0464/4463] try again --- src/komodo_notary.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 5f96e9145..b4b8edc4b 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -20,6 +20,8 @@ #include "notaries_staked.h" +#include "cc/utils.cpp" + #define KOMODO_MAINNET_START 178999 extern char NOTARYADDRS[18][64]; @@ -206,6 +208,8 @@ const char *Notaries_elected1[][2] = }; #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; From c4e4197a659df34a058481fe8fd18c72caf6ec6f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:44:52 +0800 Subject: [PATCH 0465/4463] guess --- src/cc/utils.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cc/utils.cpp b/src/cc/utils.cpp index e13c6054d..fb41aaabf 100644 --- a/src/cc/utils.cpp +++ b/src/cc/utils.cpp @@ -1,6 +1,4 @@ -#include "../script/standard.h" -#include "../base58.h" - +#include "../main.h" bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey) { CTxDestination address; txnouttype whichType; From 54054b83970ff5bb190050c41d97ff6a308db716 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:47:16 +0800 Subject: [PATCH 0466/4463] try again --- src/bitcoin-cli.cpp | 2 ++ src/cc/utils.cpp | 20 -------------------- src/cc/utils.h | 3 +-- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index a886c27f2..420123d93 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -78,6 +78,8 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" +#include "main.h" +#include "cc/CCutils.cpp" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) diff --git a/src/cc/utils.cpp b/src/cc/utils.cpp index fb41aaabf..e69de29bb 100644 --- a/src/cc/utils.cpp +++ b/src/cc/utils.cpp @@ -1,20 +0,0 @@ -#include "../main.h" -bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey) -{ - CTxDestination address; txnouttype whichType; - if ( ExtractDestination(scriptPubKey,address) != 0 ) - { - strcpy(destaddr,(char *)CBitcoinAddress(address).ToString().c_str()); - return(true); - } - fprintf(stderr,"ExtractDestination failed\n"); - return(false); -} - -bool pubkey2addr(char *destaddr,uint8_t *pubkey33) -{ - std::vectorpk; int32_t i; - for (i=0; i<33; i++) - pk.push_back(pubkey33[i]); - return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG)); -} diff --git a/src/cc/utils.h b/src/cc/utils.h index 6a70b6828..69410adbb 100644 --- a/src/cc/utils.h +++ b/src/cc/utils.h @@ -20,6 +20,7 @@ #include "version.h" + /* * Serialisation boilerplate */ @@ -42,8 +43,6 @@ bool DeserializeF(const std::vector vIn, T f) } catch(...) {} return false; } -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); -bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); #define E_MARSHAL(body) SerializeF([&] (CDataStream &ss) {body;}) #define E_UNMARSHAL(params, body) DeserializeF(params, [&] (CDataStream &ss) {body;}) From d0e0ae97ba7203daeb1bca363b44b1fe52d60c45 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:49:55 +0800 Subject: [PATCH 0467/4463] wtf --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 420123d93..a1f06525c 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -79,7 +79,7 @@ public: #include "komodo_notary.h" #include "notaries_staked.cpp" #include "main.h" -#include "cc/CCutils.cpp" +#include "cc/CCinclude.h" void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) From 20c46df9be2a4bef8b94519d5f0b299ec5034248 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 22:53:57 +0800 Subject: [PATCH 0468/4463] dead --- src/bitcoin-cli.cpp | 3 +-- src/cc/CCutils.cpp | 2 +- src/komodo_notary.h | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index a1f06525c..aead9fb7a 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -78,8 +78,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -#include "main.h" -#include "cc/CCinclude.h" + void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index b586f5fcf..491798a98 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -14,7 +14,7 @@ ******************************************************************************/ #include "CCinclude.h" -#include "../script/standard.h" + /* CCutils has low level functions that are universally useful for all contracts. */ diff --git a/src/komodo_notary.h b/src/komodo_notary.h index b4b8edc4b..c67d62342 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -20,7 +20,8 @@ #include "notaries_staked.h" -#include "cc/utils.cpp" +#include "main.h" +#include "cc/CCinclude.h" #define KOMODO_MAINNET_START 178999 From 7ccc6fe7ed4699ebdf806389ae38eb1f88240e01 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 23:26:07 +0800 Subject: [PATCH 0469/4463] try --- src/komodo_globals.h | 1 - src/komodo_notary.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 48071e072..bf96cfa44 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -29,7 +29,6 @@ uint64_t komodo_paxtotal(); int32_t komodo_longestchain(); uint64_t komodo_maxallowed(int32_t baseid); int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max); -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); pthread_mutex_t komodo_mutex; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index c67d62342..d5c54aeaf 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,6 +22,7 @@ #include "main.h" #include "cc/CCinclude.h" +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); #define KOMODO_MAINNET_START 178999 From 099b691e24767b74be11f15fe302617166d3fd78 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 2 Nov 2018 23:33:41 +0800 Subject: [PATCH 0470/4463] hacky fix --- src/komodo_notary.h | 16 +++++++--------- src/main.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d5c54aeaf..cc841bc9d 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -20,9 +20,7 @@ #include "notaries_staked.h" -#include "main.h" -#include "cc/CCinclude.h" -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); +int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; #define KOMODO_MAINNET_START 178999 @@ -237,7 +235,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam for (i=0; i Date: Fri, 2 Nov 2018 23:40:20 +0800 Subject: [PATCH 0471/4463] fix not compile --- src/wallet/rpcwallet.cpp | 69 ++-------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 153a87dc7..f2cfae5a6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4565,7 +4565,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus()); if (!EnsureWalletIsAvailable(0)) return 0; - + const CKeyStore& keystore = *pwalletMain; assert(pwalletMain != NULL); LOCK2(cs_main, pwalletMain->cs_wallet); @@ -4728,7 +4728,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt set setAddress; struct komodo_staking *kp; int32_t winners,segid,minage,nHeight,counter=0,i,m,siglen=0,nMinDepth = 1,nMaxDepth = 99999999; vector vecOutputs; uint32_t block_from_future_rejecttime,besttime,eligible,eligible2,earliest = 0; CScript best_scriptPubKey; arith_uint256 mindiff,ratio,bnTarget; CBlockIndex *tipindex,*pindex; CTxDestination address; bool fNegative,fOverflow; uint8_t hashbuf[256]; CTransaction tx; uint256 hashBlock; if (!EnsureWalletIsAvailable(0)) return 0; - + bnTarget.SetCompact(nBits, &fNegative, &fOverflow); mindiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); ratio = (mindiff / bnTarget); @@ -5029,69 +5029,6 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) return(result); } -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - -UniValue setpubkey(const UniValue& params, bool fHelp) -{ - UniValue result(UniValue::VOBJ); - if ( fHelp || params.size() != 1 ) - throw runtime_error( - "setpubkey\n" - "\nSets the -pubkey if the daemon was not started with it, if it was already set, it returns the pubkey.\n" - "\nArguments:\n" - "1. \"pubkey\" (string) pubkey to set.\n" - "\nResult:\n" - " {\n" - " \"pubkey\" : \"pubkey\", (string) The pubkey\n" - " \"ismine\" : \"true/false\", (bool)\n" - " \"R-address\" : \"R address\", (string) The pubkey\n" - " }\n" - "\nExamples:\n" - + HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") - + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") - ); - -#ifdef ENABLE_WALLET - LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); -#else - LOCK(cs_main); -#endif - - char Raddress[18]; - uint8_t pubkey33[33]; - extern uint8_t NOTARY_PUBKEY33[]; - extern std::string NOTARY_PUBKEY; - if ( NOTARY_PUBKEY33[0] == 0 ) { - if (strlen(params[0].get_str().c_str()) == 66) { - decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",Raddress) == 0) { - result.push_back(Pair("error", "pubkey entered is invalid.")); - } else { - CBitcoinAddress address(Raddress); - bool isValid = address.IsValid(); - if (isValid) - { - CTxDestination dest = address.Get(); - string currentAddress = address.ToString(); - result.push_back(Pair("address", currentAddress)); -#ifdef ENABLE_WALLET - isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; - result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); -#endif - } - NOTARY_PUBKEY = params[0].get_str(); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - } - } else { - result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); - } - } else { - result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); - } - result.push_back(Pair("pubkey", NOTARY_PUBKEY)); - return result; -} UniValue oraclesaddress(const UniValue& params, bool fHelp) { @@ -6769,7 +6706,7 @@ UniValue getbalance64(const UniValue& params, bool fHelp) UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address; if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; - + const CKeyStore& keystore = *pwalletMain; CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid; assert(pwalletMain != NULL); From 885f304f9c325957792acece4a134ae02a3a003c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 00:47:19 +0800 Subject: [PATCH 0472/4463] try --- src/main.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.h b/src/main.h index fd418502a..0dd5e35c2 100644 --- a/src/main.h +++ b/src/main.h @@ -180,11 +180,11 @@ void RegisterNodeSignals(CNodeSignals& nodeSignals); /** Unregister a network node */ void UnregisterNodeSignals(CNodeSignals& nodeSignals); -/** +/** * Process an incoming block. This only returns after the best known valid * block is made active. Note that it does not, however, guarantee that the * specific block passed to it has been checked for validity! - * + * * @param[out] state This may be set to an Error state if any error occurred processing it, including during validation/connection/etc of otherwise unrelated blocks during reorganisation; or it may be set to an Invalid state if pblock is itself invalid (but this is not guaranteed even when the block is checked). If you want to *possibly* get feedback on whether pblock is valid, you must also install a CValidationInterface (see validationinterface.h) - this will have its BlockChecked method called whenever *any* block completes validation. * @param[in] pfrom The node which we are receiving the block from; it is added to mapBlockSource and may be penalised if the block is invalid. * @param[in] pblock The block we want to process. @@ -269,6 +269,7 @@ void PruneAndFlush(); bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectAbsurdFee=false); +int32_t pubkey2address(char *destaddr,uint8_t *pubkey33); struct CNodeStateStats { int nMisbehavior; @@ -640,7 +641,7 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF /** * Check transaction inputs, and make sure any * pay-to-script-hash transactions are evaluating IsStandard scripts - * + * * Why bother? To avoid denial-of-service attacks; an attacker * can submit a standard HASH... OP_EQUAL transaction, * which will get accepted into blocks. The redemption @@ -649,14 +650,14 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF * DUP CHECKSIG DROP ... repeated 100 times... OP_1 */ -/** +/** * Check for standard transaction types * @param[in] mapInputs Map of previous transactions that have outputs we're spending * @return True if all inputs (scriptSigs) use only standard transaction forms */ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, uint32_t consensusBranchId); -/** +/** * Count ECDSA signature operations the old-fashioned (pre-0.6) way * @return number of sigops this transaction's outputs will produce when spent * @see CTransaction::FetchInputs @@ -665,7 +666,7 @@ unsigned int GetLegacySigOpCount(const CTransaction& tx); /** * Count ECDSA signature operations in pay-to-script-hash inputs. - * + * * @param[in] mapInputs Map of previous transactions that have outputs we're spending * @return maximum number of sigops required to validate this transaction's inputs * @see CTransaction::FetchInputs @@ -732,9 +733,9 @@ bool IsExpiredTx(const CTransaction &tx, int nBlockHeight); */ bool CheckFinalTx(const CTransaction &tx, int flags = -1); -/** +/** * Closure representing one script verification - * Note that this stores references to the spending transaction + * Note that this stores references to the spending transaction */ class CScriptCheck { From 943026456e03552914bae5b7e93328db4d6818c2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 01:22:18 +0800 Subject: [PATCH 0473/4463] try this arr --- src/main.h | 1 - src/rpcrawtransaction.cpp | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.h b/src/main.h index 0dd5e35c2..76e0f73ae 100644 --- a/src/main.h +++ b/src/main.h @@ -269,7 +269,6 @@ void PruneAndFlush(); bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectAbsurdFee=false); -int32_t pubkey2address(char *destaddr,uint8_t *pubkey33); struct CNodeStateStats { int nMisbehavior; diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index a870d526c..6d874f420 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -480,7 +480,7 @@ int32_t gettxout_scriptPubKey(uint8_t *scriptPubKey,int32_t maxsize,uint256 txid uint256 hashBlock; if ( GetTransaction(txid,tx,hashBlock,false) == 0 ) return(-1); - else if ( n < tx.vout.size() ) + else if ( n < tx.vout.size() ) { ptr = (uint8_t *)tx.vout[n].scriptPubKey.data(); m = tx.vout[n].scriptPubKey.size(); @@ -492,6 +492,13 @@ int32_t gettxout_scriptPubKey(uint8_t *scriptPubKey,int32_t maxsize,uint256 txid return(-1); } +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + +int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) +{ + pubkey2addr((char *)destaddr,(uint8_t *)pubkey33); +} + UniValue gettxoutproof(const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 1 && params.size() != 2)) @@ -1155,7 +1162,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp) } } else if (fHaveChain) { throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain"); - } + } RelayTransaction(tx); return hashTx.GetHex(); From 43b7d6c90a37fd24a9eaa4c5ac4d188bb1e51435 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 01:27:11 +0800 Subject: [PATCH 0474/4463] try again --- src/main.cpp | 6 ------ src/rpcrawtransaction.cpp | 21 +++++++++++++++++---- src/rpcserver.h | 3 +++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c1c7b0936..7ea4f85e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1045,7 +1045,6 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, } } extern char NOTARYADDRS[18][64]; -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { @@ -1069,11 +1068,6 @@ int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only return(0); } -int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) -{ - pubkey2addr((char *)destaddr,(uint8_t *)pubkey33); -} - bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidationState &state) { // Basic checks that don't depend on any context diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 6d874f420..5710e502f 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -492,11 +492,24 @@ int32_t gettxout_scriptPubKey(uint8_t *scriptPubKey,int32_t maxsize,uint256 txid return(-1); } -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - -int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) +bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey) { - pubkey2addr((char *)destaddr,(uint8_t *)pubkey33); + CTxDestination address; txnouttype whichType; + if ( ExtractDestination(scriptPubKey,address) != 0 ) + { + strcpy(destaddr,(char *)CBitcoinAddress(address).ToString().c_str()); + return(true); + } + fprintf(stderr,"ExtractDestination failed\n"); + return(false); +} + +bool pubkey2address(char *destaddr,uint8_t *pubkey33) +{ + std::vectorpk; int32_t i; + for (i=0; i<33; i++) + pk.push_back(pubkey33[i]); + return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG)); } UniValue gettxoutproof(const UniValue& params, bool fHelp) diff --git a/src/rpcserver.h b/src/rpcserver.h index 81ca8a8b9..372d84392 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -287,6 +287,9 @@ extern UniValue FSMlist(const UniValue& params, bool fHelp); extern UniValue FSMinfo(const UniValue& params, bool fHelp); extern UniValue auctionaddress(const UniValue& params, bool fHelp); +extern bool pubkey2address(char *destaddr,uint8_t *pubkey33); +extern bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); + extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp //extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp extern UniValue getaccountaddress(const UniValue& params, bool fHelp); From cd477f81781eb73c7a51784d8becfe374c41c9bb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 01:31:50 +0800 Subject: [PATCH 0475/4463] try --- src/rpcrawtransaction.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 5710e502f..cf8aa8fb8 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -24,6 +24,7 @@ #endif #include "komodo_defs.h" +#include "komodo_notary.h" #include From c87ce0d841612bf9d1e4dc94a4cef49721f5035c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 01:37:39 +0800 Subject: [PATCH 0476/4463] why not --- src/komodo_notary.h | 2 +- src/rpcrawtransaction.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index cc841bc9d..6291c8e1a 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -20,7 +20,7 @@ #include "notaries_staked.h" -int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; +extern int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; #define KOMODO_MAINNET_START 178999 diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index cf8aa8fb8..5710e502f 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -24,7 +24,6 @@ #endif #include "komodo_defs.h" -#include "komodo_notary.h" #include From 0a598aeea7526552272e99a3ca0ce7f9ded9cd76 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 01:41:03 +0800 Subject: [PATCH 0477/4463] extreme lengths --- src/komodo_notary.h | 709 -------------------------------------------- 1 file changed, 709 deletions(-) delete mode 100644 src/komodo_notary.h diff --git a/src/komodo_notary.h b/src/komodo_notary.h deleted file mode 100644 index 6291c8e1a..000000000 --- a/src/komodo_notary.h +++ /dev/null @@ -1,709 +0,0 @@ -/****************************************************************************** - * Copyright © 2014-2018 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - - -#include "komodo_defs.h" - -#include "komodo_cJSON.h" - -#include "notaries_staked.h" - -extern int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; - -#define KOMODO_MAINNET_START 178999 - -extern char NOTARYADDRS[18][64]; - -//extern const char *notaries_STAKED[][2]; -//extern const int num_notaries_STAKED; - -const char *Notaries_genesis[][2] = -{ - { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, - { "jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, - { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, - { "crackers_EU", "0340c66cf2c41c41efb420af57867baa765e8468c12aa996bfd816e1e07e410728" }, - { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, - { "locomb_EU", "025c6d26649b9d397e63323d96db42a9d3caad82e1d6076970efe5056c00c0779b" }, - { "fullmoon_AE", "0204a908350b8142698fdb6fabefc97fe0e04f537adc7522ba7a1e8f3bec003d4a" }, - { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, - { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, - { "crackers_NA", "029e1c01131974f4cd3f564cc0c00eb87a0f9721043fbc1ca60f9bd0a1f73f64a1" }, - { "proto_EU", "03681ffdf17c8f4f0008cefb7fa0779c5e888339cdf932f0974483787a4d6747c1" }, // 10 - { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, - { "farl4web_EU", "035caa40684ace968677dca3f09098aa02b70e533da32390a7654c626e0cf908e1" }, - { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, - { "traderbill_EU", "03196e8de3e2e5d872f31d79d6a859c8704a2198baf0af9c7b21e29656a7eb455f" }, - { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 15 - { "titomane_EU", "03517fcac101fed480ae4f2caf775560065957930d8c1facc83e30077e45bdd199" }, - { "supernet_AE", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, - { "supernet_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, - { "supernet_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, - { "yassin_EU", "033fb7231bb66484081952890d9a03f91164fb27d392d9152ec41336b71b15fbd0" }, // 20 - { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, - { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, - { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, - { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, - { "rnr_EU", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, - { "crackers_SH", "02313d72f9a16055737e14cfc528dcd5d0ef094cfce23d0348fe974b6b1a32e5f0" }, - { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, - { "polycryptoblock_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, - { "titomane_NA", "0387046d9745414fb58a0fa3599078af5073e10347e4657ef7259a99cb4f10ad47" }, - { "titomane_AE", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, - { "kolo_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, - { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, - { "eclips_EU", "0339369c1f5a2028d44be7be6f8ec3b907fdec814f87d2dead97cab4edb71a42e9" }, - { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, -}; - -const char *Notaries_elected0[][2] = -{ - { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, - { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, - { "0_kolo_testA", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, - { "artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, - { "artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, - { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, - { "artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, - { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, - { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, - { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, - { "crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, // 10 - { "crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, - { "crackers_SH", "02be28310e6312d1dd44651fd96f6a44ccc269a321f907502aae81d246fabdb03e" }, - { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, - { "etszombi_AR", "031c79168d15edabf17d9ec99531ea9baa20039d0cdc14d9525863b83341b210e9" }, - { "etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, // 15 - { "etszombi_SH", "025d7a193c0757f7437fad3431f027e7b5ed6c925b77daba52a8755d24bf682dde" }, - { "farl4web_EU", "0300ecf9121cccf14cf9423e2adb5d98ce0c4e251721fa345dec2e03abeffbab3f" }, - { "farl4web_SH", "0396bb5ed3c57aa1221d7775ae0ff751e4c7dc9be220d0917fa8bbdf670586c030" }, - { "fullmoon_AR", "0254b1d64840ce9ff6bec9dd10e33beb92af5f7cee628f999cb6bc0fea833347cc" }, - { "fullmoon_NA", "031fb362323b06e165231c887836a8faadb96eda88a79ca434e28b3520b47d235b" }, // 20 - { "fullmoon_SH", "030e12b42ec33a80e12e570b6c8274ce664565b5c3da106859e96a7208b93afd0d" }, - { "grewal_NA", "03adc0834c203d172bce814df7c7a5e13dc603105e6b0adabc942d0421aefd2132" }, - { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, - { "indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, - { "indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, - { "indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, - { "indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, - { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, - { "jsgalt_NA", "027b3fb6fede798cd17c30dbfb7baf9332b3f8b1c7c513f443070874c410232446" }, - { "karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, // 30 - { "kashifali_EU", "033777c52a0190f261c6f66bd0e2bb299d30f012dcb8bfff384103211edb8bb207" }, - { "kolo_AR", "03016d19344c45341e023b72f9fb6e6152fdcfe105f3b4f50b82a4790ff54e9dc6" }, - { "kolo_SH", "02aa24064500756d9b0959b44d5325f2391d8e95c6127e109184937152c384e185" }, - { "metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, - { "movecrypto_AR", "022783d94518e4dc77cbdf1a97915b29f427d7bc15ea867900a76665d3112be6f3" }, - { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, - { "movecrypto_NA", "02efb12f4d78f44b0542d1c60146738e4d5506d27ec98a469142c5c84b29de0a80" }, - { "movecrypto_SH", "031f9739a3ebd6037a967ce1582cde66e79ea9a0551c54731c59c6b80f635bc859" }, - { "muros_AR", "022d77402fd7179335da39479c829be73428b0ef33fb360a4de6890f37c2aa005e" }, - { "noashh_AR", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, // 40 - { "noashh_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, - { "noashh_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, - { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, - { "polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, - { "pondsea_AR", "032e1c213787312099158f2d74a89e8240a991d162d4ce8017d8504d1d7004f735" }, - { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, - { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, - { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, - { "popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, - { "popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, // 50 - { "ptytrader_NA", "0328c61467148b207400b23875234f8a825cce65b9c4c9b664f47410b8b8e3c222" }, - { "ptytrader_SH", "0250c93c492d8d5a6b565b90c22bee07c2d8701d6118c6267e99a4efd3c7748fa4" }, - { "rnr_AR", "029bdb08f931c0e98c2c4ba4ef45c8e33a34168cb2e6bf953cef335c359d77bfcd" }, - { "rnr_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, - { "rnr_NA", "02e17c5f8c3c80f584ed343b8dcfa6d710dfef0889ec1e7728ce45ce559347c58c" }, - { "rnr_SH", "037536fb9bdfed10251f71543fb42679e7c52308bcd12146b2568b9a818d8b8377" }, - { "titomane_AR", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, - { "titomane_EU", "02e41feded94f0cc59f55f82f3c2c005d41da024e9a805b41105207ef89aa4bfbd" }, - { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, - { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 60 - { "xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, - { "xxspot1_XX", "02ef445a392fcaf3ad4176a5da7f43580e8056594e003eba6559a713711a27f955" }, - { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } -}; - -#define KOMODO_NOTARIES_TIMESTAMP1 1525132800 // May 1st 2018 1530921600 // 7/7/2017 -#define KOMODO_NOTARIES_HEIGHT1 ((814000 / KOMODO_ELECTION_GAP) * KOMODO_ELECTION_GAP) - -const char *Notaries_elected1[][2] = -{ - {"0dev1_jl777", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, - {"0dev2_kolo", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" }, - {"0dev3_kolo", "025af9d2b2a05338478159e9ac84543968fd18c45fd9307866b56f33898653b014" }, - {"0dev4_decker", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" }, - {"a-team_SH", "03b59ad322b17cb94080dc8e6dc10a0a865de6d47c16fb5b1a0b5f77f9507f3cce" }, - {"artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, - {"artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, - {"artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, - {"artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, - {"badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, - {"badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, // 10 - {"batman_AR", "033ecb640ec5852f42be24c3bf33ca123fb32ced134bed6aa2ba249cf31b0f2563" }, - {"batman_SH", "02ca5898931181d0b8aafc75ef56fce9c43656c0b6c9f64306e7c8542f6207018c" }, - {"ca333_EU", "03fc87b8c804f12a6bd18efd43b0ba2828e4e38834f6b44c0bfee19f966a12ba99" }, - {"chainmakers_EU", "02f3b08938a7f8d2609d567aebc4989eeded6e2e880c058fdf092c5da82c3bc5ee" }, - {"chainmakers_NA", "0276c6d1c65abc64c8559710b8aff4b9e33787072d3dda4ec9a47b30da0725f57a" }, - {"chainstrike_SH", "0370bcf10575d8fb0291afad7bf3a76929734f888228bc49e35c5c49b336002153" }, - {"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" }, - {"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" }, - {"crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, - {"crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, // 20 - {"dwy_EU", "0259c646288580221fdf0e92dbeecaee214504fdc8bbdf4a3019d6ec18b7540424" }, - {"emmanux_SH", "033f316114d950497fc1d9348f03770cd420f14f662ab2db6172df44c389a2667a" }, - {"etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, - {"fullmoon_AR", "03380314c4f42fa854df8c471618751879f9e8f0ff5dbabda2bd77d0f96cb35676" }, - {"fullmoon_NA", "030216211d8e2a48bae9e5d7eb3a42ca2b7aae8770979a791f883869aea2fa6eef" }, - {"fullmoon_SH", "03f34282fa57ecc7aba8afaf66c30099b5601e98dcbfd0d8a58c86c20d8b692c64" }, - {"goldenman_EU", "02d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388d" }, - {"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, - {"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, - {"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, // 30 - {"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, - {"jackson_AR", "038ff7cfe34cb13b524e0941d5cf710beca2ffb7e05ddf15ced7d4f14fbb0a6f69" }, - {"jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, - {"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, - {"komodoninja_EU", "038e567b99806b200b267b27bbca2abf6a3e8576406df5f872e3b38d30843cd5ba" }, - {"komodoninja_SH", "033178586896915e8456ebf407b1915351a617f46984001790f0cce3d6f3ada5c2" }, - {"komodopioneers_SH", "033ace50aedf8df70035b962a805431363a61cc4e69d99d90726a2d48fb195f68c" }, - {"libscott_SH", "03301a8248d41bc5dc926088a8cf31b65e2daf49eed7eb26af4fb03aae19682b95" }, - {"lukechilds_AR", "031aa66313ee024bbee8c17915cf7d105656d0ace5b4a43a3ab5eae1e14ec02696" }, - {"madmax_AR", "03891555b4a4393d655bf76f0ad0fb74e5159a615b6925907678edc2aac5e06a75" }, // 40 - {"meshbits_AR", "02957fd48ae6cb361b8a28cdb1b8ccf5067ff68eb1f90cba7df5f7934ed8eb4b2c" }, - {"meshbits_SH", "025c6e94877515dfd7b05682b9cc2fe4a49e076efe291e54fcec3add78183c1edb" }, - {"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, - {"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" }, - {"patchkez_SH", "0296270f394140640f8fa15684fc11255371abb6b9f253416ea2734e34607799c4" }, - {"pbca26_NA", "0276aca53a058556c485bbb60bdc54b600efe402a8b97f0341a7c04803ce204cb5" }, - {"peer2cloud_AR", "034e5563cb885999ae1530bd66fab728e580016629e8377579493b386bf6cebb15" }, - {"peer2cloud_SH", "03396ac453b3f23e20f30d4793c5b8ab6ded6993242df4f09fd91eb9a4f8aede84" }, - {"polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, - {"hyper_AR", "020f2f984d522051bd5247b61b080b4374a7ab389d959408313e8062acad3266b4" }, // 50 - {"hyper_EU", "03d00cf9ceace209c59fb013e112a786ad583d7de5ca45b1e0df3b4023bb14bf51" }, - {"hyper_SH", "0383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3" }, - {"hyper_NA", "03d91c43230336c0d4b769c9c940145a8c53168bf62e34d1bccd7f6cfc7e5592de" }, - {"popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, - {"popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, - {"alien_AR", "0348d9b1fc6acf81290405580f525ee49b4749ed4637b51a28b18caa26543b20f0" }, - {"alien_EU", "020aab8308d4df375a846a9e3b1c7e99597b90497efa021d50bcf1bbba23246527" }, - {"thegaltmines_NA", "031bea28bec98b6380958a493a703ddc3353d7b05eb452109a773eefd15a32e421" }, - {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, - {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 - {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, -}; -#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" - -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) -{ - static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; - static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; - static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; - static uint8_t null_pubkeys[64][33] = {0}; - int staked_era; - int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - timestamp = komodo_heightstamp(height); - else if ( ASSETCHAINS_SYMBOL[0] == 0 ) - timestamp = 0; - // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. - if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) - { - if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) - { - if ( did0 == 0 ) - { - n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - if ( Pubkeys == 0 ) - { - komodo_init(height); - //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); - } - pthread_mutex_lock(&komodo_mutex); - n = Pubkeys[htind].numnotaries; - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); - HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) - { - if ( kp->notaryid < n ) - { - mask |= (1LL << kp->notaryid); - memcpy(pubkeys[kp->notaryid],kp->pubkey,33); - } else printf("illegal notaryid.%d vs n.%d\n",kp->notaryid,n); - } - pthread_mutex_unlock(&komodo_mutex); - if ( (n < 64 && mask == ((1LL << n)-1)) || (n == 64 && mask == 0xffffffffffffffffLL) ) - return(n); - printf("error retrieving notaries ht.%d got mask.%llx for n.%d\n",height,(long long)mask,n); - return(-1); -} - -int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) -{ - int32_t i,n; uint8_t pubkeys[64][33]; - n = komodo_notaries(pubkeys,height,timestamp); - *numnotariesp = n; - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - numnotaries = Pubkeys[htind].numnotaries; - for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) - return(1); - else return(0); -} - -void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) -{ - static int32_t hwmheight; - int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; - if ( Pubkeys == 0 ) - Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); - memset(&N,0,sizeof(N)); - if ( origheight > 0 ) - { - height = (origheight + KOMODO_ELECTION_GAP/2); - height /= KOMODO_ELECTION_GAP; - height = ((height + 1) * KOMODO_ELECTION_GAP); - htind = (height / KOMODO_ELECTION_GAP); - if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); - } else htind = 0; - pthread_mutex_lock(&komodo_mutex); - for (k=0; kpubkey,pubkeys[k],33); - kp->notaryid = k; - HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); - if ( 0 && height > 10000 ) - { - for (i=0; i<33; i++) - printf("%02x",pubkeys[k][i]); - printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP); - } - } - N.numnotaries = num; - for (i=htind; i hwmheight ) - hwmheight = origheight; -} - -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) -{ - // -1 if not notary, 0 if notary, 1 if special notary - struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; - *notaryidp = -1; - if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) - { - printf("komodo_chosennotary ht.%d illegal\n",height); - return(-1); - } - if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) - { - modval = ((height % numnotaries) == *notaryidp); - return(modval); - } - } - if ( height >= 250000 ) - return(-1); - if ( Pubkeys == 0 ) - komodo_init(0); - htind = height / KOMODO_ELECTION_GAP; - if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - pthread_mutex_lock(&komodo_mutex); - HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); - pthread_mutex_unlock(&komodo_mutex); - if ( kp != 0 ) - { - if ( (numnotaries= Pubkeys[htind].numnotaries) > 0 ) - { - *notaryidp = kp->notaryid; - modval = ((height % numnotaries) == kp->notaryid); - //printf("found notary.%d ht.%d modval.%d\n",kp->notaryid,height,modval); - } else printf("unexpected zero notaries at height.%d\n",height); - } //else printf("cant find kp at htind.%d ht.%d\n",htind,height); - //int32_t i; for (i=0; i<33; i++) - // printf("%02x",pubkey33[i]); - //printf(" ht.%d notary.%d special.%d htind.%d num.%d\n",height,*notaryidp,modval,htind,numnotaries); - return(modval); -} - -//struct komodo_state *komodo_stateptr(char *symbol,char *dest); - -struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - for (i=sp->NUM_NPOINTS-1; i>=0; i--) - { - *idx = i; - np = &sp->NPOINTS[i]; - if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height ) - return(np); - } - } - *idx = -1; - return(0); -} - -struct notarized_checkpoint *komodo_npptr(int32_t height) -{ - int idx; - return komodo_npptr_for_height(height, &idx); -} - -struct notarized_checkpoint *komodo_npptr_at(int idx) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - if (idx < sp->NUM_NPOINTS) - return &sp->NPOINTS[idx]; - return(0); -} - -int32_t komodo_prevMoMheight() -{ - static uint256 zero; - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - for (i=sp->NUM_NPOINTS-1; i>=0; i--) - { - np = &sp->NPOINTS[i]; - if ( np->MoM != zero ) - return(np->notarized_height); - } - } - return(0); -} - -int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - *hashp = sp->NOTARIZED_HASH; - *txidp = sp->NOTARIZED_DESTTXID; - *prevMoMheightp = komodo_prevMoMheight(); - return(sp->NOTARIZED_HEIGHT); - } - else - { - *prevMoMheightp = 0; - memset(hashp,0,sizeof(*hashp)); - memset(txidp,0,sizeof(*txidp)); - return(0); - } -} - -int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - if ( sp->NOTARIZED_HEIGHT > 0 ) - { - if ( txheight < sp->NOTARIZED_HEIGHT ) - return(numconfs); - else return(1); - } - } - return(numconfs); -} - -int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) -{ - struct notarized_checkpoint *np = 0; - if ( (np= komodo_npptr(height)) != 0 ) - { - *notarized_htp = np->notarized_height; - *MoMp = np->MoM; - *kmdtxidp = np->notarized_desttxid; - *MoMoMp = np->MoMoM; - *MoMoMoffsetp = np->MoMoMoffset; - *MoMoMdepthp = np->MoMoMdepth; - *kmdstartip = np->kmdstarti; - *kmdendip = np->kmdendi; - return(np->MoMdepth & 0xffff); - } - *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; - memset(MoMp,0,sizeof(*MoMp)); - memset(MoMoMp,0,sizeof(*MoMoMp)); - memset(kmdtxidp,0,sizeof(*kmdtxidp)); - return(0); -} - -int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) -{ - struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - if ( sp->NUM_NPOINTS > 0 ) - { - flag = 0; - if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) - { - np = &sp->NPOINTS[sp->last_NPOINTSi-1]; - if ( np->nHeight < nHeight ) - { - for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) - { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - { - //printf("flag.1 i.%d np->ht %d [%d].ht %d >= nHeight.%d, last.%d num.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight,sp->last_NPOINTSi,sp->NUM_NPOINTS); - flag = 1; - break; - } - np = &sp->NPOINTS[i]; - sp->last_NPOINTSi = i; - } - } - } - if ( flag == 0 ) - { - np = 0; - for (i=0; iNUM_NPOINTS; i++) - { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - { - //printf("i.%d np->ht %d [%d].ht %d >= nHeight.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight); - break; - } - np = &sp->NPOINTS[i]; - sp->last_NPOINTSi = i; - } - } - } - if ( np != 0 ) - { - //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); - if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) ) - printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight); - *notarized_hashp = np->notarized_hash; - *notarized_desttxidp = np->notarized_desttxid; - return(np->notarized_height); - } - } - memset(notarized_hashp,0,sizeof(*notarized_hashp)); - memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); - return(0); -} - -void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) -{ - struct notarized_checkpoint *np; - if ( notarized_height >= nHeight ) - { - fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); - return; - } - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); - portable_mutex_lock(&komodo_mutex); - sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); - np = &sp->NPOINTS[sp->NUM_NPOINTS++]; - memset(np,0,sizeof(*np)); - np->nHeight = nHeight; - sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; - sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; - sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; - sp->MoM = np->MoM = MoM; - sp->MoMdepth = np->MoMdepth = MoMdepth; - portable_mutex_unlock(&komodo_mutex); -} - -void komodo_init(int32_t height) -{ - static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; - if ( 0 && height != 0 ) - printf("komodo_init ht.%d didinit.%d\n",height,didinit); - memset(&zero,0,sizeof(zero)); - if ( didinit == 0 ) - { - pthread_mutex_init(&komodo_mutex,NULL); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - if ( height >= 0 ) - { - n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); - for (k=0; k Date: Sat, 3 Nov 2018 01:41:39 +0800 Subject: [PATCH 0478/4463] oops --- src/main.cpp | 711 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 711 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 7ea4f85e8..c8e67f8b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1068,6 +1068,717 @@ int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only return(0); } +/****************************************************************************** + * Copyright © 2014-2018 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + + +#include "komodo_defs.h" + +#include "komodo_cJSON.h" + +#include "notaries_staked.h" + +extern int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; + +#define KOMODO_MAINNET_START 178999 + +extern char NOTARYADDRS[18][64]; + +//extern const char *notaries_STAKED[][2]; +//extern const int num_notaries_STAKED; + +const char *Notaries_genesis[][2] = +{ + { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + { "jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, + { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, + { "crackers_EU", "0340c66cf2c41c41efb420af57867baa765e8468c12aa996bfd816e1e07e410728" }, + { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, + { "locomb_EU", "025c6d26649b9d397e63323d96db42a9d3caad82e1d6076970efe5056c00c0779b" }, + { "fullmoon_AE", "0204a908350b8142698fdb6fabefc97fe0e04f537adc7522ba7a1e8f3bec003d4a" }, + { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, + { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + { "crackers_NA", "029e1c01131974f4cd3f564cc0c00eb87a0f9721043fbc1ca60f9bd0a1f73f64a1" }, + { "proto_EU", "03681ffdf17c8f4f0008cefb7fa0779c5e888339cdf932f0974483787a4d6747c1" }, // 10 + { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + { "farl4web_EU", "035caa40684ace968677dca3f09098aa02b70e533da32390a7654c626e0cf908e1" }, + { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, + { "traderbill_EU", "03196e8de3e2e5d872f31d79d6a859c8704a2198baf0af9c7b21e29656a7eb455f" }, + { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 15 + { "titomane_EU", "03517fcac101fed480ae4f2caf775560065957930d8c1facc83e30077e45bdd199" }, + { "supernet_AE", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, + { "supernet_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, + { "supernet_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, + { "yassin_EU", "033fb7231bb66484081952890d9a03f91164fb27d392d9152ec41336b71b15fbd0" }, // 20 + { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, + { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, + { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, + { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, + { "rnr_EU", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, + { "crackers_SH", "02313d72f9a16055737e14cfc528dcd5d0ef094cfce23d0348fe974b6b1a32e5f0" }, + { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, + { "polycryptoblock_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + { "titomane_NA", "0387046d9745414fb58a0fa3599078af5073e10347e4657ef7259a99cb4f10ad47" }, + { "titomane_AE", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, + { "kolo_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, + { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + { "eclips_EU", "0339369c1f5a2028d44be7be6f8ec3b907fdec814f87d2dead97cab4edb71a42e9" }, + { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, +}; + +const char *Notaries_elected0[][2] = +{ + { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, + { "0_kolo_testA", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, + { "artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + { "artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + { "artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, + { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, + { "crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, // 10 + { "crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, + { "crackers_SH", "02be28310e6312d1dd44651fd96f6a44ccc269a321f907502aae81d246fabdb03e" }, + { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, + { "etszombi_AR", "031c79168d15edabf17d9ec99531ea9baa20039d0cdc14d9525863b83341b210e9" }, + { "etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, // 15 + { "etszombi_SH", "025d7a193c0757f7437fad3431f027e7b5ed6c925b77daba52a8755d24bf682dde" }, + { "farl4web_EU", "0300ecf9121cccf14cf9423e2adb5d98ce0c4e251721fa345dec2e03abeffbab3f" }, + { "farl4web_SH", "0396bb5ed3c57aa1221d7775ae0ff751e4c7dc9be220d0917fa8bbdf670586c030" }, + { "fullmoon_AR", "0254b1d64840ce9ff6bec9dd10e33beb92af5f7cee628f999cb6bc0fea833347cc" }, + { "fullmoon_NA", "031fb362323b06e165231c887836a8faadb96eda88a79ca434e28b3520b47d235b" }, // 20 + { "fullmoon_SH", "030e12b42ec33a80e12e570b6c8274ce664565b5c3da106859e96a7208b93afd0d" }, + { "grewal_NA", "03adc0834c203d172bce814df7c7a5e13dc603105e6b0adabc942d0421aefd2132" }, + { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, + { "indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + { "indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + { "indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, + { "indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + { "jsgalt_NA", "027b3fb6fede798cd17c30dbfb7baf9332b3f8b1c7c513f443070874c410232446" }, + { "karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, // 30 + { "kashifali_EU", "033777c52a0190f261c6f66bd0e2bb299d30f012dcb8bfff384103211edb8bb207" }, + { "kolo_AR", "03016d19344c45341e023b72f9fb6e6152fdcfe105f3b4f50b82a4790ff54e9dc6" }, + { "kolo_SH", "02aa24064500756d9b0959b44d5325f2391d8e95c6127e109184937152c384e185" }, + { "metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + { "movecrypto_AR", "022783d94518e4dc77cbdf1a97915b29f427d7bc15ea867900a76665d3112be6f3" }, + { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, + { "movecrypto_NA", "02efb12f4d78f44b0542d1c60146738e4d5506d27ec98a469142c5c84b29de0a80" }, + { "movecrypto_SH", "031f9739a3ebd6037a967ce1582cde66e79ea9a0551c54731c59c6b80f635bc859" }, + { "muros_AR", "022d77402fd7179335da39479c829be73428b0ef33fb360a4de6890f37c2aa005e" }, + { "noashh_AR", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, // 40 + { "noashh_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, + { "noashh_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, + { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, + { "polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + { "pondsea_AR", "032e1c213787312099158f2d74a89e8240a991d162d4ce8017d8504d1d7004f735" }, + { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, + { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, + { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, + { "popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + { "popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, // 50 + { "ptytrader_NA", "0328c61467148b207400b23875234f8a825cce65b9c4c9b664f47410b8b8e3c222" }, + { "ptytrader_SH", "0250c93c492d8d5a6b565b90c22bee07c2d8701d6118c6267e99a4efd3c7748fa4" }, + { "rnr_AR", "029bdb08f931c0e98c2c4ba4ef45c8e33a34168cb2e6bf953cef335c359d77bfcd" }, + { "rnr_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, + { "rnr_NA", "02e17c5f8c3c80f584ed343b8dcfa6d710dfef0889ec1e7728ce45ce559347c58c" }, + { "rnr_SH", "037536fb9bdfed10251f71543fb42679e7c52308bcd12146b2568b9a818d8b8377" }, + { "titomane_AR", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, + { "titomane_EU", "02e41feded94f0cc59f55f82f3c2c005d41da024e9a805b41105207ef89aa4bfbd" }, + { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, + { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 60 + { "xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, + { "xxspot1_XX", "02ef445a392fcaf3ad4176a5da7f43580e8056594e003eba6559a713711a27f955" }, + { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } +}; + +#define KOMODO_NOTARIES_TIMESTAMP1 1525132800 // May 1st 2018 1530921600 // 7/7/2017 +#define KOMODO_NOTARIES_HEIGHT1 ((814000 / KOMODO_ELECTION_GAP) * KOMODO_ELECTION_GAP) + +const char *Notaries_elected1[][2] = +{ + {"0dev1_jl777", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + {"0dev2_kolo", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" }, + {"0dev3_kolo", "025af9d2b2a05338478159e9ac84543968fd18c45fd9307866b56f33898653b014" }, + {"0dev4_decker", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" }, + {"a-team_SH", "03b59ad322b17cb94080dc8e6dc10a0a865de6d47c16fb5b1a0b5f77f9507f3cce" }, + {"artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + {"artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + {"artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + {"artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + {"badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + {"badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, // 10 + {"batman_AR", "033ecb640ec5852f42be24c3bf33ca123fb32ced134bed6aa2ba249cf31b0f2563" }, + {"batman_SH", "02ca5898931181d0b8aafc75ef56fce9c43656c0b6c9f64306e7c8542f6207018c" }, + {"ca333_EU", "03fc87b8c804f12a6bd18efd43b0ba2828e4e38834f6b44c0bfee19f966a12ba99" }, + {"chainmakers_EU", "02f3b08938a7f8d2609d567aebc4989eeded6e2e880c058fdf092c5da82c3bc5ee" }, + {"chainmakers_NA", "0276c6d1c65abc64c8559710b8aff4b9e33787072d3dda4ec9a47b30da0725f57a" }, + {"chainstrike_SH", "0370bcf10575d8fb0291afad7bf3a76929734f888228bc49e35c5c49b336002153" }, + {"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" }, + {"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" }, + {"crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, + {"crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, // 20 + {"dwy_EU", "0259c646288580221fdf0e92dbeecaee214504fdc8bbdf4a3019d6ec18b7540424" }, + {"emmanux_SH", "033f316114d950497fc1d9348f03770cd420f14f662ab2db6172df44c389a2667a" }, + {"etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, + {"fullmoon_AR", "03380314c4f42fa854df8c471618751879f9e8f0ff5dbabda2bd77d0f96cb35676" }, + {"fullmoon_NA", "030216211d8e2a48bae9e5d7eb3a42ca2b7aae8770979a791f883869aea2fa6eef" }, + {"fullmoon_SH", "03f34282fa57ecc7aba8afaf66c30099b5601e98dcbfd0d8a58c86c20d8b692c64" }, + {"goldenman_EU", "02d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388d" }, + {"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + {"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + {"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, // 30 + {"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + {"jackson_AR", "038ff7cfe34cb13b524e0941d5cf710beca2ffb7e05ddf15ced7d4f14fbb0a6f69" }, + {"jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + {"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, + {"komodoninja_EU", "038e567b99806b200b267b27bbca2abf6a3e8576406df5f872e3b38d30843cd5ba" }, + {"komodoninja_SH", "033178586896915e8456ebf407b1915351a617f46984001790f0cce3d6f3ada5c2" }, + {"komodopioneers_SH", "033ace50aedf8df70035b962a805431363a61cc4e69d99d90726a2d48fb195f68c" }, + {"libscott_SH", "03301a8248d41bc5dc926088a8cf31b65e2daf49eed7eb26af4fb03aae19682b95" }, + {"lukechilds_AR", "031aa66313ee024bbee8c17915cf7d105656d0ace5b4a43a3ab5eae1e14ec02696" }, + {"madmax_AR", "03891555b4a4393d655bf76f0ad0fb74e5159a615b6925907678edc2aac5e06a75" }, // 40 + {"meshbits_AR", "02957fd48ae6cb361b8a28cdb1b8ccf5067ff68eb1f90cba7df5f7934ed8eb4b2c" }, + {"meshbits_SH", "025c6e94877515dfd7b05682b9cc2fe4a49e076efe291e54fcec3add78183c1edb" }, + {"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + {"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" }, + {"patchkez_SH", "0296270f394140640f8fa15684fc11255371abb6b9f253416ea2734e34607799c4" }, + {"pbca26_NA", "0276aca53a058556c485bbb60bdc54b600efe402a8b97f0341a7c04803ce204cb5" }, + {"peer2cloud_AR", "034e5563cb885999ae1530bd66fab728e580016629e8377579493b386bf6cebb15" }, + {"peer2cloud_SH", "03396ac453b3f23e20f30d4793c5b8ab6ded6993242df4f09fd91eb9a4f8aede84" }, + {"polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + {"hyper_AR", "020f2f984d522051bd5247b61b080b4374a7ab389d959408313e8062acad3266b4" }, // 50 + {"hyper_EU", "03d00cf9ceace209c59fb013e112a786ad583d7de5ca45b1e0df3b4023bb14bf51" }, + {"hyper_SH", "0383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3" }, + {"hyper_NA", "03d91c43230336c0d4b769c9c940145a8c53168bf62e34d1bccd7f6cfc7e5592de" }, + {"popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + {"popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, + {"alien_AR", "0348d9b1fc6acf81290405580f525ee49b4749ed4637b51a28b18caa26543b20f0" }, + {"alien_EU", "020aab8308d4df375a846a9e3b1c7e99597b90497efa021d50bcf1bbba23246527" }, + {"thegaltmines_NA", "031bea28bec98b6380958a493a703ddc3353d7b05eb452109a773eefd15a32e421" }, + {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; +#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" + +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) +{ + static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; + static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; + static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; + static uint8_t null_pubkeys[64][33] = {0}; + int staked_era; + int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; + if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + timestamp = komodo_heightstamp(height); + else if ( ASSETCHAINS_SYMBOL[0] == 0 ) + timestamp = 0; + // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. + if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) + { + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) + { + if ( did0 == 0 ) + { + n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + if ( Pubkeys == 0 ) + { + komodo_init(height); + //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); + } + pthread_mutex_lock(&komodo_mutex); + n = Pubkeys[htind].numnotaries; + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); + HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) + { + if ( kp->notaryid < n ) + { + mask |= (1LL << kp->notaryid); + memcpy(pubkeys[kp->notaryid],kp->pubkey,33); + } else printf("illegal notaryid.%d vs n.%d\n",kp->notaryid,n); + } + pthread_mutex_unlock(&komodo_mutex); + if ( (n < 64 && mask == ((1LL << n)-1)) || (n == 64 && mask == 0xffffffffffffffffLL) ) + return(n); + printf("error retrieving notaries ht.%d got mask.%llx for n.%d\n",height,(long long)mask,n); + return(-1); +} + +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) +{ + int32_t i,n; uint8_t pubkeys[64][33]; + n = komodo_notaries(pubkeys,height,timestamp); + *numnotariesp = n; + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + numnotaries = Pubkeys[htind].numnotaries; + for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) + return(1); + else return(0); +} + +void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) +{ + static int32_t hwmheight; + int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; + if ( Pubkeys == 0 ) + Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); + memset(&N,0,sizeof(N)); + if ( origheight > 0 ) + { + height = (origheight + KOMODO_ELECTION_GAP/2); + height /= KOMODO_ELECTION_GAP; + height = ((height + 1) * KOMODO_ELECTION_GAP); + htind = (height / KOMODO_ELECTION_GAP); + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); + } else htind = 0; + pthread_mutex_lock(&komodo_mutex); + for (k=0; kpubkey,pubkeys[k],33); + kp->notaryid = k; + HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); + if ( 0 && height > 10000 ) + { + for (i=0; i<33; i++) + printf("%02x",pubkeys[k][i]); + printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP); + } + } + N.numnotaries = num; + for (i=htind; i hwmheight ) + hwmheight = origheight; +} + +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) +{ + // -1 if not notary, 0 if notary, 1 if special notary + struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; + *notaryidp = -1; + if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) + { + printf("komodo_chosennotary ht.%d illegal\n",height); + return(-1); + } + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) + { + modval = ((height % numnotaries) == *notaryidp); + return(modval); + } + } + if ( height >= 250000 ) + return(-1); + if ( Pubkeys == 0 ) + komodo_init(0); + htind = height / KOMODO_ELECTION_GAP; + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + pthread_mutex_lock(&komodo_mutex); + HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); + pthread_mutex_unlock(&komodo_mutex); + if ( kp != 0 ) + { + if ( (numnotaries= Pubkeys[htind].numnotaries) > 0 ) + { + *notaryidp = kp->notaryid; + modval = ((height % numnotaries) == kp->notaryid); + //printf("found notary.%d ht.%d modval.%d\n",kp->notaryid,height,modval); + } else printf("unexpected zero notaries at height.%d\n",height); + } //else printf("cant find kp at htind.%d ht.%d\n",htind,height); + //int32_t i; for (i=0; i<33; i++) + // printf("%02x",pubkey33[i]); + //printf(" ht.%d notary.%d special.%d htind.%d num.%d\n",height,*notaryidp,modval,htind,numnotaries); + return(modval); +} + +//struct komodo_state *komodo_stateptr(char *symbol,char *dest); + +struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + *idx = i; + np = &sp->NPOINTS[i]; + if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height ) + return(np); + } + } + *idx = -1; + return(0); +} + +struct notarized_checkpoint *komodo_npptr(int32_t height) +{ + int idx; + return komodo_npptr_for_height(height, &idx); +} + +struct notarized_checkpoint *komodo_npptr_at(int idx) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + if (idx < sp->NUM_NPOINTS) + return &sp->NPOINTS[idx]; + return(0); +} + +int32_t komodo_prevMoMheight() +{ + static uint256 zero; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + np = &sp->NPOINTS[i]; + if ( np->MoM != zero ) + return(np->notarized_height); + } + } + return(0); +} + +int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + *hashp = sp->NOTARIZED_HASH; + *txidp = sp->NOTARIZED_DESTTXID; + *prevMoMheightp = komodo_prevMoMheight(); + return(sp->NOTARIZED_HEIGHT); + } + else + { + *prevMoMheightp = 0; + memset(hashp,0,sizeof(*hashp)); + memset(txidp,0,sizeof(*txidp)); + return(0); + } +} + +int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->NOTARIZED_HEIGHT > 0 ) + { + if ( txheight < sp->NOTARIZED_HEIGHT ) + return(numconfs); + else return(1); + } + } + return(numconfs); +} + +int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +{ + struct notarized_checkpoint *np = 0; + if ( (np= komodo_npptr(height)) != 0 ) + { + *notarized_htp = np->notarized_height; + *MoMp = np->MoM; + *kmdtxidp = np->notarized_desttxid; + *MoMoMp = np->MoMoM; + *MoMoMoffsetp = np->MoMoMoffset; + *MoMoMdepthp = np->MoMoMdepth; + *kmdstartip = np->kmdstarti; + *kmdendip = np->kmdendi; + return(np->MoMdepth & 0xffff); + } + *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; + memset(MoMp,0,sizeof(*MoMp)); + memset(MoMoMp,0,sizeof(*MoMoMp)); + memset(kmdtxidp,0,sizeof(*kmdtxidp)); + return(0); +} + +int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) +{ + struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->NUM_NPOINTS > 0 ) + { + flag = 0; + if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) + { + np = &sp->NPOINTS[sp->last_NPOINTSi-1]; + if ( np->nHeight < nHeight ) + { + for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + //printf("flag.1 i.%d np->ht %d [%d].ht %d >= nHeight.%d, last.%d num.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight,sp->last_NPOINTSi,sp->NUM_NPOINTS); + flag = 1; + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + } + if ( flag == 0 ) + { + np = 0; + for (i=0; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + //printf("i.%d np->ht %d [%d].ht %d >= nHeight.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight); + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + } + if ( np != 0 ) + { + //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); + if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) ) + printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight); + *notarized_hashp = np->notarized_hash; + *notarized_desttxidp = np->notarized_desttxid; + return(np->notarized_height); + } + } + memset(notarized_hashp,0,sizeof(*notarized_hashp)); + memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); + return(0); +} + +void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) +{ + struct notarized_checkpoint *np; + if ( notarized_height >= nHeight ) + { + fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); + return; + } + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); + portable_mutex_lock(&komodo_mutex); + sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); + np = &sp->NPOINTS[sp->NUM_NPOINTS++]; + memset(np,0,sizeof(*np)); + np->nHeight = nHeight; + sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; + sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; + sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; + sp->MoM = np->MoM = MoM; + sp->MoMdepth = np->MoMdepth = MoMdepth; + portable_mutex_unlock(&komodo_mutex); +} + +void komodo_init(int32_t height) +{ + static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; + if ( 0 && height != 0 ) + printf("komodo_init ht.%d didinit.%d\n",height,didinit); + memset(&zero,0,sizeof(zero)); + if ( didinit == 0 ) + { + pthread_mutex_init(&komodo_mutex,NULL); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + if ( height >= 0 ) + { + n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); + for (k=0; k Date: Sat, 3 Nov 2018 01:43:55 +0800 Subject: [PATCH 0479/4463] unikely --- src/bitcoin-cli.cpp | 2 +- src/komodo.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index aead9fb7a..bd39318c3 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -76,7 +76,7 @@ public: #include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" -#include "komodo_notary.h" +//#include "komodo_notary.h" #include "notaries_staked.cpp" diff --git a/src/komodo.h b/src/komodo.h index d2d0231f3..94a50a337 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -48,7 +48,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block); #include "komodo_bitcoind.h" #include "komodo_interest.h" #include "komodo_pax.h" -#include "komodo_notary.h" +//#include "komodo_notary.h" int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char *dest); #include "komodo_kv.h" From f8889dbe6d326f933d7877ef673870a454725269 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 01:46:19 +0800 Subject: [PATCH 0480/4463] main.h? --- src/main.cpp | 711 --------------------------------------------------- src/main.h | 708 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 708 insertions(+), 711 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c8e67f8b4..7ea4f85e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1068,717 +1068,6 @@ int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only return(0); } -/****************************************************************************** - * Copyright © 2014-2018 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - - -#include "komodo_defs.h" - -#include "komodo_cJSON.h" - -#include "notaries_staked.h" - -extern int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; - -#define KOMODO_MAINNET_START 178999 - -extern char NOTARYADDRS[18][64]; - -//extern const char *notaries_STAKED[][2]; -//extern const int num_notaries_STAKED; - -const char *Notaries_genesis[][2] = -{ - { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, - { "jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, - { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, - { "crackers_EU", "0340c66cf2c41c41efb420af57867baa765e8468c12aa996bfd816e1e07e410728" }, - { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, - { "locomb_EU", "025c6d26649b9d397e63323d96db42a9d3caad82e1d6076970efe5056c00c0779b" }, - { "fullmoon_AE", "0204a908350b8142698fdb6fabefc97fe0e04f537adc7522ba7a1e8f3bec003d4a" }, - { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, - { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, - { "crackers_NA", "029e1c01131974f4cd3f564cc0c00eb87a0f9721043fbc1ca60f9bd0a1f73f64a1" }, - { "proto_EU", "03681ffdf17c8f4f0008cefb7fa0779c5e888339cdf932f0974483787a4d6747c1" }, // 10 - { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, - { "farl4web_EU", "035caa40684ace968677dca3f09098aa02b70e533da32390a7654c626e0cf908e1" }, - { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, - { "traderbill_EU", "03196e8de3e2e5d872f31d79d6a859c8704a2198baf0af9c7b21e29656a7eb455f" }, - { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 15 - { "titomane_EU", "03517fcac101fed480ae4f2caf775560065957930d8c1facc83e30077e45bdd199" }, - { "supernet_AE", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, - { "supernet_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, - { "supernet_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, - { "yassin_EU", "033fb7231bb66484081952890d9a03f91164fb27d392d9152ec41336b71b15fbd0" }, // 20 - { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, - { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, - { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, - { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, - { "rnr_EU", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, - { "crackers_SH", "02313d72f9a16055737e14cfc528dcd5d0ef094cfce23d0348fe974b6b1a32e5f0" }, - { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, - { "polycryptoblock_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, - { "titomane_NA", "0387046d9745414fb58a0fa3599078af5073e10347e4657ef7259a99cb4f10ad47" }, - { "titomane_AE", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, - { "kolo_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, - { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, - { "eclips_EU", "0339369c1f5a2028d44be7be6f8ec3b907fdec814f87d2dead97cab4edb71a42e9" }, - { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, -}; - -const char *Notaries_elected0[][2] = -{ - { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, - { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, - { "0_kolo_testA", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, - { "artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, - { "artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, - { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, - { "artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, - { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, - { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, - { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, - { "crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, // 10 - { "crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, - { "crackers_SH", "02be28310e6312d1dd44651fd96f6a44ccc269a321f907502aae81d246fabdb03e" }, - { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, - { "etszombi_AR", "031c79168d15edabf17d9ec99531ea9baa20039d0cdc14d9525863b83341b210e9" }, - { "etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, // 15 - { "etszombi_SH", "025d7a193c0757f7437fad3431f027e7b5ed6c925b77daba52a8755d24bf682dde" }, - { "farl4web_EU", "0300ecf9121cccf14cf9423e2adb5d98ce0c4e251721fa345dec2e03abeffbab3f" }, - { "farl4web_SH", "0396bb5ed3c57aa1221d7775ae0ff751e4c7dc9be220d0917fa8bbdf670586c030" }, - { "fullmoon_AR", "0254b1d64840ce9ff6bec9dd10e33beb92af5f7cee628f999cb6bc0fea833347cc" }, - { "fullmoon_NA", "031fb362323b06e165231c887836a8faadb96eda88a79ca434e28b3520b47d235b" }, // 20 - { "fullmoon_SH", "030e12b42ec33a80e12e570b6c8274ce664565b5c3da106859e96a7208b93afd0d" }, - { "grewal_NA", "03adc0834c203d172bce814df7c7a5e13dc603105e6b0adabc942d0421aefd2132" }, - { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, - { "indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, - { "indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, - { "indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, - { "indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, - { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, - { "jsgalt_NA", "027b3fb6fede798cd17c30dbfb7baf9332b3f8b1c7c513f443070874c410232446" }, - { "karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, // 30 - { "kashifali_EU", "033777c52a0190f261c6f66bd0e2bb299d30f012dcb8bfff384103211edb8bb207" }, - { "kolo_AR", "03016d19344c45341e023b72f9fb6e6152fdcfe105f3b4f50b82a4790ff54e9dc6" }, - { "kolo_SH", "02aa24064500756d9b0959b44d5325f2391d8e95c6127e109184937152c384e185" }, - { "metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, - { "movecrypto_AR", "022783d94518e4dc77cbdf1a97915b29f427d7bc15ea867900a76665d3112be6f3" }, - { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, - { "movecrypto_NA", "02efb12f4d78f44b0542d1c60146738e4d5506d27ec98a469142c5c84b29de0a80" }, - { "movecrypto_SH", "031f9739a3ebd6037a967ce1582cde66e79ea9a0551c54731c59c6b80f635bc859" }, - { "muros_AR", "022d77402fd7179335da39479c829be73428b0ef33fb360a4de6890f37c2aa005e" }, - { "noashh_AR", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, // 40 - { "noashh_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, - { "noashh_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, - { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, - { "polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, - { "pondsea_AR", "032e1c213787312099158f2d74a89e8240a991d162d4ce8017d8504d1d7004f735" }, - { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, - { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, - { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, - { "popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, - { "popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, // 50 - { "ptytrader_NA", "0328c61467148b207400b23875234f8a825cce65b9c4c9b664f47410b8b8e3c222" }, - { "ptytrader_SH", "0250c93c492d8d5a6b565b90c22bee07c2d8701d6118c6267e99a4efd3c7748fa4" }, - { "rnr_AR", "029bdb08f931c0e98c2c4ba4ef45c8e33a34168cb2e6bf953cef335c359d77bfcd" }, - { "rnr_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, - { "rnr_NA", "02e17c5f8c3c80f584ed343b8dcfa6d710dfef0889ec1e7728ce45ce559347c58c" }, - { "rnr_SH", "037536fb9bdfed10251f71543fb42679e7c52308bcd12146b2568b9a818d8b8377" }, - { "titomane_AR", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, - { "titomane_EU", "02e41feded94f0cc59f55f82f3c2c005d41da024e9a805b41105207ef89aa4bfbd" }, - { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, - { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 60 - { "xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, - { "xxspot1_XX", "02ef445a392fcaf3ad4176a5da7f43580e8056594e003eba6559a713711a27f955" }, - { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } -}; - -#define KOMODO_NOTARIES_TIMESTAMP1 1525132800 // May 1st 2018 1530921600 // 7/7/2017 -#define KOMODO_NOTARIES_HEIGHT1 ((814000 / KOMODO_ELECTION_GAP) * KOMODO_ELECTION_GAP) - -const char *Notaries_elected1[][2] = -{ - {"0dev1_jl777", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, - {"0dev2_kolo", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" }, - {"0dev3_kolo", "025af9d2b2a05338478159e9ac84543968fd18c45fd9307866b56f33898653b014" }, - {"0dev4_decker", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" }, - {"a-team_SH", "03b59ad322b17cb94080dc8e6dc10a0a865de6d47c16fb5b1a0b5f77f9507f3cce" }, - {"artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, - {"artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, - {"artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, - {"artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, - {"badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, - {"badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, // 10 - {"batman_AR", "033ecb640ec5852f42be24c3bf33ca123fb32ced134bed6aa2ba249cf31b0f2563" }, - {"batman_SH", "02ca5898931181d0b8aafc75ef56fce9c43656c0b6c9f64306e7c8542f6207018c" }, - {"ca333_EU", "03fc87b8c804f12a6bd18efd43b0ba2828e4e38834f6b44c0bfee19f966a12ba99" }, - {"chainmakers_EU", "02f3b08938a7f8d2609d567aebc4989eeded6e2e880c058fdf092c5da82c3bc5ee" }, - {"chainmakers_NA", "0276c6d1c65abc64c8559710b8aff4b9e33787072d3dda4ec9a47b30da0725f57a" }, - {"chainstrike_SH", "0370bcf10575d8fb0291afad7bf3a76929734f888228bc49e35c5c49b336002153" }, - {"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" }, - {"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" }, - {"crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, - {"crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, // 20 - {"dwy_EU", "0259c646288580221fdf0e92dbeecaee214504fdc8bbdf4a3019d6ec18b7540424" }, - {"emmanux_SH", "033f316114d950497fc1d9348f03770cd420f14f662ab2db6172df44c389a2667a" }, - {"etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, - {"fullmoon_AR", "03380314c4f42fa854df8c471618751879f9e8f0ff5dbabda2bd77d0f96cb35676" }, - {"fullmoon_NA", "030216211d8e2a48bae9e5d7eb3a42ca2b7aae8770979a791f883869aea2fa6eef" }, - {"fullmoon_SH", "03f34282fa57ecc7aba8afaf66c30099b5601e98dcbfd0d8a58c86c20d8b692c64" }, - {"goldenman_EU", "02d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388d" }, - {"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, - {"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, - {"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, // 30 - {"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, - {"jackson_AR", "038ff7cfe34cb13b524e0941d5cf710beca2ffb7e05ddf15ced7d4f14fbb0a6f69" }, - {"jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, - {"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, - {"komodoninja_EU", "038e567b99806b200b267b27bbca2abf6a3e8576406df5f872e3b38d30843cd5ba" }, - {"komodoninja_SH", "033178586896915e8456ebf407b1915351a617f46984001790f0cce3d6f3ada5c2" }, - {"komodopioneers_SH", "033ace50aedf8df70035b962a805431363a61cc4e69d99d90726a2d48fb195f68c" }, - {"libscott_SH", "03301a8248d41bc5dc926088a8cf31b65e2daf49eed7eb26af4fb03aae19682b95" }, - {"lukechilds_AR", "031aa66313ee024bbee8c17915cf7d105656d0ace5b4a43a3ab5eae1e14ec02696" }, - {"madmax_AR", "03891555b4a4393d655bf76f0ad0fb74e5159a615b6925907678edc2aac5e06a75" }, // 40 - {"meshbits_AR", "02957fd48ae6cb361b8a28cdb1b8ccf5067ff68eb1f90cba7df5f7934ed8eb4b2c" }, - {"meshbits_SH", "025c6e94877515dfd7b05682b9cc2fe4a49e076efe291e54fcec3add78183c1edb" }, - {"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, - {"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" }, - {"patchkez_SH", "0296270f394140640f8fa15684fc11255371abb6b9f253416ea2734e34607799c4" }, - {"pbca26_NA", "0276aca53a058556c485bbb60bdc54b600efe402a8b97f0341a7c04803ce204cb5" }, - {"peer2cloud_AR", "034e5563cb885999ae1530bd66fab728e580016629e8377579493b386bf6cebb15" }, - {"peer2cloud_SH", "03396ac453b3f23e20f30d4793c5b8ab6ded6993242df4f09fd91eb9a4f8aede84" }, - {"polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, - {"hyper_AR", "020f2f984d522051bd5247b61b080b4374a7ab389d959408313e8062acad3266b4" }, // 50 - {"hyper_EU", "03d00cf9ceace209c59fb013e112a786ad583d7de5ca45b1e0df3b4023bb14bf51" }, - {"hyper_SH", "0383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3" }, - {"hyper_NA", "03d91c43230336c0d4b769c9c940145a8c53168bf62e34d1bccd7f6cfc7e5592de" }, - {"popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, - {"popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, - {"alien_AR", "0348d9b1fc6acf81290405580f525ee49b4749ed4637b51a28b18caa26543b20f0" }, - {"alien_EU", "020aab8308d4df375a846a9e3b1c7e99597b90497efa021d50bcf1bbba23246527" }, - {"thegaltmines_NA", "031bea28bec98b6380958a493a703ddc3353d7b05eb452109a773eefd15a32e421" }, - {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, - {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 - {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, - {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, - {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, -}; -#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" - -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) -{ - static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; - static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; - static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; - static uint8_t null_pubkeys[64][33] = {0}; - int staked_era; - int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - timestamp = komodo_heightstamp(height); - else if ( ASSETCHAINS_SYMBOL[0] == 0 ) - timestamp = 0; - // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. - if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) - { - if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) - { - if ( did0 == 0 ) - { - n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - if ( Pubkeys == 0 ) - { - komodo_init(height); - //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); - } - pthread_mutex_lock(&komodo_mutex); - n = Pubkeys[htind].numnotaries; - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); - HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) - { - if ( kp->notaryid < n ) - { - mask |= (1LL << kp->notaryid); - memcpy(pubkeys[kp->notaryid],kp->pubkey,33); - } else printf("illegal notaryid.%d vs n.%d\n",kp->notaryid,n); - } - pthread_mutex_unlock(&komodo_mutex); - if ( (n < 64 && mask == ((1LL << n)-1)) || (n == 64 && mask == 0xffffffffffffffffLL) ) - return(n); - printf("error retrieving notaries ht.%d got mask.%llx for n.%d\n",height,(long long)mask,n); - return(-1); -} - -int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) -{ - int32_t i,n; uint8_t pubkeys[64][33]; - n = komodo_notaries(pubkeys,height,timestamp); - *numnotariesp = n; - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - numnotaries = Pubkeys[htind].numnotaries; - for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) - return(1); - else return(0); -} - -void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) -{ - static int32_t hwmheight; - int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; - if ( Pubkeys == 0 ) - Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); - memset(&N,0,sizeof(N)); - if ( origheight > 0 ) - { - height = (origheight + KOMODO_ELECTION_GAP/2); - height /= KOMODO_ELECTION_GAP; - height = ((height + 1) * KOMODO_ELECTION_GAP); - htind = (height / KOMODO_ELECTION_GAP); - if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); - } else htind = 0; - pthread_mutex_lock(&komodo_mutex); - for (k=0; kpubkey,pubkeys[k],33); - kp->notaryid = k; - HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); - if ( 0 && height > 10000 ) - { - for (i=0; i<33; i++) - printf("%02x",pubkeys[k][i]); - printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP); - } - } - N.numnotaries = num; - for (i=htind; i hwmheight ) - hwmheight = origheight; -} - -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) -{ - // -1 if not notary, 0 if notary, 1 if special notary - struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; - *notaryidp = -1; - if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) - { - printf("komodo_chosennotary ht.%d illegal\n",height); - return(-1); - } - if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) - { - modval = ((height % numnotaries) == *notaryidp); - return(modval); - } - } - if ( height >= 250000 ) - return(-1); - if ( Pubkeys == 0 ) - komodo_init(0); - htind = height / KOMODO_ELECTION_GAP; - if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - pthread_mutex_lock(&komodo_mutex); - HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); - pthread_mutex_unlock(&komodo_mutex); - if ( kp != 0 ) - { - if ( (numnotaries= Pubkeys[htind].numnotaries) > 0 ) - { - *notaryidp = kp->notaryid; - modval = ((height % numnotaries) == kp->notaryid); - //printf("found notary.%d ht.%d modval.%d\n",kp->notaryid,height,modval); - } else printf("unexpected zero notaries at height.%d\n",height); - } //else printf("cant find kp at htind.%d ht.%d\n",htind,height); - //int32_t i; for (i=0; i<33; i++) - // printf("%02x",pubkey33[i]); - //printf(" ht.%d notary.%d special.%d htind.%d num.%d\n",height,*notaryidp,modval,htind,numnotaries); - return(modval); -} - -//struct komodo_state *komodo_stateptr(char *symbol,char *dest); - -struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - for (i=sp->NUM_NPOINTS-1; i>=0; i--) - { - *idx = i; - np = &sp->NPOINTS[i]; - if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height ) - return(np); - } - } - *idx = -1; - return(0); -} - -struct notarized_checkpoint *komodo_npptr(int32_t height) -{ - int idx; - return komodo_npptr_for_height(height, &idx); -} - -struct notarized_checkpoint *komodo_npptr_at(int idx) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - if (idx < sp->NUM_NPOINTS) - return &sp->NPOINTS[idx]; - return(0); -} - -int32_t komodo_prevMoMheight() -{ - static uint256 zero; - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - for (i=sp->NUM_NPOINTS-1; i>=0; i--) - { - np = &sp->NPOINTS[i]; - if ( np->MoM != zero ) - return(np->notarized_height); - } - } - return(0); -} - -int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - *hashp = sp->NOTARIZED_HASH; - *txidp = sp->NOTARIZED_DESTTXID; - *prevMoMheightp = komodo_prevMoMheight(); - return(sp->NOTARIZED_HEIGHT); - } - else - { - *prevMoMheightp = 0; - memset(hashp,0,sizeof(*hashp)); - memset(txidp,0,sizeof(*txidp)); - return(0); - } -} - -int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - if ( sp->NOTARIZED_HEIGHT > 0 ) - { - if ( txheight < sp->NOTARIZED_HEIGHT ) - return(numconfs); - else return(1); - } - } - return(numconfs); -} - -int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) -{ - struct notarized_checkpoint *np = 0; - if ( (np= komodo_npptr(height)) != 0 ) - { - *notarized_htp = np->notarized_height; - *MoMp = np->MoM; - *kmdtxidp = np->notarized_desttxid; - *MoMoMp = np->MoMoM; - *MoMoMoffsetp = np->MoMoMoffset; - *MoMoMdepthp = np->MoMoMdepth; - *kmdstartip = np->kmdstarti; - *kmdendip = np->kmdendi; - return(np->MoMdepth & 0xffff); - } - *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; - memset(MoMp,0,sizeof(*MoMp)); - memset(MoMoMp,0,sizeof(*MoMoMp)); - memset(kmdtxidp,0,sizeof(*kmdtxidp)); - return(0); -} - -int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) -{ - struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - if ( sp->NUM_NPOINTS > 0 ) - { - flag = 0; - if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) - { - np = &sp->NPOINTS[sp->last_NPOINTSi-1]; - if ( np->nHeight < nHeight ) - { - for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) - { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - { - //printf("flag.1 i.%d np->ht %d [%d].ht %d >= nHeight.%d, last.%d num.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight,sp->last_NPOINTSi,sp->NUM_NPOINTS); - flag = 1; - break; - } - np = &sp->NPOINTS[i]; - sp->last_NPOINTSi = i; - } - } - } - if ( flag == 0 ) - { - np = 0; - for (i=0; iNUM_NPOINTS; i++) - { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - { - //printf("i.%d np->ht %d [%d].ht %d >= nHeight.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight); - break; - } - np = &sp->NPOINTS[i]; - sp->last_NPOINTSi = i; - } - } - } - if ( np != 0 ) - { - //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); - if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) ) - printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight); - *notarized_hashp = np->notarized_hash; - *notarized_desttxidp = np->notarized_desttxid; - return(np->notarized_height); - } - } - memset(notarized_hashp,0,sizeof(*notarized_hashp)); - memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); - return(0); -} - -void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) -{ - struct notarized_checkpoint *np; - if ( notarized_height >= nHeight ) - { - fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); - return; - } - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); - portable_mutex_lock(&komodo_mutex); - sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); - np = &sp->NPOINTS[sp->NUM_NPOINTS++]; - memset(np,0,sizeof(*np)); - np->nHeight = nHeight; - sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; - sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; - sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; - sp->MoM = np->MoM = MoM; - sp->MoMdepth = np->MoMdepth = MoMdepth; - portable_mutex_unlock(&komodo_mutex); -} - -void komodo_init(int32_t height) -{ - static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; - if ( 0 && height != 0 ) - printf("komodo_init ht.%d didinit.%d\n",height,didinit); - memset(&zero,0,sizeof(zero)); - if ( didinit == 0 ) - { - pthread_mutex_init(&komodo_mutex,NULL); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - if ( height >= 0 ) - { - n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); - for (k=0; k= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) + { + if ( did0 == 0 ) + { + n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + if ( Pubkeys == 0 ) + { + komodo_init(height); + //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); + } + pthread_mutex_lock(&komodo_mutex); + n = Pubkeys[htind].numnotaries; + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); + HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) + { + if ( kp->notaryid < n ) + { + mask |= (1LL << kp->notaryid); + memcpy(pubkeys[kp->notaryid],kp->pubkey,33); + } else printf("illegal notaryid.%d vs n.%d\n",kp->notaryid,n); + } + pthread_mutex_unlock(&komodo_mutex); + if ( (n < 64 && mask == ((1LL << n)-1)) || (n == 64 && mask == 0xffffffffffffffffLL) ) + return(n); + printf("error retrieving notaries ht.%d got mask.%llx for n.%d\n",height,(long long)mask,n); + return(-1); +} + +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) +{ + int32_t i,n; uint8_t pubkeys[64][33]; + n = komodo_notaries(pubkeys,height,timestamp); + *numnotariesp = n; + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + numnotaries = Pubkeys[htind].numnotaries; + for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) + return(1); + else return(0); +} + +void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) +{ + static int32_t hwmheight; + int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; + if ( Pubkeys == 0 ) + Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); + memset(&N,0,sizeof(N)); + if ( origheight > 0 ) + { + height = (origheight + KOMODO_ELECTION_GAP/2); + height /= KOMODO_ELECTION_GAP; + height = ((height + 1) * KOMODO_ELECTION_GAP); + htind = (height / KOMODO_ELECTION_GAP); + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); + } else htind = 0; + pthread_mutex_lock(&komodo_mutex); + for (k=0; kpubkey,pubkeys[k],33); + kp->notaryid = k; + HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); + if ( 0 && height > 10000 ) + { + for (i=0; i<33; i++) + printf("%02x",pubkeys[k][i]); + printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP); + } + } + N.numnotaries = num; + for (i=htind; i hwmheight ) + hwmheight = origheight; +} + +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) +{ + // -1 if not notary, 0 if notary, 1 if special notary + struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; + *notaryidp = -1; + if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) + { + printf("komodo_chosennotary ht.%d illegal\n",height); + return(-1); + } + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) + { + modval = ((height % numnotaries) == *notaryidp); + return(modval); + } + } + if ( height >= 250000 ) + return(-1); + if ( Pubkeys == 0 ) + komodo_init(0); + htind = height / KOMODO_ELECTION_GAP; + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + pthread_mutex_lock(&komodo_mutex); + HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); + pthread_mutex_unlock(&komodo_mutex); + if ( kp != 0 ) + { + if ( (numnotaries= Pubkeys[htind].numnotaries) > 0 ) + { + *notaryidp = kp->notaryid; + modval = ((height % numnotaries) == kp->notaryid); + //printf("found notary.%d ht.%d modval.%d\n",kp->notaryid,height,modval); + } else printf("unexpected zero notaries at height.%d\n",height); + } //else printf("cant find kp at htind.%d ht.%d\n",htind,height); + //int32_t i; for (i=0; i<33; i++) + // printf("%02x",pubkey33[i]); + //printf(" ht.%d notary.%d special.%d htind.%d num.%d\n",height,*notaryidp,modval,htind,numnotaries); + return(modval); +} + +//struct komodo_state *komodo_stateptr(char *symbol,char *dest); + +struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + *idx = i; + np = &sp->NPOINTS[i]; + if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height ) + return(np); + } + } + *idx = -1; + return(0); +} + +struct notarized_checkpoint *komodo_npptr(int32_t height) +{ + int idx; + return komodo_npptr_for_height(height, &idx); +} + +struct notarized_checkpoint *komodo_npptr_at(int idx) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + if (idx < sp->NUM_NPOINTS) + return &sp->NPOINTS[idx]; + return(0); +} + +int32_t komodo_prevMoMheight() +{ + static uint256 zero; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + np = &sp->NPOINTS[i]; + if ( np->MoM != zero ) + return(np->notarized_height); + } + } + return(0); +} + +int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + *hashp = sp->NOTARIZED_HASH; + *txidp = sp->NOTARIZED_DESTTXID; + *prevMoMheightp = komodo_prevMoMheight(); + return(sp->NOTARIZED_HEIGHT); + } + else + { + *prevMoMheightp = 0; + memset(hashp,0,sizeof(*hashp)); + memset(txidp,0,sizeof(*txidp)); + return(0); + } +} + +int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->NOTARIZED_HEIGHT > 0 ) + { + if ( txheight < sp->NOTARIZED_HEIGHT ) + return(numconfs); + else return(1); + } + } + return(numconfs); +} + +int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +{ + struct notarized_checkpoint *np = 0; + if ( (np= komodo_npptr(height)) != 0 ) + { + *notarized_htp = np->notarized_height; + *MoMp = np->MoM; + *kmdtxidp = np->notarized_desttxid; + *MoMoMp = np->MoMoM; + *MoMoMoffsetp = np->MoMoMoffset; + *MoMoMdepthp = np->MoMoMdepth; + *kmdstartip = np->kmdstarti; + *kmdendip = np->kmdendi; + return(np->MoMdepth & 0xffff); + } + *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; + memset(MoMp,0,sizeof(*MoMp)); + memset(MoMoMp,0,sizeof(*MoMoMp)); + memset(kmdtxidp,0,sizeof(*kmdtxidp)); + return(0); +} + +int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) +{ + struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->NUM_NPOINTS > 0 ) + { + flag = 0; + if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) + { + np = &sp->NPOINTS[sp->last_NPOINTSi-1]; + if ( np->nHeight < nHeight ) + { + for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + //printf("flag.1 i.%d np->ht %d [%d].ht %d >= nHeight.%d, last.%d num.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight,sp->last_NPOINTSi,sp->NUM_NPOINTS); + flag = 1; + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + } + if ( flag == 0 ) + { + np = 0; + for (i=0; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + //printf("i.%d np->ht %d [%d].ht %d >= nHeight.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight); + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + } + if ( np != 0 ) + { + //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); + if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) ) + printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight); + *notarized_hashp = np->notarized_hash; + *notarized_desttxidp = np->notarized_desttxid; + return(np->notarized_height); + } + } + memset(notarized_hashp,0,sizeof(*notarized_hashp)); + memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); + return(0); +} + +void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) +{ + struct notarized_checkpoint *np; + if ( notarized_height >= nHeight ) + { + fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); + return; + } + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); + portable_mutex_lock(&komodo_mutex); + sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); + np = &sp->NPOINTS[sp->NUM_NPOINTS++]; + memset(np,0,sizeof(*np)); + np->nHeight = nHeight; + sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; + sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; + sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; + sp->MoM = np->MoM = MoM; + sp->MoMdepth = np->MoMdepth = MoMdepth; + portable_mutex_unlock(&komodo_mutex); +} + +void komodo_init(int32_t height) +{ + static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; + if ( 0 && height != 0 ) + printf("komodo_init ht.%d didinit.%d\n",height,didinit); + memset(&zero,0,sizeof(zero)); + if ( didinit == 0 ) + { + pthread_mutex_init(&komodo_mutex,NULL); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + if ( height >= 0 ) + { + n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); + for (k=0; k Date: Sat, 3 Nov 2018 01:48:53 +0800 Subject: [PATCH 0481/4463] try --- src/bitcoin-cli.cpp | 2 +- src/komodo.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index bd39318c3..2cababe69 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -76,7 +76,7 @@ public: #include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" -//#include "komodo_notary.h" +#include "main.h" #include "notaries_staked.cpp" diff --git a/src/komodo.h b/src/komodo.h index 94a50a337..46338b705 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -48,7 +48,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block); #include "komodo_bitcoind.h" #include "komodo_interest.h" #include "komodo_pax.h" -//#include "komodo_notary.h" +#include "main.h" int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char *dest); #include "komodo_kv.h" From 98a8eea3fa339f9596d354775d0f0f49238fae76 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 02:06:19 +0800 Subject: [PATCH 0482/4463] revert that --- src/bitcoin-cli.cpp | 2 +- src/komodo.h | 2 +- src/komodo_notary.h | 709 ++++++++++++++++++++++++++++++++++++++++++++ src/main.h | 708 ------------------------------------------- 4 files changed, 711 insertions(+), 710 deletions(-) create mode 100644 src/komodo_notary.h diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 2cababe69..aead9fb7a 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -76,7 +76,7 @@ public: #include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" -#include "main.h" +#include "komodo_notary.h" #include "notaries_staked.cpp" diff --git a/src/komodo.h b/src/komodo.h index 46338b705..d2d0231f3 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -48,7 +48,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block); #include "komodo_bitcoind.h" #include "komodo_interest.h" #include "komodo_pax.h" -#include "main.h" +#include "komodo_notary.h" int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char *dest); #include "komodo_kv.h" diff --git a/src/komodo_notary.h b/src/komodo_notary.h new file mode 100644 index 000000000..6291c8e1a --- /dev/null +++ b/src/komodo_notary.h @@ -0,0 +1,709 @@ +/****************************************************************************** + * Copyright © 2014-2018 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + + +#include "komodo_defs.h" + +#include "komodo_cJSON.h" + +#include "notaries_staked.h" + +extern int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; + +#define KOMODO_MAINNET_START 178999 + +extern char NOTARYADDRS[18][64]; + +//extern const char *notaries_STAKED[][2]; +//extern const int num_notaries_STAKED; + +const char *Notaries_genesis[][2] = +{ + { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + { "jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, + { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, + { "crackers_EU", "0340c66cf2c41c41efb420af57867baa765e8468c12aa996bfd816e1e07e410728" }, + { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, + { "locomb_EU", "025c6d26649b9d397e63323d96db42a9d3caad82e1d6076970efe5056c00c0779b" }, + { "fullmoon_AE", "0204a908350b8142698fdb6fabefc97fe0e04f537adc7522ba7a1e8f3bec003d4a" }, + { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, + { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + { "crackers_NA", "029e1c01131974f4cd3f564cc0c00eb87a0f9721043fbc1ca60f9bd0a1f73f64a1" }, + { "proto_EU", "03681ffdf17c8f4f0008cefb7fa0779c5e888339cdf932f0974483787a4d6747c1" }, // 10 + { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + { "farl4web_EU", "035caa40684ace968677dca3f09098aa02b70e533da32390a7654c626e0cf908e1" }, + { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, + { "traderbill_EU", "03196e8de3e2e5d872f31d79d6a859c8704a2198baf0af9c7b21e29656a7eb455f" }, + { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 15 + { "titomane_EU", "03517fcac101fed480ae4f2caf775560065957930d8c1facc83e30077e45bdd199" }, + { "supernet_AE", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, + { "supernet_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, + { "supernet_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, + { "yassin_EU", "033fb7231bb66484081952890d9a03f91164fb27d392d9152ec41336b71b15fbd0" }, // 20 + { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, + { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, + { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, + { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, + { "rnr_EU", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, + { "crackers_SH", "02313d72f9a16055737e14cfc528dcd5d0ef094cfce23d0348fe974b6b1a32e5f0" }, + { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, + { "polycryptoblock_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + { "titomane_NA", "0387046d9745414fb58a0fa3599078af5073e10347e4657ef7259a99cb4f10ad47" }, + { "titomane_AE", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, + { "kolo_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, + { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + { "eclips_EU", "0339369c1f5a2028d44be7be6f8ec3b907fdec814f87d2dead97cab4edb71a42e9" }, + { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, +}; + +const char *Notaries_elected0[][2] = +{ + { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, + { "0_kolo_testA", "0287aa4b73988ba26cf6565d815786caf0d2c4af704d7883d163ee89cd9977edec" }, + { "artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + { "artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + { "artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + { "artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + { "badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + { "badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, + { "badass_SH", "026b49dd3923b78a592c1b475f208e23698d3f085c4c3b4906a59faf659fd9530b" }, + { "crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, // 10 + { "crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, + { "crackers_SH", "02be28310e6312d1dd44651fd96f6a44ccc269a321f907502aae81d246fabdb03e" }, + { "durerus_EU", "02bcbd287670bdca2c31e5d50130adb5dea1b53198f18abeec7211825f47485d57" }, + { "etszombi_AR", "031c79168d15edabf17d9ec99531ea9baa20039d0cdc14d9525863b83341b210e9" }, + { "etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, // 15 + { "etszombi_SH", "025d7a193c0757f7437fad3431f027e7b5ed6c925b77daba52a8755d24bf682dde" }, + { "farl4web_EU", "0300ecf9121cccf14cf9423e2adb5d98ce0c4e251721fa345dec2e03abeffbab3f" }, + { "farl4web_SH", "0396bb5ed3c57aa1221d7775ae0ff751e4c7dc9be220d0917fa8bbdf670586c030" }, + { "fullmoon_AR", "0254b1d64840ce9ff6bec9dd10e33beb92af5f7cee628f999cb6bc0fea833347cc" }, + { "fullmoon_NA", "031fb362323b06e165231c887836a8faadb96eda88a79ca434e28b3520b47d235b" }, // 20 + { "fullmoon_SH", "030e12b42ec33a80e12e570b6c8274ce664565b5c3da106859e96a7208b93afd0d" }, + { "grewal_NA", "03adc0834c203d172bce814df7c7a5e13dc603105e6b0adabc942d0421aefd2132" }, + { "grewal_SH", "03212a73f5d38a675ee3cdc6e82542a96c38c3d1c79d25a1ed2e42fcf6a8be4e68" }, + { "indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + { "indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + { "indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, + { "indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + { "jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + { "jsgalt_NA", "027b3fb6fede798cd17c30dbfb7baf9332b3f8b1c7c513f443070874c410232446" }, + { "karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, // 30 + { "kashifali_EU", "033777c52a0190f261c6f66bd0e2bb299d30f012dcb8bfff384103211edb8bb207" }, + { "kolo_AR", "03016d19344c45341e023b72f9fb6e6152fdcfe105f3b4f50b82a4790ff54e9dc6" }, + { "kolo_SH", "02aa24064500756d9b0959b44d5325f2391d8e95c6127e109184937152c384e185" }, + { "metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + { "movecrypto_AR", "022783d94518e4dc77cbdf1a97915b29f427d7bc15ea867900a76665d3112be6f3" }, + { "movecrypto_EU", "021ab53bc6cf2c46b8a5456759f9d608966eff87384c2b52c0ac4cc8dd51e9cc42" }, + { "movecrypto_NA", "02efb12f4d78f44b0542d1c60146738e4d5506d27ec98a469142c5c84b29de0a80" }, + { "movecrypto_SH", "031f9739a3ebd6037a967ce1582cde66e79ea9a0551c54731c59c6b80f635bc859" }, + { "muros_AR", "022d77402fd7179335da39479c829be73428b0ef33fb360a4de6890f37c2aa005e" }, + { "noashh_AR", "029d93ef78197dc93892d2a30e5a54865f41e0ca3ab7eb8e3dcbc59c8756b6e355" }, // 40 + { "noashh_EU", "02061c6278b91fd4ac5cab4401100ffa3b2d5a277e8f71db23401cc071b3665546" }, + { "noashh_NA", "033c073366152b6b01535e15dd966a3a8039169584d06e27d92a69889b720d44e1" }, + { "nxtswe_EU", "032fb104e5eaa704a38a52c126af8f67e870d70f82977e5b2f093d5c1c21ae5899" }, + { "polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + { "pondsea_AR", "032e1c213787312099158f2d74a89e8240a991d162d4ce8017d8504d1d7004f735" }, + { "pondsea_EU", "0225aa6f6f19e543180b31153d9e6d55d41bc7ec2ba191fd29f19a2f973544e29d" }, + { "pondsea_NA", "031bcfdbb62268e2ff8dfffeb9ddff7fe95fca46778c77eebff9c3829dfa1bb411" }, + { "pondsea_SH", "02209073bc0943451498de57f802650311b1f12aa6deffcd893da198a544c04f36" }, + { "popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + { "popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, // 50 + { "ptytrader_NA", "0328c61467148b207400b23875234f8a825cce65b9c4c9b664f47410b8b8e3c222" }, + { "ptytrader_SH", "0250c93c492d8d5a6b565b90c22bee07c2d8701d6118c6267e99a4efd3c7748fa4" }, + { "rnr_AR", "029bdb08f931c0e98c2c4ba4ef45c8e33a34168cb2e6bf953cef335c359d77bfcd" }, + { "rnr_EU", "03f5c08dadffa0ffcafb8dd7ffc38c22887bd02702a6c9ac3440deddcf2837692b" }, + { "rnr_NA", "02e17c5f8c3c80f584ed343b8dcfa6d710dfef0889ec1e7728ce45ce559347c58c" }, + { "rnr_SH", "037536fb9bdfed10251f71543fb42679e7c52308bcd12146b2568b9a818d8b8377" }, + { "titomane_AR", "03cda6ca5c2d02db201488a54a548dbfc10533bdc275d5ea11928e8d6ab33c2185" }, + { "titomane_EU", "02e41feded94f0cc59f55f82f3c2c005d41da024e9a805b41105207ef89aa4bfbd" }, + { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, + { "vanbreuk_EU", "024f3cad7601d2399c131fd070e797d9cd8533868685ddbe515daa53c2e26004c3" }, // 60 + { "xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, + { "xxspot1_XX", "02ef445a392fcaf3ad4176a5da7f43580e8056594e003eba6559a713711a27f955" }, + { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } +}; + +#define KOMODO_NOTARIES_TIMESTAMP1 1525132800 // May 1st 2018 1530921600 // 7/7/2017 +#define KOMODO_NOTARIES_HEIGHT1 ((814000 / KOMODO_ELECTION_GAP) * KOMODO_ELECTION_GAP) + +const char *Notaries_elected1[][2] = +{ + {"0dev1_jl777", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + {"0dev2_kolo", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" }, + {"0dev3_kolo", "025af9d2b2a05338478159e9ac84543968fd18c45fd9307866b56f33898653b014" }, + {"0dev4_decker", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" }, + {"a-team_SH", "03b59ad322b17cb94080dc8e6dc10a0a865de6d47c16fb5b1a0b5f77f9507f3cce" }, + {"artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + {"artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + {"artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + {"artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + {"badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + {"badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, // 10 + {"batman_AR", "033ecb640ec5852f42be24c3bf33ca123fb32ced134bed6aa2ba249cf31b0f2563" }, + {"batman_SH", "02ca5898931181d0b8aafc75ef56fce9c43656c0b6c9f64306e7c8542f6207018c" }, + {"ca333_EU", "03fc87b8c804f12a6bd18efd43b0ba2828e4e38834f6b44c0bfee19f966a12ba99" }, + {"chainmakers_EU", "02f3b08938a7f8d2609d567aebc4989eeded6e2e880c058fdf092c5da82c3bc5ee" }, + {"chainmakers_NA", "0276c6d1c65abc64c8559710b8aff4b9e33787072d3dda4ec9a47b30da0725f57a" }, + {"chainstrike_SH", "0370bcf10575d8fb0291afad7bf3a76929734f888228bc49e35c5c49b336002153" }, + {"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" }, + {"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" }, + {"crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, + {"crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, // 20 + {"dwy_EU", "0259c646288580221fdf0e92dbeecaee214504fdc8bbdf4a3019d6ec18b7540424" }, + {"emmanux_SH", "033f316114d950497fc1d9348f03770cd420f14f662ab2db6172df44c389a2667a" }, + {"etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, + {"fullmoon_AR", "03380314c4f42fa854df8c471618751879f9e8f0ff5dbabda2bd77d0f96cb35676" }, + {"fullmoon_NA", "030216211d8e2a48bae9e5d7eb3a42ca2b7aae8770979a791f883869aea2fa6eef" }, + {"fullmoon_SH", "03f34282fa57ecc7aba8afaf66c30099b5601e98dcbfd0d8a58c86c20d8b692c64" }, + {"goldenman_EU", "02d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388d" }, + {"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + {"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + {"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, // 30 + {"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + {"jackson_AR", "038ff7cfe34cb13b524e0941d5cf710beca2ffb7e05ddf15ced7d4f14fbb0a6f69" }, + {"jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + {"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, + {"komodoninja_EU", "038e567b99806b200b267b27bbca2abf6a3e8576406df5f872e3b38d30843cd5ba" }, + {"komodoninja_SH", "033178586896915e8456ebf407b1915351a617f46984001790f0cce3d6f3ada5c2" }, + {"komodopioneers_SH", "033ace50aedf8df70035b962a805431363a61cc4e69d99d90726a2d48fb195f68c" }, + {"libscott_SH", "03301a8248d41bc5dc926088a8cf31b65e2daf49eed7eb26af4fb03aae19682b95" }, + {"lukechilds_AR", "031aa66313ee024bbee8c17915cf7d105656d0ace5b4a43a3ab5eae1e14ec02696" }, + {"madmax_AR", "03891555b4a4393d655bf76f0ad0fb74e5159a615b6925907678edc2aac5e06a75" }, // 40 + {"meshbits_AR", "02957fd48ae6cb361b8a28cdb1b8ccf5067ff68eb1f90cba7df5f7934ed8eb4b2c" }, + {"meshbits_SH", "025c6e94877515dfd7b05682b9cc2fe4a49e076efe291e54fcec3add78183c1edb" }, + {"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + {"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" }, + {"patchkez_SH", "0296270f394140640f8fa15684fc11255371abb6b9f253416ea2734e34607799c4" }, + {"pbca26_NA", "0276aca53a058556c485bbb60bdc54b600efe402a8b97f0341a7c04803ce204cb5" }, + {"peer2cloud_AR", "034e5563cb885999ae1530bd66fab728e580016629e8377579493b386bf6cebb15" }, + {"peer2cloud_SH", "03396ac453b3f23e20f30d4793c5b8ab6ded6993242df4f09fd91eb9a4f8aede84" }, + {"polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + {"hyper_AR", "020f2f984d522051bd5247b61b080b4374a7ab389d959408313e8062acad3266b4" }, // 50 + {"hyper_EU", "03d00cf9ceace209c59fb013e112a786ad583d7de5ca45b1e0df3b4023bb14bf51" }, + {"hyper_SH", "0383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3" }, + {"hyper_NA", "03d91c43230336c0d4b769c9c940145a8c53168bf62e34d1bccd7f6cfc7e5592de" }, + {"popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + {"popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, + {"alien_AR", "0348d9b1fc6acf81290405580f525ee49b4749ed4637b51a28b18caa26543b20f0" }, + {"alien_EU", "020aab8308d4df375a846a9e3b1c7e99597b90497efa021d50bcf1bbba23246527" }, + {"thegaltmines_NA", "031bea28bec98b6380958a493a703ddc3353d7b05eb452109a773eefd15a32e421" }, + {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, // 60 + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; +#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" + +bool pubkey2addr(char *destaddr,uint8_t *pubkey33); + +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) +{ + static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; + static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; + static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; + static uint8_t null_pubkeys[64][33] = {0}; + int staked_era; + int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; + if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + timestamp = komodo_heightstamp(height); + else if ( ASSETCHAINS_SYMBOL[0] == 0 ) + timestamp = 0; + // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. + if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) + { + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) + { + if ( did0 == 0 ) + { + n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + if ( Pubkeys == 0 ) + { + komodo_init(height); + //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); + } + pthread_mutex_lock(&komodo_mutex); + n = Pubkeys[htind].numnotaries; + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); + HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) + { + if ( kp->notaryid < n ) + { + mask |= (1LL << kp->notaryid); + memcpy(pubkeys[kp->notaryid],kp->pubkey,33); + } else printf("illegal notaryid.%d vs n.%d\n",kp->notaryid,n); + } + pthread_mutex_unlock(&komodo_mutex); + if ( (n < 64 && mask == ((1LL << n)-1)) || (n == 64 && mask == 0xffffffffffffffffLL) ) + return(n); + printf("error retrieving notaries ht.%d got mask.%llx for n.%d\n",height,(long long)mask,n); + return(-1); +} + +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) +{ + int32_t i,n; uint8_t pubkeys[64][33]; + n = komodo_notaries(pubkeys,height,timestamp); + *numnotariesp = n; + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + numnotaries = Pubkeys[htind].numnotaries; + for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) + return(1); + else return(0); +} + +void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) +{ + static int32_t hwmheight; + int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; + if ( Pubkeys == 0 ) + Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); + memset(&N,0,sizeof(N)); + if ( origheight > 0 ) + { + height = (origheight + KOMODO_ELECTION_GAP/2); + height /= KOMODO_ELECTION_GAP; + height = ((height + 1) * KOMODO_ELECTION_GAP); + htind = (height / KOMODO_ELECTION_GAP); + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); + } else htind = 0; + pthread_mutex_lock(&komodo_mutex); + for (k=0; kpubkey,pubkeys[k],33); + kp->notaryid = k; + HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); + if ( 0 && height > 10000 ) + { + for (i=0; i<33; i++) + printf("%02x",pubkeys[k][i]); + printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP); + } + } + N.numnotaries = num; + for (i=htind; i hwmheight ) + hwmheight = origheight; +} + +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) +{ + // -1 if not notary, 0 if notary, 1 if special notary + struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; + *notaryidp = -1; + if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) + { + printf("komodo_chosennotary ht.%d illegal\n",height); + return(-1); + } + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) + { + if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) + { + modval = ((height % numnotaries) == *notaryidp); + return(modval); + } + } + if ( height >= 250000 ) + return(-1); + if ( Pubkeys == 0 ) + komodo_init(0); + htind = height / KOMODO_ELECTION_GAP; + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + pthread_mutex_lock(&komodo_mutex); + HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); + pthread_mutex_unlock(&komodo_mutex); + if ( kp != 0 ) + { + if ( (numnotaries= Pubkeys[htind].numnotaries) > 0 ) + { + *notaryidp = kp->notaryid; + modval = ((height % numnotaries) == kp->notaryid); + //printf("found notary.%d ht.%d modval.%d\n",kp->notaryid,height,modval); + } else printf("unexpected zero notaries at height.%d\n",height); + } //else printf("cant find kp at htind.%d ht.%d\n",htind,height); + //int32_t i; for (i=0; i<33; i++) + // printf("%02x",pubkey33[i]); + //printf(" ht.%d notary.%d special.%d htind.%d num.%d\n",height,*notaryidp,modval,htind,numnotaries); + return(modval); +} + +//struct komodo_state *komodo_stateptr(char *symbol,char *dest); + +struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + *idx = i; + np = &sp->NPOINTS[i]; + if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height ) + return(np); + } + } + *idx = -1; + return(0); +} + +struct notarized_checkpoint *komodo_npptr(int32_t height) +{ + int idx; + return komodo_npptr_for_height(height, &idx); +} + +struct notarized_checkpoint *komodo_npptr_at(int idx) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + if (idx < sp->NUM_NPOINTS) + return &sp->NPOINTS[idx]; + return(0); +} + +int32_t komodo_prevMoMheight() +{ + static uint256 zero; + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + np = &sp->NPOINTS[i]; + if ( np->MoM != zero ) + return(np->notarized_height); + } + } + return(0); +} + +int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + *hashp = sp->NOTARIZED_HASH; + *txidp = sp->NOTARIZED_DESTTXID; + *prevMoMheightp = komodo_prevMoMheight(); + return(sp->NOTARIZED_HEIGHT); + } + else + { + *prevMoMheightp = 0; + memset(hashp,0,sizeof(*hashp)); + memset(txidp,0,sizeof(*txidp)); + return(0); + } +} + +int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->NOTARIZED_HEIGHT > 0 ) + { + if ( txheight < sp->NOTARIZED_HEIGHT ) + return(numconfs); + else return(1); + } + } + return(numconfs); +} + +int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +{ + struct notarized_checkpoint *np = 0; + if ( (np= komodo_npptr(height)) != 0 ) + { + *notarized_htp = np->notarized_height; + *MoMp = np->MoM; + *kmdtxidp = np->notarized_desttxid; + *MoMoMp = np->MoMoM; + *MoMoMoffsetp = np->MoMoMoffset; + *MoMoMdepthp = np->MoMoMdepth; + *kmdstartip = np->kmdstarti; + *kmdendip = np->kmdendi; + return(np->MoMdepth & 0xffff); + } + *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; + memset(MoMp,0,sizeof(*MoMp)); + memset(MoMoMp,0,sizeof(*MoMoMp)); + memset(kmdtxidp,0,sizeof(*kmdtxidp)); + return(0); +} + +int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) +{ + struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + if ( sp->NUM_NPOINTS > 0 ) + { + flag = 0; + if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) + { + np = &sp->NPOINTS[sp->last_NPOINTSi-1]; + if ( np->nHeight < nHeight ) + { + for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + //printf("flag.1 i.%d np->ht %d [%d].ht %d >= nHeight.%d, last.%d num.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight,sp->last_NPOINTSi,sp->NUM_NPOINTS); + flag = 1; + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + } + if ( flag == 0 ) + { + np = 0; + for (i=0; iNUM_NPOINTS; i++) + { + if ( sp->NPOINTS[i].nHeight >= nHeight ) + { + //printf("i.%d np->ht %d [%d].ht %d >= nHeight.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight); + break; + } + np = &sp->NPOINTS[i]; + sp->last_NPOINTSi = i; + } + } + } + if ( np != 0 ) + { + //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); + if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) ) + printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight); + *notarized_hashp = np->notarized_hash; + *notarized_desttxidp = np->notarized_desttxid; + return(np->notarized_height); + } + } + memset(notarized_hashp,0,sizeof(*notarized_hashp)); + memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); + return(0); +} + +void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) +{ + struct notarized_checkpoint *np; + if ( notarized_height >= nHeight ) + { + fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); + return; + } + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); + portable_mutex_lock(&komodo_mutex); + sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); + np = &sp->NPOINTS[sp->NUM_NPOINTS++]; + memset(np,0,sizeof(*np)); + np->nHeight = nHeight; + sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; + sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; + sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; + sp->MoM = np->MoM = MoM; + sp->MoMdepth = np->MoMdepth = MoMdepth; + portable_mutex_unlock(&komodo_mutex); +} + +void komodo_init(int32_t height) +{ + static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; + if ( 0 && height != 0 ) + printf("komodo_init ht.%d didinit.%d\n",height,didinit); + memset(&zero,0,sizeof(zero)); + if ( didinit == 0 ) + { + pthread_mutex_init(&komodo_mutex,NULL); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + if ( height >= 0 ) + { + n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); + for (k=0; k= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( (timestamp != 0 && timestamp <= KOMODO_NOTARIES_TIMESTAMP1) || (ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_NOTARIES_HEIGHT1) ) - { - if ( did0 == 0 ) - { - n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - if ( Pubkeys == 0 ) - { - komodo_init(height); - //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); - } - pthread_mutex_lock(&komodo_mutex); - n = Pubkeys[htind].numnotaries; - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); - HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) - { - if ( kp->notaryid < n ) - { - mask |= (1LL << kp->notaryid); - memcpy(pubkeys[kp->notaryid],kp->pubkey,33); - } else printf("illegal notaryid.%d vs n.%d\n",kp->notaryid,n); - } - pthread_mutex_unlock(&komodo_mutex); - if ( (n < 64 && mask == ((1LL << n)-1)) || (n == 64 && mask == 0xffffffffffffffffLL) ) - return(n); - printf("error retrieving notaries ht.%d got mask.%llx for n.%d\n",height,(long long)mask,n); - return(-1); -} - -int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) -{ - int32_t i,n; uint8_t pubkeys[64][33]; - n = komodo_notaries(pubkeys,height,timestamp); - *numnotariesp = n; - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - numnotaries = Pubkeys[htind].numnotaries; - for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) - return(1); - else return(0); -} - -void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) -{ - static int32_t hwmheight; - int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; - if ( Pubkeys == 0 ) - Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); - memset(&N,0,sizeof(N)); - if ( origheight > 0 ) - { - height = (origheight + KOMODO_ELECTION_GAP/2); - height /= KOMODO_ELECTION_GAP; - height = ((height + 1) * KOMODO_ELECTION_GAP); - htind = (height / KOMODO_ELECTION_GAP); - if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); - } else htind = 0; - pthread_mutex_lock(&komodo_mutex); - for (k=0; kpubkey,pubkeys[k],33); - kp->notaryid = k; - HASH_ADD_KEYPTR(hh,N.Notaries,kp->pubkey,33,kp); - if ( 0 && height > 10000 ) - { - for (i=0; i<33; i++) - printf("%02x",pubkeys[k][i]); - printf(" notarypubs.[%d] ht.%d active at %d\n",k,origheight,htind*KOMODO_ELECTION_GAP); - } - } - N.numnotaries = num; - for (i=htind; i hwmheight ) - hwmheight = origheight; -} - -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) -{ - // -1 if not notary, 0 if notary, 1 if special notary - struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; - *notaryidp = -1; - if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) - { - printf("komodo_chosennotary ht.%d illegal\n",height); - return(-1); - } - if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) - { - modval = ((height % numnotaries) == *notaryidp); - return(modval); - } - } - if ( height >= 250000 ) - return(-1); - if ( Pubkeys == 0 ) - komodo_init(0); - htind = height / KOMODO_ELECTION_GAP; - if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) - htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; - pthread_mutex_lock(&komodo_mutex); - HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); - pthread_mutex_unlock(&komodo_mutex); - if ( kp != 0 ) - { - if ( (numnotaries= Pubkeys[htind].numnotaries) > 0 ) - { - *notaryidp = kp->notaryid; - modval = ((height % numnotaries) == kp->notaryid); - //printf("found notary.%d ht.%d modval.%d\n",kp->notaryid,height,modval); - } else printf("unexpected zero notaries at height.%d\n",height); - } //else printf("cant find kp at htind.%d ht.%d\n",htind,height); - //int32_t i; for (i=0; i<33; i++) - // printf("%02x",pubkey33[i]); - //printf(" ht.%d notary.%d special.%d htind.%d num.%d\n",height,*notaryidp,modval,htind,numnotaries); - return(modval); -} - -//struct komodo_state *komodo_stateptr(char *symbol,char *dest); - -struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - for (i=sp->NUM_NPOINTS-1; i>=0; i--) - { - *idx = i; - np = &sp->NPOINTS[i]; - if ( np->MoMdepth != 0 && height > np->notarized_height-(np->MoMdepth&0xffff) && height <= np->notarized_height ) - return(np); - } - } - *idx = -1; - return(0); -} - -struct notarized_checkpoint *komodo_npptr(int32_t height) -{ - int idx; - return komodo_npptr_for_height(height, &idx); -} - -struct notarized_checkpoint *komodo_npptr_at(int idx) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - if (idx < sp->NUM_NPOINTS) - return &sp->NPOINTS[idx]; - return(0); -} - -int32_t komodo_prevMoMheight() -{ - static uint256 zero; - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - for (i=sp->NUM_NPOINTS-1; i>=0; i--) - { - np = &sp->NPOINTS[i]; - if ( np->MoM != zero ) - return(np->notarized_height); - } - } - return(0); -} - -int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - *hashp = sp->NOTARIZED_HASH; - *txidp = sp->NOTARIZED_DESTTXID; - *prevMoMheightp = komodo_prevMoMheight(); - return(sp->NOTARIZED_HEIGHT); - } - else - { - *prevMoMheightp = 0; - memset(hashp,0,sizeof(*hashp)); - memset(txidp,0,sizeof(*txidp)); - return(0); - } -} - -int32_t komodo_dpowconfs(int32_t txheight,int32_t numconfs) -{ - char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - if ( sp->NOTARIZED_HEIGHT > 0 ) - { - if ( txheight < sp->NOTARIZED_HEIGHT ) - return(numconfs); - else return(1); - } - } - return(numconfs); -} - -int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) -{ - struct notarized_checkpoint *np = 0; - if ( (np= komodo_npptr(height)) != 0 ) - { - *notarized_htp = np->notarized_height; - *MoMp = np->MoM; - *kmdtxidp = np->notarized_desttxid; - *MoMoMp = np->MoMoM; - *MoMoMoffsetp = np->MoMoMoffset; - *MoMoMdepthp = np->MoMoMdepth; - *kmdstartip = np->kmdstarti; - *kmdendip = np->kmdendi; - return(np->MoMdepth & 0xffff); - } - *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; - memset(MoMp,0,sizeof(*MoMp)); - memset(MoMoMp,0,sizeof(*MoMoMp)); - memset(kmdtxidp,0,sizeof(*kmdtxidp)); - return(0); -} - -int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) -{ - struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; - if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) - { - if ( sp->NUM_NPOINTS > 0 ) - { - flag = 0; - if ( sp->last_NPOINTSi < sp->NUM_NPOINTS && sp->last_NPOINTSi > 0 ) - { - np = &sp->NPOINTS[sp->last_NPOINTSi-1]; - if ( np->nHeight < nHeight ) - { - for (i=sp->last_NPOINTSi; iNUM_NPOINTS; i++) - { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - { - //printf("flag.1 i.%d np->ht %d [%d].ht %d >= nHeight.%d, last.%d num.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight,sp->last_NPOINTSi,sp->NUM_NPOINTS); - flag = 1; - break; - } - np = &sp->NPOINTS[i]; - sp->last_NPOINTSi = i; - } - } - } - if ( flag == 0 ) - { - np = 0; - for (i=0; iNUM_NPOINTS; i++) - { - if ( sp->NPOINTS[i].nHeight >= nHeight ) - { - //printf("i.%d np->ht %d [%d].ht %d >= nHeight.%d\n",i,np->nHeight,i,sp->NPOINTS[i].nHeight,nHeight); - break; - } - np = &sp->NPOINTS[i]; - sp->last_NPOINTSi = i; - } - } - } - if ( np != 0 ) - { - //char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height); - if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) ) - printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight); - *notarized_hashp = np->notarized_hash; - *notarized_desttxidp = np->notarized_desttxid; - return(np->notarized_height); - } - } - memset(notarized_hashp,0,sizeof(*notarized_hashp)); - memset(notarized_desttxidp,0,sizeof(*notarized_desttxidp)); - return(0); -} - -void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) -{ - struct notarized_checkpoint *np; - if ( notarized_height >= nHeight ) - { - fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); - return; - } - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); - portable_mutex_lock(&komodo_mutex); - sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); - np = &sp->NPOINTS[sp->NUM_NPOINTS++]; - memset(np,0,sizeof(*np)); - np->nHeight = nHeight; - sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; - sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; - sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; - sp->MoM = np->MoM = MoM; - sp->MoMdepth = np->MoMdepth = MoMdepth; - portable_mutex_unlock(&komodo_mutex); -} - -void komodo_init(int32_t height) -{ - static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; - if ( 0 && height != 0 ) - printf("komodo_init ht.%d didinit.%d\n",height,didinit); - memset(&zero,0,sizeof(zero)); - if ( didinit == 0 ) - { - pthread_mutex_init(&komodo_mutex,NULL); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - if ( height >= 0 ) - { - n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); - for (k=0; k Date: Sat, 3 Nov 2018 02:22:53 +0800 Subject: [PATCH 0483/4463] fix dupe --- src/rpcrawtransaction.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 5710e502f..f446756f2 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -492,26 +492,6 @@ int32_t gettxout_scriptPubKey(uint8_t *scriptPubKey,int32_t maxsize,uint256 txid return(-1); } -bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey) -{ - CTxDestination address; txnouttype whichType; - if ( ExtractDestination(scriptPubKey,address) != 0 ) - { - strcpy(destaddr,(char *)CBitcoinAddress(address).ToString().c_str()); - return(true); - } - fprintf(stderr,"ExtractDestination failed\n"); - return(false); -} - -bool pubkey2address(char *destaddr,uint8_t *pubkey33) -{ - std::vectorpk; int32_t i; - for (i=0; i<33; i++) - pk.push_back(pubkey33[i]); - return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG)); -} - UniValue gettxoutproof(const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 1 && params.size() != 2)) From e024ec35fc8f106436b813f3567ff5ee11f83ed3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 03:01:39 +0800 Subject: [PATCH 0484/4463] last tim --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index aead9fb7a..6d6ecf77f 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -78,6 +78,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" +#include "cc/CCutils.cpp" From cfa9c3c640a130e764ed147e03f0762b1b950e36 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 14:49:09 +0800 Subject: [PATCH 0485/4463] try this first --- src/Makefile.am | 4 ++-- src/komodo_notary.h | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 0559230c0..f18c192e2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -246,8 +246,8 @@ obj/build.h: FORCE libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h # server: zcashd -libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -DSERVER +libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -DSEVER libbitcoin_server_a_SOURCES = \ sendalert.cpp \ addrman.cpp \ diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 6291c8e1a..8169d6117 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -20,8 +20,6 @@ #include "notaries_staked.h" -extern int32_t pubkey2address(char *destaddr,uint8_t *pubkey33) ; - #define KOMODO_MAINNET_START 178999 extern char NOTARYADDRS[18][64]; @@ -234,9 +232,11 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); for (i=0; i Date: Sat, 3 Nov 2018 14:54:57 +0800 Subject: [PATCH 0486/4463] modified: src/komodo_notary.h --- src/komodo_notary.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 8169d6117..febc7e40c 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -234,7 +234,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(elected_pubkeys0[i],33,(char *)Notaries_elected0[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2address((char *)NOTARYADDRS[i],(uint8_t *)Notaries_elected0[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)Notaries_elected0[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -254,7 +254,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(elected_pubkeys1[i],33,(char *)Notaries_elected1[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2address((char *)NOTARYADDRS[i],(uint8_t *)Notaries_elected1[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)Notaries_elected1[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -281,7 +281,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys1[i],33,(char *)notaries_STAKED1[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2address((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED1[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED1[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -302,7 +302,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys2[i],33,(char *)notaries_STAKED2[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2address((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED2[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED2[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -322,7 +322,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys3[i],33,(char *)notaries_STAKED3[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2address((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED3[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED3[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -341,7 +341,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys4[i],33,(char *)notaries_STAKED4[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2address((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED4[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED4[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif } From be77469369ca30003afe7f36cf4a1d85d4f84202 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 14:58:50 +0800 Subject: [PATCH 0487/4463] unneded include --- src/bitcoin-cli.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 6d6ecf77f..37ed26572 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -76,11 +76,7 @@ public: #include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" -#include "komodo_notary.h" #include "notaries_staked.cpp" -#include "cc/CCutils.cpp" - - void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From f876160b78e9f9c3dc780ac787b37ec2bc47e4d0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:02:27 +0800 Subject: [PATCH 0488/4463] hhmmm --- src/bitcoin-cli.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 37ed26572..aead9fb7a 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -76,8 +76,11 @@ public: #include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" +#include "komodo_notary.h" #include "notaries_staked.cpp" + + void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) { From 55fd0444f6b4c5e6d5f702a4bf93d408134f3268 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:15:34 +0800 Subject: [PATCH 0489/4463] try --- src/komodo_notary.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index febc7e40c..1c90b689a 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -281,6 +281,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys1[i],33,(char *)notaries_STAKED1[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); + fprintf(stderr, "pubkey?: %s\n", notaries_STAKED1[i][1]); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED1[i][1]); pthread_mutex_unlock(&komodo_mutex); #endif From e126f4cecf9c4f241414af59a999c66cb4abe1ca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:27:44 +0800 Subject: [PATCH 0490/4463] try --- src/script/standard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/script/standard.cpp b/src/script/standard.cpp index fde836154..b2e98bf2c 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -244,6 +244,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (whichType == TX_PUBKEY) { CPubKey pubKey(vSolutions[0]); + fprintf(stderr, "pubkey in exdest: %s\n",pubKey.GetHash().ToString().c_str()); if (!pubKey.IsValid()) { fprintf(stderr,"TX_PUBKEY invalid pubkey\n"); @@ -263,7 +264,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) addressRet = CScriptID(uint160(vSolutions[0])); return true; } - + else if (IsCryptoConditionsEnabled() != 0 && whichType == TX_CRYPTOCONDITION) { addressRet = CKeyID(uint160(vSolutions[0])); From 302427b0791768ec54f15f9fbe758b951c84d900 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:39:31 +0800 Subject: [PATCH 0491/4463] try this --- src/script/standard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/standard.cpp b/src/script/standard.cpp index b2e98bf2c..9707b8c2e 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -244,7 +244,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (whichType == TX_PUBKEY) { CPubKey pubKey(vSolutions[0]); - fprintf(stderr, "pubkey in exdest: %s\n",pubKey.GetHash().ToString().c_str()); + fprintf(stderr, "pubkey in exdest: %s\n",pubKey.ToString().c_str()); if (!pubKey.IsValid()) { fprintf(stderr,"TX_PUBKEY invalid pubkey\n"); From 4c93a4dd7b5e7b1ca94f70dbf8cce78e3683a1c3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:40:32 +0800 Subject: [PATCH 0492/4463] try --- src/script/standard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 9707b8c2e..d24d278f3 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -244,7 +244,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (whichType == TX_PUBKEY) { CPubKey pubKey(vSolutions[0]); - fprintf(stderr, "pubkey in exdest: %s\n",pubKey.ToString().c_str()); + fprintf(stderr, "pubkey in exdest: %s\n",pubKey.CPubKey().ToString().c_str()); if (!pubKey.IsValid()) { fprintf(stderr,"TX_PUBKEY invalid pubkey\n"); From ca7f0b86431378025e3f9af993fa3058be1f49dc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:42:02 +0800 Subject: [PATCH 0493/4463] try --- src/script/standard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/standard.cpp b/src/script/standard.cpp index d24d278f3..2c3f4afc7 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -244,7 +244,7 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (whichType == TX_PUBKEY) { CPubKey pubKey(vSolutions[0]); - fprintf(stderr, "pubkey in exdest: %s\n",pubKey.CPubKey().ToString().c_str()); + fprintf(stderr, "pubkey in exdest: %s\n",scriptPubKey.ToString().c_str()); if (!pubKey.IsValid()) { fprintf(stderr,"TX_PUBKEY invalid pubkey\n"); From c52c8d2a37c299d5b1569174d53db9b90cb0e459 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 15:44:45 +0800 Subject: [PATCH 0494/4463] fix --- src/komodo_notary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 1c90b689a..dafcbe820 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -281,8 +281,8 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys1[i],33,(char *)notaries_STAKED1[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - fprintf(stderr, "pubkey?: %s\n", notaries_STAKED1[i][1]); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED1[i][1]); + fprintf(stderr, "pubkey?: %s\n",staked_pubkeys1[i]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys1[i]); pthread_mutex_unlock(&komodo_mutex); #endif } From 4d857068593b9da3c19bb1c211f3ec34138d03dc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 16:35:51 +0800 Subject: [PATCH 0495/4463] is this working now? --- src/komodo_notary.h | 11 +++++------ src/script/standard.cpp | 1 - src/wallet/rpcwallet.cpp | 16 ++++++++++++++-- src/wallet/wallet.cpp | 6 ++++-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index dafcbe820..e02860414 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -234,7 +234,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(elected_pubkeys0[i],33,(char *)Notaries_elected0[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)Notaries_elected0[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)elected_pubkeys0[i]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -254,7 +254,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(elected_pubkeys1[i],33,(char *)Notaries_elected1[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)Notaries_elected1[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)elected_pubkeys1[i]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -281,7 +281,6 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys1[i],33,(char *)notaries_STAKED1[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - fprintf(stderr, "pubkey?: %s\n",staked_pubkeys1[i]); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys1[i]); pthread_mutex_unlock(&komodo_mutex); #endif @@ -303,7 +302,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys2[i],33,(char *)notaries_STAKED2[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED2[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys2[i]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -323,7 +322,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys3[i],33,(char *)notaries_STAKED3[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED3[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys3[i]); pthread_mutex_unlock(&komodo_mutex); #endif } @@ -342,7 +341,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam decode_hex(staked_pubkeys4[i],33,(char *)notaries_STAKED4[i][1]); #ifdef SERVER pthread_mutex_lock(&komodo_mutex); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)notaries_STAKED4[i][1]); + pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys4[i]); pthread_mutex_unlock(&komodo_mutex); #endif } diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 2c3f4afc7..9aa02bfb7 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -244,7 +244,6 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (whichType == TX_PUBKEY) { CPubKey pubKey(vSolutions[0]); - fprintf(stderr, "pubkey in exdest: %s\n",scriptPubKey.ToString().c_str()); if (!pubKey.IsValid()) { fprintf(stderr,"TX_PUBKEY invalid pubkey\n"); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 862df0c0f..dc0b19ecc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4959,6 +4959,7 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) } bool pubkey2addr(char *destaddr,uint8_t *pubkey33); +extern int32_t IS_KOMODO_NOTARY; UniValue setpubkey(const UniValue& params, bool fHelp) { @@ -5005,9 +5006,20 @@ UniValue setpubkey(const UniValue& params, bool fHelp) NOTARY_ADDRESS = address.ToString(); result.push_back(Pair("address", NOTARY_ADDRESS)); #ifdef ENABLE_WALLET - isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; - result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); + isminetype mine = pwalletMain; + if ( IsMine(*pwalletMain, dest) == ISMINE_NO ) { + result.push_back(Pair("WARNING", "privkey for this pubkey is not imported to wallet!")); + } else { + result.push_back(Pair("ismine", "true")); + std::string notaryname; + if ( StakedNotaryID(notaryname, Raddress) != -1 ) { + IS_KOMODO_NOTARY = 1; + result.push_back(Pair("IsNotary", notaryname)); + } + } #endif + } else { + result.push_back(Pair("error", "pubkey entered is invalid.")); } NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a73ea31fe..8a8f96d8f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1213,7 +1213,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - if ( NOTARY_ADDRESS != "" ) + if ( NOTARY_ADDRESS != "" && IS_KOMODO_NOTARY == 1 ) { int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { @@ -1252,7 +1252,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } else if ( numvinIsOurs < tx.vin.size() ) { // this means we were in a multi sig, we wil remove the utxo we spent from our wallet, - // IF there exisited a function for that. + // IF there exisited a function for that. + // Maybe check if there are any vouts unspetn in this TX + // then purge the TX from wallet if all spent? fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } } From 2a91d7e00270bee2bccb752c13564337e1d9cd2f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 16:40:57 +0800 Subject: [PATCH 0496/4463] fix --- src/wallet/rpcwallet.cpp | 8 ++++---- src/wallet/wallet.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index dc0b19ecc..36ebb1893 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4960,6 +4960,8 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) bool pubkey2addr(char *destaddr,uint8_t *pubkey33); extern int32_t IS_KOMODO_NOTARY; +extern uint8_t NOTARY_PUBKEY33[]; +extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; UniValue setpubkey(const UniValue& params, bool fHelp) { @@ -4989,8 +4991,6 @@ UniValue setpubkey(const UniValue& params, bool fHelp) char Raddress[18]; uint8_t pubkey33[33]; - extern uint8_t NOTARY_PUBKEY33[]; - extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; if ( NOTARY_PUBKEY33[0] == 0 ) { if (strlen(params[0].get_str().c_str()) == 66) { decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); @@ -5006,8 +5006,8 @@ UniValue setpubkey(const UniValue& params, bool fHelp) NOTARY_ADDRESS = address.ToString(); result.push_back(Pair("address", NOTARY_ADDRESS)); #ifdef ENABLE_WALLET - isminetype mine = pwalletMain; - if ( IsMine(*pwalletMain, dest) == ISMINE_NO ) { + isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; + if ( mine == ISMINE_NO ) { result.push_back(Pair("WARNING", "privkey for this pubkey is not imported to wallet!")); } else { result.push_back(Pair("ismine", "true")); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8a8f96d8f..50a825cc6 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,6 +1202,7 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; +extern int32_t IS_KOMODO_NOTARY; bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { @@ -1254,7 +1255,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl // this means we were in a multi sig, we wil remove the utxo we spent from our wallet, // IF there exisited a function for that. // Maybe check if there are any vouts unspetn in this TX - // then purge the TX from wallet if all spent? + // then purge the TX from wallet if all spent? fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } } From a673e42f9525069be6a668a672ef4ccafe1ec04b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 16:43:39 +0800 Subject: [PATCH 0497/4463] include --- src/wallet/rpcwallet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 36ebb1893..292f4666c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -20,6 +20,7 @@ #include "primitives/transaction.h" #include "zcbenchmarks.h" #include "script/interpreter.h" +#include "notaries_staked.h" #include "utiltime.h" #include "asyncrpcoperation.h" From 102b0839f846bc76e175ce1223a028e0bf82ae4b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:09:13 +0800 Subject: [PATCH 0498/4463] do addresss for -pubkey? --- src/komodo_utils.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index a9d16fd52..732b1ecdb 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1483,10 +1483,13 @@ char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { - int32_t i,notaryid; + int32_t i,notaryid; char Raddress[18]; for (i=0; i<33; i++) sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]); pubkeystr[66] = 0; + pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + CBitcoinAddress address(Raddress); + NOTARY_ADDRESS = address.ToString(); komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } From f307fe52bf7a44bbedad2972a60072130053ef93 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:11:36 +0800 Subject: [PATCH 0499/4463] try --- src/komodo_utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 732b1ecdb..f248d96f5 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -14,6 +14,7 @@ ******************************************************************************/ #include "komodo_defs.h" #include "cc/utils.h" +#include "cc/CCinclude.h" #ifdef _WIN32 #include From eb36c662f6a8ebb2a31454768e384a1da9e124ac Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:13:37 +0800 Subject: [PATCH 0500/4463] define --- src/komodo_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index f248d96f5..3c366770c 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1488,9 +1488,11 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) for (i=0; i<33; i++) sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]); pubkeystr[66] = 0; +#ifdef SERVER pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); +#endif komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } From f36ad447b8fdf242546fca23ee0586a52ce176fc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:40:27 +0800 Subject: [PATCH 0501/4463] fix --- src/komodo_notary.h | 6 ++++++ src/komodo_utils.h | 7 +------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e02860414..668378eef 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -700,6 +700,12 @@ void komodo_init(int32_t height) { pthread_mutex_init(&komodo_mutex,NULL); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); +#ifdef SERVER + char Raddress[18]; + pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + CBitcoinAddress address(Raddress); + NOTARY_ADDRESS = address.ToString(); +#endif if ( height >= 0 ) { n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 3c366770c..85d18f169 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1484,15 +1484,10 @@ char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\ int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) { - int32_t i,notaryid; char Raddress[18]; + int32_t i,notaryid; for (i=0; i<33; i++) sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]); pubkeystr[66] = 0; -#ifdef SERVER - pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); - CBitcoinAddress address(Raddress); - NOTARY_ADDRESS = address.ToString(); -#endif komodo_chosennotary(¬aryid,height,NOTARY_PUBKEY33,timestamp); return(notaryid); } From 798999bdae40cdeb8d3e6c029f1ccae27d98158a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:43:54 +0800 Subject: [PATCH 0502/4463] try print --- src/komodo_notary.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 668378eef..d180f114f 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -703,6 +703,7 @@ void komodo_init(int32_t height) #ifdef SERVER char Raddress[18]; pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + printf("address: %s\n",Raddress); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); #endif From 02cc6355d9037e9a398706add5287a939e55073e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:47:51 +0800 Subject: [PATCH 0503/4463] try --- src/komodo_notary.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d180f114f..de255ca8f 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -701,8 +701,9 @@ void komodo_init(int32_t height) pthread_mutex_init(&komodo_mutex,NULL); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); #ifdef SERVER - char Raddress[18]; - pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + char Raddress[18]; uint8_t pubkey33[33]; + decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); + pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); printf("address: %s\n",Raddress); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); From 5f5a803d5176040a1f1f7b6b7611432c95982d67 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:51:06 +0800 Subject: [PATCH 0504/4463] fix prit --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index de255ca8f..18b21d37e 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -704,7 +704,7 @@ void komodo_init(int32_t height) char Raddress[18]; uint8_t pubkey33[33]; decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - printf("address: %s\n",Raddress); + fprintf(stderr,"address: %s\n",Raddress); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); #endif From 5349a582ba28ce82cc4b50a0d27aaae9fcf2ffaa Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 17:59:33 +0800 Subject: [PATCH 0505/4463] try --- src/wallet/rpcwallet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 292f4666c..6cfa3fed5 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5031,7 +5031,10 @@ UniValue setpubkey(const UniValue& params, bool fHelp) } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } - result.push_back(Pair("pubkey", NOTARY_PUBKEY)); + if ( NOTARY_PUBKEY33[0] != 0 && NOTARY_ADDRESS.empty() == false ) { + result.push_back(Pair("address", NOTARY_ADDRESS)); + result.push_back(Pair("pubkey", NOTARY_PUBKEY)); + } return result; } From 20d6d163994462a1e4e056725354370b9545a6cb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:32:05 +0800 Subject: [PATCH 0506/4463] add -stakednotary daemon flag --- src/komodo_globals.h | 2 +- src/komodo_notary.h | 10 +++++++++- src/komodo_utils.h | 3 ++- src/rpcmisc.cpp | 13 ++++++++++--- src/wallet/wallet.cpp | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index bf96cfa44..eb4597011 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -44,7 +44,7 @@ struct komodo_state KOMODO_STATES[34]; #define _COINBASE_MATURITY 100 int COINBASE_MATURITY = _COINBASE_MATURITY;//100; -int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; +int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string NOTARY_ADDRESS,ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 18b21d37e..9a866a5eb 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -704,9 +704,17 @@ void komodo_init(int32_t height) char Raddress[18]; uint8_t pubkey33[33]; decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - fprintf(stderr,"address: %s\n",Raddress); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); + if ( IS_STAKED_NOTARY != 0 && NOTARY_ADDRESS.empty() != 0 ) { + std::string notaryname; + if (StakedNotaryID(notaryname, NOTARY_ADDRESS.c_str()) != -1 ) { + IS_STAKED_NOTARY = 1; + IS_KOMODO_NOTARY = 0; + } else { + IS_STAKED_NOTARY = 0; + } + } #endif if ( height >= 0 ) { diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 85d18f169..4fb95dcca 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1508,6 +1508,7 @@ void komodo_args(char *argv0) extern const char *Notaries_elected1[][2]; std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[256],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0; IS_KOMODO_NOTARY = GetBoolArg("-notary", false); + IS_STAKED_NOTARY = GetBoolArg("-stakednotary", false); if ( GetBoolArg("-gen", false) != 0 ) KOMODO_MININGTHREADS = GetArg("-genproclimit",1); else KOMODO_MININGTHREADS = -1; @@ -1515,7 +1516,7 @@ void komodo_args(char *argv0) fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n"); DONATION_PUBKEY = GetArg("-donation", ""); NOTARY_PUBKEY = GetArg("-pubkey", ""); - if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) + if ( strlen(NOTARY_PUBKEY.c_str()) == 66 || IS_STAKED_NOTARY == false ) { USE_EXTERNAL_PUBKEY = 1; if ( IS_KOMODO_NOTARY == 0 ) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index a1d576d58..824758b26 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -13,6 +13,7 @@ #include "timedata.h" #include "txmempool.h" #include "util.h" +#include "notaries_staked.h" #ifdef ENABLE_WALLET #include "wallet/wallet.h" #include "wallet/walletdb.h" @@ -50,11 +51,12 @@ int32_t komodo_notarized_height(int32_t *prevhtp,uint256 *hashp,uint256 *txidp); uint32_t komodo_chainactive_timestamp(); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; -extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN; +extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t komodo_segid32(char *coinaddr); int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height); int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); +int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); #define KOMODO_VERSION "0.2.1" extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; @@ -152,13 +154,18 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); obj.push_back(Pair("errors", GetWarnings("statusbar"))); { - char pubkeystr[65]; int32_t notaryid; - if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 ) + char pubkeystr[65]; int32_t notaryid; std::string notaryname; + if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 && ( IS_STAKED_NOTARY == 0 )) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("pubkey", pubkeystr)); if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); + } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 && NOTARY_ADDRESS.emtpy() == false ) { + notaryid = StakedNotaryID(notaryname, NOTARY_ADDRESS.c_str()) + obj.push_back(Pair("notaryid", notaryid)); + obj.push_back(Pair("notaryname", notaryname)); + obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } else if ( NOTARY_PUBKEY33[0] != 0 ) { obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 50a825cc6..f770c8e18 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1214,7 +1214,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - if ( NOTARY_ADDRESS != "" && IS_KOMODO_NOTARY == 1 ) + if ( NOTARY_ADDRESS != "" && IS_STAKED_NOTARY == 1 ) { int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { From 793ebde434ac68e6da56d1a92c6a560b9a8b4c1d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:42:13 +0800 Subject: [PATCH 0507/4463] fix --- src/komodo_notary.h | 2 +- src/wallet/wallet.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9a866a5eb..c9696e34f 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -708,7 +708,7 @@ void komodo_init(int32_t height) NOTARY_ADDRESS = address.ToString(); if ( IS_STAKED_NOTARY != 0 && NOTARY_ADDRESS.empty() != 0 ) { std::string notaryname; - if (StakedNotaryID(notaryname, NOTARY_ADDRESS.c_str()) != -1 ) { + if (StakedNotaryID(notaryname, Raddress) != -1 ) { IS_STAKED_NOTARY = 1; IS_KOMODO_NOTARY = 0; } else { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f770c8e18..26689cfde 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1202,7 +1202,7 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) */ extern uint8_t NOTARY_PUBKEY33[33]; extern std::string NOTARY_ADDRESS; -extern int32_t IS_KOMODO_NOTARY; +extern int32_t IS_STAKED_NOTARY; bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { From 0b5ef8057fb728fcf801a56cf250ec6f3b391b13 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:43:31 +0800 Subject: [PATCH 0508/4463] fix last --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 824758b26..2e4613ac6 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -66,7 +66,7 @@ extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,AS UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; - extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; + extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[]; if (fHelp || params.size() != 0) throw runtime_error( "getinfo\n" From 7eca3743c80821e8d277967cc5056e4f2e13fc00 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:50:08 +0800 Subject: [PATCH 0509/4463] fix --- src/rpcmisc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 2e4613ac6..083955db2 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -154,7 +154,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); obj.push_back(Pair("errors", GetWarnings("statusbar"))); { - char pubkeystr[65]; int32_t notaryid; std::string notaryname; + char pubkeystr[65]; int32_t notaryid; std::string notaryname; char *Raddress; if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 && ( IS_STAKED_NOTARY == 0 )) { obj.push_back(Pair("notaryid", notaryid)); @@ -162,7 +162,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 && NOTARY_ADDRESS.emtpy() == false ) { - notaryid = StakedNotaryID(notaryname, NOTARY_ADDRESS.c_str()) + Raddress = NOTARY_ADDRESS.c_str(); + notaryid = StakedNotaryID(notaryname, Raddress) obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); From 8df94887b3215d2898ce09cd749ab7d65b390327 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:51:31 +0800 Subject: [PATCH 0510/4463] fix better --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 083955db2..e656ab72a 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -161,7 +161,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("pubkey", pubkeystr)); if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); - } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 && NOTARY_ADDRESS.emtpy() == false ) { + } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 ) { Raddress = NOTARY_ADDRESS.c_str(); notaryid = StakedNotaryID(notaryname, Raddress) obj.push_back(Pair("notaryid", notaryid)); From ac99a6b738609de933cb9a67941d522f2f7f2b31 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:52:06 +0800 Subject: [PATCH 0511/4463] ; --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index e656ab72a..0f8669757 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -163,7 +163,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 ) { Raddress = NOTARY_ADDRESS.c_str(); - notaryid = StakedNotaryID(notaryname, Raddress) + notaryid = StakedNotaryID(notaryname, Raddress); obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); From 59d1c8e2ae8f3943b4da4d19f5dd88f3af782978 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:53:30 +0800 Subject: [PATCH 0512/4463] ? --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 0f8669757..fbb183717 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -162,7 +162,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) if ( KOMODO_LASTMINED != 0 ) obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 ) { - Raddress = NOTARY_ADDRESS.c_str(); + Raddress = (char *)NOTARY_ADDRESS.c_str(); notaryid = StakedNotaryID(notaryname, Raddress); obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); From 2dd5abbcdf997fe970c4a2866435bac35646d36b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 18:59:59 +0800 Subject: [PATCH 0513/4463] try --- src/rpcmisc.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index fbb183717..f0062ebc4 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -51,7 +51,7 @@ int32_t komodo_notarized_height(int32_t *prevhtp,uint256 *hashp,uint256 *txidp); uint32_t komodo_chainactive_timestamp(); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; -extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY; +extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t komodo_segid32(char *coinaddr); int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height); @@ -155,18 +155,17 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("errors", GetWarnings("statusbar"))); { char pubkeystr[65]; int32_t notaryid; std::string notaryname; char *Raddress; - if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 && ( IS_STAKED_NOTARY == 0 )) - { - obj.push_back(Pair("notaryid", notaryid)); - obj.push_back(Pair("pubkey", pubkeystr)); - if ( KOMODO_LASTMINED != 0 ) - obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); - } else if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY != 0 ) { + if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY == 1 ) { Raddress = (char *)NOTARY_ADDRESS.c_str(); notaryid = StakedNotaryID(notaryname, Raddress); obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); + } else if( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 && ( IS_KOMODO_NOTARY == 1 ) ) { + obj.push_back(Pair("notaryid", notaryid)); + obj.push_back(Pair("pubkey", pubkeystr)); + if ( KOMODO_LASTMINED != 0 ) + obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); } else if ( NOTARY_PUBKEY33[0] != 0 ) { obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } From 482f2dcb744a8a41e098bd07f4c73509be617d3b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:04:31 +0800 Subject: [PATCH 0514/4463] try fix --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index c9696e34f..f9ad785bf 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -706,7 +706,7 @@ void komodo_init(int32_t height) pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); - if ( IS_STAKED_NOTARY != 0 && NOTARY_ADDRESS.empty() != 0 ) { + if ( IS_STAKED_NOTARY != 0 || NOTARY_ADDRESS.empty() != 0 ) { std::string notaryname; if (StakedNotaryID(notaryname, Raddress) != -1 ) { IS_STAKED_NOTARY = 1; From dd80445e563d4058185e106d695bbebab21671a7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:12:36 +0800 Subject: [PATCH 0515/4463] fix :Wq qqq --- src/komodo_notary.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index f9ad785bf..60655f41d 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -706,14 +706,12 @@ void komodo_init(int32_t height) pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); - if ( IS_STAKED_NOTARY != 0 || NOTARY_ADDRESS.empty() != 0 ) { - std::string notaryname; - if (StakedNotaryID(notaryname, Raddress) != -1 ) { - IS_STAKED_NOTARY = 1; - IS_KOMODO_NOTARY = 0; - } else { - IS_STAKED_NOTARY = 0; - } + std::string notaryname; + if (StakedNotaryID(notaryname, Raddress) != -1 ) { + IS_STAKED_NOTARY = 1; + IS_KOMODO_NOTARY = 0; + } else { + IS_STAKED_NOTARY = 0; } #endif if ( height >= 0 ) From 00c9e899f12826e7caacf367811d4bd731baf1db Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:20:54 +0800 Subject: [PATCH 0516/4463] try --- src/rpcmisc.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index f0062ebc4..3b897e892 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -154,10 +154,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); obj.push_back(Pair("errors", GetWarnings("statusbar"))); { - char pubkeystr[65]; int32_t notaryid; std::string notaryname; char *Raddress; - if ( NOTARY_PUBKEY33[0] != 0 && IS_STAKED_NOTARY == 1 ) { - Raddress = (char *)NOTARY_ADDRESS.c_str(); - notaryid = StakedNotaryID(notaryname, Raddress); + char pubkeystr[65]; int32_t notaryid; std::string notaryname; + if ( (NOTARY_PUBKEY33[0] != 0) && (notaryid = StakedNotaryID(notaryname, (char *)NOTARY_ADDRESS.c_str()) != -1 )) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); From 6b62237c9149361058c1bc7155521f5e2eb216bc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:27:33 +0800 Subject: [PATCH 0517/4463] try --- src/wallet/rpcwallet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6cfa3fed5..cdfd5633d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5005,7 +5005,6 @@ UniValue setpubkey(const UniValue& params, bool fHelp) { CTxDestination dest = address.Get(); NOTARY_ADDRESS = address.ToString(); - result.push_back(Pair("address", NOTARY_ADDRESS)); #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; if ( mine == ISMINE_NO ) { @@ -5014,7 +5013,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) result.push_back(Pair("ismine", "true")); std::string notaryname; if ( StakedNotaryID(notaryname, Raddress) != -1 ) { - IS_KOMODO_NOTARY = 1; + IS_STAKED_NOTARY = 1; result.push_back(Pair("IsNotary", notaryname)); } } From 44ebe794f78aeca589340e4a1737e45f6718fb9b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:28:50 +0800 Subject: [PATCH 0518/4463] try --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index cdfd5633d..88f4ece82 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4960,7 +4960,7 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) } bool pubkey2addr(char *destaddr,uint8_t *pubkey33); -extern int32_t IS_KOMODO_NOTARY; +extern int32_t IS_KOMODO_NOTARY,IS_STAKED_NOTARY; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; From 72bbdaef489b2dead6fc066dd7856d526110df9d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:32:54 +0800 Subject: [PATCH 0519/4463] add print --- src/notaries_staked.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 9d413fd5d..c97a03dee 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -156,6 +156,7 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { + fprintf(stderr, "%s\n", NOTARYADDRS[i]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); return(i); From 023adb99c2b5d85fee6624e3177285ccec6632a5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:37:57 +0800 Subject: [PATCH 0520/4463] fix --- src/rpcmisc.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 3b897e892..1c044c030 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -153,20 +153,17 @@ UniValue getinfo(const UniValue& params, bool fHelp) #endif obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); obj.push_back(Pair("errors", GetWarnings("statusbar"))); - { + if ( NOTARY_PUBKEY33[0] != 0 ) { char pubkeystr[65]; int32_t notaryid; std::string notaryname; - if ( (NOTARY_PUBKEY33[0] != 0) && (notaryid = StakedNotaryID(notaryname, (char *)NOTARY_ADDRESS.c_str()) != -1 )) { + if ( (notaryid= StakedNotaryID(notaryname, (char *)NOTARY_ADDRESS.c_str()) != -1 )) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); - obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); - } else if( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 && ( IS_KOMODO_NOTARY == 1 ) ) { + } else if( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 ) { obj.push_back(Pair("notaryid", notaryid)); - obj.push_back(Pair("pubkey", pubkeystr)); if ( KOMODO_LASTMINED != 0 ) - obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); - } else if ( NOTARY_PUBKEY33[0] != 0 ) { - obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); + obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); } + obj.push_back(Pair("pubkey", NOTARY_PUBKEY)); } if ( ASSETCHAINS_CC != 0 ) obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC)); From 4cfe878d46a0a0204e0876c0a544ea720ecea4f2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:42:59 +0800 Subject: [PATCH 0521/4463] try --- src/notaries_staked.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index c97a03dee..2d3bd9e63 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -156,9 +156,10 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { - fprintf(stderr, "%s\n", NOTARYADDRS[i]); + fprintf(stderr, "%ld :: %s\n",i, NOTARYADDRS[i]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); + fprintf(stderr, "FOUND: %ld :: %s\n",i,notaryname.c_str()); return(i); } } From 152d34f3a468159808702e4758828e263d9b5ab7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 19:47:18 +0800 Subject: [PATCH 0522/4463] fix --- src/notaries_staked.cpp | 2 -- src/rpcmisc.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 2d3bd9e63..9d413fd5d 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -156,10 +156,8 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { - fprintf(stderr, "%ld :: %s\n",i, NOTARYADDRS[i]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); - fprintf(stderr, "FOUND: %ld :: %s\n",i,notaryname.c_str()); return(i); } } diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 1c044c030..37e5bc901 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -155,7 +155,7 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("errors", GetWarnings("statusbar"))); if ( NOTARY_PUBKEY33[0] != 0 ) { char pubkeystr[65]; int32_t notaryid; std::string notaryname; - if ( (notaryid= StakedNotaryID(notaryname, (char *)NOTARY_ADDRESS.c_str()) != -1 )) { + if ( (notaryid= StakedNotaryID(notaryname, (char *)NOTARY_ADDRESS.c_str())) != -1 ) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryname", notaryname)); } else if( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->nHeight,komodo_chainactive_timestamp())) >= 0 ) { From 16b97d7f2200507805e9f79c4ab3e9cbc87ce08b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 20:42:59 +0800 Subject: [PATCH 0523/4463] make function, so IS notaty can update on era change --- src/komodo_notary.h | 8 +------- src/notaries_staked.cpp | 20 ++++++++++++++++++-- src/notaries_staked.h | 1 + 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 60655f41d..596ee69d1 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -706,13 +706,7 @@ void komodo_init(int32_t height) pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); CBitcoinAddress address(Raddress); NOTARY_ADDRESS = address.ToString(); - std::string notaryname; - if (StakedNotaryID(notaryname, Raddress) != -1 ) { - IS_STAKED_NOTARY = 1; - IS_KOMODO_NOTARY = 0; - } else { - IS_STAKED_NOTARY = 0; - } + updateStakedNotary(); #endif if ( height >= 0 ) { diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 9d413fd5d..594a31d77 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -4,7 +4,8 @@ #include extern char NOTARYADDRS[18][64]; -extern int32_t STAKED_ERA; +extern std::string NOTARY_ADDRESS; +extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = @@ -114,6 +115,19 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; +int updateStakedNotary() { + std::string notaryname; + pthread_mutex_lock(&komodo_mutex); + if (StakedNotaryID(notaryname,(char *)NOTARY_ADDRESS.c_str()) != -1 ) { + IS_STAKED_NOTARY = 1; + IS_KOMODO_NOTARY = 0; + } else { + IS_STAKED_NOTARY = 0; + } + pthread_mutex_unlock(&komodo_mutex); + return(0); +} + int STAKED_era(int timestamp) { int era; @@ -128,8 +142,10 @@ int STAKED_era(int timestamp) else era = 0; // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - if ( era > STAKED_ERA ) + if ( era > STAKED_ERA ) { STAKED_ERA = era; + updateStakedNotary(); + } return(era); }; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index d3927e68f..8f0802eb3 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -25,6 +25,7 @@ extern int num_notaries_STAKED4; int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); +void updateStakedNotary(); int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname); From 0f6dac83806a356a18cf1fcb4cdb0c155ae19a15 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 20:47:50 +0800 Subject: [PATCH 0524/4463] fix --- src/notaries_staked.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 594a31d77..bd404ab33 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -6,6 +6,7 @@ extern char NOTARYADDRS[18][64]; extern std::string NOTARY_ADDRESS; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; +extern pthread_mutex_t komodo_mutex; // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = @@ -115,7 +116,7 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; -int updateStakedNotary() { +void updateStakedNotary() { std::string notaryname; pthread_mutex_lock(&komodo_mutex); if (StakedNotaryID(notaryname,(char *)NOTARY_ADDRESS.c_str()) != -1 ) { From 1a5c39bcfdaf094844269f108db09bdf69e462e2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 20:48:41 +0800 Subject: [PATCH 0525/4463] return --- src/notaries_staked.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index bd404ab33..3fec522f7 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -126,7 +126,6 @@ void updateStakedNotary() { IS_STAKED_NOTARY = 0; } pthread_mutex_unlock(&komodo_mutex); - return(0); } int STAKED_era(int timestamp) From 818f6fc43b1db3d7de54a8bd97e649424737093f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 21:15:01 +0800 Subject: [PATCH 0526/4463] dupe --- src/notaries_staked.cpp | 4 +-- src/wallet/rpcwallet.cpp | 70 ++-------------------------------------- 2 files changed, 5 insertions(+), 69 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 3fec522f7..bf59a68b7 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -118,14 +118,14 @@ int is_STAKED(const char *chain_name) { void updateStakedNotary() { std::string notaryname; - pthread_mutex_lock(&komodo_mutex); + //pthread_mutex_lock(&komodo_mutex); if (StakedNotaryID(notaryname,(char *)NOTARY_ADDRESS.c_str()) != -1 ) { IS_STAKED_NOTARY = 1; IS_KOMODO_NOTARY = 0; } else { IS_STAKED_NOTARY = 0; } - pthread_mutex_unlock(&komodo_mutex); + //pthread_mutex_unlock(&komodo_mutex); } int STAKED_era(int timestamp) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a0d88dc48..7e2109329 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4566,7 +4566,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33) auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus()); if (!EnsureWalletIsAvailable(0)) return 0; - + const CKeyStore& keystore = *pwalletMain; assert(pwalletMain != NULL); LOCK2(cs_main, pwalletMain->cs_wallet); @@ -4729,7 +4729,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt set setAddress; struct komodo_staking *kp; int32_t winners,segid,minage,nHeight,counter=0,i,m,siglen=0,nMinDepth = 1,nMaxDepth = 99999999; vector vecOutputs; uint32_t block_from_future_rejecttime,besttime,eligible,eligible2,earliest = 0; CScript best_scriptPubKey; arith_uint256 mindiff,ratio,bnTarget; CBlockIndex *tipindex,*pindex; CTxDestination address; bool fNegative,fOverflow; uint8_t hashbuf[256]; CTransaction tx; uint256 hashBlock; if (!EnsureWalletIsAvailable(0)) return 0; - + bnTarget.SetCompact(nBits, &fNegative, &fOverflow); mindiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); ratio = (mindiff / bnTarget); @@ -4939,70 +4939,6 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vectorcs_wallet : NULL); -#else - LOCK(cs_main); -#endif - - char Raddress[18]; - uint8_t pubkey33[33]; - extern uint8_t NOTARY_PUBKEY33[]; - extern std::string NOTARY_PUBKEY; - if ( NOTARY_PUBKEY33[0] == 0 ) { - if (strlen(params[0].get_str().c_str()) == 66) { - decode_hex(pubkey33,33,(char *)params[0].get_str().c_str()); - pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - if (strcmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",Raddress) == 0) { - result.push_back(Pair("error", "pubkey entered is invalid.")); - } else { - CBitcoinAddress address(Raddress); - bool isValid = address.IsValid(); - if (isValid) - { - CTxDestination dest = address.Get(); - string currentAddress = address.ToString(); - result.push_back(Pair("address", currentAddress)); -#ifdef ENABLE_WALLET - isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; - result.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); -#endif - } - NOTARY_PUBKEY = params[0].get_str(); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - } - } else { - result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); - } - } else { - result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); - } - result.push_back(Pair("pubkey", NOTARY_PUBKEY)); - return result; -} - UniValue channelsaddress(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); struct CCcontract_info *cp,C; std::vector destpubkey; CPubKey pk,pk2; char destaddr[64]; @@ -6784,7 +6720,7 @@ UniValue getbalance64(const UniValue& params, bool fHelp) UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address; if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; - + const CKeyStore& keystore = *pwalletMain; CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid; assert(pwalletMain != NULL); From afcd147d30af68e4ce960d2efc84cd47e9b46ee7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 21:24:23 +0800 Subject: [PATCH 0527/4463] dupe modified: src/komodo_globals.h --- src/komodo_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 4c3c08af0..2070e1240 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -46,7 +46,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; -std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; +std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW; char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[18][64]; From fd31d05ab581218c86469786db1c36716f282d8b Mon Sep 17 00:00:00 2001 From: Alrighttt <36680730+Alrighttt@users.noreply.github.com> Date: Sat, 3 Nov 2018 09:31:22 -0400 Subject: [PATCH 0528/4463] Update assetchains.json --- src/assetchains.json | 82 +++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index aa7c8bfb4..454852efe 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -1,84 +1,58 @@ [ { - "ac_name": "STAKEDB1", + "ac_name": "CFEK", "ac_supply": "100000", - "ac_reward" : "1000000000", - "ac_cc": "667", + "ac_reward": "10000000000000", + "ac_staked": "51", + "ac_cc": "102", "addnode": [ "195.201.137.5", "195.201.20.230" ] }, { - "ac_name": "STAKEDW1", - "ac_supply": "100000", - "ac_reward" : "1000000000", - "ac_cc": "667", + "ac_name": "CFEKED", + "ac_supply": "1000", + "ac_end": "1", + "ac_reward": "1", + "ac_staked": "1", + "ac_cc": "102", "addnode": [ "195.201.137.5", "195.201.20.230" ] }, { - "ac_name": "STAKEDPERC", - "ac_supply": "1000000", - "ac_reward" : "1000000000", - "ac_cc": "667", - "ac_perc": "10000000", - "ac_pubkey": "03bd221868abc063b54a3fceafb9898b1931ed767298a17ac0c9923500a7c60e4b", + "ac_name": "CFEKING", + "ac_supply": "1000", + "ac_end": "1", + "ac_reward": "1", + "ac_staked": "1", + "ac_cc": "102", "addnode": [ "195.201.137.5", "195.201.20.230" ] }, { - "ac_name": "STAKEDS1", - "ac_supply": "1000000", - "ac_reward" : "1000000000", - "ac_cc": "667", - "ac_staked": "10", + "ac_name": "CFEKLF", + "ac_supply": "1000", + "ac_end": "1", + "ac_reward": "1", + "ac_staked": "1", + "ac_cc": "102", "addnode": [ "195.201.137.5", "195.201.20.230" ] }, { - "ac_name": "STAKEDS9", - "ac_supply": "1000000", - "ac_reward" : "1000000000", - "ac_cc": "667", - "ac_staked": "90", - "addnode": [ - "195.201.137.5", - "195.201.20.230" - ] - }, - { - "ac_name": "STAKEDED", - "ac_supply": "1072452", - "ac_reward" : "1000000000", - "ac_cc": "667", - "addnode": [ - "195.201.137.5", - "195.201.20.230" - ] - }, - { - "ac_name": "STAKEDPRIV", - "ac_supply": "1000000", - "ac_reward" : "10000000000", - "ac_private": "1", - "addnode": [ - "195.201.137.5", - "195.201.20.230" - ] - }, - { - "ac_name": "STAKEDCCP", - "ac_supply": "1000000", - "ac_reward" : "10000000000", - "ac_private": "1", - "ac_cc": "667", + "ac_name": "CFEKMLT", + "ac_supply": "1000", + "ac_end": "1", + "ac_reward": "1", + "ac_staked": "1", + "ac_cc": "102", "addnode": [ "195.201.137.5", "195.201.20.230" From 565a17dc86b73fd9d84425f3672235f24947e740 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 15:53:30 +0800 Subject: [PATCH 0529/4463] try this please work --- src/komodo_notary.h | 8 -------- src/komodo_utils.h | 7 ++++--- src/notaries_staked.cpp | 42 ++++++++++++++++++++++++++-------------- src/notaries_staked.h | 3 ++- src/wallet/rpcwallet.cpp | 26 ++++++++++++------------- src/wallet/wallet.cpp | 2 +- 6 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 596ee69d1..e02860414 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -700,14 +700,6 @@ void komodo_init(int32_t height) { pthread_mutex_init(&komodo_mutex,NULL); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); -#ifdef SERVER - char Raddress[18]; uint8_t pubkey33[33]; - decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); - pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - CBitcoinAddress address(Raddress); - NOTARY_ADDRESS = address.ToString(); - updateStakedNotary(); -#endif if ( height >= 0 ) { n = (int32_t)(sizeof(Notaries_genesis)/sizeof(*Notaries_genesis)); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 36c93cedd..2a0452f1f 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1508,7 +1508,7 @@ void komodo_args(char *argv0) extern const char *Notaries_elected1[][2]; std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[256],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0; IS_KOMODO_NOTARY = GetBoolArg("-notary", false); - IS_STAKED_NOTARY = GetBoolArg("-stakednotary", false); + IS_STAKED_NOTARY = GetArg("-stakednotary", -1); if ( GetBoolArg("-gen", false) != 0 ) KOMODO_MININGTHREADS = GetArg("-genproclimit",1); else KOMODO_MININGTHREADS = -1; @@ -1516,7 +1516,7 @@ void komodo_args(char *argv0) fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n"); DONATION_PUBKEY = GetArg("-donation", ""); NOTARY_PUBKEY = GetArg("-pubkey", ""); - if ( strlen(NOTARY_PUBKEY.c_str()) == 66 || IS_STAKED_NOTARY == false ) + if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) { USE_EXTERNAL_PUBKEY = 1; if ( IS_KOMODO_NOTARY == 0 ) @@ -1525,11 +1525,12 @@ void komodo_args(char *argv0) if ( strcmp(NOTARY_PUBKEY.c_str(),Notaries_elected1[i][1]) == 0 ) { IS_KOMODO_NOTARY = 1; + IS_STAKED_NOTARY = -1; fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]); break; } } - //KOMODO_PAX = 1; + //KOMODO_PAX = 1; } //else KOMODO_PAX = GetArg("-pax",0); name = GetArg("-ac_name",""); if ( argv0 != 0 ) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index bf59a68b7..c10d21a8f 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -1,6 +1,7 @@ #include "notaries_staked.h" #include "crosschain.h" +#include "cc/CCinclude.h" #include extern char NOTARYADDRS[18][64]; @@ -116,21 +117,21 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; -void updateStakedNotary() { +int8_t updateStakedNotary() { std::string notaryname; - //pthread_mutex_lock(&komodo_mutex); - if (StakedNotaryID(notaryname,(char *)NOTARY_ADDRESS.c_str()) != -1 ) { - IS_STAKED_NOTARY = 1; - IS_KOMODO_NOTARY = 0; - } else { - IS_STAKED_NOTARY = 0; - } - //pthread_mutex_unlock(&komodo_mutex); + char Raddress[18]; uint8_t pubkey33[33]; + pthread_mutex_lock(&komodo_mutex); + decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); + pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); + NOTARY_ADDRESS.clear(); + NOTARY_ADDRESS.assign(Raddress); + pthread_mutex_unlock(&komodo_mutex); + return(StakedNotaryID(notaryname,Raddress)); } int STAKED_era(int timestamp) { - int era; + int8_t era, didera; if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) era = 1; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) @@ -142,9 +143,18 @@ int STAKED_era(int timestamp) else era = 0; // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - if ( era > STAKED_ERA ) { - STAKED_ERA = era; - updateStakedNotary(); + if ( era > STAKED_ERA || didera == 0 ) + { + STAKED_ERA = era; + if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) + { + if (( IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + { + IS_KOMODO_NOTARY = 0; + fprintf(stderr, "INIT.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era); + } + didera++; + } } return(era); }; @@ -171,13 +181,15 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { } int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { + int found = -1; for (size_t i = 0; i < num_notaries; i++) { if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); - return(i); + found = i; } + fprintf(stderr, "[%ld] %s\n",i,NOTARYADDRS[i]); } - return(-1); + return(found); } CrosschainAuthority Choose_auth_STAKED(int chosen_era) { diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 8f0802eb3..de502eb6d 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -3,6 +3,7 @@ #define NOTARIES_STAKED #include "crosschain.h" +#include "cc/CCinclude.h" static const int STAKED_ERA_GAP = 777; @@ -25,7 +26,7 @@ extern int num_notaries_STAKED4; int is_STAKED(const char *chain_name); int STAKED_era(int timestamp); -void updateStakedNotary(); +int8_t updateStakedNotary(); int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 7e2109329..c56d60a40 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4967,7 +4967,7 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) } bool pubkey2addr(char *destaddr,uint8_t *pubkey33); -extern int32_t IS_KOMODO_NOTARY,IS_STAKED_NOTARY; +extern int32_t IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; @@ -4994,7 +4994,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) #ifdef ENABLE_WALLET LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); #else - LOCK(cs_main); + LOCK2(cs_main); #endif char Raddress[18]; @@ -5018,18 +5018,18 @@ UniValue setpubkey(const UniValue& params, bool fHelp) result.push_back(Pair("WARNING", "privkey for this pubkey is not imported to wallet!")); } else { result.push_back(Pair("ismine", "true")); - std::string notaryname; - if ( StakedNotaryID(notaryname, Raddress) != -1 ) { - IS_STAKED_NOTARY = 1; - result.push_back(Pair("IsNotary", notaryname)); - } - } #endif - } else { + std::string notaryname; + if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) { + result.push_back(Pair("IsNotary", notaryname)); + IS_KOMODO_NOTARY = 0; + USE_EXTERNAL_PUBKEY = 1; + } + NOTARY_PUBKEY = params[0].get_str(); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + } + } else result.push_back(Pair("error", "pubkey entered is invalid.")); - } - NOTARY_PUBKEY = params[0].get_str(); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); } } else { result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); @@ -5037,7 +5037,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) } else { result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } - if ( NOTARY_PUBKEY33[0] != 0 && NOTARY_ADDRESS.empty() == false ) { + if ( NOTARY_PUBKEY33[0] != 0 && !NOTARY_ADDRESS.empty() ) { result.push_back(Pair("address", NOTARY_ADDRESS)); result.push_back(Pair("pubkey", NOTARY_PUBKEY)); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 26689cfde..b4d61fddc 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1214,7 +1214,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - if ( NOTARY_ADDRESS != "" && IS_STAKED_NOTARY == 1 ) + if ( !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) { int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { From d986a9be49cbdf1a8a1a0e56876bb3109759d97a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 16:37:22 +0800 Subject: [PATCH 0530/4463] fix --- src/notaries_staked.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index c10d21a8f..868763cc0 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -5,9 +5,10 @@ #include extern char NOTARYADDRS[18][64]; -extern std::string NOTARY_ADDRESS; +extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t komodo_mutex; +extern uint8_t NOTARY_PUBKEY33[33]; // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = From c9c5655377a8466e13b76a06e91dfde50cefa480 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 16:39:59 +0800 Subject: [PATCH 0531/4463] fix --- src/notaries_staked.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 868763cc0..3fcd6c418 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -118,6 +118,7 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; +#ifdef SERVER0 int8_t updateStakedNotary() { std::string notaryname; char Raddress[18]; uint8_t pubkey33[33]; @@ -129,6 +130,7 @@ int8_t updateStakedNotary() { pthread_mutex_unlock(&komodo_mutex); return(StakedNotaryID(notaryname,Raddress)); } +#endif int STAKED_era(int timestamp) { From bf743f3e9397792c39866f0d23f0ba8ce782a7a7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 16:44:05 +0800 Subject: [PATCH 0532/4463] try --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 3fcd6c418..c0972213f 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -118,7 +118,7 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; -#ifdef SERVER0 +#ifdef SERVER int8_t updateStakedNotary() { std::string notaryname; char Raddress[18]; uint8_t pubkey33[33]; From 5c3d966b17a13a60a5104b44dab2347455317248 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 16:45:51 +0800 Subject: [PATCH 0533/4463] try --- src/notaries_staked.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index c0972213f..06ec4abfe 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -130,6 +130,10 @@ int8_t updateStakedNotary() { pthread_mutex_unlock(&komodo_mutex); return(StakedNotaryID(notaryname,Raddress)); } +#else +int8_t updateStakedNotary() { + return(-1) +} #endif int STAKED_era(int timestamp) From 93c2aac037e2685d5b19550a8b1a58f81b8f1a80 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 16:46:41 +0800 Subject: [PATCH 0534/4463] ; --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 06ec4abfe..4b50c01b4 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -132,7 +132,7 @@ int8_t updateStakedNotary() { } #else int8_t updateStakedNotary() { - return(-1) + return(-1); } #endif From e32a1ae447fa3f930afe3e04396cf757a5faefee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 16:54:31 +0800 Subject: [PATCH 0535/4463] prints fix --- src/notaries_staked.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 4b50c01b4..d44dad31d 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -138,7 +138,8 @@ int8_t updateStakedNotary() { int STAKED_era(int timestamp) { - int8_t era, didera; + int8_t era = 0; + static int didera; if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) era = 1; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) @@ -158,7 +159,7 @@ int STAKED_era(int timestamp) if (( IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; - fprintf(stderr, "INIT.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era); + fprintf(stderr, "INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); } didera++; } @@ -188,15 +189,13 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { } int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { - int found = -1; for (size_t i = 0; i < num_notaries; i++) { if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); - found = i; + return(i); } - fprintf(stderr, "[%ld] %s\n",i,NOTARYADDRS[i]); } - return(found); + return(-1); } CrosschainAuthority Choose_auth_STAKED(int chosen_era) { From 629d69debe6e514d2b0bd34bd0436c0a781b25c7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:02:08 +0800 Subject: [PATCH 0536/4463] print --- src/notaries_staked.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index d44dad31d..07f7b3dee 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -125,6 +125,7 @@ int8_t updateStakedNotary() { pthread_mutex_lock(&komodo_mutex); decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); + fprintf(stderr, "Raddress: %s\n",Raddress); NOTARY_ADDRESS.clear(); NOTARY_ADDRESS.assign(Raddress); pthread_mutex_unlock(&komodo_mutex); From e712367feae426ff6ef232d3be10c294cd8700e6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:08:51 +0800 Subject: [PATCH 0537/4463] i --- src/notaries_staked.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 07f7b3dee..d1640403b 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -125,7 +125,6 @@ int8_t updateStakedNotary() { pthread_mutex_lock(&komodo_mutex); decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - fprintf(stderr, "Raddress: %s\n",Raddress); NOTARY_ADDRESS.clear(); NOTARY_ADDRESS.assign(Raddress); pthread_mutex_unlock(&komodo_mutex); @@ -152,11 +151,15 @@ int STAKED_era(int timestamp) else era = 0; // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. + + fprintf(stderr, "era.%d stakedEra.%s didea.%d\n",era,STAKED_ER,didera); if ( era > STAKED_ERA || didera == 0 ) { STAKED_ERA = era; + fprintf(stderr, "NUMBER 2 era.%d stakedEra.%s\n",era,STAKED_ERA); if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) { + fprintf(stderr, "PUBKEY AND ARRDESS ARRAY SET!\n"); if (( IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; @@ -193,6 +196,7 @@ int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *R for (size_t i = 0; i < num_notaries; i++) { if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); + printf("notary number: %ld\n",i ); return(i); } } From 955510333cfb5fa76d162f40437fa34585e65c32 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:16:18 +0800 Subject: [PATCH 0538/4463] fix --- src/notaries_staked.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index d1640403b..c22168aaf 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -152,11 +152,11 @@ int STAKED_era(int timestamp) era = 0; // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - fprintf(stderr, "era.%d stakedEra.%s didea.%d\n",era,STAKED_ER,didera); + fprintf(stderr, "era.%d stakedEra.%d didea.%d\n",era,STAKED_ERA,didera); if ( era > STAKED_ERA || didera == 0 ) { STAKED_ERA = era; - fprintf(stderr, "NUMBER 2 era.%d stakedEra.%s\n",era,STAKED_ERA); + fprintf(stderr, "NUMBER 2 era.%d stakedEra.%d\n",era,STAKED_ERA); if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) { fprintf(stderr, "PUBKEY AND ARRDESS ARRAY SET!\n"); From ec87ec9af5b7cb61d786ee77bac354adeb8a5247 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:19:50 +0800 Subject: [PATCH 0539/4463] fix --- src/notaries_staked.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index c22168aaf..82323513d 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -152,7 +152,7 @@ int STAKED_era(int timestamp) era = 0; // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - fprintf(stderr, "era.%d stakedEra.%d didea.%d\n",era,STAKED_ERA,didera); + //fprintf(stderr, "era.%d stakedEra.%d didea.%d\n",era,STAKED_ERA,didera); if ( era > STAKED_ERA || didera == 0 ) { STAKED_ERA = era; @@ -160,7 +160,7 @@ int STAKED_era(int timestamp) if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) { fprintf(stderr, "PUBKEY AND ARRDESS ARRAY SET!\n"); - if (( IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + if ( ( IS_STAKED_NOTARY= updateStakedNotary() > -1 ) ) { IS_KOMODO_NOTARY = 0; fprintf(stderr, "INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); From e30bbc5dd7de8632b86582c478dc70dbbca99ac2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:25:23 +0800 Subject: [PATCH 0540/4463] try this --- src/notaries_staked.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 82323513d..7bb1ee003 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -156,11 +156,10 @@ int STAKED_era(int timestamp) if ( era > STAKED_ERA || didera == 0 ) { STAKED_ERA = era; - fprintf(stderr, "NUMBER 2 era.%d stakedEra.%d\n",era,STAKED_ERA); if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) { - fprintf(stderr, "PUBKEY AND ARRDESS ARRAY SET!\n"); - if ( ( IS_STAKED_NOTARY= updateStakedNotary() > -1 ) ) + IS_STAKED_NOTARY= updateStakedNotary(); + if ( IS_STAKED_NOTARY > -1 ) { IS_KOMODO_NOTARY = 0; fprintf(stderr, "INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); @@ -194,6 +193,7 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { + fprintf(stderr, "Raddress: %s Array address: %s\n",Raddress,NOTARYADDRS[13]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); printf("notary number: %ld\n",i ); From 366554f203ca14accce8ceac5156c4d1700b9f9d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:26:24 +0800 Subject: [PATCH 0541/4463] try --- src/notaries_staked.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 7bb1ee003..be1505d54 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -159,6 +159,7 @@ int STAKED_era(int timestamp) if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) { IS_STAKED_NOTARY= updateStakedNotary(); + fprintf(stderr, "notary number: %d\n", IS_STAKED_NOTARY); if ( IS_STAKED_NOTARY > -1 ) { IS_KOMODO_NOTARY = 0; From 82628b5640050276e49b11ce8d921229a4edb071 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:37:56 +0800 Subject: [PATCH 0542/4463] aok --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index be1505d54..f551f6d51 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -156,7 +156,7 @@ int STAKED_era(int timestamp) if ( era > STAKED_ERA || didera == 0 ) { STAKED_ERA = era; - if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0] != 0 ) + if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0][0] != 0 ) { IS_STAKED_NOTARY= updateStakedNotary(); fprintf(stderr, "notary number: %d\n", IS_STAKED_NOTARY); From c9ba061ecb3415e2b64e95ec2c2d49b571e602f8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 17:41:58 +0800 Subject: [PATCH 0543/4463] workdin? --- src/notaries_staked.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index f551f6d51..7e690fab3 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -158,9 +158,7 @@ int STAKED_era(int timestamp) STAKED_ERA = era; if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0][0] != 0 ) { - IS_STAKED_NOTARY= updateStakedNotary(); - fprintf(stderr, "notary number: %d\n", IS_STAKED_NOTARY); - if ( IS_STAKED_NOTARY > -1 ) + if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; fprintf(stderr, "INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); @@ -194,10 +192,9 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { - fprintf(stderr, "Raddress: %s Array address: %s\n",Raddress,NOTARYADDRS[13]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); - printf("notary number: %ld\n",i ); + //printf("notary number: %ld\n",i ); return(i); } } From d6dfe034855bb552c07e52346014c33c5a9a5b68 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 20:18:34 +0800 Subject: [PATCH 0544/4463] here we go :D --- src/komodo_notary.h | 74 ++++++++------------------------------ src/komodo_utils.h | 13 ++++--- src/notaries_staked.cpp | 78 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 94 insertions(+), 71 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index e02860414..88ce299f7 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -22,11 +22,6 @@ #define KOMODO_MAINNET_START 178999 -extern char NOTARYADDRS[18][64]; - -//extern const char *notaries_STAKED[][2]; -//extern const int num_notaries_STAKED; - const char *Notaries_genesis[][2] = { { "jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, @@ -206,8 +201,6 @@ const char *Notaries_elected1[][2] = }; #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); - int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; @@ -220,6 +213,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam timestamp = komodo_heightstamp(height); else if ( ASSETCHAINS_SYMBOL[0] == 0 ) timestamp = 0; + // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) { @@ -232,11 +226,6 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam n0 = (int32_t)(sizeof(Notaries_elected0)/sizeof(*Notaries_elected0)); for (i=0; i STAKED_ERA || didera == 0 ) { + pthread_mutex_lock(&komodo_mutex); STAKED_ERA = era; - if ( NOTARY_PUBKEY33[0] != 0 && NOTARYADDRS[0][0] != 0 ) + if ( NOTARY_PUBKEY33[0] != 0 ) { - if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; - fprintf(stderr, "INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); + fprintf(stderr, "Staked Notary Protection Active! INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); } didera++; } + pthread_mutex_unlock(&komodo_mutex); } return(era); }; int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t notaryID = -1; + static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; + static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; + static char ChainName[65]; + + if ( ChainName[0] == 0 ) { + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + strcpy(ChainName,"KMD"); + else + strcpy(ChainName,ASSETCHAINS_SYMBOL); + } + if ( STAKED_ERA != 0 ) { switch (STAKED_ERA) { case 1: + if ( didstaked1 == 0 ) { + for (i=0; i Date: Sun, 4 Nov 2018 20:38:06 +0800 Subject: [PATCH 0545/4463] i --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index b758a74a8..c327f11e4 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -169,7 +169,7 @@ int STAKED_era(int timestamp) }; int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { - int8_t notaryID = -1; + int8_t notaryID = -1; int i; static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static char ChainName[65]; From 87542679855527ad6957b9f494f167d02a9fc0a3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 20:45:23 +0800 Subject: [PATCH 0546/4463] disable mutex --- src/notaries_staked.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index c327f11e4..0951e130a 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -152,7 +152,7 @@ int STAKED_era(int timestamp) if ( era > STAKED_ERA || didera == 0 ) { - pthread_mutex_lock(&komodo_mutex); + //pthread_mutex_lock(&komodo_mutex); STAKED_ERA = era; if ( NOTARY_PUBKEY33[0] != 0 ) { @@ -163,7 +163,7 @@ int STAKED_era(int timestamp) } didera++; } - pthread_mutex_unlock(&komodo_mutex); + //pthread_mutex_unlock(&komodo_mutex); } return(era); }; From 26a2155af5964d7a13046b7483e35f69b383bcc7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 20:50:50 +0800 Subject: [PATCH 0547/4463] fix --- src/notaries_staked.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 0951e130a..41e707f7f 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -4,7 +4,7 @@ #include "cc/CCinclude.h" #include -extern char NOTARYADDRS[18][64]; +extern char NOTARYADDRS[18][64],ASSETCHAINS_SYMBOL; extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t komodo_mutex; @@ -152,7 +152,6 @@ int STAKED_era(int timestamp) if ( era > STAKED_ERA || didera == 0 ) { - //pthread_mutex_lock(&komodo_mutex); STAKED_ERA = era; if ( NOTARY_PUBKEY33[0] != 0 ) { @@ -163,7 +162,6 @@ int STAKED_era(int timestamp) } didera++; } - //pthread_mutex_unlock(&komodo_mutex); } return(era); }; @@ -175,7 +173,7 @@ int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { static char ChainName[65]; if ( ChainName[0] == 0 ) { - if ( ASSETCHAINS_SYMBOL[0] != 0 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 ) strcpy(ChainName,"KMD"); else strcpy(ChainName,ASSETCHAINS_SYMBOL); From d41373edec9e6dad7ab288aa026748348ede585a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 4 Nov 2018 20:52:03 +0800 Subject: [PATCH 0548/4463] again --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 41e707f7f..1f6cb71c7 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -4,7 +4,7 @@ #include "cc/CCinclude.h" #include -extern char NOTARYADDRS[18][64],ASSETCHAINS_SYMBOL; +extern char NOTARYADDRS[18][64]; extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t komodo_mutex; From f07284c6820b2fdad11109d8dd50fb4cee85e4f2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 14:28:43 +0800 Subject: [PATCH 0549/4463] Move 99% of staked notary code to its own file --- src/komodo_globals.h | 2 +- src/komodo_notary.h | 87 ++++++++-------------------- src/komodo_utils.h | 4 +- src/notaries_staked.cpp | 124 +++++++++++++++++++++++++--------------- src/notaries_staked.h | 1 + src/wallet/wallet.cpp | 14 +++-- 6 files changed, 115 insertions(+), 117 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 2070e1240..50952af69 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -30,7 +30,7 @@ int32_t komodo_longestchain(); uint64_t komodo_maxallowed(int32_t baseid); int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max); -pthread_mutex_t komodo_mutex; +pthread_mutex_t komodo_mutex,staked_mutex; #define KOMODO_ELECTION_GAP 2000 //((ASSETCHAINS_SYMBOL[0] == 0) ? 2000 : 100) #define KOMODO_ASSETCHAIN_MAXLEN 65 diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 88ce299f7..48eeb6cba 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -204,15 +204,17 @@ const char *Notaries_elected1[][2] = int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; - static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2; - static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4; - static uint8_t null_pubkeys[64][33] = {0}; - int staked_era; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + if ( timestamp == 0 ) timestamp = komodo_heightstamp(height); - else if ( ASSETCHAINS_SYMBOL[0] == 0 ) + if ( ASSETCHAINS_SYMBOL[0] == 0 ) { + // Here we run the staked notaries function to populate the Notary Address's global var on KMD. + if ( IS_STAKED_NOTARY != -1 ) { + uint8_t tmp_pubkeys[64][33]; + numStakedNotaries(tmp_pubkeys,is_STAKED(timestamp)); + } timestamp = 0; + } // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) @@ -253,67 +255,26 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam } else { // here we can activate our pubkeys for STAKED chains by era. - if (timestamp != 0) - { - staked_era = STAKED_era(timestamp); - if (staked_era == 1) + if (timestamp != 0) { - if (didstaked1 == 0) + int staked_era; int32_t numSN; + uint8_t staked_pubkeys[64][33]; uint8_t null_pubkeys[64][33] = {0}; + staked_era = STAKED_era(timestamp); + + if (staked_era != 0) { - ns1 = num_notaries_STAKED1; - for (i=0; i STAKED_ERA || didera == 0 ) { STAKED_ERA = era; - if ( NOTARY_PUBKEY33[0] != 0 ) + if ( NOTARYADDRS[0][0] != 0 ) { - if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + if ( NOTARY_PUBKEY33[0] != 0 ) { - IS_KOMODO_NOTARY = 0; - fprintf(stderr, "Staked Notary Protection Active! INIT.%d RADD.%s ERA.%d didera.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era,didera); + if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + { + IS_KOMODO_NOTARY = 0; + fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era); + } } didera++; } @@ -167,89 +170,120 @@ int STAKED_era(int timestamp) }; int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { - int8_t notaryID = -1; int i; - static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; - static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; - static char ChainName[65]; + int8_t notaryID = -1; + if ( STAKED_ERA != 0 ) { + switch (STAKED_ERA) { + case 1: + notaryID = ScanStakedArray(notaries_STAKED1,num_notaries_STAKED1,Raddress,notaryname); + break; + case 2: + notaryID = ScanStakedArray(notaries_STAKED2,num_notaries_STAKED2,Raddress,notaryname); + break; + case 3: + notaryID = ScanStakedArray(notaries_STAKED3,num_notaries_STAKED3,Raddress,notaryname); + break; + case 4: + notaryID = ScanStakedArray(notaries_STAKED4,num_notaries_STAKED4,Raddress,notaryname); + break; + } + } + return(notaryID); +} - if ( ChainName[0] == 0 ) { +int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { + int i; int8_t retval = 0; + static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; + static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; + static char ChainName[65]; + + if ( ChainName[0] == 0 ) + { + pthread_mutex_init(&staked_mutex,NULL); if ( ASSETCHAINS_SYMBOL[0] == 0 ) strcpy(ChainName,"KMD"); else strcpy(ChainName,ASSETCHAINS_SYMBOL); } - if ( STAKED_ERA != 0 ) { - switch (STAKED_ERA) { + if ( era != 0 ) { + switch (era) { case 1: - if ( didstaked1 == 0 ) { - for (i=0; i Date: Mon, 5 Nov 2018 14:30:36 +0800 Subject: [PATCH 0550/4463] fix --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 48eeb6cba..9b14060a6 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -211,7 +211,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam // Here we run the staked notaries function to populate the Notary Address's global var on KMD. if ( IS_STAKED_NOTARY != -1 ) { uint8_t tmp_pubkeys[64][33]; - numStakedNotaries(tmp_pubkeys,is_STAKED(timestamp)); + numStakedNotaries(tmp_pubkeys,STAKED_era(timestamp)); } timestamp = 0; } From 64c4af2756bd2e55d22973c8ad643a1bc5cdc628 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 14:51:05 +0800 Subject: [PATCH 0551/4463] fix --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c56d60a40..bcd490915 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5011,14 +5011,14 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if (isValid) { CTxDestination dest = address.Get(); - NOTARY_ADDRESS = address.ToString(); #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; if ( mine == ISMINE_NO ) { - result.push_back(Pair("WARNING", "privkey for this pubkey is not imported to wallet!")); + result.push_back(Pair("error", "privkey for this pubkey is not imported to wallet!")); } else { result.push_back(Pair("ismine", "true")); #endif + NOTARY_ADDRESS = address.ToString(); std::string notaryname; if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) { result.push_back(Pair("IsNotary", notaryname)); From 068c48214d1b5c33cccc7961587f826700a9f2de Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 15:36:47 +0800 Subject: [PATCH 0552/4463] remove unneeded things --- src/bitcoin-cli.cpp | 1 - src/rpcserver.h | 3 --- src/wallet/rpcwallet.cpp | 6 ------ src/wallet/wallet.cpp | 12 +++++++----- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index aead9fb7a..d7c906669 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -73,7 +73,6 @@ public: #include "komodo_structs.h" #include "komodo_globals.h" -#include "cc/utils.h" #include "komodo_utils.h" #include "komodo_cJSON.c" #include "komodo_notary.h" diff --git a/src/rpcserver.h b/src/rpcserver.h index 372d84392..81ca8a8b9 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -287,9 +287,6 @@ extern UniValue FSMlist(const UniValue& params, bool fHelp); extern UniValue FSMinfo(const UniValue& params, bool fHelp); extern UniValue auctionaddress(const UniValue& params, bool fHelp); -extern bool pubkey2address(char *destaddr,uint8_t *pubkey33); -extern bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); - extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp //extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp extern UniValue getaccountaddress(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index bcd490915..fe21544dc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4991,11 +4991,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp) + HelpExampleRpc("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e") ); -#ifdef ENABLE_WALLET LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); -#else - LOCK2(cs_main); -#endif char Raddress[18]; uint8_t pubkey33[33]; @@ -5011,13 +5007,11 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if (isValid) { CTxDestination dest = address.Get(); -#ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; if ( mine == ISMINE_NO ) { result.push_back(Pair("error", "privkey for this pubkey is not imported to wallet!")); } else { result.push_back(Pair("ismine", "true")); -#endif NOTARY_ADDRESS = address.ToString(); std::string notaryname; if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f21c23810..a340ecfae 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1230,7 +1230,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } } // Now we know if it was a tx sent to us, that wasnt from ourself. - fprintf(stderr, "We sent from address: %s vouts: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs); + if ( numvinIsOurs != 0 ) + fprintf(stderr, "We sent from address: %s vins: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs); // Count vouts, check if OUR notary address is the receiver. if ( numvinIsOurs == 0 ) { for (size_t i = 0; i < tx.vout.size() ; i++) { @@ -1244,8 +1245,10 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl } } // If no vouts are to the notary address we will ignore them. - if ( numvoutIsOurs == 0 ) + if ( numvoutIsOurs == 0 ) { + fprintf(stderr, "Received transaction to address other than notary address, ignored! \n"); return false; + } fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. int64_t avgVoutSize = totalvoutvalue / numvoutIsOurs; @@ -1254,10 +1257,9 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl fprintf(stderr, "ignored: %d vouts average size of %ld sats.\n",numvoutIsOurs, avgVoutSize); return false; } - } else if ( numvinIsOurs < tx.vin.size() ) { - // this means we were in a multi sig, ideally we would remove the utxo we spent from our wallet, but you cant do that. - // this will be removed later... RPC call PurgeWalletSpents will be created instead. + // this means we were in a multi sig, ideally we would remove the utxo we spent from our wallet, but you cant do that, unless all the tx's vouts are also spent. + // RPC call PurgeWalletSpents will be created to clean all fully spent tx's instead. fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } } From 623ec7787750409ed5dfd7bc01ea4d0f32f321cb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 16:06:53 +0800 Subject: [PATCH 0553/4463] more --- src/komodo_utils.h | 2 -- src/main.cpp | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 07296466b..546fa8a13 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -13,8 +13,6 @@ * * ******************************************************************************/ #include "komodo_defs.h" -#include "cc/utils.h" -#include "cc/CCinclude.h" #ifdef _WIN32 #include diff --git a/src/main.cpp b/src/main.cpp index e272adff8..c5d2db923 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1062,9 +1062,12 @@ int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only } didinit = 1; } */ - for (int32_t i=0; i<=64; i++) - if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 ) - return(1); + if ( NOTARYADDRS[0][0] != 0 ) + { + for (int32_t i=0; i<=64; i++) + if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 ) + return(1); + } return(0); } @@ -1218,7 +1221,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio } } } - + // Ensure input values do not exceed MAX_MONEY // We have not resolved the txin values at this stage, // but we do know what the joinsplits claim to add From f0b07a30a7c7346dda0e5a805ca203211885ced3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 16:16:49 +0800 Subject: [PATCH 0554/4463] fix notaryaddrs var ? --- src/komodo_globals.h | 2 +- src/main.cpp | 2 +- src/notaries_staked.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 50952af69..783a3bafc 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -49,7 +49,7 @@ int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JU std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW; -char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[18][64]; +char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[64][18]; uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT,KOMODO_DPOWCONFS = 1; uint32_t ASSETCHAINS_MAGIC = 2387029918; diff --git a/src/main.cpp b/src/main.cpp index c5d2db923..53067481e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1044,7 +1044,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, return true; } } -extern char NOTARYADDRS[18][64]; +extern char NOTARYADDRS[64][18]; int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 6d98b480c..23b1eaa9c 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -4,7 +4,7 @@ #include "cc/CCinclude.h" #include -extern char NOTARYADDRS[18][64]; +extern char NOTARYADDRS[64][18]; extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t staked_mutex; @@ -283,6 +283,11 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { break; } } + else + { + // era is zero so we need to null ut the notary address's + //NOTARYADDRS[64][18] + } return(retval); } From 2c795c0f1c540c6cf22fdcb4866de7deba93ad74 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 16:30:08 +0800 Subject: [PATCH 0555/4463] fix --- src/komodo_globals.h | 2 +- src/main.cpp | 2 +- src/notaries_staked.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 783a3bafc..b91a6666e 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -49,7 +49,7 @@ int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JU std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW; -char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[64][18]; +char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[64][36]; uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT,KOMODO_DPOWCONFS = 1; uint32_t ASSETCHAINS_MAGIC = 2387029918; diff --git a/src/main.cpp b/src/main.cpp index 53067481e..ea4bc1234 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1044,7 +1044,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, return true; } } -extern char NOTARYADDRS[64][18]; +extern char NOTARYADDRS[64][36]; int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 23b1eaa9c..790fe5ece 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -4,7 +4,7 @@ #include "cc/CCinclude.h" #include -extern char NOTARYADDRS[64][18]; +extern char NOTARYADDRS[64][36]; extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t staked_mutex; @@ -216,6 +216,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { pthread_mutex_lock(&staked_mutex); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys1[i]); pthread_mutex_unlock(&staked_mutex); + fprintf(stderr, "copied address [%d]: %s\n",i,NOTARYADDRS[i]); #endif } didstaked1 = 1; @@ -224,6 +225,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { didstaked4 = 0; printf("%s is a STAKED chain in era 1 \n",ChainName); } + memcpy(pubkeys,staked_pubkeys1,num_notaries_STAKED1 * 33); retval = num_notaries_STAKED1; break; From 1c497de1facad745c5d3bd8807a3b9931b6262c2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 16:34:55 +0800 Subject: [PATCH 0556/4463] test --- src/notaries_staked.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 790fe5ece..e6ae00961 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -219,6 +219,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { fprintf(stderr, "copied address [%d]: %s\n",i,NOTARYADDRS[i]); #endif } + fprintf(stderr, "size of notaryaddrs array: %ld\n",sizeof(NOTARYADDRS)); didstaked1 = 1; didstaked2 = 0; didstaked3 = 0; From 8d687f0312495a94d66c55cab13fd782d688015c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:11:32 +0800 Subject: [PATCH 0557/4463] add num notaris golbal, and reset notaries on era 0 --- src/komodo_globals.h | 2 +- src/komodo_notary.h | 4 ++-- src/main.cpp | 48 +++++++++++++++++++++++++---------------- src/notaries_staked.cpp | 15 ++++++++----- src/notaries_staked.h | 2 +- 5 files changed, 43 insertions(+), 28 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index b91a6666e..05af4edd8 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -47,7 +47,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; -uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW; +uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,NUM_NOTARIES; char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[64][36]; uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 9b14060a6..d032475bb 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -258,7 +258,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam if (timestamp != 0) { int staked_era; int32_t numSN; - uint8_t staked_pubkeys[64][33]; uint8_t null_pubkeys[64][33] = {0}; + uint8_t staked_pubkeys[64][33]; staked_era = STAKED_era(timestamp); if (staked_era != 0) @@ -271,7 +271,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell. printf("%s is a STAKED chain and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); - memcpy(pubkeys,null_pubkeys,64 * 33); + memset(pubkeys,0,sizeof(pubkeys)); return(64); } } diff --git a/src/main.cpp b/src/main.cpp index ea4bc1234..386eb122e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1044,29 +1044,39 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, return true; } } + extern char NOTARYADDRS[64][36]; +extern uint8_t NUM_NOTARIES; int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only { - /*static int32_t didinit; - int32_t i; - if ( didinit == 0 ) - { - uint8_t pubkey33[33]; - for (i=0; i<=17; i++) - { - if ( i < 17 ) - decode_hex(pubkey33,33,(char *)notaries_STAKED1[i][1]); - else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); - pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); - } - didinit = 1; - } */ - if ( NOTARYADDRS[0][0] != 0 ) - { - for (int32_t i=0; i<=64; i++) - if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 ) - return(1); + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) + { + if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 ) { + for (int32_t i=0; i<=NUM_NOTARIES; i++) + if ( strcmp(coinaddr,NOTARYADDRS[i]) == 0 ) + return(1); + } + } + else + { + static int32_t didinit; static char notaryaddrs[sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) + 1][64]; + int32_t i; + if ( didinit == 0 ) + { + uint8_t pubkey33[33]; + for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) + { + if ( i < sizeof(Notaries_elected1)/sizeof(*Notaries_elected1) ) + decode_hex(pubkey33,33,(char *)Notaries_elected1[i][1]); + else decode_hex(pubkey33,33,(char *)CRYPTO777_PUBSECPSTR); + pubkey2addr((char *)notaryaddrs[i],(uint8_t *)pubkey33); + } + didinit = 1; + } + for (i=0; i<=sizeof(Notaries_elected1)/sizeof(*Notaries_elected1); i++) + if ( strcmp(coinaddr,notaryaddrs[i]) == 0 ) + return(1); } return(0); } diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index e6ae00961..baf090bbf 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -8,7 +8,7 @@ extern char NOTARYADDRS[64][36]; extern std::string NOTARY_ADDRESS,NOTARY_PUBKEY; extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t staked_mutex; -extern uint8_t NOTARY_PUBKEY33[33]; +extern uint8_t NOTARY_PUBKEY33[33],NUM_NOTARIES; // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = @@ -215,11 +215,10 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #ifdef SERVER pthread_mutex_lock(&staked_mutex); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys1[i]); + NUM_NOTARIES = num_notaries_STAKED1; pthread_mutex_unlock(&staked_mutex); - fprintf(stderr, "copied address [%d]: %s\n",i,NOTARYADDRS[i]); #endif } - fprintf(stderr, "size of notaryaddrs array: %ld\n",sizeof(NOTARYADDRS)); didstaked1 = 1; didstaked2 = 0; didstaked3 = 0; @@ -238,6 +237,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #ifdef SERVER pthread_mutex_lock(&staked_mutex); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys2[i]); + NUM_NOTARIES = num_notaries_STAKED2; pthread_mutex_unlock(&staked_mutex); #endif } @@ -257,6 +257,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #ifdef SERVER pthread_mutex_lock(&staked_mutex); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys3[i]); + NUM_NOTARIES = num_notaries_STAKED3; pthread_mutex_unlock(&staked_mutex); #endif } @@ -275,6 +276,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #ifdef SERVER pthread_mutex_lock(&staked_mutex); pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)staked_pubkeys4[i]); + NUM_NOTARIES = num_notaries_STAKED4; pthread_mutex_unlock(&staked_mutex); #endif } @@ -288,8 +290,11 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { } else { - // era is zero so we need to null ut the notary address's - //NOTARYADDRS[64][18] + // era is zero so we need to null out the notary address's + pthread_mutex_lock(&staked_mutex); + memset(NOTARYADDRS,0,sizeof(NOTARYADDRS)); + NUM_NOTARIES = 0; + pthread_mutex_unlock(&staked_mutex); } return(retval); } diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 6aedbdbe1..9944c8465 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -8,7 +8,7 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1604222222; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541409634; static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; From 51442c510db7555335576d94825ae8aec3384c69 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:14:49 +0800 Subject: [PATCH 0558/4463] fix test --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index d032475bb..39263f579 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -271,7 +271,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell. printf("%s is a STAKED chain and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); - memset(pubkeys,0,sizeof(pubkeys)); + memset(pubkeys,0,64 * 33); return(64); } } From fec7d5f7fc927486f4b02be9d3b3952ecc6b319e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:23:02 +0800 Subject: [PATCH 0559/4463] test.. changed wrong era --- src/notaries_staked.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 9944c8465..9a8fc2a50 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,8 +7,8 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1604212834; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541409634; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541410234; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1604233000; static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; From a22a25ed89b281a3c080be524b75412e3a8b54f0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:34:24 +0800 Subject: [PATCH 0560/4463] try --- src/notaries_staked.cpp | 1 + src/notaries_staked.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index baf090bbf..ac983d1ac 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -302,6 +302,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { + fprintf(stderr, "address [%d]: %s\n",i,NOTARYADDRS[i]); notaryname.assign(notaries_chosen[i][0]); //printf("notary number: %ld\n",i ); return(i); diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 9a8fc2a50..06d1c53f2 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -8,7 +8,7 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1541410234; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1604233000; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541411534; static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; From ae338198b4a94d8fab00d9fd916ba426e0b7f214 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:35:44 +0800 Subject: [PATCH 0561/4463] fix --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index ac983d1ac..3ccf4c5b9 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -302,7 +302,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { - fprintf(stderr, "address [%d]: %s\n",i,NOTARYADDRS[i]); + fprintf(stderr, "address [%ld]: %s\n",i,NOTARYADDRS[i]); notaryname.assign(notaries_chosen[i][0]); //printf("notary number: %ld\n",i ); return(i); From becfd7b0c7fbad44f6a091acd9a18512ce21108b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:42:10 +0800 Subject: [PATCH 0562/4463] fix print --- src/notaries_staked.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 3ccf4c5b9..7c39f3f62 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -301,8 +301,8 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { + fprintf(stderr, "address [%ld]: %s\n",i,NOTARYADDRS[i]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { - fprintf(stderr, "address [%ld]: %s\n",i,NOTARYADDRS[i]); notaryname.assign(notaries_chosen[i][0]); //printf("notary number: %ld\n",i ); return(i); From 0f712b6074686e95a6e494ea3d370049d03dfb16 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:44:23 +0800 Subject: [PATCH 0563/4463] tests era 3 --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 06d1c53f2..82988c1fc 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -9,7 +9,7 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1541410234; static const int STAKED_NOTARIES_TIMESTAMP2 = 1541411534; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541412000; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 102e221887478c1ea1cbbefd632342530c76a0e0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 17:58:23 +0800 Subject: [PATCH 0564/4463] test eras again --- src/komodo_notary.h | 17 +++-------------- src/notaries_staked.cpp | 5 ++++- src/notaries_staked.h | 6 +++--- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 39263f579..4e40dc6e7 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -260,20 +260,9 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam int staked_era; int32_t numSN; uint8_t staked_pubkeys[64][33]; staked_era = STAKED_era(timestamp); - - if (staked_era != 0) - { - numSN = numStakedNotaries(staked_pubkeys,staked_era); - memcpy(pubkeys,staked_pubkeys,numSN * 33); - return(numSN); - } - else - { - // this means we are in a gap, so we set the array of pubkeys to zero, this does't seem to correctly work, so added exeption to komodo.h aswell. - printf("%s is a STAKED chain and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); - memset(pubkeys,0,64 * 33); - return(64); - } + numSN = numStakedNotaries(staked_pubkeys,staked_era); + memcpy(pubkeys,staked_pubkeys,numSN * 33); + return(numSN); } } diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 7c39f3f62..257076999 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -290,11 +290,14 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { } else { - // era is zero so we need to null out the notary address's + // era is zero so we need to null out the notary address's and pubkeys. pthread_mutex_lock(&staked_mutex); memset(NOTARYADDRS,0,sizeof(NOTARYADDRS)); NUM_NOTARIES = 0; + memset(pubkeys,0,64 * 33); pthread_mutex_unlock(&staked_mutex); + printf("%s is a STAKED chain and is in an ERA GAP.\n",ASSETCHAINS_SYMBOL); + return(64); } return(retval); } diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 82988c1fc..e7ee0a395 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541410234; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541411534; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541412000; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541412157; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541413657; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 8aee84c5b3e0048ec9eb60ffcf7f312668692568 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 18:23:59 +0800 Subject: [PATCH 0565/4463] fix --- src/komodo.h | 1 - src/notaries_staked.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index d2d0231f3..e406e565a 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -832,7 +832,6 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; iGetBlockTime()) == 0)) { - printf("ERA 0 SKIP %s\n",ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 257076999..31e88e414 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -208,7 +208,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { if ( era != 0 ) { switch (era) { case 1: - if ( didstaked1 == 0 ) + if ( didstaked1 == 0 || NOTARYADDRS[0][0] == 0 ) { for (i=0; i Date: Mon, 5 Nov 2018 18:27:08 +0800 Subject: [PATCH 0566/4463] too slow --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index e7ee0a395..cbd746bf3 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -9,7 +9,7 @@ static const int STAKED_ERA_GAP = 777; static const int STAKED_NOTARIES_TIMESTAMP1 = 1541412157; static const int STAKED_NOTARIES_TIMESTAMP2 = 1541413657; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541414977; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 21aa805a693d1e37b8190ce4dafc996c7d7712f1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 18:29:45 +0800 Subject: [PATCH 0567/4463] fix --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index cbd746bf3..97cf8f7b1 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541412157; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541413657; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541414977; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541413921; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541414898; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541415875; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From d5593b354c3909e4012144292f89775c00ef0252 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 18:48:10 +0800 Subject: [PATCH 0568/4463] try this --- src/notaries_staked.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 31e88e414..18b8f8801 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -146,8 +146,9 @@ int STAKED_era(int timestamp) era = 3; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) era = 4; - else - era = 0; + else { + era = 0; didera = 0; + } // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. if ( era > STAKED_ERA || didera == 0 ) From 76eb9a496eb866bb471d19002a5e7a0c37788b1f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 18:50:25 +0800 Subject: [PATCH 0569/4463] new eras test --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 97cf8f7b1..9c2b5d811 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541413921; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541414898; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541415875; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541415367; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541416544; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541417721; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 96c7f474b9f987ec3d9f20977b32cef35b7b2d38 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 19:48:36 +0800 Subject: [PATCH 0570/4463] try print --- src/komodo.h | 1 + src/komodo_notary.h | 2 +- src/notaries_staked.cpp | 33 +++++++++++++++++---------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e406e565a..2cf18d24e 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -832,6 +832,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; iGetBlockTime()) == 0)) { + printf("ERA 0 SKIP %s getblocktime: %d pindex->nTime : %d\n",pindex->GetBlockTime(),pindex->nTime,ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 4e40dc6e7..f9534ac18 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -254,7 +254,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam } } else - { // here we can activate our pubkeys for STAKED chains by era. + { // here we can activate our pubkeys for STAKED chains everythig is in notaries_staked.cpp if (timestamp != 0) { int staked_era; int32_t numSN; diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 18b8f8801..1bcc6ce93 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -118,22 +118,6 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; -#ifdef SERVER -int8_t updateStakedNotary() { - std::string notaryname; - char Raddress[18]; uint8_t pubkey33[33]; - decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); - pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - NOTARY_ADDRESS.clear(); - NOTARY_ADDRESS.assign(Raddress); - return(StakedNotaryID(notaryname,Raddress)); -} -#else -int8_t updateStakedNotary() { - return(-1); -} -#endif - int STAKED_era(int timestamp) { int8_t era = 0; @@ -170,6 +154,23 @@ int STAKED_era(int timestamp) return(era); }; +#ifdef SERVER +int8_t updateStakedNotary() { + if ( NOTARY_ADDRESS.empty() ) { + std::string notaryname; + char Raddress[18]; uint8_t pubkey33[33]; + decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); + pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); + NOTARY_ADDRESS.assign(Raddress); + } + return(StakedNotaryID(notaryname,Raddress)); +} +#else +int8_t updateStakedNotary() { + return(-1); +} +#endif + int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { int8_t notaryID = -1; if ( STAKED_ERA != 0 ) { From dfe8e4a6cdae8d99b64b90b3fb72939356d2c0b6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 20:44:37 +0800 Subject: [PATCH 0571/4463] test --- src/komodo.h | 2 +- src/komodo_notary.h | 1 + src/notaries_staked.cpp | 6 ++++++ src/notaries_staked.h | 6 +++--- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 2cf18d24e..bc691eb81 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -832,7 +832,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; iGetBlockTime()) == 0)) { - printf("ERA 0 SKIP %s getblocktime: %d pindex->nTime : %d\n",pindex->GetBlockTime(),pindex->nTime,ASSETCHAINS_SYMBOL); + printf("ERA 0 SKIP %s getblocktime: %d pindex->nTime : %d\n",pindex->GetBlockTime(),(uint32_t)pindex->nTime,ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); diff --git a/src/komodo_notary.h b/src/komodo_notary.h index f9534ac18..ff7bc5cc3 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -205,6 +205,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; + if ( timestamp == 0 ) timestamp = komodo_heightstamp(height); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 1bcc6ce93..3343ef716 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -121,7 +121,12 @@ int is_STAKED(const char *chain_name) { int STAKED_era(int timestamp) { int8_t era = 0; + static uint32_t lasttimestamp; static int didera; + // test this, seems to sometimes get called into the past? + if ( timestamp < lasttimestamp ) + timestamp = lasttimestamp; + if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) era = 1; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) @@ -151,6 +156,7 @@ int STAKED_era(int timestamp) didera++; } } + lasttimestamp = timestamp; return(era); }; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 9c2b5d811..a4e381a45 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541415367; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541416544; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541417721; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541422105; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541423282; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541424459; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 1102a73bf817190c95ccc3f526c270cee43e20b4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 20:48:08 +0800 Subject: [PATCH 0572/4463] cant do that --- src/notaries_staked.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 3343ef716..a3d37690e 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -162,13 +162,12 @@ int STAKED_era(int timestamp) #ifdef SERVER int8_t updateStakedNotary() { - if ( NOTARY_ADDRESS.empty() ) { - std::string notaryname; - char Raddress[18]; uint8_t pubkey33[33]; - decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); - pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - NOTARY_ADDRESS.assign(Raddress); - } + std::string notaryname; + char Raddress[18]; uint8_t pubkey33[33]; + decode_hex(pubkey33,33,(char *)NOTARY_PUBKEY.c_str()); + pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); + NOTARY_ADDRESS.clear(); + NOTARY_ADDRESS.assign(Raddress); return(StakedNotaryID(notaryname,Raddress)); } #else From f4f9c03cb4c957808cc77ebe7b25f8b7cb8e2378 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 20:51:20 +0800 Subject: [PATCH 0573/4463] fix? --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index bc691eb81..c30e41af5 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -832,7 +832,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; iGetBlockTime()) == 0)) { - printf("ERA 0 SKIP %s getblocktime: %d pindex->nTime : %d\n",pindex->GetBlockTime(),(uint32_t)pindex->nTime,ASSETCHAINS_SYMBOL); + printf("ERA 0 SKIP getblocktime: %ld pindex->nTime : %d for %s\n",pindex->GetBlockTime(),(uint32_t)pindex->nTime,ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); From 73a83354dcaf5ac7b0f7580cd2b01161377201a7 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 21:32:37 +0800 Subject: [PATCH 0574/4463] fast --- src/komodo.h | 4 ++-- src/notaries_staked.cpp | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index c30e41af5..ba69a2761 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -831,8 +831,8 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) txn_count = block.vtx.size(); for (i=0; iGetBlockTime()) == 0)) { - printf("ERA 0 SKIP getblocktime: %ld pindex->nTime : %d for %s\n",pindex->GetBlockTime(),(uint32_t)pindex->nTime,ASSETCHAINS_SYMBOL); + if ((is_STAKED(ASSETCHAINS_SYMBOL) != 0) && (STAKED_era((uint32_t)pindex->nTime) == 0)) { + //printf("ERA 0 SKIP getblocktime: %ld pindex->nTime : %d for %s\n",pindex->GetBlockTime(),(uint32_t)pindex->nTime,ASSETCHAINS_SYMBOL); continue; } txhash = block.vtx[i].GetHash(); diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index a3d37690e..cc3869835 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -227,9 +227,6 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #endif } didstaked1 = 1; - didstaked2 = 0; - didstaked3 = 0; - didstaked4 = 0; printf("%s is a STAKED chain in era 1 \n",ChainName); } @@ -249,8 +246,6 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #endif } didstaked2 = 1; - didstaked3 = 0; - didstaked4 = 0; printf("%s is a STAKED chain in era 2 \n",ChainName); } memcpy(pubkeys,staked_pubkeys2,num_notaries_STAKED2 * 33); @@ -269,7 +264,6 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { #endif } didstaked3 = 1; - didstaked4 = 0; printf("%s is a STAKED chain in era 3 \n",ChainName); } memcpy(pubkeys,staked_pubkeys3,num_notaries_STAKED3 * 33); From 6556f635f0bda6b35fe2380cad61f00a9fdddfea Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 23:35:28 +0800 Subject: [PATCH 0575/4463] Add maximum priority for notarisations. --- src/komodo_globals.h | 2 +- src/miner.cpp | 24 ++++++++++++++++++++++-- src/notaries_staked.cpp | 2 +- src/wallet/wallet.cpp | 4 ++-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 05af4edd8..9dfcf0546 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -45,7 +45,7 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; -int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; +int32_t KOMODO_INSYNC,KOMODO_LASTMINED,KOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,NUM_NOTARIES; diff --git a/src/miner.cpp b/src/miner.cpp index 6c25a5007..5aef46148 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -108,11 +108,11 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED; -extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; +extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],NOTARYADDRS[64][36]; extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY; void vcalc_sha256(char deprecated[(256 >> 3) * 2 + 1],uint8_t hash[256 >> 3],uint8_t *src,int32_t len); -extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33]; +extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],NUM_NOTARIES; uint32_t Mining_start,Mining_height; int32_t My_notaryid = -1; int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); @@ -206,12 +206,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) double dPriority = 0; CAmount nTotalIn = 0; bool fMissingInputs = false; + bool fNotarisation = false; if (tx.IsCoinImport()) { CAmount nValueIn = GetCoinImportValue(tx); nTotalIn += nValueIn; dPriority += (double)nValueIn * 1000; // flat multiplier } else { + int numNotaryVins = 0; BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Read prev transaction @@ -250,8 +252,23 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) int nConf = nHeight - coins->nHeight; + if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 ) + { + uint256 hash; CTransaction tx1; CTxDestination address; + if (GetTransaction(txin.prevout.hash,tx1,hash,false)) + { + if (ExtractDestination(tx1.vout[txin.prevout.n].scriptPubKey, address)) { + for (int i = 0; i < NUM_NOTARIES; i++) { + if ( strcmp(NOTARYADDRS[i],CBitcoinAddress(address).ToString().c_str()) == 0 ) + numNotaryVins++; + } + } + } + } dPriority += (double)nValueIn * nConf; } + if ( numNotaryVins > NUM_NOTARIES / 5 ) + fNotarisation = true; nTotalIn += tx.GetJoinSplitValueIn(); } @@ -266,6 +283,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize); + if (fNotarisation) + dPriority = 1e16; + if (porphan) { porphan->dPriority = dPriority; diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index cc3869835..b528df512 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -305,7 +305,7 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname) { for (size_t i = 0; i < num_notaries; i++) { - fprintf(stderr, "address [%ld]: %s\n",i,NOTARYADDRS[i]); + //fprintf(stderr, "address [%ld]: %s\n",i,NOTARYADDRS[i]); if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { notaryname.assign(notaries_chosen[i][0]); //printf("notary number: %ld\n",i ); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a340ecfae..0133d6895 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1214,7 +1214,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if (fExisted || IsMine(tx) || IsFromMe(tx) || noteData.size() > 0) { - if ( !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) + if ( !tx.IsCoinBase() && !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) { int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { @@ -1240,7 +1240,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { // this should be a received tx.. numvoutIsOurs++; - totalvoutvalue = totalvoutvalue + tx.vout[i].nValue; + totalvoutvalue += tx.vout[i].nValue; } } } From ab27a044a00ea68f5ca67bcba23278203f62f5bc Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 5 Nov 2018 23:37:40 +0800 Subject: [PATCH 0576/4463] oops --- src/komodo_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 9dfcf0546..05af4edd8 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -45,7 +45,7 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; -int32_t KOMODO_INSYNC,KOMODO_LASTMINED,KOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; +int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,NUM_NOTARIES; From 68ae8e0468c1f020a082a62db8ba53ecfb2f79ed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 6 Nov 2018 16:26:08 +0800 Subject: [PATCH 0577/4463] move initalise notaryaddrs to connect block to stop it being called out of order --- src/komodo.h | 29 +++++++++++-- src/notaries_staked.cpp | 96 +++++++++++++++-------------------------- src/notaries_staked.h | 1 + 3 files changed, 61 insertions(+), 65 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index ba69a2761..d27981250 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -797,6 +797,8 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; + int8_t StakedEra; static int8_t lastStakedEra; + uint64_t signedmask,voutmask; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; uint8_t scriptbuf[10001],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 zero,btctxid,txhash; int32_t i,j,k,numnotaries,notarized,scriptlen,isratification,nid,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count; @@ -809,6 +811,27 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) return; } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 || IS_STAKED_NOTARY != -1 ) { + staked_era = STAKED_era(pindex->GetBlockTime()); + if ( staked_era != lastStakedEra ) { + uint8_t tmp_pubkeys[64][33]; + int8_t numSN = numStakedNotaries(tmp_pubkeys,staked_era); + UpdateNotaryAddrs(tmp_pubkeys,numSN); + STAKED_ERA = staked_era; + if ( NOTARYADDRS[0][0] != 0 ) + { + if ( NOTARY_PUBKEY33[0] != 0 ) + { + if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) + { + IS_KOMODO_NOTARY = 0; + fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era); + } + } + } + } + lastStakedEra = staked_era; + } numnotaries = komodo_notaries(pubkeys,pindex->nHeight,pindex->GetBlockTime()); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) @@ -831,9 +854,9 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) txn_count = block.vtx.size(); for (i=0; inTime) == 0)) { - //printf("ERA 0 SKIP getblocktime: %ld pindex->nTime : %d for %s\n",pindex->GetBlockTime(),(uint32_t)pindex->nTime,ASSETCHAINS_SYMBOL); - continue; + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 && staked_era == 0 ) { + // in era gap no point checking any invlaid notarisations. + break; } txhash = block.vtx[i].GetHash(); numvouts = block.vtx[i].vout.size(); diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index b528df512..ec0f2054e 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -121,12 +121,6 @@ int is_STAKED(const char *chain_name) { int STAKED_era(int timestamp) { int8_t era = 0; - static uint32_t lasttimestamp; - static int didera; - // test this, seems to sometimes get called into the past? - if ( timestamp < lasttimestamp ) - timestamp = lasttimestamp; - if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) era = 1; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) @@ -135,28 +129,9 @@ int STAKED_era(int timestamp) era = 3; else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) era = 4; - else { - era = 0; didera = 0; - } + else + era = 0; // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - - if ( era > STAKED_ERA || didera == 0 ) - { - STAKED_ERA = era; - if ( NOTARYADDRS[0][0] != 0 ) - { - if ( NOTARY_PUBKEY33[0] != 0 ) - { - if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) - { - IS_KOMODO_NOTARY = 0; - fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era); - } - } - didera++; - } - } - lasttimestamp = timestamp; return(era); }; @@ -205,7 +180,6 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { if ( ChainName[0] == 0 ) { - pthread_mutex_init(&staked_mutex,NULL); if ( ASSETCHAINS_SYMBOL[0] == 0 ) strcpy(ChainName,"KMD"); else @@ -215,35 +189,22 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { if ( era != 0 ) { switch (era) { case 1: - if ( didstaked1 == 0 || NOTARYADDRS[0][0] == 0 ) + if ( didstaked1 == 0 ) { for (i=0; i Date: Tue, 6 Nov 2018 16:30:35 +0800 Subject: [PATCH 0578/4463] fix --- src/notaries_staked.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index ec0f2054e..f061810ab 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -268,8 +268,10 @@ void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) { // staked era is set. #ifdef SERVER pthread_mutex_lock(&staked_mutex); - pubkey2addr((char *)NOTARYADDRS[i],(uint8_t *)pubkeys[i]); - NUM_NOTARIES = numNotaries; + for (int i = 0; i Date: Tue, 6 Nov 2018 16:31:51 +0800 Subject: [PATCH 0579/4463] typo --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index d27981250..515185ef3 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -797,7 +797,7 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; - int8_t StakedEra; static int8_t lastStakedEra; + int8_t staked_era; static int8_t lastStakedEra; uint64_t signedmask,voutmask; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; uint8_t scriptbuf[10001],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 zero,btctxid,txhash; @@ -855,7 +855,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) for (i=0; i Date: Tue, 6 Nov 2018 16:32:46 +0800 Subject: [PATCH 0580/4463] another --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 515185ef3..2a4a1252a 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -825,7 +825,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; - fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),era); + fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),staked_era); } } } From 120b7c3b02224d96b5653c44884f99abf3557e5e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 6 Nov 2018 16:43:41 +0800 Subject: [PATCH 0581/4463] test new era logic --- src/komodo.h | 11 ++++------- src/notaries_staked.h | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 2a4a1252a..e8dab9c77 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -818,15 +818,12 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) int8_t numSN = numStakedNotaries(tmp_pubkeys,staked_era); UpdateNotaryAddrs(tmp_pubkeys,numSN); STAKED_ERA = staked_era; - if ( NOTARYADDRS[0][0] != 0 ) + if ( NOTARYADDRS[0][0] != 0 && NOTARY_PUBKEY33[0] != 0 ) { - if ( NOTARY_PUBKEY33[0] != 0 ) + if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { - if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) - { - IS_KOMODO_NOTARY = 0; - fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),staked_era); - } + IS_KOMODO_NOTARY = 0; + fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),staked_era); } } } diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 5a63861d7..0e590e19b 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -5,11 +5,11 @@ #include "crosschain.h" #include "cc/CCinclude.h" -static const int STAKED_ERA_GAP = 777; +static const int STAKED_ERA_GAP = 300; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541422105; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541423282; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541424459; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541494052; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541494052; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541494052; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From b09c8e9f4701385e0b162d7cd3dc70cbc3f4e95f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 6 Nov 2018 17:12:48 +0800 Subject: [PATCH 0582/4463] add STAKED_ERA to getinfo .. clean code up --- src/rpcmisc.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 9a578e1a5..af4eb0ee2 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -51,7 +51,7 @@ int32_t komodo_notarized_height(int32_t *prevhtp,uint256 *hashp,uint256 *txidp); uint32_t komodo_chainactive_timestamp(); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; -extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; +extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY,STAKED_ERA; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t komodo_segid32(char *coinaddr); int64_t komodo_coinsupply(int64_t *zfundsp,int32_t height); @@ -62,12 +62,11 @@ extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint32_t ASSETCHAINS_CC; extern uint32_t ASSETCHAINS_MAGIC; extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY; -extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[]; +extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[]; UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; - extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[]; if (fHelp || params.size() != 0) throw runtime_error( "getinfo\n" @@ -171,6 +170,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)); if ( ASSETCHAINS_SYMBOL[0] != 0 ) { + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) + obj.push_back(Pair("StakedEra", STAKED_ERA)); //obj.push_back(Pair("name", ASSETCHAINS_SYMBOL)); obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT)); obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT)); From 75479b3253a02dd1237b72527aa197d7a4168d19 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 6 Nov 2018 17:26:54 +0800 Subject: [PATCH 0583/4463] test eras again --- src/notaries_staked.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 0e590e19b..2f368b163 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -5,11 +5,11 @@ #include "crosschain.h" #include "cc/CCinclude.h" -static const int STAKED_ERA_GAP = 300; +static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541494052; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541494052; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541494052; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541496946; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541497546; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541498546; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 0a7c652d842f57c30e8c0dc060144643d95a563a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 6 Nov 2018 17:47:38 +0800 Subject: [PATCH 0584/4463] fix --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 2f368b163..caee446e7 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541496946; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541497546; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541498546; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1541498901; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1541500201; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1541501501; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 863e164e998971eb706554ecfcf37a0c4c51d026 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 13:11:03 +0800 Subject: [PATCH 0585/4463] final version? --- src/komodo_notary.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index ff7bc5cc3..1d43e2770 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -205,17 +205,11 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - - if ( timestamp == 0 ) - timestamp = komodo_heightstamp(height); - if ( ASSETCHAINS_SYMBOL[0] == 0 ) { - // Here we run the staked notaries function to populate the Notary Address's global var on KMD. - if ( IS_STAKED_NOTARY != -1 ) { - uint8_t tmp_pubkeys[64][33]; - numStakedNotaries(tmp_pubkeys,STAKED_era(timestamp)); - } - timestamp = 0; - } + + if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + timestamp = komodo_heightstamp(height); + else if ( ASSETCHAINS_SYMBOL[0] == 0 ) + timestamp = 0; // If this chain is not a staked chain, use the normal Komodo logic to determine notaries. This allows KMD to still sync and use its proper pubkeys for dPoW. if (is_STAKED(ASSETCHAINS_SYMBOL) == 0) From 0920b59572b35cc55b82e7d324c4c07286da37b6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 17:27:57 +0800 Subject: [PATCH 0586/4463] add min recv size and whitelist address --- src/komodo.h | 6 +++-- src/komodo_globals.h | 4 ++-- src/komodo_notary.h | 2 +- src/komodo_utils.h | 2 ++ src/notaries_staked.cpp | 6 ++--- src/notaries_staked.h | 6 ++--- src/notarisationdb.cpp | 2 +- src/wallet/wallet.cpp | 50 +++++++++++++++++++++++++---------------- 8 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e8dab9c77..48d25d776 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -797,7 +797,7 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; - int8_t staked_era; static int8_t lastStakedEra; + int32_t staked_era; static int32_t lastStakedEra; uint64_t signedmask,voutmask; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; uint8_t scriptbuf[10001],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 zero,btctxid,txhash; @@ -823,7 +823,9 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) if ( (IS_STAKED_NOTARY= updateStakedNotary()) > -1 ) { IS_KOMODO_NOTARY = 0; - fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d\n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),staked_era); + if ( MIN_RECV_SATS == -1 ) + MIN_RECV_SATS = 100000000; + fprintf(stderr, "Staked Notary Protection Active! NotaryID.%d RADD.%s ERA.%d MIN_TX_VALUE.%lu \n",IS_STAKED_NOTARY,NOTARY_ADDRESS.c_str(),staked_era,MIN_RECV_SATS); } } } diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 05af4edd8..d415cc847 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -46,7 +46,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; -std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY; +std::string ASSETCHAINS_OVERRIDE_ADDRESS,NOTARY_ADDRESS,NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,WHITELIST_ADDRESS; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,NUM_NOTARIES; char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096],NOTARYADDRS[64][36]; @@ -54,7 +54,7 @@ uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT,KOMODO_DPOWCONFS = 1; uint32_t ASSETCHAINS_MAGIC = 2387029918; uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; -uint64_t ASSETCHAINS_FOUNDERS_REWARD,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY = 10; +uint64_t ASSETCHAINS_FOUNDERS_REWARD,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY = 10,MIN_RECV_SATS; uint32_t KOMODO_INITDONE; char KMDUSERPASS[8192],BTCUSERPASS[8192]; uint16_t KMD_PORT = 7771,BITCOIND_RPCPORT = 7771; diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 1d43e2770..96497b755 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -252,7 +252,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam { // here we can activate our pubkeys for STAKED chains everythig is in notaries_staked.cpp if (timestamp != 0) { - int staked_era; int32_t numSN; + int32_t staked_era; int8_t numSN; uint8_t staked_pubkeys[64][33]; staked_era = STAKED_era(timestamp); numSN = numStakedNotaries(staked_pubkeys,staked_era); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 546fa8a13..eeacf90d0 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1511,6 +1511,8 @@ void komodo_args(char *argv0) fprintf(stderr, "Cannot be STAKED and KMD notary at the same time!\n"); exit(0); } + MIN_RECV_SATS = GetArg("-mintxvalue",-1); + WHITELIST_ADDRESS = GetArg("-whitelist",""); if ( GetBoolArg("-gen", false) != 0 ) KOMODO_MININGTHREADS = GetArg("-genproclimit",1); else KOMODO_MININGTHREADS = -1; diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index f061810ab..e4e1c8ddb 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -106,7 +106,7 @@ const char *notaries_STAKED4[][2] = int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4)); -int is_STAKED(const char *chain_name) { +int8_t is_STAKED(const char *chain_name) { int STAKED = 0; if ( (strcmp(chain_name, "STAKED") == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) STAKED = 1; @@ -118,7 +118,7 @@ int is_STAKED(const char *chain_name) { return(STAKED); }; -int STAKED_era(int timestamp) +int32_t STAKED_era(int timestamp) { int8_t era = 0; if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) @@ -289,7 +289,7 @@ int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *R return(-1); } -CrosschainAuthority Choose_auth_STAKED(int chosen_era) { +CrosschainAuthority Choose_auth_STAKED(int32_t chosen_era) { CrosschainAuthority auth; switch (chosen_era) { case 1: diff --git a/src/notaries_staked.h b/src/notaries_staked.h index caee446e7..ae16e316d 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -24,15 +24,15 @@ extern int num_notaries_STAKED3; extern const char *notaries_STAKED4[][2]; extern int num_notaries_STAKED4; -int is_STAKED(const char *chain_name); -int STAKED_era(int timestamp); +int8_t is_STAKED(const char *chain_name); +int32_t STAKED_era(int timestamp); int8_t updateStakedNotary(); int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era); int8_t StakedNotaryID(std::string ¬aryname, char *Raddress); void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries); int8_t ScanStakedArray(const char *notaries_chosen[][2],int num_notaries,char *Raddress,std::string ¬aryname); -CrosschainAuthority Choose_auth_STAKED(int chosen_era); +CrosschainAuthority Choose_auth_STAKED(int32_t chosen_era); CrosschainAuthority auth_STAKED_chosen(const char *notaries_chosen[][2],int num_notaries); #endif diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 68c00546b..f551edf3f 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -40,7 +40,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) //printf("Authorised notarisation data for %s \n",data.symbol); } else if (authority == CROSSCHAIN_STAKED) { // We need to create auth_STAKED dynamically here based on timestamp - int staked_era = STAKED_era(timestamp); + int32_t staked_era = STAKED_era(timestamp); printf("ERA.(%d) \n",staked_era); if (staked_era == 0) { // this is an ERA GAP, so we will ignore this notarization diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0133d6895..30d2ad461 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1201,8 +1201,9 @@ bool CWallet::UpdatedNoteData(const CWalletTx& wtxIn, CWalletTx& wtx) * If fUpdate is true, existing transactions will be updated. */ extern uint8_t NOTARY_PUBKEY33[33]; -extern std::string NOTARY_ADDRESS; +extern std::string NOTARY_ADDRESS,WHITELIST_ADDRESS; extern int32_t IS_STAKED_NOTARY; +extern uint64_t MIN_RECV_SATS; bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate) { @@ -1216,34 +1217,49 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if ( !tx.IsCoinBase() && !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) { - int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; - for (size_t i = 0; i < tx.vin.size(); i++) { + int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; bool whitelisted = false; + for (size_t i = 0; i < tx.vin.size(); i++) + { uint256 hash; CTransaction txin; CTxDestination address; if (GetTransaction(tx.vin[i].prevout.hash,txin,hash,false)) { - if (ExtractDestination(txin.vout[tx.vin[i].prevout.n].scriptPubKey, address)) { - // This means we sent the tx.. - if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) { + if (ExtractDestination(txin.vout[tx.vin[i].prevout.n].scriptPubKey, address)) + { + if ( CBitcoinAddress(address).ToString() == NOTARY_ADDRESS ) numvinIsOurs++; + if ( !WHITELIST_ADDRESS.empty() ) + { + if ( CBitcoinAddress(address).ToString() == WHITELIST_ADDRESS ) + whitelisted == true; } - } + } } } - // Now we know if it was a tx sent to us, that wasnt from ourself. + // Now we know if it was a tx sent to us, that wasnt from ourself or the whitelist address if set.. if ( numvinIsOurs != 0 ) fprintf(stderr, "We sent from address: %s vins: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs); + if ( whitelisted == true ) + fprintf(stderr, "We received from whitelisted address: %s\n",WHITELIST_ADDRESS.c_str()); // Count vouts, check if OUR notary address is the receiver. - if ( numvinIsOurs == 0 ) { - for (size_t i = 0; i < tx.vout.size() ; i++) { + if ( numvinIsOurs == 0 && whitelisted == false ) + { + for (size_t i = 0; i < tx.vout.size() ; i++) + { CTxDestination address2; - if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) { - if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) { - // this should be a received tx.. + if ( ExtractDestination(tx.vout[i].scriptPubKey, address2)) + { + if ( CBitcoinAddress(address2).ToString() == NOTARY_ADDRESS ) + { numvoutIsOurs++; totalvoutvalue += tx.vout[i].nValue; } } } + // if MIN_RECV_SATS is 0, we are on full lock down mode, accept NO transactions. + if ( MIN_RECV_SATS == 0 ) { + fprintf(stderr, "This node is on full lock down all txs are ignored! \n"); + return false; + } // If no vouts are to the notary address we will ignore them. if ( numvoutIsOurs == 0 ) { fprintf(stderr, "Received transaction to address other than notary address, ignored! \n"); @@ -1252,15 +1268,11 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl fprintf(stderr, "address: %s received %ld sats from %d vouts.\n",NOTARY_ADDRESS.c_str(),totalvoutvalue,numvoutIsOurs); // here we add calculation for number if vouts received, average size and determine if we accept them to wallet or not. int64_t avgVoutSize = totalvoutvalue / numvoutIsOurs; - if ( avgVoutSize < 100000000 ) { - // average vout size is less than 1 coin, we will ignore it + if ( avgVoutSize < MIN_RECV_SATS ) { + // average vout size is less than set minimum, default is 1 coin, we will ignore it fprintf(stderr, "ignored: %d vouts average size of %ld sats.\n",numvoutIsOurs, avgVoutSize); return false; } - } else if ( numvinIsOurs < tx.vin.size() ) { - // this means we were in a multi sig, ideally we would remove the utxo we spent from our wallet, but you cant do that, unless all the tx's vouts are also spent. - // RPC call PurgeWalletSpents will be created to clean all fully spent tx's instead. - fprintf(stderr, "There are vins that are not ours, notarisation?\n"); } } From 8d0278b46db7f216a5d6aabfaddd674e435ac3cf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 17:47:39 +0800 Subject: [PATCH 0587/4463] whitelist arg already used! --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index eeacf90d0..d5ac096f5 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1512,7 +1512,7 @@ void komodo_args(char *argv0) exit(0); } MIN_RECV_SATS = GetArg("-mintxvalue",-1); - WHITELIST_ADDRESS = GetArg("-whitelist",""); + WHITELIST_ADDRESS = GetArg("-whitelistaddress",""); if ( GetBoolArg("-gen", false) != 0 ) KOMODO_MININGTHREADS = GetArg("-genproclimit",1); else KOMODO_MININGTHREADS = -1; From be7ce20da40268d11c1edd1931ebb4a79db2e3b6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 17:54:59 +0800 Subject: [PATCH 0588/4463] tets --- src/wallet/wallet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 30d2ad461..089f82372 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1229,6 +1229,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl numvinIsOurs++; if ( !WHITELIST_ADDRESS.empty() ) { + fprintf(stderr, "white list address: %s recv address: %s\n", WHITELIST_ADDRESS.c_str(),CBitcoinAddress(address).ToString()); if ( CBitcoinAddress(address).ToString() == WHITELIST_ADDRESS ) whitelisted == true; } From d92a50e5705a7a8079487a7b3f020d6af442913a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 17:56:17 +0800 Subject: [PATCH 0589/4463] fix --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 089f82372..c64e9940f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1229,7 +1229,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl numvinIsOurs++; if ( !WHITELIST_ADDRESS.empty() ) { - fprintf(stderr, "white list address: %s recv address: %s\n", WHITELIST_ADDRESS.c_str(),CBitcoinAddress(address).ToString()); + fprintf(stderr, "white list address: %s recv address: %s\n", WHITELIST_ADDRESS.c_str(),CBitcoinAddress(address).ToString().c_str()); if ( CBitcoinAddress(address).ToString() == WHITELIST_ADDRESS ) whitelisted == true; } From 6af23bd81d8497da5d27b8c0b45d1c4675aa83be Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 18:01:28 +0800 Subject: [PATCH 0590/4463] debug more --- src/wallet/wallet.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c64e9940f..fbdac9540 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1217,7 +1217,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if ( !tx.IsCoinBase() && !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) { - int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; bool whitelisted = false; + int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; bool whitelisted; for (size_t i = 0; i < tx.vin.size(); i++) { uint256 hash; CTransaction txin; CTxDestination address; @@ -1230,8 +1230,14 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl if ( !WHITELIST_ADDRESS.empty() ) { fprintf(stderr, "white list address: %s recv address: %s\n", WHITELIST_ADDRESS.c_str(),CBitcoinAddress(address).ToString().c_str()); - if ( CBitcoinAddress(address).ToString() == WHITELIST_ADDRESS ) + if ( CBitcoinAddress(address).ToString() == WHITELIST_ADDRESS ) { + fprintf(stderr, "whitlisted is set to true here.\n"); whitelisted == true; + } + } + else { + whitelisted == false; + fprintf(stderr, "whitlisted is set to false here.\n"); } } } From 0be25e9aca6e1b77ccd2a936bf436522acabf031 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 7 Nov 2018 18:06:58 +0800 Subject: [PATCH 0591/4463] try this instead? --- src/wallet/wallet.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index fbdac9540..ea47c39c1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1217,7 +1217,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { if ( !tx.IsCoinBase() && !NOTARY_ADDRESS.empty() && IS_STAKED_NOTARY > -1 ) { - int numvinIsOurs = 0, numvoutIsOurs = 0; int64_t totalvoutvalue = 0; bool whitelisted; + int numvinIsOurs = 0, numvoutIsOurs = 0, numvinIsWhiteList = 0; int64_t totalvoutvalue = 0; for (size_t i = 0; i < tx.vin.size(); i++) { uint256 hash; CTransaction txin; CTxDestination address; @@ -1232,23 +1232,19 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl fprintf(stderr, "white list address: %s recv address: %s\n", WHITELIST_ADDRESS.c_str(),CBitcoinAddress(address).ToString().c_str()); if ( CBitcoinAddress(address).ToString() == WHITELIST_ADDRESS ) { fprintf(stderr, "whitlisted is set to true here.\n"); - whitelisted == true; + numvinIsWhiteList++; } } - else { - whitelisted == false; - fprintf(stderr, "whitlisted is set to false here.\n"); - } } } } // Now we know if it was a tx sent to us, that wasnt from ourself or the whitelist address if set.. if ( numvinIsOurs != 0 ) fprintf(stderr, "We sent from address: %s vins: %d\n",NOTARY_ADDRESS.c_str(),numvinIsOurs); - if ( whitelisted == true ) + if ( numvinIsWhiteList != 0 ) fprintf(stderr, "We received from whitelisted address: %s\n",WHITELIST_ADDRESS.c_str()); // Count vouts, check if OUR notary address is the receiver. - if ( numvinIsOurs == 0 && whitelisted == false ) + if ( numvinIsOurs == 0 && numvinIsWhiteList == 0 ) { for (size_t i = 0; i < tx.vout.size() ; i++) { From d07da88136c7a2aab60dd01edcbb4806c938f813 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 9 Nov 2018 14:14:02 +0800 Subject: [PATCH 0592/4463] add cleanwalletnotarisations RPC call for testing --- src/rpcserver.cpp | 25 ++++---- src/rpcserver.h | 1 + src/wallet/rpcwallet.cpp | 133 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 145 insertions(+), 14 deletions(-) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 8934ae717..32c3ba5db 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -350,16 +350,16 @@ static const CRPCCommand vRPCCommands[] = #endif /* auction */ { "auction", "auctionaddress", &auctionaddress, true }, - + /* lotto */ { "lotto", "lottoaddress", &lottoaddress, true }, - + /* fsm */ { "FSM", "FSMaddress", &FSMaddress, true }, { "FSM", "FSMcreate", &FSMcreate, true }, { "FSM", "FSMlist", &FSMlist, true }, { "FSM", "FSMinfo", &FSMinfo, true }, - + /* rewards */ { "rewards", "rewardslist", &rewardslist, true }, { "rewards", "rewardsinfo", &rewardsinfo, true }, @@ -368,16 +368,16 @@ static const CRPCCommand vRPCCommands[] = { "rewards", "rewardslock", &rewardslock, true }, { "rewards", "rewardsunlock", &rewardsunlock, true }, { "rewards", "rewardsaddress", &rewardsaddress, true }, - + /* faucet */ { "faucet", "faucetinfo", &faucetinfo, true }, { "faucet", "faucetfund", &faucetfund, true }, { "faucet", "faucetget", &faucetget, true }, { "faucet", "faucetaddress", &faucetaddress, true }, - + /* MofN */ { "MofN", "mofnaddress", &mofnaddress, true }, - + /* Channels */ { "channels", "channelsaddress", &channelsaddress, true }, { "channels", "channelsinfo", &channelsinfo, true }, @@ -386,7 +386,7 @@ static const CRPCCommand vRPCCommands[] = { "channels", "channelscollect", &channelscollect, true }, { "channels", "channelsstop", &channelsstop, true }, { "channels", "channelsrefund", &channelsrefund, true }, - + /* Oracles */ { "oracles", "oraclesaddress", &oraclesaddress, true }, { "oracles", "oracleslist", &oracleslist, true }, @@ -396,7 +396,7 @@ static const CRPCCommand vRPCCommands[] = { "oracles", "oraclessubscribe", &oraclessubscribe, true }, { "oracles", "oraclesdata", &oraclesdata, true }, { "oracles", "oraclessamples", &oraclessamples, true }, - + /* Prices */ { "prices", "pricesaddress", &pricesaddress, true }, { "prices", "priceslist", &priceslist, true }, @@ -406,16 +406,16 @@ static const CRPCCommand vRPCCommands[] = { "prices", "pricesbet", &pricesbet, true }, { "prices", "pricesstatus", &pricesstatus, true }, { "prices", "pricesfinish", &pricesfinish, true }, - + /* Pegs */ { "pegs", "pegsaddress", &pegsaddress, true }, - + /* Triggers */ { "triggers", "triggersaddress", &triggersaddress, true }, - + /* Payments */ { "payments", "paymentsaddress", &paymentsaddress, true }, - + /* Gateways */ { "gateways", "gatewaysaddress", &gatewaysaddress, true }, { "gateways", "gatewayslist", &gatewayslist, true }, @@ -494,6 +494,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "getaccountaddress", &getaccountaddress, true }, { "wallet", "getaccount", &getaccount, true }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true }, + { "wallet", "cleanwalletnotarisations", &cleanwalletnotarisations, false }, { "wallet", "getbalance", &getbalance, false }, { "wallet", "getbalance64", &getbalance64, false }, { "wallet", "getnewaddress", &getnewaddress, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index f4c502d63..4a1370465 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -301,6 +301,7 @@ extern UniValue signmessage(const UniValue& params, bool fHelp); extern UniValue verifymessage(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp); +extern UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp); extern UniValue getbalance(const UniValue& params, bool fHelp); extern UniValue getbalance64(const UniValue& params, bool fHelp); extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 055352973..d5ec198e8 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -398,7 +398,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr // Parse Zcash address CScript scriptPubKey = GetScriptForDestination(address); - + // Create and send the transaction CReserveKey reservekey(pwalletMain); CAmount nFeeRequired; @@ -995,6 +995,135 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef return GetAccountBalance(walletdb, strAccount, nMinDepth, filter); } +UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) +{ + if (!EnsureWalletIsAvailable(fHelp)) + return NullUniValue; + + if (fHelp || params.size() > 1 ) + throw runtime_error( + "cleanwalletnotarisations \"txid\"\n" + "\nRemove all txs which are totally spent and all notarisations created from them, you can clear all txs bar one, by specifiying a txid.\n" + "\nPlease backup your wallet.dat before running this command.\n" + "\nArguments:\n" + "1. \"txid\" (string, optional) The transaction id to keep.\n" + "\nResult:\n" + "{\n" + " \"total_transactons\" : n, (numeric) Transactions in wallet of " + strprintf("%s",komodo_chainname()) + "\n" + " \"remaining_transactons\" : n, (numeric) Transactions in wallet after clean.\n" + " \"removed_transactons\" : n, (numeric) The number of transactions removed.\n" + "}\n" + "\nExamples:\n" + + HelpExampleCli("cleanoldtxs", "") + + HelpExampleCli("cleanoldtxs","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + + HelpExampleRpc("cleanoldtxs", "") + + HelpExampleRpc("cleanoldtxs","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + ); + + LOCK2(cs_main, pwalletMain->cs_wallet); + UniValue ret(UniValue::VOBJ); + uint256 exception; int32_t txs = 0; + std::vector TxToRemove; + if (params.size() == 1) + { + exception.SetHex(params[0].get_str()); + uint256 tmp_hash; CTransaction tmp_tx; + if (GetTransaction(exception,tmp_tx,tmp_hash,false)) + { + if ( !pwalletMain->IsMine(tmp_tx) ) + { + throw runtime_error("\nThe transaction is not yours!\n"); + } + else + { + for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) + { + txs++; + const CWalletTx& wtx = (*it).second; + if ( wtx.GetHash() != exception ) + { + TxToRemove.push_back(wtx.GetHash()); + } + } + } + } + else + { + throw runtime_error("\nThe transaction could not be found!\n"); + } + } + else + { + std::vector NotarisationTxs; + for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) + { + const CWalletTx& wtx = (*it).second; + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 50 ) + continue; + + CCoins coins; + if (!pcoinsTip->GetCoins(wtx.GetHash(), coins)) + { + int spents = 0; int mine = 0; + for (unsigned int n = 0; n < wtx.vout.size() ; n++) + { + if ( pwalletMain->IsMine(wtx.vout[n]) ) + mine++; + if ( ((unsigned int)n >= coins.vout.size() || coins.vout[n].IsNull() ) ) + spents++; + } + if ( spents == mine ) + { + TxToRemove.push_back(wtx.GetHash()); + for (unsigned int n = 0; n < wtx.vin.size() ; n++) + { + if ( pwalletMain->IsMine(wtx.vin[n]) ) + TxToRemove.push_back(wtx.vin[n].prevout.hash); + } + } + } + + CTxDestination address; + // get all notarisations + if ( ExtractDestination(wtx.vout[0].scriptPubKey, address) ) + { + if ( strcmp(CBitcoinAddress(address).ToString().c_str(),CRYPTO777_KMDADDR) == 0 ) + NotarisationTxs.push_back(wtx); + } + txs++; + } + + // Erase notarisations spending from fully spent splits. + BOOST_FOREACH (CWalletTx& tx, NotarisationTxs) + { + for (int n = 0; n < tx.vin.size(); n++) + { + BOOST_FOREACH (uint256& SpentHash, TxToRemove) + { + if ( SpentHash == tx.vin[n].prevout.hash ) + { + pwalletMain->EraseFromWallet(tx.GetHash()); + //fprintf(stderr, "ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); + } + } + } + } + } + + // erase txs + BOOST_FOREACH (uint256& hash, TxToRemove) + { + pwalletMain->EraseFromWallet(hash); + //fprintf(stderr, "ERASED spent Tx: %s\n",hash.ToString().c_str()); + } + + // build return JSON for stats. + int remaining = pwalletMain->mapWallet.size(); + ret.push_back(Pair("total_transactons", (int)txs)); + ret.push_back(Pair("remaining_transactons", (int)remaining)); + ret.push_back(Pair("removed_transactions", (int)(txs-remaining))); + return (ret); +} UniValue getbalance(const UniValue& params, bool fHelp) { @@ -5669,7 +5798,7 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp) UniValue oraclessamples(const UniValue& params, bool fHelp) { - UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num; + UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num; if ( fHelp || params.size() != 3 ) throw runtime_error("oraclessamples oracletxid batonutxo num\n"); if ( ensure_CCrequirements() < 0 ) From b5c356dddfd4e31c4a2a3a5ec7b76a63b84477af Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 9 Nov 2018 14:58:10 +0800 Subject: [PATCH 0593/4463] fix txs counter --- src/wallet/rpcwallet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d5ec198e8..8a62b2153 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1022,7 +1022,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) LOCK2(cs_main, pwalletMain->cs_wallet); UniValue ret(UniValue::VOBJ); - uint256 exception; int32_t txs = 0; + uint256 exception; int32_t txs = pwalletMain->mapWallet.size(); std::vector TxToRemove; if (params.size() == 1) { @@ -1090,7 +1090,6 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) if ( strcmp(CBitcoinAddress(address).ToString().c_str(),CRYPTO777_KMDADDR) == 0 ) NotarisationTxs.push_back(wtx); } - txs++; } // Erase notarisations spending from fully spent splits. From 3ce2f4ec500cf863d8132c6f2a19a8887251cd80 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 18:19:01 +0800 Subject: [PATCH 0594/4463] try ignore 0 sat coinbase --- src/wallet/wallet.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ea47c39c1..e86c54ae2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1209,6 +1209,11 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { { AssertLockHeld(cs_wallet); + if ( tx.IsCoinBase() && tx.vout[0].nValue == 0 ) + { + fprintf(stderr, "ZERO sat coinbase, ignored!\n"); + return false; + } bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); From bf554eb6cff6042787ead1ef9abdc4e601776cc2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 18:45:39 +0800 Subject: [PATCH 0595/4463] remove print ... 0 sat coinbase ignore is working --- src/wallet/wallet.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e86c54ae2..96ec88e6e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1210,10 +1210,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { AssertLockHeld(cs_wallet); if ( tx.IsCoinBase() && tx.vout[0].nValue == 0 ) - { - fprintf(stderr, "ZERO sat coinbase, ignored!\n"); return false; - } bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); From 9f4d613cf365801c0389b70945a3b42bb9e58d66 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 19:40:34 +0800 Subject: [PATCH 0596/4463] add Bar_F1sh_Rel .. move PoSPerc to debug.log add longest chain miner back --- src/miner.cpp | 12 ++++++------ src/notaries_staked.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 5aef46148..ce5021cde 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -979,20 +979,20 @@ void static BitcoinMiner() HASHTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); if ( ASSETCHAINS_STAKED < 100 ) { - for (z=31; z>=0; z--) - fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); - fprintf(stderr," PoW for staked coin PoS %d%% vs target %d%%\n",percPoS,(int32_t)ASSETCHAINS_STAKED); + //for (z=31; z>=0; z--) + // fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); + LogPrintf("Block %d : PoS %d%% vs target %d%% \n",Mining_height,percPoS,(int32_t)ASSETCHAINS_STAKED); } } while (true) { - /*if ( KOMODO_INSYNC == 0 && Mining_height > ASSETCHAINS_MINHEIGHT ) + if ( KOMODO_INSYNC == 0 && KOMODO_LONGESTCHAIN != 0 ) { fprintf(stderr,"Mining when blockchain might not be in sync longest.%d vs %d\n",KOMODO_LONGESTCHAIN,Mining_height); if ( KOMODO_LONGESTCHAIN != 0 && Mining_height >= KOMODO_LONGESTCHAIN ) KOMODO_INSYNC = 1; sleep(3); - } */ + } // Hash state KOMODO_CHOSEN_ONE = 0; crypto_generichash_blake2b_state state; @@ -1008,7 +1008,7 @@ void static BitcoinMiner() curr_state = state; crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); // (x_1, x_2, ...) = A(I, V, n, k) - LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); + LogPrintf("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); arith_uint256 hashTarget; if ( KOMODO_MININGTHREADS > 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 ) hashTarget = HASHTarget_POW; diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index e4e1c8ddb..bb2289a17 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -22,7 +22,7 @@ const char *notaries_STAKED1[][2] = {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 + {"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca From a573cd9e263c0f6bf4ea07fa837068779d74057d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 20:00:04 +0800 Subject: [PATCH 0597/4463] remove +1 sat for staked chains, needs ot be tested! --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c4fb3b6e9..590e3569f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3188,7 +3188,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin else fprintf(stderr,"checktoshis %.8f numvouts %d\n",dstr(checktoshis),(int32_t)block.vtx[0].vout.size()); } } - if ( block.vtx[0].GetValueOut() > blockReward+1 ) + + if ( ( block.vtx[0].GetValueOut() > blockReward+1 && is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) || ( block.vtx[0].GetValueOut() > blockReward ) ) { if ( ASSETCHAINS_SYMBOL[0] != 0 || pindex->nHeight >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward ) { From d10c7b83583314a4e8578aea222653835a1ddc91 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 10 Nov 2018 21:11:42 +0800 Subject: [PATCH 0598/4463] fix max money problem, maximum 1 million coins per export, minimum max money on fungible chains 1 milion. --- src/komodo_utils.h | 2 ++ src/rpccrosschain.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d5ac096f5..188e62603 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1636,6 +1636,8 @@ void komodo_args(char *argv0) MAX_MONEY = (ASSETCHAINS_SUPPLY+100) * SATOSHIDEN; else MAX_MONEY = (ASSETCHAINS_SUPPLY+100) * SATOSHIDEN + ASSETCHAINS_REWARD * (ASSETCHAINS_ENDSUBSIDY==0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY); MAX_MONEY += (MAX_MONEY * ASSETCHAINS_COMMISSION) / SATOSHIDEN; + if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN ) + MAX_MONEY = 1000000LL*COIN; //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) diff --git a/src/rpccrosschain.cpp b/src/rpccrosschain.cpp index 52df5efaf..26edb575a 100644 --- a/src/rpccrosschain.cpp +++ b/src/rpccrosschain.cpp @@ -175,6 +175,8 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp) CAmount burnAmount = AmountFromValue(params[2]); if (burnAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for export"); + if (burnAmount > 1000000LL*COIN) + throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for export, cannot export more than 1 million coins per export."); { CAmount needed = 0; for (int i=0; i Date: Sat, 10 Nov 2018 21:19:15 +0800 Subject: [PATCH 0599/4463] fix --- src/komodo_defs.h | 1 + src/komodo_utils.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 1efd187d9..ca9a05c37 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -9,6 +9,7 @@ #define IGUANA_MAXSCRIPTSIZE 10001 #define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" +#define KOMODO_FIRSTFUNGIBLEID 100 extern uint8_t ASSETCHAINS_TXPOW; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 188e62603..962af99aa 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1637,7 +1637,7 @@ void komodo_args(char *argv0) else MAX_MONEY = (ASSETCHAINS_SUPPLY+100) * SATOSHIDEN + ASSETCHAINS_REWARD * (ASSETCHAINS_ENDSUBSIDY==0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY); MAX_MONEY += (MAX_MONEY * ASSETCHAINS_COMMISSION) / SATOSHIDEN; if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN ) - MAX_MONEY = 1000000LL*COIN; + MAX_MONEY = 1000000LL*SATOSHIDEN; //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) From 973fa76710f704f5690a2f53e7a1c75f5985c5e4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 00:52:44 +0800 Subject: [PATCH 0600/4463] fix logprint, extra f ? --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index ce5021cde..c2b95178e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1008,7 +1008,7 @@ void static BitcoinMiner() curr_state = state; crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); // (x_1, x_2, ...) = A(I, V, n, k) - LogPrintf("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); + LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); arith_uint256 hashTarget; if ( KOMODO_MININGTHREADS > 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 ) hashTarget = HASHTarget_POW; From 1fe70b907a40043a5f8cf9f1b3e9927f75f4463f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 05:18:03 +0800 Subject: [PATCH 0601/4463] make coinbase normal tx --- src/rpcmining.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 0a2b56ca9..48c63aff1 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -673,8 +673,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) uint256 txHash = tx.GetHash(); setTxIndex[txHash] = i++; - if (tx.IsCoinBase() && !coinbasetxn) - continue; + //if (tx.IsCoinBase() && !coinbasetxn) + // continue; UniValue entry(UniValue::VOBJ); @@ -694,17 +694,17 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template])); entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template])); - if (tx.IsCoinBase()) { + //if (tx.IsCoinBase()) { // Show founders' reward if it is required //if (pblock->vtx[0].vout.size() > 1) { // Correct this if GetBlockTemplate changes the order // entry.push_back(Pair("foundersreward", (int64_t)tx.vout[1].nValue)); //} - CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); - entry.push_back(Pair("coinbasevalue", nReward)); - entry.push_back(Pair("required", true)); - txCoinbase = entry; - } else + // CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); + // entry.push_back(Pair("coinbasevalue", nReward)); + // entry.push_back(Pair("required", true)); + // txCoinbase = entry; + // } else transactions.push_back(entry); } @@ -726,13 +726,13 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) result.push_back(Pair("version", pblock->nVersion)); result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); - if (coinbasetxn) { - assert(txCoinbase.isObject()); - result.push_back(Pair("coinbasetxn", txCoinbase)); - } else { - result.push_back(Pair("coinbaseaux", aux)); - result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); - } + //if (coinbasetxn) { + // assert(txCoinbase.isObject()); + // result.push_back(Pair("coinbasetxn", txCoinbase)); + //} else { + // result.push_back(Pair("coinbaseaux", aux)); + // result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); + //} result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast))); if ( ASSETCHAINS_STAKED != 0 ) { From 921b6a7d52d570a839a706db7b4ba5f7b5179fee Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:04:36 +0800 Subject: [PATCH 0602/4463] add disablecb option to getblocktemplate --- src/rpcmining.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 48c63aff1..7d5b2ebdc 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -518,7 +518,6 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) #endif } - std::string strMode = "template"; UniValue lpval = NullUniValue; // TODO: Re-enable coinbasevalue once a specification has been written bool coinbasetxn = true; @@ -530,12 +529,15 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) strMode = modeval.get_str(); else if (modeval.isNull()) { - /* Do nothing */ + std::string strMode = "template"; } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); lpval = find_value(oparam, "longpollid"); + if (strMode == "disablecb") + coinbasetxn = false; + if (strMode == "proposal") { const UniValue& dataval = find_value(oparam, "data"); @@ -567,7 +569,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) } } - if (strMode != "template") + if (strMode != "template" || strMode != "disablecb") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) @@ -694,17 +696,17 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) entry.push_back(Pair("fee", pblocktemplate->vTxFees[index_in_template])); entry.push_back(Pair("sigops", pblocktemplate->vTxSigOps[index_in_template])); - //if (tx.IsCoinBase()) { + if (tx.IsCoinBase() && coinbasetxn == true ) { // Show founders' reward if it is required //if (pblock->vtx[0].vout.size() > 1) { // Correct this if GetBlockTemplate changes the order // entry.push_back(Pair("foundersreward", (int64_t)tx.vout[1].nValue)); //} - // CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); - // entry.push_back(Pair("coinbasevalue", nReward)); - // entry.push_back(Pair("required", true)); - // txCoinbase = entry; - // } else + CAmount nReward = GetBlockSubsidy(chainActive.LastTip()->nHeight+1, Params().GetConsensus()); + entry.push_back(Pair("coinbasevalue", nReward)); + entry.push_back(Pair("required", true)); + txCoinbase = entry; + } else transactions.push_back(entry); } @@ -726,12 +728,12 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) result.push_back(Pair("version", pblock->nVersion)); result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); - //if (coinbasetxn) { - // assert(txCoinbase.isObject()); - // result.push_back(Pair("coinbasetxn", txCoinbase)); - //} else { - // result.push_back(Pair("coinbaseaux", aux)); - // result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); + if (coinbasetxn) { + assert(txCoinbase.isObject()); + result.push_back(Pair("coinbasetxn", txCoinbase)); + } // else { + // result.push_back(Pair("coinbaseaux", aux)); + // result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); //} result.push_back(Pair("longpollid", chainActive.LastTip()->GetBlockHash().GetHex() + i64tostr(nTransactionsUpdatedLast))); if ( ASSETCHAINS_STAKED != 0 ) From 2205820299eefee6bdedbcb2188cd07e2bc51124 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:11:19 +0800 Subject: [PATCH 0603/4463] fix --- src/rpcmining.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 7d5b2ebdc..a3d7a5893 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -521,6 +521,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) UniValue lpval = NullUniValue; // TODO: Re-enable coinbasevalue once a specification has been written bool coinbasetxn = true; + std::string strMode; if (params.size() > 0) { const UniValue& oparam = params[0].get_obj(); @@ -529,7 +530,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) strMode = modeval.get_str(); else if (modeval.isNull()) { - std::string strMode = "template"; + strMode = "template"; } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); From 4129000ec324cf9bd23678307b4d176d12c52092 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:23:51 +0800 Subject: [PATCH 0604/4463] print --- src/rpcmining.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index a3d7a5893..944879120 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -528,6 +528,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) const UniValue& modeval = find_value(oparam, "mode"); if (modeval.isStr()) strMode = modeval.get_str(); + fprintf(stderr, "%s\n",strMode); else if (modeval.isNull()) { strMode = "template"; From 3354f67d5d576fafd16453fcc4c1b398d56c298b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:25:19 +0800 Subject: [PATCH 0605/4463] fix --- src/rpcmining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 944879120..cb421b9e0 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -528,7 +528,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) const UniValue& modeval = find_value(oparam, "mode"); if (modeval.isStr()) strMode = modeval.get_str(); - fprintf(stderr, "%s\n",strMode); + fprintf(stderr, "%s\n",strMode.c_str()); else if (modeval.isNull()) { strMode = "template"; From b6f711b69d3e0a0d702537a50b66c84ed5b03b9b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:26:36 +0800 Subject: [PATCH 0606/4463] fix --- src/rpcmining.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index cb421b9e0..b317190dd 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -526,9 +526,10 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) { const UniValue& oparam = params[0].get_obj(); const UniValue& modeval = find_value(oparam, "mode"); - if (modeval.isStr()) + if (modeval.isStr()) { strMode = modeval.get_str(); - fprintf(stderr, "%s\n",strMode.c_str()); + fprintf(stderr, "%s\n",strMode.c_str()); + } else if (modeval.isNull()) { strMode = "template"; From 1d3226eafa4934936fae8fba749835c081750204 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:29:06 +0800 Subject: [PATCH 0607/4463] fix --- src/rpcmining.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index b317190dd..ad2058fd5 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -526,10 +526,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) { const UniValue& oparam = params[0].get_obj(); const UniValue& modeval = find_value(oparam, "mode"); - if (modeval.isStr()) { + if (modeval.isStr()) strMode = modeval.get_str(); - fprintf(stderr, "%s\n",strMode.c_str()); - } else if (modeval.isNull()) { strMode = "template"; @@ -571,6 +569,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } + fprintf(stderr, "%s\n",strMode.c_str()); if (strMode != "template" || strMode != "disablecb") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); From 47bc56ea6a88664e7d14b69e2fe3095e03824964 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:32:53 +0800 Subject: [PATCH 0608/4463] fix? --- src/rpcmining.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index ad2058fd5..907d13ada 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -569,10 +569,11 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } - fprintf(stderr, "%s\n",strMode.c_str()); + if (coinbasetxn == false ) + fprintf(stderr, "disable coinbase: %s\n",strMode.c_str()); - if (strMode != "template" || strMode != "disablecb") - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); + //if (strMode != "template" || strMode != "disablecb") + // throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Komodo is not connected!"); From 7e45307718c3f325f550fae104f79da27d991629 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 06:35:30 +0800 Subject: [PATCH 0609/4463] done --- src/rpcmining.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 907d13ada..d3f0563f8 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -569,11 +569,6 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } - if (coinbasetxn == false ) - fprintf(stderr, "disable coinbase: %s\n",strMode.c_str()); - - //if (strMode != "template" || strMode != "disablecb") - // throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Komodo is not connected!"); From 2016042c79ad810dfdd92c06c36da7e8cdfa1241 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 13:16:56 +0800 Subject: [PATCH 0610/4463] fix! lol --- src/notaries_staked.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index ae16e316d..51124be23 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -7,9 +7,9 @@ static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1541498901; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1541500201; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1541501501; +static const int STAKED_NOTARIES_TIMESTAMP1 = 1604211111; +static const int STAKED_NOTARIES_TIMESTAMP2 = 1604222222; +static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; extern const char *notaries_STAKED1[][2]; From 677d4f9b5053791a804a86c908948894ff54fe6e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 14:23:46 +0800 Subject: [PATCH 0611/4463] remove vin,vins --- src/wallet/rpcwallet.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 8a62b2153..3d5d41871 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1074,12 +1074,18 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) } if ( spents == mine ) { - TxToRemove.push_back(wtx.GetHash()); for (unsigned int n = 0; n < wtx.vin.size() ; n++) { - if ( pwalletMain->IsMine(wtx.vin[n]) ) - TxToRemove.push_back(wtx.vin[n].prevout.hash); + //if ( pwalletMain->IsMine(wtx.vin[n]) ) + CTransaction vintx; uint256 hashBlock; + if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) + { + for (unsigned int z = 0; z < vintx.vin.size() ; z++) + TxToRemove.push_back(vintx.vin[z].prevout.hash); + } + TxToRemove.push_back(wtx.vin[n].prevout.hash); } + TxToRemove.push_back(wtx.GetHash()); } } From 13a5aa70a7c6e2be3d327820da9ba81dbc901797 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:10:41 +0800 Subject: [PATCH 0612/4463] print --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 3d5d41871..a393a0518 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,7 +1058,8 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 50 ) + fprintf(stderr, "depth in main chain: %d\n", wtx.GetDepthInMainChain()); + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; CCoins coins; From 462acd24ab3a84a2365190a992beb40f13d2aef5 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:21:38 +0800 Subject: [PATCH 0613/4463] fix print --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a393a0518..688675d71 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,7 +1058,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - fprintf(stderr, "depth in main chain: %d\n", wtx.GetDepthInMainChain()); + fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; From 2e4ff8898f7d13bd7363d559eb62ad776b3595f4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:32:28 +0800 Subject: [PATCH 0614/4463] try --- src/wallet/rpcwallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 688675d71..725cba3a0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1059,7 +1059,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { const CWalletTx& wtx = (*it).second; fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() > 360 ) continue; CCoins coins; @@ -1082,7 +1082,10 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) - TxToRemove.push_back(vintx.vin[z].prevout.hash); + { + fprintf(stderr, "[ %s ] depth : %d\n", vintx.GetHash().ToString().c_str(),vintx.GetDepthInMainChain()); + TxToRemove.push_back(vintx.vin[z].prevout.hash); + } } TxToRemove.push_back(wtx.vin[n].prevout.hash); } From e0383c82b916480011fb55de8e5a696005d3b855 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:35:50 +0800 Subject: [PATCH 0615/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 725cba3a0..d89368ba5 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1083,7 +1083,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) { - fprintf(stderr, "[ %s ] depth : %d\n", vintx.GetHash().ToString().c_str(),vintx.GetDepthInMainChain()); + fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str(); TxToRemove.push_back(vintx.vin[z].prevout.hash); } } From 025924e9ffc8a9ce2da2dc89685f364f659537b3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:36:54 +0800 Subject: [PATCH 0616/4463] ) --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d89368ba5..f9ac24016 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1083,7 +1083,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) { - fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str(); + fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str()); TxToRemove.push_back(vintx.vin[z].prevout.hash); } } From 4d6499bd8d737b9bb95818bf13b7aaf0c8463744 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:42:26 +0800 Subject: [PATCH 0617/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f9ac24016..e7a7a2953 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1059,7 +1059,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { const CWalletTx& wtx = (*it).second; fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() > 360 ) + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; CCoins coins; From 2e91034c1ec168edecec4d6b5c7c65a659f4af91 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 15:57:40 +0800 Subject: [PATCH 0618/4463] LogPrintf the removed txs --- src/wallet/rpcwallet.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e7a7a2953..238744805 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,7 +1058,6 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - fprintf(stderr, "[%s] depth : %d\n", wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) continue; @@ -1077,13 +1076,11 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (unsigned int n = 0; n < wtx.vin.size() ; n++) { - //if ( pwalletMain->IsMine(wtx.vin[n]) ) CTransaction vintx; uint256 hashBlock; if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) { for (unsigned int z = 0; z < vintx.vin.size() ; z++) { - fprintf(stderr, "TX: %s in block : %s\n", vintx.GetHash().ToString().c_str(),hashBlock.ToString().c_str()); TxToRemove.push_back(vintx.vin[z].prevout.hash); } } @@ -1112,7 +1109,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) if ( SpentHash == tx.vin[n].prevout.hash ) { pwalletMain->EraseFromWallet(tx.GetHash()); - //fprintf(stderr, "ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); + LogPrintf("ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); } } } @@ -1123,7 +1120,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) BOOST_FOREACH (uint256& hash, TxToRemove) { pwalletMain->EraseFromWallet(hash); - //fprintf(stderr, "ERASED spent Tx: %s\n",hash.ToString().c_str()); + LogPrintf("ERASED spent Tx: %s\n",hash.ToString().c_str()); } // build return JSON for stats. From 55b48771eabd6e77d86795132aaed122f52fceb3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 17:50:01 +0800 Subject: [PATCH 0619/4463] fix --- src/cc/dice.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 847fc5bee..a321d7149 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1425,11 +1425,8 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet return(""); } if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 ) { -<<<<<<< HEAD - CCerror = "Diceinit error in bet, is your transaction confirmed?"; -======= + CCerror = "error in Diceinit"; ->>>>>>> 880fda004f9487b7ca227f54d2f733f3139d935e return(""); } if ( bet < minbet || bet > maxbet || odds > maxodds ) @@ -1437,10 +1434,6 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet CCerror = strprintf("Dice plan %s illegal bet %.8f: minbet %.8f maxbet %.8f or odds %d vs max.%d\n",planstr,(double)bet/COIN,(double)minbet/COIN,(double)maxbet/COIN,(int32_t)odds,(int32_t)maxodds); return(""); } -<<<<<<< HEAD - int32_t entropytxs; - if ( (funding= DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs)) >= 2*bet*odds+txfee && entropyval != 0 ) -======= int32_t entropytxs=0,emptyvar=0; funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs,false); DicePlanFunds(entropyval2,entropytxid2,sbits,cp,dicepk,fundingtxid,emptyvar,true); @@ -1450,7 +1443,6 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet entropytxid = entropytxid2; } if ( ( funding >= 2*bet*odds+txfee && entropyval != 0 ) ) ->>>>>>> 880fda004f9487b7ca227f54d2f733f3139d935e { if ( entropytxs < 100 ) { CCerror = "Your dealer is broke, find a new casino."; From c7fec5f7b694c122af0c25c5ce53a899b362d6af Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 17:51:00 +0800 Subject: [PATCH 0620/4463] fix --- src/cc/dice.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index a321d7149..5a206727b 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1643,12 +1643,7 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx CScript fundingPubKey,scriptPubKey; CTransaction spenttx,betTx,entropyTx; uint256 hentropyproof,entropyused,hash,proof,txid,hashBlock,spenttxid,bettorentropy; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int32_t i,entropyvout,flag,win,loss,duplicate=0,result,iswin,vout,n=0; int64_t minbet,maxbet,maxodds,timeoutblocks,sum=0; uint64_t sbits,refsbits; char coinaddr[64]; std::string res; uint8_t funcid; if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,refsbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 ) { -<<<<<<< HEAD - CCerror = "Diceinit error in status, is your transaction confirmed?"; - fprintf(stderr,"%s\n", CCerror.c_str() ); -======= CCerror = "Diceinit error in status"; ->>>>>>> 880fda004f9487b7ca227f54d2f733f3139d935e return(0.); } win = loss = 0; From 0d318f6411454abebed095070618a0411b55fd10 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 18:03:52 +0800 Subject: [PATCH 0621/4463] fix --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index f471b0013..c6ac90196 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -458,7 +458,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; pblock->vtx[0] = txNew; - if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 ) + if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block),(int32_t)nHeight)) != 0 ) { int32_t i; uint8_t *ptr; txNew.vout.resize(2); From 13a13cd164590cbeb9b8509bf1d3d911c924b69f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 18:05:55 +0800 Subject: [PATCH 0622/4463] fix --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index c6ac90196..43ebf8607 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -458,7 +458,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; pblock->vtx[0] = txNew; - if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block),(int32_t)nHeight)) != 0 ) + if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 ) { int32_t i; uint8_t *ptr; txNew.vout.resize(2); From ecd40761e8b85770f701e035a4329214d55add13 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 18:31:51 +0800 Subject: [PATCH 0623/4463] fix stream option? --- src/komodo_utils.h | 12 ++++++------ src/pow.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index be39b4d46..9b54dace7 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1600,6 +1600,11 @@ void komodo_args(char *argv0) ASSETCHAINS_DECAY = 0; printf("ASSETCHAINS_DECAY cant be more than 100000000\n"); } + if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) != 66 && ASSETCHAINS_STREAM != 0 ) + { + printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! \n"); + exit(0); + } if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 || ASSETCHAINS_SCRIPTPUB.size() > 1 ) { if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 ) @@ -1607,11 +1612,6 @@ void komodo_args(char *argv0) decode_hex(ASSETCHAINS_OVERRIDE_PUBKEY33,33,(char *)ASSETCHAINS_OVERRIDE_PUBKEY.c_str()); calc_rmd160_sha256(ASSETCHAINS_OVERRIDE_PUBKEYHASH,ASSETCHAINS_OVERRIDE_PUBKEY33,33); } - else if ( ASSETCHAINS_STREAM != 0) - { - printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! \n"); - exit(0); - } if ( ASSETCHAINS_COMMISSION == 0 && ASSETCHAINS_FOUNDERS != 0 ) { ASSETCHAINS_COMMISSION = 53846154; // maps to 35% @@ -1661,7 +1661,7 @@ void komodo_args(char *argv0) MAX_MONEY = 1000000LL*SATOSHIDEN; if ( MAX_MONEY <= 0 || MAX_MONEY > 1000000000LL*SATOSHIDEN ) MAX_MONEY = 1000000000LL*SATOSHIDEN; - //fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN); + fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN); //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) diff --git a/src/pow.cpp b/src/pow.cpp index 9c8f68586..0e7e6678c 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -24,7 +24,7 @@ extern int32_t ASSETCHAINS_STREAM; unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { - if ( ASSETCHAINS_STREAM == 0) + if ( ASSETCHAINS_STREAM != 2 ) { unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); // Genesis block From eb7f16be6a8c5e0f9033f7900a79aeb47c53fdb3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 11 Nov 2018 18:45:20 +0800 Subject: [PATCH 0624/4463] h --- src/komodo_utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 9b54dace7..0add63fbb 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1623,12 +1623,12 @@ void komodo_args(char *argv0) if ( ASSETCHAINS_COMMISSION != 0 ) { ASSETCHAINS_COMMISSION = 0; - printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); + printf("ASSETCHAINS_COMMISSION needs an ASSETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n"); } if ( ASSETCHAINS_FOUNDERS != 0 ) { ASSETCHAINS_FOUNDERS = 0; - printf("ASSETCHAINS_FOUNDERS needs an ASETCHAINS_OVERRIDE_PUBKEY\n"); + printf("ASSETCHAINS_FOUNDERS needs an ASSETCHAINS_OVERRIDE_PUBKEY or ASSETCHAINS_SCRIPTPUB\n"); } } if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 || ASSETCHAINS_PRIVATE != 0 || ASSETCHAINS_TXPOW != 0 || ASSETCHAINS_FOUNDERS != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1 ) @@ -1661,7 +1661,7 @@ void komodo_args(char *argv0) MAX_MONEY = 1000000LL*SATOSHIDEN; if ( MAX_MONEY <= 0 || MAX_MONEY > 1000000000LL*SATOSHIDEN ) MAX_MONEY = 1000000000LL*SATOSHIDEN; - fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN); + //fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN); //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 ) From 7c50dd216c722eea4e3f1903d1d168d6ac7a3a4f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 12 Nov 2018 01:33:57 +0800 Subject: [PATCH 0625/4463] try --- src/cc/CCinclude.h | 1 - src/miner.cpp | 2 +- src/wallet/rpcwallet.cpp | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index f9924e173..0f3603d41 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -155,7 +155,6 @@ bool PreventCC(Eval* eval,const CTransaction &tx,int32_t preventCCvins,int32_t n bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey); std::vector Mypubkey(); bool Myprivkey(uint8_t myprivkey[]); -bool pubkey2addr(char *destaddr,uint8_t *pubkey33); int64_t CCduration(int32_t &numblocks,uint256 txid); bool isCCTxNotarizedConfirmed(uint256 txid); // CCtx diff --git a/src/miner.cpp b/src/miner.cpp index 43ebf8607..a657e773e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -674,7 +674,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in } else if ( USE_EXTERNAL_PUBKEY != 0 ) { - //fprintf(stderr,"use notary pubkey\n"); + fprintf(stderr,"use notary pubkey\n"); scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG; } else { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 05cbb5dee..0641b446c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5085,7 +5085,7 @@ extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; UniValue setpubkey(const UniValue& params, bool fHelp) { UniValue result(UniValue::VOBJ); - if ( fHelp || params.size() != 1 ) + if ( fHelp || params.size() > 1 ) throw runtime_error( "setpubkey\n" "\nSets the -pubkey if the daemon was not started with it, if it was already set, it returns the pubkey.\n" @@ -5128,10 +5128,10 @@ UniValue setpubkey(const UniValue& params, bool fHelp) if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) { result.push_back(Pair("IsNotary", notaryname)); IS_KOMODO_NOTARY = 0; - USE_EXTERNAL_PUBKEY = 1; } NOTARY_PUBKEY = params[0].get_str(); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + USE_EXTERNAL_PUBKEY = 1; } } else result.push_back(Pair("error", "pubkey entered is invalid.")); From 025d680a9e209a7813fbd5cbd969ada66372a755 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 12 Nov 2018 10:40:49 +0800 Subject: [PATCH 0626/4463] remove print again --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index a657e773e..43ebf8607 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -674,7 +674,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in } else if ( USE_EXTERNAL_PUBKEY != 0 ) { - fprintf(stderr,"use notary pubkey\n"); + //fprintf(stderr,"use notary pubkey\n"); scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG; } else { From 8e1f081a7e76bffb9f4eb0a0ea43c7af7001b51c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 12 Nov 2018 11:53:07 +0800 Subject: [PATCH 0627/4463] ix? --- src/cc/dice.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index cc669c771..ea5edea7e 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1254,12 +1254,9 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit } else { return(0); } -<<<<<<< HEAD fprintf(stderr,"numentropy tx %d: %.8f\n",n,(double)totalinputs/COIN); entropytxs = n; return(totalinputs); -======= ->>>>>>> 4d711ae4aa4c84f55cb63c56770205b46332f40a } bool DicePlanExists(CScript &fundingPubKey,uint256 &fundingtxid,struct CCcontract_info *cp,uint64_t refsbits,CPubKey dicepk,int64_t &minbet,int64_t &maxbet,int64_t &maxodds,int64_t &timeoutblocks) @@ -1351,14 +1348,8 @@ UniValue DiceInfo(uint256 diceid) result.push_back(Pair("timeoutblocks",timeoutblocks)); cp = CCinit(&C,EVAL_DICE); dicepk = GetUnspendable(cp,0); -<<<<<<< HEAD - int32_t entropytxs = 0; - funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,diceid,entropytxs); - result.push_back(Pair("entropytxs",entropytxs)); -======= int32_t entropytxs; funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,diceid,entropytxs,false); ->>>>>>> 4d711ae4aa4c84f55cb63c56770205b46332f40a sprintf(numstr,"%.8f",(double)funding/COIN); result.push_back(Pair("funding",numstr)); result.push_back(Pair("entropytxs",entropytxs)); @@ -1485,10 +1476,6 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet CCerror = strprintf("Dice plan %s illegal bet %.8f: minbet %.8f maxbet %.8f or odds %d vs max.%d\n",planstr,(double)bet/COIN,(double)minbet/COIN,(double)maxbet/COIN,(int32_t)odds,(int32_t)maxodds); return(""); } -<<<<<<< HEAD - int32_t entropytxs; - if ( (funding= DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs)) >= 2*bet*odds+txfee && entropyval != 0 ) -======= int32_t entropytxs=0,emptyvar=0; funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs,false); DicePlanFunds(entropyval2,entropytxid2,sbits,cp,dicepk,fundingtxid,emptyvar,true); @@ -1498,7 +1485,6 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet entropytxid = entropytxid2; } if ( ( funding >= 2*bet*odds+txfee && entropyval != 0 ) ) ->>>>>>> 4d711ae4aa4c84f55cb63c56770205b46332f40a { if ( entropytxs < 100 ) { CCerror = "Your dealer is broke, find a new casino."; From 02a54b36a8bf5534dc534fba5d2ccff979167346 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 12 Nov 2018 12:39:11 +0800 Subject: [PATCH 0628/4463] fix max money cap!? --- src/assetchains.json | 12 ++++++++++++ src/komodo_utils.h | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index d26f3a99a..4cac1fc6e 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -177,6 +177,18 @@ ] }, { + "ac_name": "KMDICE", + "ac_supply": "10500000", + "ac_reward": "2500000000", + "ac_halving": "210000", + "ac_cc": "2", + "addressindex": "1", + "spentindex": "1", + "addnode": [ + "144.76.217.232" + ] + }, + { "ac_name": "DION", "ac_supply": "3900000000", "ac_reward": "22260000000", diff --git a/src/komodo_utils.h b/src/komodo_utils.h index fe6397dcd..2ed50b994 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1641,8 +1641,8 @@ void komodo_args(char *argv0) MAX_MONEY += (MAX_MONEY * ASSETCHAINS_COMMISSION) / SATOSHIDEN; if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN ) MAX_MONEY = 1000000LL*SATOSHIDEN; - if ( MAX_MONEY <= 0 || MAX_MONEY > 1000000000LL*SATOSHIDEN ) - MAX_MONEY = 1000000000LL*SATOSHIDEN; + //if ( MAX_MONEY <= 0 || MAX_MONEY > 1000000000LL*SATOSHIDEN ) + // MAX_MONEY = 1000000000LL*SATOSHIDEN; //fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN); //printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN); ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen); From e5028657278760d5536ada58319a576b05c15518 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 12 Nov 2018 15:20:20 +0800 Subject: [PATCH 0629/4463] fix setpubkey for pool --- src/wallet/rpcwallet.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 0641b446c..17d28aced 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5120,26 +5120,31 @@ UniValue setpubkey(const UniValue& params, bool fHelp) CTxDestination dest = address.Get(); isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; if ( mine == ISMINE_NO ) { - result.push_back(Pair("error", "privkey for this pubkey is not imported to wallet!")); + result.push_back(Pair("WARNING", "privkey for this pubkey is not imported to wallet!")); } else { result.push_back(Pair("ismine", "true")); - NOTARY_ADDRESS = address.ToString(); std::string notaryname; if ( (IS_STAKED_NOTARY= StakedNotaryID(notaryname, Raddress)) > -1 ) { result.push_back(Pair("IsNotary", notaryname)); IS_KOMODO_NOTARY = 0; } - NOTARY_PUBKEY = params[0].get_str(); - decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); - USE_EXTERNAL_PUBKEY = 1; } - } else + NOTARY_PUBKEY = params[0].get_str(); + decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); + USE_EXTERNAL_PUBKEY = 1; + NOTARY_ADDRESS = address.ToString(); + } else { result.push_back(Pair("error", "pubkey entered is invalid.")); + } } } else { result.push_back(Pair("error", "pubkey is wrong length, must be 66 char hex string.")); } } else { + if ( NOTARY_ADDRESS.empty() ) { + pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33); + NOTARY_ADDRESS.assign(Raddress); + } result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon.")); } if ( NOTARY_PUBKEY33[0] != 0 && !NOTARY_ADDRESS.empty() ) { From 0724759fc48231f550a3f4614e47b61159f45cbd Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 13 Nov 2018 13:57:06 +0800 Subject: [PATCH 0630/4463] fix KMD sync issue? --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 92634de0f..2072aadb5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3192,7 +3192,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } } - if ( ( block.vtx[0].GetValueOut() > blockReward+1 && is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) || ( block.vtx[0].GetValueOut() > blockReward ) ) + if ( ( block.vtx[0].GetValueOut() > blockReward && is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) || ( block.vtx[0].GetValueOut() > blockReward+1 ) ) { if ( ASSETCHAINS_SYMBOL[0] != 0 || pindex->nHeight >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward ) { From 2120ab4fd111d67d655eb434dd9ce6b54bb4f90b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 13 Nov 2018 18:09:23 +0800 Subject: [PATCH 0631/4463] fix --- src/cc/dice.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 7ef00ad6c..81a141d3b 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1425,12 +1425,8 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet return(""); } if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 ) { -<<<<<<< HEAD CCerror = "error in Diceinit"; -======= - CCerror = "Diceinit error in bet, is your transaction confirmed?"; ->>>>>>> 08b2f80458cd1f0313af8089c9fda3b9a82ea68c return(""); } if ( bet < minbet || bet > maxbet || odds > maxodds ) From cad34b503d51f9076adef1e65435854f54fdba68 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 18:25:07 +0800 Subject: [PATCH 0632/4463] fix streamer with ac_pubey requiring ac_perc --- src/cryptoconditions/compile | 13 +++++----- src/komodo_utils.h | 4 +-- src/pow.cpp | 50 +++++++++++++++++------------------- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/cryptoconditions/compile b/src/cryptoconditions/compile index a85b723c7..99e50524b 100755 --- a/src/cryptoconditions/compile +++ b/src/cryptoconditions/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/src/komodo_utils.h b/src/komodo_utils.h index a1705c20a..80581a1f8 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1620,10 +1620,10 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = 53846154; // maps to 35% printf("ASSETCHAINS_COMMISSION defaulted to 35%% when founders reward active\n"); } - else + else if ( ASSETCHAINS_STREAM == 0 ) { ASSETCHAINS_OVERRIDE_PUBKEY.clear(); - printf("-ac_perc must be set with -ac_pubkey\n"); + printf("-ac_perc or -ac_stream must be set with -ac_pubkey\n"); } } } diff --git a/src/pow.cpp b/src/pow.cpp index 0e7e6678c..07776e273 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -24,35 +24,31 @@ extern int32_t ASSETCHAINS_STREAM; unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { - if ( ASSETCHAINS_STREAM != 2 ) - { - unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); - // Genesis block - if (pindexLast == NULL ) - return nProofOfWorkLimit; - - // Find the first block in the averaging interval - const CBlockIndex* pindexFirst = pindexLast; - arith_uint256 bnTot {0}; - for (int i = 0; pindexFirst && i < params.nPowAveragingWindow; i++) { - arith_uint256 bnTmp; - bnTmp.SetCompact(pindexFirst->nBits); - bnTot += bnTmp; - pindexFirst = pindexFirst->pprev; - } - - // Check we have enough blocks - if (pindexFirst == NULL) - return nProofOfWorkLimit; - - arith_uint256 bnAvg {bnTot / params.nPowAveragingWindow}; - - return CalculateNextWorkRequired(bnAvg, pindexLast->GetMedianTimePast(), pindexFirst->GetMedianTimePast(), params); - } - else - { + if ( ASSETCHAINS_STREAM == 2 ) return 537857807; + + unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); + // Genesis block + if (pindexLast == NULL ) + return nProofOfWorkLimit; + + // Find the first block in the averaging interval + const CBlockIndex* pindexFirst = pindexLast; + arith_uint256 bnTot {0}; + for (int i = 0; pindexFirst && i < params.nPowAveragingWindow; i++) { + arith_uint256 bnTmp; + bnTmp.SetCompact(pindexFirst->nBits); + bnTot += bnTmp; + pindexFirst = pindexFirst->pprev; } + + // Check we have enough blocks + if (pindexFirst == NULL) + return nProofOfWorkLimit; + + arith_uint256 bnAvg {bnTot / params.nPowAveragingWindow}; + + return CalculateNextWorkRequired(bnAvg, pindexLast->GetMedianTimePast(), pindexFirst->GetMedianTimePast(), params); } unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg, From 3cc9f623a8ce2f95f9030ce80a95e78fa2cd9171 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 20:44:52 +0800 Subject: [PATCH 0633/4463] commit toest to dev, clean wallet branch broken --- src/rpcserver.cpp | 2 +- src/rpcserver.h | 2 +- src/wallet/rpcwallet.cpp | 37 ++++++++++++++++++++++++++----------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 4100d2210..81a8f7cf5 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -494,7 +494,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "getaccountaddress", &getaccountaddress, true }, { "wallet", "getaccount", &getaccount, true }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true }, - { "wallet", "cleanwalletnotarisations", &cleanwalletnotarisations, false }, + { "wallet", "cleanwallettransactions", &cleanwallettransactions, false }, { "wallet", "getbalance", &getbalance, false }, { "wallet", "getbalance64", &getbalance64, false }, { "wallet", "getnewaddress", &getnewaddress, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 579db50c9..5be24c633 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -300,7 +300,7 @@ extern UniValue signmessage(const UniValue& params, bool fHelp); extern UniValue verifymessage(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp); -extern UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp); +extern UniValue cleanwallettransactions(const UniValue& params, bool fHelp); extern UniValue getbalance(const UniValue& params, bool fHelp); extern UniValue getbalance64(const UniValue& params, bool fHelp); extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c16df1a42..c46e3043d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -999,15 +999,15 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef return GetAccountBalance(walletdb, strAccount, nMinDepth, filter); } -UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) +UniValue cleanwallettransactions(const UniValue& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; if (fHelp || params.size() > 1 ) throw runtime_error( - "cleanwalletnotarisations \"txid\"\n" - "\nRemove all txs which are totally spent and all notarisations created from them, you can clear all txs bar one, by specifiying a txid.\n" + "cleanwallettransactions \"txid\"\n" + "\nRemove all txs which are totally spent, you can clear all txs bar one, by specifiying a txid.\n" "\nPlease backup your wallet.dat before running this command.\n" "\nArguments:\n" "1. \"txid\" (string, optional) The transaction id to keep.\n" @@ -1042,7 +1042,6 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { - txs++; const CWalletTx& wtx = (*it).second; if ( wtx.GetHash() != exception ) { @@ -1058,7 +1057,23 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) } else { - std::vector NotarisationTxs; + // listunspent call... this gets us all the txids that are unspent, we search this list for the oldest tx, + // then delete all txs in the wallet before this block + 10 as safety buffer. + vector vecOutputs; + assert(pwalletMain != NULL); + pwalletMain->AvailableCoins(vecOutputs, false, NULL, true); + int32_t oldestTxHeight = 0; + BOOST_FOREACH(const COutput& out, vecOutputs) + { + int32_t txheight = out.nDepth; + fprintf(stderr, "txheight.%i\n", txheight); + if ( txheight > oldestTxHeight ) + oldestTxHeight = txheight; + } + fprintf(stderr, "oldestTxHeight.%i\n",oldestTxHeight); + + + /*std::vector NotarisationTxs; for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; @@ -1117,15 +1132,15 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) } } } - } + } */ } // erase txs - BOOST_FOREACH (uint256& hash, TxToRemove) + /*BOOST_FOREACH (uint256& hash, TxToRemove) { pwalletMain->EraseFromWallet(hash); LogPrintf("ERASED spent Tx: %s\n",hash.ToString().c_str()); - } + } */ // build return JSON for stats. int remaining = pwalletMain->mapWallet.size(); @@ -5755,7 +5770,7 @@ UniValue gatewayswithdraw(const UniValue& params, bool fHelp) const CKeyStore& keystore = *pwalletMain; LOCK2(cs_main, pwalletMain->cs_wallet); bindtxid = Parseuint256((char *)params[0].get_str().c_str()); - coin = params[1].get_str(); + coin = params[1].get_str(); withdrawpub = ParseHex(params[2].get_str()); amount = atof((char *)params[3].get_str().c_str()) * COIN; hex = GatewaysWithdraw(0,bindtxid,coin,pubkey2pk(withdrawpub),amount); @@ -5808,7 +5823,7 @@ UniValue gatewaysmultisig(const UniValue& params, bool fHelp) if ( ensure_CCrequirements() < 0 ) throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); + LOCK2(cs_main, pwalletMain->cs_wallet); txidaddr = (char *)params[0].get_str().c_str(); return(GatewaysMultisig(txidaddr)); } @@ -5821,7 +5836,7 @@ UniValue gatewayspartialsign(const UniValue& params, bool fHelp) if ( ensure_CCrequirements() < 0 ) throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); const CKeyStore& keystore = *pwalletMain; - LOCK2(cs_main, pwalletMain->cs_wallet); + LOCK2(cs_main, pwalletMain->cs_wallet); txid = Parseuint256((char *)params[0].get_str().c_str()); coin = params[1].get_str(); parthex = params[2].get_str(); From eead6be2c7b1fc6eb4f1199bf8b16ad9c8120c98 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 21:24:08 +0800 Subject: [PATCH 0634/4463] add delete logic --- src/wallet/rpcwallet.cpp | 89 ++++++++-------------------------------- 1 file changed, 18 insertions(+), 71 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c46e3043d..73f3e7f66 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1057,90 +1057,37 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) } else { - // listunspent call... this gets us all the txids that are unspent, we search this list for the oldest tx, - // then delete all txs in the wallet before this block + 10 as safety buffer. - vector vecOutputs; - assert(pwalletMain != NULL); - pwalletMain->AvailableCoins(vecOutputs, false, NULL, true); - int32_t oldestTxHeight = 0; - BOOST_FOREACH(const COutput& out, vecOutputs) - { - int32_t txheight = out.nDepth; - fprintf(stderr, "txheight.%i\n", txheight); - if ( txheight > oldestTxHeight ) - oldestTxHeight = txheight; - } - fprintf(stderr, "oldestTxHeight.%i\n",oldestTxHeight); + // listunspent call... this gets us all the txids that are unspent, we search this list for the oldest tx, + vector vecOutputs; + assert(pwalletMain != NULL); + pwalletMain->AvailableCoins(vecOutputs, false, NULL, true); + int32_t oldestTxDepth = 0; + BOOST_FOREACH(const COutput& out, vecOutputs) + { + if ( out.nDepth > oldestTxHeight ) + oldestTxDepth = out.nDepth; + } + oldestTxDepth = oldestTxDepth + 1; + fprintf(stderr, "oldestTxHeight.%i\n",oldestTxHeight); - - /*std::vector NotarisationTxs; + // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) - continue; - - CCoins coins; - if (!pcoinsTip->GetCoins(wtx.GetHash(), coins)) + if (wtx.GetDepthInMainChain() < oldestTxDepth) { - int spents = 0; int mine = 0; - for (unsigned int n = 0; n < wtx.vout.size() ; n++) - { - if ( pwalletMain->IsMine(wtx.vout[n]) ) - mine++; - if ( ((unsigned int)n >= coins.vout.size() || coins.vout[n].IsNull() ) ) - spents++; - } - if ( spents == mine ) - { - for (unsigned int n = 0; n < wtx.vin.size() ; n++) - { - CTransaction vintx; uint256 hashBlock; - if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) - { - for (unsigned int z = 0; z < vintx.vin.size() ; z++) - { - TxToRemove.push_back(vintx.vin[z].prevout.hash); - } - } - TxToRemove.push_back(wtx.vin[n].prevout.hash); - } - TxToRemove.push_back(wtx.GetHash()); - } - } - - CTxDestination address; - // get all notarisations - if ( ExtractDestination(wtx.vout[0].scriptPubKey, address) ) - { - if ( strcmp(CBitcoinAddress(address).ToString().c_str(),CRYPTO777_KMDADDR) == 0 ) - NotarisationTxs.push_back(wtx); + TxToRemove.push_back(wtx.GetHash()); + fprintf(stderr, "[%s] : depth.%i \n",wtx.GetHash(),wtx.GetDepthInMainChain()); } } - - // Erase notarisations spending from fully spent splits. - BOOST_FOREACH (CWalletTx& tx, NotarisationTxs) - { - for (int n = 0; n < tx.vin.size(); n++) - { - BOOST_FOREACH (uint256& SpentHash, TxToRemove) - { - if ( SpentHash == tx.vin[n].prevout.hash ) - { - pwalletMain->EraseFromWallet(tx.GetHash()); - LogPrintf("ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); - } - } - } - } */ } // erase txs - /*BOOST_FOREACH (uint256& hash, TxToRemove) + BOOST_FOREACH (uint256& hash, TxToRemove) { pwalletMain->EraseFromWallet(hash); LogPrintf("ERASED spent Tx: %s\n",hash.ToString().c_str()); - } */ + } // build return JSON for stats. int remaining = pwalletMain->mapWallet.size(); From 769d800441bbefa5fe94454cd72374a482fa1aed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 21:26:03 +0800 Subject: [PATCH 0635/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 73f3e7f66..2e848cd75 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1077,7 +1077,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) if (wtx.GetDepthInMainChain() < oldestTxDepth) { TxToRemove.push_back(wtx.GetHash()); - fprintf(stderr, "[%s] : depth.%i \n",wtx.GetHash(),wtx.GetDepthInMainChain()); + fprintf(stderr, "[%s] : depth.%i \n",wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); } } } From 702f709517bf5b0e201b169a530ea87df71f2082 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 21:27:12 +0800 Subject: [PATCH 0636/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2e848cd75..631a475de 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1068,7 +1068,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) oldestTxDepth = out.nDepth; } oldestTxDepth = oldestTxDepth + 1; - fprintf(stderr, "oldestTxHeight.%i\n",oldestTxHeight); + fprintf(stderr, "oldestTxDepth.%i\n",oldestTxDepth); // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) From dbbe6d419194f7f9f6df88764bc539234a963541 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 21:28:10 +0800 Subject: [PATCH 0637/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 631a475de..fed60ff31 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1064,7 +1064,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) int32_t oldestTxDepth = 0; BOOST_FOREACH(const COutput& out, vecOutputs) { - if ( out.nDepth > oldestTxHeight ) + if ( out.nDepth > oldestTxDepth ) oldestTxDepth = out.nDepth; } oldestTxDepth = oldestTxDepth + 1; From d506b5433e3e5be219ea10870036f4e0d3f83944 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 21:32:19 +0800 Subject: [PATCH 0638/4463] > --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index fed60ff31..a5cb169d6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1074,7 +1074,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - if (wtx.GetDepthInMainChain() < oldestTxDepth) + if (wtx.GetDepthInMainChain() > oldestTxDepth) { TxToRemove.push_back(wtx.GetHash()); fprintf(stderr, "[%s] : depth.%i \n",wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); From 540e3f03b2f70f86052edeba424dfac3140ef80c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 22:31:20 +0800 Subject: [PATCH 0639/4463] fix log prints --- src/wallet/rpcwallet.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index de50d0257..56525625f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1008,7 +1008,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) if (fHelp || params.size() > 1 ) throw runtime_error( "cleanwallettransactions \"txid\"\n" - "\nRemove all txs which are totally spent, you can clear all txs bar one, by specifiying a txid.\n" + "\nRemove all txs that are spent. You can clear all txs bar one, by specifiying a txid.\n" "\nPlease backup your wallet.dat before running this command.\n" "\nArguments:\n" "1. \"txid\" (string, optional) The transaction id to keep.\n" @@ -1068,18 +1068,14 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) if ( out.nDepth > oldestTxDepth ) oldestTxDepth = out.nDepth; } - oldestTxDepth = oldestTxDepth + 1; - fprintf(stderr, "oldestTxDepth.%i\n",oldestTxDepth); + oldestTxDepth = oldestTxDepth + 1; // add extra block just for safety. // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; if (wtx.GetDepthInMainChain() > oldestTxDepth) - { TxToRemove.push_back(wtx.GetHash()); - fprintf(stderr, "[%s] : depth.%i \n",wtx.GetHash().ToString().c_str(),wtx.GetDepthInMainChain()); - } } } @@ -1087,7 +1083,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) BOOST_FOREACH (uint256& hash, TxToRemove) { pwalletMain->EraseFromWallet(hash); - LogPrintf("ERASED spent Tx: %s\n",hash.ToString().c_str()); + LogPrintf("Erased %s from wallet.\n",hash.ToString().c_str()); } // build return JSON for stats. From 02c49755a585fab54e469206da5c7dbc97a7fcf4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 22:55:36 +0800 Subject: [PATCH 0640/4463] fix wallet cleaner --- src/rpcserver.cpp | 2 +- src/rpcserver.h | 2 +- src/wallet/rpcwallet.cpp | 88 +++++++++++----------------------------- 3 files changed, 25 insertions(+), 67 deletions(-) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 7267461b3..65f12a346 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -495,7 +495,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "getaccountaddress", &getaccountaddress, true }, { "wallet", "getaccount", &getaccount, true }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true }, - { "wallet", "cleanwalletnotarisations", &cleanwalletnotarisations, false }, + { "wallet", "cleanwallettransactions", &cleanwallettransactions, false }, { "wallet", "getbalance", &getbalance, false }, { "wallet", "getbalance64", &getbalance64, false }, { "wallet", "getnewaddress", &getnewaddress, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 873e2dc05..f7fa65942 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -300,7 +300,7 @@ extern UniValue signmessage(const UniValue& params, bool fHelp); extern UniValue verifymessage(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp); -extern UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp); +extern UniValue cleanwallettransactions(const UniValue& params, bool fHelp); extern UniValue getbalance(const UniValue& params, bool fHelp); extern UniValue getbalance64(const UniValue& params, bool fHelp); extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 69c310bcf..a5c8bdaff 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1003,15 +1003,15 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef return GetAccountBalance(walletdb, strAccount, nMinDepth, filter); } -UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) +UniValue cleanwallettransactions(const UniValue& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) return NullUniValue; if (fHelp || params.size() > 1 ) throw runtime_error( - "cleanwalletnotarisations \"txid\"\n" - "\nRemove all txs which are totally spent and all notarisations created from them, you can clear all txs bar one, by specifiying a txid.\n" + "cleanwallettransactions \"txid\"\n" + "\nRemove all txs that are spent. You can clear all txs bar one, by specifiying a txid.\n" "\nPlease backup your wallet.dat before running this command.\n" "\nArguments:\n" "1. \"txid\" (string, optional) The transaction id to keep.\n" @@ -1022,10 +1022,10 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) " \"removed_transactons\" : n, (numeric) The number of transactions removed.\n" "}\n" "\nExamples:\n" - + HelpExampleCli("cleanoldtxs", "") - + HelpExampleCli("cleanoldtxs","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") - + HelpExampleRpc("cleanoldtxs", "") - + HelpExampleRpc("cleanoldtxs","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + + HelpExampleCli("cleanwallettransactions", "") + + HelpExampleCli("cleanwallettransactions","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + + HelpExampleRpc("cleanwallettransactions", "") + + HelpExampleRpc("cleanwallettransactions","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); @@ -1046,7 +1046,6 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) { for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { - txs++; const CWalletTx& wtx = (*it).second; if ( wtx.GetHash() != exception ) { @@ -1062,65 +1061,24 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) } else { - std::vector NotarisationTxs; + // listunspent call... this gets us all the txids that are unspent, we search this list for the oldest tx, + vector vecOutputs; + assert(pwalletMain != NULL); + pwalletMain->AvailableCoins(vecOutputs, false, NULL, true); + int32_t oldestTxDepth = 0; + BOOST_FOREACH(const COutput& out, vecOutputs) + { + if ( out.nDepth > oldestTxDepth ) + oldestTxDepth = out.nDepth; + } + oldestTxDepth = oldestTxDepth + 1; // add extra block just for safety. + + // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 360 ) - continue; - - CCoins coins; - if (!pcoinsTip->GetCoins(wtx.GetHash(), coins)) - { - int spents = 0; int mine = 0; - for (unsigned int n = 0; n < wtx.vout.size() ; n++) - { - if ( pwalletMain->IsMine(wtx.vout[n]) ) - mine++; - if ( ((unsigned int)n >= coins.vout.size() || coins.vout[n].IsNull() ) ) - spents++; - } - if ( spents == mine ) - { - for (unsigned int n = 0; n < wtx.vin.size() ; n++) - { - CTransaction vintx; uint256 hashBlock; - if ( GetTransaction(wtx.vin[n].prevout.hash,vintx,hashBlock,false) != 0 ) - { - for (unsigned int z = 0; z < vintx.vin.size() ; z++) - { - TxToRemove.push_back(vintx.vin[z].prevout.hash); - } - } - TxToRemove.push_back(wtx.vin[n].prevout.hash); - } - TxToRemove.push_back(wtx.GetHash()); - } - } - - CTxDestination address; - // get all notarisations - if ( ExtractDestination(wtx.vout[0].scriptPubKey, address) ) - { - if ( strcmp(CBitcoinAddress(address).ToString().c_str(),CRYPTO777_KMDADDR) == 0 ) - NotarisationTxs.push_back(wtx); - } - } - - // Erase notarisations spending from fully spent splits. - BOOST_FOREACH (CWalletTx& tx, NotarisationTxs) - { - for (int n = 0; n < tx.vin.size(); n++) - { - BOOST_FOREACH (uint256& SpentHash, TxToRemove) - { - if ( SpentHash == tx.vin[n].prevout.hash ) - { - pwalletMain->EraseFromWallet(tx.GetHash()); - LogPrintf("ERASED Notarisation: %s\n",tx.GetHash().ToString().c_str()); - } - } - } + if (wtx.GetDepthInMainChain() > oldestTxDepth) + TxToRemove.push_back(wtx.GetHash()); } } @@ -1128,7 +1086,7 @@ UniValue cleanwalletnotarisations(const UniValue& params, bool fHelp) BOOST_FOREACH (uint256& hash, TxToRemove) { pwalletMain->EraseFromWallet(hash); - LogPrintf("ERASED spent Tx: %s\n",hash.ToString().c_str()); + LogPrintf("Erased %s from wallet.\n",hash.ToString().c_str()); } // build return JSON for stats. From b22e82022f94e71dfef378146a6d737dd482a3ed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 18 Nov 2018 22:56:23 +0800 Subject: [PATCH 0641/4463] fix help --- src/wallet/rpcwallet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 56525625f..605e55c74 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1019,10 +1019,10 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) " \"removed_transactons\" : n, (numeric) The number of transactions removed.\n" "}\n" "\nExamples:\n" - + HelpExampleCli("cleanoldtxs", "") - + HelpExampleCli("cleanoldtxs","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") - + HelpExampleRpc("cleanoldtxs", "") - + HelpExampleRpc("cleanoldtxs","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + + HelpExampleCli("cleanwallettransactions", "") + + HelpExampleCli("cleanwallettransactions","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + + HelpExampleRpc("cleanwallettransactions", "") + + HelpExampleRpc("cleanwallettransactions","\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") ); LOCK2(cs_main, pwalletMain->cs_wallet); From 7a89c512ce4a61f7652adf3986fbf262c5f3a093 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Tue, 20 Nov 2018 13:32:17 +0800 Subject: [PATCH 0642/4463] x10 safety margin --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 605e55c74..b075c22d3 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1068,7 +1068,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) if ( out.nDepth > oldestTxDepth ) oldestTxDepth = out.nDepth; } - oldestTxDepth = oldestTxDepth + 1; // add extra block just for safety. + oldestTxDepth = oldestTxDepth + 1; // add extra 10 blocks just for safety. // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) From 692de95bb7e1cfdc03c96b2118cc028254c8a2ac Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 21 Nov 2018 18:20:31 +0800 Subject: [PATCH 0643/4463] unlock locked utxo before fetching unspents, then relock them. --- src/wallet/rpcwallet.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b075c22d3..00222f116 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1058,6 +1058,11 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) } else { + // get all locked utxos to relock them later. + vector vLockedUTXO; + pwalletMain->ListLockedCoins(vLockedUTXO); + // unlock all coins so that the following call containes all utxos. + pwalletMain->UnlockAllCoins(); // listunspent call... this gets us all the txids that are unspent, we search this list for the oldest tx, vector vecOutputs; assert(pwalletMain != NULL); @@ -1068,7 +1073,11 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) if ( out.nDepth > oldestTxDepth ) oldestTxDepth = out.nDepth; } - oldestTxDepth = oldestTxDepth + 1; // add extra 10 blocks just for safety. + oldestTxDepth = oldestTxDepth + 1; // add extra block just for safety. + // lock all the previouly locked coins. + BOOST_FOREACH(COutPoint &outpt, vOutpts) { + pwalletMain->LockCoin(outpt); + } // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) From 805ea3594f77cdcef7bba926268c09be8f5fe27f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 21 Nov 2018 18:23:02 +0800 Subject: [PATCH 0644/4463] fix --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 00222f116..ac64027d6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1075,7 +1075,7 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) } oldestTxDepth = oldestTxDepth + 1; // add extra block just for safety. // lock all the previouly locked coins. - BOOST_FOREACH(COutPoint &outpt, vOutpts) { + BOOST_FOREACH(COutPoint &outpt, vLockedUTXO) { pwalletMain->LockCoin(outpt); } From f72c3ba1d27e3e8d4dc7e0f19ed0138c4965ba5c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 22 Nov 2018 16:51:34 +0800 Subject: [PATCH 0645/4463] fix --- src/komodo.h | 6 ++++-- src/rpcmisc.cpp | 8 ++++++++ src/rpcserver.cpp | 1 + src/rpcserver.h | 1 + src/wallet/rpcwallet.cpp | 9 +++++++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e6c9a8c54..5b1bfe1ac 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -811,9 +811,11 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) return; } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); - if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 || IS_STAKED_NOTARY != -1 ) { + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) + { staked_era = STAKED_era(pindex->GetBlockTime()); - if ( staked_era != lastStakedEra ) { + if ( staked_era != lastStakedEra ) + { uint8_t tmp_pubkeys[64][33]; int8_t numSN = numStakedNotaries(tmp_pubkeys,staked_era); UpdateNotaryAddrs(tmp_pubkeys,numSN); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index e51a50a97..f85705a90 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -64,6 +64,14 @@ extern uint32_t ASSETCHAINS_MAGIC; extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[]; +UniValue getiguanajson(const UniValue& params, bool fHelp) +{ + if ( params.size() != 1 ) + throw runtime_error("please supply old staked.json!\n"); + UniValue json = params[0].get_obj(); + return json; +} + UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 65f12a346..dc0ebd465 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -263,6 +263,7 @@ static const CRPCCommand vRPCCommands[] = /* Overall control/query calls */ { "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */ { "control", "help", &help, true }, + { "control", "getiguanajson", &getiguanajson, true }, { "control", "stop", &stop, true }, /* P2P networking */ diff --git a/src/rpcserver.h b/src/rpcserver.h index f7fa65942..2ae1e8de1 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -324,6 +324,7 @@ extern UniValue walletlock(const UniValue& params, bool fHelp); extern UniValue encryptwallet(const UniValue& params, bool fHelp); extern UniValue validateaddress(const UniValue& params, bool fHelp); extern UniValue getinfo(const UniValue& params, bool fHelp); +extern UniValue getiguanajson(const UniValue& params, bool fHelp); extern UniValue setpubkey(const UniValue& params, bool fHelp); extern UniValue getwalletinfo(const UniValue& params, bool fHelp); extern UniValue getblockchaininfo(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a5c8bdaff..d6a06525d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1061,6 +1061,11 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) } else { + // get all locked utxos to relock them later. + vector vLockedUTXO; + pwalletMain->ListLockedCoins(vLockedUTXO); + // unlock all coins so that the following call containes all utxos. + pwalletMain->UnlockAllCoins(); // listunspent call... this gets us all the txids that are unspent, we search this list for the oldest tx, vector vecOutputs; assert(pwalletMain != NULL); @@ -1072,6 +1077,10 @@ UniValue cleanwallettransactions(const UniValue& params, bool fHelp) oldestTxDepth = out.nDepth; } oldestTxDepth = oldestTxDepth + 1; // add extra block just for safety. + // lock all the previouly locked coins. + BOOST_FOREACH(COutPoint &outpt, vLockedUTXO) { + pwalletMain->LockCoin(outpt); + } // then add all txs in the wallet before this block to the list to remove. for (map::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) From 06659e51f2ba27e7a022ea0cd29d7b1f7723f7bb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 22 Nov 2018 16:55:14 +0800 Subject: [PATCH 0646/4463] remove wrong +1 fix --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 590e3569f..840705d2d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3189,7 +3189,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } } - if ( ( block.vtx[0].GetValueOut() > blockReward+1 && is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) || ( block.vtx[0].GetValueOut() > blockReward ) ) + if ( ( block.vtx[0].GetValueOut() > blockReward+1 ) { if ( ASSETCHAINS_SYMBOL[0] != 0 || pindex->nHeight >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward ) { From ec8f86f89db78e29f1898fc5d36dd9e93fef82b7 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Thu, 22 Nov 2018 11:05:39 +0100 Subject: [PATCH 0647/4463] update ERA2 --- src/notaries_staked.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index bb2289a17..ae2646e9e 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -40,20 +40,25 @@ const char *notaries_STAKED2[][2] = {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 + {"CrisF", "024d19acf0d5de212cdd50326cd143292545d366a71b2b9c6df9f2110de2dfa1f2" }, //RKtAD2kyRRMx4EiG1eeTNprF5h2nmGbzzu + {"smk762", "0330e8fbdb6d560095d33da86a139c755b7896eb5b85239966fa7b235db16d4037" }, // RFB8zewwMNcLMPuQ84B6PofxJBBsuYxiN8 + {"jorian", "0288e682c1ac449f1b85c4acb2d0bcd216d5df34c15fd18b8a8dd5fa64b8ece8ef" }, // RR1yT5aB19VwFoUCGTW4q4pk4qmhHEEE4t {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN + {"greentea", "02054c14ae81838a063d22a75eaa3c961415f6825a57c8b8e4148d19dad64f128e" }, // REF7R76WpL1v7nSXjjiNHtRa2xYtq5qk1p + {"CMaurice", "025830ce81bd1301fb67d5872344efa7a9ff99ae85fe1234f18c085db9072b740f" }, // RX7pXUaV24xFn6DVKV8t3PrRF3gKw6TBjf {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s + {"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t + {"zatJUM", "030fff499b6dc0215344b28a0b6b4becdfb00cd34cd1b36b983ec14f47965fd4bc" }, // RSoEDLBasth7anxS8gbkg6KgeGiz8rhqv1 + {"dwy", "03669457b2934d98b5761121dd01b243aed336479625b293be9f8c43a6ae7aaeff" }, // RKhZMqRF361FSGFAzstP5AhozekPjoVh5q + {"dukeleto", "03e4322510ee46d417b8382fe124f5a381a3cef6aef08f8a4e90c66a42a04b4015" }, // RB8vS1fkGuttoNYkA2B1ivNn8vhqbCEqbe + {"gcharang", "03336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8" }, // RJYiWn3FRCSSLf9Pe5RJcbrKQYosaMburP + {"ca333", "03a18a33313ccdbf3c9778776e33c423e073ff5833fa1de092ce9e921de52f22f6" }, // RX333A56jWdeW15MwZsaW3mHxGaDu2Yutp + {"computergenie", "03448ce28fb21748e8b05bbe32d6b1e758b589ac1eb359e5d552f8868f2b75dc92" }, // RGeniexxkjnR34hg7ZnCf36kmfuJusf6rE }; int num_notaries_STAKED2 = (sizeof(notaries_STAKED2)/sizeof(*notaries_STAKED2)); From 7d13c2e5a0b4eadb56d87433ebb5254daea2a6aa Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 22 Nov 2018 19:49:49 +0800 Subject: [PATCH 0648/4463] add getiguanajson RPC, for ERA2 only at this stage. --- src/notaries_staked.cpp | 24 ++++++++++++++++------ src/notaries_staked.h | 11 ++++++---- src/rpcmisc.cpp | 45 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index ae2646e9e..65e71f0c6 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -10,6 +10,18 @@ extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t staked_mutex; extern uint8_t NOTARY_PUBKEY33[33],NUM_NOTARIES; +const char *iguanaSeeds[8][1] = +{ + {"80.240.17.222"}, + {"103.6.12.112"}, + {"18.224.176.46"}, + {"45.76.120.247"}, + {"103.6.12.112"}, + {"103.6.12.112"}, + {"103.6.12.112"}, + {"103.6.12.112"}, +}; + // Era 1 set of pubkeys const char *notaries_STAKED1[][2] = { @@ -113,9 +125,9 @@ int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4)); int8_t is_STAKED(const char *chain_name) { int STAKED = 0; - if ( (strcmp(chain_name, "STAKED") == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) + if ( (strcmp(chain_name, "LABS") == 0) || (strncmp(chain_name, "LABS", 4) == 0) ) STAKED = 1; - else if ( (strcmp(chain_name, "STKD") == 0) || (strncmp(chain_name, "STKD", 4) == 0) ) + else if ( (strcmp(chain_name, "LAB") == 0) || (strncmp(chain_name, "LAB", 3) == 0) ) STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; @@ -126,13 +138,13 @@ int8_t is_STAKED(const char *chain_name) { int32_t STAKED_era(int timestamp) { int8_t era = 0; - if (timestamp <= STAKED_NOTARIES_TIMESTAMP1) + if (timestamp <= STAKED_NOTARIES_TIMESTAMP[0]) era = 1; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP)) + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP[1] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[0] + STAKED_ERA_GAP)) era = 2; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= (STAKED_NOTARIES_TIMESTAMP2 + STAKED_ERA_GAP)) + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP[2] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[1] + STAKED_ERA_GAP)) era = 3; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP)) + else if (timestamp <= STAKED_NOTARIES_TIMESTAMP[3] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[2] + STAKED_ERA_GAP)) era = 4; else era = 0; diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 51124be23..f71f75264 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -5,12 +5,15 @@ #include "crosschain.h" #include "cc/CCinclude.h" +static const int32_t iguanaPort = 9997; +static const int8_t BTCminsigs = 13; +static const int8_t overrideMinSigs = 0; +extern const char *iguanaSeeds[8][1]; + static const int STAKED_ERA_GAP = 777; -static const int STAKED_NOTARIES_TIMESTAMP1 = 1604211111; -static const int STAKED_NOTARIES_TIMESTAMP2 = 1604222222; -static const int STAKED_NOTARIES_TIMESTAMP3 = 1604233333; -static const int STAKED_NOTARIES_TIMESTAMP4 = 1604244444; +static const int NUM_STAKED_ERAS = 4; +static const int STAKED_NOTARIES_TIMESTAMP[NUM_STAKED_ERAS] = {1542885514, 1604222222, 1604233333, 1604244444}; extern const char *notaries_STAKED1[][2]; extern int num_notaries_STAKED1; diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index f85705a90..965286d6b 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -66,9 +66,48 @@ extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[ UniValue getiguanajson(const UniValue& params, bool fHelp) { - if ( params.size() != 1 ) - throw runtime_error("please supply old staked.json!\n"); - UniValue json = params[0].get_obj(); + if (fHelp || params.size() != 0) + throw runtime_error("getiguanajson\nreturns json for iguana, for the current ERA."); + + UniValue json(UniValue::VOBJ); + UniValue seeds(UniValue::VARR); + UniValue notaries(UniValue::VARR); + // get the current era, use local time for now. + // should ideally take blocktime of last known block. + int now = time(NULL); int32_t era; + for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) { + if ( now <= STAKED_NOTARIES_TIMESTAMP[i] ) { + era = i + 1; + break; + } + } + if ( era != 2 ) + throw runtime_error("its not era2 yet!"); + + // loop over seeds array and push back to json array for seeds + for (int8_t i = 0; i < 8; i++) { + seeds.push_back(iguanaSeeds[i][0]); + } + + // loop over era's notaries and push back each pair to the notary array + for (int8_t i = 0; i < num_notaries_STAKED2; i++) { + UniValue notary(UniValue::VOBJ); + notary.push_back(Pair(notaries_STAKED2[i][0],notaries_STAKED2[i][1])); + notaries.push_back(notary); + } + + // get the min sigs + int minsigs; + if ( num_notaries_STAKED2/5 > overrideMinSigs ) + minsigs = (num_notaries_STAKED2 + 4) / 5; + else + minsigs = overrideMinSigs; + + json.push_back(Pair("port",iguanaPort)); + json.push_back(Pair("BTCminsigs",BTCminsigs)); + json.push_back(Pair("minsigs",minsigs)); + json.push_back(Pair("seeds", seeds)); + json.push_back(Pair("notaries",notaries)); return json; } From 03c35656685cff2ff1db602fc2d025a47ba8c2c3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 22 Nov 2018 19:51:13 +0800 Subject: [PATCH 0649/4463] fix ( --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 840705d2d..903b07a65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3189,7 +3189,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } } - if ( ( block.vtx[0].GetValueOut() > blockReward+1 ) + if ( block.vtx[0].GetValueOut() > blockReward+1 ) { if ( ASSETCHAINS_SYMBOL[0] != 0 || pindex->nHeight >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward ) { From 5bbc803ee844b8d977b62609b0e9fab293aabbed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 22 Nov 2018 23:05:15 +0800 Subject: [PATCH 0650/4463] refactor to use 3d array of pubkeys --- src/notaries_staked.cpp | 236 +++++++--------------------------------- src/notaries_staked.h | 113 ++++++++++++++++--- src/rpcmisc.cpp | 12 +- 3 files changed, 146 insertions(+), 215 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 65e71f0c6..19fe06b81 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -10,119 +10,6 @@ extern int32_t STAKED_ERA,IS_STAKED_NOTARY,IS_KOMODO_NOTARY; extern pthread_mutex_t staked_mutex; extern uint8_t NOTARY_PUBKEY33[33],NUM_NOTARIES; -const char *iguanaSeeds[8][1] = -{ - {"80.240.17.222"}, - {"103.6.12.112"}, - {"18.224.176.46"}, - {"45.76.120.247"}, - {"103.6.12.112"}, - {"103.6.12.112"}, - {"103.6.12.112"}, - {"103.6.12.112"}, -}; - -// Era 1 set of pubkeys -const char *notaries_STAKED1[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; - -int num_notaries_STAKED1 = (sizeof(notaries_STAKED1)/sizeof(*notaries_STAKED1)); - -// Era 2 set of pubkeys -const char *notaries_STAKED2[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "024d19acf0d5de212cdd50326cd143292545d366a71b2b9c6df9f2110de2dfa1f2" }, //RKtAD2kyRRMx4EiG1eeTNprF5h2nmGbzzu - {"smk762", "0330e8fbdb6d560095d33da86a139c755b7896eb5b85239966fa7b235db16d4037" }, // RFB8zewwMNcLMPuQ84B6PofxJBBsuYxiN8 - {"jorian", "0288e682c1ac449f1b85c4acb2d0bcd216d5df34c15fd18b8a8dd5fa64b8ece8ef" }, // RR1yT5aB19VwFoUCGTW4q4pk4qmhHEEE4t - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"greentea", "02054c14ae81838a063d22a75eaa3c961415f6825a57c8b8e4148d19dad64f128e" }, // REF7R76WpL1v7nSXjjiNHtRa2xYtq5qk1p - {"CMaurice", "025830ce81bd1301fb67d5872344efa7a9ff99ae85fe1234f18c085db9072b740f" }, // RX7pXUaV24xFn6DVKV8t3PrRF3gKw6TBjf - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t - {"zatJUM", "030fff499b6dc0215344b28a0b6b4becdfb00cd34cd1b36b983ec14f47965fd4bc" }, // RSoEDLBasth7anxS8gbkg6KgeGiz8rhqv1 - {"dwy", "03669457b2934d98b5761121dd01b243aed336479625b293be9f8c43a6ae7aaeff" }, // RKhZMqRF361FSGFAzstP5AhozekPjoVh5q - {"dukeleto", "03e4322510ee46d417b8382fe124f5a381a3cef6aef08f8a4e90c66a42a04b4015" }, // RB8vS1fkGuttoNYkA2B1ivNn8vhqbCEqbe - {"gcharang", "03336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8" }, // RJYiWn3FRCSSLf9Pe5RJcbrKQYosaMburP - {"ca333", "03a18a33313ccdbf3c9778776e33c423e073ff5833fa1de092ce9e921de52f22f6" }, // RX333A56jWdeW15MwZsaW3mHxGaDu2Yutp - {"computergenie", "03448ce28fb21748e8b05bbe32d6b1e758b589ac1eb359e5d552f8868f2b75dc92" }, // RGeniexxkjnR34hg7ZnCf36kmfuJusf6rE -}; - -int num_notaries_STAKED2 = (sizeof(notaries_STAKED2)/sizeof(*notaries_STAKED2)); - -// Era 3 set of pubkeys -const char *notaries_STAKED3[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; - -int num_notaries_STAKED3 = (sizeof(notaries_STAKED3)/sizeof(*notaries_STAKED3)); - -// Era 4 set of pubkeys -const char *notaries_STAKED4[][2] = -{ - {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x - {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg - {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ - {"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9 - {"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8 - {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev - {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 - {"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL - {"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 - {"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu - {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx - {"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca - {"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5 - {"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s -}; - -int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4)); - int8_t is_STAKED(const char *chain_name) { int STAKED = 0; if ( (strcmp(chain_name, "LABS") == 0) || (strncmp(chain_name, "LABS", 4) == 0) ) @@ -137,19 +24,16 @@ int8_t is_STAKED(const char *chain_name) { int32_t STAKED_era(int timestamp) { - int8_t era = 0; - if (timestamp <= STAKED_NOTARIES_TIMESTAMP[0]) - era = 1; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP[1] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[0] + STAKED_ERA_GAP)) - era = 2; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP[2] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[1] + STAKED_ERA_GAP)) - era = 3; - else if (timestamp <= STAKED_NOTARIES_TIMESTAMP[3] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[2] + STAKED_ERA_GAP)) - era = 4; - else - era = 0; + int8_t era = 0; + if (timestamp <= STAKED_NOTARIES_TIMESTAMP[0]) + return(1); + for (int32_t i = 1; i < NUM_STAKED_ERAS; i++) + { + if (timestamp <= STAKED_NOTARIES_TIMESTAMP[i] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[i-1] + STAKED_ERA_GAP)) + return(i); + } // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. - return(era); + return(0); }; #ifdef SERVER @@ -169,24 +53,16 @@ int8_t updateStakedNotary() { #endif int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { - int8_t notaryID = -1; - if ( STAKED_ERA != 0 ) { - switch (STAKED_ERA) { - case 1: - notaryID = ScanStakedArray(notaries_STAKED1,num_notaries_STAKED1,Raddress,notaryname); - break; - case 2: - notaryID = ScanStakedArray(notaries_STAKED2,num_notaries_STAKED2,Raddress,notaryname); - break; - case 3: - notaryID = ScanStakedArray(notaries_STAKED3,num_notaries_STAKED3,Raddress,notaryname); - break; - case 4: - notaryID = ScanStakedArray(notaries_STAKED4,num_notaries_STAKED4,Raddress,notaryname); - break; - } + if ( STAKED_ERA != 0 ) + { + for (int8_t i = 0; i < num_notaries_STAKED[STAKED_ERA-1]; i++) { + if ( strcmp(Raddress,NOTARYADDRS[i]) == 0 ) { + notaryname.assign(notaries_STAKED[STAKED_ERA-1][i][0]); + return(i); + } + } } - return(notaryID); + return(-1); } int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { @@ -208,50 +84,50 @@ int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) { case 1: if ( didstaked1 == 0 ) { - for (i=0; i overrideMinSigs ) - minsigs = (num_notaries_STAKED2 + 4) / 5; + if ( num_notaries_STAKED[era]/5 > overrideMinSigs ) + minsigs = (num_notaries_STAKED[era] + 4) / 5; else minsigs = overrideMinSigs; From e232fd00498c4e3c844f0200540a71f5abdf5cd1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 00:02:46 +0800 Subject: [PATCH 0651/4463] fix new era function --- src/notaries_staked.cpp | 4 ++-- src/rpcmisc.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index 19fe06b81..d29d5dfb2 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -18,7 +18,7 @@ int8_t is_STAKED(const char *chain_name) { STAKED = 2; else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) STAKED = 3; - //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + //fprintf(stderr, "This chain is: %s which is: %d\n", chain_name,STAKED); return(STAKED); }; @@ -30,7 +30,7 @@ int32_t STAKED_era(int timestamp) for (int32_t i = 1; i < NUM_STAKED_ERAS; i++) { if (timestamp <= STAKED_NOTARIES_TIMESTAMP[i] && timestamp >= (STAKED_NOTARIES_TIMESTAMP[i-1] + STAKED_ERA_GAP)) - return(i); + return(i+1); } // if we are in a gap, return era 0, this allows to invalidate notarizations when in GAP. return(0); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 1a5095823..a8f1830ff 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -109,6 +109,8 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) return json; } + + UniValue getinfo(const UniValue& params, bool fHelp) { uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height; From 1dfb6457a1b533335e84689dee9dd99c6ffb22ca Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 00:17:57 +0800 Subject: [PATCH 0652/4463] fix --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 5b1bfe1ac..e58fe9be6 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -811,7 +811,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) return; } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); - if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) + if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 || IS_STAKED_NOTARY > -1 ) { staked_era = STAKED_era(pindex->GetBlockTime()); if ( staked_era != lastStakedEra ) From f24352c4a21f58d96f7c4b08ee038fdcda1662b1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 01:28:05 +0800 Subject: [PATCH 0653/4463] revert era to 1 --- src/notaries_staked.h | 2 +- src/rpcmisc.cpp | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index a931abdf7..0c2a7eb22 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -23,7 +23,7 @@ static const char *iguanaSeeds[8][1] = static const int STAKED_ERA_GAP = 777; static const int NUM_STAKED_ERAS = 4; -static const int STAKED_NOTARIES_TIMESTAMP[NUM_STAKED_ERAS] = {1542885514, 1604222222, 1604233333, 1604244444}; +static const int STAKED_NOTARIES_TIMESTAMP[NUM_STAKED_ERAS] = {1604111111, 1604222222, 1604233333, 1604244444}; // Era array of pubkeys. static const char *notaries_STAKED[NUM_STAKED_ERAS][64][2] = diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index a8f1830ff..4160da730 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -109,7 +109,28 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) return json; } - +UniValue getnotarysendmany(const UniValue& params, bool fHelp) +{ + if (fHelp || params.size() != 1) + throw runtime_error("getnotarysendmany\n "); + // era + int32_t era = params[0].get_int() - 1; + if ( era < 0 || era > NUM_STAKED_ERAS ) + throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); + // Amount + CAmount nAmount = AmountFromValue(params[1]); + if (nAmount <= 0) + throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); + UniValue ret(UniValue::VOBJ) + for (int i = 0; i Date: Fri, 23 Nov 2018 01:29:52 +0800 Subject: [PATCH 0654/4463] fix --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 4160da730..a9ce7ffd8 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -121,7 +121,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) CAmount nAmount = AmountFromValue(params[1]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); - UniValue ret(UniValue::VOBJ) + UniValue ret(UniValue::VOBJ); for (int i = 0; i Date: Fri, 23 Nov 2018 02:32:25 +0800 Subject: [PATCH 0655/4463] try this --- src/notarisationdb.cpp | 1 + src/rpcserver.cpp | 1 + src/rpcserver.h | 1 + 3 files changed, 3 insertions(+) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index f551edf3f..a4efa8b24 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -50,6 +50,7 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight) // pass era slection off to notaries_staked.cpp file auth_STAKED = Choose_auth_STAKED(staked_era); } + printf("minsigs.%i era.%i authsize.%i\n",auth_STAKED.requiredSigs,staked_era,auth_STAKED.size); if (!CheckTxAuthority(tx, auth_STAKED)) continue; printf("Authorised notarisation data for %s \n",data.symbol); diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index dc0ebd465..d4143fcfb 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -264,6 +264,7 @@ static const CRPCCommand vRPCCommands[] = { "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */ { "control", "help", &help, true }, { "control", "getiguanajson", &getiguanajson, true }, + { "control", "getnotarysendmany", &getnotarysendmany, true }, { "control", "stop", &stop, true }, /* P2P networking */ diff --git a/src/rpcserver.h b/src/rpcserver.h index 2ae1e8de1..9ab033d12 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -325,6 +325,7 @@ extern UniValue encryptwallet(const UniValue& params, bool fHelp); extern UniValue validateaddress(const UniValue& params, bool fHelp); extern UniValue getinfo(const UniValue& params, bool fHelp); extern UniValue getiguanajson(const UniValue& params, bool fHelp); +extern UniValue getnotarysendmany(const UniValue& params, bool fHelp); extern UniValue setpubkey(const UniValue& params, bool fHelp); extern UniValue getwalletinfo(const UniValue& params, bool fHelp); extern UniValue getblockchaininfo(const UniValue& params, bool fHelp); From eb533cf7d7975fea498d3dc6fc8c7d1fd653c67e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 02:42:57 +0800 Subject: [PATCH 0656/4463] fix? --- src/crosschain.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain.h b/src/crosschain.h index c186d5161..b59037cc8 100644 --- a/src/crosschain.h +++ b/src/crosschain.h @@ -9,8 +9,8 @@ const int CROSSCHAIN_STAKED = 3; typedef struct CrosschainAuthority { uint8_t notaries[64][33]; - size_t size; - size_t requiredSigs; + int8_t size; + int8_t requiredSigs; } CrosschainAuthority; int GetSymbolAuthority(const char* symbol); From 46f857e7300d349df264a3567557958d0f868c6e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 03:04:30 +0800 Subject: [PATCH 0657/4463] try --- src/crosschain_authority.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 8116b2887..c43639836 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -42,10 +42,14 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (!seen[i]) { if (memcmp(pk, auth.notaries[i], 33) == 0) { seen[i] = 1; + printf("seennotary..%i\n",i); goto found; + } else { + printf("notary.%i is not valid!\n",i); } } } + return false; found:; } From f6c1f9803821d0f911c95ae49bf0b05cf971b8c2 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 03:09:15 +0800 Subject: [PATCH 0658/4463] fix --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index a9ce7ffd8..d3dd9a569 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -111,7 +111,7 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - if (fHelp || params.size() != 1) + if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany\n "); // era int32_t era = params[0].get_int() - 1; From 141cca7fa7de59c0298a3f40a6cfb8e95992021e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 03:33:04 +0800 Subject: [PATCH 0659/4463] try --- src/crosschain_authority.cpp | 2 +- src/rpcmisc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index c43639836..262a70c40 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -42,7 +42,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (!seen[i]) { if (memcmp(pk, auth.notaries[i], 33) == 0) { seen[i] = 1; - printf("seennotary..%i\n",i); + printf("seennotary.%i\n",i); goto found; } else { printf("notary.%i is not valid!\n",i); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index d3dd9a569..5deaf15c1 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -114,7 +114,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany\n "); // era - int32_t era = params[0].get_int() - 1; + int32_t era = (int)params[0] - 1; if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); // Amount From d7d0047b8f4a4b1d0b777c1458eff885d1f6a1cf Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 03:58:04 +0800 Subject: [PATCH 0660/4463] try --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 5deaf15c1..89c66355f 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -114,7 +114,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany\n "); // era - int32_t era = (int)params[0] - 1; + int32_t era = params[0] - 1; if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); // Amount From 84c5374aaa307feeb252829676cd372e51ef8019 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:03:27 +0800 Subject: [PATCH 0661/4463] try --- src/rpcmisc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 89c66355f..64537d401 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -112,13 +112,13 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 2) - throw runtime_error("getnotarysendmany\n "); + throw runtime_error("getnotarysendmany "); // era - int32_t era = params[0] - 1; + int32_t era = params[1].get_int() - 1; if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); // Amount - CAmount nAmount = AmountFromValue(params[1]); + CAmount nAmount = AmountFromValue(params[0]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); UniValue ret(UniValue::VOBJ); From 504d318eac432298d03ece964c9689271c9e67b8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:08:49 +0800 Subject: [PATCH 0662/4463] try --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 64537d401..0ffe4ecf6 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -114,7 +114,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany "); // era - int32_t era = params[1].get_int() - 1; + era = params[1].get_int() - 1; if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); // Amount From a632f010dd202868d2f21eb89b7776848e28510f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:10:18 +0800 Subject: [PATCH 0663/4463] try --- src/rpcmisc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 0ffe4ecf6..f323a73ce 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -114,6 +114,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany "); // era + int era = 1; era = params[1].get_int() - 1; if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); From 918ba2b923a812cd93a7a4b3caf630da6b5afc29 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:15:53 +0800 Subject: [PATCH 0664/4463] try --- src/rpcmisc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index f323a73ce..003c39bde 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -114,8 +114,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany "); // era - int era = 1; - era = params[1].get_int() - 1; + int era = ValueFromAmount(AmountFromValue(params[1])); if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); // Amount From 9168011a9a74ff5e174a57d9a786c8e5c64d5eed Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:18:14 +0800 Subject: [PATCH 0665/4463] fix --- src/rpcmisc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 003c39bde..91faf6221 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -114,7 +114,8 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) if (fHelp || params.size() != 2) throw runtime_error("getnotarysendmany "); // era - int era = ValueFromAmount(AmountFromValue(params[1])); + int era = AmountFromValue(params[1]); + printf("%i\n",era ); if ( era < 0 || era > NUM_STAKED_ERAS ) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); // Amount From 85a7b3b92a327c4589b588ae7c3a6be12357af6e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:26:07 +0800 Subject: [PATCH 0666/4463] try --- src/rpcmisc.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 91faf6221..6413f4ee0 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -64,6 +64,16 @@ extern uint32_t ASSETCHAINS_MAGIC; extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[]; +int32_t getera(int now) +{ + for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) { + if ( now <= STAKED_NOTARIES_TIMESTAMP[i] ) { + era = i; + break; + } + } +} + UniValue getiguanajson(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) @@ -74,13 +84,8 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue notaries(UniValue::VARR); // get the current era, use local time for now. // should ideally take blocktime of last known block. - int now = time(NULL); int32_t era; - for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) { - if ( now <= STAKED_NOTARIES_TIMESTAMP[i] ) { - era = i; - break; - } - } + int now = time(NULL); + int32_t era = getera(now); // loop over seeds array and push back to json array for seeds for (int8_t i = 0; i < 8; i++) { @@ -111,13 +116,10 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - if (fHelp || params.size() != 2) - throw runtime_error("getnotarysendmany "); + if (fHelp || params.size() != 1) + throw runtime_error("getnotarysendmany "); // era - int era = AmountFromValue(params[1]); - printf("%i\n",era ); - if ( era < 0 || era > NUM_STAKED_ERAS ) - throw JSONRPCError(RPC_TYPE_ERROR, "Invalid era"); + int32_t era = getera(time(NULL)); // Amount CAmount nAmount = AmountFromValue(params[0]); if (nAmount <= 0) From 8c8c1a5aeae33303146f630a49420acf45089409 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:27:18 +0800 Subject: [PATCH 0667/4463] fix --- src/rpcmisc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 6413f4ee0..bd05635f6 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -68,8 +68,7 @@ int32_t getera(int now) { for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) { if ( now <= STAKED_NOTARIES_TIMESTAMP[i] ) { - era = i; - break; + return(i); } } } From a89c137047fc4417c0331b74db6ce062d24067a8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 04:37:39 +0800 Subject: [PATCH 0668/4463] fix? --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index bd05635f6..063a71bed 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -126,7 +126,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) UniValue ret(UniValue::VOBJ); for (int i = 0; i Date: Fri, 23 Nov 2018 12:10:09 +0800 Subject: [PATCH 0669/4463] fix --- src/rpcmisc.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 063a71bed..5f1db9636 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -115,21 +115,32 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - if (fHelp || params.size() != 1) - throw runtime_error("getnotarysendmany "); - // era - int32_t era = getera(time(NULL)); + if (fHelp || params.size() > 2) + throw runtime_error( + "getnotarysendmany ( era amount_to_send )\n" + "\nReturn a sendmany array for all notary address in defined era.\n" + ); + int era = 0; + if (params.size() > 0) { + era = params[0].get_int(); + } + if (era < 0 || era > NUM_STAKED_ERAS) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "era is not valid"); + } // Amount - CAmount nAmount = AmountFromValue(params[0]); + if (params.size() > 1) + CAmount nAmount = AmountFromValue(params[1]); + if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); UniValue ret(UniValue::VOBJ); for (int i = 0; i Date: Fri, 23 Nov 2018 12:22:21 +0800 Subject: [PATCH 0670/4463] fix --- src/rpcmisc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 5f1db9636..864b23aac 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -120,6 +120,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) "getnotarysendmany ( era amount_to_send )\n" "\nReturn a sendmany array for all notary address in defined era.\n" ); + // era int era = 0; if (params.size() > 0) { era = params[0].get_int(); @@ -128,8 +129,9 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "era is not valid"); } // Amount + CAmount nAmount; if (params.size() > 1) - CAmount nAmount = AmountFromValue(params[1]); + nAmount = AmountFromValue(params[1]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); From deab4769eec95eda79e826e89d9b8a8f94d89f42 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 12:35:11 +0800 Subject: [PATCH 0671/4463] try --- src/rpcmisc.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 864b23aac..bd1c4ade8 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -115,23 +115,15 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - if (fHelp || params.size() > 2) + if (fHelp || params.size() != 1) throw runtime_error( - "getnotarysendmany ( era amount_to_send )\n" - "\nReturn a sendmany array for all notary address in defined era.\n" + "getnotarysendmany ( amount_to_send )\n" + "\nReturn a sendmany array for all notary address in current era.\n" ); // era - int era = 0; - if (params.size() > 0) { - era = params[0].get_int(); - } - if (era < 0 || era > NUM_STAKED_ERAS) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "era is not valid"); - } + int era = getera(time(NULL)); // Amount - CAmount nAmount; - if (params.size() > 1) - nAmount = AmountFromValue(params[1]); + CAmount nAmount = AmountFromValue(params[1]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); From 537d2f88216d3951b6f000750a9c45f71033d569 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 12:39:53 +0800 Subject: [PATCH 0672/4463] fix --- src/rpcmisc.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index bd1c4ade8..3583fe590 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -115,15 +115,23 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - if (fHelp || params.size() != 1) + if (fHelp || params.size() > 3) throw runtime_error( - "getnotarysendmany ( amount_to_send )\n" - "\nReturn a sendmany array for all notary address in current era.\n" + "getnotarysendmany ( all era amount_to_send )\n" + "\nReturn a sendmany array for all notary address in defined era.\n" ); - // era - int era = getera(time(NULL)); + // era: + int era = 0; + if (params.size() > 0) { + era = params[1].get_int(); + } + if (era < 0 || era > NUM_STAKED_ERAS) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "era is not valid"); + } // Amount - CAmount nAmount = AmountFromValue(params[1]); + CAmount nAmount; + if (params.size() > 1) + nAmount = AmountFromValue(params[2]); if (nAmount <= 0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); From a959c865b824ecf46fbdd8364eb87444b499c5c4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 12:43:25 +0800 Subject: [PATCH 0673/4463] wtf?!?! --- src/rpcmisc.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 3583fe590..499eafea0 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -115,26 +115,12 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - if (fHelp || params.size() > 3) - throw runtime_error( - "getnotarysendmany ( all era amount_to_send )\n" - "\nReturn a sendmany array for all notary address in defined era.\n" - ); - // era: - int era = 0; - if (params.size() > 0) { - era = params[1].get_int(); - } - if (era < 0 || era > NUM_STAKED_ERAS) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "era is not valid"); - } - // Amount - CAmount nAmount; - if (params.size() > 1) - nAmount = AmountFromValue(params[2]); - if (nAmount <= 0) - throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send"); + // era: + int era = getera(time(NULL)); + // Amount + CAmount nAmount = AmountFromValue(10); + UniValue ret(UniValue::VOBJ); for (int i = 0; i Date: Fri, 23 Nov 2018 13:02:21 +0800 Subject: [PATCH 0674/4463] fix --- src/crosschain_authority.cpp | 2 +- src/rpcmisc.cpp | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 262a70c40..f7f51c8df 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -45,7 +45,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) printf("seennotary.%i\n",i); goto found; } else { - printf("notary.%i is not valid!\n",i); + //printf("notary.%i is not valid!\n",i); } } } diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 499eafea0..98bcf70d1 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -115,11 +115,7 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue getnotarysendmany(const UniValue& params, bool fHelp) { - - // era: int era = getera(time(NULL)); - // Amount - CAmount nAmount = AmountFromValue(10); UniValue ret(UniValue::VOBJ); for (int i = 0; i Date: Fri, 23 Nov 2018 13:14:04 +0800 Subject: [PATCH 0675/4463] fix --- src/rpcmisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 98bcf70d1..9be0af7c0 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -123,7 +123,7 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp) char Raddress[18]; uint8_t pubkey33[33]; decode_hex(pubkey33,33,(char *)notaries_STAKED[era][i][1]); pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); - ret.push_back(Pair(Raddress,(int)10); + ret.push_back(Pair(Raddress,(int)10)); } return ret; } From a8e89788c5869d0c61ec26a1dac31983a9294c71 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 15:17:02 +0800 Subject: [PATCH 0676/4463] change protocol version and ERA --- src/notaries_staked.h | 2 +- src/version.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 0c2a7eb22..9d0a3aae0 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -23,7 +23,7 @@ static const char *iguanaSeeds[8][1] = static const int STAKED_ERA_GAP = 777; static const int NUM_STAKED_ERAS = 4; -static const int STAKED_NOTARIES_TIMESTAMP[NUM_STAKED_ERAS] = {1604111111, 1604222222, 1604233333, 1604244444}; +static const int STAKED_NOTARIES_TIMESTAMP[NUM_STAKED_ERAS] = {1542964044, 1604222222, 1604233333, 1604244444}; // Era array of pubkeys. static const char *notaries_STAKED[NUM_STAKED_ERAS][64][2] = diff --git a/src/version.h b/src/version.h index aaa172403..633f2ec18 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 170005; +static const int PROTOCOL_VERSION = 170006; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -19,7 +19,7 @@ static const int GETHEADERS_VERSION = 31800; //! disconnect from peers older than this proto version static const int MIN_PEER_PROTO_VERSION = 170002; -static const int STAKEDMIN_PEER_PROTO_VERSION = 170005; +static const int STAKEDMIN_PEER_PROTO_VERSION = 170006; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this From 4ef4377c8b3e8085381b7629ecd92592d88c7736 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 15:25:55 +0800 Subject: [PATCH 0677/4463] change CrisF pubkey --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 9d0a3aae0..82b226ee6 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -51,7 +51,7 @@ static const char *notaries_STAKED[NUM_STAKED_ERAS][64][2] = {"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 - {"CrisF", "024d19acf0d5de212cdd50326cd143292545d366a71b2b9c6df9f2110de2dfa1f2" }, //RKtAD2kyRRMx4EiG1eeTNprF5h2nmGbzzu + {"CrisF", "024d19acf0d5de212cdd50326cd143292545d366a71b2b9c6df9f2110de2dfa1f2" }, // RKtAD2kyRRMx4EiG1eeTNprF5h2nmGbzzu {"smk762", "0330e8fbdb6d560095d33da86a139c755b7896eb5b85239966fa7b235db16d4037" }, // RFB8zewwMNcLMPuQ84B6PofxJBBsuYxiN8 {"jorian", "0288e682c1ac449f1b85c4acb2d0bcd216d5df34c15fd18b8a8dd5fa64b8ece8ef" }, // RR1yT5aB19VwFoUCGTW4q4pk4qmhHEEE4t {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev From aeaab7fb86d53cafec8640ca74fb6f329e873ba4 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 23 Nov 2018 22:39:57 +0800 Subject: [PATCH 0678/4463] fix dwy_merge for only 10ksat size p2pk --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d6a06525d..a05eede52 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4473,7 +4473,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) if (nValue > maximum_utxo_size) { continue; } else { - if (out.tx->vout[out.i].scriptPubKey.size() == 35) { + if (out.tx->vout[out.i].scriptPubKey.size() == 35 && nValue == 10000) { continue; } } From cbc4bd2bacef68ffc19f1ae68633819707f454e8 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 24 Nov 2018 12:32:52 +0800 Subject: [PATCH 0679/4463] add smk again, wrong key somehow --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 82b226ee6..8b1a1e945 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -52,7 +52,7 @@ static const char *notaries_STAKED[NUM_STAKED_ERAS][64][2] = {"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg {"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 {"CrisF", "024d19acf0d5de212cdd50326cd143292545d366a71b2b9c6df9f2110de2dfa1f2" }, // RKtAD2kyRRMx4EiG1eeTNprF5h2nmGbzzu - {"smk762", "0330e8fbdb6d560095d33da86a139c755b7896eb5b85239966fa7b235db16d4037" }, // RFB8zewwMNcLMPuQ84B6PofxJBBsuYxiN8 + {"smk762", "029f6c1f38c4d6825acb3b4b5147f7992e943b617cdaa0f4f5f36187e239d52d5a" }, // RPy6Xj2LWrxNoEW9YyREDgBZDZZ5qURXBU {"jorian", "0288e682c1ac449f1b85c4acb2d0bcd216d5df34c15fd18b8a8dd5fa64b8ece8ef" }, // RR1yT5aB19VwFoUCGTW4q4pk4qmhHEEE4t {"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev {"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6 From e341d1c1efc486d3350339409f4fad747563d741 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 24 Nov 2018 15:59:47 +0800 Subject: [PATCH 0680/4463] add kmdcrazy corret key --- src/notaries_staked.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notaries_staked.h b/src/notaries_staked.h index 8b1a1e945..b407e6412 100644 --- a/src/notaries_staked.h +++ b/src/notaries_staked.h @@ -62,7 +62,7 @@ static const char *notaries_STAKED[NUM_STAKED_ERAS][64][2] = {"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx {"greentea", "02054c14ae81838a063d22a75eaa3c961415f6825a57c8b8e4148d19dad64f128e" }, // REF7R76WpL1v7nSXjjiNHtRa2xYtq5qk1p {"CMaurice", "025830ce81bd1301fb67d5872344efa7a9ff99ae85fe1234f18c085db9072b740f" }, // RX7pXUaV24xFn6DVKV8t3PrRF3gKw6TBjf - {"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca + {"kmdkrazy", "02da444a2627d420f1f622fcdfb9bddb67d6d4241ad6b4d5054716ddbde8a25dfb" }, // RJPJBbHcm5mkAxhkkERHRfEE9Cvkr4Euoi {"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t {"zatJUM", "030fff499b6dc0215344b28a0b6b4becdfb00cd34cd1b36b983ec14f47965fd4bc" }, // RSoEDLBasth7anxS8gbkg6KgeGiz8rhqv1 {"dwy", "03669457b2934d98b5761121dd01b243aed336479625b293be9f8c43a6ae7aaeff" }, // RKhZMqRF361FSGFAzstP5AhozekPjoVh5q From bde984aee2fdfc09820a2cb0ebfb8dc6e2796f87 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 25 Nov 2018 00:16:00 +0800 Subject: [PATCH 0681/4463] jl77s peferct fix --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index cd415040a..c24ca2bde 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2017,6 +2017,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) bool IsInitialBlockDownload() { + return false; const CChainParams& chainParams = Params(); LOCK(cs_main); if (fImporting || fReindex) From 1c4dda372adf492da2988b846d5f91f2c7153162 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 25 Nov 2018 00:23:17 +0800 Subject: [PATCH 0682/4463] no boueno --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c24ca2bde..cd415040a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2017,7 +2017,6 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) bool IsInitialBlockDownload() { - return false; const CChainParams& chainParams = Params(); LOCK(cs_main); if (fImporting || fReindex) From 677170d4e5436ce9bae992d74ea58a25a9787e61 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 25 Nov 2018 12:20:31 +0100 Subject: [PATCH 0683/4463] add gitlab CI conf --- .gitlab-ci.yml | 164 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..1bbf7a699 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,164 @@ +stages: +- build +- test +######################################################################################################################## +####START#### PROJECT LEVEL VARIABLES ####START#### +######################################################################################################################## +variables: + PACKAGE_DIR_LINUX: linux64 + PACKAGE_DIR_WINDOWS: win64 + PACKAGE_DIR_MACOS: macos + AGAMA_ARTIFACTS_LINUX: ${PACKAGE_DIR_LINUX}.tar.gz + AGAMA_ARTIFACTS_WINDOWS: ${PACKAGE_DIR_WINDOWS}.zip + AGAMA_ARTIFACTS_MACOS: ${PACKAGE_DIR_MACOS}.tar.gz + AGAMA_ARTIFACTS_LINUX_CHECKSUM: ${AGAMA_ARTIFACTS_LINUX}.md5 + AGAMA_ARTIFACTS_WINDOWS_CHECKSUM: ${AGAMA_ARTIFACTS_WINDOWS}.md5 + AGAMA_ARTIFACTS_MACOS_CHECKSUM: ${AGAMA_ARTIFACTS_MACOS}.md5 + ARTIFACT_EXPIRATION: 1 week + +######################################################################################################################## +####END#### PROJECT LEVEL VARIABLES ####END#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####START#### Build Stage: compile and package komodo binaries for the Agama Wallet. ####START##### +######################################################################################################################## +######################################################################################################################## +####START#### LINUX ####START#### +######################################################################################################################## +build:ubuntu: + stage: build + image: ca333/komodo-builders:komodo-ubuntu + variables: + DOCKER_DRIVER: overlay2 + cache: + key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}" + paths: + - depends/built + script: + - zcutil/build.sh -j$(nproc) + - mkdir ${PACKAGE_DIR_LINUX} + - cp src/komodod + src/komodo-cli + ${PACKAGE_DIR_LINUX} + - chmod +x ${PACKAGE_DIR_LINUX}/komodod + - chmod +x ${PACKAGE_DIR_LINUX}/komodo-cli + - tar -czvf ${AGAMA_ARTIFACTS_LINUX} ${PACKAGE_DIR_LINUX} + - md5sum ${AGAMA_ARTIFACTS_LINUX} > ${AGAMA_ARTIFACTS_LINUX_CHECKSUM} + artifacts: + paths: + - ${AGAMA_ARTIFACTS_LINUX} + - ${AGAMA_ARTIFACTS_LINUX_CHECKSUM} + expire_in: 1 week + +######################################################################################################################## +####END#### LINUX ####END#### +######################################################################################################################## +####START#### WINDOWS ####START#### +######################################################################################################################## +build:windows: + stage: build + image: ca333/komodo-builders:komodo-windows + variables: + DOCKER_DRIVER: overlay2 + cache: + key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}" + paths: + - depends/built + script: + - zcutil/build-win.sh -j$(nproc) + - mkdir ${PACKAGE_DIR_WINDOWS} + - cp src/komodod.exe + src/komodo-cli.exe + src/komodo-tx.exe + ${PACKAGE_DIR_WINDOWS} + - zip -r ${PACKAGE_DIR_WINDOWS} + - md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} + artifacts: + paths: + - ${AGAMA_ARTIFACTS_WINDOWS} + - ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} + expire_in: 1 week +######################################################################################################################## +####END#### WINDOWS ####END#### +######################################################################################################################## +####START#### MACOS ####START#### +######################################################################################################################## +build:macos: + stage: build + tags: ["High Sierra"] + cache: + key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}" + paths: + - depends/built + script: + - zcutil/build-mac.sh -j$(sysctl -n hw.physicalcpu) + - ./makeRelease.sh ${PACKAGE_DIR_MACOS} + - tar -czvf ${AGAMA_ARTIFACTS_MACOS} ${PACKAGE_DIR_MACOS} + - md5sum ${AGAMA_ARTIFACTS_MACOS} > ${AGAMA_ARTIFACTS_MACOS_CHECKSUM} + artifacts: + paths: + - ${AGAMA_ARTIFACTS_MACOS} + - ${AGAMA_ARTIFACTS_MACOS_CHECKSUM} + expire_in: 1 week +######################################################################################################################## +####END#### MACOS ####END#### +######################################################################################################################## +######################################################################################################################## +####END#### Build Stage ####END#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####START#### Test stage: Produce code quality and static application security test reports. ####START#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####START#### Code Quality ####START#### +######################################################################################################################## +code_quality: + image: docker:stable + variables: + DOCKER_DRIVER: overlay2 + allow_failure: true + services: + - docker:stable-dind + script: + - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + - docker run + --env SOURCE_CODE="$PWD" + --volume "$PWD":/code + --volume /var/run/docker.sock:/var/run/docker.sock + "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code + artifacts: + paths: [gl-code-quality-report.json] +######################################################################################################################## +####END#### Code Quality ####END#### +######################################################################################################################## +######################################################################################################################## +####START#### Static Application Security Tests ####START#### +######################################################################################################################## +sast: + image: docker:stable + variables: + DOCKER_DRIVER: overlay2 + allow_failure: true + services: + - docker:stable-dind + script: + - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') + - docker run + --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" + --volume "$PWD:/code" + --volume /var/run/docker.sock:/var/run/docker.sock + "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code + artifacts: + paths: [gl-sast-report.json] +######################################################################################################################## +####END#### Static Application Security Tests ####END#### +######################################################################################################################## +######################################################################################################################## +######################################################################################################################## +####END#### Test stage ####END#### +######################################################################################################################## +######################################################################################################################## From f1fed89795a809ac84a84c2b42a45daa03394463 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 25 Nov 2018 13:31:53 +0100 Subject: [PATCH 0684/4463] fix CI zip archiver --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bbf7a699..3ace05cb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,7 +72,7 @@ build:windows: src/komodo-cli.exe src/komodo-tx.exe ${PACKAGE_DIR_WINDOWS} - - zip -r ${PACKAGE_DIR_WINDOWS} + - zip -r ${PACKAGE_DIR_WINDOWS}.zip ${PACKAGE_DIR_WINDOWS} - md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} artifacts: paths: From 73e64aa79c9c1b9d2c8b53a7e1505f1216a2bff3 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 25 Nov 2018 17:00:01 +0100 Subject: [PATCH 0685/4463] update gitlab CI conf --- .gitlab-ci.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f867ad6b..3ace05cb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,7 @@ variables: AGAMA_ARTIFACTS_WINDOWS_CHECKSUM: ${AGAMA_ARTIFACTS_WINDOWS}.md5 AGAMA_ARTIFACTS_MACOS_CHECKSUM: ${AGAMA_ARTIFACTS_MACOS}.md5 ARTIFACT_EXPIRATION: 1 week + ######################################################################################################################## ####END#### PROJECT LEVEL VARIABLES ####END#### ######################################################################################################################## @@ -27,7 +28,7 @@ variables: ######################################################################################################################## build:ubuntu: stage: build - image: asherd/komodo-builders:komodo-ubuntu + image: ca333/komodo-builders:komodo-ubuntu variables: DOCKER_DRIVER: overlay2 cache: @@ -48,7 +49,8 @@ build:ubuntu: paths: - ${AGAMA_ARTIFACTS_LINUX} - ${AGAMA_ARTIFACTS_LINUX_CHECKSUM} - expire_in: ${ARTIFACT_EXPIRATION} + expire_in: 1 week + ######################################################################################################################## ####END#### LINUX ####END#### ######################################################################################################################## @@ -56,7 +58,7 @@ build:ubuntu: ######################################################################################################################## build:windows: stage: build - image: asherd/komodo-builders:komodo-windows + image: ca333/komodo-builders:komodo-windows variables: DOCKER_DRIVER: overlay2 cache: @@ -65,18 +67,18 @@ build:windows: - depends/built script: - zcutil/build-win.sh -j$(nproc) - - mkdir ${PACKAGE_DIR_WINDOWS}. + - mkdir ${PACKAGE_DIR_WINDOWS} - cp src/komodod.exe src/komodo-cli.exe src/komodo-tx.exe ${PACKAGE_DIR_WINDOWS} - - zip -r ${PACKAGE_DIR_WINDOWS} + - zip -r ${PACKAGE_DIR_WINDOWS}.zip ${PACKAGE_DIR_WINDOWS} - md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} artifacts: paths: - ${AGAMA_ARTIFACTS_WINDOWS} - ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM} - expire_in: ${ARTIFACT_EXPIRATION} + expire_in: 1 week ######################################################################################################################## ####END#### WINDOWS ####END#### ######################################################################################################################## @@ -98,7 +100,7 @@ build:macos: paths: - ${AGAMA_ARTIFACTS_MACOS} - ${AGAMA_ARTIFACTS_MACOS_CHECKSUM} - expire_in: ${ARTIFACT_EXPIRATION} + expire_in: 1 week ######################################################################################################################## ####END#### MACOS ####END#### ######################################################################################################################## @@ -159,4 +161,4 @@ sast: ######################################################################################################################## ####END#### Test stage ####END#### ######################################################################################################################## -######################################################################################################################## \ No newline at end of file +######################################################################################################################## From 8a8fb052bde226f05007dbb9ab5fc109577c5175 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 25 Nov 2018 17:04:54 +0100 Subject: [PATCH 0686/4463] rename makeRelease.sh --- makeRelease.sh => makeReleaseMac.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename makeRelease.sh => makeReleaseMac.sh (100%) diff --git a/makeRelease.sh b/makeReleaseMac.sh similarity index 100% rename from makeRelease.sh rename to makeReleaseMac.sh From 7b7271aa452943abe27fc21c2e1f99affa5c0e2d Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 15:26:00 +0800 Subject: [PATCH 0687/4463] remove isinitialblockdl from tmpmempool and revert false as default --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index cd415040a..36624e624 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4313,7 +4313,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C const uint256 &hash = tx.GetHash(); if ( tx.vjoinsplit.size() == 0 ) { transactionsToRemove.push_back(tx); - tmpmempool.addUnchecked(hash,e,!IsInitialBlockDownload()); + tmpmempool.addUnchecked(hash,e,false); } } BOOST_FOREACH(const CTransaction& tx, transactionsToRemove) { From f4ff5f49b53d0ce3b1d9eeb47a9deed2c5105fc1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 15:31:54 +0800 Subject: [PATCH 0688/4463] fix --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 36624e624..33bd98928 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4313,7 +4313,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C const uint256 &hash = tx.GetHash(); if ( tx.vjoinsplit.size() == 0 ) { transactionsToRemove.push_back(tx); - tmpmempool.addUnchecked(hash,e,false); + tmpmempool.addUnchecked(hash,e,true); } } BOOST_FOREACH(const CTransaction& tx, transactionsToRemove) { From 7399a87134480f12a04ff7ba33017ce5e9a53dac Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 16:15:27 +0800 Subject: [PATCH 0689/4463] fix --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index 33bd98928..2b6966659 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4374,6 +4374,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C // here we add back all txs from the temp mempool to the main mempool. // which removes any tx locally that were invalid after the block arrives. int invalidtxs = 0; + LOCK(mempool.cs); BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx) { CTransaction tx = e.GetTx(); CValidationState state; bool fMissingInputs,fOverrideFees = false; From 7a25c614cf50353776e295be8a1583c0401f2734 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 20:52:50 +0800 Subject: [PATCH 0690/4463] speed up miner modifications? --- src/miner.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index aad8d0c44..fc0280868 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -105,6 +105,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, } #include "komodo_defs.h" +#define CRYPTO777_KMDADDR "RXL3YXG2ceaB6C5hfJcN4fvmLH2C34knhA" extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED; @@ -214,7 +215,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) nTotalIn += nValueIn; dPriority += (double)nValueIn * 1000; // flat multiplier } else { - int numNotaryVins = 0; + // TODO: It will be much faster here to just compare scriptpubkey! + CTxDestination ToAddress; int numNotaryVins = 0; bool fToCryptoAddress = false; + if (ExtractDestination(tx.vout[0].scriptPubKey, ToAddress)) { + if ( strcmp(CRYPTO777_KMDADDR,CBitcoinAddress(ToAddress).ToString().c_str()) == 0 ) + fToCryptoAddress = true; + } BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Read prev transaction @@ -253,7 +259,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) int nConf = nHeight - coins->nHeight; - if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 ) + if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 && fToCryptoAddress ) { uint256 hash; CTransaction tx1; CTxDestination address; if (GetTransaction(txin.prevout.hash,tx1,hash,false)) From f5746c6416a52e74f65ecfe93b61d8747774d50a Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 20:55:46 +0800 Subject: [PATCH 0691/4463] debug print --- src/miner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index fc0280868..0b38afa88 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -290,8 +290,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) CFeeRate feeRate(nTotalIn-tx.GetValueOut(), nTxSize); - if (fNotarisation) + if (fNotarisation) { dPriority = 1e16; + fprintf(stderr, "Notarisation.%s set to maximum priority.\n",tx.hash.ToString().c_str()); + } if (porphan) { From c3e81dab26d099f080cea0286c288f8a437481c3 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 20:58:12 +0800 Subject: [PATCH 0692/4463] fix --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 0b38afa88..012e89c95 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -292,7 +292,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) if (fNotarisation) { dPriority = 1e16; - fprintf(stderr, "Notarisation.%s set to maximum priority.\n",tx.hash.ToString().c_str()); + fprintf(stderr, "Notarisation.%s set to maximum priority.\n",hash.ToString().c_str()); } if (porphan) From d1fa5c68b426ce4cee0fb2c353e71e6ca98cd4ad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 21:36:41 +0800 Subject: [PATCH 0693/4463] more debug --- src/miner.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/miner.cpp b/src/miner.cpp index 012e89c95..3bbf928f4 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -218,6 +218,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) // TODO: It will be much faster here to just compare scriptpubkey! CTxDestination ToAddress; int numNotaryVins = 0; bool fToCryptoAddress = false; if (ExtractDestination(tx.vout[0].scriptPubKey, ToAddress)) { + fprintf(stderr, "%s %s\n",CRYPTO777_KMDADDR, CBitcoinAddress(ToAddress).ToString().c_str()); if ( strcmp(CRYPTO777_KMDADDR,CBitcoinAddress(ToAddress).ToString().c_str()) == 0 ) fToCryptoAddress = true; } @@ -262,6 +263,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 && fToCryptoAddress ) { uint256 hash; CTransaction tx1; CTxDestination address; + fprintf(stderr, "Checking vins for notarisation.\n"); if (GetTransaction(txin.prevout.hash,tx1,hash,false)) { if (ExtractDestination(tx1.vout[txin.prevout.n].scriptPubKey, address)) { From ea8cf3fc1cb7d80ec5807b442a8d9fe27353df5b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 21:46:41 +0800 Subject: [PATCH 0694/4463] try again --- src/miner.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 3bbf928f4..ef826d05d 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -218,7 +218,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) // TODO: It will be much faster here to just compare scriptpubkey! CTxDestination ToAddress; int numNotaryVins = 0; bool fToCryptoAddress = false; if (ExtractDestination(tx.vout[0].scriptPubKey, ToAddress)) { - fprintf(stderr, "%s %s\n",CRYPTO777_KMDADDR, CBitcoinAddress(ToAddress).ToString().c_str()); if ( strcmp(CRYPTO777_KMDADDR,CBitcoinAddress(ToAddress).ToString().c_str()) == 0 ) fToCryptoAddress = true; } @@ -263,7 +262,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) if ( NOTARYADDRS[0][0] != 0 && NUM_NOTARIES != 0 && fToCryptoAddress ) { uint256 hash; CTransaction tx1; CTxDestination address; - fprintf(stderr, "Checking vins for notarisation.\n"); if (GetTransaction(txin.prevout.hash,tx1,hash,false)) { if (ExtractDestination(tx1.vout[txin.prevout.n].scriptPubKey, address)) { @@ -276,6 +274,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) } dPriority += (double)nValueIn * nConf; } + fprintf(stderr, "minsigs.%i vs numsigs.%i\n",(NUM_NOTARIES/5),numNotaryVins); if ( numNotaryVins > NUM_NOTARIES / 5 ) fNotarisation = true; nTotalIn += tx.GetJoinSplitValueIn(); From 9a72f91980227622cf7c508391d73ac25d469e56 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Wed, 28 Nov 2018 21:50:30 +0800 Subject: [PATCH 0695/4463] fix! --- src/miner.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index ef826d05d..7d15c3003 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -274,8 +274,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) } dPriority += (double)nValueIn * nConf; } - fprintf(stderr, "minsigs.%i vs numsigs.%i\n",(NUM_NOTARIES/5),numNotaryVins); - if ( numNotaryVins > NUM_NOTARIES / 5 ) + if ( numNotaryVins >= NUM_NOTARIES / 5 ) fNotarisation = true; nTotalIn += tx.GetJoinSplitValueIn(); } From 0b6970c798ac63e02dbf380f1f2f201cb4caec02 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 09:35:50 +0800 Subject: [PATCH 0696/4463] change min sigs to +1 --- src/komodo.h | 4 ++++ src/miner.cpp | 2 +- src/rpcmisc.cpp | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e58fe9be6..d5f5817a1 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -708,6 +708,10 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->MoMdepth); if ( ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); + //if ( is_STAKED != 0 ) + //{ + // HERE we should add the notarisation to libscotts DB. + //} if ( ASSETCHAINS_SYMBOL[0] == 0 ) { if ( signedfp == 0 ) diff --git a/src/miner.cpp b/src/miner.cpp index 7d15c3003..7370beb64 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -215,7 +215,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) nTotalIn += nValueIn; dPriority += (double)nValueIn * 1000; // flat multiplier } else { - // TODO: It will be much faster here to just compare scriptpubkey! + // TODO: It will be much faster here to just compare scriptpubkey to the crypto pubkey! CTxDestination ToAddress; int numNotaryVins = 0; bool fToCryptoAddress = false; if (ExtractDestination(tx.vout[0].scriptPubKey, ToAddress)) { if ( strcmp(CRYPTO777_KMDADDR,CBitcoinAddress(ToAddress).ToString().c_str()) == 0 ) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 9be0af7c0..4f436f41a 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -82,7 +82,7 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) UniValue seeds(UniValue::VARR); UniValue notaries(UniValue::VARR); // get the current era, use local time for now. - // should ideally take blocktime of last known block. + // should ideally take blocktime of last known block? int now = time(NULL); int32_t era = getera(now); @@ -98,10 +98,10 @@ UniValue getiguanajson(const UniValue& params, bool fHelp) notaries.push_back(notary); } - // get the min sigs + // get the min sigs .. this always rounds UP so mine sigs in iguana is +1 min sigs in komodod, due to some rounding error. int minsigs; if ( num_notaries_STAKED[era]/5 > overrideMinSigs ) - minsigs = (num_notaries_STAKED[era] + 4) / 5; + minsigs = (num_notaries_STAKED[era] / 5) + 1; else minsigs = overrideMinSigs; From 7cb41a160528c0c6908b0989319da966eb42f4fa Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 11:03:56 +0800 Subject: [PATCH 0697/4463] fix kmdice twice --- src/assetchains.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index 43242ea42..09f7cdb96 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -177,18 +177,6 @@ "190.114.254.104" ] }, - { - "ac_name": "KMDICE", - "ac_supply": "10500000", - "ac_reward": "2500000000", - "ac_halving": "210000", - "ac_cc": "2", - "addressindex": "1", - "spentindex": "1", - "addnode": [ - "144.76.217.232" - ] - }, { "ac_name": "DION", "ac_supply": "3900000000", From d54d5424585c2b91ebf166f9a302eb89d37a7f73 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 22:33:01 +0800 Subject: [PATCH 0698/4463] remove streamer --- src/komodo_bitcoind.h | 52 ++++------ src/komodo_gateway.h | 2 +- src/komodo_globals.h | 2 +- src/komodo_utils.h | 14 +-- src/main.cpp | 22 +--- src/miner.cpp | 40 +------- src/pow.cpp | 4 - src/rpcblockchain.cpp | 212 --------------------------------------- src/rpcserver.cpp | 1 - src/rpcserver.h | 1 - src/wallet/rpcwallet.cpp | 1 - 11 files changed, 27 insertions(+), 324 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index d0d6a7632..c00d33216 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1105,7 +1105,6 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_ commission must be in coinbase.vout[1] and must be >= 10000 sats PoS stake must be without txfee and in the last tx in the block at vout[0] */ -extern int32_t ASSETCHAINS_STREAM; CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams); @@ -1113,29 +1112,26 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) { int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0; txn_count = pblock->vtx.size(); - if ( ASSETCHAINS_STREAM == 0 ) + if ( ASSETCHAINS_FOUNDERS != 0 ) { - if ( ASSETCHAINS_FOUNDERS != 0 ) + nSubsidy = GetBlockSubsidy(height,Params().GetConsensus()); + //fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); + return((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); + n = pblock->vtx[0].vout.size(); + for (j=0; jvtx[0].vout[j].nValue; + } + else + { + for (i=0; ivtx[0].vout.size(); + n = pblock->vtx[i].vout.size(); for (j=0; jvtx[0].vout[j].nValue; - } - else - { - for (i=0; ivtx[i].vout.size(); - for (j=0; jvtx[i].vout[j].nValue; - } + //fprintf(stderr,"(%d %.8f).%d ",i,dstr(block.vtx[i].vout[j].nValue),j); + if ( i != 0 || j != 1 ) + total += pblock->vtx[i].vout[j].nValue; } } } @@ -1483,7 +1479,7 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ int64_t komodo_checkcommission(CBlock *pblock,int32_t height) { int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; - if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0 ) + if ( ASSETCHAINS_COMMISSION != 0 ) { checktoshis = komodo_commission(pblock,height); //fprintf(stderr,"height.%d commission %.8f\n",height,(double)checktoshis/COIN); @@ -1632,20 +1628,6 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) if ( komodo_checkcommission(pblock,height) < 0 ) return(-1); } - if ( ASSETCHAINS_STREAM != 0 && height > 128 ) - { - int lasttx = ( pblock->vtx.size() -1 ); - if ( lasttx == 0 ) - return(-1); - uint256 hash; CTransaction tx; - if (GetTransaction(pblock->vtx[lasttx].vin[0].prevout.hash,tx,hash,false)) - { - script = (uint8_t *)tx.vout[pblock->vtx[lasttx].vin[0].prevout.n].scriptPubKey.data(); - if ( script[0] != 33 || script[34] != OP_CHECKSIG || memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) != 0 ) { - return(-1); - } - } - } } //fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed); if ( failed != 0 && possible == 0 && notaryid < 0 ) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 1ed05897d..3845030ca 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -744,7 +744,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim else { checktoshis = 0; - if ( (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && height > 1 ) + if ( ASSETCHAINS_COMMISSION != 0 && height > 1 ) { if ( (checktoshis= komodo_checkcommission((CBlock *)&block,height)) < 0 ) { diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 0953713b0..dda78a6e1 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -44,7 +44,7 @@ struct komodo_state KOMODO_STATES[34]; #define _COINBASE_MATURITY 100 int COINBASE_MATURITY = _COINBASE_MATURITY;//100; -int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI; +int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,WHITELIST_ADDRESS; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,NUM_NOTARIES,ASSETCHAINS_FOUNDERS; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 80581a1f8..1a6757b49 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1573,12 +1573,7 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = GetArg("-ac_perc",0); ASSETCHAINS_OVERRIDE_PUBKEY = GetArg("-ac_pubkey",""); ASSETCHAINS_SCRIPTPUB = GetArg("-ac_script",""); - ASSETCHAINS_STREAM = GetArg("-ac_stream",0); - if ( ASSETCHAINS_STREAM != 0 && ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_PRIVATE != 0 )) { - printf("ASSETCHAINS_STREAM cannot be used with:\n ASSETCHAINS_COMMISSION \n ASSETCHAINS_ENDSUBSIDY\n ASSETCHAINS_REWARD\n ASSETCHAINS_HALVING\n ASSETCHAINS_DECAY\n ASSETCHAINS_PRIVATE\n"); - exit(0); - } if ( (ASSETCHAINS_STAKED= GetArg("-ac_staked",0)) > 100 ) ASSETCHAINS_STAKED = 100; if ( ASSETCHAINS_STAKED != 0 && ASSETCHAINS_PRIVATE != 0 ) @@ -1601,11 +1596,6 @@ void komodo_args(char *argv0) ASSETCHAINS_DECAY = 0; printf("ASSETCHAINS_DECAY cant be more than 100000000\n"); } - if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) != 66 && ASSETCHAINS_STREAM != 0 ) - { - printf("ASSETCHAINS_STREAM needs ASSETCHAINS_OVERRIDE_PUBKEY! \n"); - exit(0); - } if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 || ASSETCHAINS_SCRIPTPUB.size() > 1 ) { if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 ) @@ -1620,10 +1610,10 @@ void komodo_args(char *argv0) ASSETCHAINS_COMMISSION = 53846154; // maps to 35% printf("ASSETCHAINS_COMMISSION defaulted to 35%% when founders reward active\n"); } - else if ( ASSETCHAINS_STREAM == 0 ) + else { ASSETCHAINS_OVERRIDE_PUBKEY.clear(); - printf("-ac_perc or -ac_stream must be set with -ac_pubkey\n"); + printf("-ac_perc must be set with -ac_pubkey\n"); } } } diff --git a/src/main.cpp b/src/main.cpp index 2b6966659..26b5e8f5b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1918,7 +1918,6 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW) //uint64_t komodo_moneysupply(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint32_t ASSETCHAINS_MAGIC; -extern int32_t ASSETCHAINS_STREAM; extern uint64_t ASSETCHAINS_STAKED,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY; extern uint8_t ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE; @@ -1947,12 +1946,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) else if ( ASSETCHAINS_ENDSUBSIDY == 0 || nHeight < ASSETCHAINS_ENDSUBSIDY ) { if ( ASSETCHAINS_REWARD == 0 ) - { - if ( ASSETCHAINS_STREAM != 0 && nHeight > 128 ) - return(0); - else - return(10000); - } + return(10000); else if ( ASSETCHAINS_ENDSUBSIDY != 0 && nHeight >= ASSETCHAINS_ENDSUBSIDY ) return(0); else @@ -3020,18 +3014,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin return state.DoS(100, error("ConnectBlock(): JoinSplit requirements not met"), REJECT_INVALID, "bad-txns-joinsplit-requirements-not-met"); - if ( ASSETCHAINS_SYMBOL[0] != 0 ) - { - if ( ASSETCHAINS_STREAM != 0 ) - { - if ( block.vtx.size() == 1 && block.vtx[0].vout.size() == 2 && pindex->nHeight > ASSETCHAINS_MINHEIGHT) - { - return state.DoS(100, error("ConnectBlock(): There are no TX in this block, it is invalid!"), - REJECT_INVALID, "bad-block-no-transactions"); - } - } - } - if (fAddressIndex || fSpentIndex) { for (size_t j = 0; j < tx.vin.size(); j++) { @@ -3181,7 +3163,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", (unsigned)block.vtx.size(), 0.001 * (nTime1 - nTimeStart), 0.001 * (nTime1 - nTimeStart) / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart) / (nInputs-1), nTimeConnect * 0.000001); CAmount blockReward = nFees + GetBlockSubsidy(pindex->nHeight, chainparams.GetConsensus()) + sum; - if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0 ) //ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && + if ( ASSETCHAINS_COMMISSION != 0 ) //ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && { uint64_t checktoshis; if ( (checktoshis= komodo_commission((CBlock *)&block,(int32_t)pindex->nHeight)) != 0 ) diff --git a/src/miner.cpp b/src/miner.cpp index 7370beb64..709ba6a65 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -107,7 +107,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, #include "komodo_defs.h" #define CRYPTO777_KMDADDR "RXL3YXG2ceaB6C5hfJcN4fvmLH2C34knhA" -extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,ASSETCHAINS_STREAM,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; +extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE; extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],NOTARYADDRS[64][36]; extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB; @@ -467,7 +467,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; pblock->vtx[0] = txNew; - if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_STREAM != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 ) + if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 ) { int32_t i; uint8_t *ptr; txNew.vout.resize(2); @@ -544,26 +544,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount) return(0); } } - else if ( ASSETCHAINS_STREAM != 0 && ASSETCHAINS_SYMBOL[0] != 0 && nHeight > 128 ) - { - CMutableTransaction txStream = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1); - if ( komodo_notaryvin(txStream,ASSETCHAINS_OVERRIDE_PUBKEY33) > 0 ) - { - CAmount txfees = 10000; - pblock->vtx.push_back(txStream); - pblocktemplate->vTxFees.push_back(txfees); - pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStream)); - nFees += txfees; - pblocktemplate->vTxFees[0] = -nFees; - //*(uint64_t *)(&pblock->vtx[0].vout[0].nValue) += txfees; - //fprintf(stderr,"added notaryvin\n"); - } - else - { - fprintf(stderr,"error adding streamer vin, the chain broke! \n"); - return(0); - } - } else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) { CValidationState state; @@ -690,13 +670,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight,in decode_hex(ptr,len,(char *)ASSETCHAINS_SCRIPTPUB.c_str()); } } - else if ( ASSETCHAINS_STREAM != 0 ) - { - if ( nHeight < 128 ) - scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG; - else - scriptPubKey = CScript() << ParseHex(CRYPTO777_PUBSECPSTR) << OP_CHECKSIG; - } else if ( USE_EXTERNAL_PUBKEY != 0 ) { //fprintf(stderr,"use notary pubkey\n"); @@ -926,19 +899,14 @@ void static BitcoinMiner() { if ( ASSETCHAINS_REWARD == 0 ) { - int minvoutsize = 1; - int minvtxsize = 1; - if ( ASSETCHAINS_STREAM != 0 ) - minvoutsize = 2; - minvtxsize = 2; - if ( pblock->vtx.size() == minvtxsize && pblock->vtx[0].vout.size() == minvoutsize && Mining_height > ASSETCHAINS_MINHEIGHT ) + if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) { static uint32_t counter; if ( counter++ < 10 ) fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL); sleep(10); continue; - } else fprintf(stderr,"%s tx.%d vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx.size(),(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); + } else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT); } } IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); diff --git a/src/pow.cpp b/src/pow.cpp index 07776e273..1291e445e 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -20,13 +20,9 @@ #include "librustzcash.h" #endif // ENABLE_RUST uint32_t komodo_chainactive_timestamp(); -extern int32_t ASSETCHAINS_STREAM; unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { - if ( ASSETCHAINS_STREAM == 2 ) - return 537857807; - unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact(); // Genesis block if (pindexLast == NULL ) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index abc8864bc..f078094ff 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -261,218 +261,6 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) return result; } -unsigned char hexval(unsigned char c) -{ - if ('0' <= c && c <= '9') - return c - '0'; - else if ('a' <= c && c <= 'f') - return c - 'a' + 10; - else if ('A' <= c && c <= 'F') - return c - 'A' + 10; - else abort(); -} - -void hex2ascii(const string& in, string& out) -{ - out.clear(); - out.reserve(in.length() / 2); - for (string::const_iterator p = in.begin(); p != in.end(); p++) - { - unsigned char c = hexval(*p); - p++; - if (p == in.end()) break; // incomplete last digit - should report error - c = (c << 4) + hexval(*p); // + takes precedence over << - out.push_back(c); - } -} - -UniValue getdatafromblock(const UniValue& params, bool fHelp) -{ - if (fHelp || params.size() < 1 || params.size() > 2) - throw runtime_error( - "getdatafromblock \"hash|height\" true/false\n" - "\nReturns all the data sent via streamer in block if there was any data in it.\n" - "\nArguments:\n" - "1. \"hash|height\" (string, required) The block hash or height\n" - "2. \"true/false\" (bool, optional) if false do not return the actual data. Default true.\n" - "\nResult (for verbose = true):\n" - "{\n" - " \"streamid\" : \"string\", (string) the name of the stream.\n" - " \"firsttxid\" : \"hash\", (string) the first transaction of the stream.\n" - " \"firstblockheight\" : \"n\", (numeric) the block the stream starts in.\n" - " \"firstdeqid\" : n, (numeric) The sequence id of the first data chunk in this block\n" - " \"lastseqid\" : n, (numeric) The sequence id of the last data chunk in this block\n" - " \"data\" : \"xxxx\", (string) A hex string containing all the data chunks in this block.\n" - "}\n" - "\nResult (for verbose=false):\n" - " \"streamid\" : \"string\", (string) the name of the stream.\n" - " \"firsttxid\" : \"hash\", (string) the first transaction of the stream.\n" - " \"firstblockheight\" : \"n\", (numeric) the block the stream starts in.\n" - " \"firstdeqid\" : n, (numeric) The sequence id of the first data chunk in this block\n" - " \"lastseqid\" : n, (numeric) The sequence id of the last data chunk in this block\n" - + HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 false\"") - + HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") - + HelpExampleCli("getblock", "12800") - + HelpExampleRpc("getblock", "12800 false") - ); - - LOCK(cs_main); - - std::string strHash = params[0].get_str(); - bool fVerbose = true; - if (params.size() > 1) { - std::string verboseflag = params[1].get_str(); - if ( verboseflag == "false" ) - fVerbose = false; - } - - // If height is supplied, find the hash - if (strHash.size() < (2 * sizeof(uint256))) { - // std::stoi allows characters, whereas we want to be strict - regex r("[[:digit:]]+"); - if (!regex_match(strHash, r)) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block height parameter"); - } - - int nHeight = -1; - try { - nHeight = std::stoi(strHash); - } - catch (const std::exception &e) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block height parameter"); - } - - if (nHeight < 0 || nHeight > chainActive.Height()) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); - } - strHash = chainActive[nHeight]->GetBlockHash().GetHex(); - } - - uint256 hash(uint256S(strHash)); - - if (mapBlockIndex.count(hash) == 0) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); - - CBlock block; - CBlockIndex* pblockindex = mapBlockIndex[hash]; - - if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0) - throw JSONRPCError(RPC_INTERNAL_ERROR, "Block not available (pruned data)"); - - if(!ReadBlockFromDisk(block, pblockindex,1)) - throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); - - UniValue result(UniValue::VOBJ); - int firstseqid = 0; - int lastseqid = 0; - int i = 0; - int did1 = 0; - int skippedtxs = 0; - int failed = 0; - int getfirstblock = 0; - static std::string streamid,firsttxid; - static int firsttxnHeight; - std::string blockdata; - fprintf(stderr, "number of tx in block: %ld\n", block.vtx.size()); - // Iif block tx size is > 2 then we can do this - if ( block.vtx.size() > 2 ) - { - BOOST_FOREACH(const CTransaction&tx, block.vtx) - { - // ignore first and last TX and any TX that does not have 3 vouts. - if ( (i == 0) || (i == (block.vtx.size() -1)) || (tx.vout.size() != 3) ) - { - fprintf(stderr, "skipped tx number: %d\n",i); - skippedtxs = skippedtxs + 1; - } else { - std::string opretstr = HexStr(tx.vout[2].scriptPubKey.begin(), tx.vout[2].scriptPubKey.end()); - // scriptPubKey is longer than 81, should mean its an OP_RETURN, maybe also check vout == 0 ? - if ( opretstr.size() > 81 ) { - std::string idstr = opretstr.substr (8,64); // stream ID or txid - std::string seqidstr = opretstr.substr (72,8); // sequence ID - std::string data = opretstr.substr (80); // data chunk - unsigned int seqid; - std::stringstream ss; - ss << std::hex << seqidstr; - ss >> seqid; - if ( seqid == 1 ) { - streamid = idstr; - getfirstblock = 1; - } else if ( seqid == 2 ) { - firsttxid = idstr; - } else if (firsttxid.empty()) { - firsttxid.append(idstr); - } else if ( firsttxid != idstr ) { - printf("firsttxid.%s idstr.%s change firsttxid and wipe streamid?\n",firsttxid.c_str(),idstr.c_str()); - firsttxid.clear(); - firsttxid.append(idstr); - streamid.clear(); - firsttxnHeight = 0; - } - if ( seqid == (lastseqid + 1) || did1 == 0 ) { - blockdata.append(data); - } else { - result.push_back(Pair("error","chunck out of order or missing in this block!")); - result.push_back(Pair("lastvalidseqid", (int)lastseqid)); - break; - } - if ( did1 == 0 ) { - firstseqid = seqid; - did1 = 1; - } - lastseqid = seqid; - } else { - skippedtxs = skippedtxs + 1; - fprintf(stderr, "skipped tx number: %d\n",i); - } - // function here to extract seqid from first and last TX - // we an push the data or not depending on input from RPC. - } - i = i + 1; - } - if (streamid.empty() || getfirstblock == 1) { - if ( lastseqid == 1) { - firsttxid = block.vtx[1].GetHash().GetHex(); - } - uint256 hash; CTransaction firsttx; - uint256 firsttxid_256(uint256S(firsttxid)); - if (GetTransaction(firsttxid_256,firsttx,hash,false)) { - if ( streamid.empty() ) { - std::string firststreamid = HexStr(firsttx.vout[2].scriptPubKey.begin(), firsttx.vout[2].scriptPubKey.end()); - streamid.append(firststreamid.substr (8,64)); - } - printf("first stream id changed to: %s\n", streamid.c_str()); - BlockMap::iterator mi = mapBlockIndex.find(hash); - if (mi != mapBlockIndex.end() && (*mi).second) { - CBlockIndex* pindex = (*mi).second; - printf("found block height: %d\n",pindex->nHeight); - if (chainActive.Contains(pindex)) { - firsttxnHeight = pindex->nHeight; - } - } - } - } - } else { - failed = 1; - } - - if ( failed == 1 || skippedtxs == i ) { - result.push_back(Pair("error","there is no data in this block.")); - } else { - std::string decodedstreamid; - hex2ascii(streamid, decodedstreamid); - result.push_back(Pair("streamid", decodedstreamid.c_str())); - result.push_back(Pair("firsttxid", firsttxid)); - result.push_back(Pair("firstblockheight", (int)firsttxnHeight)); - result.push_back(Pair("firstseqid", (int)firstseqid)); - result.push_back(Pair("lastseqid", (int)lastseqid)); - if (fVerbose == true) { - result.push_back(Pair("data", blockdata)); - } - } - return result; -} - UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) { UniValue result(UniValue::VOBJ); diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index d4143fcfb..98417e201 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -287,7 +287,6 @@ static const CRPCCommand vRPCCommands[] = { "blockchain", "getbestblockhash", &getbestblockhash, true }, { "blockchain", "getblockcount", &getblockcount, true }, { "blockchain", "getblock", &getblock, true }, - { "blockchain", "getdatafromblock", &getdatafromblock, true }, { "blockchain", "getblockdeltas", &getblockdeltas, false }, { "blockchain", "getblockhashes", &getblockhashes, true }, { "blockchain", "getblockhash", &getblockhash, true }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 9ab033d12..851c39d42 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -368,7 +368,6 @@ extern UniValue getblockdeltas(const UniValue& params, bool fHelp); extern UniValue getblockhash(const UniValue& params, bool fHelp); extern UniValue getblockheader(const UniValue& params, bool fHelp); extern UniValue getblock(const UniValue& params, bool fHelp); -extern UniValue getdatafromblock(const UniValue& params, bool fHelp); extern UniValue gettxoutsetinfo(const UniValue& params, bool fHelp); extern UniValue gettxout(const UniValue& params, bool fHelp); extern UniValue verifychain(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a05eede52..5e24f1530 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -46,7 +46,6 @@ using namespace libzcash; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern std::string ASSETCHAINS_OVERRIDE_PUBKEY; -extern int32_t ASSETCHAINS_STREAM; extern UniValue TxJoinSplitToJSON(const CTransaction& tx); extern uint8_t ASSETCHAINS_PRIVATE; extern int32_t USE_EXTERNAL_PUBKEY; From 5dead9f36b8ea0cd8b79d5a31d929feab225caaa Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 22:37:23 +0800 Subject: [PATCH 0699/4463] fix --- src/komodo_bitcoind.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index c00d33216..124c8f2b2 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1135,10 +1135,6 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) } } } - else - { - commission = 10000; - } return(commission); } From aba30935272dc1215f52ba14808cbcd42ac98721 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:36:51 +0800 Subject: [PATCH 0700/4463] try fix --- src/crosschain.cpp | 2 +- src/crosschain_authority.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain.cpp b/src/crosschain.cpp index ff143da2c..fbd6b8f1a 100644 --- a/src/crosschain.cpp +++ b/src/crosschain.cpp @@ -284,7 +284,7 @@ bool CheckMoMoM(uint256 kmdNotarisationHash, uint256 momom) return nota.second.MoMoM == momom; }; - return (bool) ScanNotarisationsFromHeight(block.nHeight-100, checkMoMoM, nota); + return (bool) ScanNotarisationsFromHeight(block.GetHeight()-100, checkMoMoM, nota); } diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index f7f51c8df..7aeb27f01 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -33,7 +33,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vout.size() < txIn.prevout.n) return false; CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; if (spk.size() != 35) return false; - const unsigned char *pk = spk.data(); + const unsigned char *pk = spk[0]; if (pk++[0] != 33) return false; if (pk[33] != OP_CHECKSIG) return false; From 598ccdb0900514850bc71a3f7b79beaac30b2f72 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:39:57 +0800 Subject: [PATCH 0701/4463] fix --- src/crosschain_authority.cpp | 2 +- src/komodo_globals.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 7aeb27f01..3fbc39b42 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -33,7 +33,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vout.size() < txIn.prevout.n) return false; CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; if (spk.size() != 35) return false; - const unsigned char *pk = spk[0]; + const unsigned char *pk = (char *)spk[0]; if (pk++[0] != 33) return false; if (pk[33] != OP_CHECKSIG) return false; diff --git a/src/komodo_globals.h b/src/komodo_globals.h index a09d81e4e..c0de313ab 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -46,7 +46,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100; int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI; int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; -std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB; +std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,WHITELIST_ADDRESS; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_FOUNDERS,NUM_NOTARIES; bool VERUS_MINTBLOCKS; From d2b899687e374bd25ce2ca9df8fed4016ef734a1 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:41:15 +0800 Subject: [PATCH 0702/4463] try --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 3fbc39b42..af462731f 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -33,7 +33,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vout.size() < txIn.prevout.n) return false; CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; if (spk.size() != 35) return false; - const unsigned char *pk = (char *)spk[0]; + const unsigned char *pk = (char *)&spk[0]; if (pk++[0] != 33) return false; if (pk[33] != OP_CHECKSIG) return false; From ab2a8e53ca0ddf0c0f4ff427e32b4b60e2e6e47f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:43:59 +0800 Subject: [PATCH 0703/4463] try --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index af462731f..928f6ed64 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -33,7 +33,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vout.size() < txIn.prevout.n) return false; CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; if (spk.size() != 35) return false; - const unsigned char *pk = (char *)&spk[0]; + char *pk = *spk[0]; if (pk++[0] != 33) return false; if (pk[33] != OP_CHECKSIG) return false; From 88da77886c0c231af8d36965a6902db43553395b Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:45:42 +0800 Subject: [PATCH 0704/4463] try --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 928f6ed64..551c322fe 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -33,7 +33,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vout.size() < txIn.prevout.n) return false; CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; if (spk.size() != 35) return false; - char *pk = *spk[0]; + unsigned char *pk = *spk[0]; if (pk++[0] != 33) return false; if (pk[33] != OP_CHECKSIG) return false; From be1b9071a1c1eae51058dddebc051a8a75afc78e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:46:34 +0800 Subject: [PATCH 0705/4463] try --- src/crosschain_authority.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crosschain_authority.cpp b/src/crosschain_authority.cpp index 551c322fe..b4379c010 100644 --- a/src/crosschain_authority.cpp +++ b/src/crosschain_authority.cpp @@ -33,7 +33,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth) if (tx.vout.size() < txIn.prevout.n) return false; CScript spk = tx.vout[txIn.prevout.n].scriptPubKey; if (spk.size() != 35) return false; - unsigned char *pk = *spk[0]; + const unsigned char *pk = &spk[0]; if (pk++[0] != 33) return false; if (pk[33] != OP_CHECKSIG) return false; From c8e652c452504de65333246368caebe5d190ab3e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:50:38 +0800 Subject: [PATCH 0706/4463] fix --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 35b9b0120..edc0ba40c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -277,7 +277,7 @@ libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h # server: zcashd libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -DSERVER -libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -DSEVER +libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -DSERVER libbitcoin_server_a_SOURCES = \ sendalert.cpp \ addrman.cpp \ From 43a6b39140840314678ac07720f6a1c400d3f890 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:55:14 +0800 Subject: [PATCH 0707/4463] try --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 31cfd9a3d..e49ffadcc 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -75,7 +75,7 @@ public: #include "komodo_utils.h" #include "komodo_cJSON.c" #include "komodo_notary.h" -#include "notaries_staked.cpp" +//#include "notaries_staked.cpp" From 104f60f0949fbe5132330910bc013f6890b68139 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:56:28 +0800 Subject: [PATCH 0708/4463] uh --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e49ffadcc..31cfd9a3d 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -75,7 +75,7 @@ public: #include "komodo_utils.h" #include "komodo_cJSON.c" #include "komodo_notary.h" -//#include "notaries_staked.cpp" +#include "notaries_staked.cpp" From 95fbd857070b9a3688d28915f35b0362df6e98b6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Thu, 29 Nov 2018 23:59:48 +0800 Subject: [PATCH 0709/4463] try --- src/bitcoin-cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 31cfd9a3d..488516abb 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -74,8 +74,8 @@ public: #include "komodo_globals.h" #include "komodo_utils.h" #include "komodo_cJSON.c" -#include "komodo_notary.h" -#include "notaries_staked.cpp" +//#include "komodo_notary.h" +//#include "notaries_staked.cpp" From 3a55d61fb6f1b7dbdbd34e37ebbbc54b3b794b1f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 00:01:24 +0800 Subject: [PATCH 0710/4463] try --- src/bitcoin-cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 488516abb..e6e7819f5 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -72,8 +72,8 @@ public: #include "komodo_structs.h" #include "komodo_globals.h" -#include "komodo_utils.h" -#include "komodo_cJSON.c" +//#include "komodo_utils.h" +//#include "komodo_cJSON.c" //#include "komodo_notary.h" //#include "notaries_staked.cpp" From d56e1595668aca0ff17031b821208d7fafa8b5d6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 00:14:53 +0800 Subject: [PATCH 0711/4463] y --- src/bitcoin-cli.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e6e7819f5..c06b24693 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -72,10 +72,10 @@ public: #include "komodo_structs.h" #include "komodo_globals.h" -//#include "komodo_utils.h" -//#include "komodo_cJSON.c" -//#include "komodo_notary.h" -//#include "notaries_staked.cpp" +#include "komodo_utils.h" +#include "komodo_cJSON.c" +#include "komodo_notary.h" +#include "notaries_staked.h" From 6f16da8472e827faad938b312a1c65e7ec3af4bb Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 00:15:59 +0800 Subject: [PATCH 0712/4463] y --- src/bitcoin-cli.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index c06b24693..4731fd9a2 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -76,6 +76,7 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.h" +#include "notaries_staked.cpp" From 5552614eeac670242511ce1447d7a6024abd7e22 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 00:25:25 +0800 Subject: [PATCH 0713/4463] try --- src/coins.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/coins.h b/src/coins.h index f35af02f0..62943eb83 100644 --- a/src/coins.h +++ b/src/coins.h @@ -26,7 +26,7 @@ #include "zcash/IncrementalMerkleTree.hpp" #include "veruslaunch.h" -/** +/** * Pruned version of CTransaction: only retains metadata and unspent transaction outputs * * Serialized format: @@ -428,10 +428,10 @@ public: class CCoinsViewCache; -/** +/** * A reference to a mutable cache entry. Encapsulating it allows us to run * cleanup code after the modification is finished, and keeping track of - * concurrent modifications. + * concurrent modifications. */ class CCoinsModifier { @@ -456,6 +456,7 @@ class CTransactionExceptionData CTransactionExceptionData() : scriptPubKey(), voutMask() {} }; +#ifdef SERVER class CLaunchMap { public: @@ -478,6 +479,7 @@ class CLaunchMap } }; static CLaunchMap launchMap = CLaunchMap(); +#endif /** CCoinsView that adds a memory cache for transactions to another CCoinsView */ class CCoinsViewCache : public CCoinsViewBacked @@ -488,7 +490,7 @@ protected: /** * Make mutable so that we can "fill the cache" even from Get-methods - * declared as "const". + * declared as "const". */ mutable uint256 hashBlock; mutable CCoinsMap cacheCoins; @@ -564,7 +566,7 @@ public: //! Calculate the size of the cache (in bytes) size_t DynamicMemoryUsage() const; - /** + /** * Amount of bitcoins coming in to a transaction * Note that lightweight clients may not know anything besides the hash of previous transactions, * so may not be able to calculate this. From caad5eaee1856469ae75fa019b2a2821b5b07da0 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 00:32:20 +0800 Subject: [PATCH 0714/4463] fix --- src/coins.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/coins.h b/src/coins.h index 62943eb83..4ef6ad29f 100644 --- a/src/coins.h +++ b/src/coins.h @@ -456,7 +456,6 @@ class CTransactionExceptionData CTransactionExceptionData() : scriptPubKey(), voutMask() {} }; -#ifdef SERVER class CLaunchMap { public: @@ -479,7 +478,6 @@ class CLaunchMap } }; static CLaunchMap launchMap = CLaunchMap(); -#endif /** CCoinsView that adds a memory cache for transactions to another CCoinsView */ class CCoinsViewCache : public CCoinsViewBacked From a4e70bd4644bbad5e31692408a3f8d83e383fbbe Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 00:48:04 +0800 Subject: [PATCH 0715/4463] try reverse --- src/Makefile.am | 10 +++++----- src/notaries_staked.cpp | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index edc0ba40c..daced98c8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -276,8 +276,8 @@ obj/build.h: FORCE libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h # server: zcashd -libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) -DSERVER -libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -DSERVER +libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) +libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_server_a_SOURCES = \ sendalert.cpp \ addrman.cpp \ @@ -581,9 +581,9 @@ endif # bitcoin-cli binary # komodo_cli_SOURCES = bitcoin-cli.cpp -komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) -komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) -DCLI +komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -DCLI +komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -DCLI # wallet-utility binary # if ENABLE_WALLET diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index d29d5dfb2..e69a43397 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -36,7 +36,11 @@ int32_t STAKED_era(int timestamp) return(0); }; -#ifdef SERVER +#ifdef CLI +int8_t updateStakedNotary() { + return(-1); +} +#else int8_t updateStakedNotary() { std::string notaryname; char Raddress[18]; uint8_t pubkey33[33]; @@ -46,10 +50,6 @@ int8_t updateStakedNotary() { NOTARY_ADDRESS.assign(Raddress); return(StakedNotaryID(notaryname,Raddress)); } -#else -int8_t updateStakedNotary() { - return(-1); -} #endif int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { @@ -150,24 +150,24 @@ void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) { if ( pubkeys[0][0] == 0 ) { // null pubkeys, era 0. -#ifdef SERVER pthread_mutex_lock(&staked_mutex); memset(NOTARYADDRS,0,sizeof(NOTARYADDRS)); NUM_NOTARIES = 0; pthread_mutex_unlock(&staked_mutex); -#endif } else { // staked era is set. -#ifdef SERVER pthread_mutex_lock(&staked_mutex); for (int i = 0; i Date: Fri, 30 Nov 2018 00:55:05 +0800 Subject: [PATCH 0716/4463] wtrf --- src/bitcoin-cli.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 4731fd9a2..e123e536b 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -69,14 +69,14 @@ public: #include "uint256.h" #include "arith_uint256.h" -#include "komodo_structs.h" +//#include "komodo_structs.h" -#include "komodo_globals.h" -#include "komodo_utils.h" -#include "komodo_cJSON.c" -#include "komodo_notary.h" -#include "notaries_staked.h" -#include "notaries_staked.cpp" +//#include "komodo_globals.h" +//#include "komodo_utils.h" +//#include "komodo_cJSON.c" +//#include "komodo_notary.h" +//#include "notaries_staked.h" +//#include "notaries_staked.cpp" @@ -104,7 +104,7 @@ static int AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); - komodo_args(argv[0]); + //komodo_args(argv[0]); if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo(); if (!mapArgs.count("-version")) { From 2afd221d79dbcc7308cc0b531a9e1429fb23e351 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 01:05:05 +0800 Subject: [PATCH 0717/4463] really --- src/bitcoin-cli.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e123e536b..d30d75d38 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -65,19 +65,19 @@ public: }; +#ifdef FROM_CLI #define FROM_CLI #include "uint256.h" #include "arith_uint256.h" -//#include "komodo_structs.h" - -//#include "komodo_globals.h" -//#include "komodo_utils.h" -//#include "komodo_cJSON.c" -//#include "komodo_notary.h" -//#include "notaries_staked.h" -//#include "notaries_staked.cpp" +#include "komodo_structs.h" +#include "komodo_globals.h" +#include "komodo_utils.h" +#include "komodo_cJSON.c" +#include "komodo_notary.h" +#include "notaries_staked.cpp" +#endif void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) @@ -104,7 +104,7 @@ static int AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); - //komodo_args(argv[0]); + komodo_args(argv[0]); if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo(); if (!mapArgs.count("-version")) { From 7ca059a0fbdd453d80913c809c2ba5d2cbe59a75 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 01:31:00 +0800 Subject: [PATCH 0718/4463] last attempt --- src/bitcoin-cli.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index d30d75d38..e4357dbfa 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -17,6 +17,8 @@ #include #include #include "support/events.h" +uint16_t BITCOIND_RPCPORT = 7771; +char ASSETCHAINS_SYMBOL[65]; #include @@ -65,7 +67,7 @@ public: }; -#ifdef FROM_CLI +/* #define FROM_CLI #include "uint256.h" #include "arith_uint256.h" @@ -77,7 +79,6 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" #include "notaries_staked.cpp" -#endif void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) @@ -89,6 +90,7 @@ uint32_t komodo_heightstamp(int32_t height) { return(0); } +*/ // // This function returns either one of EXIT_ codes when it's expected to stop the process or @@ -104,7 +106,12 @@ static int AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); - komodo_args(argv[0]); + //komodo_args(argv[0]); + std:string name; + name = GetArg("-ac_name",""); + if ( !name.empty() ) + strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); + if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo(); if (!mapArgs.count("-version")) { @@ -218,7 +225,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params) { std::string host = GetArg("-rpcconnect", "127.0.0.1"); int port = GetArg("-rpcport", BaseParams().RPCPort()); - BITCOIND_RPCPORT = port; + //BITCOIND_RPCPORT = port; // Obtain event base raii_event_base base = obtain_event_base(); From a4313d45366b97838d9fbc7f6e0649e61a9601ad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 01:53:45 +0800 Subject: [PATCH 0719/4463] clean up --- src/Makefile.am | 6 +++--- src/bitcoin-cli.cpp | 28 +--------------------------- src/notaries_staked.cpp | 10 ---------- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index daced98c8..1eada2c1d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -581,9 +581,9 @@ endif # bitcoin-cli binary # komodo_cli_SOURCES = bitcoin-cli.cpp -komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) -DCLI -komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -DCLI -komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -DCLI +komodo_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS) +komodo_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +komodo_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) # wallet-utility binary # if ENABLE_WALLET diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e4357dbfa..f8f0fe002 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -67,31 +67,6 @@ public: }; -/* -#define FROM_CLI -#include "uint256.h" -#include "arith_uint256.h" - -#include "komodo_structs.h" - -#include "komodo_globals.h" -#include "komodo_utils.h" -#include "komodo_cJSON.c" -#include "komodo_notary.h" -#include "notaries_staked.cpp" - - -void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) -{ - -} - -uint32_t komodo_heightstamp(int32_t height) -{ - return(0); -} -*/ - // // This function returns either one of EXIT_ codes when it's expected to stop the process or // CONTINUE_EXECUTION when it's expected to continue further. @@ -106,7 +81,6 @@ static int AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); - //komodo_args(argv[0]); std:string name; name = GetArg("-ac_name",""); if ( !name.empty() ) @@ -225,7 +199,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params) { std::string host = GetArg("-rpcconnect", "127.0.0.1"); int port = GetArg("-rpcport", BaseParams().RPCPort()); - //BITCOIND_RPCPORT = port; + BITCOIND_RPCPORT = port; // Obtain event base raii_event_base base = obtain_event_base(); diff --git a/src/notaries_staked.cpp b/src/notaries_staked.cpp index e69a43397..ba9a88343 100644 --- a/src/notaries_staked.cpp +++ b/src/notaries_staked.cpp @@ -36,11 +36,6 @@ int32_t STAKED_era(int timestamp) return(0); }; -#ifdef CLI -int8_t updateStakedNotary() { - return(-1); -} -#else int8_t updateStakedNotary() { std::string notaryname; char Raddress[18]; uint8_t pubkey33[33]; @@ -50,7 +45,6 @@ int8_t updateStakedNotary() { NOTARY_ADDRESS.assign(Raddress); return(StakedNotaryID(notaryname,Raddress)); } -#endif int8_t StakedNotaryID(std::string ¬aryname, char *Raddress) { if ( STAKED_ERA != 0 ) @@ -160,12 +154,8 @@ void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) { // staked era is set. pthread_mutex_lock(&staked_mutex); for (int i = 0; i Date: Fri, 30 Nov 2018 19:19:58 +0800 Subject: [PATCH 0720/4463] try --- src/bitcoin-cli.cpp | 2 +- src/main.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index f8f0fe002..f632c8827 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -80,7 +80,7 @@ static int AppInitRPC(int argc, char* argv[]) // // Parameters // - ParseParameters(argc, argv); + ParseParameters(argc, lolargv); std:string name; name = GetArg("-ac_name",""); if ( !name.empty() ) diff --git a/src/main.cpp b/src/main.cpp index 0404df255..06c564f7f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6556,7 +6556,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, return true; } -//fprintf(stderr,"netmsg: %s\n", strCommand.c_str()); + fprintf(stderr,"netmsg: %s\n", strCommand.c_str()); if (strCommand == "version") { @@ -6572,12 +6572,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, CAddress addrMe; CAddress addrFrom; uint64_t nNonce = 1; + fprintf(stderr, "version.%i\n",pfrom->nVersion); int nVersion; // use temporary for version, don't set version number until validated as connected vRecv >> nVersion >> pfrom->nServices >> nTime >> addrMe; if (nVersion == 10300) nVersion = 300; if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) { + fprintf(stderr, "Is Staked!\n"); if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version @@ -6587,8 +6589,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->fDisconnect = true; return false; } - } else + } + else { + fprintf(stderr, "Is not staked!\n"); if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version From f74593d621328048ff2e0b7f614e669584997bad Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 19:22:49 +0800 Subject: [PATCH 0721/4463] go --- src/bitcoin-cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index f632c8827..f8f0fe002 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -80,7 +80,7 @@ static int AppInitRPC(int argc, char* argv[]) // // Parameters // - ParseParameters(argc, lolargv); + ParseParameters(argc, argv); std:string name; name = GetArg("-ac_name",""); if ( !name.empty() ) From fd988f01f14eb3c625b906d3484b600360655a85 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 19:30:09 +0800 Subject: [PATCH 0722/4463] try fix --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 06c564f7f..53265e7e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6579,8 +6579,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, nVersion = 300; if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 ) { - fprintf(stderr, "Is Staked!\n"); - if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION) + if (nVersion < STAKEDMIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); @@ -6592,8 +6591,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, } else { - fprintf(stderr, "Is not staked!\n"); - if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) + if (nVersion < MIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); From 7644808ff16e50f954914d95ca333a375dbf7732 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Fri, 30 Nov 2018 21:21:08 +0800 Subject: [PATCH 0723/4463] try --- src/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 53265e7e3..7a81501e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6556,7 +6556,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, return true; } - fprintf(stderr,"netmsg: %s\n", strCommand.c_str()); + //fprintf(stderr,"netmsg: %s\n", strCommand.c_str()); if (strCommand == "version") { @@ -6572,7 +6572,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, CAddress addrMe; CAddress addrFrom; uint64_t nNonce = 1; - fprintf(stderr, "version.%i\n",pfrom->nVersion); int nVersion; // use temporary for version, don't set version number until validated as connected vRecv >> nVersion >> pfrom->nServices >> nTime >> addrMe; if (nVersion == 10300) From a089187c442bc897ae1f672fc2d1de5cc0b6a72f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 1 Dec 2018 12:02:09 +0800 Subject: [PATCH 0724/4463] attempt wallet fix for empty vin issue --- src/wallet/wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 96ec88e6e..91d3e6d56 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1211,6 +1211,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl AssertLockHeld(cs_wallet); if ( tx.IsCoinBase() && tx.vout[0].nValue == 0 ) return false; + if ( tx.vin.empty() ) + return false; bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; auto noteData = FindMyNotes(tx); From 0fc3fd3de9876e1280b97a4fc0dfe14176eafaba Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 1 Dec 2018 12:18:44 +0800 Subject: [PATCH 0725/4463] fix getblocktemplate --- src/rpc/mining.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index aed10944c..e4a1dcd4a 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -606,9 +606,13 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } + else + { + strMode = "template"; + } - if (strMode != "template") - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); + //if (strMode != "template") + // throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); bool fvNodesEmpty; { From 905a829964f30925399dc0604668fbe3f23f3389 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 1 Dec 2018 14:08:51 +0800 Subject: [PATCH 0726/4463] p --- src/rpc/mining.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index e4a1dcd4a..25b75c301 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -611,9 +611,6 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) strMode = "template"; } - //if (strMode != "template") - // throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); - bool fvNodesEmpty; { LOCK(cs_vNodes); From 492d6703ed5058218b4fa050a67e7a557cbe0c50 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sat, 1 Dec 2018 23:39:10 +0100 Subject: [PATCH 0727/4463] sync jl777:FSM --- src/Makefile.am | 253 +- src/Makefile.gtest.include | 9 +- src/Makefile.qt.include | 2 +- src/Makefile.qttest.include | 2 +- src/Makefile.test.include | 148 +- src/Makefile.zcash.include | 1 + src/addrman.h | 11 +- src/alert.h | 5 +- src/amount.h | 2 +- src/assetchains.json | 23 - src/assetchains.old | 1 - src/asyncrpcoperation.cpp | 2 +- src/base58.cpp | 52 +- src/base58.h | 39 +- src/bech32.cpp | 194 + src/bech32.h | 30 + src/bitcoin-cli.cpp | 113 +- src/bitcoind.cpp | 10 +- src/bloom.h | 2 +- src/cc/CC made easy.md | 719 ++++ src/cc/CCGateways.h | 9 +- src/cc/CCHeir.h | 2 +- src/cc/CCOracles.h | 2 +- src/cc/CCPayments.h | 2 +- src/cc/CCPegs.h | 2 +- src/cc/CCPrices.h | 2 +- src/cc/CCTriggers.h | 2 +- src/cc/CCassets.h | 7 +- src/cc/CCassetsCore.cpp | 99 +- src/cc/CCassetstx.cpp | 91 +- src/cc/CCauction.h | 2 +- src/cc/CCchannels.h | 2 +- src/cc/CCcustom.cpp | 3 +- src/cc/CCdice.h | 2 +- src/cc/CCfaucet.h | 2 +- src/cc/CCfsm.h | 2 +- src/cc/CCinclude.h | 33 +- src/cc/CClotto.h | 2 +- src/cc/CCrewards.h | 2 +- src/cc/CCtx.cpp | 92 +- src/cc/CCutils.cpp | 110 +- src/cc/assets.cpp | 14 +- src/cc/auction.cpp | 11 +- src/cc/betprotocol.cpp | 15 +- src/cc/betprotocol.h | 2 +- src/cc/channels.cpp | 28 +- src/cc/dapps/makedapps | 2 + src/cc/dapps/oraclefeed.c | 236 +- src/cc/dapps/zmigrate.c | 956 +++++ src/cc/dice.cpp | 125 +- src/cc/disputepayout.cpp | 2 +- src/cc/eval.cpp | 14 +- src/cc/eval.h | 5 +- src/cc/faucet.cpp | 13 +- src/cc/fsm.cpp | 8 +- src/cc/gateways.cpp | 995 +++-- src/cc/heir.cpp | 11 +- src/cc/lotto.cpp | 11 +- src/cc/oracles.cpp | 41 +- src/cc/payments.cpp | 11 +- src/cc/pegs.cpp | 11 +- src/cc/prices.cpp | 13 +- src/cc/rewards.cpp | 16 +- src/cc/triggers.cpp | 11 +- src/chain.cpp | 69 +- src/chain.h | 189 +- src/chainparams.cpp | 178 +- src/chainparams.h | 16 +- src/chainparamsseeds.h | 6 + src/clientversion.h | 8 +- src/coins.cpp | 427 ++- src/coins.h | 222 +- src/compressor.h | 14 +- src/consensus/consensus.h | 13 +- src/consensus/params.h | 24 +- src/consensus/upgrades.cpp | 41 +- src/consensus/upgrades.h | 12 + src/core_io.h | 4 +- src/core_memusage.h | 2 +- src/core_write.cpp | 73 +- src/crosschain.cpp | 15 +- src/crypto/common.h | 36 +- src/crypto/equihash.cpp | 2 +- src/crypto/haraka.c | 606 +++ src/crypto/haraka.h | 126 + src/crypto/haraka_portable.c | 375 ++ src/crypto/haraka_portable.h | 33 + src/crypto/verus_hash.cpp | 180 + src/crypto/verus_hash.h | 133 + src/cryptoconditions/Makefile.am | 2 +- .../include/cryptoconditions.h | 3 +- src/cryptoconditions/src/anon.c | 2 +- .../src/asn/CompoundSha256Condition.h | 2 +- src/cryptoconditions/src/asn/Condition.h | 2 +- src/cryptoconditions/src/asn/ConditionTypes.h | 2 +- .../src/asn/Ed25519FingerprintContents.h | 2 +- .../src/asn/Ed25519Sha512Fulfillment.h | 2 +- .../src/asn/EvalFulfillment.h | 2 +- src/cryptoconditions/src/asn/Fulfillment.h | 2 +- src/cryptoconditions/src/asn/INTEGER.h | 2 +- src/cryptoconditions/src/asn/NativeInteger.h | 2 +- src/cryptoconditions/src/asn/OCTET_STRING.h | 2 +- .../src/asn/PrefixFingerprintContents.h | 2 +- .../src/asn/PrefixFulfillment.h | 2 +- .../src/asn/PreimageFulfillment.h | 2 +- .../src/asn/RsaFingerprintContents.h | 2 +- .../src/asn/RsaSha256Fulfillment.h | 2 +- .../src/asn/Secp256k1FingerprintContents.h | 2 +- .../src/asn/Secp256k1Fulfillment.h | 2 +- .../src/asn/SimpleSha256Condition.h | 2 +- .../src/asn/ThresholdFingerprintContents.h | 2 +- .../src/asn/ThresholdFulfillment.h | 2 +- .../src/asn/asn_codecs_prim.h | 2 +- src/cryptoconditions/src/asn/ber_decoder.h | 2 +- src/cryptoconditions/src/asn/constr_CHOICE.h | 2 +- .../src/asn/constr_SEQUENCE.h | 2 +- src/cryptoconditions/src/asn/constr_SET_OF.h | 2 +- src/cryptoconditions/src/asn/constr_TYPE.h | 18 +- src/cryptoconditions/src/asn/constraints.h | 2 +- src/cryptoconditions/src/asn/der_encoder.h | 2 +- src/cryptoconditions/src/asn/per_decoder.c | 2 +- src/cryptoconditions/src/asn/per_decoder.h | 4 +- src/cryptoconditions/src/asn/per_encoder.c | 2 +- src/cryptoconditions/src/asn/per_encoder.h | 4 +- src/cryptoconditions/src/asn/per_opentype.c | 2 +- src/cryptoconditions/src/asn/per_support.c | 2 +- src/cryptoconditions/src/asn/per_support.h | 2 +- src/cryptoconditions/src/asn/xer_decoder.c | 2 +- src/cryptoconditions/src/asn/xer_decoder.h | 2 +- src/cryptoconditions/src/asn/xer_encoder.h | 2 +- src/cryptoconditions/src/cryptoconditions.c | 30 +- .../src/include/secp256k1/Makefile.am | 2 +- src/dbwrapper.cpp | 108 + src/dbwrapper.h | 277 ++ src/deprecation.cpp | 32 +- src/deprecation.h | 4 +- src/fiat/verus | 7 + src/fiat/verus.bat | 14 + src/gtest/json_test_vectors.h | 4 +- src/gtest/main.cpp | 36 +- src/gtest/test_checkblock.cpp | 304 +- src/gtest/test_checktransaction.cpp | 292 +- src/gtest/test_circuit.cpp | 2 +- src/gtest/test_deprecation.cpp | 63 +- src/gtest/test_foundersreward.cpp | 11 +- src/gtest/test_joinsplit.cpp | 351 +- src/gtest/test_keys.cpp | 48 + src/gtest/test_keystore.cpp | 287 +- src/gtest/test_mempool.cpp | 48 +- src/gtest/test_merkletree.cpp | 93 +- src/gtest/test_noteencryption.cpp | 327 +- src/gtest/test_paymentdisclosure.cpp | 13 +- src/gtest/test_pedersen_hash.cpp | 15 + src/gtest/test_pow.cpp | 45 +- src/gtest/test_proofs.cpp | 8 +- src/gtest/test_rpc.cpp | 4 +- src/gtest/test_sapling_note.cpp | 72 + src/gtest/test_transaction.cpp | 62 +- src/gtest/test_transaction_builder.cpp | 335 ++ src/gtest/test_upgrades.cpp | 29 + src/gtest/test_validation.cpp | 31 +- src/gtest/test_zip32.cpp | 134 + src/hash.h | 115 +- src/httprpc.cpp | 6 +- src/httpserver.cpp | 2 +- src/httpserver.h | 3 + src/init.cpp | 143 +- src/key.cpp | 6 +- src/key.h | 21 +- src/key_io.cpp | 377 ++ src/key_io.h | 42 + src/keystore.cpp | 144 +- src/keystore.h | 183 +- src/komodo-tx.cpp | 252 +- src/komodo.h | 42 +- src/komodo_bitcoind.h | 344 +- src/komodo_defs.h | 8 +- src/komodo_gateway.h | 20 +- src/komodo_globals.h | 196 +- src/komodo_interest.h | 2 +- src/komodo_jumblr.h | 9 +- src/komodo_pax.h | 4 +- src/komodo_structs.h | 7 +- src/komodo_utils.h | 361 +- src/main.cpp | 1823 +++++---- src/main.h | 102 +- src/memusage.h | 10 +- src/merkleblock.cpp | 4 +- src/merkleblock.h | 4 +- src/metrics.cpp | 98 +- src/metrics.h | 6 +- src/miner.cpp | 856 ++++- src/miner.h | 4 +- src/net.cpp | 100 +- src/net.h | 7 +- src/netbase.h | 4 +- src/notarisationdb.cpp | 8 +- src/notarisationdb.h | 8 +- src/paymentdisclosure.cpp | 6 +- src/paymentdisclosure.h | 25 +- src/paymentdisclosuredb.cpp | 10 +- src/pow.cpp | 291 +- src/pow.h | 7 +- src/pow/tromp/equi_miner.h | 6 + src/prevector.h | 494 +++ src/primitives/block.cpp | 92 +- src/primitives/block.h | 122 +- src/primitives/nonce.cpp | 71 + src/primitives/nonce.h | 64 + src/primitives/transaction.cpp | 260 +- src/primitives/transaction.h | 411 ++- src/protocol.h | 17 +- src/pubkey.cpp | 6 +- src/pubkey.h | 39 +- src/qt/bitcoin.cpp | 2 +- src/qt/transactiondesc.cpp | 35 +- src/rest.cpp | 7 +- src/rpc/blockchain.cpp | 1674 +++++++++ src/rpc/client.cpp | 214 ++ src/rpc/client.h | 17 + src/rpc/crosschain.cpp | 308 ++ src/rpc/mining.cpp | 1014 +++++ src/rpc/misc.cpp | 1342 +++++++ src/rpc/net.cpp | 673 ++++ src/rpc/protocol.cpp | 127 + src/rpc/protocol.h | 93 + src/rpc/rawtransaction.cpp | 1313 +++++++ src/rpc/register.h | 32 + src/rpc/server.cpp | 818 ++++ src/rpc/server.h | 438 +++ src/rpcblockchain.old | 1622 ++++++++ src/script/cc.cpp | 8 + src/script/cc.h | 6 + src/script/interpreter.cpp | 125 +- src/script/interpreter.h | 5 +- src/script/script.cpp | 182 +- src/script/script.h | 35 +- src/script/script_ext.cpp | 121 + src/script/script_ext.h | 50 + src/script/serverchecker.cpp | 1 + src/script/serverchecker.h | 3 +- src/script/sigcache.cpp | 92 + src/script/sigcache.h | 26 + src/script/sign.cpp | 257 +- src/script/sign.h | 15 +- src/script/standard.cpp | 192 +- src/script/standard.h | 71 +- src/script/zcashconsensus.cpp | 9 +- src/sendalert.cpp | 13 +- src/serialize.h | 684 ++-- src/snark/Makefile | 18 +- .../domains/basic_radix2_domain_aux.tcc | 2 +- src/snark/libsnark/algebra/fields/bigint.hpp | 2 +- src/snark/libsnark/algebra/fields/bigint.tcc | 5 +- src/snark/libsnark/algebra/fields/fp.hpp | 8 +- src/snark/libsnark/algebra/fields/fp.tcc | 8 +- .../algebra/fields/fp12_2over3over2.tcc | 2 +- .../algebra/fields/tests/test_bigint.cpp | 39 +- .../algebra/fields/tests/test_fields.cpp | 2 +- src/snark/libsnark/common/profiling.cpp | 29 +- src/snark/libsnark/common/utils.cpp | 4 +- src/snark/libsnark/common/utils.hpp | 8 +- .../gadgetlib1/gadgets/basic_gadgets.tcc | 4 +- .../gadgets/hashes/sha256/sha256_aux.tcc | 2 +- .../hashes/sha256/sha256_components.hpp | 4 +- .../hashes/sha256/sha256_components.tcc | 6 +- .../gadgets/hashes/sha256/sha256_gadget.tcc | 4 +- .../merkle_tree_check_read_gadget.tcc | 2 +- .../merkle_tree_check_update_gadget.tcc | 2 +- src/snark/libsnark/gadgetlib1/pb_variable.hpp | 4 +- src/snark/libsnark/gadgetlib1/pb_variable.tcc | 4 +- .../qap/tests/test_qap.cpp | 10 +- src/spentindex.h | 4 +- src/streams.h | 165 +- src/support/pagelocker.h | 1 + src/sync.h | 1 + src/test-komodo/test_eval_bet.cpp | 2 +- src/test-komodo/test_eval_notarisation.cpp | 2 +- src/test-komodo/testutils.cpp | 4 +- src/test/DoS_tests.cpp | 6 +- src/test/alert_tests.cpp | 447 +++ src/test/base32_tests.cpp | 4 +- src/test/base58_tests.cpp | 158 +- src/test/base64_tests.cpp | 4 +- src/test/bctest.py | 1 - src/test/bech32_tests.cpp | 100 + src/test/bip32_tests.cpp | 34 +- src/test/bitcoin-util-test.py | 2 +- src/test/bloom_tests.cpp | 15 +- src/test/buildenv.py.in | 2 +- src/test/coins_tests.cpp | 449 ++- src/test/convertbits_tests.cpp | 52 + src/test/data/base58_keys_valid.json | 572 ++- src/test/data/bitcoin-util-test.json | 13 + src/test/data/merkle_commitments_sapling.json | 18 + src/test/data/merkle_path.json | 240 +- src/test/data/merkle_path_sapling.json | 122 + src/test/data/merkle_roots_empty_sapling.json | 65 + src/test/data/merkle_roots_sapling.json | 18 + .../data/merkle_serialization_sapling.json | 18 + .../merkle_witness_serialization_sapling.json | 138 + src/test/data/sapling_key_components.json | 14 + src/test/data/sighash.json | 1000 ++--- src/test/data/txcreatedata_seq0.hex | 1 + src/test/data/txcreatedata_seq1.hex | 1 + src/test/dbwrapper_tests.cpp | 234 ++ src/test/key_tests.cpp | 114 +- src/test/mempool_tests.cpp | 10 + src/test/miner_tests.cpp | 17 +- src/test/multisig_tests.cpp | 11 +- src/test/pmt_tests.cpp | 1 - src/test/pow_tests.cpp | 6 +- src/test/prevector_tests.cpp | 217 ++ src/test/rpc_tests.cpp | 20 +- src/test/rpc_wallet_tests.cpp | 479 ++- src/test/script_P2SH_tests.cpp | 48 +- src/test/script_tests.cpp | 76 +- src/test/serialize_tests.cpp | 79 +- src/test/sighash_tests.cpp | 54 +- src/test/sigopcount_tests.cpp | 2 +- src/test/skiplist_tests.cpp | 20 +- src/test/test_bitcoin.cpp | 31 + src/test/transaction_tests.cpp | 137 +- src/test/uint256_tests.cpp | 46 +- src/test/util_tests.cpp | 15 +- src/transaction_builder.cpp | 307 ++ src/transaction_builder.h | 112 + src/txdb.cpp | 419 ++- src/txdb.h | 25 +- src/txmempool.cpp | 301 +- src/txmempool.h | 19 +- src/uint252.h | 2 +- src/uint256.h | 18 +- src/undo.h | 30 +- src/util.cpp | 63 +- src/util.h | 13 + src/utilstrencodings.cpp | 310 +- src/utilstrencodings.h | 49 +- src/utiltest.cpp | 59 +- src/utiltest.h | 13 +- src/validationinterface.cpp | 11 +- src/validationinterface.h | 12 +- src/version.h | 5 +- src/verusd | 5 + src/verusd.bat | 10 + src/veruslaunch.cpp | 1424 +++++++ src/veruslaunch.h | 17 + src/wallet-utility.cpp | 8 + .../asyncrpcoperation_mergetoaddress.cpp | 124 +- src/wallet/asyncrpcoperation_mergetoaddress.h | 20 +- src/wallet/asyncrpcoperation_sendmany.cpp | 418 ++- src/wallet/asyncrpcoperation_sendmany.h | 38 +- .../asyncrpcoperation_shieldcoinbase.cpp | 154 +- src/wallet/asyncrpcoperation_shieldcoinbase.h | 28 +- src/wallet/crypter.cpp | 303 +- src/wallet/crypter.h | 63 +- src/wallet/gtest/test_transaction.cpp | 28 +- src/wallet/gtest/test_wallet.cpp | 1675 +++++++-- src/wallet/gtest/test_wallet_zkeys.cpp | 334 +- src/wallet/rpcdisclosure.cpp | 31 +- src/wallet/rpcdump.cpp | 250 +- src/wallet/rpcwallet.cpp | 1434 ++++--- src/wallet/rpcwallet.h | 12 + src/wallet/wallet.cpp | 2018 +++++++--- src/wallet/wallet.h | 433 ++- src/wallet/wallet_ismine.cpp | 25 +- src/wallet/wallet_ismine.h | 4 +- src/wallet/walletdb.cpp | 222 +- src/wallet/walletdb.h | 73 +- src/zcash/Address.cpp | 123 +- src/zcash/Address.hpp | 186 +- src/zcash/CreateJoinSplit.cpp | 1 - src/zcash/IncrementalMerkleTree.cpp | 54 +- src/zcash/IncrementalMerkleTree.hpp | 84 +- src/zcash/JoinSplit.cpp | 121 +- src/zcash/JoinSplit.hpp | 64 +- src/zcash/Note.cpp | 253 +- src/zcash/Note.hpp | 181 +- src/zcash/NoteEncryption.cpp | 239 ++ src/zcash/NoteEncryption.hpp | 92 +- src/zcash/Proof.cpp | 10 +- src/zcash/Proof.hpp | 22 +- src/zcash/Zcash.h | 13 + src/zcash/circuit/gadget.tcc | 24 +- src/zcash/circuit/merkle.tcc | 2 +- src/zcash/circuit/note.tcc | 12 +- src/zcash/prf.cpp | 74 + src/zcash/prf.h | 10 + src/zcash/zip32.cpp | 170 + src/zcash/zip32.h | 144 + src/zcbenchmarks.cpp | 236 +- src/zcbenchmarks.h | 4 + src/zcsymbols.txt | 3285 +++++++++++++++++ 393 files changed, 43240 insertions(+), 8042 deletions(-) create mode 100644 src/bech32.cpp create mode 100644 src/bech32.h create mode 100644 src/cc/CC made easy.md create mode 100755 src/cc/dapps/makedapps create mode 100644 src/cc/dapps/zmigrate.c create mode 100644 src/crypto/haraka.c create mode 100644 src/crypto/haraka.h create mode 100644 src/crypto/haraka_portable.c create mode 100644 src/crypto/haraka_portable.h create mode 100644 src/crypto/verus_hash.cpp create mode 100644 src/crypto/verus_hash.h create mode 100644 src/dbwrapper.cpp create mode 100644 src/dbwrapper.h create mode 100755 src/fiat/verus create mode 100644 src/fiat/verus.bat create mode 100644 src/gtest/test_keys.cpp create mode 100644 src/gtest/test_pedersen_hash.cpp create mode 100644 src/gtest/test_sapling_note.cpp create mode 100644 src/gtest/test_transaction_builder.cpp create mode 100644 src/gtest/test_zip32.cpp create mode 100644 src/key_io.cpp create mode 100644 src/key_io.h create mode 100644 src/prevector.h create mode 100644 src/primitives/nonce.cpp create mode 100644 src/primitives/nonce.h create mode 100644 src/rpc/blockchain.cpp create mode 100644 src/rpc/client.cpp create mode 100644 src/rpc/client.h create mode 100644 src/rpc/crosschain.cpp create mode 100644 src/rpc/mining.cpp create mode 100644 src/rpc/misc.cpp create mode 100644 src/rpc/net.cpp create mode 100644 src/rpc/protocol.cpp create mode 100644 src/rpc/protocol.h create mode 100644 src/rpc/rawtransaction.cpp create mode 100644 src/rpc/register.h create mode 100644 src/rpc/server.cpp create mode 100644 src/rpc/server.h create mode 100644 src/rpcblockchain.old create mode 100644 src/script/script_ext.cpp create mode 100644 src/script/script_ext.h create mode 100644 src/script/sigcache.cpp create mode 100644 src/script/sigcache.h create mode 100644 src/test/alert_tests.cpp create mode 100644 src/test/bech32_tests.cpp create mode 100644 src/test/convertbits_tests.cpp create mode 100644 src/test/data/merkle_commitments_sapling.json create mode 100644 src/test/data/merkle_path_sapling.json create mode 100644 src/test/data/merkle_roots_empty_sapling.json create mode 100644 src/test/data/merkle_roots_sapling.json create mode 100644 src/test/data/merkle_serialization_sapling.json create mode 100644 src/test/data/merkle_witness_serialization_sapling.json create mode 100644 src/test/data/sapling_key_components.json create mode 100644 src/test/data/txcreatedata_seq0.hex create mode 100644 src/test/data/txcreatedata_seq1.hex create mode 100644 src/test/dbwrapper_tests.cpp create mode 100644 src/test/prevector_tests.cpp create mode 100644 src/transaction_builder.cpp create mode 100644 src/transaction_builder.h create mode 100755 src/verusd create mode 100644 src/verusd.bat create mode 100644 src/veruslaunch.cpp create mode 100644 src/veruslaunch.h create mode 100644 src/wallet/rpcwallet.h create mode 100644 src/zcash/zip32.cpp create mode 100644 src/zcash/zip32.h create mode 100644 src/zcsymbols.txt diff --git a/src/Makefile.am b/src/Makefile.am index 694d67278..2f69758d3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ DIST_SUBDIRS = secp256k1 univalue cryptoconditions AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(SAN_LDFLAGS) $(HARDENED_LDFLAGS) AM_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS) AM_CPPFLAGS = $(HARDENED_CPPFLAGS) +EXTRA_LIBRARIES = if EMBEDDED_LEVELDB LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include @@ -20,10 +21,12 @@ $(LIBLEVELDB) $(LIBMEMENV): endif BITCOIN_CONFIG_INCLUDES=-I$(builddir)/config -BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS) +BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS) BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/include +BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/src +BITCOIN_INCLUDES += -I$(srcdir)/cryptoconditions/src/asn BITCOIN_INCLUDES += -I$(srcdir)/snark BITCOIN_INCLUDES += -I$(srcdir)/snark/libsnark BITCOIN_INCLUDES += -I$(srcdir)/univalue/include @@ -34,7 +37,7 @@ endif if TARGET_DARWIN LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl else -LIBBITCOIN_SERVER=libbitcoin_server.a +LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl endif LIBBITCOIN_WALLET=libbitcoin_wallet.a @@ -42,59 +45,74 @@ LIBBITCOIN_COMMON=libbitcoin_common.a LIBBITCOIN_CLI=libbitcoin_cli.a LIBBITCOIN_UTIL=libbitcoin_util.a LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a +LIBVERUS_CRYPTO=crypto/libverus_crypto.a +LIBVERUS_PORTABLE_CRYPTO=crypto/libverus_portable_crypto.a LIBSECP256K1=secp256k1/libsecp256k1.la LIBCRYPTOCONDITIONS=cryptoconditions/libcryptoconditions_core.la LIBSNARK=snark/libsnark.a LIBUNIVALUE=univalue/libunivalue.la -LIBZCASH=libzcash.a -lcurl +LIBZCASH=libzcash.a + +if ENABLE_ZMQ +LIBBITCOIN_ZMQ=libbitcoin_zmq.a +endif +if ENABLE_PROTON +LIBBITCOIN_PROTON=libbitcoin_proton.a +endif +if BUILD_BITCOIN_LIBS +LIBZCASH_CONSENSUS=libzcashconsensus.la +endif +if ENABLE_WALLET +LIBBITCOIN_WALLET=libbitcoin_wallet.a +endif $(LIBSECP256K1): $(wildcard secp256k1/src/*) $(wildcard secp256k1/include/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " -LIBSNARK_CXXFLAGS = -fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all +LIBSNARK_CXXFLAGS = $(AM_CXXFLAGS) $(PIC_FLAGS) -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all LIBSNARK_CONFIG_FLAGS = CURVE=ALT_BN128 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 NO_COMPILE_LIBGTEST=1 if HAVE_OPENMP LIBSNARK_CONFIG_FLAGS += MULTICORE=1 endif +if TARGET_DARWIN +LIBSNARK_CONFIG_FLAGS += PLATFORM=darwin +endif $(LIBSNARK): $(wildcard snark/src/*) - $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" + $(AM_V_at) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" libsnark-tests: $(wildcard snark/src/*) - $(AM_V_at) CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" + $(AM_V_at) CC="$(CC)" CXX="$(CXX)" AR="$(AR)" CXXFLAGS="$(LIBSNARK_CXXFLAGS)" $(MAKE) $(AM_MAKEFLAGS) -C snark/ check DEPINST="$(LIBSNARK_DEPINST)" $(LIBSNARK_CONFIG_FLAGS) OPTFLAGS="-O2 -march=x86-64" $(LIBUNIVALUE): $(wildcard univalue/lib/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue/ + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " $(LIBCRYPTOCONDITIONS): $(wildcard cryptoconditions/src/*) $(wildcard cryptoconditions/include/*) - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) OPTFLAGS="-O2 -march=x86-64 -g " # Make is not made aware of per-object dependencies to avoid limiting building parallelization # But to build the less dependent modules first, we manually select their order here: -EXTRA_LIBRARIES = \ - crypto/libbitcoin_crypto.a \ - libbitcoin_util.a \ - libbitcoin_common.a \ - libbitcoin_server.a \ - libbitcoin_cli.a \ - libzcash.a +EXTRA_LIBRARIES += \ + $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ + $(LIBBITCOIN_UTIL) \ + $(LIBBITCOIN_COMMON) \ + $(LIBBITCOIN_SERVER) \ + $(LIBBITCOIN_CLI) \ + libzcash.a if ENABLE_WALLET BITCOIN_INCLUDES += $(BDB_CPPFLAGS) -EXTRA_LIBRARIES += libbitcoin_wallet.a +EXTRA_LIBRARIES += $(LIBBITCOIN_WALLET) endif if ENABLE_ZMQ -EXTRA_LIBRARIES += libbitcoin_zmq.a +EXTRA_LIBRARIES += $(LIBBITCOIN_ZMQ) endif if ENABLE_PROTON -EXTRA_LIBRARIES += libbitcoin_proton.a +EXTRA_LIBRARIES += $(LIBBITCOIN_PROTON) endif -if BUILD_BITCOIN_LIBS -lib_LTLIBRARIES = libzcashconsensus.la -LIBZCASH_CONSENSUS=libzcashconsensus.la -else -LIBZCASH_CONSENSUS= -endif +lib_LTLIBRARIES = $(LIBZCASH_CONSENSUS) bin_PROGRAMS = noinst_PROGRAMS = @@ -121,7 +139,8 @@ LIBZCASH_H = \ zcash/prf.h \ zcash/Proof.hpp \ zcash/util.h \ - zcash/Zcash.h + zcash/Zcash.h \ + zcash/zip32.h .PHONY: FORCE collate-libsnark check-symbols check-security # bitcoin core # @@ -140,6 +159,7 @@ BITCOIN_CORE_H = \ asyncrpcoperation.h \ asyncrpcqueue.h \ base58.h \ + bech32.h \ bloom.h \ cc/eval.h \ chain.h \ @@ -162,14 +182,18 @@ BITCOIN_CORE_H = \ consensus/validation.h \ core_io.h \ core_memusage.h \ + crypto/haraka.h \ + crypto/haraka_portable.h \ + crypto/verus_hash.h \ deprecation.h \ hash.h \ httprpc.h \ httpserver.h \ init.h \ key.h \ + key_io.h \ keystore.h \ - leveldbwrapper.h \ + dbwrapper.h \ limitedmap.h \ main.h \ memusage.h \ @@ -184,15 +208,18 @@ BITCOIN_CORE_H = \ paymentdisclosuredb.h \ policy/fees.h \ pow.h \ + prevector.h \ primitives/block.h \ primitives/transaction.h \ + primitives/nonce.h \ protocol.h \ pubkey.h \ random.h \ reverselock.h \ - rpcclient.h \ - rpcprotocol.h \ - rpcserver.h \ + rpc/client.h \ + rpc/protocol.h \ + rpc/server.h \ + rpc/register.h \ scheduler.h \ script/interpreter.h \ script/script.h \ @@ -212,6 +239,7 @@ BITCOIN_CORE_H = \ timedata.h \ tinyformat.h \ torcontrol.h \ + transaction_builder.h \ txdb.h \ txmempool.h \ ui_interface.h \ @@ -229,9 +257,11 @@ BITCOIN_CORE_H = \ wallet/asyncrpcoperation_shieldcoinbase.h \ wallet/crypter.h \ wallet/db.h \ + wallet/rpcwallet.h \ wallet/wallet.h \ wallet/wallet_ismine.h \ wallet/walletdb.h \ + veruslaunch.h \ zmq/zmqabstractnotifier.h \ zmq/zmqconfig.h\ zmq/zmqnotificationinterface.h \ @@ -280,14 +310,18 @@ libbitcoin_server_a_SOURCES = \ chain.cpp \ checkpoints.cpp \ crosschain.cpp \ + crypto/haraka.h \ + crypto/haraka_portable.h \ + crypto/verus_hash.h \ + crypto/verus_hash.cpp \ deprecation.cpp \ httprpc.cpp \ httpserver.cpp \ init.cpp \ - leveldbwrapper.cpp \ + dbwrapper.cpp \ main.cpp \ merkleblock.cpp \ - metrics.cpp \ + metrics.h \ miner.cpp \ net.cpp \ noui.cpp \ @@ -297,14 +331,15 @@ libbitcoin_server_a_SOURCES = \ policy/fees.cpp \ pow.cpp \ rest.cpp \ - rpcblockchain.cpp \ - rpccrosschain.cpp \ - rpcmining.cpp \ - rpcmisc.cpp \ - rpcnet.cpp \ - rpcrawtransaction.cpp \ - rpcserver.cpp \ + rpc/blockchain.cpp \ + rpc/crosschain.cpp \ + rpc/mining.cpp \ + rpc/misc.cpp \ + rpc/net.cpp \ + rpc/rawtransaction.cpp \ + rpc/server.cpp \ script/serverchecker.cpp \ + script/sigcache.cpp \ timedata.cpp \ torcontrol.cpp \ txdb.cpp \ @@ -314,8 +349,6 @@ libbitcoin_server_a_SOURCES = \ $(LIBZCASH_H) if ENABLE_ZMQ -LIBBITCOIN_ZMQ=libbitcoin_zmq.a - libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS) libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_zmq_a_SOURCES = \ @@ -325,8 +358,6 @@ libbitcoin_zmq_a_SOURCES = \ endif if ENABLE_PROTON -LIBBITCOIN_PROTON=libbitcoin_proton.a - libbitcoin_proton_a_CPPFLAGS = $(BITCOIN_INCLUDES) libbitcoin_proton_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_proton_a_SOURCES = \ @@ -350,6 +381,7 @@ libbitcoin_wallet_a_SOURCES = \ wallet/db.cpp \ paymentdisclosure.cpp \ paymentdisclosuredb.cpp \ + transaction_builder.cpp \ wallet/rpcdisclosure.cpp \ wallet/rpcdump.cpp \ cc/CCassetstx.cpp \ @@ -358,6 +390,7 @@ libbitcoin_wallet_a_SOURCES = \ wallet/wallet.cpp \ wallet/wallet_ismine.cpp \ wallet/walletdb.cpp \ + zcash/zip32.cpp \ $(BITCOIN_CORE_H) \ $(LIBZCASH_H) @@ -365,22 +398,26 @@ libbitcoin_wallet_a_SOURCES = \ crypto_libbitcoin_crypto_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_CONFIG_INCLUDES) crypto_libbitcoin_crypto_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) crypto_libbitcoin_crypto_a_SOURCES = \ - crypto/common.h \ - crypto/equihash.cpp \ - crypto/equihash.h \ - crypto/equihash.tcc \ - crypto/hmac_sha256.cpp \ - crypto/hmac_sha256.h \ - crypto/hmac_sha512.cpp \ - crypto/hmac_sha512.h \ - crypto/ripemd160.cpp \ - crypto/ripemd160.h \ - crypto/sha1.cpp \ - crypto/sha1.h \ - crypto/sha256.cpp \ - crypto/sha256.h \ - crypto/sha512.cpp \ - crypto/sha512.h + crypto/common.h \ + crypto/equihash.cpp \ + crypto/equihash.h \ + crypto/equihash.tcc \ + crypto/hmac_sha256.cpp \ + crypto/hmac_sha256.h \ + crypto/hmac_sha512.cpp \ + crypto/hmac_sha512.h \ + crypto/ripemd160.cpp \ + crypto/ripemd160.h \ + crypto/sha1.cpp \ + crypto/sha1.h \ + crypto/sha256.cpp \ + crypto/sha256.h \ + crypto/sha512.cpp \ + crypto/sha512.h \ + crypto/haraka.h \ + crypto/haraka_portable.h \ + crypto/verus_hash.h \ + crypto/verus_hash.cpp if ENABLE_MINING EQUIHASH_TROMP_SOURCES = \ @@ -394,35 +431,60 @@ crypto_libbitcoin_crypto_a_SOURCES += \ ${EQUIHASH_TROMP_SOURCES} endif +# Verus hash specific library - optimized +crypto_libverus_crypto_a_CPPFLAGS = -O3 -Wint-conversion -march=x86-64 -msse4 -msse4.1 -msse4.2 -mssse3 -mavx -maes -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS) +crypto_libverus_crypto_a_CXXFLAGS = -O3 -Wint-conversion -march=x86-64 -msse4 -msse4.1 -msse4.2 -mssse3 -mavx -maes -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS) +crypto_libverus_crypto_a_SOURCES = \ + crypto/haraka.h \ + crypto/haraka.c + +# Verus hash specific library - portable +crypto_libverus_portable_crypto_a_CPPFLAGS = -O3 -Wint-conversion -march=x86-64 -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CPPFLAGS) +crypto_libverus_portable_crypto_a_CXXFLAGS = -O3 -Wint-conversion -march=x86-64 -g -funroll-loops -fomit-frame-pointer -fPIC $(AM_CXXFLAGS) +crypto_libverus_portable_crypto_a_SOURCES = \ + crypto/haraka_portable.h \ + crypto/haraka_portable.c + # common: shared between zcashd and non-server tools -libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +libbitcoin_common_a_CPPFLAGS = -fPIC $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) +libbitcoin_common_a_CXXFLAGS = -fPIC $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_common_a_SOURCES = \ amount.cpp \ arith_uint256.cpp \ base58.cpp \ + bech32.cpp \ chainparams.cpp \ coins.cpp \ compressor.cpp \ consensus/upgrades.cpp \ core_read.cpp \ core_write.cpp \ + crypto/haraka.h \ + crypto/haraka_portable.h \ + crypto/verus_hash.h \ + crypto/verus_hash.cpp \ hash.cpp \ importcoin.cpp \ key.cpp \ + key_io.cpp \ keystore.cpp \ netbase.cpp \ + metrics.cpp \ primitives/block.cpp \ primitives/transaction.cpp \ + primitives/nonce.cpp \ protocol.cpp \ pubkey.cpp \ scheduler.cpp \ script/cc.cpp \ script/interpreter.cpp \ script/script.cpp \ + script/script_ext.cpp \ script/script_error.cpp \ script/sign.cpp \ script/standard.cpp \ + veruslaunch.cpp \ + transaction_builder.cpp \ $(BITCOIN_CORE_H) \ $(LIBZCASH_H) @@ -432,23 +494,23 @@ libbitcoin_common_a_SOURCES = \ libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_util_a_SOURCES = \ - support/pagelocker.cpp \ - chainparamsbase.cpp \ - clientversion.cpp \ - compat/glibc_sanity.cpp \ - compat/glibcxx_sanity.cpp \ - compat/strnlen.cpp \ - random.cpp \ - rpcprotocol.cpp \ - support/cleanse.cpp \ - sync.cpp \ - uint256.cpp \ - util.cpp \ - utilmoneystr.cpp \ - utilstrencodings.cpp \ - utiltime.cpp \ - $(BITCOIN_CORE_H) \ - $(LIBZCASH_H) + support/pagelocker.cpp \ + chainparamsbase.cpp \ + clientversion.cpp \ + compat/glibc_sanity.cpp \ + compat/glibcxx_sanity.cpp \ + compat/strnlen.cpp \ + random.cpp \ + rpc/protocol.cpp \ + support/cleanse.cpp \ + sync.cpp \ + uint256.cpp \ + util.cpp \ + utilmoneystr.cpp \ + utilstrencodings.cpp \ + utiltime.cpp \ + $(BITCOIN_CORE_H) \ + $(LIBZCASH_H) if GLIBC_BACK_COMPAT libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp @@ -458,9 +520,9 @@ endif libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_cli_a_SOURCES = \ - rpcclient.cpp \ - $(BITCOIN_CORE_H) \ - $(LIBZCASH_H) + rpc/client.cpp \ + $(BITCOIN_CORE_H) \ + $(LIBZCASH_H) nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h # @@ -480,7 +542,11 @@ komodod_LDADD = \ $(LIBBITCOIN_COMMON) \ $(LIBUNIVALUE) \ $(LIBBITCOIN_UTIL) \ + $(LIBBITCOIN_ZMQ) \ + $(LIBBITCOIN_PROTON) \ $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBZCASH) \ $(LIBSNARK) \ $(LIBLEVELDB) \ @@ -488,12 +554,8 @@ komodod_LDADD = \ $(LIBSECP256K1) \ $(LIBCRYPTOCONDITIONS) -if ENABLE_ZMQ -komodod_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) -endif - if ENABLE_WALLET -komodod_LDADD += libbitcoin_wallet.a +komodod_LDADD += $(LIBBITCOIN_WALLET) endif komodod_LDADD += \ @@ -503,7 +565,11 @@ komodod_LDADD += \ $(CRYPTO_LIBS) \ $(EVENT_PTHREADS_LIBS) \ $(EVENT_LIBS) \ + $(ZMQ_LIBS) \ + $(PROTON_LIBS) \ $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBZCASH_LIBS) if ENABLE_PROTON @@ -538,6 +604,8 @@ komodo_cli_LDADD = \ $(EVENT_LIBS) \ $(LIBZCASH) \ $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBZCASH_LIBS) if ENABLE_WALLET @@ -545,6 +613,8 @@ wallet_utility_LDADD = \ libbitcoin_wallet.a \ $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBSECP256K1) \ $(LIBBITCOIN_UTIL) \ $(BOOST_LIBS) \ @@ -575,6 +645,8 @@ komodo_tx_LDADD = \ $(LIBZCASH) \ $(LIBSNARK) \ $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ + $(LIBVERUS_PORTABLE_CRYPTO) \ $(LIBZCASH_LIBS) \ $(LIBCRYPTOCONDITIONS) @@ -591,6 +663,7 @@ libzcash_a_SOURCES = \ zcash/Note.cpp \ zcash/prf.cpp \ zcash/util.cpp \ + zcash/zip32.cpp \ zcash/circuit/commitment.tcc \ zcash/circuit/gadget.tcc \ zcash/circuit/merkle.tcc \ @@ -600,6 +673,10 @@ libzcash_a_SOURCES = \ libzcash_a_CPPFLAGS = -DMULTICORE -fopenmp -fPIC -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS $(HARDENED_CPPFLAGS) $(HARDENED_CXXFLAGS) $(HARDENED_LDFLAGS) -pipe $(SAN_LDFLAGS) -O1 -g -Wstack-protector $(SAN_CXXFLAGS) -fstack-protector-all -fPIE -fvisibility=hidden -DSTATIC $(BITCOIN_INCLUDES) +#libzcash_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +#libzcash_a_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +#libzcash_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) -DMONTGOMERY_OUTPUT + libzcash_a_CXXFLAGS = $(SAN_CXXFLAGS) $(HARDENED_CXXFLAGS) -fwrapv -fno-strict-aliasing libzcash_a_LDFLAGS = $(SAN_LDFLAGS) $(HARDENED_LDFLAGS) libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT @@ -616,6 +693,7 @@ libzcashconsensus_la_SOURCES = \ crypto/sha512.cpp \ hash.cpp \ primitives/transaction.cpp \ + primitives/nonce.cpp \ pubkey.cpp \ script/zcashconsensus.cpp \ script/interpreter.cpp \ @@ -645,6 +723,7 @@ clean-local: -$(MAKE) -C leveldb clean -$(MAKE) -C secp256k1 clean -$(MAKE) -C snark clean + -$(MAKE) -C univalue clean rm -f leveldb/*/*.gcno leveldb/helpers/memenv/*.gcno -rm -f config.h @@ -677,5 +756,3 @@ include Makefile.ktest.include #include Makefile.test.include #include Makefile.gtest.include endif - -include Makefile.zcash.include diff --git a/src/Makefile.gtest.include b/src/Makefile.gtest.include index f70672052..ec3a4a12e 100644 --- a/src/Makefile.gtest.include +++ b/src/Makefile.gtest.include @@ -23,6 +23,7 @@ zcash_gtest_SOURCES += \ gtest/test_equihash.cpp \ gtest/test_httprpc.cpp \ gtest/test_joinsplit.cpp \ + gtest/test_keys.cpp \ gtest/test_keystore.cpp \ gtest/test_noteencryption.cpp \ gtest/test_mempool.cpp \ @@ -32,7 +33,9 @@ zcash_gtest_SOURCES += \ gtest/test_pow.cpp \ gtest/test_random.cpp \ gtest/test_rpc.cpp \ + gtest/test_sapling_note.cpp \ gtest/test_transaction.cpp \ + gtest/test_transaction_builder.cpp \ gtest/test_upgrades.cpp \ gtest/test_validation.cpp \ gtest/test_circuit.cpp \ @@ -40,7 +43,9 @@ zcash_gtest_SOURCES += \ gtest/test_libzcash_utils.cpp \ gtest/test_proofs.cpp \ gtest/test_paymentdisclosure.cpp \ - gtest/test_checkblock.cpp + gtest/test_pedersen_hash.cpp \ + gtest/test_checkblock.cpp \ + gtest/test_zip32.cpp if ENABLE_WALLET zcash_gtest_SOURCES += \ wallet/gtest/test_wallet.cpp @@ -49,7 +54,7 @@ endif komodo_gtest_CPPFLAGS = $(AM_CPPFLAGS) -DMULTICORE -fopenmp -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DSTATIC $(BITCOIN_INCLUDES) komodo_gtest_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -komodo_gtest_LDADD = -lgtest -lgmock $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ +komodo_gtest_LDADD = -lgtest -lgmock $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBVERUS_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) if ENABLE_ZMQ zcash_gtest_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c21016737..6afc3a707 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -361,7 +361,7 @@ qt_komodo_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER) if ENABLE_WALLET qt_komodo_qt_LDADD += $(LIBBITCOIN_WALLET) endif -qt_komodo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ +qt_komodo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBVERUS_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBZCASH_LIBS) qt_komodo_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) qt_komodo_qt_LIBTOOLFLAGS = --tag CXX diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include index 3e57a8926..2d56d07e3 100644 --- a/src/Makefile.qttest.include +++ b/src/Makefile.qttest.include @@ -30,7 +30,7 @@ qt_test_test_komodo_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) if ENABLE_WALLET qt_test_test_komodo_qt_LDADD += $(LIBBITCOIN_WALLET) endif -qt_test_test_komodo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) \ +qt_test_test_komodo_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBVERUS_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) \ $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \ $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBZCASH_LIBS) qt_test_test_komodo_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) diff --git a/src/Makefile.test.include b/src/Makefile.test.include index a52b66335..1f9f9ac1e 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -20,78 +20,89 @@ EXTRA_DIST += \ test/data/wallet.dat JSON_TEST_FILES = \ - test/data/script_valid.json \ - test/data/base58_keys_valid.json \ - test/data/base58_encode_decode.json \ - test/data/base58_keys_invalid.json \ - test/data/script_invalid.json \ - test/data/tx_invalid.json \ - test/data/tx_valid.json \ - test/data/sighash.json \ - test/data/merkle_roots.json \ - test/data/merkle_roots_empty.json \ - test/data/merkle_serialization.json \ - test/data/merkle_witness_serialization.json \ - test/data/merkle_path.json \ - test/data/merkle_commitments.json \ - test/data/g1_compressed.json \ - test/data/g2_compressed.json + test/data/script_valid.json \ + test/data/base58_keys_valid.json \ + test/data/base58_encode_decode.json \ + test/data/base58_keys_invalid.json \ + test/data/script_invalid.json \ + test/data/tx_invalid.json \ + test/data/tx_valid.json \ + test/data/sighash.json \ + test/data/merkle_roots.json \ + test/data/merkle_roots_empty.json \ + test/data/merkle_serialization.json \ + test/data/merkle_witness_serialization.json \ + test/data/merkle_path.json \ + test/data/merkle_commitments.json \ + test/data/merkle_roots_sapling.json \ + test/data/merkle_roots_empty_sapling.json \ + test/data/merkle_serialization_sapling.json \ + test/data/merkle_witness_serialization_sapling.json \ + test/data/merkle_path_sapling.json \ + test/data/merkle_commitments_sapling.json \ + test/data/g1_compressed.json \ + test/data/g2_compressed.json \ + test/data/sapling_key_components.json RAW_TEST_FILES = test/data/alertTests.raw GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h) BITCOIN_TESTS =\ - test/arith_uint256_tests.cpp \ - test/bignum.h \ - test/addrman_tests.cpp \ - test/allocator_tests.cpp \ - test/base32_tests.cpp \ - test/base58_tests.cpp \ - test/base64_tests.cpp \ - test/bip32_tests.cpp \ - test/bloom_tests.cpp \ - test/checkblock_tests.cpp \ - test/Checkpoints_tests.cpp \ - test/coins_tests.cpp \ - test/compress_tests.cpp \ - test/crypto_tests.cpp \ - test/DoS_tests.cpp \ - test/equihash_tests.cpp \ - test/getarg_tests.cpp \ - test/hash_tests.cpp \ - test/key_tests.cpp \ - test/main_tests.cpp \ - test/mempool_tests.cpp \ - test/miner_tests.cpp \ - test/mruset_tests.cpp \ - test/multisig_tests.cpp \ - test/netbase_tests.cpp \ - test/pmt_tests.cpp \ - test/policyestimator_tests.cpp \ - test/pow_tests.cpp \ - test/raii_event_tests.cpp \ - test/reverselock_tests.cpp \ - test/rpc_tests.cpp \ - test/sanity_tests.cpp \ - test/scheduler_tests.cpp \ - test/script_P2SH_tests.cpp \ - test/script_P2PKH_tests.cpp \ - test/script_tests.cpp \ - test/scriptnum_tests.cpp \ - test/serialize_tests.cpp \ - test/sighash_tests.cpp \ - test/sigopcount_tests.cpp \ - test/skiplist_tests.cpp \ - test/test_bitcoin.cpp \ - test/test_bitcoin.h \ - test/timedata_tests.cpp \ - test/torcontrol_tests.cpp \ - test/transaction_tests.cpp \ - test/uint256_tests.cpp \ - test/univalue_tests.cpp \ - test/util_tests.cpp \ - test/sha256compress_tests.cpp + test/arith_uint256_tests.cpp \ + test/bignum.h \ + test/addrman_tests.cpp \ + test/alert_tests.cpp \ + test/allocator_tests.cpp \ + test/base32_tests.cpp \ + test/base58_tests.cpp \ + test/base64_tests.cpp \ + test/bech32_tests.cpp \ + test/bip32_tests.cpp \ + test/bloom_tests.cpp \ + test/checkblock_tests.cpp \ + test/Checkpoints_tests.cpp \ + test/coins_tests.cpp \ + test/compress_tests.cpp \ + test/convertbits_tests.cpp \ + test/crypto_tests.cpp \ + test/DoS_tests.cpp \ + test/equihash_tests.cpp \ + test/getarg_tests.cpp \ + test/hash_tests.cpp \ + test/key_tests.cpp \ + test/dbwrapper_tests.cpp \ + test/main_tests.cpp \ + test/mempool_tests.cpp \ + test/miner_tests.cpp \ + test/mruset_tests.cpp \ + test/multisig_tests.cpp \ + test/netbase_tests.cpp \ + test/pmt_tests.cpp \ + test/policyestimator_tests.cpp \ + test/pow_tests.cpp \ + test/prevector_tests.cpp \ + test/raii_event_tests.cpp \ + test/reverselock_tests.cpp \ + test/rpc_tests.cpp \ + test/sanity_tests.cpp \ + test/scheduler_tests.cpp \ + test/script_P2SH_tests.cpp \ + test/script_tests.cpp \ + test/scriptnum_tests.cpp \ + test/serialize_tests.cpp \ + test/sighash_tests.cpp \ + test/sigopcount_tests.cpp \ + test/skiplist_tests.cpp \ + test/test_bitcoin.cpp \ + test/test_bitcoin.h \ + test/timedata_tests.cpp \ + test/torcontrol_tests.cpp \ + test/transaction_tests.cpp \ + test/uint256_tests.cpp \ + test/univalue_tests.cpp \ + test/util_tests.cpp \ + test/sha256compress_tests.cpp if ENABLE_WALLET BITCOIN_TESTS += \ @@ -102,12 +113,15 @@ endif test_test_bitcoin_SOURCES = $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES) test_test_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) -fopenmp $(BITCOIN_INCLUDES) -I$(builddir)/test/ $(TESTDEFS) $(EVENT_CFLAGS) -test_test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ +test_test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBVERUS_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \ $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) if ENABLE_WALLET test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET) endif +test_test_bitcoin_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) \ + $(LIBLEVELDB) $(LIBMEMENV) $(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS) +test_test_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) test_test_bitcoin_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(LIBZCASH) $(LIBSNARK) $(LIBZCASH_LIBS) test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static diff --git a/src/Makefile.zcash.include b/src/Makefile.zcash.include index da5b4344d..4302b2e0d 100644 --- a/src/Makefile.zcash.include +++ b/src/Makefile.zcash.include @@ -24,6 +24,7 @@ zcash_CreateJoinSplit_LDADD = \ $(LIBSNARK) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) \ + $(LIBVERUS_CRYPTO) \ $(BOOST_LIBS) \ $(LIBZCASH_LIBS) \ $(LIBCRYPTOCONDITIONS) \ diff --git a/src/addrman.h b/src/addrman.h index 0483e8bdb..5c77a4fdb 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -54,7 +54,7 @@ public: ADD_SERIALIZE_METHODS; template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(*(CAddress*)this); READWRITE(source); READWRITE(nLastSuccess); @@ -279,7 +279,7 @@ public: * very little in common. */ template - void Serialize(Stream &s, int nType, int nVersionDummy) const + void Serialize(Stream &s) const { LOCK(cs); @@ -329,7 +329,7 @@ public: } template - void Unserialize(Stream& s, int nType, int nVersionDummy) + void Unserialize(Stream& s) { LOCK(cs); @@ -434,11 +434,6 @@ public: Check(); } - unsigned int GetSerializeSize(int nType, int nVersion) const - { - return (CSizeComputer(nType, nVersion) << *this).size(); - } - void Clear() { std::vector().swap(vRandom); diff --git a/src/alert.h b/src/alert.h index 76d8d916e..4e3b88775 100644 --- a/src/alert.h +++ b/src/alert.h @@ -49,9 +49,8 @@ public: ADD_SERIALIZE_METHODS; template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(this->nVersion); - nVersion = this->nVersion; READWRITE(nRelayUntil); READWRITE(nExpiration); READWRITE(nID); @@ -87,7 +86,7 @@ public: ADD_SERIALIZE_METHODS; template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(vchMsg); READWRITE(vchSig); } diff --git a/src/amount.h b/src/amount.h index 9b62f7663..7423fdaa1 100644 --- a/src/amount.h +++ b/src/amount.h @@ -58,7 +58,7 @@ public: ADD_SERIALIZE_METHODS; template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(nSatoshisPerK); } }; diff --git a/src/assetchains.json b/src/assetchains.json index 44885c9d4..d26f3a99a 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -186,28 +186,5 @@ "addnode": [ "51.75.124.34" ] - }, - { - "ac_name": "KMDICE", - "ac_supply": "10500000", - "ac_reward": "2500000000", - "ac_halving": "210000", - "ac_cc": "2", - "addressindex": "1", - "spentindex": "1", - "addnode": [ - "144.76.217.232" - ] - }, - { - "ac_name": "ZEX", - "ac_founders": "1", - "ac_reward": "13000000000", - "ac_halving": "525600", - "ac_cc": "2", - "ac_pubkey": "039d4a50cc70d1184e462a22edb3b66385da97cc8059196f8305c184a3e21440af", - "addnode": [ - "5.9.102.210" - ] } ] diff --git a/src/assetchains.old b/src/assetchains.old index 29f14198c..42a1effb6 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -44,4 +44,3 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=PGT -ac_supply=10000000 -ac_end=1 -addnode=190.114.254.104 & ./komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=144.76.217.232 & ./komodod -pubkey=$pubkey -ac_name=DION -ac_supply=3900000000 -ac_reward=22260000000 -ac_staked=100 -ac_cc=1 -ac_end=4300000000 -addnode=51.75.124.34 & -./komodod -pubkey=$pubkey -ac_name=ZEX -ac_cc=2 -ac_founders=1 -ac_halving=525600 -ac_reward=13000000000 -ac_pubkey=039d4a50cc70d1184e462a22edb3b66385da97cc8059196f8305c184a3e21440af -addnode=5.9.102.210 & diff --git a/src/asyncrpcoperation.cpp b/src/asyncrpcoperation.cpp index f32e8d716..ff5c4cb9f 100644 --- a/src/asyncrpcoperation.cpp +++ b/src/asyncrpcoperation.cpp @@ -16,7 +16,7 @@ using namespace std; static boost::uuids::random_generator uuidgen; -std::map OperationStatusMap = { +static std::map OperationStatusMap = { {OperationStatus::READY, "queued"}, {OperationStatus::EXECUTING, "executing"}, {OperationStatus::CANCELLED, "cancelled"}, diff --git a/src/base58.cpp b/src/base58.cpp index c086cc854..12978fa1c 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -4,15 +4,12 @@ #include "base58.h" -#include "hash.h" -#include "uint256.h" - -#include "version.h" -#include "streams.h" +#include +#include #include -#include #include +#include #include #include #include @@ -104,7 +101,7 @@ std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend) std::string EncodeBase58(const std::vector& vch) { - return EncodeBase58(&vch[0], &vch[0] + vch.size()); + return EncodeBase58(vch.data(), vch.data() + vch.size()); } bool DecodeBase58(const std::string& str, std::vector& vchRet) @@ -143,6 +140,7 @@ bool DecodeBase58Check(const std::string& str, std::vector& vchRe return DecodeBase58Check(str.c_str(), vchRet); } + CBase58Data::CBase58Data() { vchVersion.clear(); @@ -215,6 +213,7 @@ public: CBitcoinAddressVisitor(CBitcoinAddress* addrIn) : addr(addrIn) {} bool operator()(const CKeyID& id) const { return addr->Set(id); } + bool operator()(const CPubKey& key) const { return addr->Set(key); } bool operator()(const CScriptID& id) const { return addr->Set(id); } bool operator()(const CNoDestination& no) const { return false; } }; @@ -227,6 +226,13 @@ bool CBitcoinAddress::Set(const CKeyID& id) return true; } +bool CBitcoinAddress::Set(const CPubKey& key) +{ + CKeyID id = key.GetID(); + SetData(Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS), &id, 20); + return true; +} + bool CBitcoinAddress::Set(const CScriptID& id) { SetData(Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS), &id, 20); @@ -302,6 +308,14 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const return true; } +bool CBitcoinAddress::GetKeyID_NoCheck(CKeyID& keyID) const +{ + uint160 id; + memcpy(&id, &vchData[0], 20); + keyID = CKeyID(id); + return true; +} + bool CBitcoinAddress::IsScript() const { return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS); @@ -373,27 +387,3 @@ DATA_TYPE CZCEncoding::Get() const ss >> ret; return ret; } - -// Explicit instantiations for libzcash::PaymentAddress -template bool CZCEncoding::Set(const libzcash::PaymentAddress& addr); -template libzcash::PaymentAddress CZCEncoding::Get() const; - -// Explicit instantiations for libzcash::ViewingKey -template bool CZCEncoding::Set(const libzcash::ViewingKey& vk); -template libzcash::ViewingKey CZCEncoding::Get() const; - -// Explicit instantiations for libzcash::SpendingKey -template bool CZCEncoding::Set(const libzcash::SpendingKey& sk); -template libzcash::SpendingKey CZCEncoding::Get() const; diff --git a/src/base58.h b/src/base58.h index 73e1c4d94..66cb7e7a0 100644 --- a/src/base58.h +++ b/src/base58.h @@ -58,13 +58,13 @@ std::string EncodeBase58Check(const std::vector& vchIn); * Decode a base58-encoded string (psz) that includes a checksum into a byte * vector (vchRet), return true if decoding is successful */ -inline bool DecodeBase58Check(const char* psz, std::vector& vchRet); +bool DecodeBase58Check(const char* psz, std::vector& vchRet); /** * Decode a base58-encoded string (str) that includes a checksum into a byte * vector (vchRet), return true if decoding is successful */ -inline bool DecodeBase58Check(const std::string& str, std::vector& vchRet); +bool DecodeBase58Check(const std::string& str, std::vector& vchRet); /** * Base class for all base58-encoded data @@ -107,39 +107,6 @@ public: DATA_TYPE Get() const; }; -class CZCPaymentAddress : public CZCEncoding { -protected: - std::string PrependName(const std::string& s) const { return "payment address" + s; } - -public: - CZCPaymentAddress() {} - - CZCPaymentAddress(const std::string& strAddress) { SetString(strAddress.c_str(), 2); } - CZCPaymentAddress(const libzcash::PaymentAddress& addr) { Set(addr); } -}; - -class CZCViewingKey : public CZCEncoding { -protected: - std::string PrependName(const std::string& s) const { return "viewing key" + s; } - -public: - CZCViewingKey() {} - - CZCViewingKey(const std::string& strViewingKey) { SetString(strViewingKey.c_str(), 3); } - CZCViewingKey(const libzcash::ViewingKey& vk) { Set(vk); } -}; - -class CZCSpendingKey : public CZCEncoding { -protected: - std::string PrependName(const std::string& s) const { return "spending key" + s; } - -public: - CZCSpendingKey() {} - - CZCSpendingKey(const std::string& strAddress) { SetString(strAddress.c_str(), 2); } - CZCSpendingKey(const libzcash::SpendingKey& addr) { Set(addr); } -}; - /** base58-encoded Bitcoin addresses. * Public-key-hash-addresses have version 0 (or 111 testnet). * The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key. @@ -149,6 +116,7 @@ public: class CBitcoinAddress : public CBase58Data { public: bool Set(const CKeyID &id); + bool Set(const CPubKey &key); bool Set(const CScriptID &id); bool Set(const CTxDestination &dest); bool IsValid() const; @@ -163,6 +131,7 @@ public: CTxDestination Get() const; bool GetKeyID(CKeyID &keyID) const; + bool GetKeyID_NoCheck(CKeyID& keyID) const; bool GetIndexKey(uint160& hashBytes, int& type) const; bool IsScript() const; }; diff --git a/src/bech32.cpp b/src/bech32.cpp new file mode 100644 index 000000000..78c35b976 --- /dev/null +++ b/src/bech32.cpp @@ -0,0 +1,194 @@ +// Copyright (c) 2017 Pieter Wuille +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "bech32.h" + +namespace +{ + +typedef std::vector data; + +/** The Bech32 character set for encoding. */ +const char* CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; + +/** The Bech32 character set for decoding. */ +const int8_t CHARSET_REV[128] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 15, -1, 10, 17, 21, 20, 26, 30, 7, 5, -1, -1, -1, -1, -1, -1, + -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, + 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1, + -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, + 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1 +}; + +/** Concatenate two byte arrays. */ +data Cat(data x, const data& y) +{ + x.insert(x.end(), y.begin(), y.end()); + return x; +} + +/** This function will compute what 6 5-bit values to XOR into the last 6 input values, in order to + * make the checksum 0. These 6 values are packed together in a single 30-bit integer. The higher + * bits correspond to earlier values. */ +uint32_t PolyMod(const data& v) +{ + // The input is interpreted as a list of coefficients of a polynomial over F = GF(32), with an + // implicit 1 in front. If the input is [v0,v1,v2,v3,v4], that polynomial is v(x) = + // 1*x^5 + v0*x^4 + v1*x^3 + v2*x^2 + v3*x + v4. The implicit 1 guarantees that + // [v0,v1,v2,...] has a distinct checksum from [0,v0,v1,v2,...]. + + // The output is a 30-bit integer whose 5-bit groups are the coefficients of the remainder of + // v(x) mod g(x), where g(x) is the Bech32 generator, + // x^6 + {29}x^5 + {22}x^4 + {20}x^3 + {21}x^2 + {29}x + {18}. g(x) is chosen in such a way + // that the resulting code is a BCH code, guaranteeing detection of up to 3 errors within a + // window of 1023 characters. Among the various possible BCH codes, one was selected to in + // fact guarantee detection of up to 4 errors within a window of 89 characters. + + // Note that the coefficients are elements of GF(32), here represented as decimal numbers + // between {}. In this finite field, addition is just XOR of the corresponding numbers. For + // example, {27} + {13} = {27 ^ 13} = {22}. Multiplication is more complicated, and requires + // treating the bits of values themselves as coefficients of a polynomial over a smaller field, + // GF(2), and multiplying those polynomials mod a^5 + a^3 + 1. For example, {5} * {26} = + // (a^2 + 1) * (a^4 + a^3 + a) = (a^4 + a^3 + a) * a^2 + (a^4 + a^3 + a) = a^6 + a^5 + a^4 + a + // = a^3 + 1 (mod a^5 + a^3 + 1) = {9}. + + // During the course of the loop below, `c` contains the bitpacked coefficients of the + // polynomial constructed from just the values of v that were processed so far, mod g(x). In + // the above example, `c` initially corresponds to 1 mod (x), and after processing 2 inputs of + // v, it corresponds to x^2 + v0*x + v1 mod g(x). As 1 mod g(x) = 1, that is the starting value + // for `c`. + uint32_t c = 1; + for (auto v_i : v) { + // We want to update `c` to correspond to a polynomial with one extra term. If the initial + // value of `c` consists of the coefficients of c(x) = f(x) mod g(x), we modify it to + // correspond to c'(x) = (f(x) * x + v_i) mod g(x), where v_i is the next input to + // process. Simplifying: + // c'(x) = (f(x) * x + v_i) mod g(x) + // ((f(x) mod g(x)) * x + v_i) mod g(x) + // (c(x) * x + v_i) mod g(x) + // If c(x) = c0*x^5 + c1*x^4 + c2*x^3 + c3*x^2 + c4*x + c5, we want to compute + // c'(x) = (c0*x^5 + c1*x^4 + c2*x^3 + c3*x^2 + c4*x + c5) * x + v_i mod g(x) + // = c0*x^6 + c1*x^5 + c2*x^4 + c3*x^3 + c4*x^2 + c5*x + v_i mod g(x) + // = c0*(x^6 mod g(x)) + c1*x^5 + c2*x^4 + c3*x^3 + c4*x^2 + c5*x + v_i + // If we call (x^6 mod g(x)) = k(x), this can be written as + // c'(x) = (c1*x^5 + c2*x^4 + c3*x^3 + c4*x^2 + c5*x + v_i) + c0*k(x) + + // First, determine the value of c0: + uint8_t c0 = c >> 25; + + // Then compute c1*x^5 + c2*x^4 + c3*x^3 + c4*x^2 + c5*x + v_i: + c = ((c & 0x1ffffff) << 5) ^ v_i; + + // Finally, for each set bit n in c0, conditionally add {2^n}k(x): + if (c0 & 1) c ^= 0x3b6a57b2; // k(x) = {29}x^5 + {22}x^4 + {20}x^3 + {21}x^2 + {29}x + {18} + if (c0 & 2) c ^= 0x26508e6d; // {2}k(x) = {19}x^5 + {5}x^4 + x^3 + {3}x^2 + {19}x + {13} + if (c0 & 4) c ^= 0x1ea119fa; // {4}k(x) = {15}x^5 + {10}x^4 + {2}x^3 + {6}x^2 + {15}x + {26} + if (c0 & 8) c ^= 0x3d4233dd; // {8}k(x) = {30}x^5 + {20}x^4 + {4}x^3 + {12}x^2 + {30}x + {29} + if (c0 & 16) c ^= 0x2a1462b3; // {16}k(x) = {21}x^5 + x^4 + {8}x^3 + {24}x^2 + {21}x + {19} + } + return c; +} + +/** Convert to lower case. */ +inline unsigned char LowerCase(unsigned char c) +{ + return (c >= 'A' && c <= 'Z') ? (c - 'A') + 'a' : c; +} + +/** Expand a HRP for use in checksum computation. */ +data ExpandHRP(const std::string& hrp) +{ + data ret; + ret.reserve(hrp.size() + 90); + ret.resize(hrp.size() * 2 + 1); + for (size_t i = 0; i < hrp.size(); ++i) { + unsigned char c = hrp[i]; + ret[i] = c >> 5; + ret[i + hrp.size() + 1] = c & 0x1f; + } + ret[hrp.size()] = 0; + return ret; +} + +/** Verify a checksum. */ +bool VerifyChecksum(const std::string& hrp, const data& values) +{ + // PolyMod computes what value to xor into the final values to make the checksum 0. However, + // if we required that the checksum was 0, it would be the case that appending a 0 to a valid + // list of values would result in a new valid list. For that reason, Bech32 requires the + // resulting checksum to be 1 instead. + return PolyMod(Cat(ExpandHRP(hrp), values)) == 1; +} + +/** Create a checksum. */ +data CreateChecksum(const std::string& hrp, const data& values) +{ + data enc = Cat(ExpandHRP(hrp), values); + enc.resize(enc.size() + 6); // Append 6 zeroes + uint32_t mod = PolyMod(enc) ^ 1; // Determine what to XOR into those 6 zeroes. + data ret(6); + for (size_t i = 0; i < 6; ++i) { + // Convert the 5-bit groups in mod to checksum values. + ret[i] = (mod >> (5 * (5 - i))) & 31; + } + return ret; +} + +} // namespace + +namespace bech32 +{ + +/** Encode a Bech32 string. */ +std::string Encode(const std::string& hrp, const data& values) { + data checksum = CreateChecksum(hrp, values); + data combined = Cat(values, checksum); + std::string ret = hrp + '1'; + ret.reserve(ret.size() + combined.size()); + for (auto c : combined) { + if (c >= 32) { + return ""; + } + ret += CHARSET[c]; + } + return ret; +} + +/** Decode a Bech32 string. */ +std::pair Decode(const std::string& str) { + bool lower = false, upper = false; + for (size_t i = 0; i < str.size(); ++i) { + unsigned char c = str[i]; + if (c < 33 || c > 126) return {}; + if (c >= 'a' && c <= 'z') lower = true; + if (c >= 'A' && c <= 'Z') upper = true; + } + if (lower && upper) return {}; + size_t pos = str.rfind('1'); + if (str.size() > 1023 || pos == str.npos || pos == 0 || pos + 7 > str.size()) { + return {}; + } + data values(str.size() - 1 - pos); + for (size_t i = 0; i < str.size() - 1 - pos; ++i) { + unsigned char c = str[i + pos + 1]; + int8_t rev = (c < 33 || c > 126) ? -1 : CHARSET_REV[c]; + if (rev == -1) { + return {}; + } + values[i] = rev; + } + std::string hrp; + for (size_t i = 0; i < pos; ++i) { + hrp += LowerCase(str[i]); + } + if (!VerifyChecksum(hrp, values)) { + return {}; + } + return {hrp, data(values.begin(), values.end() - 6)}; +} + +} // namespace bech32 diff --git a/src/bech32.h b/src/bech32.h new file mode 100644 index 000000000..2e2823e97 --- /dev/null +++ b/src/bech32.h @@ -0,0 +1,30 @@ +// Copyright (c) 2017 Pieter Wuille +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +// Bech32 is a string encoding format used in newer address types. +// The output consists of a human-readable part (alphanumeric), a +// separator character (1), and a base32 data section, the last +// 6 characters of which are a checksum. +// +// For more information, see BIP 173. + +#ifndef BITCOIN_BECH32_H +#define BITCOIN_BECH32_H + +#include +#include +#include + +namespace bech32 +{ + +/** Encode a Bech32 string. Returns the empty string in case of failure. */ +std::string Encode(const std::string& hrp, const std::vector& values); + +/** Decode a Bech32 string. Returns (hrp, data). Empty hrp means failure. */ +std::pair> Decode(const std::string& str); + +} // namespace bech32 + +#endif // BITCOIN_BECH32_H diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index bf189e483..64830d463 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -5,8 +5,8 @@ #include "chainparamsbase.h" #include "clientversion.h" -#include "rpcclient.h" -#include "rpcprotocol.h" +#include "rpc/client.h" +#include "rpc/protocol.h" #include "util.h" #include "utilstrencodings.h" @@ -16,19 +16,19 @@ #include #include #include "support/events.h" +uint16_t BITCOIND_RPCPORT = 7771; +char ASSETCHAINS_SYMBOL[65]; #include using namespace std; -int64_t MAX_MONEY = 200000000 * 100000000LL; -uint64_t komodo_maxallowed(int32_t baseid) { return(100000000LL * 1000000); } // stub - static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900; +static const int CONTINUE_EXECUTION=-1; std::string HelpMessageCli() { - string strUsage; + std::string strUsage; strUsage += HelpMessageGroup(_("Options:")); strUsage += HelpMessageOpt("-?", _("This help message")); strUsage += HelpMessageOpt("-conf=", strprintf(_("Specify configuration file (default: %s)"), "komodo.conf")); @@ -42,6 +42,7 @@ std::string HelpMessageCli() strUsage += HelpMessageOpt("-rpcuser=", _("Username for JSON-RPC connections")); strUsage += HelpMessageOpt("-rpcpassword=", _("Password for JSON-RPC connections")); strUsage += HelpMessageOpt("-rpcclienttimeout=", strprintf(_("Timeout in seconds during HTTP requests, or 0 for no timeout. (default: %d)"), DEFAULT_HTTP_CLIENT_TIMEOUT)); + strUsage += HelpMessageOpt("-stdin", _("Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases)")); return strUsage; } @@ -65,34 +66,25 @@ public: }; -#define FROM_CLI -#include "uint256.h" -#include "arith_uint256.h" - -#include "komodo_structs.h" - -#include "komodo_globals.h" -#include "komodo_utils.h" -#include "komodo_cJSON.c" -#include "komodo_notary.h" - -void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth) -{ - -} - -uint32_t komodo_heightstamp(int32_t height) -{ - return(0); -} - -static bool AppInitRPC(int argc, char* argv[]) +// +// This function returns either one of EXIT_ codes when it's expected to stop the process or +// CONTINUE_EXECUTION when it's expected to continue further. +// +static int AppInitRPC(int argc, char* argv[]) { + static_assert(CONTINUE_EXECUTION != EXIT_FAILURE, + "CONTINUE_EXECUTION should be different from EXIT_FAILURE"); + static_assert(CONTINUE_EXECUTION != EXIT_SUCCESS, + "CONTINUE_EXECUTION should be different from EXIT_SUCCESS"); // // Parameters // ParseParameters(argc, argv); - komodo_args(argv[0]); + std:string name; + name = GetArg("-ac_name",""); + if ( !name.empty() ) + strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1); + if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo(); if (!mapArgs.count("-version")) { @@ -107,29 +99,33 @@ static bool AppInitRPC(int argc, char* argv[]) } fprintf(stdout, "%s", strUsage.c_str()); - return false; + if (argc < 2) { + fprintf(stderr, "Error: too few parameters\n"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); - return false; + return EXIT_FAILURE; } try { ReadConfigFile(mapArgs, mapMultiArgs); } catch (const std::exception& e) { fprintf(stderr,"Error reading configuration file: %s\n", e.what()); - return false; + return EXIT_FAILURE; } // Check for -testnet or -regtest parameter (BaseParams() calls are only valid after this clause) if (!SelectBaseParamsFromCommandLine()) { fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); - return false; + return EXIT_FAILURE; } if (GetBoolArg("-rpcssl", false)) { fprintf(stderr, "Error: SSL mode for RPC (-rpcssl) is no longer supported.\n"); - return false; + return EXIT_FAILURE; } - return true; + return CONTINUE_EXECUTION; } @@ -198,7 +194,7 @@ static void http_error_cb(enum evhttp_request_error err, void *ctx) } #endif -UniValue CallRPC(const string& strMethod, const UniValue& params) +UniValue CallRPC(const std::string& strMethod, const UniValue& params) { std::string host = GetArg("-rpcconnect", "127.0.0.1"); int port = GetArg("-rpcport", BaseParams().RPCPort()); @@ -213,7 +209,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params) HTTPReply response; raii_evhttp_request req = obtain_evhttp_request(http_request_done, (void*)&response); if (req == NULL) - throw runtime_error("create http request failed"); + throw std::runtime_error("create http request failed"); #if LIBEVENT_VERSION_NUMBER >= 0x02010300 evhttp_request_set_error_cb(req.get(), http_error_cb); #endif @@ -223,7 +219,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params) if (mapArgs["-rpcpassword"] == "") { // Try fall back to cookie-based authentication if no password is provided if (!GetAuthCookie(&strRPCUserColonPass)) { - throw runtime_error(strprintf( + throw std::runtime_error(strprintf( _("Could not locate RPC credentials. No authentication cookie could be found,\n" "and no rpcpassword is set in the configuration file (%s)."), GetConfigFile().string().c_str())); @@ -256,26 +252,26 @@ UniValue CallRPC(const string& strMethod, const UniValue& params) if (response.status == 0) throw CConnectionFailed(strprintf("couldn't connect to server: %s (code %d)\n(make sure server is running and you are connecting to the correct RPC port)", http_errorstring(response.error), response.error)); else if (response.status == HTTP_UNAUTHORIZED) - throw runtime_error("incorrect rpcuser or rpcpassword (authorization failed)"); + throw std::runtime_error("incorrect rpcuser or rpcpassword (authorization failed)"); else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR) - throw runtime_error(strprintf("server returned HTTP error %d", response.status)); + throw std::runtime_error(strprintf("server returned HTTP error %d", response.status)); else if (response.body.empty()) - throw runtime_error("no response from server"); + throw std::runtime_error("no response from server"); // Parse reply UniValue valReply(UniValue::VSTR); if (!valReply.read(response.body)) - throw runtime_error("couldn't parse reply from server"); + throw std::runtime_error("couldn't parse reply from server"); const UniValue& reply = valReply.get_obj(); if (reply.empty()) - throw runtime_error("expected reply to have result, error and id properties"); + throw std::runtime_error("expected reply to have result, error and id properties"); return reply; } int CommandLineRPC(int argc, char *argv[]) { - string strPrint; + std::string strPrint; int nRet = 0; try { // Skip switches @@ -283,15 +279,17 @@ int CommandLineRPC(int argc, char *argv[]) argc--; argv++; } - - // Method - if (argc < 2) - throw runtime_error("too few parameters"); - string strMethod = argv[1]; - - // Parameters default to strings - std::vector strParams(&argv[2], &argv[argc]); - UniValue params = RPCConvertValues(strMethod, strParams); + std::vector args = std::vector(&argv[1], &argv[argc]); + if (GetBoolArg("-stdin", false)) { + // Read one arg per line from stdin and append + std::string line; + while (std::getline(std::cin,line)) + args.push_back(line); + } + if (args.size() < 1) + throw std::runtime_error("too few parameters (need at least command)"); + std::string strMethod = args[0]; + UniValue params = RPCConvertValues(strMethod, std::vector(args.begin()+1, args.end())); // Execute and handle connection failures with -rpcwait const bool fWait = GetBoolArg("-rpcwait", false); @@ -343,7 +341,7 @@ int CommandLineRPC(int argc, char *argv[]) throw; } catch (const std::exception& e) { - strPrint = string("error: ") + e.what(); + strPrint = std::string("error: ") + e.what(); nRet = EXIT_FAILURE; } catch (...) { @@ -362,12 +360,13 @@ int main(int argc, char* argv[]) SetupEnvironment(); if (!SetupNetworking()) { fprintf(stderr, "Error: Initializing networking failed\n"); - exit(1); + return EXIT_FAILURE; } try { - if(!AppInitRPC(argc, argv)) - return EXIT_FAILURE; + int ret = AppInitRPC(argc, argv); + if (ret != CONTINUE_EXECUTION) + return ret; } catch (const std::exception& e) { PrintExceptionContinue(&e, "AppInitRPC()"); diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 80fef2c0f..34e1b5d91 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -4,7 +4,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "clientversion.h" -#include "rpcserver.h" +#include "rpc/server.h" #include "init.h" #include "main.h" #include "noui.h" @@ -12,7 +12,6 @@ #include "util.h" #include "httpserver.h" #include "httprpc.h" -#include "rpcserver.h" #include #include @@ -42,6 +41,7 @@ */ static bool fDaemon; +#include "komodo_defs.h" #define KOMODO_ASSETCHAIN_MAXLEN 65 extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; void komodo_passport_iteration(); @@ -115,7 +115,7 @@ bool AppInit(int argc, char* argv[]) } fprintf(stdout, "%s", strUsage.c_str()); - return false; + return true; } try @@ -179,7 +179,7 @@ bool AppInit(int argc, char* argv[]) if (fCommandLine) { fprintf(stderr, "Error: There is no RPC client functionality in komodod. Use the komodo-cli utility instead.\n"); - exit(1); + exit(EXIT_FAILURE); } #ifndef _WIN32 @@ -236,5 +236,5 @@ int main(int argc, char* argv[]) // Connect bitcoind signal handlers noui_connect(); - return (AppInit(argc, argv) ? 0 : 1); + return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/src/bloom.h b/src/bloom.h index a4dba8cb4..df5c30b1e 100644 --- a/src/bloom.h +++ b/src/bloom.h @@ -73,7 +73,7 @@ public: ADD_SERIALIZE_METHODS; template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(vData); READWRITE(nHashFuncs); READWRITE(nTweak); diff --git a/src/cc/CC made easy.md b/src/cc/CC made easy.md new file mode 100644 index 000000000..3f15a6b6b --- /dev/null +++ b/src/cc/CC made easy.md @@ -0,0 +1,719 @@ +/****************************************************************************** + * Copyright © 2014-2018 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +How to write utxo based CryptoConditions contracts for KMD chains +by jl777 + +This is not the only smart contracts methodology that is possible to build on top of OP_CHECKCRYPTOCONDITION, just the first one. All the credit for getting OP_CHECKCRYPTOCONDITION working in the Komodo codebase goes to @libscott. I am just hooking into the code that he made and tried to make it just a little easier to make new contracts. + +There is probably some fancy marketing name to use, but for now, I will just call it "CC contract" for short, knowing that it is not 100% technically accurate as the CryptoConditions aspect is not really the main attribute. However, the KMD contracts were built to make the CryptoConditions codebase that was integrated into it to be more accessible. + +Since CC contracts run native C/C++ code, it is turing complete and that means that any contract that is possible to do on any other platform will be possible to create via CC contract. + +utxo based contracts are a bit harder to start writing than for balance based contracts. However, they are much more secure as they leverage the existing bitcoin utxo system. That makes it much harder to have bugs that issue a zillion new coins from a bug, since all the CC contract operations needs to also obey the existing bitcoin utxo protocol. + +This document will be heavily example based so it will utilize many of the existing reference CC contracts. After understanding this document, you should be in a good position to start creating either a new CC contract to be integrated into komodod or to make rpc based dapps directly. + +Chapter 0 - Bitcoin Protocol Basics +There are many aspects of the bitcoin protocol that isnt needed to understand the CC contracts dependence on it. Such details will not be discussed. The primary aspect is the utxo, unspent transaction output. Just a fancy name for txid/vout, so when you sendtoaddress some coins, it creates a txid and the first output is vout.0, combine it and txid/0 is a specific utxo. + +Of course, to understand even this level of detail requires that you understand what a txid is, but there are plenty of reference materials on that. It is basically the 64 char long set of letters and numbers that you get when you send funds. + +Implicit with the utxo is that it prevents double spends. Once you spend a utxo, you cant spend it again. This is quite an important characteristic and while advanced readers will point out chain reorgs can allow a double spend, we will not confuse the issue with such details. The important thing is that given a blockchain at a specific height's blockhash, you can know if a txid/vout has been spent or not. + +There are also the transactions that are in memory waiting to be mined, the mempool. And it is possible for the utxo to be spent by a tx in the mempool. However since it isnt confirmed yet, it is still unspent at the current height, even if we are pretty sure it will be spent in the next block. + +A useful example is to think about a queue of people lined up to get into an event. They need to have a valid ticket and also to get into the queue. After some time passes, they get their ticket stamped and allowed into the event. + +In the utxo case, the ticket is the spending transaction and the event is the confirmed blockchain. The queue is the mempool. + + +Chapter 1 - OP_CHECKCRYPTOCONDITION +In the prior chapter the utxo was explained. However, the specific mechanism used to send a payment was not explained. Contrary to what most people might think, on the blockchain there are not entries that say "pay X amount to address". Instead what exists is a bitcoin script that must be satisfied in order for the funds to be able to be spent. + +Originally, there was the pay to pubkey script: + + +About as simple of a payment script that you can get. Basically the pubkey's signature is checked and if it is valid, you get to spend it. One problem satoshi realized was that with Quantum Computers such payment scripts are vulnerable! So, he made a way to have a cold address, ie. an address whose pubkey isnt known. At least it isnt known until it is spent, so it is only Quantum resistant prior to the first spend. This line of reasoning is why we have one time use addresses and a new change address for each transaction. Maybe in some ways, this is too forward thinking as it makes things a lot more confusing to use and easier to lose track of all the required private keys. + +However, it is here to stay and its script is: + + +With this, the blockchain has what maps to "pay to address", just that the address is actually a base58 encoded (prefix + pubkeyhash). Hey, if it wasnt complicated, it would be easy! + +In order to spend a p2pkh (pay to pubkey hash) utxo, you need to divulge the pubkey in addition to having a valid signature. After the first spend from an address, its security is degraded to p2pk (pay to pubkey) as its pubkey is now known. The net result is that each reused address takes 25 extra bytes on the blockchain, and that is why for addresses that are expected to be reused, I just use the p2pk script. + +Originally, bitcoin allowed any type of script opcodes to be used directly. The problem was some of them caused problems and satoshi decided to disable them and only allow standard forms of payments. Thus the p2pk and p2pkh became 99%+ of bitcoin transactions. However, going from having a fully scriptable language that can create countless payment scripts (and bugs!), to having just 2... well it was a "short term" limitation. It did last for some years but eventually a compromise p2sh script was allowed to be standard. This is a pay to script hash, so it can have a standard format as the normal p2pkh, but have infinitely more flexibility. + +