Skip to content

Instantly share code, notes, and snippets.

@cryptozeny
Last active December 27, 2018 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cryptozeny/163695da2c51452e67db1a52cd161beb to your computer and use it in GitHub Desktop.
Save cryptozeny/163695da2c51452e67db1a52cd161beb to your computer and use it in GitHub Desktop.
LWMA-1 pow_tests: difficulty 0 issue

https://www.youtube.com/watch?v=HpNscUBpffU

@zawy#5864 I have a problem. With 0 interval hash attack Difficulty increases correctly. But after that I change to a very large interval, the difficulty becomes 0. Whats the problem? I am on LWMA-1

CODE:

    /* BEGIN - HUGE ATACK */
    // Add 5000 blocks: small attack: with 0 interval
    printf("*** HUGE ATTACK: Add 5000 blocks: attack: with 0 interval: insanely higher\n");
    for ( int j = 0; j < 5000; j++ ) {
        blocks[i] = GetBlockIndex(&blocks[i - 1], 0, nBits);
        nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
        printf("%-12s %-5d %u / %x\n",  "currentBits",  i-1, (unsigned)nBits, (unsigned)nBits);
        powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
        printf("%-12s %-5d %s\n",       "powLimit2",    i-1, powLimitFromBits.GetHex().c_str());
    }
    BOOST_CHECK_EQUAL( nBits, 0xc0deca3 );
    // 0xc0deca3 == 202239139 == 00000000000000000000000000000000000000000deca3000000000000000000
    printf("*** HUGE ATTACK is finished\n");
    /* END - HUGE ATACK */
    
    /* BEGIN - RESTORE */
    // Add 5000 blocks: with normal interval
    printf("*** RESTORE: Add 5000 blocks: with longer interval\n");
    for ( int j = 0; j < 5000; j++ ) {
        blocks[i] = GetBlockIndex(&blocks[i - 1], 15*99999999, nBits);
        nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
        powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
    }
    BOOST_CHECK_EQUAL( nBits, powLimitBits );
    // 0xc0deca3 == 202239139 == 00000000000000000000000000000000000000000deca3000000000000000000
    printf("*** RESTORE is finished\n");
    /* END - RESTORE */

RESULT:

currentBits  5310  202258193 / c0e3711
powLimit2    5310  00000000000000000000000000000000000000000e3711000000000000000000
currentBits  5311  202239139 / c0deca3
powLimit2    5311  00000000000000000000000000000000000000000deca3000000000000000000
*** HUGE ATTACK is finished
*** RESTORE: Add 5000 blocks: with longer interval
test/pow_tests.cpp(321): error in "sugarchain_test": check nBits == powLimitBits failed [0 != 520617983]
*** RESTORE is finished

PROBLEM

powLimitBits failed [0 != 520617983]

There was HUGE ATTACK. However, it should return to powLimit via RESTORE. But the result is now zero. 😭

I see last 4 blocks

Parameter    Block Value
currentBits  8517  50503554 / 3029f82
powLimit2    8517  0000000000000000000000000000000000000000000000000000000000029f82
currentBits  8518  50445006 / 301bace
powLimit2    8518  000000000000000000000000000000000000000000000000000000000001bace
currentBits  8519  50387793 / 300db51
powLimit2    8519  000000000000000000000000000000000000000000000000000000000000db51
currentBits  8520  0 / 0
powLimit2    8520  0000000000000000000000000000000000000000000000000000000000000000
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <pow.h>
#include <arith_uint256.h>
#include <chain.h>
#include <primitives/block.h>
#include <uint256.h>
// LWMA-3 for BTC/Zcash clones
// Copyright (c) 2017-2018 The Bitcoin Gold developers
// MIT License
// Algorithm by Zawy, a modification of WT-144 by Tom Harding
// Code by h4x3rotab of BTC Gold, modified/updated by Zawy
// Updated to LWMA-3 by iamstenman (MicroBitcoin)
// For change/updates, see
// https://github.com/zawy12/difficulty-algorithms/issues/3#issuecomment-388386175
// FTL must be changed to 300 or N*T/20 whichever is higher.
// FTL in BTC clones is MAX_FUTURE_BLOCK_TIME in chain.h.
// FTL in Ignition, Numus, and others can be found in main.h as DRIFT.
// FTL in Zcash & Dash clones need to change the 2*60*60 here:
// if (block.GetBlockTime() > nAdjustedTime + 2 * 60 * 60)
// which is around line 3450 in main.cpp in ZEC and validation.cpp in Dash
unsigned int Lwma3CalculateNextWorkRequired(const CBlockIndex* pindexLast, const Consensus::Params& params)
{
const int64_t T = params.nPowTargetSpacing;
const int64_t N = params.lwmaAveragingWindow;
const int64_t k = N * (N + 1) * T / 2;
const int64_t height = pindexLast->nHeight;
const arith_uint256 powLimit = UintToArith256(params.powLimit);
if (height < N) { return powLimit.GetCompact(); }
arith_uint256 sumTarget, previousDiff, nextTarget;
int64_t thisTimestamp, previousTimestamp;
int64_t t = 0, j = 0, solvetimeSum = 0;
const CBlockIndex* blockPreviousTimestamp = pindexLast->GetAncestor(height - N);
previousTimestamp = blockPreviousTimestamp->GetBlockTime();
// Loop through N most recent blocks.
for (int64_t i = height - N + 1; i <= height; i++) {
const CBlockIndex* block = pindexLast->GetAncestor(i);
thisTimestamp = (block->GetBlockTime() > previousTimestamp) ?
block->GetBlockTime() : previousTimestamp + 1;
int64_t solvetime = std::min(6 * T, thisTimestamp - previousTimestamp);
previousTimestamp = thisTimestamp;
j++;
t += solvetime * j; // Weighted solvetime sum.
arith_uint256 target;
target.SetCompact(block->nBits);
sumTarget += target / (k * N);
// if (i > height - 3) { solvetimeSum += solvetime; } // LWMA-3, deprecated
if (i == height) { previousDiff = target.SetCompact(block->nBits); }
}
nextTarget = t * sumTarget;
// if (solvetimeSum < (8 * T) / 10) { nextTarget = (previousDiff*100)/106; } // LWMA-3, deprecated
if (nextTarget > powLimit) { nextTarget = powLimit; }
return nextTarget.GetCompact();
}
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
assert(pindexLast != nullptr);
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
{
if (params.fPowAllowMinDifficultyBlocks)
{
// Special difficulty rule for testnet:
// If the new block's timestamp is more than 2* 10 minutes
// then allow mining of a min-difficulty block.
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2)
return nProofOfWorkLimit;
}
}
return Lwma3CalculateNextWorkRequired(pindexLast, params);
}
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params)
{
bool fNegative;
bool fOverflow;
arith_uint256 bnTarget;
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
// Check range
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
return false;
// Check proof of work matches claimed amount
if (UintToArith256(hash) > bnTarget)
return false;
return true;
}
// Copyright (c) 2015-2017 The Bitcoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chain.h>
#include <chainparams.h>
#include <pow.h>
#include <random.h>
#include <util.h>
#include <test/test_bitcoin.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(sugarchain_test) {
// Copyright (c) 2018 cryptozeny of the Sugarchain Core developers
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
const Consensus::Params &mainnetParams = chainParams->GetConsensus();
std::vector<CBlockIndex> blocks(99999);
// Block counter.
int i = 0;
const arith_uint256 powLimit = UintToArith256(chainParams->GetConsensus().powLimit);
uint32_t powLimitBits = powLimit.GetCompact();
// arith_uint256 currentPow = powLimit >> 4;
// uint32_t initialBits = currentPow.GetCompact();
printf("*** Show mainnetParams\n");
printf("%-12s %-5ld\n", "T", mainnetParams.nPowTargetSpacing);
printf("%-12s %-5ld\n", "N", mainnetParams.lwmaAveragingWindow);
printf("*** Check Genesis\n");
printf("%-12s %-5s %s\n", "Parameter", "Block", "Value");
printf("%-12s %-5d %u / %x\n", "powLimitBits", i, (unsigned)powLimitBits, (unsigned)powLimitBits);
printf("%-12s %-5d %s\n", "powLimit", i, powLimit.ToString().c_str()); // 0x1f07ffff
/* BEGIN - SetCompact */
// https://en.bitcoin.it/wiki/Difficulty
// https://en.bitcoin.it/wiki/Target
arith_uint256 powLimitFromBits;
bool fNegative;
bool fOverflow;
powLimitFromBits.SetCompact((unsigned)powLimitBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i, powLimitFromBits.GetHex().c_str());
/* END - SetCompact */
/* BEGIN - Check nBits */
/*
MODELL REFERENCE
arith_uint256 left = UintToArith256(uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
uint32_t leftBits = left.GetCompact();
arith_uint256 right = UintToArith256(uint256S("0007ffff00000000000000000000000000000000000000000000000000000000"));
uint32_t rightBits = right.GetCompact();
BOOST_CHECK_EQUAL( leftBits, rightBits ); // 0x1f07ffff
*/
// arith_uint256 left = UintToArith256(uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
arith_uint256 left = powLimit;
uint32_t leftBits = left.GetCompact();
// arith_uint256 right = UintToArith256(uint256S("0007ffff00000000000000000000000000000000000000000000000000000000"));
arith_uint256 right = powLimitFromBits;
uint32_t rightBits = right.GetCompact();
printf("*** Check Genesis nBits\n");
printf("%-12s %-5d %u / %x\n", "nBitsA", i, leftBits, leftBits);
printf("%-12s %-5d %s\n", "powLimitA", i, powLimit.ToString().c_str()); // 0x1f07ffff
printf("%-12s %-5d %u / %x\n", "nBitsB", i, rightBits, rightBits);
powLimitFromBits.SetCompact((unsigned)powLimitBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimitB", i, powLimitFromBits.GetHex().c_str());
BOOST_CHECK_EQUAL( leftBits, rightBits ); // 0x1f07ffff
/* END - Check nBits */
// Genesis block.
blocks[0] = CBlockIndex();
blocks[0].nHeight = 0;
blocks[0].nTime = 1541009400;
blocks[0].nBits = powLimitBits;
blocks[0].nChainWork = GetBlockProof(blocks[0]);
// Create the first window for lwma, with blocks every 15 seconds.
// consensus.lwmaAveragingWindow = 200;
// N=200 for T=15: Lwma3CalculateNextWorkRequired
/* Begin - First Window */
for (i = 1; i < 201; i++) {
blocks[i] = GetBlockIndex(&blocks[i - 1], 15, powLimitBits); // 0x1f07ffff
}
uint32_t nBits = Lwma3CalculateNextWorkRequired(&blocks[201], chainParams->GetConsensus());
// Last block for the first window: still same
blocks[i] = GetBlockIndex(&blocks[i - 1], 15+1, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("*** block[201] Last block for the first window: still same\n");
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
printf("*** filling the first window is finished \n");
BOOST_CHECK_EQUAL( nBits, powLimitBits ); // 0x1f07ffff
// BOOST_CHECK_EQUAL( powLimitBits.c_str(), powLimitFromBits.GetHex().c_str() ); // 0x1f07ffff // FIXME.SUGAR
/* End - First Window */
// Add one block: still same
blocks[i] = GetBlockIndex(&blocks[i - 1], 15+1, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("*** block[202] Add one block: still same\n");
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
printf("*** \n");
BOOST_CHECK_EQUAL( nBits, powLimitBits ); // 0x1f07ffff
// Add one block: a little bit higher
blocks[i] = GetBlockIndex(&blocks[i - 1], 15-1.0000000000000010, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("*** block[203] Add one block: a little bit higher\n");
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow);
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
printf("*** \n");
BOOST_CHECK_EQUAL( nBits, 0x1f07fff9 );
// 0x1f07fff9 == 520617977 == 0007fff900000000000000000000000000000000000000000000000000000000
// Add one block: a little bit lower: back to powLimit
blocks[i] = GetBlockIndex(&blocks[i - 1], 15*99, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("*** block[204] Add one block: a little bit lower: back to powLimit\n");
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
printf("*** \n");
BOOST_CHECK_EQUAL( nBits, powLimitBits );
/* BEGIN - SMALL ATACK */
// Add 5 blocks: small attack: with 0 interval
printf("*** SMALL ATTACK: Add 5 blocks: attack: with 0 interval: still same\n");
for ( int j = 0; j < 5; j++ ) {
blocks[i] = GetBlockIndex(&blocks[i - 1], 0, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
// printf("*** block[%d] \n", i-1);
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
BOOST_CHECK_EQUAL( nBits, powLimitBits );
}
printf("*** \n");
// Add one block: higher with normal interval
blocks[i] = GetBlockIndex(&blocks[i - 1], 15, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("*** block[210] LAST SMALL ATTACK: Add one block: higher with normal interval\n");
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow);
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
printf("*** SMALL ATTACK is finished\n");
BOOST_CHECK_EQUAL( nBits, 0x1f07fe58 );
// 0x1f07fe58 == 520617560 == 0007fe5800000000000000000000000000000000000000000000000000000000
/* END - SMALL ATACK */
// Add one block: lower: back to powLimit
blocks[i] = GetBlockIndex(&blocks[i - 1], 15*999, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("*** block[211] Add one block: lower: back to powLimit\n");
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
printf("*** \n");
BOOST_CHECK_EQUAL( nBits, powLimitBits );
/* BEGIN - MEDIUM ATACK */
// Add 100 blocks: small attack: with 0 interval
printf("*** MEDIUM ATTACK: Add 100 blocks: attack: with 0 interval: higher\n");
for ( int j = 0; j < 100; j++ ) {
blocks[i] = GetBlockIndex(&blocks[i - 1], 0, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
}
BOOST_CHECK_EQUAL( nBits, 0x1f021c42 );
// 0x1f021c42 == 520232002 == 00021c4200000000000000000000000000000000000000000000000000000000
printf("*** MEDIUM ATTACK is finished\n");
/* END - SMALL ATACK */
/* BEGIN - HUGE ATACK */
// Add 5000 blocks: small attack: with 0 interval
printf("*** HUGE ATTACK: Add 5000 blocks: attack: with 0 interval: insanely higher\n");
for ( int j = 0; j < 5000; j++ ) {
blocks[i] = GetBlockIndex(&blocks[i - 1], 0, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
}
BOOST_CHECK_EQUAL( nBits, 0xc0deca3 );
// 0xc0deca3 == 202239139 == 00000000000000000000000000000000000000000deca3000000000000000000
printf("*** HUGE ATTACK is finished\n");
/* END - HUGE ATACK */
/* BEGIN - RESTORE */
// Add 5000 blocks: with normal interval
printf("*** RESTORE: Add 5000 blocks: with longer interval\n");
for ( int j = 0; j < 5000; j++ ) {
blocks[i] = GetBlockIndex(&blocks[i - 1], 15*99999999, nBits);
nBits = Lwma3CalculateNextWorkRequired(&blocks[i++], chainParams->GetConsensus());
// printf("%-12s %-5d %u / %x\n", "currentBits", i-1, (unsigned)nBits, (unsigned)nBits);
powLimitFromBits.SetCompact((unsigned)nBits, &fNegative, &fOverflow); // powLimitBits == 0x1f07ffff
// printf("%-12s %-5d %s\n", "powLimit2", i-1, powLimitFromBits.GetHex().c_str());
}
BOOST_CHECK_EQUAL( nBits, powLimitBits );
// 0xc0deca3 == 202239139 == 00000000000000000000000000000000000000000deca3000000000000000000
printf("*** RESTORE is finished\n");
/* END - RESTORE */
}
BOOST_AUTO_TEST_SUITE_END()
$ ./src/test/test_sugarchain test_bitcoin --log_level=test_suite --run_test=pow_tests
Running 1 test cases...
Entering test suite "Sugarchain Test Suite"
Entering test suite "pow_tests"
Entering test case "sugarchain_test"
*** Show mainnetParams
T 15
N 200
*** Check Genesis
Parameter Block Value
powLimitBits 0 520617983 / 1f07ffff
powLimit 0 0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
powLimit2 0 0007ffff00000000000000000000000000000000000000000000000000000000
*** Check Genesis nBits
nBitsA 0 520617983 / 1f07ffff
powLimitA 0 0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
nBitsB 0 520617983 / 1f07ffff
powLimitB 0 0007ffff00000000000000000000000000000000000000000000000000000000
*** block[201] Last block for the first window: still same
currentBits 201 520617983 / 1f07ffff
powLimit2 201 0007ffff00000000000000000000000000000000000000000000000000000000
*** filling the first window is finished
*** block[202] Add one block: still same
currentBits 202 520617983 / 1f07ffff
powLimit2 202 0007ffff00000000000000000000000000000000000000000000000000000000
***
*** block[203] Add one block: a little bit higher
currentBits 203 520617977 / 1f07fff9
powLimit2 203 0007fff900000000000000000000000000000000000000000000000000000000
***
*** block[204] Add one block: a little bit lower: back to powLimit
currentBits 204 520617983 / 1f07ffff
powLimit2 204 0007ffff00000000000000000000000000000000000000000000000000000000
***
*** SMALL ATTACK: Add 5 blocks: attack: with 0 interval: still same
currentBits 205 520617983 / 1f07ffff
powLimit2 205 0007ffff00000000000000000000000000000000000000000000000000000000
currentBits 206 520617983 / 1f07ffff
powLimit2 206 0007ffff00000000000000000000000000000000000000000000000000000000
currentBits 207 520617983 / 1f07ffff
powLimit2 207 0007ffff00000000000000000000000000000000000000000000000000000000
currentBits 208 520617983 / 1f07ffff
powLimit2 208 0007ffff00000000000000000000000000000000000000000000000000000000
currentBits 209 520617983 / 1f07ffff
powLimit2 209 0007ffff00000000000000000000000000000000000000000000000000000000
***
*** block[210] LAST SMALL ATTACK: Add one block: higher with normal interval
currentBits 210 520617560 / 1f07fe58
powLimit2 210 0007fe5800000000000000000000000000000000000000000000000000000000
*** SMALL ATTACK is finished
*** block[211] Add one block: lower: back to powLimit
currentBits 211 520617983 / 1f07ffff
powLimit2 211 0007ffff00000000000000000000000000000000000000000000000000000000
***
*** MEDIUM ATTACK: Add 100 blocks: attack: with 0 interval: higher
currentBits 212 520617983 / 1f07ffff
powLimit2 212 0007ffff00000000000000000000000000000000000000000000000000000000
currentBits 213 520617983 / 1f07ffff
...
currentBits 310 520234734 / 1f0226ee
powLimit2 310 000226ee00000000000000000000000000000000000000000000000000000000
currentBits 311 520232002 / 1f021c42
powLimit2 311 00021c4200000000000000000000000000000000000000000000000000000000
*** MEDIUM ATTACK is finished
*** HUGE ATTACK: Add 5000 blocks: attack: with 0 interval: insanely higher
currentBits 312 520229303 / 1f0211b7
powLimit2 312 000211b700000000000000000000000000000000000000000000000000000000
currentBits 313 520226638 / 1f02074e
...
currentBits 5309 202277644 / c0e830c
powLimit2 5309 00000000000000000000000000000000000000000e830c000000000000000000
currentBits 5310 202258193 / c0e3711
powLimit2 5310 00000000000000000000000000000000000000000e3711000000000000000000
currentBits 5311 202239139 / c0deca3
powLimit2 5311 00000000000000000000000000000000000000000deca3000000000000000000
*** HUGE ATTACK is finished
*** RESTORE: Add 5000 blocks: with longer interval
...
currentBits 8510 50680416 / 3055260
powLimit2 8510 0000000000000000000000000000000000000000000000000000000000055260
currentBits 8511 50633082 / 304997a
powLimit2 8511 000000000000000000000000000000000000000000000000000000000004997a
currentBits 8512 50585748 / 303e094
powLimit2 8512 000000000000000000000000000000000000000000000000000000000003e094
currentBits 8513 50540283 / 3032efb
powLimit2 8513 0000000000000000000000000000000000000000000000000000000000032efb
currentBits 8514 50567976 / 3039b28
powLimit2 8514 0000000000000000000000000000000000000000000000000000000000039b28
currentBits 8515 50506758 / 302ac06
powLimit2 8515 000000000000000000000000000000000000000000000000000000000002ac06
currentBits 8516 50504889 / 302a4b9
powLimit2 8516 000000000000000000000000000000000000000000000000000000000002a4b9
currentBits 8517 50503554 / 3029f82
powLimit2 8517 0000000000000000000000000000000000000000000000000000000000029f82
currentBits 8518 50445006 / 301bace
powLimit2 8518 000000000000000000000000000000000000000000000000000000000001bace
currentBits 8519 50387793 / 300db51
powLimit2 8519 000000000000000000000000000000000000000000000000000000000000db51
currentBits 8520 0 / 0
powLimit2 8520 0000000000000000000000000000000000000000000000000000000000000000
currentBits 8521 0 / 0
powLimit2 8521 0000000000000000000000000000000000000000000000000000000000000000
test/pow_tests.cpp(321): error in "sugarchain_test": check nBits == powLimitBits failed [0 != 520617983]
*** RESTORE is finished
Leaving test case "sugarchain_test"; testing time: 11212070mks
Entering test case "GetBlockProofEquivalentTime_test"
Leaving test case "GetBlockProofEquivalentTime_test"; testing time: 7513mks
Leaving test suite "pow_tests"
Leaving test suite "Sugarchain Test Suite"
*** 1 failure detected in test suite "Sugarchain Test Suite"
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment