Skip to content

Commit

Permalink
EMERGENCY UPDATE:
Browse files Browse the repository at this point in the history
fix kimoto gravity well exploit
https://bitcointalk.org/index.php?topic=552895.0
  • Loading branch information
hbastidas committed Feb 27, 2019
1 parent ef4a68b commit afa1242
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion coin-qt.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = ONIX-qt
VERSION = 1.1.0.0
VERSION = 1.1.1.0
INCLUDEPATH += src src/json src/qt
QT += network
DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
Expand Down
24 changes: 22 additions & 2 deletions src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,33 @@ namespace Checkpoints
( 269146, uint256("0x0000000000029793ce6a0855c6d5deb21e34e6dad33917c0f48efed30821d16f"))
( 269149, uint256("0x00000000000433a3c3442ce9fdb772a2ce1130512e9536283da516cc3f440dc8"))
( 269168, uint256("0x000000000004edc83638eddda4c889a9c269b88b923ec7c70803cf38068ab393"))
( 300000, uint256("0x00000000000502760fe120b5be6f315513af417cd7942ce4f760399d7fe37707"))
( 301000, uint256("0x000000000004c7fbbb7ee14c8dccc5163f766a0828fe5111458ae083bc94ec15"))
( 302000, uint256("0x00000000000352758df557025fe426025240e6e1379de176b2c75e3cfae3181f"))
( 303000, uint256("0x0000000000058c5bed0aa9ab9c138593a508dbf8ff1d71f9089f081d559a8dc8"))
( 304000, uint256("0x000000000001eb7863e9d3867dc947c55e1471024b56206d76ecbead5f09862e"))
( 305000, uint256("0x00000000000295aa7b3c89eb9ebbb58b9b28133ad267bd0f3353ea7f7b8ac77c"))
( 306000, uint256("0x00000000000073832dba9660b59beb1d05f36995dc8eefd94b997d37f29233fd"))
( 307000, uint256("0x00000000000254f8d4f83dd173f9a8e9324d564d9fce5d569ee1e1a7d2eebda0"))
( 308000, uint256("0x0000000000026c9f4750ef1c5c475919152186e672f5d65998009645353f1059"))
( 309000, uint256("0x000000000002b37239c39992818251b862c8c8d1af403d5050d588e4eab9d0f6"))
( 310000, uint256("0x000000000006423edd1f1c09de4b77d1fa1cb2082cff8972b045c3df285acab2"))
( 311000, uint256("0x000000000005531ffe060f16f212179f73b5b810a32e979f921cdaa08e3a794f"))
( 312000, uint256("0x00000000000461a40b2a7569279e12685a5b0d01a60684e0914f9b4a03048ceb"))
( 313000, uint256("0x000000000001dbfcaf0c2cb23dc869f52163158c86b080580325c46d9901106d"))
( 314000, uint256("0x00000000000003acb4c3f90932348a2ef627a27cfb48f28e9f7130f02004be07"))
( 315000, uint256("0x000000000000434d1217ba061d6ef3e3a971680ae71cea0b9c42c65e64f9be69"))
( 316000, uint256("0x000000000002a7a273852520aeb96b045f95b2fa15e235df9a2c915bb13c3662"))
( 317000, uint256("0x000000000005a82db0ac7190e66d13089526d357ff067e8cef6449ea1b904ff0"))
( 317500, uint256("0x0000000000033b345872b9749fddf57853f05a195c07689bb48a2b0fa72368bc"))
( 317899, uint256("0x000000000003a185e15f9ebd7308bdda33fabc25e3f408dc6634dd787c4c3f8d"))


;
static const CCheckpointData data = {
&mapCheckpoints,
1542315277, // * UNIX timestamp of last checkpoint block
362490, // * total number of transactions between genesis and last checkpoint
1551135761, // * UNIX timestamp of last checkpoint block
428279, // * total number of transactions between genesis and last checkpoint
// (the tx=... number in the SetBestChain debug.log lines)
1000.0 // * estimated number of transactions per day after checkpoint
};
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 1
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 0

// Set to true for release, false for prerelease or test build
Expand Down
15 changes: 13 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@ unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBloc

if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || (uint64)BlockLastSolved->nHeight < PastBlocksMin) { return bnProofOfWorkLimit.GetCompact(); }

int64 LatestBlockTime = BlockLastSolved->GetBlockTime();
for (unsigned int i = 1; BlockReading && BlockReading->nHeight > 0; i++) {
if (PastBlocksMax > 0 && i > PastBlocksMax) { break; }
PastBlocksMass++;
Expand All @@ -1137,10 +1138,20 @@ unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBloc
else { PastDifficultyAverage = ((CBigNum().SetCompact(BlockReading->nBits) - PastDifficultyAveragePrev) / i) + PastDifficultyAveragePrev; }
PastDifficultyAveragePrev = PastDifficultyAverage;

PastRateActualSeconds = BlockLastSolved->GetBlockTime() - BlockReading->GetBlockTime();
if (LatestBlockTime < BlockReading->GetBlockTime()) {
if (BlockReading->nHeight > 317910) LatestBlockTime = BlockReading->GetBlockTime();
}
PastRateActualSeconds = LatestBlockTime - BlockReading->GetBlockTime();

PastRateTargetSeconds = TargetBlocksSpacingSeconds * PastBlocksMass;
PastRateAdjustmentRatio = double(1);
if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; }

if (BlockReading->nHeight > 317910) {
if (PastRateActualSeconds < 1) { PastRateActualSeconds = 1; }
} else {
if (PastRateActualSeconds < 0) { PastRateActualSeconds = 0; }
}

if (PastRateActualSeconds != 0 && PastRateTargetSeconds != 0) {
PastRateAdjustmentRatio = double(PastRateTargetSeconds) / double(PastRateActualSeconds);
}
Expand Down

0 comments on commit afa1242

Please sign in to comment.