Skip to content

Commit 9033c57

Browse files
author
limxdev
committed
Merge branch 'master' of https://github.com/LIMXTEC/BitCore into 0.9.8.x
2 parents 173373c + 7613027 commit 9033c57

14 files changed

+44
-59
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 0)
44
define(_CLIENT_VERSION_MINOR, 90)
55
define(_CLIENT_VERSION_REVISION, 8)
6-
define(_CLIENT_VERSION_BUILD, 10)
6+
define(_CLIENT_VERSION_BUILD, 11)
77
define(_CLIENT_VERSION_IS_RELEASE, true)
88
define(_COPYRIGHT_YEAR, 2020)
99
define(_COPYRIGHT_HOLDERS,[The %s developers])

src/chainparams.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,9 @@ class CMainParams : public CChainParams {
215215
{ 200000, uint256S("0x65c89c662dbdad4aeeb4215076884be736a7512984741b353bbdef47478305e5")},
216216
{ 215000, uint256S("0x18accc496518e6f3008eeaab7e04123939d66eb7f8a02f2fcb3d69093c1df38c")},
217217
{ 356548, uint256S("0xf62b6c5645997d078d9cb130cfe96d64ec2c047bbceca3ae8ffc373eef80b866")},
218+
{ 550000, uint256S("0xa901848fe9d22814dbb3e0f62892d3bd7a1e70f6a48a459e68ebaf24ea5d5867")},
218219
}
219220
};
220-
// FXTC BEGIN
221-
consensus.nlastValidPowHashHeight = 999999999;
222-
// FXTC
223221

224222
chainTxData = ChainTxData{
225223
// BTX: data as of block 0x8da1c7f79018fac8acac69a57b2f8b5d2743af67976a4525fdedc8c85a3a1418 (height 410476).
@@ -364,9 +362,7 @@ class CTestNetParams : public CChainParams {
364362
{0, uint256S("0xe02c5d66e8edb49984eb743c798bca069466ce457b7febfa3c3a01b33353b7bc6")},
365363
}
366364
};
367-
// FXTC BEGIN
368-
consensus.nlastValidPowHashHeight = 99999999;;
369-
// FXTC
365+
370366

371367
chainTxData = ChainTxData{
372368
// BTX: data as of block 0x8da1c7f79018fac8acac69a57b2f8b5d2743af67976a4525fdedc8c85a3a1418 (height 410476).
@@ -482,9 +478,7 @@ class CRegTestParams : public CChainParams {
482478
{0, uint256S("0x604148281e5c4b7f2487e5d03cd60d8e6f69411d613f6448034508cea52e9574")},
483479
}
484480
};
485-
// FXTC BEGIN
486-
consensus.nlastValidPowHashHeight = 99999999;;
487-
// FXTC
481+
488482

489483
chainTxData = ChainTxData{
490484
0,

src/consensus/params.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ struct Params {
115115
int64_t DifficultyAdjustmentIntervalV2() const { return nPowTargetTimespanV2 / nPowTargetSpacing; }
116116
uint256 nMinimumChainWork;
117117
uint256 defaultAssumeValid;
118-
// FXTC BEGIN
119-
int nlastValidPowHashHeight;
120-
// FXTC EMD
121118
};
122119
} // namespace Consensus
123120

src/masternode-payments.cpp

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl
143143
// we can only check masternode payments
144144

145145
const Consensus::Params& consensusParams = Params().GetConsensus();
146-
146+
//We should leave that here until we start the Superblocksystem. The second stage is the Spork 8 only if Superblock are online - Chris 2020
147147
if(sporkManager.IsSporkActive(SPORK_22_MASTERNODE_PAYMENT_ENFORCEMENT))
148148
{
149149
LogPrintf("IsBlockPayeeValid SPORK_22 -- ERROR: Invalid masternode payment detected at height %d: %s\n", nBlockHeight, txNew->ToString());
@@ -311,9 +311,23 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int nBlockH
311311
}
312312

313313
int CMasternodePayments::GetMinMasternodePaymentsProto() {
314-
return sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)
315-
? MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2
316-
: MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
314+
if (DEFAULTMINPROTO < sporkManager.GetSporkValue(SPORK_BTX_18_MIN_PEER_PROTO_VERSION))
315+
{
316+
return sporkManager.GetSporkValue(SPORK_BTX_18_MIN_PEER_PROTO_VERSION);
317+
}
318+
else
319+
{
320+
return DEFAULTMINPROTO;
321+
}
322+
}
323+
324+
int CMasternodePayments::GetFactorEnforcement() {
325+
326+
if (FACTOR_ENFORCEMENT > sporkManager.GetSporkValue(SPORK_22_FACTOR_ENFORCEMENT)|| sporkManager.GetSporkValue(SPORK_22_FACTOR_ENFORCEMENT) > 200)
327+
{
328+
return FACTOR_ENFORCEMENT;
329+
}
330+
return sporkManager.GetSporkValue(SPORK_22_FACTOR_ENFORCEMENT);
317331
}
318332

319333
void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman)
@@ -683,14 +697,7 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s
683697
return false;
684698
}
685699

686-
int nMinRequiredProtocol;
687-
if(nBlockHeight >= nValidationHeight) {
688-
// new votes must comply SPORK_10_MASTERNODE_PAY_UPDATED_NODES rules
689-
nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto();
690-
} else {
691-
// allow non-updated masternodes for old blocks
692-
nMinRequiredProtocol = MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1;
693-
}
700+
int nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto();
694701

695702
if(mnInfo.nProtocolVersion < nMinRequiredProtocol) {
696703
strError = strprintf("Masternode protocol is too old: nProtocolVersion=%d, nMinRequiredProtocol=%d", mnInfo.nProtocolVersion, nMinRequiredProtocol);
@@ -710,13 +717,14 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s
710717
}
711718

712719
if(nRank > MNPAYMENTS_SIGNATURES_TOTAL) {
720+
int vCount = mnpayments.GetFactorEnforcement();
713721
// It's common to have masternodes mistakenly think they are in the top 10
714722
// We don't want to print all of these messages in normal mode, debug mode should print though
715723
strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, nRank);
716724
// Only ban for new mnw which is out of bounds, for old mnw MN list itself might be way too much off
717-
if(nRank > MNPAYMENTS_SIGNATURES_TOTAL*2 && nBlockHeight > nValidationHeight) {
725+
if(nRank > MNPAYMENTS_SIGNATURES_TOTAL * vCount && nBlockHeight > nValidationHeight) {
718726
LOCK(cs_main);
719-
strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL*2, nRank);
727+
strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL * vCount, nRank);
720728
LogPrintf("CMasternodePaymentVote::IsValid -- Error: %s\n", strError);
721729
Misbehaving(pnode->GetId(), 20);
722730
}

src/masternode-payments.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class CMasternodeBlockPayees;
1919

2020
static const int MNPAYMENTS_SIGNATURES_REQUIRED = 6;
2121
static const int MNPAYMENTS_SIGNATURES_TOTAL = 10;
22+
static const int DEFAULTMINPROTO = 79999;
23+
static const int FACTOR_ENFORCEMENT = 2;
2224

2325
//! minimum peer version that can receive and send masternode payment messages,
2426
// vote for masternode and be elected as a payment winner
2527
// V1 - Last protocol version before update
2628
// V2 - Newest protocol version
27-
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70206;
28-
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70208;
2929

3030
extern CCriticalSection cs_vecPayees;
3131
extern CCriticalSection cs_mapMasternodeBlocks;
@@ -210,6 +210,7 @@ class CMasternodePayments
210210
bool CanVote(COutPoint outMasternode, int nBlockHeight);
211211

212212
int GetMinMasternodePaymentsProto();
213+
int GetFactorEnforcement();
213214
void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman);
214215
std::string GetRequiredPaymentsString(int nBlockHeight);
215216
void FillBlockPayee(CMutableTransaction& txNew, int nBlockHeight, CAmount blockReward, CTxOut& txoutMasternodeRet);

src/masternode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class CMasternodePing
5959
nSentinelVersion = DEFAULT_SENTINEL_VERSION;
6060
return;
6161
}
62-
READWRITE(fSentinelIsCurrent);
63-
READWRITE(nSentinelVersion);
62+
//READWRITE(fSentinelIsCurrent);
63+
//READWRITE(nSentinelVersion);
6464
}
6565

6666
uint256 GetHash() const

src/masternodeman.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void CMasternodeMan::Check()
156156
LOCK2(cs_main, cs);
157157
// FXTC END
158158

159-
LogPrint(BCLog::MASTERNODE, "CMasternodeMan::Check -- nLastWatchdogVoteTime=%d, IsWatchdogActive()=%d\n", nLastWatchdogVoteTime, IsWatchdogActive());
159+
//LogPrint(BCLog::MASTERNODE, "CMasternodeMan::Check -- nLastWatchdogVoteTime=%d, IsWatchdogActive()=%d\n", nLastWatchdogVoteTime, IsWatchdogActive());
160160

161161
for (auto& mnpair : mapMasternodes) {
162162
mnpair.second.Check();
@@ -802,8 +802,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, const std::string& strCommand,
802802
// if masternode uses sentinel ping instead of watchdog
803803
// we shoud update nTimeLastWatchdogVote here if sentinel
804804
// ping flag is actual
805-
if(pmn && mnp.fSentinelIsCurrent)
806-
UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime);
805+
//if(pmn && mnp.fSentinelIsCurrent)
806+
// UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime);
807807

808808
// too late, new MNANNOUNCE is required
809809
if(pmn && pmn->IsNewStartRequired()) return;
@@ -1495,12 +1495,6 @@ void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t
14951495
nLastWatchdogVoteTime = GetTime();
14961496
}
14971497

1498-
bool CMasternodeMan::IsWatchdogActive()
1499-
{
1500-
LOCK(cs);
1501-
// Check if any masternodes have voted recently, otherwise return false
1502-
return (GetTime() - nLastWatchdogVoteTime) <= MASTERNODE_WATCHDOG_MAX_SECONDS;
1503-
}
15041498

15051499
bool CMasternodeMan::AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash)
15061500
{
@@ -1553,9 +1547,9 @@ void CMasternodeMan::SetMasternodeLastPing(const COutPoint& outpoint, const CMas
15531547
// if masternode uses sentinel ping instead of watchdog
15541548
// we shoud update nTimeLastWatchdogVote here if sentinel
15551549
// ping flag is actual
1556-
if(mnp.fSentinelIsCurrent) {
1557-
UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime);
1558-
}
1550+
//if(mnp.fSentinelIsCurrent) {
1551+
// UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime);
1552+
//}
15591553
mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp));
15601554

15611555
CMasternodeBroadcast mnb(*pmn);

src/masternodeman.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ class CMasternodeMan
218218
return vecTmp;;
219219
}
220220

221-
bool IsWatchdogActive();
222221
void UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime = 0);
223222
bool AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash);
224223
void RemoveGovernanceObject(uint256 nGovernanceObjectHash);

src/rpc/governance.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ UniValue getgovernanceinfo(const JSONRPCRequest& request)
969969

970970
UniValue obj(UniValue::VOBJ);
971971
obj.push_back(Pair("governanceminquorum", Params().GetConsensus().nGovernanceMinQuorum));
972-
obj.push_back(Pair("masternodewatchdogmaxseconds", MASTERNODE_WATCHDOG_MAX_SECONDS));
973972
obj.push_back(Pair("proposalfee", ValueFromAmount(GOVERNANCE_PROPOSAL_FEE_TX)));
974973
obj.push_back(Pair("superblockcycle", Params().GetConsensus().nSuperblockCycle));
975974
obj.push_back(Pair("lastsuperblock", nLastSuperblock));

src/rpc/masternode.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,6 @@ UniValue masternodelist(const JSONRPCRequest& request)
512512
" addr - Print ip address associated with a masternode (can be additionally filtered, partial match)\n"
513513
" full - Print info in format 'status protocol payee lastseen activeseconds lastpaidtime lastpaidblock IP'\n"
514514
" (can be additionally filtered, partial match)\n"
515-
" info - Print info in format 'status protocol payee lastseen activeseconds sentinelversion sentinelstate IP'\n"
516-
" (can be additionally filtered, partial match)\n"
517515
" lastpaidblock - Print the last block height a node was paid on the network\n"
518516
" lastpaidtime - Print the last time a node was paid on the network\n"
519517
" lastseen - Print timestamp of when a masternode was last seen on the network\n"
@@ -581,8 +579,6 @@ UniValue masternodelist(const JSONRPCRequest& request)
581579
EncodeDestination(mn.pubKeyCollateralAddress.GetID()) << " " <<
582580
(int64_t)mn.lastPing.sigTime << " " << std::setw(8) <<
583581
(int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " <<
584-
SafeIntVersionToString(mn.lastPing.nSentinelVersion) << " " <<
585-
(mn.lastPing.fSentinelIsCurrent ? "current" : "expired") << " " <<
586582
mn.addr.ToString();
587583
std::string strInfo = streamInfo.str();
588584
if (strFilter !="" && strInfo.find(strFilter) == std::string::npos &&

src/spork.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ bool CSporkManager::IsSporkActive(int nSporkID)
205205
case SPORK_BTX_19_MIN_VERSION_COUNT: r = SPORK_BTX_19_MIN_VERSION_COUNT_DEFAULT; break;
206206
case SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT: r = SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT_DEFAULT; break;
207207
case SPORK_BTX_21_MAX_VERSION_COUNT: r = SPORK_BTX_21_MAX_VERSION_COUNT_DEFAULT; break;
208-
case SPORK_BTX_22_UNKNOW: r = SPORK_BTX_22_UNKNOW_DEFAULT; break;
208+
case SPORK_22_FACTOR_ENFORCEMENT: r = SPORK_22_FACTOR_ENFORCEMENT_DEFAULT; break;
209209
// FXTC END
210210
default:
211211
LogPrint(BCLog::SPORK, "CSporkManager::IsSporkActive -- Unknown Spork ID %d\n", nSporkID);
@@ -252,7 +252,7 @@ int64_t CSporkManager::GetSporkValue(int nSporkID)
252252
case SPORK_BTX_19_MIN_VERSION_COUNT: return SPORK_BTX_19_MIN_VERSION_COUNT_DEFAULT;
253253
case SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT: return SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT_DEFAULT;
254254
case SPORK_BTX_21_MAX_VERSION_COUNT: return SPORK_BTX_21_MAX_VERSION_COUNT_DEFAULT;
255-
case SPORK_BTX_22_UNKNOW: return SPORK_BTX_22_UNKNOW_DEFAULT;
255+
case SPORK_22_FACTOR_ENFORCEMENT: return SPORK_22_FACTOR_ENFORCEMENT_DEFAULT;
256256

257257
default:
258258
LogPrint(BCLog::SPORK, "CSporkManager::GetSporkValue -- Unknown Spork ID %d\n", nSporkID);
@@ -291,7 +291,7 @@ int CSporkManager::GetSporkIDByName(std::string strName)
291291
if (strName == "SPORK_BTX_19_MIN_VERSION_COUNT") return SPORK_BTX_19_MIN_VERSION_COUNT;
292292
if (strName == "SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT") return SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT;
293293
if (strName == "SPORK_BTX_21_MAX_VERSION_COUNT") return SPORK_BTX_21_MAX_VERSION_COUNT;
294-
if (strName == "SPORK_BTX_22_UNKNOW") return SPORK_BTX_22_UNKNOW;
294+
if (strName == "SPORK_22_FACTOR_ENFORCEMENT") return SPORK_22_FACTOR_ENFORCEMENT;
295295

296296
LogPrint(BCLog::SPORK, "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName);
297297
return -1;
@@ -328,7 +328,7 @@ std::string CSporkManager::GetSporkNameByID(int nSporkID)
328328
case SPORK_BTX_19_MIN_VERSION_COUNT: return "SPORK_BTX_19_MIN_VERSION_COUNT";
329329
case SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT: return "SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT";
330330
case SPORK_BTX_21_MAX_VERSION_COUNT: return "SPORK_BTX_21_MAX_VERSION_COUNT";
331-
case SPORK_BTX_22_UNKNOW: return "SPORK_BTX_22_UNKNOW";
331+
case SPORK_22_FACTOR_ENFORCEMENT: return "SPORK_22_FACTOR_ENFORCEMENT";
332332

333333
default:
334334
LogPrint(BCLog::SPORK, "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID);

src/spork.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static const int SPORK_BTX_18_MIN_PEER_PROTO_VERSION = 94680031;
5959
static const int SPORK_BTX_19_MIN_VERSION_COUNT = 94680032;
6060
static const int SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT = 94680026;
6161
static const int SPORK_BTX_21_MAX_VERSION_COUNT = 94680027;
62-
static const int SPORK_BTX_22_UNKNOW = 94680028;
62+
static const int SPORK_22_FACTOR_ENFORCEMENT = 94680028;
6363
// FXTC END
6464

6565
static const int64_t SPORK_2_INSTANTSEND_ENABLED_DEFAULT = 0; // ON
@@ -90,7 +90,7 @@ static const int64_t SPORK_BTX_18_MIN_PEER_PROTO_VERSION_DEFAULT = 70016;// OFF
9090
static const int64_t SPORK_BTX_19_MIN_VERSION_COUNT_DEFAULT = 4070908800ULL;// OFF
9191
static const int64_t SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT_DEFAULT = 4070908800ULL;// OFF
9292
static const int64_t SPORK_BTX_21_MAX_VERSION_COUNT_DEFAULT = 4070908800ULL;// OFF
93-
static const int64_t SPORK_BTX_22_UNKNOW_DEFAULT = 4070908800ULL;// OFF
93+
static const int64_t SPORK_22_FACTOR_ENFORCEMENT_DEFAULT = 4070908800ULL;// OFF
9494

9595

9696

src/txdb.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
274274
pindexNew->nStatus = diskindex.nStatus;
275275
pindexNew->nTx = diskindex.nTx;
276276

277-
// BitCore BEGIN
278-
if (pindexNew->nHeight > consensusParams.nlastValidPowHashHeight)
279-
// FXTC END
280277
if (!CheckProofOfWork(pindexNew->GetBlockPoWHash(), pindexNew->nBits, consensusParams))
281278
return error("%s: CheckProofOfWork failed: %s", __func__, pindexNew->ToString());
282279

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3660,7 +3660,7 @@ bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState&
36603660
if (pindexPrev->nStatus & BLOCK_FAILED_MASK)
36613661
return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk");
36623662
// FXTC BEGIN
3663-
if (fCheckpointsEnabled && pindexPrev->nHeight < chainparams.GetConsensus().nlastValidPowHashHeight && !Checkpoints::IsExpectedCheckpoint(chainparams.Checkpoints(), pindexPrev->nHeight + 1, block.GetHash()))
3663+
if (fCheckpointsEnabled && !Checkpoints::IsExpectedCheckpoint(chainparams.Checkpoints(), pindexPrev->nHeight + 1, block.GetHash()))
36643664
return state.DoS(100, error("%s: Checkpoints::IsExpectedCheckpoint(): invalid checkpoint at height %d", __func__, pindexPrev->nHeight + 1), REJECT_CHECKPOINT, "bad-chackpoint");
36653665
// FXTC END
36663666
if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev, GetAdjustedTime()))

0 commit comments

Comments
 (0)