From c4e813bf09187cd90f76621463b39466301299a1 Mon Sep 17 00:00:00 2001 From: kanon <60179867+decryp2kanon@users.noreply.github.com> Date: Mon, 15 Jun 2020 03:48:00 +0900 Subject: [PATCH] [backport] API server v34 starboy (88fe002) (#165) * add: option "-prunedebuglogfile": limit filesize of debug.log (#110) The idea is `ShrinkDebugFile` in realtime. - AIM: to prevent disk is filling full up with log file. - DEBUG: If `debug.log` is over 10 MB (`10*1000*1000`), shrink to 1 MB (`1*1000*1000`). 10x smaller * `watch -n1 ls -lh debug.log` * `watch -n5 ps -p "$(cat sugarchaind.pid)" -o %cpu,%mem,cmd` - RUN: check logging speed and filesize * `sugarchaind -prunedebuglogfile -reindex-chainstate` - PERIOD: a cycle took around `4:30` when `-reindex-chainstate` ``` 2020-04-20 23:18:55 DEBUG.LOG PRUNED at 10000071 2020-04-20 23:24:33 DEBUG.LOG PRUNED at 10000014 2020-04-20 23:30:11 DEBUG.LOG PRUNED at 10000018 2020-04-20 23:35:45 DEBUG.LOG PRUNED at 10000186 ``` * IBD: do not check PoW (Yespower) during downloading headers (#122) * IBD: do not check PoW (Yespower) during downloading headers However this means checking PoW during IBD is, not actually skipped, but still checking in another places. This makes IBD much faster. * remove: debug printf * adding comment by volbil * revert: (#80) do not disconnect whitelisted peers during IBD (#124) * GUI: do not display in GB, but in MB (#125) * revert (#78) & fix: disabled more getheaders (#126) * revert&fix: disabled more getheaders * remove: printf * IBD: Print blockheader count on debug.log (#128) * revert: MINIMUM_CONNECT_TIME (#129) https://github.com/bitcoin/bitcoin/blob/f56c00b2345cd2e392ade4733e2ca9cb9b0af623/src/net_processing.h#L36 * Revert "revert: MINIMUM_CONNECT_TIME (#129)" (#130) This reverts commit e37dfecf0c551a6328797321070f9e289547de98. * update: checkpoint (#132) * bump 0.16.3.31rc1 + manpage (#133) **Changes: v0.16.3.31rc1** - Major * Fix: IBD `30%` faster, and `60%` reduced data traffic #122 * Add: new option `-prunedebuglogfile`: limit filesize of debug.log #110 * Add: when IBD, print blockheader count on debug.log #128 * Update: checkpoints (mainnet) #132 - Minor * GUI: display size in MB (was GB) #125 * Revert: IBD settings back to BTC original #124 #126 * IBD: max blocks in transit per peer (cached PoW) (#135) * bump v0.16.3.32rc2 + manpage (#137) **Changes: v0.16.3.32rc2** - Major * Fix: IBD `30%` faster, and `60%` reduced data traffic #122 * Add: new option `-prunedebuglogfile`: limit filesize of debug.log #110 * Add: when IBD, print blockheader count on debug.log #128 * Update: checkpoints (mainnet) #132 * Fix: IBD optimizing #135 - Minor * GUI: display size in MB (was GB) #125 * Revert: IBD settings back to BTC original #124 #126 * fix: daemon Killed on ARM during IBD (out-of-memory) (#140) * Revert "revert (#78) & fix: disabled more getheaders (#126)" This reverts commit 7c45e62357dfa7420b6e6ca15594a9652378be6a. * comment * remove: BCLog::POW (-debug=pow) (#142) * add: bootstrap height at 4421701 (#143) * scripts: In linearize, search for next position of magic bytes rather than fail https://github.com/bitcoin/bitcoin/pull/16802/ * add: bootstrap height at 4421701 * update: seeds 2020-05-19 KST (#144) * fix: travis: pathlib2 (#148) ImportError: No module named 'pathlib2' * doc (#151) * bump v0.16.3.33rc3 + manpage (#152) **Changes: v33rc3** - Major * Fix: IBD `30%` faster, and `60%` reduced data traffic #122 * Add: new option `-prunedebuglogfile`: limit filesize of debug.log #110 * Add: when IBD, print blockheader count on debug.log #128 * Update: checkpoints (mainnet) #132 * Fix: IBD optimizing #135 * Update: seed list #144 * Remove: BCLog::POW (-debug=pow) #142 - Minor * GUI: display size in MB (was GB) #125 * Revert: IBD settings back to BTC original #124 * Add: bootstrap height at 4421701 #143 * Fix: travis pathlib2 #148 * update: blockchain size as 3GB (#153) * cleanup (#154) * comment * seeds version checker * doc: release note v34 starboy (#160) * doc: release note: starboy * fix: known issue * bump: v0.16.3.34-starboy + manpage (#161) **Changes: v34-starboy (same as v33)** - Major * Fix: IBD `30%` faster, and `60%` reduced data traffic #122 * Add: new option `-prunedebuglogfile`: limit filesize of debug.log #110 * Add: when IBD, print blockheader count on debug.log #128 * Update: checkpoints (mainnet) #132 * Fix: IBD optimizing #135 * Update: seed list #144 * Remove: BCLog::POW (-debug=pow) #142 - Minor * GUI: display size in MB (was GB) #125 * Revert: IBD settings back to BTC original #124 * Add: bootstrap height at 4421701 #143 * Fix: travis pathlib2 #148 --- .travis.yml | 2 +- README.md | 23 ++++---- configure.ac | 2 +- contrib/linearize/README.md | 8 +-- contrib/linearize/linearize-data.py | 7 ++- contrib/linearize/linearize.cfg | 6 +- contrib/seeds/makeseeds.py | 2 +- contrib/seeds/nodes_main.txt | 11 ++-- contrib/seeds/nodes_test.txt | 4 +- contrib/seeds/seeds_main.txt | 45 ++++++++------- contrib/seeds/seeds_test.txt | 6 +- doc/man/sugarchain-cli.1 | 6 +- doc/man/sugarchain-qt.1 | 14 +++-- doc/man/sugarchain-tx.1 | 6 +- doc/man/sugarchaind.1 | 14 +++-- doc/release-notes.md | 85 +++++++++++++++++++++++++++-- src/chainparams.cpp | 18 ++++-- src/chainparamsseeds.h | 15 ++--- src/init.cpp | 2 + src/net_processing.cpp | 4 +- src/pow.cpp | 17 ------ src/qt/bitcoingui.cpp | 11 +++- src/qt/guiutil.cpp | 5 +- src/qt/intro.cpp | 4 +- src/util.cpp | 41 +++++++++++++- src/util.h | 2 +- src/validation.cpp | 14 ++++- src/validation.h | 11 +++- 28 files changed, 266 insertions(+), 119 deletions(-) diff --git a/.travis.yml b/.travis.yml index c46ba115e..981812dd8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,7 +103,7 @@ install: - if [ -n "$DPKG_ADD_ARCH" ]; then sudo dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get update; fi - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES; fi - - if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then travis_retry pip3 install flake8 --user; fi + - if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then travis_retry pip3 install pathlib2 flake8 --user; fi before_script: - if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi - if [ "$CHECK_DOC" = 1 ]; then contrib/devtools/git-subtree-check.sh src/crypto/ctaes; fi diff --git a/README.md b/README.md index 83153a434..8b86321e3 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ information or see https://opensource.org/licenses/MIT. Minimum Requirement ------------------- - CPU: 1 Core -- RAM: 1024 MB (at least 2048 MB [swap](https://github.com/sugarchain-project/doc/blob/master/swap.md)) -- DISK: 3 GB +- RAM: 1024 MB (at least 3 GB [swap](https://github.com/sugarchain-project/doc/blob/master/swap.md)) +- DISK: 5 GB Depends on Bitcoin Core @@ -108,9 +108,6 @@ Run --- The options `-rpcuser`, `-rpcpassword`, and `-printtoconsole` are optional. `server=1` needed by RPC servers or cpuminer when solo-mining. -- Mainnet: debug mode: `pow` for PoW - > ./src/qt/sugarchain-qt -server=1 -rpcuser=rpcuser -rpcpassword=rpcpassword **-debug=pow** -printtoconsole - - Mainnet: debug mode: `net` for Network > ./src/qt/sugarchain-qt -server=1 -rpcuser=rpcuser -rpcpassword=rpcpassword **-debug=net** -printtoconsole @@ -134,18 +131,20 @@ Known Issues ------------ - Transaction too large: * This is a part of BTC. - * It will be fixed in next *Schnorr Signature* update. + * It will be fixed in next *Taproot+Schnorr* update. - Slow update balance on wallet: - * Update total balance *every minute (12 blocks)* interval. * This slow is a part of BTC. + * Update total balance *every minute (12 blocks)* interval. * This fix is a (nice) workaround for now. [source](https://github.com/sugarchain-project/sugarchain/commit/72436c90b29844cf507895df053103f9b6840776#diff-2e3836af182cfb375329c3463ffd91f8) - Poor performance on ARM CPUs (32/64-Bit): - * ARM optimization for Yespower disabled for now. - * *TODO* + * No ARM optimization for Yespower yet. - Poor performance on 32-Bit OS: - * SSE2 for Yespower disabled for now. [source](https://github.com/sugarchain-project/sugarchain/blob/d977987a83aba115d50a9130f0d7914330d1bc75/src/crypto/yespower-1.0.1/yespower-opt.c#L59) - * Please use *64-bit* for best performance. - + * No SSE2 optimization for Yespower yet. [source](https://github.com/sugarchain-project/sugarchain/blob/d977987a83aba115d50a9130f0d7914330d1bc75/src/crypto/yespower-1.0.1/yespower-opt.c#L59) +- Slow startup on low memory machines: + * Startup can take up to some hours on 1cpu 1024ram (+swap 3GB) VPS. + * Workaround is just increase RAM at least 2 GB. +- Slow rescanning `wallet.dat`: + * If your wallet is too heavy or mining purpose, it may take very long when importing. Release process using GITIAN ---------------------------- diff --git a/configure.ac b/configure.ac index d89d8b696..5e6e061df 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 16) define(_CLIENT_VERSION_REVISION, 3) -define(_CLIENT_VERSION_BUILD, 30) +define(_CLIENT_VERSION_BUILD, 34) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2020) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/contrib/linearize/README.md b/contrib/linearize/README.md index 60b995e66..dafd1cb4a 100644 --- a/contrib/linearize/README.md +++ b/contrib/linearize/README.md @@ -39,10 +39,10 @@ Change absolute location in `linearize.cfg` $ head -1 hashlist.txt # genesis 7d5eaec2dbb75f99feadfa524c78b7cabc1d8c8204f79d4f3a83381b811b0adc - $ wc -l hashlist.txt # 2601001+1 (add genesis) - 2601002 hashlist.txt - $ tail -n 1 hashlist.txt # height 2601001 # getblockhash 2601001 - 56e8f536feb26f749ed9198f56f397da08f018de9518674b2ac12a41061612cb + $ wc -l hashlist.txt # 4421701+1 (add genesis) + 4421702 hashlist.txt + $ tail -n 1 hashlist.txt # height 4421701 # getblockhash 4421701 + 9a9c7db86b1a67a399d50f7f45b1d4bbb9179bcf0be08331239a1b9881ebcea9 ## Step 2: Copy local block data diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index 915b0004f..75a42d528 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -215,8 +215,11 @@ def run(self): inMagic = inhdr[:4] if (inMagic != self.settings['netmagic']): - print("Invalid magic: " + hexlify(inMagic).decode('utf-8')) - return + # Seek backwards 7 bytes (skipping the first byte in the previous search) + # and continue searching from the new position if the magic bytes are not + # found. + self.inF.seek(-7, os.SEEK_CUR) + continue inLenLE = inhdr[4:] su = struct.unpack(" [params] diff --git a/doc/man/sugarchain-qt.1 b/doc/man/sugarchain-qt.1 index 59c4c7193..19e84d718 100644 --- a/doc/man/sugarchain-qt.1 +++ b/doc/man/sugarchain-qt.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH SUGARCHAIN-QT "1" "March 2020" "sugarchain-qt v0.16.3.30" "User Commands" +.TH SUGARCHAIN-QT "1" "June 2020" "sugarchain-qt v0.16.3.34" "User Commands" .SH NAME -sugarchain-qt \- manual page for sugarchain-qt v0.16.3.30 +sugarchain-qt \- manual page for sugarchain-qt v0.16.3.34 .SH DESCRIPTION -Sugarchain Yumekawa version v0.16.3.30 (64\-bit) +Sugarchain Yumekawa version v0.16.3.34 (64\-bit) Usage: .IP sugarchain\-qt [command\-line options] @@ -32,7 +32,7 @@ block hash) If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: -56e8f536feb26f749ed9198f56f397da08f018de9518674b2ac12a41061612cb, +9a9c7db86b1a67a399d50f7f45b1d4bbb9179bcf0be08331239a1b9881ebcea9, testnet: e87ec8451768ddadc3364b48efdc8f47b79e7723eb69c75ae3e7083bf48985b1) .HP @@ -403,7 +403,7 @@ optional). If is not supplied or if = 1, output all debugging information. can be: net, tor, mempool, http, bench, zmq, db, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, -libevent, coindb, qt, leveldb, pow. +libevent, coindb, qt, leveldb. .HP \fB\-debugexclude=\fR .IP @@ -433,6 +433,10 @@ transactions (default: 0.10) .IP Send trace/debug info to console instead of debug.log file .HP +\fB\-prunedebuglogfile\fR +.IP +Prune (limit) filesize of debug.log +.HP \fB\-shrinkdebugfile\fR .IP Shrink debug.log file on client startup (default: 1 when no \fB\-debug\fR) diff --git a/doc/man/sugarchain-tx.1 b/doc/man/sugarchain-tx.1 index 17e1d6380..2f97132bf 100644 --- a/doc/man/sugarchain-tx.1 +++ b/doc/man/sugarchain-tx.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH SUGARCHAIN-TX "1" "March 2020" "sugarchain-tx v0.16.3.30" "User Commands" +.TH SUGARCHAIN-TX "1" "June 2020" "sugarchain-tx v0.16.3.34" "User Commands" .SH NAME -sugarchain-tx \- manual page for sugarchain-tx v0.16.3.30 +sugarchain-tx \- manual page for sugarchain-tx v0.16.3.34 .SH DESCRIPTION -Sugarchain Yumekawa sugarchain\-tx utility version v0.16.3.30 +Sugarchain Yumekawa sugarchain\-tx utility version v0.16.3.34 .SS "Usage:" .TP sugarchain\-tx [options] [commands] diff --git a/doc/man/sugarchaind.1 b/doc/man/sugarchaind.1 index 6ecd8e5b6..6bba5275a 100644 --- a/doc/man/sugarchaind.1 +++ b/doc/man/sugarchaind.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH SUGARCHAIND "1" "March 2020" "sugarchaind v0.16.3.30" "User Commands" +.TH SUGARCHAIND "1" "June 2020" "sugarchaind v0.16.3.34" "User Commands" .SH NAME -sugarchaind \- manual page for sugarchaind v0.16.3.30 +sugarchaind \- manual page for sugarchaind v0.16.3.34 .SH DESCRIPTION -Sugarchain Yumekawa Daemon version v0.16.3.30 +Sugarchain Yumekawa Daemon version v0.16.3.34 .SS "Usage:" .TP sugarchaind [options] @@ -33,7 +33,7 @@ block hash) If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: -56e8f536feb26f749ed9198f56f397da08f018de9518674b2ac12a41061612cb, +9a9c7db86b1a67a399d50f7f45b1d4bbb9179bcf0be08331239a1b9881ebcea9, testnet: e87ec8451768ddadc3364b48efdc8f47b79e7723eb69c75ae3e7083bf48985b1) .HP @@ -408,7 +408,7 @@ optional). If is not supplied or if = 1, output all debugging information. can be: net, tor, mempool, http, bench, zmq, db, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, -libevent, coindb, qt, leveldb, pow. +libevent, coindb, qt, leveldb. .HP \fB\-debugexclude=\fR .IP @@ -438,6 +438,10 @@ transactions (default: 0.10) .IP Send trace/debug info to console instead of debug.log file .HP +\fB\-prunedebuglogfile\fR +.IP +Prune (limit) filesize of debug.log +.HP \fB\-shrinkdebugfile\fR .IP Shrink debug.log file on client startup (default: 1 when no \fB\-debug\fR) diff --git a/doc/release-notes.md b/doc/release-notes.md index 898f40a2e..1b51ca71e 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -1,3 +1,67 @@ +## Yumekawa v0.16.3.34-starboy +- Version: Final Release +- Date: 2020-06-07 + +**Changes:** +- Major Fix: + * Fix: IBD `30%` faster, and `60%` reduced data traffic + [#122](https://github.com/sugarchain-project/sugarchain/pull/122) + * Add: new option `-prunedebuglogfile`: limit filesize of debug.log + [#110](https://github.com/sugarchain-project/sugarchain/pull/110) + * Add: when IBD, print blockheader count on debug.log (only sugarchain-qt) + [#128](https://github.com/sugarchain-project/sugarchain/pull/128) + * Update: checkpoints (mainnet) + [#132](https://github.com/sugarchain-project/sugarchain/pull/132) + * Fix: IBD optimizing + [#135](https://github.com/sugarchain-project/sugarchain/pull/135) + [#22 (comment)](https://github.com/sugarchain-project/sugarchain/pull/22#issuecomment-568301895) + * Update: seed list + [#144](https://github.com/sugarchain-project/sugarchain/pull/144) + * Remove: BCLog::POW (-debug=pow) + [#142](https://github.com/sugarchain-project/sugarchain/pull/142) +- Minor Fix: + * GUI: display size in `MB` (was GB) + [#125](https://github.com/sugarchain-project/sugarchain/pull/125) + * Revert: IBD settings back to BTC original + [#124](https://github.com/sugarchain-project/sugarchain/pull/124) + * Add: bootstrap height at `4421701` + [#143](https://github.com/sugarchain-project/sugarchain/pull/143) + * Fix: travis pathlib2 + [#148](https://github.com/sugarchain-project/sugarchain/pull/148) + +**Known Issues** +- Transaction too large: + * This is a part of BTC. + * It will be fixed in next *Taproot+Schnorr* update. +- Slow update balance on wallet: + * This slow is a part of BTC. + * Update total balance *every minute (12 blocks)* interval. + * This fix is a (nice) workaround for now. [source](https://github.com/sugarchain-project/sugarchain/commit/72436c90b29844cf507895df053103f9b6840776#diff-2e3836af182cfb375329c3463ffd91f8) +- Poor performance on ARM CPUs (32/64-Bit): + * No ARM optimization for Yespower yet. +- Poor performance on 32-Bit OS: + * No SSE2 optimization for Yespower yet. [source](https://github.com/sugarchain-project/sugarchain/blob/d977987a83aba115d50a9130f0d7914330d1bc75/src/crypto/yespower-1.0.1/yespower-opt.c#L59) +- Slow startup on low memory machines: + * Startup can take up to some hours on 1cpu 1024ram (+swap 3GB) VPS. + * Workaround is just increase RAM at least 2 GB. +- Slow rescanning `wallet.dat`: + * If your wallet is too heavy or mining purpose, it may take very long when importing. + +**Credits:** +Thanks to everyone who directly contributed to this release +- decryp2kanon +- solardiz (original Yespower author) +- barrystyle +- volbil +- Nugetzrul3 +- cryptozeny + +**Financial Support:** +We give our utmost thanks to the donors. This donation will be used for our future development. See [donations](https://github.com/sugarchain-project/Donations/blob/master/README.md). +- Rakutens + +----- + ## Yumekawa v0.16.3.30-moonlight - Version: Final Release - Date: 2020-03-02 @@ -42,12 +106,11 @@ [#85](https://github.com/sugarchain-project/sugarchain/pull/85) [#92](https://github.com/sugarchain-project/sugarchain/pull/92) -**[Known Issues](https://github.com/sugarchain-project/sugarchain#known-issues)** +**Known Issues** +Same as before **Credits:** - Thanks to everyone who directly contributed to this release - - solardiz (original Yespower author) - volbil - okoto-xyz @@ -55,7 +118,6 @@ Thanks to everyone who directly contributed to this release - cryptozeny **Financial Support:** - We give our utmost thanks to the donors. This donation will be used for our future development. See [donations](https://github.com/sugarchain-project/Donations/blob/master/README.md). - 唐伯虎 @@ -84,11 +146,22 @@ We give our utmost thanks to the donors. This donation will be used for our futu * add: bootstrap linearize at height `650000`, `1043000` * fix: comment error (#6) -**[Known Issues](https://github.com/sugarchain-project/sugarchain#known-issues)** +**Known Issues** +- Transaction too large: + * This is a part of BTC. + * It will be fixed in next *Schnorr Signature* update. +- Slow update balance on wallet: + * Update total balance *every minute (12 blocks)* interval. + * This slow is a part of BTC. + * This fix is a (nice) workaround for now. [source](https://github.com/sugarchain-project/sugarchain/commit/72436c90b29844cf507895df053103f9b6840776#diff-2e3836af182cfb375329c3463ffd91f8) +- Poor performance on ARM CPUs (32/64-Bit): + * ARM optimization for Yespower disabled for now. +- Poor performance on 32-Bit OS: + * SSE2 for Yespower disabled for now. [source](https://github.com/sugarchain-project/sugarchain/blob/d977987a83aba115d50a9130f0d7914330d1bc75/src/crypto/yespower-1.0.1/yespower-opt.c#L59) + * Please use *64-bit* for best performance. **Credits:** Thanks to everyone who directly contributed to this release (alphabetical order) - - AestheticSenpai - cryptozeny - ilmango-doge diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 9e59fa33c..07216d0ee 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -214,10 +214,15 @@ class CMainParams : public CChainParams { consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; // The best chain should have at least this much work. - consensus.nMinimumChainWork = uint256S("00000000000000000000000000000000000000000000000000000b63a48c5c1e"); // getblockhash 2601001 "chainwork" // TODO.SUGAR.UPDATE + // TODO.SUGAR.UPDATE + // (510*510*17)+1=4421701 + // getblockhash 4421701 && "chainwork" + consensus.nMinimumChainWork = uint256S("0000000000000000000000000000000000000000000000000000214f0c90bb88"); // By default assume that the signatures in ancestors of this block are valid. - consensus.defaultAssumeValid = uint256S("56e8f536feb26f749ed9198f56f397da08f018de9518674b2ac12a41061612cb"); // getblockhash 2601001 "hash" // TODO.SUGAR.UPDATE + // TODO.SUGAR.UPDATE + // getblockhash 4421701 && "hash" + consensus.defaultAssumeValid = uint256S("9a9c7db86b1a67a399d50f7f45b1d4bbb9179bcf0be08331239a1b9881ebcea9"); /** * The message start string is designed to be unlikely to occur in normal data. @@ -277,16 +282,17 @@ class CMainParams : public CChainParams { {512, uint256S("094afbe86930e4950c601fde563cd2c7b9d050c1b567ad6fe48ae3b15a705ebb")}, {900000, uint256S("8a566a463925cf028cb427edb6d4d18a9c1213bf472d9032369c4e45449eb71c")}, {2601511, uint256S("e30af0fcf522354f43c3ab2cfb4805d175b1264608b6124eab0b635bdea2589d")}, // 2601511=2601001+510 + {4422211, uint256S("1f4186606aaab3cb3818f073599602e573476da9fed0b65c9f14646210d6b18f")}, // 4422211=4421701+510 // TODO.SUGAR.UPDATE } }; // TODO.SUGAR.UPDATE chainTxData = ChainTxData{ - // Data from RPC: getchaintxstats 4096 e30af0fcf522354f43c3ab2cfb4805d175b1264608b6124eab0b635bdea2589d (2601511) - /* nTime */ 1579620817, - /* nTxCount */ 2788446, - /* dTxRate */ 0.2125159767967751 + // Data from RPC: getchaintxstats 4096 1f4186606aaab3cb3818f073599602e573476da9fed0b65c9f14646210d6b18f (4422211) + /* nTime */ 1588725180, + /* nTxCount */ 4695912, + /* dTxRate */ 0.2072510822510822 }; } }; diff --git a/src/chainparamsseeds.h b/src/chainparamsseeds.h index a5b4184cf..65e75021c 100644 --- a/src/chainparamsseeds.h +++ b/src/chainparamsseeds.h @@ -8,21 +8,22 @@ * IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly. */ static SeedSpec6 pnSeed6_main[] = { - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x31,0xe9,0x89,0x6c}, 34230}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x33,0x59,0xad,0xb2}, 34230}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6c,0xa0,0x86,0x2f}, 34230}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x76,0x19,0x03,0xf2}, 34230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3e,0x8d,0x45,0xdb}, 34230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x59,0xaf,0x15,0x3c}, 34230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8b,0x63,0x44,0xdd}, 34230}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x96,0x5f,0x8b,0xe1}, 34230}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x96,0x6d,0x69,0xcd}, 34230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9b,0x8a,0x8b,0x61}, 34230}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9d,0xf5,0x45,0x0f}, 34230}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9f,0xe2,0x49,0x16}, 34230}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa0,0x77,0x65,0xdb}, 34230}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa3,0x2c,0xae,0xb8}, 34230}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x17,0xb5,0x77}, 34230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcf,0x94,0x54,0x80}, 34230}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd3,0x90,0x78,0xa4}, 34230} }; static SeedSpec6 pnSeed6_test[] = { - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x85,0x82,0x7f,0xbd}, 44230} + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2d,0x4c,0xc2,0xac}, 44230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x96,0x5f,0x92,0xb9}, 44230}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x96,0x5f,0x9a,0x18}, 44230} }; #endif // BITCOIN_CHAINPARAMSSEEDS_H diff --git a/src/init.cpp b/src/init.cpp index 1af72a2e2..385f15361 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -478,6 +478,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-maxtxfee=", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction or raw transaction; setting this too low may abort large transactions (default: %s)"), CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE))); strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file")); + strUsage += HelpMessageOpt("-prunedebuglogfile", _("Prune (limit) filesize of debug.log")); // FIXME.SUGAR // prune debug.log if (showDebug) { strUsage += HelpMessageOpt("-printpriority", strprintf("Log transaction fee per kB when mining blocks (default: %u)", DEFAULT_PRINTPRIORITY)); @@ -832,6 +833,7 @@ static std::string ResolveErrMsg(const char * const optname, const std::string& void InitLogging() { fPrintToConsole = gArgs.GetBoolArg("-printtoconsole", false); + fPruneDebugLog = gArgs.GetBoolArg("-prunedebuglogfile", false); // FIXME.SUGAR // prune debug.log fLogTimestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); fLogTimeMicros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 139998042..9c8aef688 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1398,7 +1398,7 @@ bool static ProcessHeadersMessage(CNode *pfrom, CConnman *connman, const std::ve } // FIXME.SUGAR - // 120x bitcoin // IBD: disable additional download during IBD, due to too much traffic + // IBD: disable additional download during IBD, due to too much traffic /* if (nCount == MAX_HEADERS_RESULTS) { // Headers message had its maximum size; the peer may have more headers. @@ -3589,7 +3589,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic& interruptM // Note: If all our peers are inbound, then we won't // disconnect our sync peer for stalling; we have bigger // problems if we can't get any outbound peers. - if (!pto->fWhitelisted && !IsInitialBlockDownload()) { // FIXME.SUGAR // IBD: do not disconnect *whitelisted* peers during IBD + if (!pto->fWhitelisted) { LogPrintf("Timeout downloading headers from peer=%d, disconnecting\n", pto->GetId()); pto->fDisconnect = true; return true; diff --git a/src/pow.cpp b/src/pow.cpp index 16ca8c3a9..76f9fafbc 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -12,8 +12,6 @@ #include #include -#include // DigiShieldZEC - unsigned int GetNextWorkRequired_BTC(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { assert(pindexLast != nullptr); @@ -93,8 +91,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead if (params.fPowNoRetargeting && params.fPowAllowMinDifficultyBlocks) { // Special difficulty rule for REGTEST: NO RETARGET // It fixs test/validation_block_tests/processnewblock_signals_ordering - LogPrint(BCLog::POW, "GetNextWorkRequired \033[31;1mNO DIFFICULTY RETARGET\033[0m\n"); // NO DIFFICULTY RETARGET: red - LogPrint(BCLog::POW, "pindexLast->nBits = 0x%x\n", pindexLast->nBits); return pindexLast->nBits; } @@ -131,16 +127,10 @@ unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg, int64_t nLastBlockTime, int64_t nFirstBlockTime, const Consensus::Params& params) { - // BEGIN - DEBUG for - LogPrint(BCLog::POW, "\n\nbnAvg=%s nLastBlockTime=%d nFirstBlockTime=%d params=%s\n\n", bnAvg.ToString(), nLastBlockTime, nFirstBlockTime, ¶ms); - // END - DEBUG for - // Limit adjustment step // Use medians to prevent time-warp attacks int64_t nActualTimespan = nLastBlockTime - nFirstBlockTime; - LogPrint(BCLog::POW, " nActualTimespan = %d before dampening\n", nActualTimespan); nActualTimespan = params.AveragingWindowTimespan() + (nActualTimespan - params.AveragingWindowTimespan())/4; - LogPrint(BCLog::POW, " nActualTimespan = %d before bounds\n", nActualTimespan); if (nActualTimespan < params.MinActualTimespan()) nActualTimespan = params.MinActualTimespan(); @@ -156,13 +146,6 @@ unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg, if (bnNew > bnPowLimit) bnNew = bnPowLimit; - /// debug print - LogPrint(BCLog::POW, "GetNextWorkRequired RETARGET\n"); - LogPrint(BCLog::POW, "params.AveragingWindowTimespan() = %d nActualTimespan = %d\n", params.AveragingWindowTimespan(), nActualTimespan); - LogPrint(BCLog::POW, "Timespan ratio: %d / %d = \033[31;1m%.3g\033[0m\n", params.AveragingWindowTimespan(), nActualTimespan, (double)params.AveragingWindowTimespan()/(double)nActualTimespan); // Timespan ratio: Red - LogPrint(BCLog::POW, "Current average: %08x %s\n", bnAvg.GetCompact(), bnAvg.ToString()); - LogPrint(BCLog::POW, "After: %08x %s %d\n", bnNew.GetCompact(), bnNew.ToString(), bnNew.GetCompact()); - return bnNew.GetCompact(); } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 919c919ee..2629502c0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -32,6 +32,8 @@ #include #include +#include // FIXME.SUGAR // IBD: for IsInitialBlockDownload() + #include #include @@ -758,8 +760,15 @@ void BitcoinGUI::updateHeadersSyncProgressLabel() int64_t headersTipTime = clientModel->getHeaderTipTime(); int headersTipHeight = clientModel->getHeaderTipHeight(); int estHeadersLeft = (GetTime() - headersTipTime) / Params().GetConsensus().nPowTargetSpacing; - if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) + if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) { progressBarLabel->setText(tr("Syncing Headers (%1%)...").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, 'f', 1))); + + // FIXME.SUGAR + // IBD: Print blockheader count on debug.log + // Start to print if the percentage is over 1.0% to make clean + if (IsInitialBlockDownload() && (100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight) >= 1.0) + LogPrintf("headers=%d(%.1f%%)\n", headersTipHeight, (100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight)); + } } void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 32232e02e..6305727a8 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1006,7 +1006,10 @@ QString formatBytes(uint64_t bytes) if(bytes < 1024 * 1024 * 1024) return QString(QObject::tr("%1 MB")).arg(bytes / 1024 / 1024); - return QString(QObject::tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); + // FIXME.SUGAR + // Do not display in GB + // return QString(QObject::tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); + return QString(QObject::tr("%1 MB")).arg(bytes / 1024 / 1024); } qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) { diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index fc8acbf61..8881c2d46 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -22,9 +22,9 @@ static const uint64_t GB_BYTES = 1000000000LL; /* Minimum free space (in GB) needed for data directory */ -static const uint64_t BLOCK_CHAIN_SIZE = 2; // inaccurate size +static const uint64_t BLOCK_CHAIN_SIZE = 3; // in GB as an integer // TODO.SUGAR.UPDATE /* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */ -static const uint64_t CHAIN_STATE_SIZE = 1; // inaccurate size // should INT +static const uint64_t CHAIN_STATE_SIZE = 1; // in GB as an integer // TODO.SUGAR.UPDATE /* Total required space (in GB) depending on user choice (prune, not prune) */ static uint64_t requiredSpace; diff --git a/src/util.cpp b/src/util.cpp index 2c77d237c..475a5e4db 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -89,6 +89,7 @@ const char * const DEFAULT_DEBUGLOGFILE = "debug.log"; ArgsManager gArgs; bool fPrintToConsole = false; bool fPrintToDebugLog = true; +bool fPruneDebugLog = false; // FIXME.SUGAR // prune debug.log bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS; bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS; @@ -252,7 +253,6 @@ const CLogCategoryDesc LogCategories[] = {BCLog::COINDB, "coindb"}, {BCLog::QT, "qt"}, {BCLog::LEVELDB, "leveldb"}, - {BCLog::POW, "pow"}, {BCLog::ALL, "1"}, {BCLog::ALL, "all"}, }; @@ -373,6 +373,45 @@ int LogPrintStr(const std::string &str) ret = FileWriteStr(strTimestamped, fileout); } + + // FIXME.SUGAR // prune debug.log + // BEGIN - PRUNE DEBUG.LOG + // If debug.log is over 10 MB (10*1000*1000), shrink to 1 MB (1*1000*1000) + // see "void ShrinkDebugFile()" + if (fPrintToDebugLog && fPruneDebugLog && !fPrintToConsole) + { + { + // Amount of debug.log to save at end when shrinking (must fit in memory) + constexpr size_t RECENT_DEBUG_HISTORY_SIZE = 1*1000*1000; // was (10 * 1000000) + // Scroll debug.log if it's getting too big + fs::path pathLog = GetDebugLogPath(); + FILE* file = fsbridge::fopen(pathLog, "r"); + // If debug.log file is more than 10x bigger the RECENT_DEBUG_HISTORY_SIZE + // trim it down by saving only the last RECENT_DEBUG_HISTORY_SIZE bytes + if (file && fs::file_size(pathLog) > 10 * RECENT_DEBUG_HISTORY_SIZE) // was (11 * (RECENT_DEBUG_HISTORY_SIZE / 10))) + { + // BEGIN - DEBUG FILESIZE + printf("%s DEBUG.LOG PRUNED at %lu\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str(), fs::file_size(pathLog)); + // END - DEBUG FILESIZE + + // Restart the file with some of the end + std::vector vch(RECENT_DEBUG_HISTORY_SIZE, 0); + fseek(file, -((long)vch.size()), SEEK_END); + int nBytes = fread(vch.data(), 1, vch.size(), file); + fclose(file); + + file = fsbridge::fopen(pathLog, "w"); + if (file) + { + fwrite(vch.data(), 1, nBytes, file); + fclose(file); + } + } + else if (file != nullptr) + fclose(file); + } + } + // END - PRUNE LOG } return ret; } diff --git a/src/util.h b/src/util.h index ad2577e78..adf291dfb 100644 --- a/src/util.h +++ b/src/util.h @@ -49,6 +49,7 @@ class CTranslationInterface extern bool fPrintToConsole; extern bool fPrintToDebugLog; +extern bool fPruneDebugLog; // FIXME.SUGAR // prune debug.log extern bool fLogTimestamps; extern bool fLogTimeMicros; @@ -104,7 +105,6 @@ namespace BCLog { COINDB = (1 << 18), QT = (1 << 19), LEVELDB = (1 << 20), - POW = (1 << 21), ALL = ~(uint32_t)0, }; } diff --git a/src/validation.cpp b/src/validation.cpp index 1745b1720..834c6bf13 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3357,6 +3357,13 @@ static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, if (fCheckPOW && !CheckProofOfWork(block.GetPoWHash_cached(), block.nBits, consensusParams)) return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed"); + // FIXME.SUGAR // check PoW: SKIPPED during downloading headers (IBD) + // You can see this log when IBD. + // This means PoW check during IBD is not actually skipped, but still its checking in another places. + // What we skipped is only when Downloading headers, but not else. This makes IBD much faster. + // if (IsInitialBlockDownload()) + // printf("%s IBD=%d CBH=%s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str(), IsInitialBlockDownload(), block.GetHash().ToString().c_str()); + return true; } @@ -3367,8 +3374,9 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P if (block.fChecked) return true; + // FIXME.SUGAR // check PoW: SKIPPED during downloading headers (IBD) // Check that the header is valid (particularly PoW). This is mostly - // redundant with the call in AcceptBlockHeader. + // redundant with the call in AcceptBlockHeader, but when IBD mode, its SKIPPED. if (!CheckBlockHeader(block, state, consensusParams, fCheckPOW)) return false; @@ -3644,7 +3652,9 @@ bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState& return true; } - if (!CheckBlockHeader(block, state, chainparams.GetConsensus())) + // FIXME.SUGAR // check PoW: SKIPPED during downloading headers (IBD) + // IBD: do not check PoW (Yespower) during Download headers for performance reason + if (!IsInitialBlockDownload() && !CheckBlockHeader(block, state, chainparams.GetConsensus())) return error("%s: Consensus::CheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); // Get prev block index diff --git a/src/validation.h b/src/validation.h index 4c91c94f4..8be330c1a 100644 --- a/src/validation.h +++ b/src/validation.h @@ -85,8 +85,17 @@ static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB static const int MAX_SCRIPTCHECK_THREADS = 16; /** -par default (number of script-checking threads, 0 = auto) */ static const int DEFAULT_SCRIPTCHECK_THREADS = 0; + /** Number of blocks that can be requested at any given time from a single peer. */ -static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16; +// FIXME.SUGAR +// GetPoWHash_cached +/** IBD: which sets MAX_BLOCKS_IN_TRANSIT_PER_PEER to be same as MAX_HEADERS_RESULTS. + * Without this change, at least in Resistance the block headers download would get unnecessarily + * far ahead of the full blocks download, resulting in more work lost and redone in case the + * initial blocks download is interrupted and continued. + * The work loss is because we do not yet store cached PoWs on disk. */ +static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 2000; // (was 16) + /** Timeout in seconds during which a peer must stall block download progress before being disconnected. */ static const unsigned int BLOCK_STALLING_TIMEOUT = 2; /** Number of headers sent in one getheaders result. We rely on the assumption that if a peer sends