Skip to content

Commit

Permalink
Merge pull request #16 from coolblock/master
Browse files Browse the repository at this point in the history
Attempt to eliminate frequent splits
  • Loading branch information
coolblock committed Jan 22, 2019
2 parents a0d81ab + 5d19775 commit 99fbadc
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 39 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 12)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 8)
define(_CLIENT_VERSION_BUILD, 10)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2018)
AC_INIT([Vivo Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/vivocoin/vivo/issues],[vivocore])
Expand Down
4 changes: 2 additions & 2 deletions src/activemasternode.cpp
Expand Up @@ -170,7 +170,7 @@ void CActiveMasternode::ManageStateInitial()
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}

/*
int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
if(service.GetPort() != mainnetDefaultPort) {
Expand All @@ -185,7 +185,7 @@ void CActiveMasternode::ManageStateInitial()
LogPrintf("CActiveMasternode::ManageStateInitial -- %s: %s\n", GetStateString(), strNotCapableReason);
return;
}

*/
LogPrintf("CActiveMasternode::ManageStateInitial -- Checking inbound connection to '%s'\n", service.ToString());

if(!ConnectNode((CAddress)service, NULL, true)) {
Expand Down
24 changes: 17 additions & 7 deletions src/chainparams.cpp
Expand Up @@ -130,9 +130,11 @@ class CMainParams : public CChainParams {
assert(consensus.hashGenesisBlock == uint256S("0x00000f6be3e151f9082a2b82c2916192a791090015b80979934a45d625460d62"));
assert(genesis.hashMerkleRoot == uint256S("0x35d3553e7bdc0568c8c37074cb7cc4bd930bd57ceff0799ddb0279487d3fd8df"));


vSeeds.push_back(CDNSSeedData("seed.vivocoinseed.dynu.net", "seednode.vivocoinseed.dynu.net"));
vSeeds.push_back(CDNSSeedData("seeds.vivocoin.net", "seed.seeds.vivocoin.net"));
vSeeds.push_back(CDNSSeedData("seeds.vivocoin.net", "seeds.vivocoin.net"));
vSeeds.push_back(CDNSSeedData("seed.seeds.vivocoin.net", "seed.seeds.vivocoin.net"));
vSeeds.push_back(CDNSSeedData("seed.vivocoinseed.dynu.net", "seed.vivocoinseed.dynu.net"));
vSeeds.push_back(CDNSSeedData("vivoseed.hashcube.com", "vivoseed.hashcube.com"));
vSeeds.push_back(CDNSSeedData("vivoseed.mm.my", "vivoseed.mm.my"));

// Vivo addresses start with 'V'
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,70);
Expand Down Expand Up @@ -169,11 +171,19 @@ class CMainParams : public CChainParams {
( 0, uint256S("0x00000f6be3e151f9082a2b82c2916192a791090015b80979934a45d625460d62"))
( 5290, uint256S("0x000000000346e7d6b167a7aeccf6e521d9d78a7e0fe95f5b47d854b0bfc23654"))
(161000, uint256S("0x0000000000f55b8708a236b2c8057d8396023d5d56ec2d1b120af40e3073755e"))
(304500, uint256S("0x000000001791f3f7d83ddb62333dbeeedcb61403b8931cafe66835edfad20090")),
1542999374, // * UNIX timestamp of last checkpoint block
600000, // * total number of transactions between genesis and last checkpoint
(304500, uint256S("0x000000001791f3f7d83ddb62333dbeeedcb61403b8931cafe66835edfad20090"))
(305000, uint256S("000000000fe61fa890e38551a6b09c885cd654f41929826f5c949c737a62830d"))
(305500, uint256S("000000001357f8392867ce9194e6bf27ab36cf720ca321090a9ba3397852a231"))
(306000, uint256S("000000000a0ceb4c9681b411a39c922bc57717aefe3e621cceb3ff5022e831b4"))
(306500, uint256S("0000000001473705e8838c283bc18bcbecb28d4de047ce7810f89dc15c8f0b85"))
(307000, uint256S("000000000525621400e9d10a79b02237194e34667b73898cd5f9fc99ea58ec7a"))
(337418, uint256S("000000001d8e498bbd22dca1ac0d6e5e234e2cc4e090130299a9a640f6d0a105"))
(307500, uint256S("0000000021ba9398d0458721e41a362396c31abcb751cf4520ce973b5f2d96d6"))
(308000, uint256S("0000000018ee47a3c93296309ce207724868232706f59a6937362581476ce462")),
1543442279, // * UNIX timestamp of last checkpoint block
5000, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
1000 // * estimated number of transactions per day after checkpoint
500 // * estimated number of transactions per day after checkpoint
};
}
};
Expand Down
25 changes: 9 additions & 16 deletions src/chainparamsseeds.h
Expand Up @@ -8,22 +8,15 @@
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*/
static SeedSpec6 pnSeed6_main[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0x83,0xa0,0xd5}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xc8,0x43,0x69}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0x4d,0x62,0x89}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0x46,0xad}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xac,0xa5,0xbd}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xac,0x19,0x62}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2e,0x24,0x24,0xaf}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xac,0x19,0x63}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x50,0xd0,0xe1,0x7f}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x34,0xb2,0x18,0xab}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x0d,0x50,0x40,0x64}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x0d,0x51,0xcb,0xe0}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x50,0xd0,0xe5,0xaa}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xbc,0x78,0xf8,0x80}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x23,0xc5,0x56,0xd3}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x05,0xc4,0x01,0x32}, 12845}
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0xa9,0xd6}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0xf8,0x06,0x4d}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x57,0x8c}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x90,0xca,0x75,0x8f}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0xf6,0x65,0x76}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x20,0x54,0x4f}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0xf6,0x6f,0x75}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0x1c,0x53,0x01}, 12845},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8c,0x52,0x20,0xde}, 12845}
};

static SeedSpec6 pnSeed6_test[] = {
Expand Down
10 changes: 9 additions & 1 deletion src/governance.cpp
Expand Up @@ -108,7 +108,9 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C
if(!masternodeSync.IsBlockchainSynced()) return;

if(pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) return;

if(pfrom->nVersion == 70209) return;
if(pfrom->nVersion == 70208) return;

// ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA
if (strCommand == NetMsgType::MNGOVERNANCESYNC)
{
Expand All @@ -123,6 +125,9 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C

vRecv >> nProp;


if(pfrom->nVersion != 70209)
if(pfrom->nVersion != 70208)
if(pfrom->nVersion >= GOVERNANCE_FILTER_PROTO_VERSION) {
vRecv >> filter;
filter.UpdateEmptyFull();
Expand Down Expand Up @@ -1156,6 +1161,9 @@ int CGovernanceManager::RequestGovernanceObjectVotes(const std::vector<CNode*>&
if(pnode->fMasternode || (fMasterNode && pnode->fInbound)) continue;
// only use up to date peers
if(pnode->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) continue;
if(pnode->nVersion == 70209) continue;
if(pnode->nVersion == 70208) continue;

// stop early to prevent setAskFor overflow
size_t nProjectedSize = pnode->setAskFor.size() + nProjectedVotes;
if(nProjectedSize > SETASKFOR_MAX_SZ/2) continue;
Expand Down
3 changes: 2 additions & 1 deletion src/main.cpp
Expand Up @@ -5267,7 +5267,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CAddress addrFrom;
uint64_t nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)

if (pfrom->nVersion < MIN_PEER_PROTO_VERSION | (pfrom->nVersion == 70209) | (pfrom->nVersion == 70208) )
{
// disconnect from peers older than this proto version
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
Expand Down
6 changes: 6 additions & 0 deletions src/masternode-sync.cpp
Expand Up @@ -487,6 +487,9 @@ void CMasternodeSync::ProcessTick()
netfulfilledman.AddFulfilledRequest(pnode->addr, "governance-sync");

if (pnode->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) continue;
if(pnode->nVersion == 70209) continue;
if(pnode->nVersion == 70208) continue;

nRequestedMasternodeAttempt++;

SendGovernanceSyncRequest(pnode);
Expand All @@ -502,6 +505,9 @@ void CMasternodeSync::ProcessTick()

void CMasternodeSync::SendGovernanceSyncRequest(CNode* pnode)
{
if(pnode->nVersion != 70209)
if(pnode->nVersion != 70208)

if(pnode->nVersion >= GOVERNANCE_FILTER_PROTO_VERSION) {
CBloomFilter filter;
filter.clear();
Expand Down
11 changes: 6 additions & 5 deletions src/masternode.cpp
Expand Up @@ -282,6 +282,7 @@ void CMasternode::Check(bool fForce)
}
}


bool CMasternode::IsValidNetAddr()
{
return IsValidNetAddr(addr);
Expand All @@ -292,7 +293,7 @@ bool CMasternode::IsValidNetAddr(CService addrIn)
// TODO: regtest is fine with any addresses for now,
// should probably be a bit smarter if one day we start to implement tests for this
return Params().NetworkIDString() == CBaseChainParams::REGTEST ||
(addrIn.IsIPv4() && IsReachable(addrIn) && addrIn.IsRoutable());
(IsReachable(addrIn) && addrIn.IsRoutable());
}

masternode_info_t CMasternode::GetInfo()
Expand Down Expand Up @@ -428,7 +429,7 @@ bool CMasternodeBroadcast::Create(std::string strService, std::string strKeyMast
}

CService service = CService(strService);
int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
/*int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
if(service.GetPort() != mainnetDefaultPort) {
strErrorRet = strprintf("Invalid port %u for masternode %s, only %d is supported on mainnet.", service.GetPort(), strService, mainnetDefaultPort);
Expand All @@ -440,7 +441,7 @@ bool CMasternodeBroadcast::Create(std::string strService, std::string strKeyMast
LogPrintf("CMasternodeBroadcast::Create -- %s\n", strErrorRet);
return false;
}

*/
return Create(txin, CService(strService), keyCollateralAddressNew, pubKeyCollateralAddressNew, keyMasternodeNew, pubKeyMasternodeNew, strErrorRet, mnbRet);
}

Expand Down Expand Up @@ -536,10 +537,10 @@ bool CMasternodeBroadcast::SimpleCheck(int& nDos)
}

int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
/*if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
if(addr.GetPort() != mainnetDefaultPort) return false;
} else if(addr.GetPort() == mainnetDefaultPort) return false;

*/
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/masternode.h
Expand Up @@ -18,8 +18,8 @@ class CMasternodePing;
static const int MASTERNODE_CHECK_SECONDS = 5;
static const int MASTERNODE_MIN_MNB_SECONDS = 5 * 60;
static const int MASTERNODE_MIN_MNP_SECONDS = 10 * 60;
static const int MASTERNODE_EXPIRATION_SECONDS = 65 * 60;
static const int MASTERNODE_WATCHDOG_MAX_SECONDS = 120 * 60;
static const int MASTERNODE_EXPIRATION_SECONDS = 120 * 60; // added hour
static const int MASTERNODE_WATCHDOG_MAX_SECONDS = 150 * 60; //added 30 minutes
static const int MASTERNODE_NEW_START_REQUIRED_SECONDS = 180 * 60;

static const int MASTERNODE_POSE_BAN_MAX_SCORE = 5;
Expand Down
4 changes: 2 additions & 2 deletions src/masternodeconfig.cpp
Expand Up @@ -65,7 +65,7 @@ bool CMasternodeConfig::read(std::string& strErr) {
return false;
}
int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
/*if(Params().NetworkIDString() == CBaseChainParams::MAIN) {
if(port != mainnetDefaultPort) {
strErr = _("Invalid port detected in masternode.conf") + "\n" +
strprintf(_("Port: %d"), port) + "\n" +
Expand All @@ -81,7 +81,7 @@ bool CMasternodeConfig::read(std::string& strErr) {
streamConfig.close();
return false;
}

*/

add(alias, ip, privKey, txHash, outputIndex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/net.cpp
Expand Up @@ -1408,7 +1408,7 @@ void ThreadDNSAddressSeed()
MilliSleep(11 * 1000);

LOCK(cs_vNodes);
if (vNodes.size() >= 2) {
if (vNodes.size() >= 500) {
LogPrintf("P2P peers available. Skipped DNS seeding.\n");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Expand Up @@ -10,7 +10,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 70206;
static const int PROTOCOL_VERSION = 70210;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down

0 comments on commit 99fbadc

Please sign in to comment.