diff --git a/.travis.yml b/.travis.yml index 095aed71..b54a7430 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,11 @@ language: minimal cache: ccache: true directories: - - depends/built - - depends/sdk-sources - - $HOME/.ccache + - "$HOME/.ccache" + - "$TRAVIS_BUILD_DIR/depends/built" + - "$TRAVIS_BUILD_DIR/depends/sdk-sources" + - "$TRAVIS_BUILD_DIR/ci/scratch/.ccache" + - "$TRAVIS_BUILD_DIR/releases/$HOST" git: depth: false # full clone for git subtree check, this works around issue #12388 stages: @@ -24,7 +26,7 @@ env: - CCACHE_TEMPDIR=/tmp/.ccache-temp - CCACHE_COMPRESS=1 - CCACHE_DIR=$HOME/.ccache - - BASE_OUTDIR=$TRAVIS_BUILD_DIR/out + - BASE_OUTDIR=$TRAVIS_BUILD_DIR/releases/$HOST - SDK_URL=https://bitcoincore.org/depends-sources/sdks - WINEDEBUG=fixme-all - DOCKER_PACKAGES="build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache" @@ -38,7 +40,7 @@ install: - if [[ $HOST = *-mingw32 ]]; then DOCKER_ADMIN="--cap-add SYS_ADMIN"; fi - DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$TRAVIS_BUILD_DIR,dst=$TRAVIS_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $TRAVIS_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG) - DOCKER_EXEC () { docker exec $DOCKER_ID bash -c "cd $PWD && $*"; } - - if [ -n "$DPKG_ADD_ARCH" ]; then DOCKER_EXEC dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi + - if [ -n "$DPKG_ADD_ARCH" ]; then DOCKER_EXEC dpkg --add-architecture "$DPKG_ADD_ARCH"; fi - travis_retry DOCKER_EXEC apt-get update - travis_retry DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES $DOCKER_PACKAGES before_script: @@ -50,7 +52,7 @@ before_script: - if [ -z "$NO_DEPENDS" ]; then DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS; fi script: - export TRAVIS_COMMIT_LOG=`git log --format=fuller -1` - - OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST + - OUTDIR=$BASE_OUTDIR - BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib" - if [ -z "$NO_DEPENDS" ]; then DOCKER_EXEC ccache --max-size=$CCACHE_SIZE; fi - BEGIN_FOLD autogen; test -n "$CONFIG_SHELL" && DOCKER_EXEC "$CONFIG_SHELL" -c "./autogen.sh" || DOCKER_EXEC ./autogen.sh; END_FOLD @@ -60,6 +62,15 @@ script: - if [ "$RUN_BENCH" = "true" ]; then BEGIN_FOLD bench; DOCKER_EXEC LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib $OUTDIR/bin/bench_bitcoin -scaling=0.001 ; END_FOLD; fi - if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then extended="--extended --exclude feature_pruning,feature_dbcrash"; fi - if [ "$RUN_TESTS" = "true" ]; then BEGIN_FOLD functional-tests; DOCKER_EXEC test/functional/test_runner.py --combinedlogslen=4000 --coverage --quiet --failfast ${extended}; END_FOLD; fi + - if [ "$NAME" = "arm-linux-gnueabihf" ]; then cd $OUTDIR; pwd; tar -czf bitcore-$NAME.tar.gz -C $OUTDIR bin lib; sha256sum bitcore-$NAME.tar.gz > bitcore-$NAME.tar.gz.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "win32-daemon" ]; then cp ./src/*.exe $OUTDIR; cd $OUTDIR; pwd; zip -r bitcore-$NAME.zip ./*.exe; sha256sum bitcore-$NAME.zip > bitcore-$NAME.zip.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "win32-qt" ]; then ls; pwd; ls ./src; cp ./src/*.exe $OUTDIR; cd $OUTDIR; pwd; zip -r bitcore-$NAME.zip ./*.exe; sha256sum bitcore-$NAME.zip > bitcore-$NAME.zip.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "win64-daemon" ]; then cp ./src/*.exe $OUTDIR; cd $OUTDIR; pwd; zip -r bitcore-$NAME.zip ./*.exe; sha256sum bitcore-$NAME.zip > bitcore-$NAME.zip.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "i686-pc-linux-gnu" ]; then cd $OUTDIR; pwd; tar -czf bitcore-$NAME.tar.gz -C $OUTDIR bin lib; sha256sum bitcore-$NAME.tar.gz > bitcore-$NAME.tar.gz.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "x86_64-linux-gnu_qt5-dev" ]; then cd $OUTDIR; pwd; tar -czf bitcore-$NAME.tar.gz -C $OUTDIR bin lib; sha256sum bitcore-$NAME.tar.gz > bitcore-$NAME.tar.gz.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "x86_64-linux-gnu_qt5_with-libs" ]; then cd $OUTDIR; pwd; tar -czf bitcore-$NAME.tar.gz -C $OUTDIR bin lib; sha256sum bitcore-$NAME.tar.gz > bitcore-$NAME.tar.gz.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "x86_64-linux-gnu_no-wallet" ]; then cd $OUTDIR; pwd; tar -czf bitcore-$NAME.tar.gz -C $OUTDIR bin lib; sha256sum bitcore-$NAME.tar.gz > bitcore-$NAME.tar.gz.sha256.txt; ls $OUTDIR; fi + - if [ "$NAME" = "osx64" ]; then cp BitCore-BTX.dmg $OUTDIR/bitcore-$NAME.dmg; cd $OUTDIR; pwd; sha256sum bitcore-$NAME.dmg > bitcore-$NAME.dmg.sha256.txt; ls $OUTDIR; fi after_script: - echo $TRAVIS_COMMIT_RANGE - echo $TRAVIS_COMMIT_LOG @@ -69,6 +80,7 @@ jobs: - stage: test env: >- HOST=arm-linux-gnueabihf + NAME="arm-linux-gnueabihf" PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="NO_QT=1" GOAL="install" @@ -77,6 +89,7 @@ jobs: - stage: test env: >- HOST=i686-w64-mingw32 + NAME="win32-daemon" DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="python3 nsis g++-mingw-w64-i686 wine-binfmt wine32" @@ -87,6 +100,7 @@ jobs: - stage: test env: >- HOST=x86_64-w64-mingw32 + NAME="win64-daemon" DEP_OPTS="NO_QT=1" PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine-binfmt wine64" RUN_TESTS=false @@ -96,6 +110,7 @@ jobs: - stage: test env: >- HOST=i686-pc-linux-gnu + NAME="i686-pc-linux-gnu" PACKAGES="g++-multilib python3-zmq" DEP_OPTS="NO_QT=1" RUN_TESTS=false @@ -106,6 +121,7 @@ jobs: - stage: test env: >- HOST=x86_64-unknown-linux-gnu + NAME="x86_64-linux-gnu_qt5-dev" PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools protobuf-compiler libdbus-1-dev libharfbuzz-dev libprotobuf-dev" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1" RUN_TESTS=false @@ -116,6 +132,7 @@ jobs: - stage: test env: >- HOST=x86_64-unknown-linux-gnu + NAME="x86_64-linux-gnu_qt5_with-libs" PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev" NO_DEPENDS=1 RUN_TESTS=false @@ -125,6 +142,7 @@ jobs: - stage: test env: >- HOST=x86_64-unknown-linux-gnu + NAME="x86_64-linux-gnu_no-wallet" PACKAGES="python3" DEP_OPTS="NO_WALLET=1" RUN_TESTS=false @@ -134,6 +152,7 @@ jobs: - stage: test env: >- HOST=x86_64-apple-darwin14 + NAME="osx64" PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev python3-setuptools-git" OSX_SDK=10.11 GOAL="all deploy" @@ -157,7 +176,19 @@ jobs: - test/lint/check-doc.py - test/lint/check-rpc-mappings.py . - test/lint/lint-all.sh -# - if [ "$TRAVIS_REPO_SLUG" = "limxdev/core17base" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then -# while read LINE; do travis_retry gpg --keyserver hkp://subset.pool.sks-keyservers.net --recv-keys $LINE; done < contrib/verify-commits/trusted-keys && -# travis_wait 50 contrib/verify-commits/verify-commits.py; -# fi +deploy: + provider: releases + api_key: + secure: "E2PjkmjnN0AFzlaXlyrZUx4qh9bPBb15zTtNnOBSIcKlzVV6LtKQpiBxjws3HywLBXVRKMFSi+f/D/GfoHF0MeiOvcVtFaERWAXOjdxDcQm4fjQvTNei8kr07fk18pii2Rjq97X7GVF5pqHiTF6AsCCyvAlqRz+hsZxJO9Y/YJyDNwomSLvozuHJqC6kZi/2LyDBh7D7tztQsfSti9iNsUwV1oStenBlBQvHyjIgAnlvMIULtTqbybWjYUIjaKE2OnoAb+UmdXewT14gk00l6aLj8CH3t3j4YJIOSWnCYWjc251QD3DtGYs7ddY7lwwsnz6qJsiIJ5ANRrotT1LM9HRlFaLd/ll+q1z5wyZY6ezV1CHwD8Q09RvOWiBfLN1t8OT3XM2Ua+zkqjHO66IR6SWxW5wY125JLdy3Quz6xUUvvSawJCj6L4b/emz35ZDGVI/tPaVOIypwORDMHQw/xu/bahL87Lf4JYtjvHpqu7r1vQn/zfQXmR9y9Bxe/rxUN0btIUAt2uiBbm7AgpAtqqv7rs+B3tBTHoZ0mx444JIbThaBmeqg8vID3Sd1J1F6F35RljBk5mH6Furan1gUXVcaBJag8DprbCC48+cBC4YLyqMHUr2hogjeD1lgzjwE8sCbvCpUn1k74BHevHQvnyUrpMnyLqCQkI3YlaHxuPk=" + file_glob: true + file: + - "$OUTDIR/*.tar.gz" + - "$OUTDIR/*.tar.gz.sha256.txt" + - "$OUTDIR/*.zip" + - "$OUTDIR/*.zip.sha256.txt" + - "$OUTDIR/*.dmg" + - "$OUTDIR/*.dmg.sha256.txt" + skip_cleanup: true + on: + tags: true + draft: true diff --git a/README.md b/README.md index c6edf2b2..a52e8ed0 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ Welcome to BitCore BTX ===================================== -![GitHub Logo](https://i.imgur.com/jnpy4Me.jpg) +![GitHub Logo](https://i.imgur.com/X3tduas.png) [ Release Notes ](https://www.reddit.com/r/bitcore_btx/comments/fsbzog/odarhom_release_notes_short_overview_first_draft/) - [ FAQ ](https://www.reddit.com/r/bitcore_btx/wiki/index/odarhom_faq) - [ Website ](https://www.bitcore.cc) - [ BitcoinTalk ](https://bitcointalk.org/index.php?topic=1883902.0) -[![Build Status](https://travis-ci.org/LIMXTEC/BitCore.svg?branch=0.9.8.x)](https://travis-ci.org/LIMXTEC/BitCore) +[![Build Status](https://travis-ci.com/bitcore-btx/BitCore.svg?branch=master)](https://travis-ci.com/bitcore-btx/BitCore) What is BitCore? ---------------- @@ -19,7 +19,7 @@ BitCore BTX preserves and implements Bitcoin features such as SegWit, which enab - Masternode System Dash Core - 2,100 BTX for one Masternode - 220 Byte Datacarriersize (OP_RETURN) -- Hashalgorythm Timetravel10 +- Hashalgorithm MagaBTX ( a unique solution for Bitcore) - Bitcore Diffshield - Travis CI support @@ -38,7 +38,7 @@ Development Process ------------------- The `master` branch is regularly built and tested, but is not guaranteed to be -completely stable. [Releases](https://github.com/LIMXTEC/bitcore/release) are created +completely stable. [Releases](https://github.com/bitcore-btx/BitCore/release) are created regularly to indicate new official, stable release versions of BitCore. The contribution workflow is described in [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/configure.ac b/configure.ac index 559b4f77..8b310f2d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) -define(_CLIENT_VERSION_MINOR, 90) -define(_CLIENT_VERSION_REVISION, 9) -define(_CLIENT_VERSION_BUILD, 8) +define(_CLIENT_VERSION_MINOR, 91) +define(_CLIENT_VERSION_REVISION, 1) +define(_CLIENT_VERSION_BUILD, 1) define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2021) +define(_COPYRIGHT_YEAR, 2024) define(_COPYRIGHT_HOLDERS,[The %s developers]) define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[BitCore Core]]) AC_INIT([BitCore BTX],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/LIMXTEC/bitcore/issues],[bitcore],[https://bitcore.cc/]) @@ -538,7 +538,7 @@ case $host in fi AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"]) - CPPFLAGS="$CPPFLAGS -DMAC_OSX" + CPPFLAGS="$CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0" OBJCXXFLAGS="$CXXFLAGS" ;; *android*) diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus index 496266f2..666a8fc3 100644 --- a/contrib/macdeploy/macdeployqtplus +++ b/contrib/macdeploy/macdeployqtplus @@ -550,7 +550,8 @@ if len(config.fancy) == 1: sys.exit(1) try: - fancy = plistlib.readPlist(p) + with open(p, 'rb') as fp: + fancy = plistlib.load(fp, fmt=plistlib.FMT_XML) except: if verbose >= 1: sys.stderr.write("Error: Could not parse fancy disk image plist at \"%s\"\n" % (p)) diff --git a/depends/Makefile b/depends/Makefile index 3686aaf1..3561ae13 100755 --- a/depends/Makefile +++ b/depends/Makefile @@ -7,7 +7,7 @@ SDK_PATH ?= $(BASEDIR)/SDKs NO_QT ?= NO_WALLET ?= NO_UPNP ?= -FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources +FALLBACK_DOWNLOAD_PATH ?= https://download.bitcoinabc.org/depends-sources/ BUILD = $(shell ./config.guess) HOST ?= $(BUILD) diff --git a/masternode.sh b/masternode.sh index 1d4e3612..afe381ef 100644 --- a/masternode.sh +++ b/masternode.sh @@ -17,7 +17,7 @@ export LC_ALL=C scriptversion="v0.1.2" release="" -git="https://github.com/LIMXTEC/BitCore.git" +git="https://github.com/bitcore-btx/BitCore.git" date="$(date +%y-%m-%d-%s)" script=$( cd $(dirname ${BASH_SOURCE[0]}) || exit > /dev/null; pwd -P ) logfile="/tmp/install_${date}_out.log" @@ -57,7 +57,7 @@ function get_confirmation() { function current_release () { latest_release="$( bash <> ${logfile} # if code directory does not exists, we create it clone the src if [ ! -d ${sent_dir} ]; then - { cd ${data_dir} || exit; git clone https://github.com/LIMXTEC/sentinel.git sentinel; cd sentinel || exit; } >> ${logfile} + { cd ${data_dir} || exit; git clone https://github.com/bitcore-btx/sentinel.git sentinel; cd sentinel || exit; } >> ${logfile} else echo "* Updating the existing sentinel GIT repo" cd ${sent_dir} ||exit &>> ${logfile} @@ -357,7 +357,7 @@ function cleanup_after() { function print_logo() { cd ~/ || exit - wget -q https://raw.githubusercontent.com/LIMXTEC/BitCore/0.15/src/qt/res/icons/bitcore_logo_horizontal.png 2>&1 + wget -q https://raw.githubusercontent.com/bitcore-btx/BitCore/0.15/src/qt/res/icons/bitcore_logo_horizontal.png 2>&1 convert bitcore_logo_horizontal.png bitcore_logo_horizontal.jpg 2>&1 rm bitcore_logo_horizontal.png mv bitcore_logo_horizontal.jpg /usr/local/bin/bitcore_logo_horizontal.jpg 2>&1 @@ -546,7 +546,7 @@ function create_script() { if [[ "$testnet" -eq 1 ]]; then (cat > ${data_dir}/${name}.menu.sh) << "EOF" &> /dev/null #!/bin/bash -latest_release=$(curl --silent "https://api.github.com/repos/LIMXTEC/BitCore/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') +latest_release=$(curl --silent "https://api.github.com/repos/bitcore-btx/BitCore/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') pause(){ read -p "Press [Enter] key to continue..." fackEnterKey } @@ -641,7 +641,7 @@ EOF else (cat > ${data_dir}/${name}.menu.sh) << "EOF" &> /dev/null #!/bin/bash -latest_release=$(curl --silent "https://api.github.com/repos/LIMXTEC/BitCore/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') +latest_release=$(curl --silent "https://api.github.com/repos/bitcore-btx/BitCore/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') pause(){ read -p "Press [Enter] key to continue..." fackEnterKey } diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 0f5b63b5..8a432239 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -323,23 +323,17 @@ RES_ICONS += \ RES_ICONS += \ qt/res/icons/Bitcointalk.png \ qt/res/icons/BitcoreCC.png \ + qt/res/icons/crex24.png \ + qt/res/icons/hotbit.png \ + qt/res/icons/graviex.png \ qt/res/icons/cryptoID.png \ qt/res/icons/GitHub.png \ qt/res/icons/Telegram.png \ qt/res/icons/Twitter.png \ - qt/res/icons/BitZ.png \ - qt/res/icons/Ccex.png \ - qt/res/icons/Coinexchange.png \ - qt/res/icons/Coinomi.png \ - qt/res/icons/CryptoBridgeB.png \ - qt/res/icons/Cryptopia.png \ qt/res/icons/Facebook.png \ qt/res/icons/InsightAPI.png \ qt/res/icons/Reddit.png \ - qt/res/icons/TradeSat.png \ - qt/res/icons/VEBITCOIN.png \ - qt/res/icons/Hitbtc.png \ - qt/res/icons/exrates.png + qt/res/icons/Hitbtc.png # BITCOIN_QT_BASE_CPP = \ @@ -411,10 +405,7 @@ endif RES_IMAGES = \ qt/res/images/bitcore_logo_horizontal.png \ - qt/res/images/bitcore_main_hgB_flower.png \ - qt/res/images/bitcore_main_hgB_machine.png \ - qt/res/images/bitcore_main_hgB.png \ - qt/res/images/bitcore_main_hgB_white.png + qt/res/images/bitcore_main_hgB.png RES_CSS = qt/res/css/bitcore_main.css diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 379e7321..0d2a4656 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -220,15 +220,16 @@ class CMainParams : public CChainParams { { 550000, uint256S("0xa901848fe9d22814dbb3e0f62892d3bd7a1e70f6a48a459e68ebaf24ea5d5867")}, { 590000, uint256S("0x81dc076e3b07fbc50a691ddbbe0b53ece5fe95562e54b289c589cd333f7a282a")}, { 659006, uint256S("0xdb16bdb35d197193c18ab42259b55f0b91c4c84da94e2a49e681c4eb43d96ddb")}, + { 1483550, uint256S("0xb04a88e70378562ce7284a614edc1d7975e0ef28d33381fc381feb7c1ce9f02f")}, } }; // BTX for faster loading - consensus.nlastValidPowHashHeight = 659006; + consensus.nlastValidPowHashHeight = 1000000; chainTxData = ChainTxData{ // BTX: data as of block 0x8da1c7f79018fac8acac69a57b2f8b5d2743af67976a4525fdedc8c85a3a1418 (height 410476). - 1588381219, // * UNIX timestamp of last known number of transactions - 2103714, // * total number of transactions between genesis and that timestamp + 1728846093, // * UNIX timestamp of last known number of transactions + 3773639, // * total number of transactions between genesis and that timestamp // (the tx=... number in the SetBestChain debug.log lines) 0 // * estimated number of transactions per second after that timestamp }; diff --git a/src/crypto/mega-btx.h b/src/crypto/mega-btx.h index d80da869..97eb8895 100644 --- a/src/crypto/mega-btx.h +++ b/src/crypto/mega-btx.h @@ -71,37 +71,35 @@ inline uint256 Mega_Btx(const T1 pbegin, const T1 pend,uint32_t timestamp) //static std::chrono::duration[16]; static unsigned char pblank[1]; arith_uint512 hash[23]; - uint32_t permutation_1[HASH_FUNC_COUNT_1]; - uint32_t permutation_2[HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_1]; - uint32_t permutation_3[HASH_FUNC_COUNT_3 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_1]; + uint32_t permutation_X[HASH_FUNC_COUNT_3 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_1]; //Init1 for (uint32_t i = 1; i < HASH_FUNC_COUNT_1; i++) { - permutation_1[i] = i; + permutation_X[i] = i; } //Init2 for (uint32_t i = HASH_FUNC_COUNT_1; i < HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_1; i++) { - permutation_2[i] = i; + permutation_X[i] = i; } //Init3 for (uint32_t i = HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2; i < HASH_FUNC_COUNT_3 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_1; i++) { - permutation_3[i] = i; + permutation_X[i] = i; } uint32_t steps_1 = (timestamp - HASH_FUNC_BASE_TIMESTAMP_1) % HASH_FUNC_COUNT_PERMUTATIONS_7; for (uint32_t i = 0; i < steps_1; i++) { - std::next_permutation(permutation_1, permutation_1 + HASH_FUNC_COUNT_1); + std::next_permutation(permutation_X, permutation_X + HASH_FUNC_COUNT_1); } uint32_t steps_2 = (timestamp+ HASH_FUNC_VAR_1 - HASH_FUNC_BASE_TIMESTAMP_1) % HASH_FUNC_COUNT_PERMUTATIONS; for (uint32_t i = 0; i < steps_2; i++) { - std::next_permutation(permutation_2 + HASH_FUNC_COUNT_1, permutation_2 + HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2); + std::next_permutation(permutation_X + HASH_FUNC_COUNT_1, permutation_X + HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2); } uint32_t steps_3 = (timestamp+ HASH_FUNC_VAR_2 - HASH_FUNC_BASE_TIMESTAMP_1) % HASH_FUNC_COUNT_PERMUTATIONS_7; for (uint32_t i = 0; i < steps_3; i++) { - std::next_permutation(permutation_3 + HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2, permutation_3 + HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_3); + std::next_permutation(permutation_X + HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2, permutation_X + HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_3); } int lenToHash = 64; @@ -116,7 +114,7 @@ inline uint256 Mega_Btx(const T1 pbegin, const T1 pend,uint32_t timestamp) for (int i = 1; i < HASH_FUNC_COUNT_1; i++) { toHash = static_cast(&hash[i-1]);; - switch (permutation_1[i]) { + switch (permutation_X[i]) { case 1: // 3000 + 700 sph_echo512_init(&ctx_echo); @@ -187,7 +185,7 @@ inline uint256 Mega_Btx(const T1 pbegin, const T1 pend,uint32_t timestamp) } for (int i = HASH_FUNC_COUNT_1; i < HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2; i++) { toHash = static_cast(&hash[i-1]);; - switch (permutation_2[i]) { + switch (permutation_X[i]) { case 8: // 2100 +2000 sph_whirlpool_init(&ctx_whirlpool); @@ -266,9 +264,9 @@ inline uint256 Mega_Btx(const T1 pbegin, const T1 pend,uint32_t timestamp) break; } } - for (int i = HASH_FUNC_COUNT_2; i < HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_3; i++) { + for (int i = HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2; i < HASH_FUNC_COUNT_1 + HASH_FUNC_COUNT_2 + HASH_FUNC_COUNT_3; i++) { toHash = static_cast(&hash[i-1]);; - switch (permutation_3[i]) { + switch (permutation_X[i]) { case 16: // 700 + 2000 sph_sha512_init(&ctx_sha512); diff --git a/src/init.cpp b/src/init.cpp index 370c41ca..d6667368 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -586,7 +586,7 @@ void SetupServerArgs() std::string LicenseInfo() { // Megacoin - const std::string URL_SOURCE_CODE = ""; + const std::string URL_SOURCE_CODE = ""; const std::string URL_WEBSITE = ""; // FXTC BEGIN diff --git a/src/instantx.cpp b/src/instantx.cpp index 30adcba9..c5005877 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -734,7 +734,7 @@ void CInstantSend::CheckAndRemove() ++itMasternodeOrphan; } } - LogPrintf("CInstantSend::CheckAndRemove -- %s\n", ToString()); + //LogPrintf("CInstantSend::CheckAndRemove -- %s\n", ToString()); } bool CInstantSend::AlreadyHave(const uint256& hash) diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 71cf8021..d8cfdd16 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -16,6 +16,10 @@ #include +/** Object for who's going to get paid on which blocks */ +//extern void Misbehaving(NodeId nodeid, int howmuch, const std::string& message=""); +// FXTC END + /** Object for who's going to get paid on which blocks */ CMasternodePayments mnpayments; @@ -44,53 +48,11 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar // we are still using budgets, but we have no data about them anymore, // all we know is predefined budget cycle and window - const Consensus::Params& consensusParams = Params().GetConsensus(); - - if(nBlockHeight < consensusParams.nSuperblockStartBlock) { - int nOffset = nBlockHeight % consensusParams.nBudgetPaymentsCycleBlocks; - if(nBlockHeight >= consensusParams.nBudgetPaymentsStartBlock && - nOffset < consensusParams.nBudgetPaymentsWindowBlocks) { - // NOTE: make sure SPORK_13_OLD_SUPERBLOCK_FLAG is disabled when 12.1 starts to go live - if(masternodeSync.IsSynced() && !sporkManager.IsSporkActive(SPORK_13_OLD_SUPERBLOCK_FLAG)) { - // no budget blocks should be accepted here, if SPORK_13_OLD_SUPERBLOCK_FLAG is disabled - LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- Client synced but budget spork is disabled, checking block value against block reward\n"); - if(!isBlockRewardValueMet) { - strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, budgets are disabled", - nBlockHeight, block.vtx[0]->GetValueOut(), blockReward); - } - return isBlockRewardValueMet; - } - LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- WARNING: Skipping budget block value checks, accepting block\n"); - // TODO: reprocess blocks to make sure they are legit? - return true; - } - // LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- Block is not in budget cycle window, checking block value against block reward\n"); - if(!isBlockRewardValueMet) { - strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, block is not in budget cycle window", - nBlockHeight, block.vtx[0]->GetValueOut(), blockReward); - } - return isBlockRewardValueMet; - } - - // superblocks started - - CAmount nSuperblockMaxValue = blockReward + CSuperblock::GetPaymentsLimit(nBlockHeight, block.GetBlockHeader()); - bool isSuperblockMaxValueMet = (block.vtx[0]->GetValueOut() <= nSuperblockMaxValue); - - LogPrint(BCLog::GOBJECT, "block.vtx[0]->GetValueOut() %lld <= nSuperblockMaxValue %lld\n", block.vtx[0]->GetValueOut(), nSuperblockMaxValue); - if(!masternodeSync.IsSynced()) { // not enough data but at least it must NOT exceed superblock max value - if(CSuperblock::IsValidBlockHeight(nBlockHeight)) { - if(fDebug) LogPrintf("IsBlockPayeeValid -- WARNING: Client not synced, checking superblock max bounds only\n"); - if(!isSuperblockMaxValueMet) { - strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded superblock max value", - nBlockHeight, block.vtx[0]->GetValueOut(), nSuperblockMaxValue); - } - return isSuperblockMaxValueMet; - } + if(!isBlockRewardValueMet) { - strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, only regular blocks are allowed at this height", + strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d)(!masternodeSync.IsSynced()), exceeded block reward, only regular blocks are allowed at this height", nBlockHeight, block.vtx[0]->GetValueOut(), blockReward); } // it MUST be a regular block otherwise @@ -98,35 +60,13 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar } // we are synced, let's try to check as much data as we can - - if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) { - if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) { - if(CSuperblockManager::IsValid(block.vtx[0], nBlockHeight, blockReward, block.GetBlockHeader())) { - LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- Valid superblock at height %d: %s\n", nBlockHeight, block.vtx[0]->ToString()); - // all checks are done in CSuperblock::IsValid, nothing to do here - return true; - } - - // triggered but invalid? that's weird - LogPrintf("IsBlockValueValid -- ERROR: Invalid superblock detected at height %d: %s\n", nBlockHeight, block.vtx[0]->ToString()); - // should NOT allow invalid superblocks, when superblocks are enabled - strErrorRet = strprintf("invalid superblock detected at height %d", nBlockHeight); - return false; - } - LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- No triggered superblock detected at height %d\n", nBlockHeight); - if(!isBlockRewardValueMet) { - strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, no triggered superblock detected", - nBlockHeight, block.vtx[0]->GetValueOut(), blockReward); - } - } else { - // should NOT allow superblocks at all, when superblocks are disabled - LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- Superblocks are disabled, no superblocks allowed\n"); + + LogPrint(BCLog::GOBJECT, "IsBlockValueValid -- Superblocks are disabled, no superblocks allowed\n"); if(!isBlockRewardValueMet) { strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, superblocks are disabled", nBlockHeight, block.vtx[0]->GetValueOut(), blockReward); } - } - + // it MUST be a regular block return isBlockRewardValueMet; } @@ -142,64 +82,6 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl // we are still using budgets, but we have no data about them anymore, // we can only check masternode payments - const Consensus::Params& consensusParams = Params().GetConsensus(); - - if(nBlockHeight < consensusParams.nSuperblockStartBlock) { - if(mnpayments.IsTransactionValid(txNew, nBlockHeight)) { - LogPrint(BCLog::MNPAYMENTS, "IsBlockPayeeValid -- Valid masternode payment at height %d: %s\n", nBlockHeight, txNew->ToString()); - return true; - } - - int nOffset = nBlockHeight % consensusParams.nBudgetPaymentsCycleBlocks; - if(nBlockHeight >= consensusParams.nBudgetPaymentsStartBlock && - nOffset < consensusParams.nBudgetPaymentsWindowBlocks) { - if(!sporkManager.IsSporkActive(SPORK_13_OLD_SUPERBLOCK_FLAG)) { - // no budget blocks should be accepted here, if SPORK_13_OLD_SUPERBLOCK_FLAG is disabled - LogPrint(BCLog::GOBJECT, "IsBlockPayeeValid -- ERROR: Client synced but budget spork is disabled and masternode payment is invalid\n"); - return false; - } - // NOTE: this should never happen in real, SPORK_13_OLD_SUPERBLOCK_FLAG MUST be disabled when 12.1 starts to go live - LogPrint(BCLog::GOBJECT, "IsBlockPayeeValid -- WARNING: Probably valid budget block, have no data, accepting\n"); - // TODO: reprocess blocks to make sure they are legit? - return true; - } - - if(sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) { - //if (!sporkManager.IsSporkActive(SPORK_22_MASTERNODE_PAYMENT_ENFORCEMENT) && !sporkManager.IsSporkActive(SPORK_BTX_23_MASTERNODE_PAYMENT_LOW_VOTING)) { - LogPrintf("IsBlockPayeeValid -- ERROR: Invalid masternode payment detected at height %d: %s\n", nBlockHeight, txNew->ToString()); - return false; - } else { - LogPrintf("IsBlockPayeeValid -- WARNING: Masternode payment enforcement is ignored, accepting any payee\n"); - return true; - } - //} - - LogPrintf("IsBlockPayeeValid -- WARNING: Masternode payment enforcement is disabled, accepting any payee\n"); - return true; - } - - // superblocks started - // SEE IF THIS IS A VALID SUPERBLOCK - - if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) { - if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) { - if(CSuperblockManager::IsValid(txNew, nBlockHeight, blockReward, pblock)) { - LogPrint(BCLog::GOBJECT, "IsBlockPayeeValid -- Valid superblock at height %d: %s\n", nBlockHeight, txNew->ToString()); - return true; - } - - LogPrintf("IsBlockPayeeValid -- ERROR: Invalid superblock detected at height %d: %s\n", nBlockHeight, txNew->ToString()); - // should NOT allow such superblocks, when superblocks are enabled - return false; - } - // continue validation, should pay MN - LogPrint(BCLog::GOBJECT, "IsBlockPayeeValid -- No triggered superblock detected at height %d\n", nBlockHeight); - } else { - // should NOT allow superblocks at all, when superblocks are disabled - LogPrint(BCLog::GOBJECT, "IsBlockPayeeValid -- Superblocks are disabled, no superblocks allowed\n"); - } - - // IF THIS ISN'T A SUPERBLOCK OR SUPERBLOCK IS INVALID, IT SHOULD PAY A MASTERNODE DIRECTLY if(mnpayments.IsTransactionValid(txNew, nBlockHeight)) { LogPrint(BCLog::MNPAYMENTS, "IsBlockPayeeValid -- Valid masternode payment at height %d: %s\n", nBlockHeight, txNew->ToString()); return true; @@ -216,16 +98,7 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl void FillBlockPayments(CMutableTransaction& txNew, int nBlockHeight, CAmount blockReward, CTxOut& txoutMasternodeRet, std::vector& voutSuperblockRet) { - // only create superblocks if spork is enabled AND if superblock is actually triggered - // (height should be validated inside) - if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED) && - CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) { - LogPrint(BCLog::GOBJECT, "FillBlockPayments -- triggered superblock creation at height %d\n", nBlockHeight); - CSuperblockManager::CreateSuperblock(txNew, nBlockHeight, voutSuperblockRet); - return; - } - // FILL BLOCK PAYEE WITH MASTERNODE PAYMENT OTHERWISE mnpayments.FillBlockPayee(txNew, nBlockHeight, blockReward, txoutMasternodeRet); LogPrint(BCLog::MNPAYMENTS, "FillBlockPayments -- nBlockHeight %d blockReward %lld txoutMasternodeRet %s txNew %s\n", nBlockHeight, blockReward, txoutMasternodeRet.ToString(), txNew.ToString()); @@ -428,7 +301,7 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCom ExtractDestination(vote.payee, address1); std::string address2 = EncodeDestination(address1); - LogPrint(BCLog::MNPAYMENTS, "MASTERNODEPAYMENTVOTE -- vote: address=%s, nBlockHeight=%d, nHeight=%d, prevout=%s, hash=%s new\n", + LogPrint(BCLog::MNPAYMENTS,"MASTERNODEPAYMENTVOTE -- vote: address=%s, nBlockHeight=%d, nHeight=%d, prevout=%s, hash=%s new\n", address2, vote.nBlockHeight, nCachedBlockHeight, vote.vinMasternode.prevout.ToStringShort(), nHash.ToString()); if(AddPaymentVote(vote)){ @@ -571,7 +444,6 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransactionRef txNew) int nMaxSignatures = 0; std::string strPayeesPossible = ""; - CAmount nMasternodePayment = GetMasternodePayment(nBlockHeight, txNew->GetValueOut()); //require at least MNPAYMENTS_SIGNATURES_REQUIRED signatures @@ -581,16 +453,49 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransactionRef txNew) nMaxSignatures = payee.GetVoteCount(); } } +// BTX Start +// BTX If we have minimum one sign so we can check here or we skip that. Always to use 6 sign isn't perfect. 2024-10 - // if we don't have at least MNPAYMENTS_SIGNATURES_REQUIRED signatures on a payee, approve whichever is the longest chain - if(sporkManager.IsSporkActive(SPORK_BTX_23_MASTERNODE_PAYMENT_LOW_VOTING)) + for (auto& payee : vecPayees) { - if(nMaxSignatures < MNPAYMENTS_SIGNATURES_REQUIRED/3) return true; + if (payee.GetVoteCount() >= MNPAYMENTS_SIGNATURES_REQUIRED/3 && SPORK_BTX_23_MASTERNODE_PAYMENT_LOW_VOTING) + { + for (auto txout : txNew->vout) + { + if (payee.GetPayee() == txout.scriptPubKey && nMasternodePayment == txout.nValue) + { + LogPrint(BCLog::MNPAYMENTS, "CMasternodeBlockPayees::IsTransactionValid Spork -- Found required payment\n"); + return true; + } + + CTxDestination address1; + ExtractDestination(payee.GetPayee(), address1); + std::string address2 = EncodeDestination(address1); + + if(strPayeesPossible == "") + { + strPayeesPossible = address2; + } + else + { + strPayeesPossible += "," + address2; + } + + } + LogPrintf("CMasternodeBlockPayees::IsTransactionValid -- ERROR: Missing required payment, possible payees: '%s', amount: %f BTX\n", strPayeesPossible, (float)nMasternodePayment/COIN); + return false; + } } - else + // if we don't have at least MNPAYMENTS_SIGNATURES_REQUIRED signatures on a payee, approve whichever is the longest chain + + LogPrintf("nMaxSignatures: %s \n", nMaxSignatures); + + if(nMaxSignatures < MNPAYMENTS_SIGNATURES_REQUIRED) { - if(nMaxSignatures < MNPAYMENTS_SIGNATURES_REQUIRED) return true; - } + LogPrint(BCLog::MNPAYMENTS, "Default: Not enough nMaxSignatures = %s \n", nMaxSignatures); + return true; + } +/// BTX END for (auto& payee : vecPayees) { if (payee.GetVoteCount() >= MNPAYMENTS_SIGNATURES_REQUIRED) { @@ -727,7 +632,8 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s LOCK(cs_main); strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL * vCount, nRank); LogPrintf("CMasternodePaymentVote::IsValid -- Error: %s\n", strError); - Misbehaving(pnode->GetId(), 20); + //BTX invalid is enough 2024-10 + //Misbehaving(pnode->GetId(), 20); } // Still invalid however return false; diff --git a/src/masternode.cpp b/src/masternode.cpp index f66e2809..a9eaee70 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -105,13 +105,14 @@ arith_uint256 CMasternode::CalculateScore(const uint256& blockHash) return UintToArith256(ss.GetHash()); } -/* + CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outpoint) { - return CheckCollateral(outpoint); + int nHeight; + return CheckCollateral(outpoint, nHeight); } -*/ -CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outpoint) + +CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outpoint, int& nHeightRet) { AssertLockHeld(cs_main); @@ -126,6 +127,7 @@ CMasternode::CollateralStatus CMasternode::CheckCollateral(const COutPoint& outp return COLLATERAL_INVALID_AMOUNT; } + nHeightRet = coin.nHeight; return COLLATERAL_OK; } @@ -268,7 +270,7 @@ bool CMasternode::IsInputAssociatedWithPubkey() CTransactionRef tx; uint256 hash; - if(GetTransaction(vin.prevout.hash, tx, Params().GetConsensus(), hash, true)) { + if(GetTransaction(vin.prevout.hash, tx, Params().GetConsensus(), hash)) { // FXTC BEGIN //for (auto out : tx->vout) // if(out.nValue == 1000*COIN && out.scriptPubKey == payee) return true; @@ -386,23 +388,23 @@ bool CMasternodeBroadcast::Create(std::string strService, std::string strKeyMast return Log("Sync in progress. Must wait until sync is complete to start Masternode"); if (!CMessageSigner::GetKeysFromSecret(strKeyMasternode, keyMasternodeNew, pubKeyMasternodeNew)) - return Log(strprintf("Invalid masternode key %s", strKeyMasternode)); + return Log(strprintf("Invalid masternode key %s\n", strKeyMasternode)); // FXTC TODO: always using first wallet with MN std::vector> wallets = GetWallets(); CWallet * const pwallet = (wallets.size() > 0) ? wallets[0].get() : nullptr; if (!pwallet->GetMasternodeOutpointAndKeys(outpoint, pubKeyCollateralAddressNew, keyCollateralAddressNew, strTxHash, strOutputIndex)) - return Log(strprintf("Could not allocate outpoint %s:%s for masternode %s", strTxHash, strOutputIndex, strService)); + return Log(strprintf("Could not allocate outpoint %s:%s for masternode %s\n", strTxHash, strOutputIndex, strService)); CService service; if (!Lookup(strService.c_str(), service, 0, false)) - return Log(strprintf("Invalid address %s for masternode.", strService)); + return Log(strprintf("Invalid address %s for masternode.\n", strService)); int nDefaultPort = Params().GetDefaultPort(); if (Params().NetworkIDString() == CBaseChainParams::MAIN) { if (service.GetPort() != nDefaultPort) - return Log(strprintf("Invalid port %u for masternode %s, only %d is supported on mainnet.", service.GetPort(), strService, nDefaultPort)); + return Log(strprintf("Invalid port %u for masternode %s, only %d is supported on mainnet.\n", service.GetPort(), strService, nDefaultPort)); } else if (service.GetPort() == nDefaultPort) - return Log(strprintf("Invalid port %u for masternode %s, %d is the only supported on mainnet.", service.GetPort(), strService, nDefaultPort)); + return Log(strprintf("Invalid port %u for masternode %s, %d is the only supported on mainnet.\n", service.GetPort(), strService, nDefaultPort)); return Create(outpoint, service, keyCollateralAddressNew, pubKeyCollateralAddressNew, keyMasternodeNew, pubKeyMasternodeNew, strErrorRet, mnbRet); } @@ -426,16 +428,16 @@ bool CMasternodeBroadcast::Create(const COutPoint& outpoint, const CService& ser CMasternodePing mnp(outpoint); if (!mnp.Sign(keyMasternodeNew, pubKeyMasternodeNew)) - return Log(strprintf("Failed to sign ping, masternode=%s", outpoint.ToStringShort())); + return Log(strprintf("Failed to sign ping, masternode=%s\n", outpoint.ToStringShort())); mnbRet = CMasternodeBroadcast(service, outpoint, pubKeyCollateralAddressNew, pubKeyMasternodeNew, PROTOCOL_VERSION); if (!mnbRet.IsValidNetAddr()) - return Log(strprintf("Invalid IP address, masternode=%s", outpoint.ToStringShort())); + return Log(strprintf("Invalid IP address, masternode=%s\n", outpoint.ToStringShort())); mnbRet.lastPing = mnp; if (!mnbRet.Sign(keyCollateralAddressNew)) - return Log(strprintf("Failed to sign broadcast, masternode=%s", outpoint.ToStringShort())); + return Log(strprintf("Failed to sign broadcast, masternode=%s\n", outpoint.ToStringShort())); return true; } @@ -577,7 +579,7 @@ bool CMasternodeBroadcast::CheckOutpoint(int& nDos) } int nHeight; - CollateralStatus err = CheckCollateral(vin.prevout); + CollateralStatus err = CheckCollateral(vin.prevout, nHeight); if (err == COLLATERAL_UTXO_NOT_FOUND) { LogPrint(BCLog::MASTERNODE, "CMasternodeBroadcast::CheckOutpoint -- Failed to find Masternode UTXO, masternode=%s\n", vin.prevout.ToStringShort()); return false; @@ -613,7 +615,7 @@ bool CMasternodeBroadcast::CheckOutpoint(int& nDos) // should be at least not earlier than block when masternode collateral tx got nMasternodeMinimumConfirmations uint256 hashBlock = uint256(); CTransactionRef tx2; - GetTransaction(vin.prevout.hash, tx2, Params().GetConsensus(), hashBlock, true); + GetTransaction(vin.prevout.hash, tx2, Params().GetConsensus(), hashBlock); { LOCK(cs_main); BlockMap::iterator mi = mapBlockIndex.find(hashBlock); @@ -780,7 +782,10 @@ bool CMasternodePing::CheckAndUpdate(CMasternode* pmn, bool fFromNewBroadcast, i return false; } - if (pmn->IsNewStartRequired()) { + // BTX BEGIN + //if (pmn->IsNewStartRequired()) { + if (pmn->IsExpired()){ + // BTX END LogPrint(BCLog::MASTERNODE, "CMasternodePing::CheckAndUpdate -- masternode is completely expired, new start is required, masternode=%s\n", vin.prevout.ToStringShort()); return false; } @@ -789,8 +794,13 @@ bool CMasternodePing::CheckAndUpdate(CMasternode* pmn, bool fFromNewBroadcast, i { LOCK(cs_main); BlockMap::iterator mi = mapBlockIndex.find(blockHash); - if ((*mi).second && (*mi).second->nHeight < chainActive.Height() - 24) { - LogPrintf("CMasternodePing::CheckAndUpdate -- Masternode ping is invalid, block hash is too old: masternode=%s blockHash=%s\n", vin.prevout.ToStringShort(), blockHash.ToString()); + // BTX 2024-10 + if ((*mi).second && (*mi).second->nHeight < chainActive.Height() - (MASTERNODE_NEW_START_REQUIRED_SECONDS / Params().GetConsensus().nPowTargetSpacing)) { + //if ((*mi).second && (*mi).second->nHeight < chainActive.Height() - 24) { + //LogPrintf("CMasternodePing::CheckAndUpdate -- Masternode ping is invalid, block hash is too old: masternode=%s blockHash=%s\n", vin.prevout.ToStringShort(), blockHash.ToString()); + LogPrint(BCLog::MASTERNODE, "CMasternodePing::CheckAndUpdate -- Masternode ping is invalid, block hash is too old: masternode=%s blockHash=%s\n", vin.prevout.ToStringShort(), blockHash.ToString()); + // Do nothing here ( no Masternode update, no mnping relay) + // Let this node to be visible but fail to accept mnping // nDos = 1; return false; } diff --git a/src/masternode.h b/src/masternode.h index 04b1857b..5401364f 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -17,9 +17,9 @@ class CConnman; static const int MASTERNODE_CHECK_SECONDS = 5; static const int MASTERNODE_MIN_MNB_SECONDS = 5 * 60; static const int MASTERNODE_MIN_MNP_SECONDS = 10 * 60; -static const int MASTERNODE_EXPIRATION_SECONDS = 65 * 60; +static const int MASTERNODE_EXPIRATION_SECONDS = 4 * 60 * 60; //BTX 2024-10 We make it a little easier to keep the mn online. old 65 * 60; static const int MASTERNODE_WATCHDOG_MAX_SECONDS = 120 * 60; -static const int MASTERNODE_NEW_START_REQUIRED_SECONDS = 180 * 60; +static const int MASTERNODE_NEW_START_REQUIRED_SECONDS = 3 * 24 * 60 * 60; // old 180 * 60; static const int MASTERNODE_POSE_BAN_MAX_SCORE = 5; @@ -204,6 +204,7 @@ class CMasternode : public masternode_info_t bool UpdateFromNewBroadcast(CMasternodeBroadcast& mnb, CConnman& connman); static CollateralStatus CheckCollateral(const COutPoint& outpoint); + static CollateralStatus CheckCollateral(const COutPoint& outpoint, int& nHeightRet); // FXTC BEGIN bool CollateralValueCheck(int nHeight, CAmount TxValue); diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index a5937945..9a93a71a 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -18,6 +18,10 @@ #include