Skip to content

Commit

Permalink
GUI wallet stability improved
Browse files Browse the repository at this point in the history
fix TX filter initialization
  • Loading branch information
SkaZun committed Feb 22, 2019
1 parent bb22ee5 commit 107bf0c
Show file tree
Hide file tree
Showing 22 changed files with 245 additions and 255 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_REVISION, 4)
define(_CLIENT_VERSION_BUILD, 7)
define(_CLIENT_VERSION_BUILD, 14)
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: 7 additions & 7 deletions src/chainparams.cpp
Expand Up @@ -110,7 +110,7 @@ class CMainParams : public CChainParams
nPoSTargetSpacing = 60; // 1 minute
nMaturity = 40;
nMasternodeCountDrift = 3;
nMaxMoneyOut = 13994245 * COIN;
nMaxMoneyOut = 25481245 * COIN;
nStartMasternodePaymentsBlock = 100;

/** Height or Time Based Activations **/
Expand Down Expand Up @@ -220,12 +220,12 @@ class CTestNetParams : public CMainParams
nMaxMoneyOut = 1000000000 * COIN;

//! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1541462411;
genesis.nNonce = 290796;
genesis.nTime = 1546300800;
genesis.nNonce = 0;

hashGenesisBlock = genesis.GetHash();

//assert(hashGenesisBlock == uint256("0"));
assert(hashGenesisBlock == uint256("019a701040d795514ea77eda681e74f8de73afdb1b39d541fc0c697585b878dc"));

vFixedSeeds.clear();
vSeeds.clear();
Expand All @@ -248,9 +248,9 @@ class CTestNetParams : public CMainParams

nPoolMaxTransactions = 2;

vAlertPubKey = ParseHex("0428e89226dd86459df40d436a067c83749c78d653e22c556ae2d9b322296f3f1604e2f4789128386bc4acd6184c9a0062cf0cb98cf71cdbca1e808c25b7670367");
vGMPubKey = ParseHex("049e20bd6cc0da7270bfa60daf381593377418ce9270b7dd38a93026acae98966e89da65067b41e388e194a7e4e2276336b3ddba5e3d5bbc81a78a04f982dfb4fc");
strSporkKey = "0416726a44c09752eddf582f08ad668bd49d563322a6ad746347eb6874bbfce2a6ce12c0f991fed88289d977395e1814a0cc1778f24ee2eeaa68d58183f3bd6195";
vAlertPubKey = ParseHex("04e2a902b30e8e5430e4f3d1ac79630282cc65a036d0aa70ec041d8903b9a626b601a888d8479412bcc363250b02cb2f0e783e7dbeef8606a6ab635fde952949f9");
vGMPubKey = ParseHex("0414b78fd29848ca55bacabe49c6bf53c8cb5224cdd84590f21616457c564b01d2c26c69fea8a55b5e336cb40981ba3167b04ddd149a21f59ab07cf30a4b7285b1");
strSporkKey = "043f305881c14698ca11d9ccbbef49714a816da377bcc0b25d2d54e5a5b266605353e5ec4c7f9958899b5e7a550225d652151ada50d040277ef75ada1214f92e77";
strObfuscationPoolDummyAddress = "xJR9MjNhPLKLLCowMWNznC9gkEQHQPjcJr";

}
Expand Down
3 changes: 2 additions & 1 deletion src/clientversion.cpp
Expand Up @@ -88,7 +88,8 @@ static std::string FormatVersion(int nVersion)

std::string FormatFullVersion()
{
return "2.0.4.7";
return strprintf("%d.%d.%d.%d", CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD);
// return "2.0.4.11";
// return CLIENT_BUILD;
}

Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Expand Up @@ -17,7 +17,7 @@
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 4
#define CLIENT_VERSION_BUILD 7
#define CLIENT_VERSION_BUILD 14

//! Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
Expand Down
75 changes: 56 additions & 19 deletions src/main.cpp
Expand Up @@ -1661,24 +1661,48 @@ CAmount GetBlockValue(int nHeight)
// anti instamine
int64_t nSubsidy = 0;

if ( nHeight == 0 ) {
nSubsidy = 1000000 * COIN; // premine
} else if (nHeight < 200) {
nSubsidy = 0 * COIN;
} else if (nHeight >= 200 && nHeight < 5050) {
nSubsidy = 5 * COIN;
} else if (nHeight >= 5050 && nHeight < 26551) {
nSubsidy = 30 * COIN;
} else if (nHeight >= 26551 && nHeight < 48052) {
nSubsidy = 40 * COIN;
} else if (nHeight >= 48052 && nHeight < 69553) {
nSubsidy = 50 * COIN;
} else if (nHeight >= 69553 && nHeight < 96804) {
nSubsidy = 60 * COIN;
} else if (nHeight >= 96804 && nHeight < 187805) {
nSubsidy = 55 * COIN;
} else if (nHeight >= 187805) {
nSubsidy = 50 * COIN;
if (Params().NetworkID() == CBaseChainParams::TESTNET){
if ( nHeight == 0 ) {
nSubsidy = 10000000 * COIN; // premine
} else if (nHeight < 200) {
nSubsidy = 200 * COIN;
} else if (nHeight >= 200 && nHeight < 2000) {
nSubsidy = 50 * COIN;
} else if (nHeight >= 2000 && nHeight < 4000) {
nSubsidy = 40 * COIN;
} else if (nHeight >= 4000 && nHeight < 6000) {
nSubsidy = 30 * COIN;
} else if (nHeight >= 6000 && nHeight < 8000) {
nSubsidy = 20 * COIN;
} else if (nHeight >= 8000) {
nSubsidy = 10 * COIN;
}
} else {
if ( nHeight == 0 ) {
nSubsidy = 1000000 * COIN; // premine
} else if (nHeight < 200) {
nSubsidy = 0 * COIN;
} else if (nHeight >= 200 && nHeight < 5050) {
nSubsidy = 5 * COIN;
} else if (nHeight >= 5050 && nHeight < 26551) {
nSubsidy = 30 * COIN;
} else if (nHeight >= 26551 && nHeight < 48052) {
nSubsidy = 40 * COIN;
} else if (nHeight >= 48052 && nHeight < 69553) {
nSubsidy = 50 * COIN;
} else if (nHeight >= 69553 && nHeight < 96804) {
nSubsidy = 60 * COIN;
} else if (nHeight >= 96804 && nHeight < 187805) {
nSubsidy = 55 * COIN;
} else if (nHeight >= 187805 && nHeight < 392807) {
nSubsidy = 50 * COIN;
} else if (nHeight >= 392807 && nHeight < 522808) {
nSubsidy = 25 * COIN;
} else if (nHeight >= 522808 && nHeight < 652809) {
nSubsidy = 12.5 * COIN;
} else if (nHeight >= 652809) {
nSubsidy = 6.25 * COIN;
}
}

// Check if we reached the coin max supply.
Expand Down Expand Up @@ -2055,6 +2079,11 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
}
}

if (txFilterState && txFilterTarget > pindex->nHeight) {
setFilterAddress.clear();
txFilterState = false;
}

// move best block pointer to prevout block
view.SetBestBlock(pindex->pprev->GetBlockHash());

Expand Down Expand Up @@ -2293,6 +2322,9 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
}
}

if (!txFilterState && txFilterTarget > pindex->nHeight)
InitTxFilter();

// add this block to the view's block chain
view.SetBestBlock(pindex->GetBlockHash());

Expand Down Expand Up @@ -5027,6 +5059,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,

mapAlreadyAskedFor.erase(inv);

if (!txFilterState) {
LogPrintf("Transaction not accepted because txFilter not initialized. tx=%s\n", tx.GetHash().ToString());
return true;
}

if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs, false, ignoreFees)) {
mempool.check(pcoinsTip);
RelayTransaction(tx);
Expand Down Expand Up @@ -5450,7 +5487,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,

int ActiveProtocol()
{
// if (IsSporkActive(SPORK_8_NEW_PROTOCOL_ENFORCEMENT)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;
if (IsSporkActive(SPORK_10_NEW_PROTOCOL_ENFORCEMENT_2)) return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;

return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT;
}
Expand Down
1 change: 1 addition & 0 deletions src/masternode-sync.cpp
Expand Up @@ -156,6 +156,7 @@ void CMasternodeSync::GetNextAsset()
case (MASTERNODE_SYNC_GM):
LogPrintf("CMasternodeSync::GetNextAsset - Sync has finished\n");
RequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED;
if (!txFilterState) InitTxFilter();
break;
}
RequestedMasternodeAttempt = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/pow.cpp
Expand Up @@ -13,6 +13,7 @@
#include "primitives/block.h"
#include "uint256.h"
#include "util.h"
#include "spork.h"

#include <math.h>

Expand All @@ -37,7 +38,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast)
if (pindexLast->nHeight >= Params().LAST_POW_BLOCK()) {
uint256 bnTargetLimit = (~uint256(0) >> 24);
int64_t nTargetSpacing = Params().PoSTargetSpacing(); // 60;
int64_t nTargetTimespan = Params().PoSTargetSpacing() /*60*/ * 40;
if (ActiveProtocol() >= 70223) //IsSporkActive(SPORK_10_NEW_PROTOCOL_ENFORCEMENT_2))
nTargetSpacing = 120; // 2 min. block time after fork
int64_t nTargetTimespan = nTargetSpacing /*60*/ * 40;

int64_t nActualSpacing = 0;
if (pindexLast->nHeight != 0)
Expand Down

0 comments on commit 107bf0c

Please sign in to comment.