Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
SkaZun committed Mar 25, 2019
2 parents 39b20cf + f5ecfa8 commit 95d93f5
Show file tree
Hide file tree
Showing 122 changed files with 3,970 additions and 1,211 deletions.
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 4)
define(_CLIENT_VERSION_BUILD, 14)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
AC_INIT([ESBC Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[http://esbproject.online/],[esbcoin])
Expand Down
14 changes: 12 additions & 2 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,22 @@ RES_IMAGES = \
qt/res/dark/images/upArrow_small.png \
qt/res/dark/images/leftArrow_small.png \
qt/res/dark/images/rightArrow_small.png \
qt/res/dark/images/qtreeview_selected.png
qt/res/dark/images/qtreeview_selected.png\
qt/res/dblue/images/about.png \
qt/res/dblue/images/splash.png \
qt/res/dblue/images/frame_blue.png \
qt/res/dblue/images/downArrow.png \
qt/res/dblue/images/downArrow_small.png \
qt/res/dblue/images/upArrow_small.png \
qt/res/dblue/images/leftArrow_small.png \
qt/res/dblue/images/rightArrow_small.png \
qt/res/dblue/images/qtreeview_selected.png


RES_CSS = \
qt/res/css/default.css \
qt/res/dark/css/dark.css
qt/res/css/dblue.css \
qt/res/css/dark.css

RES_MOVIES = $(wildcard $(srcdir)/qt/res/movies/spinner-*.png) \
$(wildcard $(srcdir)/qt/res/dark/movies/spinner-*.png)
Expand Down
4 changes: 2 additions & 2 deletions src/activemasternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void CActiveMasternode::ManageStatus()
pmn = mnodeman.Find(pubKeyMasternode);
if (pmn != NULL) {
pmn->Check();
if (pmn->IsEnabled() && pmn->protocolVersion == PROTOCOL_VERSION)
if (pmn->IsEnabled() && pmn->protocolVersion >= ActiveProtocol())
EnableHotColdMasterNode(pmn->vin, pmn->addr);
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@ bool CActiveMasternode::SendMasternodePing(std::string& errorMessage)
// Update lastPing for our masternode in Masternode list
CMasternode* pmn = mnodeman.Find(vin);
if (pmn != NULL) {
if (pmn->IsPingedWithin(MASTERNODE_PING_SECONDS, mnp.sigTime)) {
if (pmn->IsPingedWithin((ActiveProtocol() >= CONSENSUS_FORK_PROTO) ? MASTERNODE_PING_SECONDS2 : MASTERNODE_PING_SECONDS, mnp.sigTime)) {
errorMessage = "Too early to send Masternode Ping";
return false;
}
Expand Down
12 changes: 8 additions & 4 deletions src/amount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "amount.h"

#include "spork.h"
#include "tinyformat.h"

CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
Expand All @@ -17,10 +17,14 @@ CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)

CAmount CFeeRate::GetFee(size_t nSize) const
{
CAmount nFee = nSatoshisPerK * nSize / 1000;
CAmount nFeePerK = nSatoshisPerK;
if (ActiveProtocol() >= CONSENSUS_FORK_PROTO && nFeePerK == 10000)
nFeePerK = 250000;

CAmount nFee = nFeePerK * nSize / 1000;

if (nFee == 0 && nSatoshisPerK > 0)
nFee = nSatoshisPerK;
if (nFee == 0 && nFeePerK > 0)
nFee = nFeePerK;

return nFee;
}
Expand Down
13 changes: 7 additions & 6 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ class CMainParams : public CChainParams
vSeeds.push_back(CDNSSeedData("", "144.202.22.6"));
vSeeds.push_back(CDNSSeedData("", "144.202.16.146"));
vSeeds.push_back(CDNSSeedData("", "144.202.30.41"));
// vSeeds.push_back(CDNSSeedData("", "188.225.77.175"));
// vSeeds.push_back(CDNSSeedData("", "188.225.77.88"));
// vSeeds.push_back(CDNSSeedData("", "188.225.77.84"));
// vSeeds.push_back(CDNSSeedData("", "188.225.77.83"));
// vSeeds.push_back(CDNSSeedData("", "188.225.77.82"));
vSeeds.push_back(CDNSSeedData("", "79.143.187.24"));

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, 92); // e
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, 63); // S
Expand All @@ -175,6 +171,9 @@ class CMainParams : public CChainParams

nPoolMaxTransactions = 3;

nStakeInputMin = 10 * COIN;
strDevFeeAddress = "eDevFundRTnKngZ3zFPPaqaTuvKvGVdStf";

vAlertPubKey = ParseHex("0428e89226dd86459df40d436a067c83749c78d653e22c556ae2d9b322296f3f1604e2f4789128386bc4acd6184c9a0062cf0cb98cf71cdbca1e808c25b7670367");
vGMPubKey = ParseHex("049e20bd6cc0da7270bfa60daf381593377418ce9270b7dd38a93026acae98966e89da65067b41e388e194a7e4e2276336b3ddba5e3d5bbc81a78a04f982dfb4fc");
strSporkKey = "0416726a44c09752eddf582f08ad668bd49d563322a6ad746347eb6874bbfce2a6ce12c0f991fed88289d977395e1814a0cc1778f24ee2eeaa68d58183f3bd6195";
Expand Down Expand Up @@ -213,7 +212,7 @@ class CTestNetParams : public CMainParams
nToCheckBlockUpgradeMajority = 100;
nMinerThreads = 0;
nTargetSpacing = 1 * 60; // 1 minute
nLastPOWBlock = std::numeric_limits<decltype(nLastPOWBlock)>::max();
// nLastPOWBlock = std::numeric_limits<decltype(nLastPOWBlock)>::max();
nMaturity = 15;
nMasternodeCountDrift = 4;
nModifierUpdateBlock = std::numeric_limits<decltype(nModifierUpdateBlock)>::max();
Expand Down Expand Up @@ -247,6 +246,8 @@ class CTestNetParams : public CMainParams
fTestnetToBeDeprecatedFieldRPC = true;

nPoolMaxTransactions = 2;
nStakeInputMin = 1 * COIN;
strDevFeeAddress = "xJETLzAQWJj18aQ74cHqAtdStrZves2U4A";

vAlertPubKey = ParseHex("04e2a902b30e8e5430e4f3d1ac79630282cc65a036d0aa70ec041d8903b9a626b601a888d8479412bcc363250b02cb2f0e783e7dbeef8606a6ab635fde952949f9");
vGMPubKey = ParseHex("0414b78fd29848ca55bacabe49c6bf53c8cb5224cdd84590f21616457c564b01d2c26c69fea8a55b5e336cb40981ba3167b04ddd149a21f59ab07cf30a4b7285b1");
Expand Down
4 changes: 4 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class CChainParams
int LAST_POW_BLOCK() const { return nLastPOWBlock; }
int StartMNPaymentsBlock() const {return nStartMasternodePaymentsBlock; }

std::string DevFeeAddress() const { return strDevFeeAddress; }
CAmount StakeInputMin() const { return nStakeInputMin; }

protected:
CChainParams() {}
Expand Down Expand Up @@ -160,6 +162,8 @@ class CChainParams
std::string strSporkKey;
std::string strObfuscationPoolDummyAddress;
int64_t nStartMasternodePayments;
std::string strDevFeeAddress;
CAmount nStakeInputMin;
};

/**
Expand Down
6 changes: 3 additions & 3 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

//! These need to be macros, as clientversion.cpp's and esbcoin*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_BUILD 14
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 1

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
39 changes: 27 additions & 12 deletions src/gm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ std::map<int, std::pair<CPubKey, int>> mapGMSigners;

void ProcessGM(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
{
if (chainActive.Tip() == NULL)
return;

if (strCommand == "gm") {
CGM message;
vRecv >> message;

if (chainActive.Tip() == NULL) return;

uint256 messageHash = message.GetHash();
if (pfrom->setKnown.count(messageHash) == 0) {
if (message.ProcessMessage()) {
Expand All @@ -61,15 +62,31 @@ void ProcessGM(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
}
}
}

if (strCommand == "getgm") {
else if (strCommand == "getgm") {
{
LOCK(cs_mapGMs);

CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
for (auto& item : mapGMs)
ss << item.second;
pfrom->PushMessage("gmsync", ss);
/*
map<uint256, CGM>::iterator it = mapGMs.begin();
while (it != mapGMs.end()) {
pfrom->PushMessage("gm", it->second);
it++;
}
*/
}
}
else if (strCommand == "gmsync") {
CGM message;
while (!vRecv.empty()) {
//message.SetNull();
vRecv >> message;
uint256 messageHash = message.GetHash();
if (pfrom->setKnown.count(messageHash) == 0 && message.ProcessMessage())
pfrom->setKnown.insert(messageHash);
}
}
}
Expand Down Expand Up @@ -132,7 +149,7 @@ uint256 CGM::GetHash() const

bool CGM::IsInEffect() const
{
return (GetAdjustedTime() < nExpiration);
return (GetTime() < nExpiration);
}

bool CGM::Cancels(const CGM& message) const
Expand Down Expand Up @@ -185,13 +202,11 @@ bool CGM::CheckSignature(int& sLevel) const
return error("CGM::CheckSignature() : verify GM signature failed");
} else {
std::map<int, std::pair<CPubKey, int>>::iterator it = mapGMSigners.find(nSignerID);
if (it == mapGMSigners.end()) {
if (it == mapGMSigners.end())
return error("CGM::CheckSignature() : signer not found");
} else {
if (!it->second.first.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
return error("CGM::CheckSignature() : verify signature failed");
sLevel = !it->second.second;
}
if (!it->second.first.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
return error("CGM::CheckSignature() : verify signature failed");
sLevel = it->second.second;
}

return true;
Expand Down Expand Up @@ -243,7 +258,7 @@ bool CGM::ProcessMessage(bool fThread)

// check transfer message age
if (sLevel == 1) {
if ( (GetAdjustedTime() + 60) < nExpiration ) {
if ( (GetTime() + 60) < nExpiration ) {
LogPrint("gm", "too long active time requested\n");
return false;
}
Expand Down
10 changes: 4 additions & 6 deletions src/gm.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers
// Copyright (c) 2018 e-Sport Betting Coin developers
// Copyright (c) 2018-2019 The ESBC Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

//#ifndef BITCOIN_ALERT_H
//#define BITCOIN_ALERT_H
#ifndef ESPB_GM_H
#define ESPB_GM_H
#ifndef ESBC_GM_H
#define ESBC_GM_H

#include "base58.h"
#include "key.h"
Expand Down Expand Up @@ -112,4 +110,4 @@ class CGM : public CUnsignedMessage
static CGM getMessageByHash(const uint256& hash);
};

#endif // ESPB_GM_H // BITCOIN_ALERT_H
#endif // ESBC_GM_H
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,7 @@ bool AppInit2(boost::thread_group& threadGroup)
threadGroup.create_thread(boost::bind(&ThreadCheckObfuScationPool));

// ********************************************************* Step 11: start node
InitTxFilter();

if (!CheckDiskSpace())
return false;
Expand Down
16 changes: 12 additions & 4 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "db.h"
#include "kernel.h"
#include "spork.h"
#include "script/interpreter.h"
#include "timedata.h"
#include "util.h"
Expand Down Expand Up @@ -243,7 +244,7 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64_t& nStakeMod

// The stake modifier used to hash for a stake kernel is chosen as the stake
// modifier about a selection interval later than the coin generating the kernel
bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake)
bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake, int64_t nTime)
{
nStakeModifier = 0;
if (!mapBlockIndex.count(hashBlockFrom))
Expand All @@ -252,6 +253,8 @@ bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier, int
nStakeModifierHeight = pindexFrom->nHeight;
nStakeModifierTime = pindexFrom->GetBlockTime();
int64_t nStakeModifierSelectionInterval = GetStakeModifierSelectionInterval();
if (ActiveProtocol() >= CONSENSUS_FORK_PROTO && nTime >= GetSporkValue(SPORK_10_NEW_PROTOCOL_ENFORCEMENT_2))
nStakeModifierSelectionInterval = nStakeMinAge * 3 / 4;
const CBlockIndex* pindex = pindexFrom;
CBlockIndex* pindexNext = chainActive[pindexFrom->nHeight + 1];

Expand Down Expand Up @@ -302,7 +305,7 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock blockFrom, const CTra
return error("CheckStakeKernelHash() : nTime violation");

if (nTimeBlockFrom + nStakeMinAge > nTimeTx) // Min age requirement
return error("CheckStakeKernelHash() : min age violation - nTimeBlockFrom=%d nStakeMinAge=%d nTimeTx=%d", nTimeBlockFrom, nStakeMinAge, nTimeTx);
return false; //error("CheckStakeKernelHash() : min age violation - nTimeBlockFrom=%d nStakeMinAge=%d nTimeTx=%d", nTimeBlockFrom, nStakeMinAge, nTimeTx);

//grab difficulty
uint256 bnTargetPerCoinDay;
Expand All @@ -312,7 +315,7 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock blockFrom, const CTra
uint64_t nStakeModifier = 0;
int nStakeModifierHeight = 0;
int64_t nStakeModifierTime = 0;
if (!GetKernelStakeModifier(blockFrom.GetHash(), nStakeModifier, nStakeModifierHeight, nStakeModifierTime, fPrintProofOfStake)) {
if (!GetKernelStakeModifier(blockFrom.GetHash(), nStakeModifier, nStakeModifierHeight, nStakeModifierTime, fPrintProofOfStake, nTimeTx)) {
LogPrintf("CheckStakeKernelHash(): failed to get kernel stake modifier \n");
return false;
}
Expand Down Expand Up @@ -400,8 +403,13 @@ bool CheckProofOfStake(const CBlock block, uint256& hashProofOfStake)
if (!ReadBlockFromDisk(blockprev, pindex->GetBlockPos()))
return error("CheckProofOfStake(): INFO: failed to find block");

unsigned int nInterval = 0;
unsigned int nTime = block.nTime;
if (ActiveProtocol() >= CONSENSUS_FORK_PROTO &&
nTime >= GetSporkValue(SPORK_10_NEW_PROTOCOL_ENFORCEMENT_2) &&
txPrev.vout[txin.prevout.n].nValue < Params().StakeInputMin())
return error("CheckProofOfStake(): stake input below minimal value");

unsigned int nInterval = 0;
if (!CheckStakeKernelHash(block.nBits, blockprev, txPrev, txin.prevout, nTime, nInterval, true, hashProofOfStake, fDebug))
return error("CheckProofOfStake() : INFO: check kernel failed on coinstake %s, hashProof=%s \n", tx.GetHash().ToString().c_str(), hashProofOfStake.ToString().c_str()); // may occur during initial download or if behind on block chain sync

Expand Down
Loading

0 comments on commit 95d93f5

Please sign in to comment.