Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Spork code overhaul #1000

Merged
merged 16 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ BITCOIN_CORE_H = \
serialize.h \
spork.h \
sporkdb.h \
sporkid.h \
stakeinput.h \
streams.h \
support/cleanse.h \
Expand Down
4 changes: 2 additions & 2 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ bool CActiveMasternode::SendMasternodePing(std::string& errorMessage)
* AFTER MIGRATION TO V12 IS DONE
*/

if (IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return true;
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return true;
// for migration purposes ping our node on old masternodes network too
std::string retErrorMessage;
std::vector<unsigned char> vchMasterNodeSignature;
Expand Down Expand Up @@ -300,7 +300,7 @@ bool CActiveMasternode::CreateBroadcast(CTxIn vin, CService service, CKey keyCol
* AFTER MIGRATION TO V12 IS DONE
*/

if (IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return true;
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return true;
// for migration purposes inject our node in old masternodes' list too
std::string retErrorMessage;
std::vector<unsigned char> vchMasterNodeSignature;
Expand Down
10 changes: 5 additions & 5 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ class CMainParams : public CChainParams

nPoolMaxTransactions = 3;
nBudgetCycleBlocks = 43200; //!< Amount of blocks in a months period of time (using 1 minutes per) = (60*24*30)
strSporkKey = "040F129DE6546FE405995329A887329BED4321325B1A73B0A257423C05C1FCFE9E40EF0678AEF59036A22C42E61DFD29DF7EFB09F56CC73CADF64E05741880E3E7";
strSporkKeyOld = "0499A7AF4806FC6DE640D23BC5936C29B77ADF2174B4F45492727F897AE63CF8D27B2F05040606E0D14B547916379FA10716E344E745F880EDC037307186AA25B7";
strSporkPubKey = "040F129DE6546FE405995329A887329BED4321325B1A73B0A257423C05C1FCFE9E40EF0678AEF59036A22C42E61DFD29DF7EFB09F56CC73CADF64E05741880E3E7";
strSporkPubKeyOld = "0499A7AF4806FC6DE640D23BC5936C29B77ADF2174B4F45492727F897AE63CF8D27B2F05040606E0D14B547916379FA10716E344E745F880EDC037307186AA25B7";
strObfuscationPoolDummyAddress = "D87q2gC9j6nNrnzCsg4aY6bHMLsT9nUhEw";
nStartMasternodePayments = 1403728576; //Wed, 25 Jun 2014 20:36:16 GMT

Expand Down Expand Up @@ -355,8 +355,8 @@ class CTestNetParams : public CMainParams

nPoolMaxTransactions = 2;
nBudgetCycleBlocks = 144; //!< Ten cycles per day on testnet
strSporkKey = "04E88BB455E2A04E65FCC41D88CD367E9CCE1F5A409BE94D8C2B4B35D223DED9C8E2F4E061349BA3A38839282508066B6DC4DB72DD432AC4067991E6BF20176127";
strSporkKeyOld = "04A8B319388C0F8588D238B9941DC26B26D3F9465266B368A051C5C100F79306A557780101FE2192FE170D7E6DEFDCBEE4C8D533396389C0DAFFDBC842B002243C";
strSporkPubKey = "04E88BB455E2A04E65FCC41D88CD367E9CCE1F5A409BE94D8C2B4B35D223DED9C8E2F4E061349BA3A38839282508066B6DC4DB72DD432AC4067991E6BF20176127";
strSporkPubKeyOld = "04A8B319388C0F8588D238B9941DC26B26D3F9465266B368A051C5C100F79306A557780101FE2192FE170D7E6DEFDCBEE4C8D533396389C0DAFFDBC842B002243C";
strObfuscationPoolDummyAddress = "y57cqfGRkekRyDRNeJiLtYVEbvhXrNbmox";
nStartMasternodePayments = 1420837558; //Fri, 09 Jan 2015 21:05:58 GMT
nBudget_Fee_Confirmations = 3; // Number of confirmations for the finalization fee. We have to make this very short
Expand Down Expand Up @@ -437,7 +437,7 @@ class CRegTestParams : public CTestNetParams
private key hex: bd4960dcbd9e7f2223f24e7164ecb6f1fe96fc3a416f5d3a830ba5720c84b8ca
Address: yCvUVd72w7xpimf981m114FSFbmAmne7j9
*/
strSporkKey = "043969b1b0e6f327de37f297a015d37e2235eaaeeb3933deecd8162c075cee0207b13537618bde640879606001a8136091c62ec272dd0133424a178704e6e75bb7";
strSporkPubKey = "043969b1b0e6f327de37f297a015d37e2235eaaeeb3933deecd8162c075cee0207b13537618bde640879606001a8136091c62ec272dd0133424a178704e6e75bb7";
}
const Checkpoints::CCheckpointData& Checkpoints() const
{
Expand Down
8 changes: 4 additions & 4 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class CChainParams
int64_t GetProposalEstablishmentTime() const { return nProposalEstablishmentTime; }

/** Spork key and Masternode Handling **/
std::string SporkKey() const { return strSporkKey; }
std::string SporkKeyOld() const { return strSporkKeyOld; }
std::string SporkPubKey() const { return strSporkPubKey; }
std::string SporkPubKeyOld() const { return strSporkPubKeyOld; }
int64_t NewSporkStart() const { return nEnforceNewSporkKey; }
int64_t RejectOldSporkKey() const { return nRejectOldSporkKey; }
std::string ObfuscationPoolDummyAddress() const { return strObfuscationPoolDummyAddress; }
Expand Down Expand Up @@ -193,8 +193,8 @@ class CChainParams
bool fHeadersFirstSyncingActive;
int nPoolMaxTransactions;
int nBudgetCycleBlocks;
std::string strSporkKey;
std::string strSporkKeyOld;
std::string strSporkPubKey;
std::string strSporkPubKeyOld;
int64_t nEnforceNewSporkKey;
int64_t nRejectOldSporkKey;
std::string strObfuscationPoolDummyAddress;
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ bool AppInit2()

// PIVX: load previous sessions sporks if we have them.
uiInterface.InitMessage(_("Loading sporks..."));
LoadSporksFromDB();
sporkManager.LoadSporksFromDB();

uiInterface.InitMessage(_("Loading block index..."));
std::string strBlockIndexError = "";
Expand Down
51 changes: 41 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState& state, const CTransa
*pfMissingInputs = false;

//Temporarily disable zerocoin for maintenance
if (GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && tx.ContainsZerocoins())
if (sporkManager.IsSporkActive(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && tx.ContainsZerocoins())
return state.DoS(10, error("AcceptToMemoryPool : Zerocoin transactions are temporarily disabled for maintenance"), REJECT_INVALID, "bad-tx");

int chainHeight = chainActive.Height();
Expand Down Expand Up @@ -2044,7 +2044,7 @@ CAmount GetSeeSaw(const CAmount& blockValue, int nMasternodeCount, int nHeight)
{
//if a mn count is inserted into the function we are looking for a specific result for a masternode count
if (nMasternodeCount < 1){
if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT))
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT))
nMasternodeCount = mnodeman.stable_size();
else
nMasternodeCount = mnodeman.size();
Expand Down Expand Up @@ -3241,7 +3241,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return state.DoS(100, error("ConnectBlock() : too many sigops"), REJECT_INVALID, "bad-blk-sigops");

//Temporarily disable zerocoin transactions for maintenance
if (block.nTime > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && !IsInitialBlockDownload() && tx.ContainsZerocoins()) {
if (block.nTime > sporkManager.GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && !IsInitialBlockDownload() && tx.ContainsZerocoins()) {
return state.DoS(100, error("ConnectBlock() : zerocoin transactions are currently in maintenance mode"));
}

Expand Down Expand Up @@ -3756,19 +3756,50 @@ bool static ConnectTip(CValidationState& state, CBlockIndex* pindexNew, CBlock*
return true;
}

bool DisconnectBlocksAndReprocess(int blocks)
bool DisconnectBlocks(int nBlocks)
{
LOCK(cs_main);

CValidationState state;

LogPrintf("DisconnectBlocksAndReprocess: Got command to replay %d blocks\n", blocks);
for (int i = 0; i <= blocks; i++)
LogPrintf("%s: Got command to replay %d blocks\n", __func__, nBlocks);
for (int i = 0; i <= nBlocks; i++)
DisconnectTip(state);

return true;
}

void ReprocessBlocks(int nBlocks)
{
std::map<uint256, int64_t>::iterator it = mapRejectedBlocks.begin();
while (it != mapRejectedBlocks.end()) {
//use a window twice as large as is usual for the nBlocks we want to reset
if ((*it).second > GetTime() - (nBlocks * Params().TargetSpacing() * 2)) {
BlockMap::iterator mi = mapBlockIndex.find((*it).first);
if (mi != mapBlockIndex.end() && (*mi).second) {
LOCK(cs_main);

CBlockIndex* pindex = (*mi).second;
LogPrintf("%s - %s\n", __func__, (*it).first.ToString());

CValidationState state;
ReconsiderBlock(state, pindex);
}
}
++it;
}

CValidationState state;
{
LOCK(cs_main);
DisconnectBlocks(nBlocks);
}

if (state.IsValid()) {
random-zebra marked this conversation as resolved.
Show resolved Hide resolved
ActivateBestChain(state);
}
}

/*
DisconnectBlockAndInputs

Expand Down Expand Up @@ -4404,7 +4435,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
}

// ----------- swiftTX transaction scanning -----------
if (IsSporkActive(SPORK_3_SWIFTTX_BLOCK_FILTERING)) {
if (sporkManager.IsSporkActive(SPORK_3_SWIFTTX_BLOCK_FILTERING)) {
for (const CTransaction& tx : block.vtx) {
if (!tx.IsCoinBase()) {
//only reject blocks when it's based on complete consensus
Expand Down Expand Up @@ -7048,7 +7079,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
budget.ProcessMessage(pfrom, strCommand, vRecv);
masternodePayments.ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
ProcessMessageSwiftTX(pfrom, strCommand, vRecv);
ProcessSpork(pfrom, strCommand, vRecv);
sporkManager.ProcessSpork(pfrom, strCommand, vRecv);
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
}

Expand All @@ -7063,11 +7094,11 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
int ActiveProtocol()
{
// SPORK_14 is used for 70917 (v3.4+)
if (IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT))
if (sporkManager.IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT))
return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;

// SPORK_15 was used for 70916 (v3.3+), commented out now.
//if (IsSporkActive(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2))
//if (sporkManager.IsSporkActive(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2))
// return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;

return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT;
Expand Down
3 changes: 2 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex);
bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool* pfClean = NULL);

/** Reprocess a number of blocks to try and get on the correct chain again **/
bool DisconnectBlocksAndReprocess(int blocks);
bool DisconnectBlocks(int nBlocks);
void ReprocessBlocks(int nBlocks);
random-zebra marked this conversation as resolved.
Show resolved Hide resolved

/** Apply the effects of this block (with given index) on the UTXO set represented by coins */
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& coins, bool fJustCheck, bool fAlreadyChecked = false);
Expand Down
16 changes: 8 additions & 8 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ bool IsBlockValueValid(const CBlock& block, CAmount nExpectedValue, CAmount nMin
} else { // we're synced and have data so check the budget schedule

//are these blocks even enabled
if (!IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)) {
if (!sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)) {
return nMinted <= nExpectedValue;
}

Expand Down Expand Up @@ -234,7 +234,7 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
const CTransaction& txNew = (nBlockHeight > Params().LAST_POW_BLOCK() ? block.vtx[1] : block.vtx[0]);

//check if it's a budget block
if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)) {
if (sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS)) {
if (budget.IsBudgetPaymentBlock(nBlockHeight)) {
transactionStatus = budget.IsTransactionValid(txNew, nBlockHeight);
if (transactionStatus == TrxValidationStatus::Valid) {
Expand All @@ -243,7 +243,7 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)

if (transactionStatus == TrxValidationStatus::InValid) {
LogPrint("masternode","Invalid budget payment detected %s\n", txNew.ToString().c_str());
if (IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT))
if (sporkManager.IsSporkActive(SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT))
return false;

LogPrint("masternode","Budget enforcement is disabled, accepting block\n");
Expand All @@ -261,7 +261,7 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
return true;
LogPrint("masternode","Invalid mn payment detected %s\n", txNew.ToString().c_str());

if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT))
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT))
return false;
LogPrint("masternode","Masternode payment enforcement is disabled, accepting block\n");

Expand All @@ -274,7 +274,7 @@ void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStak
CBlockIndex* pindexPrev = chainActive.Tip();
if (!pindexPrev) return;

if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight + 1)) {
if (sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight + 1)) {
budget.FillBlockPayee(txNew, nFees, fProofOfStake);
} else {
masternodePayments.FillBlockPayee(txNew, nFees, fProofOfStake, fZPIVStake);
Expand All @@ -283,7 +283,7 @@ void FillBlockPayee(CMutableTransaction& txNew, CAmount nFees, bool fProofOfStak

std::string GetRequiredPaymentsString(int nBlockHeight)
{
if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)) {
if (sporkManager.IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(nBlockHeight)) {
return budget.GetRequiredPaymentsString(nBlockHeight);
} else {
return masternodePayments.GetRequiredPaymentsString(nBlockHeight);
Expand Down Expand Up @@ -359,7 +359,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFe

int CMasternodePayments::GetMinMasternodePaymentsProto()
{
if (IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES))
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES))
return ActiveProtocol(); // Allow only updated peers
else
return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; // Also allow old peers as long as they are allowed to run
Expand Down Expand Up @@ -547,7 +547,7 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew)

CAmount nReward = GetBlockValue(nBlockHeight);

if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
// Get a stable number of masternodes by ignoring newly activated (< 8000 sec old) masternodes
nMasternode_Drift_Count = mnodeman.stable_size() + Params().MasternodeCountDrift();
}
Expand Down
4 changes: 2 additions & 2 deletions src/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void CMasternodeSync::Process()
// timeout
if (lastMasternodeList == 0 &&
(RequestedMasternodeAttempt >= MASTERNODE_SYNC_THRESHOLD * 3 || GetTime() - nAssetSyncStarted > MASTERNODE_SYNC_TIMEOUT * 5)) {
if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
LogPrintf("CMasternodeSync::Process - ERROR - Sync has failed, will retry later\n");
RequestedMasternodeAssets = MASTERNODE_SYNC_FAILED;
RequestedMasternodeAttempt = 0;
Expand Down Expand Up @@ -339,7 +339,7 @@ void CMasternodeSync::Process()
// timeout
if (lastMasternodeWinner == 0 &&
(RequestedMasternodeAttempt >= MASTERNODE_SYNC_THRESHOLD * 3 || GetTime() - nAssetSyncStarted > MASTERNODE_SYNC_TIMEOUT * 5)) {
if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
LogPrintf("CMasternodeSync::Process - ERROR - Sync has failed, will retry later\n");
RequestedMasternodeAssets = MASTERNODE_SYNC_FAILED;
RequestedMasternodeAttempt = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ int CMasternodeMan::stable_size ()
if (mn.protocolVersion < nMinProtocol) {
continue; // Skip obsolete versions
}
if (IsSporkActive (SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
if (sporkManager.IsSporkActive (SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
nMasternode_Age = GetAdjustedTime() - mn.sigTime;
if ((nMasternode_Age) < nMasternode_Min_Age) {
continue; // Skip masternodes younger than (default) 8000 sec (MUST be > MASTERNODE_REMOVAL_SECONDS)
Expand Down Expand Up @@ -607,7 +607,7 @@ int CMasternodeMan::GetMasternodeRank(const CTxIn& vin, int64_t nBlockHeight, in
continue; // Skip obsolete versions
}

if (IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
nMasternode_Age = GetAdjustedTime() - mn.sigTime;
if ((nMasternode_Age) < nMasternode_Min_Age) {
if (fDebug) LogPrint("masternode","Skipping just activated Masternode. Age: %ld\n", nMasternode_Age);
Expand Down Expand Up @@ -856,7 +856,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
// Light version for OLD MASSTERNODES - fake pings, no self-activation
else if (strCommand == "dsee") { //ObfuScation Election Entry

if (IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return;
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return;

CTxIn vin;
CService addr;
Expand Down Expand Up @@ -1061,7 +1061,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData

else if (strCommand == "dseep") { //ObfuScation Election Entry Ping

if (IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return;
if (sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES)) return;

CTxIn vin;
std::vector<unsigned char> vchSig;
Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet,
if (tx.IsCoinBase() || tx.IsCoinStake() || !IsFinalTx(tx, nHeight)){
continue;
}
if(GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && tx.ContainsZerocoins()){
if(sporkManager.IsSporkActive(SPORK_16_ZEROCOIN_MAINTENANCE_MODE) && tx.ContainsZerocoins()){
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/privacywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void PrivacyWidget::onSendClicked(){
if (!walletModel || !walletModel->getOptionsModel())
return;

if(GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE)) {
if(sporkManager.IsSporkActive(SPORK_16_ZEROCOIN_MAINTENANCE_MODE)) {
warn(tr("Zerocoin"), tr("zPIV is currently undergoing maintenance"));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ bool SendWidget::sendZpiv(QList<SendCoinsRecipient> recipients){
if (!walletModel || !walletModel->getOptionsModel())
return false;

if(GetAdjustedTime() > GetSporkValue(SPORK_16_ZEROCOIN_MAINTENANCE_MODE)) {
if(sporkManager.IsSporkActive(SPORK_16_ZEROCOIN_MAINTENANCE_MODE)) {
emit message(tr("Spend Zerocoin"), tr("zPIV is currently undergoing maintenance."), CClientUIInterface::MSG_ERROR);
return false;
}
Expand Down
Loading