Skip to content

Commit

Permalink
Remove BIP130 for Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MNPJason committed Feb 21, 2019
1 parent 5624d18 commit 569695a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class CMainParams : public CChainParams
fMineBlocksOnDemand = false;
fSkipProofOfWorkCheck = false;
fTestnetToBeDeprecatedFieldRPC = false;

fHeadersFirstSyncingActive = false;

nPoolMaxTransactions = 3;
strSporkKey = "044a30edfb288d8973761070dc8b456d429c7b8872d475a837e09e71d3b710c08055852a50de199ee04c0643ebb4bce1c52a27c63cec13c62cf2f84eda00d8a3a6";
Expand Down
3 changes: 3 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ 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 @@ -152,6 +154,7 @@ class CChainParams
bool fMineBlocksOnDemand;
bool fSkipProofOfWorkCheck;
bool fTestnetToBeDeprecatedFieldRPC;
bool fHeadersFirstSyncingActive;
int nPoolMaxTransactions;
std::string strSporkKey;
std::string strObfuscationPoolDummyAddress;
Expand Down
13 changes: 7 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6037,7 +6037,8 @@ bool fRequestedSporksIDB = false;
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived)
{
RandAddSeedPerfmon();
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
if (fDebug)
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 @@ -6327,7 +6328,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


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


else if (strCommand == "headers") {
else if (strCommand == "headers" && Params().HeadersFirstSyncingActive()) {
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;
Expand Down Expand Up @@ -6388,8 +6389,8 @@ 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;

LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id);
if (fDebug)
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());
Expand Down Expand Up @@ -6567,7 +6568,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}


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

Expand Down
4 changes: 2 additions & 2 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +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());
// 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 @@ -595,7 +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");
// LogPrint("miner", "MNPCoinMiner wait half of the nHashDrift\n");
MilliSleep(5000);
continue;
}
Expand Down

0 comments on commit 569695a

Please sign in to comment.