Sync speed - Test notes
-
There appears to be a problem with getting past certain blocks, not related to ACP. This is causing slow sync issues.
Writing to the debug log may also be slowing syncs. In particular there appears to be excessive writes about stealth addresses.
Debug.log, 0.9.6.1 - not a from scratch sync, notes on possible areas of investigation.
2017-07-31 19:02:03 ProcessBlock: ACCEPTED 2017-07-31 19:02:03 ProcessBlock: Preliminary checks 2017-07-31 19:02:03 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2017-07-31 19:02:03 ProcessBlock() ProcessBlock: ORPHAN BLOCK 88, prev=65093717eafaaedb9021d3f37b5c44952c0747c29ff799a273654a9ebe2584ef 2017-07-31 19:02:03 ProcessBlock: Preliminary checks 2017-07-31 19:02:03 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2017-07-31 19:02:03 ProcessBlock() ProcessBlock: ORPHAN BLOCK 89, prev=f3a33a083baa2a422412755500f661e26a57c929b679023789d0c99a55ffa005 2017-07-31 19:02:03 ProcessBlock: Preliminary checks 2017-07-31 19:02:03 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2017-07-31 19:02:03 AcceptBlockHeader,nHeight=1819213 2017-07-31 19:02:03 GetNextWorkRequired pindexLast block Height=1819212,nBits=470426393 2017-07-31 19:02:03 GetNextWorkRequired the next block Height=1819213 2017-07-31 19:02:03 GetNextWorkRequired fork 2017-07-31 19:02:03 Difficulty rules regular blocks 2017-07-31 19:02:03 GetNextWorkRequired(), nActualTimespan = 16 before bounds 2017-07-31 19:02:03 RETARGET: nActualTimespanShort = 75, nActualTimespanMedium = 62, nActualTimespanLong = 62, nActualTimeSpanAvg = 66, nActualTimespan (damped) =$ 2017-07-31 19:02:03 RETARGET: nActualTimespan = 61 after bounds 2017-07-31 19:02:03 RETARGET: nTargetTimespan = 60, nTargetTimespan/nActualTimespan = 0.9836 2017-07-31 19:02:03 GetNextWorkRequired RETARGET
Previously from full sync …
2016-07-10 13:58:16 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2016-07-10 13:58:16 ProcessBlock() ProcessBlock: ORPHAN BLOCK 751, prev=c67a17ae6fe49b7dbde87caac5babcfe72a5800b90a12c87bafea6f207285299 2016-07-10 13:58:16 ProcessBlock: Preliminary checks 2016-07-10 13:58:16 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2016-07-10 13:58:16 ProcessBlock() ProcessBlock: ORPHAN BLOCK 751, prev=0de30384a16180e8d897143d787f544635d0a56ec2678fb354a009396ebb28ac 2016-07-10 13:58:16 ProcessBlock: Preliminary checks 2016-07-10 13:58:16 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2016-07-10 13:58:16 ProcessBlock() ProcessBlock: ORPHAN BLOCK 751, prev=73d228efdb4f9ed6f7588a5da92f78084454c90dad010ed161f4ed819c49170f 2016-07-10 13:58:17 ProcessBlock: Preliminary checks 2016-07-10 13:58:17 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits
-
nSwitch
https://github.com/FeatherCoin/Feathercoin/issues/117
https://github.com/FeatherCoin/Feathercoin/search?utf8=✓&q=nSwitchV2&type=DogecoinFix
https://github.com/dogecoin/dogecoin/issues/717
main.cpp Line 1488
bool CheckProofOfWork(uint256 hash, unsigned int nBits) { CBigNum bnTarget; bnTarget.SetCompact(nBits); // Check range if (bnTarget <= 0 || bnTarget > Params().ProofOfWorkLimit()) return error("Check range CheckProofOfWork() : nBits below minimum work"); // Check proof of work matches claimed amount //LogPrintf("CheckProofOfWork() hash=%s \n",hash.ToString().c_str()); //LogPrintf("CheckProofOfWork() nBits=%i \n",nBits); //LogPrintf("CheckProofOfWork() bnTarget.getuint256=%s \n",bnTarget.getuint256().ToString().c_str()); if (hash > bnTarget.getuint256()) return error("matches claimed amount, CheckProofOfWork() : hash doesn't match nBits"); return true; }
-
Instead of chaging the max orphan blocks up, as 750 is too low to pass a number of long chains, (seen n Bitcoin and Dogecoin). …
I just wanted to comment on this issue (because it shows up in google first) that a work around is to use the ‘-maxorphanblocks’ startup parameter which should be in latest version if anyone is still running into this issue.
It was merged here:
#4258main.cpp
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded - unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS); + unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, GetArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS)); + unsigned int nEvicted = LimitOrphanTxSize(nMaxOrphanTx);
Max orphan transactions updated (from LTC)
-
Running sync from scratch with -debug enabled.
2017-08-10 20:48:38 view.GetBestBlock()=e5d01f34b54e8436da39df4053512e59f268d14a285294f4ec074a7484203460 2017-08-10 20:48:38 No coin database inconsistencies in last 289 blocks (503 transactions) 2017-08-10 20:48:38 init message: Checking ACP ... 2017-08-10 20:48:38 block index 7246ms 2017-08-10 20:48:38 init message: Loading wallet... 2017-08-10 20:48:38 nFileVersion = 90601 2017-08-10 20:48:38 Keys: 0 plaintext, 0 encrypted, 149 w/ metadata, 0 total 2017-08-10 20:48:38 wallet 201ms 2017-08-10 20:48:38 init message: Loading addresses... 2017-08-10 20:48:38 Loaded 14089 addresses from peers.dat 12ms 2017-08-10 20:48:38 mapBlockIndex.size() = 1359510 2017-08-10 20:48:38 nBestHeight = 1358341 2017-08-10 20:48:38 setKeyPool.size() = 100 2017-08-10 20:48:38 mapWallet.size() = 21 2017-08-10 20:48:38 mapAddressBook.size() = 45 2017-08-10 20:48:38 ext-ip thread start 2017-08-10 20:48:38 dnsseed thread start 2017-08-10 20:48:38 upnp thread start 2017-08-10 20:48:38 net thread start 2017-08-10 20:48:38 opencon thread start 2017-08-10 20:48:38 addcon thread start 2017-08-10 20:48:38 init message: Done loading 2017-08-10 20:48:38 msghand thread start 2017-08-10 20:48:38 dumpaddr thread start 2017-08-10 20:48:38 Initialization result: 1 2017-08-10 20:48:39 GetMyExternalIP() received [xxx.xxx.xxx.xxx] xxx.xxx.xxx.xxx:0 2017-08-10 20:48:39 GetMyExternalIP() returned xxx.xxx.xxx.xxx 2017-08-10 20:48:39 AddLocal(xxx.xxx.xxx.xxx:9336,4) 2017-08-10 20:48:39 ext-ip thread exit 2017-08-10 20:48:39 receive version message: /Feathercoin:0.9.6/: version 70003, blocks=1836439, us=88.105.71.156:51766, them=50.71.89.36:9336, peer=50.71.89.36:9336 2017-08-10 20:48:39 Added time data, samples 2, offset -1 (+0 minutes) 2017-08-10 20:48:39 receive version message: /Feathercoin:0.9.6.1/: version 70005, blocks=1836439, us=88.105.71.156:40926, them=46.4.0.101:9336, peer=46.4.0.101:9336 2017-08-10 20:48:39 Added time data, samples 3, offset +0 (+0 minutes) 2017-08-10 20:48:40 ProcessBlock: Preliminary checks 2017-08-10 20:48:40 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn't match nBits 2017-08-10 20:48:40 AcceptBlockHeader,nHeight=1358342 2017-08-10 20:48:40 GetNextWorkRequired pindexLast block Height=1358341,nBits=471931785 2017-08-10 20:48:40 GetNextWorkRequired the next block Height=1358342 2017-08-10 20:48:40 GetNextWorkRequired fork 2017-08-10 20:48:40 Difficulty rules regular blocks 2017-08-10 20:48:40 GetNextWorkRequired(), nActualTimespan = 48 before bounds 2017-08-10 20:48:40 RETARGET: nActualTimespanShort = 50, nActualTimespanMedium = 62, nActualTimespanLong = 62, nActualTimeSpanAvg = 58, nActualTimespan (damped) = 59 2017-08-10 20:48:40 RETARGET: nActualTimespan = 59 after bounds 2017-08-10 20:48:40 RETARGET: nTargetTimespan = 60, nTargetTimespan/nActualTimespan = 1.0169 2017-08-10 20:48:40 GetNextWorkRequired RETARGET 2017-08-10 20:48:40 nTargetTimespan = 60 nActualTimespan = 59
-
Potential Debug Logging update :
https://github.com/dogecoin/dogecoin/commit/87f599d64828bd93e89f2e11087270ed88078170
-
The message LogPrintf("CheckProofOfWork etc should print out before the error(“CheckProofOfWork(): hash doesn’t match nBits”); but doesn’t - I see this is nested ifs - it is supposed to be?
//if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) if (fNegative || bnTarget == 0 || fOverflow || bnTarget > bnPowLimit) return error("CheckProofOfWork(): nBits below minimum work"); // Check proof of work matches claimed amount // if (hash > bnTarget.getuint256()) if (UintToArith256(hash) > bnTarget) { LogPrintf("CheckProofOfWork 100,nBits=%d,hash=%s,bnTarget=%s,UintToArith256(hash)=%s\n",nBits,hash.ToString(),bnTarget.GetHex(),UintToArith256(hash).GetHex()); return error("CheckProofOfWork(): hash doesn't match nBits"); } return true;
-
Note : Testing removing some unnecessary debug messages.
Main.cpp Line : 1483
if (bnNew > Params().ProofOfWorkLimit())
bnNew = Params().ProofOfWorkLimit();/// debug print
LogPrintf(“GetNextWorkRequired RETARGET\n”);
LogPrintf(“nTargetTimespan = %d nActualTimespan = %d\n”, nTargetTimespan, nActualTimespan);
LogPrintf(“Before: %08x %s\n”, pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString());
LogPrintf(“After: %08x %s\n”, bnNew.GetCompact(), bnNew.getuint256().ToString()); -
First ERROR: matches claimed amount, CheckProofOfWork() : hash doesn’t match nBits with Log messages added and no re-target messages.
ProcessBlock: ACCEPTED
2017-08-11 13:17:48 ProcessBlock: Preliminary checks
2017-08-11 13:17:48 CheckProofOfWork() hash=482fae83361c9dd985d02b35fba8dd6600ccdd3ff55a746ce577970f40c0c914
2017-08-11 13:17:48 CheckProofOfWork() nBits=470826180
2017-08-11 13:17:48 CheckProofOfWork() bnTarget.getuint256=00000000103cc400000000000000000000000000000000000000000000000000
2017-08-11 13:17:48 ERROR: matches claimed amount, CheckProofOfWork() : hash doesn’t match nBits
2017-08-11 13:17:48 CheckProofOfWork() hash=0000000006897920f310b9b9e23635a8ab132e37b3e13fe1346106437cb28949
2017-08-11 13:17:48 CheckProofOfWork() nBits=470826180
2017-08-11 13:17:48 CheckProofOfWork() bnTarget.getuint256=00000000103cc400000000000000000000000000000000000000000000000000
2017-08-11 13:17:48 ProcessBlock() ProcessBlock: ORPHAN BLOCK 0, prev=66ed4148da8836604d53581be16c0192cf412116ba3bfd3c8da2dabee8324b3a
2017-08-11 13:17:49 ProcessBlock: Preliminary checks
2017-08-11 13:17:49 CheckProofOfWork() hash=0000000000a72edca5adcf77864aade9733973fd525ae4ada23dcd88bacad968
2017-08-11 13:17:49 CheckProofOfWork() nBits=469844437
2017-08-11 13:17:49 CheckProofOfWork() bnTarget.getuint256=000000000141d500000000000000000000000000000000000000000000000000
2017-08-11 13:17:49 AcceptBlockHeader,nHeight=90873 -
Why are these messages printed to the debug?
2017-08-11 13:20:22 BOOST_FOREACH nOutputIdOuter=1 ,find txout…
2017-08-11 13:20:22 txout scriptPubKey= OP_DUP OP_HASH160 f4eeb6ac54e3d12a0d72fd1b976de88a66539c96 OP_EQUALVERIFY OP_CHECKSIG
2017-08-11 13:20:22 txout hash = 5d5132cbd37c996cc24801429c86fb1dc952e6c4905b76f315693189eedd0372
2017-08-11 13:20:22 AddToWalletIfInvolvingMe,hash=22e5bb48b01b645a7d80823cdc5a8440261bf2e2b7ad9ab2725e4c49d011c130 .
2017-08-11 13:20:22 FindStealthTransactions() tx:22e5bb48b01b645a7d80823cdc5a8440261bf2e2b7ad9ab2725e4c49d011c130,BOOST_FOREACH nOutputIdOuter=0 ,find txout…
2017-08-11 13:20:22 txout scriptPubKey= OP_DUP OP_HASH160 ab4add4d94512f94cc326803a1199e6106ac7d06 OP_EQUALVERIFY OP_CHECKSIG
2017-08-11 13:20:22 txout hash = a969806b1bb2445b7b272e22adaf4d833c2956ebacd51b598f5e676981740feb -
A pull request : https://github.com/FeatherCoin/Feathercoin/pull/216
Options to speed up sync - with 0.9.6.1 release
set db cache higher (0.9.6.1 options)
add switch -maxblockorphans=10000Speed restrictions with Blockchain versions
Version 0.13 contains highest speed increase / work (openSSL replacement), so some FTC sync issue are BTC code restrictions related.
Feathercoin has required ACP to prevent attacks, this works by orphaning none complaint chains until a chain compies with normal rules and checkpoints is longer. 0.13 should fix this issue.
ARM devices, 32bit and old machines will be much slower to synchronize. There is a lot of CPU and Database IO as each full node rechecks all the blocks are correct. 0.11 was sped up slightly, by not exploring orphans if there was a main block.
Further Tests / options
http://forum.feathercoin.com/topic/8798/dev-feathercoin-0-9-6-2-maintenance-fix-build-upgrade-issues-notes/109