diff --git a/README.md b/README.md index a06f6b5..cdd37ec 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,18 @@ MNPCOIN Core ===================================== -Version: V1.2.4 +Version: V1.2.5 Website: https://mnpcoin.pro Utility: https://masternodes.pro +#### 02-21-19 V1.2.5 +- Update checkpoints @MNPJason +- Remove lingering BIP130 Code @MNPJason +- Update Version to v1.2.5 @MNPJason +- Update masternode.sh file @MNPJason + + #### 02-21-19 V1.2.4 - Remove BIP130 as it was causing a bandwidth issue with local wallets and hosted nodes @MNPJason - Update masternode.sh file @MNPJason diff --git a/configure.ac b/configure.ac index ffc4c2e..b2cd554 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 2) -define(_CLIENT_VERSION_REVISION, 4) +define(_CLIENT_VERSION_REVISION, 5) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2019) diff --git a/doc/masternode.sh b/doc/masternode.sh index 0c7df7c..d016eaf 100755 --- a/doc/masternode.sh +++ b/doc/masternode.sh @@ -1,7 +1,7 @@ #!/bin/bash -PACKAGE='mnpcoin-v1.2.4.tar.gz' -VERSION='v1.2.4' +PACKAGE='mnpcoin-v1.2.5.tar.gz' +VERSION='v1.2.5' system_motd() { clear @@ -21,7 +21,7 @@ system_motd() { echo " ██║ ╚═╝ ██║██║ ╚═██║██║ ╚██████╗╚██████╔╝██║██║ ╚═██║ " echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝╚═╝ ╚═╝ " echo "" - echo "Updated: 2/21/2019 By: MNP_Jason" + echo "Updated: 2/25/2019 By: MNP_Jason" echo && echo && echo sleep 2 } diff --git a/src/chain.cpp b/src/chain.cpp index 90f5aa6..823d4b4 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -54,8 +54,8 @@ CBlockLocator CChain::GetLocator(const CBlockIndex* pindex) const const CBlockIndex* CChain::FindFork(const CBlockIndex* pindex) const { - if (!pindex) - return nullptr; +// if (!pindex) +// return nullptr; if (pindex->nHeight > Height()) pindex = pindex->GetAncestor(Height()); diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 18edc24..fa13cb8 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -84,12 +84,15 @@ static Checkpoints::MapCheckpoints mapCheckpoints = ( 220000, uint256("6d55a17c276ab12b14b6b8d13fb33e733613b25c600c220a457ed6a054c137cf")) ( 240000, uint256("85469fe3a2b8130e163f1e0b1c324c405dc84f91a62d001de1cdbf465f056dcd")) ( 248000, uint256("b7934ead9db1c2444e591060d46dfcbf1330ccba04524d1b46ef164b991adc9d")) + ( 260000, uint256("6b6b58124a1686d18aab22ac56efba4ab691da92ebcb2fb4bad9c1237fd76d4e")) + ( 280000, uint256("ef54192b4db3a50c3958c1f810b14cd29e9d4c625faa9a78ed7a60b641e6f6e6")) + ( 293650, uint256("e5f257db46a1b89f319f97e90fdf6c8143d8e1fedc60cdf6751fc5a6bbb593f4")) ; static const Checkpoints::CCheckpointData data = { &mapCheckpoints, - 1548362685, // * UNIX timestamp of last checkpoint block - 506447, // * total number of transactions between genesis and last checkpoint + 1551127482, // * UNIX timestamp of last checkpoint block + 604487, // * total number of transactions between genesis and last checkpoint // (the tx=... number in the SetBestChain debug.log lines) 2000 // * estimated number of transactions per day after checkpoint }; diff --git a/src/config/mnpcoin-config.h b/src/config/mnpcoin-config.h index be23189..2aac032 100644 --- a/src/config/mnpcoin-config.h +++ b/src/config/mnpcoin-config.h @@ -21,7 +21,7 @@ #define CLIENT_VERSION_MINOR 2 /* Build revision */ -#define CLIENT_VERSION_REVISION 4 +#define CLIENT_VERSION_REVISION 5 /* Version is release */ #define COPYRIGHT_YEAR 2019 @@ -274,7 +274,7 @@ #define PACKAGE_NAME "MNPCoin Core" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "MNPCoin Core 1.2.4" +#define PACKAGE_STRING "MNPCoin Core 1.2.5" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "mnpcoin" @@ -283,7 +283,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.2.4" +#define PACKAGE_VERSION "1.2.5" /* Define to necessary symbol if this constant uses a non-standard name on your system. */ diff --git a/src/main.cpp b/src/main.cpp index 836dac8..a276d3e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -301,8 +301,6 @@ struct CNodeState { uint256 hashLastUnknownBlock; //! The last full block we both have. CBlockIndex* pindexLastCommonBlock; - //! The best header we have sent our peer. - CBlockIndex *pindexBestHeaderSent; //! Whether we've started headers synchronization with this peer. bool fSyncStarted; //! Since when we're stalling block download progress (in microseconds), or 0. @@ -311,8 +309,6 @@ struct CNodeState { int nBlocksInFlight; //! Whether we consider this a preferred download peer. bool fPreferredDownload; - //! Whether this peer wants invs or headers (when possible) for block announcements. - bool fPreferHeaders; CNodeBlocks nodeBlocks; @@ -324,12 +320,10 @@ struct CNodeState { pindexBestKnownBlock = NULL; hashLastUnknownBlock = uint256(0); pindexLastCommonBlock = NULL; - pindexBestHeaderSent = NULL; fSyncStarted = false; nStallingSince = 0; nBlocksInFlight = 0; fPreferredDownload = false; - fPreferHeaders = false; } }; @@ -460,25 +454,6 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256& hash) } } -// Requires cs_main -bool CanDirectFetch() -{ - // merged from https://github.com/bitcoin/bitcoin/pull/7129/files - return true; - //return chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - Params().TargetSpacing() * 20; -} - -// Requires cs_main -bool PeerHasHeader(CNodeState *state, CBlockIndex *pindex) -{ - if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight)) - return true; - else if (state->pindexBestHeaderSent && pindex == state->pindexBestHeaderSent->GetAncestor(pindex->nHeight)) - return true; - else - return false; -} - /** Find the last common ancestor two blocks have. * Both pa and pb must be non-NULL. */ CBlockIndex* LastCommonAncestor(CBlockIndex* pa, CBlockIndex* pb) @@ -3882,14 +3857,13 @@ static bool ActivateBestChainStep(CValidationState& state, CBlockIndex* pindexMo */ bool ActivateBestChain(CValidationState& state, CBlock* pblock, bool fAlreadyChecked) { - CBlockIndex* pindexMostWork = nullptr; + CBlockIndex* pindexNewTip = NULL; + CBlockIndex* pindexMostWork = NULL;; do { boost::this_thread::interruption_point(); - CBlockIndex *pindexNewTip = nullptr; - const CBlockIndex *pindexFork = nullptr; - bool fInitialDownload = false; + bool fInitialDownload; while (true) { TRY_LOCK(cs_main, lockMain); if (!lockMain) { @@ -3897,7 +3871,6 @@ bool ActivateBestChain(CValidationState& state, CBlock* pblock, bool fAlreadyChe continue; } - CBlockIndex *pindexOldTip = chainActive.Tip(); pindexMostWork = FindMostWorkChain(); // Whether we have anything to do at all. @@ -3908,7 +3881,6 @@ bool ActivateBestChain(CValidationState& state, CBlock* pblock, bool fAlreadyChe return false; pindexNewTip = chainActive.Tip(); - pindexFork = chainActive.FindFork(pindexOldTip); fInitialDownload = IsInitialBlockDownload(); break; } @@ -3917,46 +3889,21 @@ bool ActivateBestChain(CValidationState& state, CBlock* pblock, bool fAlreadyChe // Notifications/callbacks that can run without cs_main if (!fInitialDownload) { // Find the hashes of all blocks that weren't previously in the best chain. - std::vector vHashes; - CBlockIndex *pindexToAnnounce = pindexNewTip; - while (pindexToAnnounce != pindexFork) { - vHashes.push_back(pindexToAnnounce->GetBlockHash()); - pindexToAnnounce = pindexToAnnounce->pprev; - if (vHashes.size() == MAX_BLOCKS_TO_ANNOUNCE) { - // Limit announcements in case of a huge reorganization. - // Rely on the peer's synchronization mechanism in that case. - break; - } - } + uint256 hashNewTip = pindexNewTip->GetBlockHash(); // Relay inventory, but don't relay old inventory during initial block download. int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate(); { LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodes) { - if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate)) { - BOOST_REVERSE_FOREACH(const uint256& hash, vHashes) { - pnode->PushBlockHash(hash); - } - } - } + BOOST_FOREACH (CNode* pnode, vNodes) + if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate)) + pnode->PushInventory(CInv(MSG_BLOCK, hashNewTip)); } // Notify external listeners about the new tip. // Note: uiInterface, should switch main signals. - if (!vHashes.empty()) { - GetMainSignals().UpdatedBlockTip(pindexNewTip); - uiInterface.NotifyBlockTip(vHashes.front()); - - if (pblock) { - unsigned size = GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION); - // If the size is over 1 MB notify external listeners, and it is within the last 5 minutes - // ZC: why MAX_BLOCK_SIZE_LEGACY, a bug (PIVX) or on purpose to notify of? - if (size > MAX_BLOCK_SIZE_LEGACY && pblock->GetBlockTime() > GetAdjustedTime() - 300) { - uiInterface.NotifyBlockSize(static_cast(size), vHashes.front()); - } - } - } + uiInterface.NotifyBlockTip(hashNewTip); + GetMainSignals().UpdatedBlockTip(pindexNewTip); } } while (pindexMostWork != chainActive.Tip()); CheckBlockIndex(); @@ -6180,18 +6127,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, LOCK(cs_main); State(pfrom->GetId())->fCurrentlyConnected = true; } - if (pfrom->nVersion >= SENDHEADERS_VERSION) { - // Tell our peer we prefer to receive headers rather than inv's - // We send this to non-NODE NETWORK peers as well, because even - // non-NODE NETWORK peers can announce blocks (such as pruning - // nodes) - pfrom->PushMessage("sendheaders"); - } - } - else if (strCommand == "sendheaders") - { - LOCK(cs_main); - State(pfrom->GetId())->fPreferHeaders = true; } @@ -6286,7 +6221,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (inv.type == MSG_BLOCK) { UpdateBlockAvailability(pfrom->GetId(), inv.hash); - if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash) && CanDirectFetch()) { + if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) { // Add this to the list of blocks to request vToFetch.push_back(inv); LogPrint("net", "getblocks (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id); @@ -6397,15 +6332,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop) break; } - - // pindex can be NULL either if we sent chainActive.Tip() OR - // if our peer has chainActive.Tip() (and thus we are sending an empty - // headers message). In both cases it's safe to update - // pindexBestHeaderSent to be our tip. - CNodeState *nodestate = State(pfrom->GetId()); - if (nodestate) - nodestate->pindexBestHeaderSent = pindex ? pindex : chainActive.Tip(); - pfrom->PushMessage("headers", vHeaders); } @@ -6624,54 +6550,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, LogPrintf("more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256(0)); } - - bool fCanDirectFetch = CanDirectFetch(); - CNodeState *nodestate = State(pfrom->GetId()); - // If this set of headers is valid and ends in a block with at least as - // much work as our tip, download as much as possible. - if (fCanDirectFetch && pindexLast->IsValid(BLOCK_VALID_TREE) && chainActive.Tip()->nChainWork <= pindexLast->nChainWork) { - vector vToFetch; - CBlockIndex *pindexWalk = pindexLast; - // Calculate all the blocks we'd need to switch to pindexLast, up to a limit. - while (pindexWalk && !chainActive.Contains(pindexWalk) && vToFetch.size() <= MAX_BLOCKS_IN_TRANSIT_PER_PEER) { - if (!(pindexWalk->nStatus & BLOCK_HAVE_DATA) && - !mapBlocksInFlight.count(pindexWalk->GetBlockHash())) { - // We don't have this block, and it's not yet in flight. - vToFetch.push_back(pindexWalk); - } - pindexWalk = pindexWalk->pprev; - } - // If pindexWalk still isn't on our main chain, we're looking at a - // very large reorg at a time we think we're close to caught up to - // the main chain -- this shouldn't really happen. Bail out on the - // direct fetch and rely on parallel download instead. - if (!chainActive.Contains(pindexWalk)) { - LogPrint("net", "Large reorg, won't direct fetch to %s (%d)\n", - pindexLast->GetBlockHash().ToString(), - pindexLast->nHeight); - } else { - vector vGetData; - // Download as much as possible, from earliest to latest. - BOOST_REVERSE_FOREACH(CBlockIndex *pindex, vToFetch) { - if (nodestate && nodestate->nBlocksInFlight >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) { - // Can't download any more from this peer - break; - } - vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash())); - MarkBlockAsInFlight(pfrom->GetId(), pindex->GetBlockHash(), pindex); - LogPrint("net", "Requesting block %s from peer=%d\n", - pindex->GetBlockHash().ToString(), pfrom->id); - } - if (vGetData.size() > 1) { - LogPrint("net", "Downloading blocks toward %s (%d) via headers direct fetch\n", - pindexLast->GetBlockHash().ToString(), pindexLast->nHeight); - } - if (vGetData.size() > 0) { - pfrom->PushMessage("getdata", vGetData); - } - } - } - CheckBlockIndex(); } @@ -6955,11 +6833,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // it was the one which was commented out int ActiveProtocol() { - if (IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT)) +// if (IsSporkActive(SPORK_14_NEW_PROTOCOL_ENFORCEMENT)) +// return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; + + if (IsSporkActive(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; -// if (IsSporkActive(SPORK_15_NEW_PROTOCOL_ENFORCEMENT_2)) -// return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT; return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT; } @@ -7193,97 +7072,6 @@ bool SendMessages(CNode* pto, bool fSendTrickle) GetMainSignals().Broadcast(); } - // - // Try sending block announcements via headers - // - { - // If we have less than MAX_BLOCKS_TO_ANNOUNCE in our - // list of block hashes we're relaying, and our peer wants - // headers announcements, then find the first header - // not yet known to our peer but would connect, and send. - // If no header would connect, or if we have too many - // blocks, or if the peer doesn't want headers, just - // add all to the inv queue. - LOCK(pto->cs_inventory); - vector vHeaders; - bool fRevertToInv = (!state.fPreferHeaders || pto->vBlockHashesToAnnounce.size() > MAX_BLOCKS_TO_ANNOUNCE); - CBlockIndex *pBestIndex = NULL; // last header queued for delivery - ProcessBlockAvailability(pto->id); // ensure pindexBestKnownBlock is up-to-date - if (!fRevertToInv) { - bool fFoundStartingHeader = false; - // Try to find first header that our peer doesn't have, and - // then send all headers past that one. If we come across any - // headers that aren't on chainActive, give up. - BOOST_FOREACH(const uint256 &hash, pto->vBlockHashesToAnnounce) { - BlockMap::iterator mi = mapBlockIndex.find(hash); - assert(mi != mapBlockIndex.end()); - CBlockIndex *pindex = mi->second; - if (chainActive[pindex->nHeight] != pindex) { - // Bail out if we reorged away from this block - fRevertToInv = true; - break; - } - assert(pBestIndex == NULL || pindex->pprev == pBestIndex); - pBestIndex = pindex; - if (fFoundStartingHeader) { - // add this to the headers message - vHeaders.push_back(pindex->GetBlockHeader()); - } else if (PeerHasHeader(&state, pindex)) { - continue; // keep looking for the first new block - } else if (pindex->pprev == NULL || PeerHasHeader(&state, pindex->pprev)) { - // Peer doesn't have this header but they do have the prior one. - // Start sending headers. - fFoundStartingHeader = true; - vHeaders.push_back(pindex->GetBlockHeader()); - } else { - // Peer doesn't have this header or the prior one -- nothing will - // connect, so bail out. - fRevertToInv = true; - break; - } - } - } - if (fRevertToInv) { - // If falling back to using an inv, just try to inv the tip. - // The last entry in vBlockHashesToAnnounce was our tip at some point - // in the past. - if (!pto->vBlockHashesToAnnounce.empty()) { - const uint256 &hashToAnnounce = pto->vBlockHashesToAnnounce.back(); - BlockMap::iterator mi = mapBlockIndex.find(hashToAnnounce); - assert(mi != mapBlockIndex.end()); - CBlockIndex *pindex = mi->second; - // Warn if we're announcing a block that is not on the main chain. - // This should be very rare and could be optimized out. - // Just log for now. - if (chainActive[pindex->nHeight] != pindex) { - LogPrint("net", "Announcing block %s not on main chain (tip=%s)\n", - hashToAnnounce.ToString(), chainActive.Tip()->GetBlockHash().ToString()); - } - // If the peer announced this block to us, don't inv it back. - // (Since block announcements may not be via inv's, we can't solely rely on - // setInventoryKnown to track this.) - if (!PeerHasHeader(&state, pindex)) { - pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce)); - LogPrint("net", "%s: sending inv peer=%d hash=%s\n", __func__, - pto->id, hashToAnnounce.ToString()); - } - } - } else if (!vHeaders.empty()) { - if (vHeaders.size() > 1) { - LogPrint("net", "%s: %u headers, range (%s, %s), to peer=%d\n", __func__, - vHeaders.size(), - vHeaders.front().GetHash().ToString(), - vHeaders.back().GetHash().ToString(), pto->id); - } else { - LogPrint("net", "%s: sending header %s to peer=%d\n", __func__, - vHeaders.front().GetHash().ToString(), pto->id); - } - pto->PushMessage("headers", vHeaders); - state.pindexBestHeaderSent = pBestIndex; - } - pto->vBlockHashesToAnnounce.clear(); - } - // // Message: inventory // diff --git a/src/main.h b/src/main.h index 7d6f04c..9eafb05 100644 --- a/src/main.h +++ b/src/main.h @@ -127,9 +127,6 @@ static const unsigned char REJECT_DUST = 0x41; static const unsigned char REJECT_INSUFFICIENTFEE = 0x42; static const unsigned char REJECT_CHECKPOINT = 0x43; -/** Maximum number of headers to announce when relaying blocks with headers message.*/ -static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; - struct BlockHasher { size_t operator()(const uint256& hash) const { return hash.GetLow64(); } }; diff --git a/src/net.h b/src/net.h index d2fbf65..485775b 100644 --- a/src/net.h +++ b/src/net.h @@ -367,10 +367,6 @@ class CNode std::multimap mapAskFor; std::vector vBlockRequested; - // Used for headers announcements - unfiltered blocks to relay - // Also protected by cs_inventory - std::vector vBlockHashesToAnnounce; - // Ping time measurement: // The pong reply we're expecting, or 0 if no pong expected. uint64_t nPingNonceSent; @@ -475,12 +471,6 @@ class CNode } } - void PushBlockHash(const uint256 &hash) - { - LOCK(cs_inventory); - vBlockHashesToAnnounce.push_back(hash); - } - void AskFor(const CInv& inv); // TODO: Document the postcondition of this function. Is cs_vSend locked? diff --git a/src/ui_interface.h b/src/ui_interface.h index bee72b2..744b32e 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -102,9 +102,6 @@ class CClientUIInterface /** New block has been accepted */ boost::signals2::signal NotifyBlockTip; - /** New block has been accepted and is over a certain size */ - boost::signals2::signal NotifyBlockSize; - /** Banlist did change. */ boost::signals2::signal BannedListChanged; }; diff --git a/src/version.h b/src/version.h index 3a2573e..f336b92 100644 --- a/src/version.h +++ b/src/version.h @@ -11,7 +11,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70035; +static const int PROTOCOL_VERSION = 70040; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -20,8 +20,8 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 70000; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 70010; -static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70030; +static const int MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT = 70030; +static const int MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT = 70040; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this