diff --git a/README.md b/README.md index 54ef10661336b..2887aa774274b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -$PAC Core staging tree 0.12.3 +$PAC Core staging tree 0.12.3.0 =============================== @@ -82,11 +82,26 @@ Translators should also follow the [forum](https://www.paccoin.org/forum/topic/p Setting up a masternode on a VPS (only for Cold wallet setup) ------- Go to your VPS and execute this: -1) wget https://raw.githubusercontent.com/PACCommunity/PAC/master/pacmn.sh -2) chmod +x pacmn.sh -3) ./pacmn.sh +1) `wget https://raw.githubusercontent.com/PACCommunity/PAC/master/pacmn.sh` +2) `chmod +x pacmn.sh` +3) `./pacmn.sh` Follow the instructions and: Enter your external IP Enter your masternode genkey The script will setup the environment and run your masternode + +Updating a masternode on a VPS to the latest verion (only for Cold wallet setup) +------- +Go to your VPS and execute the following commands on the command line: +1) `wget https://raw.githubusercontent.com/PACCommunity/PAC/master/pac-update.sh` +2) `chmod +x pac-update.sh` +3) `./pac-update.sh` + +Or run this single line to execute the previous commands in one go: + +`wget https://raw.githubusercontent.com/PACCommunity/PAC/master/pac-update.sh && chmod +x pac-update.sh && ./pac-update.sh` + + +Follow the instructions: +1)Do you want to autobackup wallet.dat and continue with the process? [y/n]: Type yes to backup and continue or no to stop process diff --git a/configure.ac b/configure.ac index 5e9ba469b7c50..a2362adccd02d 100644 --- a/configure.ac +++ b/configure.ac @@ -2,10 +2,10 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 12) -define(_CLIENT_VERSION_REVISION, 2) -define(_CLIENT_VERSION_BUILD, 3) +define(_CLIENT_VERSION_REVISION, 3) +define(_CLIENT_VERSION_BUILD, 1) define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2017) +define(_COPYRIGHT_YEAR, 2018) AC_INIT([Paccoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/paccoinpay/paccoin/issues],[paccoincore]) AC_CONFIG_SRCDIR([src/validation.cpp]) AC_CONFIG_HEADERS([src/config/paccoin-config.h]) diff --git a/contrib/seeds/nodes_main.txt b/contrib/seeds/nodes_main.txt index abd19f9d19ea6..21d94ceb2bf74 100644 --- a/contrib/seeds/nodes_main.txt +++ b/contrib/seeds/nodes_main.txt @@ -1,2 +1,5 @@ -54.244.79.140:7112 -34.209.87.8:7112 \ No newline at end of file +209.250.251.184:7112 +108.61.252.138:7112 +144.202.48.162:7112 +45.32.193.76:7112 +144.202.101.191:7112 \ No newline at end of file diff --git a/contrib/seeds/nodes_test.txt b/contrib/seeds/nodes_test.txt index 23a02d956ac13..8899c5173ba7f 100644 --- a/contrib/seeds/nodes_test.txt +++ b/contrib/seeds/nodes_test.txt @@ -1,2 +1,2 @@ -34.212.116.68:17111 -34.212.253.142:17111 +144.202.75.199:17112 +144.202.106.163:17112 \ No newline at end of file diff --git a/pac-update.sh b/pac-update.sh new file mode 100644 index 0000000000000..26923ed2e8a1f --- /dev/null +++ b/pac-update.sh @@ -0,0 +1,184 @@ +#!/bin/bash + +set -e +cd ~/ + +arch=`uname -m` +version="0.12.3.1" +old_version="0.12.3.0" +base_url="https://github.com/PACCommunity/PAC/releases/download/v${version}" +if [ "${arch}" == "x86_64" ]; then + tarball_name="PAC-v${version}-linux-x86_64.tar.gz" + binary_url="${base_url}/${tarball_name}" +elif [ "${arch}" == "x86_32" ]; then + tarball_name="PAC-v${version}-linux-x86.tar.gz" + binary_url="${base_url}/${tarball_name}" +else + echo "PAC binary distribution not available for the architecture: ${arch}" + exit -1 +fi + +echo " .......... " +echo " .............. " +echo " .................... " +echo " .....-yyyyyyys+-:oo-.. oooooooo. ooooo oooooooo " +echo " ......:MMMMNNdddmMMMd... MMMMNMMMMMh. MMMMMMM MMMMMMMMMM " +echo "......:MMmy..-+MNdh:..... MMMM: .dMMMy oMMMyMMNN .NMMMMy " +echo "......:ddmm...-hdNm...... MMMM+-+mMMMs :MMMs dMMm yMMMMo " +echo "....:ohNMMNdoydNMMN/..... MMMMMMMMMmo. NMMN -MMMd yMMMM. " +echo "...+dMNdddNmmdhy+-....... MMMM+::- dMMMNmmmMMMMs :MMMMm. " +echo "......::MMMm............. MMMM: yMMMdoooooNMMM mMMMMNdddN+ " +echo " ......:MNdo............. dddd- ddddd. ddddd. :ohdmmdhy: " +echo " ....-+-.............. " +echo " ................. " +echo " ........... " + +echo "################################################" +echo "# Welcome #" +echo "################################################" +echo "" +echo "This script will update PAC to the latest version (${version})." +echo "Before running the script we recommend to backup your private keys and your wallet.dat file that is under ~/.paccoincore/wallet.dat even though this script will not affect them" +read -p "Do you want to auto-backup wallet.dat and continue with the process? [y/n]: " cont +if [ $cont = 'n' ] || [ $cont = 'no' ] || [ $cont = 'N' ] || [ $cont = 'No' ]; then + exit -1 +fi + +if [ -e ~/paccoin-cli ] && [ -e ~/paccoind ]; then + echo "" + echo "#######################################" + echo "# Stopping pac services (daemon) #" + echo "#######################################" + echo "" + + wallstatus=$( ./paccoin-cli mnsync status ) || true + if [ -z "$wallstatus" ]; then + echo "Daemon is not running no need to stop it" + else + echo "Stopping the Daemon" + ./paccoin-cli stop + sleep 60 + + wallstatus=$( ./paccoin-cli mnsync status ) || true + if [ -z "$wallstatus" ]; then + echo "Daemon stopped!" + else + echo "Daemon was not stopped! Please kill the deamon process or run ./paccoin-cli stop, then run the script again" + exit + fi + fi + + echo "" + echo "###############################" + echo "# Removing old binaries #" + echo "###############################" + echo "" + + if [ -e paccoin-cli ]; then + echo "Removing paccoin-cli" + rm paccoin-cli + fi + + if [ -e paccoind ]; then + echo "Removing paccoind" + rm paccoind + fi + + if [ -e paccoin-qt ]; then + echo "Removing paccoin-qt" + rm paccoin-qt + fi + + if [ -e ~/PAC-v0.12.3.0-linux-x86_64.tar.gz ]; then + echo "Removing PAC-v0.12.3.0-linux-x86_64.tar.gz" + rm PAC-v0.12.3.0-linux-x86_64.tar.gz + fi + + if [ -d ~/PAC-v0.12.3.0-linux-x86_64 ]; then + echo "Removing PAC-v0.12.23.0-linux-x86_64 directory" + rm -r PAC-v0.12.3.0-linux-x86_64 + fi +else + is_pac_running=`ps ax | grep -v grep | grep paccoind | wc -l` + if [ $is_pac_running -gt 0 ]; then + echo "PAC process is still running, it's not safe to continue with the update, exiting." + echo "Please stop the daemon with './pacoin-cli stop' or kill the daeomon process, then run the script again." + exit -1 + fi +fi + +echo "" +echo "#######################################" +echo "# Backing up the wallet.dat #" +echo "#######################################" +echo "" +is_pac_running=`ps ax | grep -v grep | grep paccoind | wc -l` +if [ $is_pac_running -gt 0 ]; then + echo "PAC process is still running, it's not safe to continue with the update, exiting." + echo "Please stop the daemon with './paccoin-cli stop' or kill the daemon process, then run the script again." + exit -1 +else + currpath=$( pwd ) + echo "Backing up the wallet.dat" + backupsdir="pac_wallet_backups" + mkdir -p $backupsdir + backupfilename=wallet.dat.$(date +%F_%T) + cp ~/.paccoincore/wallet.dat "$currpath/$backupsdir/$backupfilename" + echo "wallet.dat was saved to : $currpath/$backupsdir/$backupfilename" +fi + +echo "" +echo "###############################" +echo "# Get/Setup new binaries #" +echo "###############################" +echo "" + +if test -e "${tarball_name}"; then + rm -r $tarball_name +fi +wget $binary_url +if test -e "${tarball_name}"; then + echo "Unpacking $PAC distribution" + tar -xvzf $tarball_name + chmod +x paccoind + chmod +x paccoin-cli + echo "Binaries were saved to: $PWD/$tarball_name" +else + echo "There was a problem downloading the binaries, please try running again the script." + exit -1 +fi + +echo "" +echo "##################################################################" +echo "# Updating the sentinel (Applies only on masternodes) #" +echo "##################################################################" +echo "" + +was_sentinel_found=0 +if [ -d ~/sentinel ]; then + was_sentinel_found=1 + cd sentinel + git pull + cd .. +fi + +echo "" +echo "###########################" +echo "# Running the daemon #" +echo "###########################" +echo "" + +cd ~/ +./paccoind -daemon=1 +echo "Waiting for daemon to be up and running" +sleep 60 +./paccoin-cli getinfo +echo "PAC Updated!" +echo "Remember to go to your cold wallet and start the masternode (cold wallet must also be on the latest version)." + +if [ $was_sentinel_found -eq 0 ]; then + echo "No sentinel was found, in case this is a masternode follow the instructions below. If this is not a masternode, then ignore this message." + echo "Intructions:" + echo "1) Go to the sentinel folder" + echo "2) Run this command: git pull" +fi \ No newline at end of file diff --git a/pacmn.sh b/pacmn.sh index 049042337acd2..9120d676a79b4 100644 --- a/pacmn.sh +++ b/pacmn.sh @@ -2,6 +2,31 @@ set -e +if [ "$1" == "--testnet" ]; then + pac_rpc_port=17111 + pac_port=17112 + is_testnet=1 +else + pac_rpc_port=7111 + pac_port=7112 + is_testnet=0 +fi + +arch=`uname -m` +version="0.12.3.1" +old_version="0.12.3.0" +base_url="https://github.com/PACCommunity/PAC/releases/download/v${version}" +if [ "${arch}" == "x86_64" ]; then + tarball_name="PAC-v${version}-linux-x86_64.tar.gz" + binary_url="${base_url}/${tarball_name}" +elif [ "${arch}" == "x86_32" ]; then + tarball_name="PAC-v${version}-linux-x86.tar.gz" + binary_url="${base_url}/${tarball_name}" +else + echo "PAC binary distribution not available for the architecture: ${arch}" + exit -1 +fi + echo "################################################" echo "# Welcome to PAC Masternode's server setup #" echo "################################################" @@ -23,26 +48,10 @@ echo "###############################" echo "# Installing Dependencies #" echo "###############################" echo "" -echo "Running this script on Ubuntu 16.04 LTS is highly recommended (2GB RAM)" +echo "Running this script on Ubuntu 16.04 LTS or newer is highly recommended." -sudo add-apt-repository -y ppa:bitcoin/bitcoin sudo apt-get -y update -sudo apt-get -y install libminiupnpc-dev -sudo apt-get -y install libboost-all-dev -sudo apt-get -y install build-essential -sudo apt-get -y install libtool -sudo apt-get -y install autotools-dev -sudo apt-get -y install automake pkg-config -sudo apt-get -y install libssl-dev -sudo apt-get -y install libevent-dev bsdmainutils -sudo apt-get -y install git -sudo apt-get -y install libzmq3-dev -sudo apt-get -y install libdb4.8-dev -sudo apt-get -y install libdb4.8++-dev -sudo apt-get -y install virtualenv -sudo apt-get -y install ufw -sudo apt-get -y install pwgen -sudo apt-get -y install jq +sudo apt-get -y install git python virtualenv ufw pwgen echo "###############################" @@ -52,26 +61,34 @@ sudo ufw status sudo ufw disable sudo ufw allow ssh/tcp sudo ufw limit ssh/tcp -sudo ufw allow 7112/tcp +sudo ufw allow $pac_port/tcp sudo ufw logging on sudo ufw --force enable sudo ufw status -sudo iptables -A INPUT -p tcp --dport '7112' -j ACCEPT +sudo iptables -A INPUT -p tcp --dport $pac_port -j ACCEPT echo "" echo "###############################" echo "# Get/Setup binaries #" echo "###############################" echo "" -wget "https://github.com/PACCommunity/PAC/releases/download/v0.12.2.3/PAC-v0.12.2.3-ubuntu-16.04-x64.tar.gz" -tar xvf 'PAC-v0.12.2.3-ubuntu-16.04-x64.tar.gz' -cd ~/ -rm PAC-v0.12.2.3-ubuntu-16.04-x64.tar.gz -currpath=$( pwd ) -echo "Binaries got stored on: $currpath" -chmod +x paccoind -chmod +x paccoin-cli + +if test -e "${tarball_name}"; then + rm -r $tarball_name +fi +wget $binary_url +if test -e "${tarball_name}"; then + echo "Unpacking $PAC distribution" + tar -xvzf $tarball_name + chmod +x paccoind + chmod +x paccoin-cli + echo "Binaries were saved to: $PWD/$tarball_name" + rm -r $tarball_name +else + echo "There was a problem downloading the binaries, please try running again the script." + exit -1 +fi echo "###############################" echo "# Configure the wallet #" @@ -98,15 +115,15 @@ echo "Configuring the paccoin.conf" echo "rpcuser=$(pwgen -s 16 1)" > paccoin.conf echo "rpcpassword=$(pwgen -s 64 1)" >> paccoin.conf echo "rpcallowip=127.0.0.1" >> paccoin.conf -echo "rpcport=7111" >> paccoin.conf +echo "rpcport=$pac_rpc_port" >> paccoin.conf echo "externalip=$ipaddr" >> paccoin.conf -echo "port=7112" >> paccoin.conf +echo "port=$pac_port" >> paccoin.conf echo "server=1" >> paccoin.conf echo "daemon=1" >> paccoin.conf echo "listen=1" >> paccoin.conf -echo "staking=0" >> paccoin.conf +echo "testnet=$is_testnet" >> paccoin.conf echo "masternode=1" >> paccoin.conf -echo "masternodeaddr=$ipaddr:7112" >> paccoin.conf +echo "masternodeaddr=$ipaddr:$pac_port" >> paccoin.conf echo "masternodeprivkey=$mnkey" >> paccoin.conf @@ -119,11 +136,9 @@ cd ~/ ./paccoind sleep 60 -syncedinfo=$( ./paccoin-cli mnsync status ) -assetid=$( echo $syncedinfo | jq '.AssetID' ) - -if [ $assetid == 'null' ]; then - echo "Wallet is not running or there is an issue, please restart wallet!" +is_pac_running=`ps ax | grep -v grep | grep paccoind | wc -l` +if [ $is_pac_running -eq 0 ]; then + echo "The daemon is not running or there is an issue, please restart the daemon!" exit fi diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index ecccbad314145..f0c5da00c1e0a 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -120,7 +120,13 @@ bool CActiveMasternode::SendMasternodePing(CConnman& connman) bool CActiveMasternode::UpdateSentinelPing(int version) { nSentinelVersion = version; + if(version < MIN_SENTINEL_VERSION ){ + LogPrintf("CActiveMasternode::UpdateSentinelPing -- Sentinel is out of date please update. Version = %s\n", SafeIntVersionToString(version)); + return false; + } + nSentinelPingTime = GetAdjustedTime(); + LogPrint("masternode", "CActiveMasternode::UpdateSentinelPing -- Updated Sentinel Version = %s PingTime = %d\n", SafeIntVersionToString(nSentinelVersion), nSentinelPingTime); return true; } @@ -197,7 +203,7 @@ void CActiveMasternode::ManageStateInitial(CConnman& connman) void CActiveMasternode::ManageStateRemote() { - LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n", + LogPrint("masternode", "CActiveMasternode::ManageStateRemote -- Start status = %s, type = %s, pinger enabled = %d, pubKeyMasternode.GetID() = %s\n", GetStatus(), GetTypeString(), fPingerEnabled, pubKeyMasternode.GetID().ToString()); mnodeman.CheckMasternode(pubKeyMasternode, true); diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 5e3e72328a5cc..66fd47226b03c 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2014-2017 The Dash Core developers +// Copyright (c) 2018 The $PAC Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -91,7 +92,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi * * CBlock(hash=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1390095618, nBits=1e0ffff0, nNonce=28917698, vtx=1) * CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0) - * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73) + * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c57426974636f696e20426c6f636b20233530373230323a2030303030303030303030303030303030303032646366383861643766656365383639346361663735313234626131383165323963653338633736623763333738) * CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF) * vMerkleTree: e0028e */ @@ -120,8 +121,8 @@ class CMainParams : public CChainParams { strNetworkID = "main"; consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050) consensus.nMasternodePaymentsStartBlock = 200; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock - consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value - consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value + consensus.nMasternodePaymentsIncreaseBlock = 50000; // 50000 height aproximately April 20th + consensus.nMasternodePaymentsIncreasePeriod = 576*30; // Not used consensus.nInstantSendKeepLock = 24; consensus.nBudgetPaymentsStartBlock = 200; // actual historical value consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725 @@ -163,10 +164,10 @@ class CMainParams : public CChainParams { consensus.vDeployments[Consensus::DEPLOYMENT_DIP0001].nThreshold = 3226; // 80% of 4032 // The best chain should have at least this much work. - consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000000183bd5351b7866"); // 7200 + consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000204045f68ab84052de"); // #50620 // By default assume that the signatures in ancestors of this block are valid. - consensus.defaultAssumeValid = uint256S("0x00000000000b7d73439cae777bae147b8daaee692a9e5e06fd8466749de39465"); // 7200 + consensus.defaultAssumeValid = uint256S("0x0000000000000349685ff23a2344db4d51ae9f169cda23c8a472fb783914b071"); // #50620 /** * The message start string is designed to be unlikely to occur in normal data. @@ -192,6 +193,8 @@ class CMainParams : public CChainParams { vSeeds.clear(); vSeeds.push_back(CDNSSeedData("paccoin.io", "dnsseed1.paccoin.io")); vSeeds.push_back(CDNSSeedData("paccoin.io", "dnsseed2.paccoin.io")); + vSeeds.push_back(CDNSSeedData("paccoin.io", "dns-seeder-next.paccoin.io")); + vSeeds.push_back(CDNSSeedData("paccoin.io", "dns-seeder-foxtrot.paccoin.io")); // Paccoin addresses start with 'P' base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,55); @@ -221,12 +224,15 @@ class CMainParams : public CChainParams { checkpointData = (CCheckpointData) { boost::assign::map_list_of - ( 100, uint256S("0x000005065df82218140bc7c59cfd6913eaa5a88f3255ccc977c546cb0beb9ff0")) - ( 7200, uint256S("0x00000000000b7d73439cae777bae147b8daaee692a9e5e06fd8466749de39465")), - 1517696635, // * UNIX timestamp of last checkpoint block - 0, // * total number of transactions between genesis and last checkpoint + ( 100, uint256S("0x000005065df82218140bc7c59cfd6913eaa5a88f3255ccc977c546cb0beb9ff0")) + ( 7200, uint256S("0x00000000000b7d73439cae777bae147b8daaee692a9e5e06fd8466749de39465")) + ( 43850, uint256S("0x0000000000000be675f137fbf5cbe5e9d8cb0ea509d30252a02c30944f16970f")) + ( 50000, uint256S("0x00000000000007cdd43a784898eb9cb5be63ca7db5e5935a05a1baa01a658ca0")) + ( 50620, uint256S("0x0000000000000349685ff23a2344db4d51ae9f169cda23c8a472fb783914b071")), + 1524414644, // * UNIX timestamp of last checkpoint block + 167228, // * total number of transactions between genesis and last checkpoint // (the tx=... number in the SetBestChain debug.log lines) - 1000 // * estimated number of transactions per day after checkpoint + 1500 // * estimated number of transactions per day after checkpoint }; } }; @@ -241,7 +247,7 @@ class CTestNetParams : public CChainParams { strNetworkID = "test"; consensus.nSubsidyHalvingInterval = 210240; consensus.nMasternodePaymentsStartBlock = 2; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock - consensus.nMasternodePaymentsIncreaseBlock = 4030; + consensus.nMasternodePaymentsIncreaseBlock = 6200; consensus.nMasternodePaymentsIncreasePeriod = 10; consensus.nInstantSendKeepLock = 6; consensus.nBudgetPaymentsStartBlock = 2; @@ -304,9 +310,8 @@ class CTestNetParams : public CChainParams { assert(consensus.hashGenesisBlock == uint256S(TESTNET_GENESIS_HASH)); assert(genesis.hashMerkleRoot == uint256S(GENESIS_MERKLE_ROOT)); - vFixedSeeds.clear(); vSeeds.clear(); - //vSeeds.push_back(CDNSSeedData("paccoin.net", "testnet-seed.paccoin.net")); + vSeeds.push_back(CDNSSeedData("paccoin.io", "testnet-static-dns.paccoin.io")); // Testnet Paccoin addresses start with 'q' base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,120); diff --git a/src/chainparamsseeds.h b/src/chainparamsseeds.h index 0e578c819733e..1bdd73bcf799a 100644 --- a/src/chainparamsseeds.h +++ b/src/chainparamsseeds.h @@ -9,11 +9,15 @@ */ static SeedSpec6 pnSeed6_main[] = { {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd1,0xfa,0xfb,0xb8}, 7112}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xfc,0x8a}, 7112} + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0x3d,0xfc,0x8a}, 7112}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x30,0xa2}, 7112}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0xc1,0x4c}, 7112}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x65,0xbf}, 7112} }; static SeedSpec6 pnSeed6_test[] = { - //{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x22,0xd4,0x74,0x44}, 17111}, - //{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x22,0xd4,0xfd,0x8e}, 17111} + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x4b,0xc7}, 17112}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x6a,0xa3}, 17112} }; + #endif // PAC_CHAINPARAMSSEEDS_H diff --git a/src/clientversion.h b/src/clientversion.h index bcd47d477b966..87755e11be5ca 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -16,8 +16,8 @@ //! These need to be macros, as clientversion.cpp's and paccoin*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 12 -#define CLIENT_VERSION_REVISION 2 -#define CLIENT_VERSION_BUILD 3 +#define CLIENT_VERSION_REVISION 3 +#define CLIENT_VERSION_BUILD 1 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true @@ -26,7 +26,7 @@ * Copyright year (2009-this) * Todo: update this when changing our copyright comments in the source */ -#define COPYRIGHT_YEAR 2017 +#define COPYRIGHT_YEAR 2018 #endif //HAVE_CONFIG_H diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 8603c2909b27d..bcaa7e18f0f34 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -282,7 +282,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int nBlockH } // GET MASTERNODE PAYMENT VARIABLES SETUP - CAmount masternodePayment = GetMasternodePayment(nBlockHeight, blockReward); + CAmount masternodePayment = GetMasternodePayment(nBlockHeight, blockReward, Params().GetConsensus()); // split reward between miner ... txNew.vout[0].nValue -= masternodePayment; @@ -549,7 +549,7 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew) int nMaxSignatures = 0; std::string strPayeesPossible = ""; - CAmount nMasternodePayment = GetMasternodePayment(nBlockHeight, txNew.GetValueOut()); + CAmount nMasternodePayment = GetMasternodePayment(nBlockHeight, txNew.GetValueOut(), Params().GetConsensus()); //require at least MNPAYMENTS_SIGNATURES_REQUIRED signatures diff --git a/src/masternode-payments.h b/src/masternode-payments.h index 1cf5d87491e1c..8ddda879096b7 100644 --- a/src/masternode-payments.h +++ b/src/masternode-payments.h @@ -24,7 +24,7 @@ static const int MNPAYMENTS_SIGNATURES_TOTAL = 10; // V1 - Last protocol version before update // V2 - Newest protocol version static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70206; -static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70208; +static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70213; extern CCriticalSection cs_vecPayees; extern CCriticalSection cs_mapMasternodeBlocks; diff --git a/src/masternode.cpp b/src/masternode.cpp index 2be5ba6864c0d..b27f03950f67c 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -324,7 +324,7 @@ void CMasternode::UpdateLastPaid(const CBlockIndex *pindex, int nMaxBlocksToScan if(!ReadBlockFromDisk(block, BlockReading, Params().GetConsensus())) // shouldn't really happen continue; - CAmount nMasternodePayment = GetMasternodePayment(BlockReading->nHeight, block.vtx[0].GetValueOut()); + CAmount nMasternodePayment = GetMasternodePayment(BlockReading->nHeight, block.vtx[0].GetValueOut(), Params().GetConsensus()); BOOST_FOREACH(CTxOut txout, block.vtx[0].vout) if(mnpayee == txout.scriptPubKey && nMasternodePayment == txout.nValue) { diff --git a/src/masternode.h b/src/masternode.h index 56462ba51739e..cb02cc4f229c5 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -29,6 +29,10 @@ static const int MASTERNODE_POSE_BAN_MAX_SCORE = 5; // sentinel version before sentinel ping implementation #define DEFAULT_SENTINEL_VERSION 0x010001 +// sentinel with voting fix to enable proposals +#define MIN_SENTINEL_VERSION 0x010200 + + class CMasternodePing { public: diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 2460c74ce673e..0e42b21be95e2 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -344,6 +344,16 @@ UniValue gobject(const UniValue& params, bool fHelp) return returnObj; } + if(mn.IsWatchdogExpired()) { + nFailed++; + statusObj.push_back(Pair("result", "failed")); + statusObj.push_back(Pair("errorMessage", "WATCHDOG_EXPIRED nodes aren't allowed to vote.")); + resultsObj.push_back(Pair("paccoin.conf", statusObj)); + returnObj.push_back(Pair("overall", strprintf("Voted successfully %d time(s) and failed %d time(s).", nSuccessful, nFailed))); + returnObj.push_back(Pair("detail", resultsObj)); + return returnObj; + } + CGovernanceVote vote(mn.vin.prevout, hash, eVoteSignal, eVoteOutcome); if(!vote.Sign(activeMasternode.keyMasternode, activeMasternode.pubKeyMasternode)) { nFailed++; diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 96e589b863cda..0d83d63f53d4a 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -846,6 +846,5 @@ UniValue sentinelping(const UniValue& params, bool fHelp) ); } - activeMasternode.UpdateSentinelPing(StringVersionToInt(params[0].get_str())); - return true; + return activeMasternode.UpdateSentinelPing(StringVersionToInt(params[0].get_str())); } diff --git a/src/validation.cpp b/src/validation.cpp index b7072eac321a9..2987a5b54df58 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1239,7 +1239,7 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params& } else { dDiff = ConvertBitsToDouble(nPrevBits); } - + if (nPrevHeight < 100) { nSubsidyBase = 35500000; @@ -1260,17 +1260,23 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params& return fSuperblockPartOnly ? nSuperblockPart : nSubsidy - nSuperblockPart; } -CAmount GetMasternodePayment(int nHeight, CAmount blockValue) +CAmount GetMasternodePayment(int nHeight, CAmount blockValue, const Consensus::Params& consensusParams) { - double dMasternodePart = 9.0/16.0; - CAmount ret = blockValue * dMasternodePart; // 45% of the total block reward. - return ret; + double dMasternodePart; + + if(nHeight < consensusParams.nMasternodePaymentsIncreaseBlock){ + dMasternodePart = 9.0/16.0; // 56.25% of the block reward. + } else { + dMasternodePart = 15.0/16.0; // 93.75% of the block reward. + } + + return (blockValue * dMasternodePart); } double GetSubsidyMultiplier(int nPrevHeight, int nSubsidyAdjustmentInterval) { double dMultiplier = 0.0; - + if (nPrevHeight < 100) { dMultiplier = 1.0; } else if (nPrevHeight <= nSubsidyAdjustmentInterval * 1) { @@ -1292,7 +1298,7 @@ double GetSubsidyMultiplier(int nPrevHeight, int nSubsidyAdjustmentInterval) } else { dMultiplier = 0.0; } - + return dMultiplier; } @@ -2224,6 +2230,14 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd // the peer who sent us this block is missing some data and wasn't able // to recognize that block is actually invalid. // TODO: resync data (both ways?) and try to reprocess this block later. + int nInvalidMasternodePaymentsIncreaseBlock = chainparams.GetConsensus().nMasternodePaymentsIncreaseBlock; + if (chainparams.NetworkIDString() == CBaseChainParams::MAIN && + pindex->nHeight == nInvalidMasternodePaymentsIncreaseBlock && + pindex->GetBlockHash() != uint256S("0x00000000000007cdd43a784898eb9cb5be63ca7db5e5935a05a1baa01a658ca0")) { + InvalidateBlock(state, chainparams.GetConsensus(), pindex); + return state.DoS(0, error("ConnectBlock(PAC): invalid chain found on block %i", nInvalidMasternodePaymentsIncreaseBlock), REJECT_INVALID, "bad-chain-found"); + } + CAmount blockReward = nFees + GetBlockSubsidy(pindex->pprev->nBits, pindex->pprev->nHeight, chainparams.GetConsensus()); std::string strError = ""; if (!IsBlockValueValid(block, pindex->nHeight, blockReward, strError)) { @@ -3959,7 +3973,7 @@ bool LoadBlockIndex() return true; } -bool InitBlockIndex(const CChainParams& chainparams) +bool InitBlockIndex(const CChainParams& chainparams) { LOCK(cs_main); diff --git a/src/validation.h b/src/validation.h index 725c06ef1c5e9..841a827284a28 100644 --- a/src/validation.h +++ b/src/validation.h @@ -198,7 +198,7 @@ static const unsigned int DEFAULT_CHECKLEVEL = 3; // Setting the target to > than 945MB will make it likely we can respect the target. static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024; -/** +/** * 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! @@ -209,7 +209,7 @@ static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 945 * 1024 * 1024; * * Note that we guarantee that either the proof-of-work is valid on pblock, or * (and possibly also) BlockChecked will have been called. - * + * * @param[in] pblock The block we want to process. * @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources and whitelisted peers. * @param[out] dbp The already known disk position of pblock, or NULL if not yet stored. @@ -263,7 +263,7 @@ bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams, double ConvertBitsToDouble(unsigned int nBits); CAmount GetBlockSubsidy(int nBits, int nHeight, const Consensus::Params& consensusParams, bool fSuperblockPartOnly = false); -CAmount GetMasternodePayment(int nHeight, CAmount blockValue); +CAmount GetMasternodePayment(int nHeight, CAmount blockValue, const Consensus::Params& consensusParams); double GetSubsidyMultiplier(int nPrevHeight, int nSubsidyAdjustmentInterval); /** @@ -318,7 +318,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 @@ -381,7 +381,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = NULL /** * 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 { diff --git a/src/version.h b/src/version.h index 9b0f31b35df4c..b373eee2e4444 100644 --- a/src/version.h +++ b/src/version.h @@ -10,7 +10,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70212; +static const int PROTOCOL_VERSION = 70213; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -19,7 +19,7 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 70077; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 70212; +static const int MIN_PEER_PROTO_VERSION = 70213; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this