Skip to content

Commit f81de9f

Browse files
author
limxdev
committed
Merge branch 'master-0.17' of https://github.com/LIMXTEC/BitSend into master-0.17
2 parents 301478c + 508fde0 commit f81de9f

6 files changed

Lines changed: 72 additions & 40 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Bitsend Core integration/staging tree
22
=====================================
33

4-
[![Build Status](https://travis-ci.org/LIMXTEC/BitSend.svg?branch=master)](https://travis-ci.org/LIMXTEC/BitSend)
54

65
https://bitsend.cc
76

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
22
AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 0)
44
define(_CLIENT_VERSION_MINOR, 17)
5-
define(_CLIENT_VERSION_REVISION, 0)
5+
define(_CLIENT_VERSION_REVISION, 9)
66
define(_CLIENT_VERSION_BUILD, 1)
77
define(_CLIENT_VERSION_IS_RELEASE, true)
8-
define(_COPYRIGHT_YEAR, 2020)
8+
define(_COPYRIGHT_YEAR, 2021)
99
define(_COPYRIGHT_HOLDERS,[The %s developers])
1010
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Bitsend Core]])
1111
AC_INIT([Bitsend Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/LIMXTEC/BitSend/issues],[bitsend],[https://bitsend.cc/])

src/chainparams.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ class CRegTestParams : public CChainParams {
277277
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
278278
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
279279
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
280-
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
281-
consensus.nPowTargetSpacing = 10 * 60;
280+
consensus.nPowTargetTimespan = 160 * 60; // BSD 17.9
281+
consensus.nPowTargetSpacing = 2.5 * 60; // BSD 17.9
282282
consensus.fPowAllowMinDifficultyBlocks = true;
283283
consensus.fPowNoRetargeting = true;
284284
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains

src/pow.cpp

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
unsigned int static DUAL_KGW3(const CBlockIndex* pindexLast, const Consensus::Params& params, const CBlockHeader *pblock)
1818
{
19-
// current difficulty formula, ERC3 - DUAL_KGW3, written by Christian Knoepke - apfelbaum@email.de
20-
// BitSend and Eropecoin Developer
2119
const CBlockIndex *BlockLastSolved = pindexLast;
2220
const CBlockIndex *BlockReading = pindexLast;
2321
bool kgwdebug=false;
@@ -150,7 +148,56 @@ unsigned int static DUAL_KGW3(const CBlockIndex* pindexLast, const Consensus::Pa
150148
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
151149
{
152150
//Initial DK3
153-
return DUAL_KGW3(pindexLast, params, pblock);
151+
int Diff_Fork1 = 951000;
152+
assert(pindexLast != nullptr);
153+
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
154+
if (pindexLast->nHeight+1 <= Diff_Fork1)
155+
{
156+
return DUAL_KGW3(pindexLast, params, pblock);
157+
}
158+
//// Update 0.17.9 BSD
159+
// Genesis block
160+
if (pindexLast == NULL)
161+
return nProofOfWorkLimit;
162+
163+
// Only change once per difficulty adjustment interval
164+
if ((pindexLast->nHeight+1) % params.DifficultyAdjustmentInterval() != 0)
165+
{
166+
if (params.fPowAllowMinDifficultyBlocks)
167+
{
168+
// Special difficulty rule for testnet:
169+
// If the new block's timestamp is more than 2* 10 minutes
170+
// then allow mining of a min-difficulty block.
171+
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2)
172+
return nProofOfWorkLimit;
173+
else
174+
{
175+
// Return the last non-special-min-difficulty-rules-block
176+
const CBlockIndex* pindex = pindexLast;
177+
while (pindex->pprev && pindex->nHeight % params.DifficultyAdjustmentInterval() != 0 && pindex->nBits == nProofOfWorkLimit)
178+
pindex = pindex->pprev;
179+
return pindex->nBits;
180+
}
181+
}
182+
// LogPrintf("difficulty adjustment interval %d \n",(pindexLast->nHeight+1) % params.DifficultyAdjustmentInterval());
183+
return pindexLast->nBits;
184+
}
185+
186+
// Go back by what we want to be 14 days worth of blocks
187+
// Litecoin: This fixes an issue where a 51% attack can change difficulty at will.
188+
// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
189+
int blockstogoback = params.DifficultyAdjustmentInterval()-1;
190+
if ((pindexLast->nHeight+1) != params.DifficultyAdjustmentInterval())
191+
blockstogoback = params.DifficultyAdjustmentInterval();
192+
193+
// Go back by what we want to be 14 days worth of blocks
194+
const CBlockIndex* pindexFirst = pindexLast;
195+
for (int i = 0; pindexFirst && i < blockstogoback; i++)
196+
pindexFirst = pindexFirst->pprev;
197+
198+
assert(pindexFirst);
199+
return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params);
200+
//// Update 0.17.9 BSD END
154201

155202
}
156203

@@ -161,10 +208,10 @@ unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nF
161208

162209
// Limit adjustment step
163210
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
164-
if (nActualTimespan < params.nPowTargetTimespan/4)
165-
nActualTimespan = params.nPowTargetTimespan/4;
166-
if (nActualTimespan > params.nPowTargetTimespan*4)
167-
nActualTimespan = params.nPowTargetTimespan*4;
211+
if (nActualTimespan < params.nPowTargetTimespan/1.2)
212+
nActualTimespan = params.nPowTargetTimespan/1.2;
213+
if (nActualTimespan > params.nPowTargetTimespan*1.2)
214+
nActualTimespan = params.nPowTargetTimespan*1.2;
168215

169216
// Retarget
170217
const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);

src/qt/splashscreen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const Netw
4343
QString titleText = tr(PACKAGE_NAME);
4444
QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
4545
versionText = versionText.rightJustified(25, '.', true);
46-
QString copyrightText = "Welcome to Bitsend Core\n0.17.0.x\n\nOfficial website\nbitsend.cc";
46+
QString copyrightText = "Welcome to Bitsend Core\n\nOfficial website\nbitsend.cc";
4747
//QString copyrightText = QString::fromUtf8(CopyrightHolders(strprintf("\xc2\xA9 %u-%u ", 2009, COPYRIGHT_YEAR)).c_str());
4848
QString titleAddText = networkStyle->getTitleAddText();
4949

src/validation.cpp

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,14 +1220,19 @@ bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const CBlockIndex* pindex
12201220
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
12211221
{
12221222

1223+
//FORKX17_Main_Net = 240000
12231224
CAmount nSubsidy = 50 * COIN;
12241225

12251226
if (nHeight <= 2)
12261227
nSubsidy = 1306400 * COIN;
12271228

1229+
12281230
if (nHeight > (FORKX17_Main_Net-1000))nSubsidy = 25 * COIN;
1229-
if (nHeight >= ((FORKX17_Main_Net*33)-50256))nSubsidy = 1/10 * COIN;
1230-
1231+
if (nHeight > (950000))nSubsidy = 12.5 * COIN;
1232+
if (nHeight > (1000000))nSubsidy = 6.25 * COIN;
1233+
if (nHeight > (1050000))nSubsidy = 3.125 * COIN;
1234+
if (nHeight > (1100000))nSubsidy = 1.5625 * COIN;
1235+
// In the last stage we will generate 315000 BSD per year
12311236

12321237
return nSubsidy;
12331238
}
@@ -1236,7 +1241,12 @@ CAmount GetMasternodePayment(int nHeight, CAmount blockValue)
12361241
{
12371242
CAmount ret = blockValue/5; // start at 20%
12381243

1239-
1244+
if(nHeight >= 1000000)
1245+
{
1246+
// We change it to 50%
1247+
ret = blockValue / 2;
1248+
return ret;
1249+
}
12401250

12411251
if(nHeight > 140500) ret += blockValue / 20;
12421252
// 140500
@@ -1262,30 +1272,6 @@ CAmount GetMasternodePayment(int nHeight, CAmount blockValue)
12621272
// 235540
12631273
if(nHeight > 140500+((288*30)* 11)) ret += blockValue / 20;
12641274
// 244180
1265-
/* For later Stop by 20% /80%
1266-
if(nHeight > 140500+((288*30)* 12)) ret += blockValue / 50;
1267-
// 252820
1268-
if(nHeight > 140500+((288*30)* 13)) ret += blockValue / 50;
1269-
// 261460
1270-
if(nHeight > 140500+((288*30)* 14)) ret += blockValue / 50;
1271-
// 270100
1272-
if(nHeight > 140500+((288*30)* 15)) ret += blockValue / 50;
1273-
// 278740
1274-
if(nHeight > 140500+((288*30)* 16)) ret += blockValue / 50;
1275-
// 287380
1276-
if(nHeight > 140500+((288*30)* 17)) ret += blockValue / 50;
1277-
// 296020
1278-
if(nHeight > 140500+((288*30)* 18)) ret += blockValue / 50;
1279-
// 304660
1280-
if(nHeight > 140500+((288*30)* 19)) ret += blockValue / 50;
1281-
// 313300
1282-
if(nHeight > 140500+((288*30)* 20)) ret += blockValue / 50;
1283-
// 321940
1284-
if(nHeight > 140500+((288*30)* 21)) ret += blockValue / 100;
1285-
*/
1286-
// LogPrintf("Zugriff main.cpp 1448 blockValue %u\n", blockValue);
1287-
1288-
12891275
return ret;
12901276
}
12911277

0 commit comments

Comments
 (0)