Skip to content

Commit

Permalink
Merge pull request #20 from MasterNodesPro/BIP130
Browse files Browse the repository at this point in the history
BIP130
  • Loading branch information
tvl83 authored Jan 20, 2019
2 parents dc7f873 + 551dc38 commit f0748b9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Website: https://mnpcoin.pro

Utility: https://masternodes.pro

#### 01-13-19
---- __Spork Protocol Update Enforced Feb 1, 2019__
#### 01-19-19

- Implemented BIP130
- Removed Zerocoin options from transaction dropdown.
- Updated Copyright dates and minor cleanup of code.
Expand Down
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class CMainParams : public CChainParams
fMineBlocksOnDemand = false;
fSkipProofOfWorkCheck = false;
fTestnetToBeDeprecatedFieldRPC = false;
fHeadersFirstSyncingActive = false;


nPoolMaxTransactions = 3;
strSporkKey = "044a30edfb288d8973761070dc8b456d429c7b8872d475a837e09e71d3b710c08055852a50de199ee04c0643ebb4bce1c52a27c63cec13c62cf2f84eda00d8a3a6";
Expand Down
3 changes: 0 additions & 3 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ class CChainParams
const CBlock& GenesisBlock() const { return genesis; }
/** Make miner wait to have peers to avoid wasting work */
bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
/** Headers first syncing is disabled */
bool HeadersFirstSyncingActive() const { return fHeadersFirstSyncingActive; };
/** Default value for -checkmempool and -checkblockindex argument */
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
/** Allow mining of a min-difficulty block */
Expand Down Expand Up @@ -154,7 +152,6 @@ class CChainParams
bool fMineBlocksOnDemand;
bool fSkipProofOfWorkCheck;
bool fTestnetToBeDeprecatedFieldRPC;
bool fHeadersFirstSyncingActive;
int nPoolMaxTransactions;
std::string strSporkKey;
std::string strObfuscationPoolDummyAddress;
Expand Down
18 changes: 10 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5762,8 +5762,7 @@ bool fRequestedSporksIDB = false;
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived)
{
RandAddSeedPerfmon();
if (fDebug)
LogPrintf("received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) {
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
return true;
Expand Down Expand Up @@ -6053,7 +6052,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


else if (strCommand == "getblocks" || strCommand == "getheaders") {
else if (strCommand == "getblocks") {
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;
Expand Down Expand Up @@ -6085,15 +6084,17 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


else if (strCommand == "headers" && Params().HeadersFirstSyncingActive()) {
else if (strCommand == "headers") {
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;

LOCK(cs_main);

if (IsInitialBlockDownload())
if (IsInitialBlockDownload() && !pfrom->fWhitelisted) {
LogPrint("net", "Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->id);
return true;
}

CBlockIndex* pindex = NULL;
if (locator.IsNull()) {
Expand All @@ -6112,8 +6113,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
vector<CBlock> vHeaders;
int nLimit = MAX_HEADERS_RESULTS;
if (fDebug)
LogPrintf("getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id);

LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id);

for (; pindex; pindex = chainActive.Next(pindex)) {
vHeaders.push_back(pindex->GetBlockHeader());
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
Expand Down Expand Up @@ -6290,7 +6292,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


else if (strCommand == "headers" && Params().HeadersFirstSyncingActive() && !fImporting && !fReindex) // Ignore headers received while importing
else if (strCommand == "headers" && !fImporting && !fReindex) // Ignore headers received while importing
{
std::vector<CBlockHeader> headers;

Expand Down
2 changes: 2 additions & 0 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake)
while (chainActive.Tip()->nTime < 1471482000 || vNodes.empty() || pwallet->IsLocked() || !fMintableCoins ||
nReserveBalance >= pwallet->GetBalance() || !masternodeSync.IsSynced()) {
nLastCoinStakeSearchInterval = 0;
LogPrint("miner", "MNPCoinMiner wait 5 seconds (%u, %d, %d, %d)\n", vNodes.size(), pwallet->IsLocked(), fMintableCoins, masternodeSync.IsBlockchainSynced());
MilliSleep(5000);
if (!fGenerateBitcoins && !fProofOfStake)
continue;
Expand All @@ -594,6 +595,7 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake)
{
if (GetTime() - mapHashedBlocks[chainActive.Tip()->nHeight] < max(pwallet->nHashInterval, (unsigned int)1)) // wait half of the nHashDrift with max wait of 3 minutes
{
LogPrint("miner", "MNPCoinMiner wait half of the nHashDrift\n");
MilliSleep(5000);
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ using namespace boost;
#define SPORK_3_SWIFTTX_BLOCK_FILTERING_DEFAULT 1424217600 //2015-2-18
#define SPORK_5_MAX_VALUE_DEFAULT 1000 //1000 MNP
#define SPORK_7_MASTERNODE_SCANNING_DEFAULT 978307200 //2001-1-1
#define SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT 1535904000 // Activated - Sun Sep 2 16:00:00 2018
#define SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT 4070908800 //OFF
#define SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT 4070908800 //OFF
#define SPORK_10_MASTERNODE_PAY_UPDATED_NODES_DEFAULT 4070908800 //OFF
//#define SPORK_11_LOCK_INVALID_UTXO_DEFAULT 4070908800 //OFF - NOTE: this is block height not time!
#define SPORK_13_ENABLE_SUPERBLOCKS_DEFAULT 4070908800 //OFF
#define SPORK_14_NEW_PROTOCOL_ENFORCEMENT_DEFAULT 4070908800 //OFF
#define SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2_DEFAULT 4070908800 //OFF
#define SPORK_16_ZEROCOIN_MAINTENANCE_MODE_DEFAULT 1539263208 // activated - Thu Oct 11 13:06:48 2018
#define SPORK_16_ZEROCOIN_MAINTENANCE_MODE_DEFAULT 4070908800 //OFF

class CSporkMessage;
class CSporkManager;
Expand Down

0 comments on commit f0748b9

Please sign in to comment.