Skip to content

Commit

Permalink
UPDATE 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Master-Win committed Oct 23, 2020
1 parent 46771ff commit e5f937a
Show file tree
Hide file tree
Showing 23 changed files with 150 additions and 53 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,23 @@ Here is the list:
<tr><td>Level 5</td><td>100.000</td><td>Masternode Collateral</td></tr>
</table>

### NEW Masternode Collateral TiersNode
starts from block 450000
Here is the list:
<table>
<tr><td>Level 1</td><td>15.000</td><td>Masternode Collateral</td></tr>
<tr><td>Level 2</td><td>30.000</td><td>Masternode Collateral</td></tr>
<tr><td>Level 3</td><td>60.000</td><td>Masternode Collateral</td></tr>
<tr><td>Level 4</td><td>100.000</td><td>Masternode Collateral</td></tr>
<tr><td>Level 5</td><td>150.000</td><td>Masternode Collateral</td></tr>
</table>

### Block Rewards

<table>
<tr><td>1</td><td>350000-420000</td><td>2.6</td></tr>
<tr><td>2</td><td>420000-500000</td><td>7.6</td></tr>
<tr><td>3</td><td>500000-45434791</td><td>13.5</td></tr>
<tr><td>2</td><td>420000-450000</td><td>7.6</td></tr>
<tr><td>2</td><td>450000-500000</td><td>6.6</td></tr>
<tr><td>2</td><td>500000-750000</td><td>5.6</td></tr>
<tr><td>3</td><td>750000-45434791</td><td>4.6</td></tr>
</table>
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2020)
Expand Down
12 changes: 7 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ 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("0x0000036c78e3d52adc852a690c253a04b60e23b14119076815a2e533ad9c108e"));
(0, uint256("0x0000036c78e3d52adc852a690c253a04b60e23b14119076815a2e533ad9c108e"))
(438420, uint256("a689d6da0612c100eea0d79a5ee63ebe2c249d3baf767c070abbec082fee58fa"));
static const Checkpoints::CCheckpointData data = {
&mapCheckpoints,
1576775767, // * UNIX timestamp of last checkpoint block
0, // * total number of transactions between genesis and last checkpoint
1603489390, // * UNIX timestamp of last checkpoint block
1052378, // * 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
};
Expand Down Expand Up @@ -174,6 +175,7 @@ class CMainParams : public CChainParams

vSeeds.push_back(CDNSSeedData("1", "seed1.masterwin.online"));
vSeeds.push_back(CDNSSeedData("2", "seed2.masterwin.online"));
vSeeds.push_back(CDNSSeedData("3", "45.143.138.70"));

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,50); // Start with 'M'
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(3, 17);
Expand All @@ -184,7 +186,7 @@ class CMainParams : public CChainParams

convertSeed6(vFixedSeeds, pnSeed6_main, ARRAYLEN(pnSeed6_main));

fMiningRequiresPeers = true;
fMiningRequiresPeers = false;
fAllowMinDifficultyBlocks = false;
fDefaultConsistencyChecks = false;
fRequireStandard = true;
Expand Down Expand Up @@ -237,7 +239,7 @@ class CMainParams : public CChainParams
});

vMasternodeTiers.push_back ({
500000,
450000,
{
{15000 * COIN, 4 },
{30000 * COIN, 8 },
Expand Down
24 changes: 15 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,11 +1970,17 @@ int64_t GetBlockValue(int nHeight)
else if (nHeight <= 420000 && nHeight > 350000) {
nSubsidy = 2.6 * COIN;
}
else if (nHeight <= 500000 && nHeight > 420000) {
else if (nHeight <= 450000 && nHeight > 420000) {
nSubsidy = 7.6 * COIN;
}
else if (nHeight <= 45434791 && nHeight > 500000) {
nSubsidy = 13.5 * COIN;
else if (nHeight <= 500000 && nHeight > 450000) {
nSubsidy = 6.6 * COIN;
}
else if (nHeight <= 750000 && nHeight > 500000) {
nSubsidy = 5.6 * COIN;
}
else if (nHeight <= 45434791 && nHeight > 750000) {
nSubsidy = 4.6 * COIN;
}
else {
nSubsidy = 0 * COIN;
Expand Down Expand Up @@ -6571,14 +6577,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// it was the one which was commented out
int ActiveProtocol()
{
// SPORK_14 was used for 70918 (v2.0.0+)
// if (IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT))
// return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;

// SPORK_15 is used for 70919 (v3.0.0+)
if (IsSporkActive (SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2))
// SPORK_14 was used for 70920 (v3.1.0+)
if (IsSporkActive (SPORK_14_NEW_PROTOCOL_ENFORCEMENT))
return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;

// SPORK_15 is used for 70919 (v3.0.1+)
// if (IsSporkActive (SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2))
// return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;

return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT;
}

Expand Down
83 changes: 62 additions & 21 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
if (pfrom->nVersion < ActiveProtocol()) return;

if (winner.GetTier () == 0) {
LogPrintf ("CMasternodePayments::ProcessMessageMasternodePayments() : mnw - Could not find tier of masternode \n");
LogPrint ("mnpayments", "CMasternodePayments::ProcessMessageMasternodePayments() : mnw - Could not find tier of masternode \n");

if (masternodeSync.IsSynced ())
Misbehaving (pfrom->GetId (), 20);
Expand All @@ -383,6 +383,20 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st

return;
}

unsigned int payeeTier = winner.GetPayeeTier ();

if (payeeTier == 0) {
LogPrint ("mnpayments", "CMasternodePayments::ProcessMessageMasternodePayments() : mnw - Could not find tier of payee %s\n", winner.GetPayeeScript ().ToAddressString ());

// if (masternodeSync.IsSynced ())
// Misbehaving (pfrom->GetId (), 20);

if (ActiveProtocol () >= MIN_PEER_PROTO_VERSION_MNW_VIN)
mnodeman.AskForMN (pfrom, winner.vinPayee);

return;
}

int nHeight;
{
Expand All @@ -401,7 +415,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
return;
}

int nFirstBlock = nHeight - int (mnodeman.CountEnabledOnLevel (winner.GetTier ()) * 1.25);
int nFirstBlock = nHeight - int (mnodeman.CountEnabledOnLevel (payeeTier) * 1.25);

if (winner.nBlockHeight < nFirstBlock || winner.nBlockHeight > nHeight + 20) {
LogPrint("mnpayments", "mnw - winner out of range - FirstBlock %d Height %d bestHeight %d\n", nFirstBlock, winner.nBlockHeight, nHeight);
Expand All @@ -414,7 +428,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
return;
}

if (!masternodePayments.CanVote (winner.vinMasternode.prevout, winner.GetTier (), winner.nBlockHeight)) {
if (!masternodePayments.CanVote (winner)) {
// LogPrint("masternode","mnw - masternode already voted - %s\n", winner.vinMasternode.prevout.ToStringShort());
return;
}
Expand Down Expand Up @@ -445,12 +459,50 @@ unsigned int CMasternodePaymentWinner::GetTier () {
return 0;
}

CScript CMasternodePaymentWinner::GetPayeeScript () {
if (ActiveProtocol () < MIN_PEER_PROTO_VERSION_MNW_VIN) {
if (payee == CScript ())
LogPrint ("mnpayments", "CMasternodePaymentWinner::GetPayeeScript() : returning empty CScript\n");

return payee;
}

CMasternode* pmn = mnodeman.Find (vinPayee);

if (pmn != NULL)
return GetScriptForDestination (pmn->pubKeyCollateralAddress.GetID ());

CTransaction prevTx;
uint256 hashBlock = 0;

if (GetTransaction (vinPayee.prevout.hash, prevTx, hashBlock, true))
return prevTx.vout [vinPayee.prevout.n].scriptPubKey;

LogPrint ("mnpayments", "CMasternodePaymentWinner::GetPayeeScript() : Failed to get payee's CScript\n");

return CScript ();
}

unsigned int CMasternodePaymentWinner::GetPayeeTier () {
CMasternode* pmn;

if (ActiveProtocol () < MIN_PEER_PROTO_VERSION_MNW_VIN)
pmn = mnodeman.Find (payee); // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
else
pmn = mnodeman.Find (vinPayee);

if (pmn)
return pmn->GetTier (nBlockHeight);

return 0;
}

bool CMasternodePaymentWinner::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode)
{
std::string errorMessage;
std::string strMasterNodeSignMessage;

std::string strMessage = vinMasternode.prevout.ToStringShort() + std::to_string(nBlockHeight) + payee.ToString();
std::string strMessage = vinMasternode.prevout.ToStringShort () + std::to_string (nBlockHeight) + GetPayeeScript ().ToString ();

if (!obfuScationSigner.SignMessage(strMessage, errorMessage, vchSig, keyMasternode)) {
LogPrint("masternode","CMasternodePing::Sign() - Error: %s\n", errorMessage.c_str());
Expand Down Expand Up @@ -572,7 +624,7 @@ bool CMasternodePayments::AddWinningMasternode(CMasternodePaymentWinner& winnerI
}
}

mapMasternodeBlocks [winnerIn.nBlockHeight].AddPayee (winnerIn.payee, winnerIn.GetTier (), 1);
mapMasternodeBlocks [winnerIn.nBlockHeight].AddPayee (winnerIn.GetPayeeScript (), winnerIn.GetPayeeTier (), 1);

return true;
}
Expand Down Expand Up @@ -801,14 +853,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
return false;
}

CMasternode* pmn = mnodeman.Find (activeMasternode.vin);

if (pmn == NULL)
return false;

unsigned int masternodeTier = pmn->GetTier ();

{
for (unsigned int masternodeTier = 1; masternodeTier <= Params ().getMasternodeTierCount (nBlockHeight + 1); masternodeTier++) {
// Create a new winner for this level
CMasternodePaymentWinner newWinner (activeMasternode.vin);

Expand All @@ -819,18 +864,14 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight)
if (pmn == NULL) {
LogPrint ("masternode", "CMasternodePayments::ProcessBlock() Failed to find masternode to pay\n");

return false;
continue;
}

LogPrint ("masternode", "CMasternodePayments::ProcessBlock() Found by FindOldestNotInVec\n");

newWinner.nBlockHeight = nBlockHeight;

CScript payee = GetScriptForDestination (pmn->pubKeyCollateralAddress.GetID());
newWinner.AddPayee (payee);
newWinner.AddPayee (pmn->vin);

CTxDestination address1;
ExtractDestination (payee, address1);
ExtractDestination (newWinner.GetPayeeScript (), address1);
CBitcoinAddress address2 (address1);

LogPrint ("masternode", "CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d level %d. \n", address2.ToString ().c_str (), newWinner.nBlockHeight, masternodeTier);
Expand Down Expand Up @@ -859,7 +900,7 @@ bool CMasternodePaymentWinner::SignatureValid()
CMasternode* pmn = mnodeman.Find(vinMasternode);

if (pmn != NULL) {
std::string strMessage = vinMasternode.prevout.ToStringShort() + std::to_string(nBlockHeight) + payee.ToString();
std::string strMessage = vinMasternode.prevout.ToStringShort () + std::to_string (nBlockHeight) + GetPayeeScript ().ToString ();

std::string errorMessage = "";
if (!obfuScationSigner.VerifyMessage(pmn->pubKeyMasternode, vchSig, strMessage, errorMessage)) {
Expand Down
40 changes: 30 additions & 10 deletions src/masternode-payments.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,41 +215,52 @@ class CMasternodePaymentWinner
CTxIn vinMasternode;

int nBlockHeight;
CScript payee;
CScript payee; // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
CTxIn vinPayee;
std::vector<unsigned char> vchSig;

CMasternodePaymentWinner()
{
nBlockHeight = 0;
vinMasternode = CTxIn();
payee = CScript();
payee = CScript(); // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
vinPayee = CTxIn ();
}

CMasternodePaymentWinner(CTxIn vinIn)
{
nBlockHeight = 0;
vinMasternode = vinIn;
payee = CScript();
payee = CScript(); // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
vinPayee = CTxIn ();
}

uint256 GetHash()
{
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
ss << payee;

if (ActiveProtocol () < MIN_PEER_PROTO_VERSION_MNW_VIN)
ss << payee; // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
else
ss << vinPayee;

ss << nBlockHeight;
ss << vinMasternode.prevout;

return ss.GetHash();
}

unsigned int GetTier ();
CScript GetPayeeScript ();
unsigned int GetPayeeTier ();
bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode);
bool IsValid(CNode* pnode, std::string& strError);
bool SignatureValid();
void Relay();

void AddPayee (CScript payeeIn) {
payee = payeeIn;
void AddPayee (CTxIn vinPayeeIn) {
vinPayee = vinPayeeIn;
payee = GetPayeeScript (); // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
}


Expand All @@ -260,7 +271,12 @@ class CMasternodePaymentWinner
{
READWRITE(vinMasternode);
READWRITE(nBlockHeight);
READWRITE(payee);

if (nVersion < MIN_PEER_PROTO_VERSION_MNW_VIN)
READWRITE (payee); // REMOVE when MIN_VERSION is at least MIN_PEER_PROTO_VERSION_MNW_VIN
else
READWRITE (vinPayee);

READWRITE(vchSig);
}

Expand All @@ -269,7 +285,7 @@ class CMasternodePaymentWinner
std::string ret = "";
ret += vinMasternode.ToString();
ret += ", " + boost::lexical_cast<std::string>(nBlockHeight);
ret += ", " + payee.ToString() + "@" + boost::lexical_cast<std::string>(GetTier ());
ret += ", " + GetPayeeScript ().ToString () + "@" + boost::lexical_cast<std::string>(GetPayeeTier ());
ret += ", " + boost::lexical_cast<std::string>((int)vchSig.size());
return ret;
}
Expand Down Expand Up @@ -332,10 +348,14 @@ class CMasternodePayments
return true;
}

bool CanVote (const COutPoint& outMasternode, unsigned int mnLevel, int nBlockHeight) {
bool CanVote (CMasternodePaymentWinner winner) {
unsigned int voteForTier = winner.GetPayeeTier ();
COutPoint outMasternode = winner.vinMasternode.prevout;
int nBlockHeight = winner.nBlockHeight;

LOCK (cs_mapMasternodePayeeVotes);

uint256 key = ((outMasternode.hash + outMasternode.n) << 4) + mnLevel;
uint256 key = ((outMasternode.hash + outMasternode.n) << 4) + voteForTier;

if (mapMasternodesLastVote.count (key)) {
if (mapMasternodesLastVote [key] == nBlockHeight)
Expand Down
2 changes: 2 additions & 0 deletions src/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
if (pindexLast->nHeight > Params().LAST_POW_BLOCK()) {
uint256 bnTargetLimit = (~uint256(0) >> 24);
int64_t nTargetSpacing = 60;
if (pindexLast->nHeight >= 450000)
nTargetSpacing = 1.5 * 60;
int64_t nTargetTimespan = 60 * 40;

int64_t nActualSpacing = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/res/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ padding-left: 15px;

QLabel#labelOverviewHeaderRight {
qproperty-alignment: 'AlignVCenter | AlignRight';
background-image: url(':/images/masterwin_logo_horizontal');
background-image: url(':/images/logo_horizontal');
background-repeat: no-repeat;
/* background-color:#0e0e0e; */
background-position: right center;
Expand Down
Binary file modified src/qt/res/icons/bitcoin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/icons/bitcoin_regtest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/icons/bitcoin_testnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/icons/merchant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/icons/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/masterwin_logo_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/splash_regtest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/splash_testnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/walletFrame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/qt/res/images/walletFrame_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e5f937a

Please sign in to comment.