added non-enforcement masternode payments

This commit is contained in:
Evan Duffield 2014-06-25 08:43:16 -07:00
parent a950f31002
commit df7734b684
2 changed files with 52 additions and 36 deletions

View File

@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_MINOR 9
#define CLIENT_VERSION_REVISION 11 #define CLIENT_VERSION_REVISION 11
#define CLIENT_VERSION_BUILD 2 #define CLIENT_VERSION_BUILD 3
// Set to true for release, false for prerelease or test build // Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true #define CLIENT_VERSION_IS_RELEASE true

View File

@ -1813,7 +1813,7 @@ uint256 CBlockHeader::GetSpecialHash() const
{ {
// calculate additional masternode vote info to include in hash // calculate additional masternode vote info to include in hash
uint256 hash = 0; uint256 hash = 0;
uint256 vmnAdditional; uint256 vmnAdditional = 0;
//printf("------------------------------------------------\n"); //printf("------------------------------------------------\n");
if( (fTestNet && nTime > START_MASTERNODE_PAYMENTS_TESTNET) || (!fTestNet && nTime > START_MASTERNODE_PAYMENTS)) { if( (fTestNet && nTime > START_MASTERNODE_PAYMENTS_TESTNET) || (!fTestNet && nTime > START_MASTERNODE_PAYMENTS)) {
@ -5175,6 +5175,21 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
CBlockIndex* pindexPrev = pindexBest; CBlockIndex* pindexPrev = pindexBest;
if(bMasterNodePayment) { if(bMasterNodePayment) {
if(!pblock->MasterNodePaymentsEnforcing()){
int winningNode = darkSendPool.GetCurrentMasterNode(1);
if(winningNode >= 0){
pblock->payee.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
payments++;
txNew.vout.resize(payments);
//txNew.vout[0].scriptPubKey = scriptPubKeyIn;
txNew.vout[payments-1].scriptPubKey.SetDestination(darkSendMasterNodes[winningNode].pubkey.GetID());
txNew.vout[payments-1].nValue = 0;
printf("Masternode payment to %s\n", txNew.vout[payments-1].scriptPubKey.ToString().c_str());
}
} else {
CBlock blockLast; CBlock blockLast;
if(blockLast.ReadFromDisk(pindexPrev)){ if(blockLast.ReadFromDisk(pindexPrev)){
BOOST_FOREACH(CMasterNodeVote& mv1, blockLast.vmn){ BOOST_FOREACH(CMasterNodeVote& mv1, blockLast.vmn){
@ -5193,7 +5208,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
if (((pindexPrev->nHeight+1) - mv1.GetHeight()) >= MASTERNODE_PAYMENTS_EXPIRATION) { if (((pindexPrev->nHeight+1) - mv1.GetHeight()) >= MASTERNODE_PAYMENTS_EXPIRATION) {
// do nothing // do nothing
} else if(mv1.GetVotes() >= MASTERNODE_PAYMENTS_MIN_VOTES && payments <= MASTERNODE_PAYMENTS_MAX) { } else if( (mv1.GetVotes() >= MASTERNODE_PAYMENTS_MIN_VOTES && pblock->MasterNodePaymentsEnforcing()) && payments <= MASTERNODE_PAYMENTS_MAX) {
pblock->payee = mv1.GetPubKey(); pblock->payee = mv1.GetPubKey();
payments++; payments++;
@ -5217,6 +5232,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
pblock->vmn.push_back(mv); pblock->vmn.push_back(mv);
} }
} }
}
// Add our coinbase tx as first transaction // Add our coinbase tx as first transaction
pblock->vtx.push_back(txNew); pblock->vtx.push_back(txNew);