Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from SuB1X-Coin/v1.3.0
Browse files Browse the repository at this point in the history
1.3.4 wallet release (REVIEW NEEDED)
  • Loading branch information
SuB1X-Coin committed May 3, 2018
2 parents 1d1617b + 902ec2a commit 79a9523
Show file tree
Hide file tree
Showing 11 changed files with 357 additions and 217 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -12,6 +12,7 @@ src/zsub1x-cli
src/zsub1x-tx
src/test/test_zsub1x
src/qt/test/test_zsub1x-qt
src/leveldb/build_config.mk

# autoreconf
Makefile.in
Expand Down Expand Up @@ -128,3 +129,5 @@ CMakeLists.txt
cmake-build-debug
config.log
config.status

background.tiff*
4 changes: 2 additions & 2 deletions configure.ac
@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_REVISION, 4)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2017)
Expand Down
62 changes: 35 additions & 27 deletions src/chainparams.cpp
Expand Up @@ -54,22 +54,31 @@ static void convertSeed6(std::vector<CAddress>& vSeedsOut, const SeedSpec6* data
// + Contains no strange transactions
static Checkpoints::MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
(0, uint256("0x00000a0177b7685aa71168550959d11f1c183b96fff0c0d87f92b2fca5ff1bea"));
( 0, uint256("00000a0177b7685aa71168550959d11f1c183b96fff0c0d87f92b2fca5ff1bea"))
( 20000, uint256("1de459751747179d9609b52d70074ccf904f0d82fc9be4bcd4b0bfa471d030fb"))
( 40000, uint256("f40bd1f4e6038f819d273c52ca78ace5b3cff10250e73024bb9d0f8bdc98388e"))
( 60000, uint256("46155616ae0999418d2731e01e336963e41925d60784cf089c16d5db7d1fc027"))
( 80000, uint256("293c0e58a08efb714401b960a23a2bfc063861133a0dc587efef0b3905ec6bf8"))
(101000, uint256("6c56cd86e52040a47698461be2d3d8a5929109a5a27b11ee8099c76b4cbcca4f"));

static const Checkpoints::CCheckpointData data = {
&mapCheckpoints,
1514540176, // * UNIX timestamp of last checkpoint block
0, // * total number of transactions between genesis and last checkpoint
1523438857, // * UNIX timestamp of last checkpoint block
207557, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
2000 // * estimated number of transactions per day after checkpoint
3000 // * estimated number of transactions per day after checkpoint
};

static Checkpoints::MapCheckpoints mapCheckpointsTestnet =
boost::assign::map_list_of(0, uint256("0x001"));
boost::assign::map_list_of
(0, uint256("f0953272d927ae99c6db109bfb40a2780db9158c8e9cfe319bacebfa725b3123"))
(10000, uint256("22da27e23ea78e9421bf601a3d5b7b3f7386e4a768da0278ca558cd960d9602a"))
(19999, uint256("d12a7e13706d004c884613e4837f061b073b963fc172075e7f2b60b5ec7bcb80"));
static const Checkpoints::CCheckpointData dataTestnet = {
&mapCheckpointsTestnet,
1740710,
0,
250};
1523644959,
39846,
3000};

static Checkpoints::MapCheckpoints mapCheckpointsRegtest =
boost::assign::map_list_of(0, uint256("0x001"));
Expand Down Expand Up @@ -160,11 +169,8 @@ class CMainParams : public CChainParams
assert(hashGenesisBlock == uint256("0x00000a0177b7685aa71168550959d11f1c183b96fff0c0d87f92b2fca5ff1bea"));
assert(genesis.hashMerkleRoot == uint256("0x15f6a85ff76e304d1114a26df10cd06c8c99e729b430a769294f62e1357f0297"));

//vSeeds.push_back(CDNSSeedData("1.1.1.1", "1.1.1.1")); // Primary DNS Seeder
vSeeds.push_back(CDNSSeedData("209.250.241.176", "209.250.241.176")); // Single node address
vSeeds.push_back(CDNSSeedData("209.250.243.131", "209.250.243.131")); // Single node address
vSeeds.push_back(CDNSSeedData("45.77.239.108", "45.77.239.108")); // Single node address
vSeeds.push_back(CDNSSeedData("107.191.44.102", "107.191.44.102")); // Single node address
vSeeds.push_back(CDNSSeedData("seeds.sub1x.org", "seeds.sub1x.org")); // Primary DNS Seeder
vSeeds.push_back(CDNSSeedData("sub1x.mnseeds.com", "sub1x.mnseeds.com")); // Additional DNS seeder, by mn.zone


base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 80);
Expand All @@ -188,7 +194,7 @@ class CMainParams : public CChainParams
fHeadersFirstSyncingActive = false;

nPoolMaxTransactions = 3;
strSporkKey = "0459eede7626441f7802af2736cb3a4aeb3e1f95070cde39d068a4f16525ee8fdd3c075f29f9e115aeb91952239194aa6ac19765574fed8a0d7f174f2b450e9630";
strSporkKey = "043a9030e0dd8e0f64469982581c305b083deb16823ee9a30d624f1bb7421ec78d5100c6fc2997ec2d28d2d6bcd3fc45f482f9ebe8d2aaf0a8cb4a98022f2afe89";
strObfuscationPoolDummyAddress = "ZJUq47KtCqh7X54cqcWVZ2R3SVEFAbKHye";
nStartMasternodePayments = 1516371317; //Wed, 25 Jun 2014 20:36:16 GMT

Expand Down Expand Up @@ -220,12 +226,14 @@ class CTestNetParams : public CMainParams
{
networkID = CBaseChainParams::TESTNET;
strNetworkID = "test";
pchMessageStart[0] = 0x43;
pchMessageStart[1] = 0x76;
pchMessageStart[2] = 0x65;
pchMessageStart[3] = 0xba;
vAlertPubKey = ParseHex("042292b1f401860eea99e1a8a103effbd7e1c013a59a1a3a0c91c9d1997a0bc6f338567278c11344802838c107055bf7c1641eaed61e879245c255a4f5be5746fc");
nDefaultPort = 51434;
pchMessageStart[0] = 0x04;
pchMessageStart[1] = 0x95;
pchMessageStart[2] = 0xfd;
pchMessageStart[3] = 0xcf;
// vAlertPubKey = ParseHex("042292b1f401860eea99e1a8a103effbd7e1c013a59a1a3a0c91c9d1997a0bc6f338567278c11344802838c107055bf7c1641eaed61e879245c255a4f5be5746fc");
vAlertPubKey = ParseHex("04b2bb481c5e01f5e134ca56c1eb9498ffed660238e09851e392f0222d26801637d0f9b0b75367227746f39ef2b5fc6538d570aaf8ea9fdd766f0f091ebd0e47f5");

nDefaultPort = 50005;
nEnforceBlockUpgradeMajority = 51;
nRejectBlockOutdatedMajority = 75;
nToCheckBlockUpgradeMajority = 100;
Expand All @@ -248,15 +256,13 @@ class CTestNetParams : public CMainParams
genesis.nTime = 1515616140;
genesis.nNonce = 79855;

hashGenesisBlock = genesis.GetHash();
hashGenesisBlock = genesis.GetHash();
//assert(hashGenesisBlock == uint256("0x000007cff63ef602a51bf074e384b3516f0dd202f14d52f7c8c9b1af9423ab2e"));

vFixedSeeds.clear();
vSeeds.clear();
vSeeds.push_back(CDNSSeedData("209.250.241.176", "209.250.241.176")); // Single node address
vSeeds.push_back(CDNSSeedData("209.250.243.131", "209.250.243.131")); // Single node address
vSeeds.push_back(CDNSSeedData("45.77.239.108", "45.77.239.108")); // Single node address

vSeeds.push_back(CDNSSeedData("seeds-testnet.sub1x.org", "seeds-testnet.sub1x.org")); // DNS seeds
vSeeds.push_back(CDNSSeedData("sub1x-testnet.mnseeds.com", "sub1x-testnet.mnseeds.com")); // DNS seeds by mn.zone

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 139); // Testnet zsub1x addresses start with 'x' or 'y'
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 19); // Testnet zsub1x script addresses start with '8' or '9'
Expand All @@ -279,7 +285,9 @@ class CTestNetParams : public CMainParams
fTestnetToBeDeprecatedFieldRPC = true;

nPoolMaxTransactions = 2;
strSporkKey = "04188441e39d99aa69068ee07d26980f459b84465bbd765c6ee15d1aec5b76b5aebb01b24be184a1d3a12af61276549d96cc9499d909f8afc183132837d18d643d";
// strSporkKey = "04188441e39d99aa69068ee07d26980f459b84465bbd765c6ee15d1aec5b76b5aebb01b24be184a1d3a12af61276549d96cc9499d909f8afc183132837d18d643d";
strSporkKey = "049094e5731ede8dbf41738dc752c76a31f82f6d37bff9a532cde91faa3965559a7e3e65078e216aac9f1e08c72966aa1e96b3d89a17b6786c654970c3291471a1";

strObfuscationPoolDummyAddress = "xp87cG8UEQgzs1Bk67Yk884C7pnQfAeo7q";
nStartMasternodePayments = 1420837558; //Fri, 09 Jan 2015 21:05:58 GMT
nBudget_Fee_Confirmations = 3; // Number of confirmations for the finalization fee. We have to make this very short
Expand Down Expand Up @@ -320,7 +328,7 @@ class CRegTestParams : public CTestNetParams
genesis.nNonce = 732084;

hashGenesisBlock = genesis.GetHash();
nDefaultPort = 51436;
nDefaultPort = 50006;
//assert(hashGenesisBlock == uint256("0x000008415bdca132b70cf161ecc548e5d0150fd6634a381ee2e99bb8bb77dbb3"));

vFixedSeeds.clear(); //! Testnet mode doesn't have any fixed seeds.
Expand Down
4 changes: 2 additions & 2 deletions src/clientversion.h
Expand Up @@ -16,8 +16,8 @@

//! These need to be macros, as clientversion.cpp's and zsub1x*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_MINOR 3
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_BUILD 0

//! Set to true for release, false for prerelease or test build
Expand Down
51 changes: 43 additions & 8 deletions src/masternode-budget.cpp
Expand Up @@ -16,6 +16,7 @@
#include "util.h"
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include "spork.h"

CBudgetManager budget;
CCriticalSection cs_budget;
Expand All @@ -28,11 +29,14 @@ int nSubmittedFinalBudget;

int GetBudgetPaymentCycleBlocks()
{
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// DON'T CHANGE THESE BUDGET PERIODS AFTER A PROPOSAL HAS BEEN PAID
// NEW WALLETS WON'T RECOGNIZE THE PAID BLOCK AND WILL FORK, UNLESS YOU DO IT BASED ON HEIGHT
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Amount of blocks in a months period of time (using 1 minutes per) = (60*24*30)
if (Params().NetworkID() == CBaseChainParams::MAIN) return 43200;
//for testing purposes

return 144; //ten times per day
return 480; // twice a day in testnet
}

bool IsBudgetCollateralValid(uint256 nTxCollateralHash, uint256 nExpectedHash, std::string& strError, int64_t& nTime, int& nConf)
Expand Down Expand Up @@ -832,13 +836,23 @@ std::string CBudgetManager::GetRequiredPaymentsString(int nBlockHeight)

CAmount CBudgetManager::GetTotalBudget(int nHeight)
{
if (chainActive.Tip() == NULL) return 0;
CAmount nSubsidy = 0;
CAmount totalBudget = 0;
if (chainActive.Tip() == NULL) return totalBudget;

nSubsidy = GetBlockValue(nHeight);
LogPrint("masternode","CBudgetManager::GetTotalBudget(%d): GetBlockValue(%d) returned %f COINs\n", nHeight, nHeight, nSubsidy / COIN);

// Define governance budget as 20% of the block value
totalBudget = ((nSubsidy / 100) * 20) * GetBudgetPaymentCycleBlocks();

if (Params().NetworkID() == CBaseChainParams::TESTNET) {
CAmount nSubsidy = 500 * COIN;
return ((nSubsidy / 100) * 10) * 146;
// Increase the budget in testnet 10x to make it more exciting
totalBudget = totalBudget * 10;
}
return 0;

LogPrint("masternode","CBudgetManager::GetTotalBudget(%d) returning %f COINs\n", nHeight, totalBudget / COIN);
return totalBudget;
}

void CBudgetManager::NewBlock()
Expand Down Expand Up @@ -1364,13 +1378,34 @@ CBudgetProposal::CBudgetProposal(const CBudgetProposal& other)
fValid = true;
}

unsigned long getVetoHash(const std::string& str)
{
unsigned long hash = 1;
for (size_t i = 0; i < str.size(); ++i)
hash = 13 * hash + (unsigned char)str[i];
return hash;
}

bool CBudgetProposal::IsValid(std::string& strError, bool fCheckCollateral)
{
if (GetNays() - GetYeas() > mnodeman.CountEnabled(ActiveProtocol()) / 10) {
strError = "Proposal " + strProposalName + ": Active removal";
return false;
}

CTxDestination address1;
ExtractDestination(address, address1);
CBitcoinAddress address2(address1);
// create a unique string for the proposal
std::string proposalStr = strProposalName +"/"+ strURL +"/"+ address2.ToString() +"/"+ std::to_string(nAmount) +"/"+ std::to_string(nBlockStart) +"/"+ std::to_string(nBlockEnd);
int vetoHash = getVetoHash(proposalStr) % 2000000000;

LogPrint("mnbudget", "CBudgetProposal::IsValid Proposal '%s' has VETO hash %d\n", proposalStr, vetoHash);
if (GetSporkValue(SPORK_12_PROPOSAL_VETO) == vetoHash) {
strError = "Proposal Veto";
return false;
}

if (nBlockStart < 0) {
strError = "Invalid Proposal";
return false;
Expand All @@ -1381,7 +1416,7 @@ bool CBudgetProposal::IsValid(std::string& strError, bool fCheckCollateral)
return false;
}

if (nAmount < 10 * COIN) {
if (nAmount < 0.04 * COIN) {
strError = "Proposal " + strProposalName + ": Invalid nAmount";
return false;
}
Expand Down Expand Up @@ -1419,7 +1454,7 @@ bool CBudgetProposal::IsValid(std::string& strError, bool fCheckCollateral)

//can only pay out 10% of the possible coins (min value of coins)
if (nAmount > budget.GetTotalBudget(nBlockStart)) {
strError = "Proposal " + strProposalName + ": Payment more than max";
strError = "Proposal " + strProposalName + ": Payment more than max (" + std::to_string(budget.GetTotalBudget(nBlockStart) / COIN) + ")";
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/masternode-budget.h
Expand Up @@ -31,8 +31,8 @@ class CTxBudgetPayment;
#define VOTE_YES 1
#define VOTE_NO 2

static const CAmount PROPOSAL_FEE_TX = (50 * COIN);
static const CAmount BUDGET_FEE_TX = (50 * COIN);
static const CAmount PROPOSAL_FEE_TX = (0.04 * COIN);
static const CAmount BUDGET_FEE_TX = (0.04 * COIN);
static const int64_t BUDGET_VOTE_UPDATE_MIN = 60 * 60;

extern std::vector<CBudgetProposalBroadcast> vecImmatureBudgetProposals;
Expand Down

0 comments on commit 79a9523

Please sign in to comment.