From 5038b56d7ba828fab8dccac8245903eaf5f1534b Mon Sep 17 00:00:00 2001 From: faetos Date: Thu, 26 Jul 2018 11:16:53 -0500 Subject: [PATCH] Final budget alterations --- configure.ac | 2 +- contrib/devtools/check-doc.py | 2 +- contrib/gitian-descriptors/gitian-aarch64.yml | 2 +- contrib/gitian-descriptors/gitian-linux.yml | 2 +- contrib/gitian-descriptors/gitian-osx.yml | 2 +- contrib/gitian-descriptors/gitian-win.yml | 2 +- contrib/sprledgerxfr/treasury.asc | 39 ----- contrib/sprledgerxfr/utxo.py | 159 ------------------ src/kernel.cpp | 4 +- src/main.cpp | 15 +- src/masternode-budget.cpp | 2 - 11 files changed, 10 insertions(+), 221 deletions(-) delete mode 100644 contrib/sprledgerxfr/treasury.asc delete mode 100755 contrib/sprledgerxfr/utxo.py diff --git a/configure.ac b/configure.ac index 943fa814c..a801ab7df 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 14) -define(_CLIENT_VERSION_REVISION, 7) +define(_CLIENT_VERSION_REVISION, 8) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) diff --git a/contrib/devtools/check-doc.py b/contrib/devtools/check-doc.py index c3a7e050f..1245ee13a 100755 --- a/contrib/devtools/check-doc.py +++ b/contrib/devtools/check-doc.py @@ -20,7 +20,7 @@ REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"') REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")') # list unsupported, deprecated and duplicate args as they need no documentation -SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize', '-sendfreetransactions', '-checklevel', '-liquidityprovider', '-anonymizeheliumamount']) +SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize', '-sendfreetransactions', '-checklevel', '-liquidityprovider']) def main(): used = check_output(CMD_GREP_ARGS, shell=True) diff --git a/contrib/gitian-descriptors/gitian-aarch64.yml b/contrib/gitian-descriptors/gitian-aarch64.yml index 51a23eb4b..fd9ef6761 100644 --- a/contrib/gitian-descriptors/gitian-aarch64.yml +++ b/contrib/gitian-descriptors/gitian-aarch64.yml @@ -1,5 +1,5 @@ --- -name: "helium-aarch64-0.14.7.1" +name: "helium-aarch64-0.14.8" enable_cache: true suites: - "xenial" diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 57b89bccc..9caeb7eb8 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "helium-linux-0.14.7.1" +name: "helium-linux-0.14.8" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index 776d0c395..f4fa2afdd 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -1,5 +1,5 @@ --- -name: "helium-osx-0.14.7.1" +name: "helium-osx-0.14.8" enable_cache: true suites: - "trusty" diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index ea243e04b..7e83137fe 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -1,5 +1,5 @@ --- -name: "helium-win-0.14.7.1" +name: "helium-win-0.14.8" enable_cache: true suites: - "trusty" diff --git a/contrib/sprledgerxfr/treasury.asc b/contrib/sprledgerxfr/treasury.asc deleted file mode 100644 index e68bef8eb..000000000 --- a/contrib/sprledgerxfr/treasury.asc +++ /dev/null @@ -1,39 +0,0 @@ -Treasurer0: -{ - "private_key": "308201130201010420de8cb45410a8c591eb4ea0fd4d909a428287a882122df990683718f35b2cc4c6a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a14403420004e77c3c8b007cd24b4d8b44502dcbfaedc0a64855ac404701ae841cab711394bea9e375577fcfd77c982f773d9d8a6deeb1c03bd07dd545648af11e7bfcfb9209", - "U public_key": "04e77c3c8b007cd24b4d8b44502dcbfaedc0a64855ac404701ae841cab711394bea9e375577fcfd77c982f773d9d8a6deeb1c03bd07dd545648af11e7bfcfb9209", - "U wallet_address": "SP3sVbutfidsRyEKG2PvigVeNAp3QcV6Hi", - "U wallet_private_key": "7RyCRiZ4edSbnc1GGYPUGBo691WPa9T6PmKUWQomb9M2LeezjmE", - "C public_key": "03e77c3c8b007cd24b4d8b44502dcbfaedc0a64855ac404701ae841cab711394be", - "C wallet_address": "Sbe6m4y6wGhUo6FoS6Sab2PxnScXm8HQTf", - "C wallet_private_key": "VPD3S6QX75qzYHWAPbYBL2eRgMEidJJAoUcYQp5RohqNuFKH4KZx" -} - -Treasurer1: -{ - "private_key": "308201130201010420662186953fe8a022ac2a6030dc9b0c74812e006ed996d6cb730c0ee0cd7439a4a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a14403420004e71045a78ce6e802123e3d437180576701a56ec15c4bf23ae7ccaac0df25b7adadeb7cffee566843aa909de5613b91c782581f4ce6a0d9ad6bd45d0f5e6df5bc", - "U public_key": "04e71045a78ce6e802123e3d437180576701a56ec15c4bf23ae7ccaac0df25b7adadeb7cffee566843aa909de5613b91c782581f4ce6a0d9ad6bd45d0f5e6df5bc", - "U wallet_address": "SMhW76d1MJCrxTNmfMVoAFwHN2hPwYLngd", - "U wallet_private_key": "7R4AVbBviztu8iJcd6PvCUDdBMnZXuymGwEK5geUSq4PqQnoWVz", - "C public_key": "02e71045a78ce6e802123e3d437180576701a56ec15c4bf23ae7ccaac0df25b7ad", - "C wallet_address": "Sapor5rpxvaGQ4cW8dptj3zW94MxuAwW4P", - "C wallet_private_key": "VKAxuBuE8NY573JkEJp9od8igik6bSqYRLMkofzQ917ynVcVA3Qj" -} -Treasurer2: -{ - "private_key": "30820113020101042020f6737578fcfbab59ed12a3ef03fca909e5b72214d54a7ed6d72e93c887a385a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a1440342000400f1c377af2d592cad1d3e987d6b55a4f4461b9f247cc91fb6dbc932af076550996338720cb916b8fc273e5848da23a6f2166fb4a68a802eb5500f0ba065e1d9", - "U public_key": "0400f1c377af2d592cad1d3e987d6b55a4f4461b9f247cc91fb6dbc932af076550996338720cb916b8fc273e5848da23a6f2166fb4a68a802eb5500f0ba065e1d9", - "U wallet_address": "SbRHtusnJom45gix997D8qL4hm7tMgUiPn", - "U wallet_private_key": "7QXhgb4bSuUZ8o7P2d9vKSFKRVSK8sxQus8bTpW2RCxXYiVjvRm", - "C public_key": "0300f1c377af2d592cad1d3e987d6b55a4f4461b9f247cc91fb6dbc932af076550", - "C wallet_address": "SeYn7AmvjB3Wr3QqdJK6UsW85dPKeEKmSg", - "C wallet_private_key": "VGrWZjLs3LccqQXAEAaNLNSCK6Wj3muaYLGX7Nf7Fqn5ptJKYtfk" -} - - - -createmultisig 2 "[\"03e77c3c8b007cd24b4d8b44502dcbfaedc0a64855ac404701ae841cab711394be\", \"02e71045a78ce6e802123e3d437180576701a56ec15c4bf23ae7ccaac0df25b7ad\", \"0300f1c377af2d592cad1d3e987d6b55a4f4461b9f247cc91fb6dbc932af076550\"]" -{ - "address": "34P4rrEHPBNRT8XxFDi3CShWeHz9V5D7YZ", - "redeemScript": "522103e77c3c8b007cd24b4d8b44502dcbfaedc0a64855ac404701ae841cab711394be2102e71045a78ce6e802123e3d437180576701a56ec15c4bf23ae7ccaac0df25b7ad210300f1c377af2d592cad1d3e987d6b55a4f4461b9f247cc91fb6dbc932af07655053ae" -} diff --git a/contrib/sprledgerxfr/utxo.py b/contrib/sprledgerxfr/utxo.py deleted file mode 100755 index 3c688496d..000000000 --- a/contrib/sprledgerxfr/utxo.py +++ /dev/null @@ -1,159 +0,0 @@ -#! /usr/bin/env python3 -import unittest -import os -from datetime import datetime, timedelta, tzinfo -import json -import re -# import sqlite3 -import psycopg2 -import requests -import time - -ecoin = dict( - name="Spreadcoin", - symbol="SPR", - url="http://spreadcoin.info", - ispos=True, - scheme=["proof-of-work", "proof-of-stake"], - nethashcmd="getnetworkhps", - rpchost="127.0.0.1", - rpcuser="spreadcoinuser", - rpcpassword="letmein", - nbpp=20, - endpoint="http://localhost:0000", - dataset="sprchain", - mainburnaddress="", - testburnaddress="", - donationaddresses = ["address-1-here"], - port=41677, - rpcport=41678, - testnetrpcuser="spreadcoinuser", - testnetrpcpassword="letmein", - testnetdataset="sprtchain", - testnetport=51677, - testnetrpcport=51678, - strftimeformat="%%H:%%M:%%S %%d-%%m-%%Y", - blockdateformat="formatted", - txdateformat="%%Y-%%m-%%d %%H:%%M:%%S UTC" -) - -global blockhash -debug = False -test = False - -MAX_BLOCK_HEIGHT = 1657200 # The block number marking the end of the public ledger, -1 for “latest block” -# MAX_BLOCK_HEIGHT = 1000 - - -class RPCHost(object): - def __init__(self, url): - self._session = requests.Session() - self._url = url - self._headers = {'content-type': 'application/json'} - - def call(self, rpcMethod, *params): - payload = json.dumps({"method": rpcMethod, "params": list(params), "jsonrpc": "2.0"}) - tries = 10 - hadConnectionFailures = False - while True: - # print("{url} {headers} {data}".format(url=self._url, headers=self._headers, data=payload)) - try: - response = self._session.get(self._url, headers=self._headers, data=payload) - except requests.exceptions.ConnectionError: - tries -= 1 - if tries == 0: - raise Exception('Failed to connect for remote procedure call.') - hadConnectionFailures = True - print("Couldn't connect for remote procedure call, will sleep for ten seconds and then try again ({} more tries)".format(tries)) - time.sleep(10) - else: - if hadConnectionFailures: - print('Connected for remote procedure call after retry.') - break - if response.status_code not in (200, 500): - raise Exception('RPC connection failure: ' + str(response.status_code) + ' ' + response.reason) - responseJSON = response.json() - if 'error' in responseJSON and responseJSON['error'] is not None: - raise Exception('Error in RPC call: ' + str(responseJSON['error'])) - return responseJSON['result'] - - -class TestCatchUp(unittest.TestCase): - - def setUp(self): - self.ecoin = ecoin - self.serverurl = 'http://{}:{}@localhost:{}/'.format( - self.ecoin.get('rpcuser'), self.ecoin.get('rpcpassword'), self.ecoin.get('rpcport')) - self.amerpc = RPCHost(self.serverurl) - - - - # self.conn = sqlite3.connect('utxo.db') - # self.cursor = self.conn.cursor() - - # Connect to an existing database - self.conn = psycopg2.connect("dbname=sprutxo user=gjh password=9h1991n5") - - # Open a cursor to perform database operations - self.cursor = self.conn.cursor() - - - # Create table - self.cursor.execute('''CREATE TABLE IF NOT EXISTS outputs ( - bnum integer, spent boolean default false, - tx text, bhsh text, - txhsh text, seq integer, - addr text, bal numeric)''') - self.cursor.execute('''CREATE INDEX IF NOT EXISTS txhsh_index ON outputs USING HASH (txhsh);''') - self.conn.commit() - - def tearDown(self): - # self.cursor.execute('''DROP TABLE IF EXISTS outputs;''') - self.conn.commit() - self.conn.close() - - # @unittest.skip("Passed, skipping") - def test_doreadblock(self): - binfo = self.amerpc.call('getinfo') - self.cursor.execute('''select max(bnum) from outputs''') - last_block_in_db = self.cursor.fetchone()[0] or 0 - blocknum = binfo['blocks'] if MAX_BLOCK_HEIGHT is None else MAX_BLOCK_HEIGHT - if last_block_in_db < blocknum: - print("Catching up from {} to {}".format(last_block_in_db, blocknum)) - for i in range(last_block_in_db + 1, blocknum + 1): - block = self.amerpc.call('getblock', self.amerpc.call('getblockhash', i)) - # FOR EACH TX - for txid in block.get('tx'): - tx = self.amerpc.call('decoderawtransaction', self.amerpc.call('getrawtransaction', txid)) - # SPENT TXS, REMOVE FROM UTXO SET - for txin in tx.get('vin'): - if "coinbase" not in txin.keys(): - query = """update outputs set spent = true where txhsh='{}' and seq={};""".format( - txin["txid"], txin["vout"]) - self.cursor.execute(query) - # UNSPENT TXS, ADD TO UTXO SET - for txout in tx.get('vout'): - scripttype = txout["scriptPubKey"]["type"] - if scripttype in ["pubkeyhash", "pubkey", "scripthash"]: - query = "insert into outputs (bnum, tx, bhsh, txhsh, seq, addr, bal) " + \ - "values ({}, '{}', '{}', '{}', {}, '{}', {});".format( - i, scripttype, block["hash"], txid, txout["n"], - txout["scriptPubKey"]["addresses"][0], - txout["value"]) - self.cursor.execute(query) - elif scripttype in ["nonstandard", "multisig"]: - query = "insert into outputs (bnum, tx, bhsh, txhsh, seq, addr, bal) " + \ - "values ({}, '{}', '{}', '{}', {}, '** {} **', {});".format( - i, scripttype, block["hash"], txid, txout["n"], - scripttype, txout["value"]) - self.cursor.execute(query) - else: - raise Exception( - "Don't know how to handle {} scripts in transaction {}".format( - scripttype, txid)) - if i % 10000 == 0: - print(i) - self.conn.commit() - -if __name__ == "__main__": - unittest.main() diff --git a/src/kernel.cpp b/src/kernel.cpp index 6bac1c127..00cf35688 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -83,8 +83,8 @@ static bool SelectBlockFromCandidates( uint64_t nStakeModifierPrev, const CBlockIndex** pindexSelected) { - bool fModifierV2 = false; - bool fFirstRun = true; + bool fModifierV2 = true; + bool fFirstRun = false; bool fSelected = false; uint256 hashBest = 0; *pindexSelected = (const CBlockIndex*)0; diff --git a/src/main.cpp b/src/main.cpp index 0d6284842..840bba7a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2096,24 +2096,13 @@ int64_t GetMasternodePayment(int nHeight, int64_t blockValue, int nMasternodeCou } } - /* Note: GJH Temporary hack to investigate initial PoW period */ - // NH - commented out // - //if (nHeight <= 10000) - // ret = 0; - - /* FIXME: GJH Particularise masternode payment schedule */ + /* NOTE: GJH Particularise masternode payment schedule */ if (nHeight <= 43200) { ret = 0; } else if (nHeight > 43200) { ret = blockValue / (100 / 30); -// } else if (nHeight < (Params().NetworkID() == CBaseChainParams::TESTNET ? 145000 : 151200) && nHeight >= 86400) { -// ret = 50 * COIN; -// } else if (nHeight <= Params().LAST_POW_BLOCK() && nHeight >= 151200) { -// ret = blockValue / 2; -// } else if (nHeight < Params().Zerocoin_Block_V2_Start()) { -// return GetSeeSaw(blockValue, nMasternodeCount, nHeight); } else { - //When zPIV is staked, masternode only gets 2 PIV + //When zPIV is staked, masternode only gets 2 HLM ret = 3 * COIN; if (isZPIVStake) ret = 2 * COIN; diff --git a/src/masternode-budget.cpp b/src/masternode-budget.cpp index e8f0e8998..b9ffcc59d 100644 --- a/src/masternode-budget.cpp +++ b/src/masternode-budget.cpp @@ -925,8 +925,6 @@ CAmount CBudgetManager::GetTotalBudget(int nHeight) nSubsidy = 0; } else if (nHeight > 43200) { nSubsidy = 5 * COIN; -// } else if (nHeight >= Params().Zerocoin_Block_V2_Start()) { -// nSubsidy = 4.5 * COIN; } else { nSubsidy = 5 * COIN; }