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

Commit

Permalink
DigitalNote v1.0.3.2 Initial
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
CryptoCoderz committed Sep 25, 2020
1 parent 43e239d commit ce502c0
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 117 deletions.
16 changes: 8 additions & 8 deletions DigitalNote.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = DigitalNote-qt
VERSION = 1.0.3.1
VERSION = 1.0.3.2
INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor
QT += core gui widgets network printsupport
DEFINES += ENABLE_WALLET
Expand All @@ -17,9 +17,9 @@ greaterThan(QT_MAJOR_VERSION, 4) {
}

win32{
BOOST_LIB_SUFFIX=-mgw81-mt-s-x32-1_72
BOOST_INCLUDE_PATH=C:/deps/boost_1_72_0
BOOST_LIB_PATH=C:/deps/boost_1_72_0/stage/lib
BOOST_LIB_SUFFIX=-mgw8-mt-s-x32-1_74
BOOST_INCLUDE_PATH=C:/deps/boost_1_74_0
BOOST_LIB_PATH=C:/deps/boost_1_74_0/stage/lib
BDB_INCLUDE_PATH=C:/deps/db-6.2.32.NC/build_unix
BDB_LIB_PATH=C:/deps/db-6.2.32.NC/build_unix
OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.2u/include
Expand Down Expand Up @@ -544,12 +544,12 @@ isEmpty(BDB_INCLUDE_PATH) {
}

isEmpty(BOOST_LIB_PATH) {
macx:BOOST_LIB_PATH = /usr/local/Cellar/boost/1.73.0/lib
macx:BOOST_LIB_PATH = /usr/local/Cellar/boost@1.59/1.59.0/lib
windows:BOOST_LIB_PATH=C:/dev/coindeps32/boost_1_57_0/lib
}

isEmpty(BOOST_INCLUDE_PATH) {
macx:BOOST_INCLUDE_PATH = /usr/local/Cellar/boost/1.73.0/include
macx:BOOST_INCLUDE_PATH = /usr/local/Cellar/boost@1.59/1.59.0/include
windows:BOOST_INCLUDE_PATH=C:/dev/coindeps32/boost_1_57_0/include
}

Expand Down Expand Up @@ -578,12 +578,12 @@ isEmpty(MINIUPNPC_LIB_PATH) {
}

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

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

Expand Down
26 changes: 26 additions & 0 deletions src/blockparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "main.h"
#include "mnengine.h"
#include "masternodeman.h"
#include "masternode-payments.h"

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

//
// Masternode Select Payout Toggle
//
bool fMNselect(int nHeight)
{
// Try to get frist masternode in our list
CMasternode* winningNode = mnodeman.GetCurrentMasterNode(1);
// If initial sync or we can't find a masternode in our list
if(IsInitialBlockDownload() || !winningNode){
// Return false (for sanity, we have no masternode to pay)
LogPrintf("MasterNode Select Validation : Either still syncing or no masternodes found\n");
return false;
}
// Set TX values
CScript payee;
CTxIn vin;
//spork
if(masternodePayments.GetWinningMasternode(nHeight, payee, vin)){
LogPrintf("MasterNode Select Validation: SUCCEEDED\n");
return true;
}
return false;
}


//
// PoW coin base reward
//
Expand Down
1 change: 1 addition & 0 deletions src/blockparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void VRX_ThreadCurve(const CBlockIndex* pindexLast, bool fProofOfStake);
void VRX_Dry_Run(const CBlockIndex* pindexLast);
unsigned int VRX_Retarget(const CBlockIndex* pindexLast, bool fProofOfStake);
unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfStake);
extern bool fMNselect(int nHeight);
int64_t GetProofOfWorkReward(int nHeight, int64_t nFees);
int64_t GetProofOfStakeReward(const CBlockIndex* pindexPrev, int64_t nCoinAge, int64_t nFees);
int64_t GetMasternodePayment(int nHeight, int64_t blockValue);
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 3
#define CLIENT_VERSION_BUILD 1
#define CLIENT_VERSION_BUILD 2

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
29 changes: 15 additions & 14 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2546,7 +2546,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c

CScript payee;
CTxIn vin;
if(!masternodePayments.GetBlockPayee(pindexBest->nHeight+1, payee, vin) || payee == CScript()){
if(!masternodePayments.GetWinningMasternode(pindexBest->nHeight+1, payee, vin) || payee == CScript()){
foundPayee = true; //doesn't require a specific payee
foundPaymentAmount = true;
foundPaymentAndPayee = true;
Expand Down Expand Up @@ -2689,7 +2689,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
if (isProofOfStake) {
// Check for PoS masternode payment
if (i == nProofOfIndexMasternode) {
if (mnodeman.IsPayeeAValidMasternode(rawPayee)) {
if (mnodeman.IsPayeeAValidMasternode(rawPayee) && fMNselect(pindexBest->nHeight)) {
LogPrintf("CheckBlock() : PoS Recipient masternode address validity succesfully verified\n");
} else if (addressOut.ToString() == strVfyDevopsAddress) {
LogPrintf("CheckBlock() : PoS Recipient masternode address validity succesfully verified\n");
Expand Down Expand Up @@ -2748,7 +2748,7 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
else if (!isProofOfStake) {
// Check for PoW masternode payment
if (i == nProofOfIndexMasternode) {
if (mnodeman.IsPayeeAValidMasternode(rawPayee)) {
if (mnodeman.IsPayeeAValidMasternode(rawPayee) && fMNselect(pindexBest->nHeight)) {
LogPrintf("CheckBlock() : PoW Recipient masternode address validity succesfully verified\n");
} else if (addressOut.ToString() == strVfyDevopsAddress) {
LogPrintf("CheckBlock() : PoW Recipient masternode address validity succesfully verified\n");
Expand Down Expand Up @@ -3123,15 +3123,18 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
mapOrphanBlocksByPrev.erase(hashPrev);
}

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

CScript payee;
CTxIn vin;

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

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

mnEnginePool.CheckTimeout();
mnEnginePool.NewBlock();
masternodePayments.ProcessBlock(GetHeight()+10);

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

LogPrintf("ProcessBlock() : Update Masternode Last Paid Time - %d\n", pindexBest->nHeight);
}

masternodePayments.ProcessBlock(GetHeight()+10);
}

}

LogPrintf("ProcessBlock: ACCEPTED\n");
Expand Down Expand Up @@ -4416,10 +4415,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if (fSecMsgEnabled) {
SecureMsgReceiveData(pfrom, strCommand, vRecv);
}
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
ProcessMessageInstantX(pfrom, strCommand, vRecv);
ProcessSpork(pfrom, strCommand, vRecv);
if (pfrom->nVersion >= MIN_MASTERNODE_BSC_RELAY) {
mnodeman.ProcessMessage(pfrom, strCommand, vRecv);
ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
ProcessMessageInstantX(pfrom, strCommand, vRecv);
ProcessSpork(pfrom, strCommand, vRecv);
}
// Ignore unknown commands for extensibility
}

Expand Down
Loading

0 comments on commit ce502c0

Please sign in to comment.