Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Commit ce502c0

Browse files
committed
DigitalNote v1.0.3.2 Initial
Changelog - Added Staking on Masternode compatibility (Fixes staking a Masternode collateral input) - Fixed "unlock for staking only" issue in GUI - Masternode winner select and data relay overhaul (one of many to come)
1 parent 43e239d commit ce502c0

16 files changed

+206
-117
lines changed

DigitalNote.pro

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TEMPLATE = app
22
TARGET = DigitalNote-qt
3-
VERSION = 1.0.3.1
3+
VERSION = 1.0.3.2
44
INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor
55
QT += core gui widgets network printsupport
66
DEFINES += ENABLE_WALLET
@@ -17,9 +17,9 @@ greaterThan(QT_MAJOR_VERSION, 4) {
1717
}
1818

1919
win32{
20-
BOOST_LIB_SUFFIX=-mgw81-mt-s-x32-1_72
21-
BOOST_INCLUDE_PATH=C:/deps/boost_1_72_0
22-
BOOST_LIB_PATH=C:/deps/boost_1_72_0/stage/lib
20+
BOOST_LIB_SUFFIX=-mgw8-mt-s-x32-1_74
21+
BOOST_INCLUDE_PATH=C:/deps/boost_1_74_0
22+
BOOST_LIB_PATH=C:/deps/boost_1_74_0/stage/lib
2323
BDB_INCLUDE_PATH=C:/deps/db-6.2.32.NC/build_unix
2424
BDB_LIB_PATH=C:/deps/db-6.2.32.NC/build_unix
2525
OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.2u/include
@@ -544,12 +544,12 @@ isEmpty(BDB_INCLUDE_PATH) {
544544
}
545545

546546
isEmpty(BOOST_LIB_PATH) {
547-
macx:BOOST_LIB_PATH = /usr/local/Cellar/boost/1.73.0/lib
547+
macx:BOOST_LIB_PATH = /usr/local/Cellar/boost@1.59/1.59.0/lib
548548
windows:BOOST_LIB_PATH=C:/dev/coindeps32/boost_1_57_0/lib
549549
}
550550

551551
isEmpty(BOOST_INCLUDE_PATH) {
552-
macx:BOOST_INCLUDE_PATH = /usr/local/Cellar/boost/1.73.0/include
552+
macx:BOOST_INCLUDE_PATH = /usr/local/Cellar/boost@1.59/1.59.0/include
553553
windows:BOOST_INCLUDE_PATH=C:/dev/coindeps32/boost_1_57_0/include
554554
}
555555

@@ -578,12 +578,12 @@ isEmpty(MINIUPNPC_LIB_PATH) {
578578
}
579579

580580
isEmpty(OPENSSL_INCLUDE_PATH) {
581-
macx:OPENSSL_INCLUDE_PATH = /usr/local/Cellar/openssl@1.1/1.1.1g/include
581+
macx:OPENSSL_INCLUDE_PATH = /usr/local/Cellar/openssl/1.0.2t/include
582582
windows:OPENSSL_INCLUDE_PATH=C:/dev/coindeps32/openssl-1.0.1p/include
583583
}
584584

585585
isEmpty(OPENSSL_LIB_PATH) {
586-
macx:OPENSSL_LIB_PATH = /usr/local/Cellar/openssl@1.1/1.1.1g/lib
586+
macx:OPENSSL_LIB_PATH = /usr/local/Cellar/openssl/1.0.2t/lib
587587
windows:OPENSSL_LIB_PATH=C:/dev/coindeps32/openssl-1.0.1p/lib
588588
}
589589

src/blockparams.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "main.h"
1818
#include "mnengine.h"
1919
#include "masternodeman.h"
20+
#include "masternode-payments.h"
2021

2122
#include <boost/random/mersenne_twister.hpp>
2223
#include <boost/random/uniform_int_distribution.hpp>
@@ -477,6 +478,31 @@ unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfS
477478
// Idle Duration : 5 Intervals (no adjustment)
478479
//
479480

481+
//
482+
// Masternode Select Payout Toggle
483+
//
484+
bool fMNselect(int nHeight)
485+
{
486+
// Try to get frist masternode in our list
487+
CMasternode* winningNode = mnodeman.GetCurrentMasterNode(1);
488+
// If initial sync or we can't find a masternode in our list
489+
if(IsInitialBlockDownload() || !winningNode){
490+
// Return false (for sanity, we have no masternode to pay)
491+
LogPrintf("MasterNode Select Validation : Either still syncing or no masternodes found\n");
492+
return false;
493+
}
494+
// Set TX values
495+
CScript payee;
496+
CTxIn vin;
497+
//spork
498+
if(masternodePayments.GetWinningMasternode(nHeight, payee, vin)){
499+
LogPrintf("MasterNode Select Validation: SUCCEEDED\n");
500+
return true;
501+
}
502+
return false;
503+
}
504+
505+
480506
//
481507
// PoW coin base reward
482508
//

src/blockparams.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void VRX_ThreadCurve(const CBlockIndex* pindexLast, bool fProofOfStake);
4040
void VRX_Dry_Run(const CBlockIndex* pindexLast);
4141
unsigned int VRX_Retarget(const CBlockIndex* pindexLast, bool fProofOfStake);
4242
unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake);
43+
extern bool fMNselect(int nHeight);
4344
int64_t GetProofOfWorkReward(int nHeight, int64_t nFees);
4445
int64_t GetProofOfStakeReward(const CBlockIndex* pindexPrev, int64_t nCoinAge, int64_t nFees);
4546
int64_t GetMasternodePayment(int nHeight, int64_t blockValue);

src/clientversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define CLIENT_VERSION_MAJOR 1
1010
#define CLIENT_VERSION_MINOR 0
1111
#define CLIENT_VERSION_REVISION 3
12-
#define CLIENT_VERSION_BUILD 1
12+
#define CLIENT_VERSION_BUILD 2
1313

1414
// Set to true for release, false for prerelease or test build
1515
#define CLIENT_VERSION_IS_RELEASE true

src/main.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
25462546

25472547
CScript payee;
25482548
CTxIn vin;
2549-
if(!masternodePayments.GetBlockPayee(pindexBest->nHeight+1, payee, vin) || payee == CScript()){
2549+
if(!masternodePayments.GetWinningMasternode(pindexBest->nHeight+1, payee, vin) || payee == CScript()){
25502550
foundPayee = true; //doesn't require a specific payee
25512551
foundPaymentAmount = true;
25522552
foundPaymentAndPayee = true;
@@ -2689,7 +2689,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
26892689
if (isProofOfStake) {
26902690
// Check for PoS masternode payment
26912691
if (i == nProofOfIndexMasternode) {
2692-
if (mnodeman.IsPayeeAValidMasternode(rawPayee)) {
2692+
if (mnodeman.IsPayeeAValidMasternode(rawPayee) && fMNselect(pindexBest->nHeight)) {
26932693
LogPrintf("CheckBlock() : PoS Recipient masternode address validity succesfully verified\n");
26942694
} else if (addressOut.ToString() == strVfyDevopsAddress) {
26952695
LogPrintf("CheckBlock() : PoS Recipient masternode address validity succesfully verified\n");
@@ -2748,7 +2748,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
27482748
else if (!isProofOfStake) {
27492749
// Check for PoW masternode payment
27502750
if (i == nProofOfIndexMasternode) {
2751-
if (mnodeman.IsPayeeAValidMasternode(rawPayee)) {
2751+
if (mnodeman.IsPayeeAValidMasternode(rawPayee) && fMNselect(pindexBest->nHeight)) {
27522752
LogPrintf("CheckBlock() : PoW Recipient masternode address validity succesfully verified\n");
27532753
} else if (addressOut.ToString() == strVfyDevopsAddress) {
27542754
LogPrintf("CheckBlock() : PoW Recipient masternode address validity succesfully verified\n");
@@ -3123,15 +3123,18 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
31233123
mapOrphanBlocksByPrev.erase(hashPrev);
31243124
}
31253125

3126-
if(!IsInitialBlockDownload()){
3126+
// Try to get frist masternode in our list
3127+
CMasternode* winningNode = mnodeman.GetCurrentMasterNode(1);
3128+
// If initial sync or we can't find a masternode in our list
3129+
if(!IsInitialBlockDownload() || winningNode){
31273130

31283131
CScript payee;
31293132
CTxIn vin;
31303133

31313134
// If we're in LiteMode disable mnengine features without disabling masternodes
31323135
if (!fLiteMode && !fImporting && !fReindex && pindexBest->nHeight > Checkpoints::GetTotalBlocksEstimate()){
31333136

3134-
if(masternodePayments.GetBlockPayee(pindexBest->nHeight, payee, vin)){
3137+
if(masternodePayments.GetWinningMasternode(pindexBest->nHeight, payee, vin)){
31353138
//UPDATE MASTERNODE LAST PAID TIME
31363139
CMasternode* pmn = mnodeman.Find(vin);
31373140
if(pmn != NULL) {
@@ -3143,11 +3146,10 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
31433146

31443147
mnEnginePool.CheckTimeout();
31453148
mnEnginePool.NewBlock();
3146-
masternodePayments.ProcessBlock(GetHeight()+10);
31473149

31483150
} else if (fLiteMode && !fImporting && !fReindex && pindexBest->nHeight > Checkpoints::GetTotalBlocksEstimate())
31493151
{
3150-
if(masternodePayments.GetBlockPayee(pindexBest->nHeight, payee, vin)){
3152+
if(masternodePayments.GetWinningMasternode(pindexBest->nHeight, payee, vin)){
31513153
//UPDATE MASTERNODE LAST PAID TIME
31523154
CMasternode* pmn = mnodeman.Find(vin);
31533155
if(pmn != NULL) {
@@ -3156,10 +3158,7 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
31563158

31573159
LogPrintf("ProcessBlock() : Update Masternode Last Paid Time - %d\n", pindexBest->nHeight);
31583160
}
3159-
3160-
masternodePayments.ProcessBlock(GetHeight()+10);
31613161
}
3162-
31633162
}
31643163

31653164
LogPrintf("ProcessBlock: ACCEPTED\n");
@@ -4416,10 +4415,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
44164415
if (fSecMsgEnabled) {
44174416
SecureMsgReceiveData(pfrom, strCommand, vRecv);
44184417
}
4419-
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
4420-
ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
4421-
ProcessMessageInstantX(pfrom, strCommand, vRecv);
4422-
ProcessSpork(pfrom, strCommand, vRecv);
4418+
if (pfrom->nVersion >= MIN_MASTERNODE_BSC_RELAY) {
4419+
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
4420+
ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
4421+
ProcessMessageInstantX(pfrom, strCommand, vRecv);
4422+
ProcessSpork(pfrom, strCommand, vRecv);
4423+
}
44234424
// Ignore unknown commands for extensibility
44244425
}
44254426

0 commit comments

Comments
 (0)