diff --git a/configure.ac b/configure.ac index a972c327e..77671e2c5 100644 --- a/configure.ac +++ b/configure.ac @@ -3,12 +3,12 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 3) dnl Must be kept in sync with src/clientversion.h , ugh! define(_CLIENT_VERSION_MINOR, 10) -define(_CLIENT_VERSION_REVISION, 0) +define(_CLIENT_VERSION_REVISION, 1) define(_CLIENT_VERSION_BUILD, 50) define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50))) define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1))) define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2023) +define(_COPYRIGHT_YEAR, 2024) AC_INIT([Hush],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_SUFFIX(_ZC_BUILD_VAL)],[https://git.hush.is/hush/hush3],[hush]) AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) diff --git a/contrib/block_time.pl b/contrib/block_time.pl index 1b7c6a914..0a9bf6e53 100755 --- a/contrib/block_time.pl +++ b/contrib/block_time.pl @@ -7,14 +7,18 @@ use strict; # Given a block time, estimate when it will happen my $block = shift || die "Usage: $0 123"; +my $coin = shift || ''; my $hush = "./src/hush-cli"; unless (-e $hush) { die "$hush does not exist, aborting"; } +if ($coin) { + $hush .= " -ac_name=$coin"; +} my $blockcount = qx{$hush getblockcount}; unless ($blockcount = int($blockcount)) { - print "Invalid response from hush-cli\n"; + print "Invalid response from $hush\n"; exit 1; } @@ -22,13 +26,24 @@ if ($block <= $blockcount) { die "That block has already happened!"; } else { my $diff = $block - $blockcount; - my $minutes = $diff*1.25; # 75s in minutes + my $minpb = 1.25; # 75s in minutes for HUSH3 + if ($coin eq 'DRAGONX') { + $minpb = 0.6; # minutes per block + } elsif ($coin) { + # TODO: support custom bloctimes + $minpb = 1; # assumes default blocktime of 60s + } + my $minutes = $diff*$minpb; my $seconds = $minutes*60; my $now = time; my $then = $now + $seconds; my $ldate = localtime($then); my $gmdate = gmtime($then); - print "Hush Block $block will happen at roughly:\n"; + if ($coin) { + print "$coin Block $block will happen at roughly:\n"; + } else { + print "Hush Block $block will happen at roughly:\n"; + } print "$ldate Eastern # $then\n"; print "$gmdate GMT # $then\n"; } diff --git a/depends/packages/libcurl.mk b/depends/packages/libcurl.mk index 92c319a70..96c41e0b5 100644 --- a/depends/packages/libcurl.mk +++ b/depends/packages/libcurl.mk @@ -14,7 +14,7 @@ $(package)_dependencies=wolfssl $(package)_download_path=https://curl.haxx.se/download $(package)_config_opts_linux=--disable-shared --enable-static --without-ssl --prefix=$(host_prefix) --host=$(host) $(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --with-wolfssl --without-ssl --prefix=$(host_prefix) --host=x86_64-w64-mingw32 -$(package)_config_opts_darwin=--disable-shared --enable-static --with-wolfssl --without-ssl --prefix=$(host_prefix) +$(package)_config_opts_darwin=--disable-shared --enable-static --without-ssl --prefix=$(host_prefix) $(package)_cflags_darwin=-mmacosx-version-min=10.9 $(package)_conf_tool=./configure diff --git a/doc/man/hush-cli.1 b/doc/man/hush-cli.1 index d39016e53..c2e81580b 100644 --- a/doc/man/hush-cli.1 +++ b/doc/man/hush-cli.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. -.TH HUSH-CLI "1" "November 2023" "hush-cli v3.10.0" "User Commands" +.TH HUSH-CLI "1" "January 2024" "hush-cli v3.10.1" "User Commands" .SH NAME -hush-cli \- manual page for hush-cli v3.10.0 +hush-cli \- manual page for hush-cli v3.10.1 .SH DESCRIPTION -Hush RPC client version v3.10.0\-4facbadc6\-dirty +Hush RPC client version v3.10.1\-05ee31891\-dirty .PP In order to ensure you are adequately protecting your privacy when using Hush, please see . @@ -75,7 +75,7 @@ Read extra arguments from standard input, one per line until EOF/Ctrl\-D In order to ensure you are adequately protecting your privacy when using Hush, please see . -Copyright (C) 2016-2023 Duke Leto and The Hush Developers +Copyright (C) 2016-2024 Duke Leto and The Hush Developers Copyright (C) 2016-2020 jl777 and SuperNET developers diff --git a/doc/man/hush-tx.1 b/doc/man/hush-tx.1 index fcec88245..5c1867b46 100644 --- a/doc/man/hush-tx.1 +++ b/doc/man/hush-tx.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. -.TH HUSH-TX "1" "November 2023" "hush-tx v3.10.0" "User Commands" +.TH HUSH-TX "1" "January 2024" "hush-tx v3.10.1" "User Commands" .SH NAME -hush-tx \- manual page for hush-tx v3.10.0 +hush-tx \- manual page for hush-tx v3.10.1 .SH DESCRIPTION -hush\-tx utility version v3.10.0\-4facbadc6\-dirty +hush\-tx utility version v3.10.1\-05ee31891\-dirty .SS "Usage:" .TP hush\-tx [options] [commands] @@ -89,7 +89,7 @@ Set register NAME to given JSON\-STRING In order to ensure you are adequately protecting your privacy when using Hush, please see . -Copyright (C) 2016-2023 Duke Leto and The Hush Developers +Copyright (C) 2016-2024 Duke Leto and The Hush Developers Copyright (C) 2016-2020 jl777 and SuperNET developers diff --git a/doc/man/hushd.1 b/doc/man/hushd.1 index fca19a54b..2f6fe2d2a 100644 --- a/doc/man/hushd.1 +++ b/doc/man/hushd.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13. -.TH HUSHD "1" "November 2023" "hushd v3.10.0" "User Commands" +.TH HUSHD "1" "January 2024" "hushd v3.10.1" "User Commands" .SH NAME -hushd \- manual page for hushd v3.10.0 +hushd \- manual page for hushd v3.10.1 .SH DESCRIPTION -Hush Daemon version v3.10.0\-4facbadc6\-dirty +Hush Daemon version v3.10.1\-05ee31891\-dirty .PP In order to ensure you are adequately protecting your privacy when using Hush, please see . @@ -771,7 +771,7 @@ Enforce transaction\-rate limit, default 0 In order to ensure you are adequately protecting your privacy when using Hush, please see . -Copyright (C) 2016-2023 Duke Leto and The Hush Developers +Copyright (C) 2016-2024 Duke Leto and The Hush Developers Copyright (C) 2016-2020 jl777 and SuperNET developers diff --git a/doc/release-process.md b/doc/release-process.md index 497ad0daa..566de1b1f 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -26,7 +26,8 @@ If the last command has no output, congrats, there is nothing to do. If the last ``` git checkout master git merge --no-ff dev # using the default commit message is fine -git push origin master +git tag vX.Y.Z # this creates a tag vX.Y.Z on current master, or you can let gitea do it later +git push --tags origin master git checkout dev git merge master git push origin dev diff --git a/doc/relnotes/README.md b/doc/relnotes/README.md index 36da43edb..ff09ce3a1 100644 --- a/doc/relnotes/README.md +++ b/doc/relnotes/README.md @@ -10,6 +10,23 @@ and no longer on Github, since they banned Duke Leto and also because they censor many people around the world and work with evil organizations. +# Hush 3.10.1 "Oneiric Octopus" + +This is an OPTIONAL but RECOMMENDED release for Hush full nodes. It fixes an important bug +that affects new Hush nodes. It also makes syncing faster for both Hushd and DragonX nodes. + +``` + 26 files changed, 257 insertions(+), 429 deletions(-) +``` + + * Fix the bug which causes "payment to wrong pubkey" error when syncing a new node + * Faster syncing of Hush and DragonX full nodes + * Slightly less memory usage in each Equihash/RandomX mining thread + * Fixed compiling issues related to RandomX v1.2.1 + * Improved RPC docs for `getblocktemplate` + * Removed the `getdeprecationinfo` RPC + + # Hush 3.10.0 "Sassy Siphonophore" ``` diff --git a/src/Makefile.am b/src/Makefile.am index 6178fa19e..7869af310 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -165,7 +165,6 @@ BITCOIN_CORE_H = \ consensus/validation.h \ core_io.h \ core_memusage.h \ - deprecation.h \ fs.h \ hash.h \ httprpc.h \ @@ -300,7 +299,6 @@ libbitcoin_server_a_SOURCES = \ fs.cpp \ crosschain.cpp \ crosschain_authority.cpp \ - deprecation.cpp \ httprpc.cpp \ httpserver.cpp \ i2p.cpp \ diff --git a/src/RandomX/CMakeLists.txt b/src/RandomX/CMakeLists.txt index ebbdff2b6..b1fdff959 100644 --- a/src/RandomX/CMakeLists.txt +++ b/src/RandomX/CMakeLists.txt @@ -96,7 +96,7 @@ function(add_flag flag) endfunction() # x86-64 -if ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64")) +if (ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64") list(APPEND randomx_sources src/jit_compiler_x86.cpp) diff --git a/src/RandomX/src/virtual_memory.c b/src/RandomX/src/virtual_memory.c index d2cdcda0f..9b06ad050 100644 --- a/src/RandomX/src/virtual_memory.c +++ b/src/RandomX/src/virtual_memory.c @@ -148,9 +148,9 @@ void* allocMemoryPages(size_t bytes) { mem = NULL; #if defined(USE_PTHREAD_JIT_WP) && defined(MAC_OS_VERSION_11_0) \ && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 - if (__builtin_available(macOS 11.0, *)) { + //if (__builtin_available(macOS 11.0, *)) { pthread_jit_write_protect_np(0); - } + //} #endif #endif return mem; @@ -173,11 +173,11 @@ void setPagesRW(void* ptr, size_t bytes) { char *errfunc; #if defined(USE_PTHREAD_JIT_WP) && defined(MAC_OS_VERSION_11_0) \ && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 - if (__builtin_available(macOS 11.0, *)) { + //if (__builtin_available(macOS 11.0, *)) { pthread_jit_write_protect_np(0); - } else { - pageProtect(ptr, bytes, PAGE_READWRITE, &errfunc); - } + //} else { + // pageProtect(ptr, bytes, PAGE_READWRITE, &errfunc); + //} #else pageProtect(ptr, bytes, PAGE_READWRITE, &errfunc); #endif @@ -187,12 +187,12 @@ void setPagesRX(void* ptr, size_t bytes) { char *errfunc; #if defined(USE_PTHREAD_JIT_WP) && defined(MAC_OS_VERSION_11_0) \ && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 - if (__builtin_available(macOS 11.0, *)) { + //if (__builtin_available(macOS 11.0, *)) { pthread_jit_write_protect_np(1); __builtin___clear_cache((char*)ptr, ((char*)ptr) + bytes); - } else { - pageProtect(ptr, bytes, PAGE_EXECUTE_READ, &errfunc); - } + //} else { + // pageProtect(ptr, bytes, PAGE_EXECUTE_READ, &errfunc); + //} #else pageProtect(ptr, bytes, PAGE_EXECUTE_READ, &errfunc); #endif diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 8b5644c2f..88e9f7308 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -1877,9 +1877,53 @@ void *chainparams_commandline() { (1576000, uint256S("0x00000001b67093fd107d5dd39e75e23103bceca5e32d7e4c27732897492780de")) (1577000, uint256S("0x00000001cac9f3fd5737948e8cf2265ada33160ba67d94a66cd85f908cbab004")) (1578000, uint256S("0x00000002db302bc36ed573796784357f4b4996c01d17a0eee0563c229060e1a8")) - ,(int64_t) 1700673191, // time of last checkpointed block - (int64_t) 2400163, // total txs - (double) 1220 // txs in the last day before block 1578008 + (1579000, uint256S("0x00000004a5aca25e8baeca9bd937e9c5bc27c075690c7d441d2a69b29392a31d")) + (1580000, uint256S("0x0000000897f1f891389334c3cc14841378246bd7666232b52a1a755ac092f8a5")) + (1581000, uint256S("0x00000003e996025437dcd844c62d5778c82bcc9768f2609493bda62ced535cc0")) + (1582000, uint256S("0x00000001ddcdc509e4fa43f34b0eb00308c23e21136c877c6befec8ba232ea95")) + (1583000, uint256S("0x00000003a30285bcb967ae31b97702f3ade300a208a6cdcc2c254ee4b2a66062")) + (1584000, uint256S("0x00000000ccb834eb790011a30aa33fdcdcb443296e3a3ec420e29d6413dce38c")) + (1585000, uint256S("0x00000002d227588d39f9217460a34da268f37aef8f28f9d53fc87314b1ec6b3c")) + (1586000, uint256S("0x00000003ba48bfa7d995099e122c9fbd2e19e42ec42e362d3142f66f8cfd967c")) + (1587000, uint256S("0x000000037ae95bb52e52286223b449519af9994ebc661926360b5813e4b5d560")) + (1588000, uint256S("0x00000005b95fa6cac7772e82f74b8f6130aede11308a0312f1c19cc16338f8f1")) + (1589000, uint256S("0x00000008f29dc9267430f9f3ee93c4893872295473a49e5fd05e19c07eba1fa2")) + (1590000, uint256S("0x0000000124680145c0bef5178b36aab191b7e59a456d7df83c4696eaaec17beb")) + (1591000, uint256S("0x000000042f3d814172a90ee7ff5e5b2125d5414d3f22397f31e42ea93847f4bc")) + (1592000, uint256S("0x000000042e67b7c474b8ea3e00ec14d245d1d1196eb7d4d3e0547f0970fa0707")) + (1593000, uint256S("0x0000000490834e0f188f2916ae426080ab797a5c3c00e2c5bd38a37f6915e544")) + (1594000, uint256S("0x00000007749b27607197da9d6c1daa0bde5ed075cf32c6b1d72dea83351d6a16")) + (1595000, uint256S("0x00000003359c0d869f01d60242d9a3de93e99ec2960b769d3d3ec163648189db")) + (1596000, uint256S("0x000000057dd0a8dfe17f502794b593a83559687dfeb24bf10122ab60c8bbc66b")) + (1597000, uint256S("0x000000050ba2b634de119fc24c363be0e28b0b2fd78c01ffbffed9bbb4d6a96d")) + (1598000, uint256S("0x000000065b982278187da90e228ac479cc355bca7f06c0b786598e93f6ed80f6")) + (1599000, uint256S("0x00000000b17078a591b4746be99aa02419400a9e04e78637db2997cf02350643")) + (1600000, uint256S("0x0000000e4dfb00523f8535e5bbc66401dc0aed33ffcba721c275ca0a35f2477b")) + (1601000, uint256S("0x0000000282b3506902c3b41d51dff89773966e4cf8d85131574a932cad335d6a")) + (1602000, uint256S("0x0000000148a726145cfc3c54927505e1a56be5892e55d5d9549827b95b473f03")) + (1603000, uint256S("0x00000006bab00e8b778e91376f9c6f09f293e5dcf829b58beeb517a89f1972e8")) + (1604000, uint256S("0x000000047ec28daa1ebd35d272006bb99be1bfc432e64fa9ba7558669a0beebc")) + (1605000, uint256S("0x00000002829e77226633eecc400ad22f7c0051e9acea26285ffb12cad1fd3461")) + (1606000, uint256S("0x00000005c2cb7675138e10f36971d9620254bc4781d07f0785c0567068e39ef5")) + (1607000, uint256S("0x00000005703e6b60f7004a502a54615df241f38e1b4f30856a21db2ab8e2a162")) + (1608000, uint256S("0x00000000397c7d1a709c8156ef2d3da4f63b06cef6e16656510e9fb07e398d94")) + (1609000, uint256S("0x000000031accfc8544bde0cf3d160e9c46186d1330bfbc2f075bda9e63e71058")) + (1610000, uint256S("0x00000000318ea4aea52e334b9b3f8bf91e63fe485468936bba68485ae1095a46")) + (1611000, uint256S("0x0000000197b39d70fb42cd31ddc99cc3993f8fcf143f4f13138908bad9be1dfb")) + (1612000, uint256S("0x000000032441e4bbf21affe0c75a11c2aa6e8527be12effc017cb0601dd0d88a")) + (1613000, uint256S("0x00000002ff16ad0bafee22be75b953357ac958b64aa74761017cf27ef349093f")) + (1614000, uint256S("0x00000003a313b96708612dd8223e7d1bf0384b6edc56320a9932f64d1d638db6")) + (1615000, uint256S("0x00000000d192d0150f90daa6b4e2e6f7236cd641314fdced99fce65fe30d48be")) + (1616000, uint256S("0x000000036a26bb9a2481f666975bd98a478b52eb98cc0719fea84bac424a7ba8")) + (1617000, uint256S("0x000000015b35b9e2df778aac51af83403d9f361c582ff8a91a3dc4fdfadf7018")) + (1618000, uint256S("0x0000000638029048e3dff9fba19fcf06b88543ecfe45980cfdb1282670095d85")) + (1619000, uint256S("0x000000025fcd19b079405d3037588012a9cdc138ee633dd5ab5cdef92a8de23d")) + (1620000, uint256S("0x000000048c6667a8724512cbd999bc491ec8522b1f3817001c7ba485dec46d10")) + (1621000, uint256S("0x00000005d981cd3473f8815d18965c0e0035993117390e9659fe8d3b9562c8dc")) + (1622000, uint256S("0x0000000371a1663973c7b19a0b4dd8673f1ddb14a0438c89de3908712437f688")) + ,(int64_t) 1703996480, // time of last checkpointed block + (int64_t) 2450197, // total txs + (double) 1289 // txs in the last day before block 1622466 }; // END HUSH mainnet checkpoint data } else if (strcmp(SMART_CHAIN_SYMBOL,"DRAGONX") == 0) { @@ -2783,9 +2827,102 @@ void *chainparams_commandline() { (894000, uint256S("0x00003681261a9e354a6c39c450ed133e22759b32760d346941b1ffcf78c72637")) (895000, uint256S("0x00003930f93e5f335699d76ed9feff63a7372c5e42215e2089b52ab06a76c5f7")) (896000, uint256S("0x00004d0e19dce5d3faf528cb41b636cd405d54129260054fa7b5d047d97c6f7b")) - ,(int64_t) 1700672140, // time of last checkpointed block - (int64_t) 915277, // total txs - (double) 2410 // txs in the last day before block 896461 + (897000, uint256S("0x000034f1933d827c974fe0b463c2f47d03600b5286bee593a862dfdfbedabeab")) + (898000, uint256S("0x00003ac2943862684f1a753f8baa071d0b87bb37ac9653c0c5f5fd02868d0dc7")) + (899000, uint256S("0x000065bad08079b6c104460b7d3d2a4ff4a54ec89ecc0662649cf420e5388f04")) + (900000, uint256S("0x000023936469313daadbfb35bb1af3ca9c3a0a2f7341e3fd54c73e817bb2b586")) + (901000, uint256S("0x00009a42a0fd6e91c1b302ca778b33cd093c1996a5677efd6dadebf7f855b1fc")) + (902000, uint256S("0x0000510d7d2e2b03a68cb85f6fc053882d8ae05324cd571255c905f7dc2e4184")) + (903000, uint256S("0x00002a955c654e036531a05844298d72378a8cd1fc6c00dfa2b2105ea00edec5")) + (904000, uint256S("0x00003feb74a594eb7fdbca9ff4f54d81d4bbd2c20ac5ec78c52fe5c996ef4c1e")) + (905000, uint256S("0x000002a091febc5c4498e5334cbefe64ef08a0397a94b908253baee18b7193e6")) + (906000, uint256S("0x000022331700860809c0066e3329d18c0b3754ae2c8ebd6eeb0a42d83acccb48")) + (907000, uint256S("0x000009cda75fc593c641567f237ea453535ed3e5c851267a2b43b59b7d82a232")) + (908000, uint256S("0x00005d7fdf2fa669e27ffc8e9e230b36886364e60496108b9b73e166a48e4382")) + (909000, uint256S("0x000053376948fb992c82c3e56d648e8e3de70d3c55192a65b5f0c0a3db5b478d")) + (910000, uint256S("0x000033733d3f6613409f56627cee647bc85066a57b789b248d94fcafc3ba0479")) + (911000, uint256S("0x00000ecf2a1c9272c9f155be408b5fdfb3d41d8a67f5d4d4c9cf45c41731f61c")) + (912000, uint256S("0x00003d2c5c67bf69530bde65945a65296a611bbc09596f5ccfa1af84973e356a")) + (913000, uint256S("0x00000a50a4efcda624ddfe0f6160b14ed6e7dbce3f1f8c1a17967ed2ed1a6d29")) + (914000, uint256S("0x00002c13dad6c6e5bddabd391b3ed5da2f83993af5d9e9137cd777a2859bc934")) + (915000, uint256S("0x00007339913ca51cc74c064838beebd8ba81a92ad082a363e8993ebd44974cd6")) + (916000, uint256S("0x000062d5cf2992756ee1c996940beb97dc40dec98e911f4f101ec2e3c8ad4e40")) + (917000, uint256S("0x000062b4081cdeadd650f1aad8b123b7f7f33c9075bdcdfa3d5ab6e84324f6d9")) + (918000, uint256S("0x00005f4e81c679bd1e1c6dcb6cda0bc1bd024327224b76f614d2a2565b8ba17e")) + (919000, uint256S("0x00007fe72bd2c8d7d40c2dd97e36026d8a298754c9a7a8bfb4f1249fec14729b")) + (920000, uint256S("0x0000660a4c74a8c9d65df6dc9c7d22ced45d560c1d22cf3e248baa02cc773177")) + (921000, uint256S("0x000027a1ae24bf0bba3dadc225089f11146d8148f2d93e487881e3af235aada8")) + (922000, uint256S("0x00000026bf6572a65d7c42300ceee60286a0d0f1ca75da6285ccc81aaf20da33")) + (923000, uint256S("0x000055f21ee2ac27bc82fc8f3490a5e06c91d619a099643648ab2c0f485c784b")) + (924000, uint256S("0x00006606390d5f493eb1497b50ae859980d3ce958ef45e74112b8a1df26d0f8d")) + (925000, uint256S("0x000041fc67cef98bbdd6d9e3a13cb0cd5dd60ffc28de1e2f128e425ebc74ba86")) + (926000, uint256S("0x00004e378cd6512d0feffe6c6d40352ff7a275ca3d21c60633910d90d4fd619b")) + (927000, uint256S("0x00003d3dfafbe41cd72e98c993d61795739d12bbe73c3d88c381172fa687bffa")) + (928000, uint256S("0x000013a74075878f81afc451d5b8d7278aac05e9980feb6dd5d0cc2df05d3bcd")) + (929000, uint256S("0x00007b35381ebbc1aa79d9829aa8897a74e357c497f79b4e214523b28f5201d2")) + (930000, uint256S("0x00004990787bb80cd418e82f5ce14197ea53e4803b88d35233d0a9df06f08ed4")) + (931000, uint256S("0x00006353a8dc66f567c4865540d4d82f6aa323c239953070232436d816fe4239")) + (932000, uint256S("0x000046627e904e21eb12036c13af5260821233b6ce24255a7fd65b4d9f2811ed")) + (933000, uint256S("0x00007cbc4f3b750bc10f6bc51c67c392302259cbbf9d4e3de7e98ee2556d3e29")) + (934000, uint256S("0x000039494242b523c7eb4a8fd669227000654bebdb439793032dcfefa761e978")) + (935000, uint256S("0x00005e1d76e1f3f790d271260466b1cb7317a152e27f3eb3fa5ac02caa9de0b3")) + (936000, uint256S("0x0000803ebc34268fe221568bf74e86b7d00b306a5dcc74e58657eb0eabab4c48")) + (937000, uint256S("0x0000679acd510514d98cd755da8a5f84f86e6d3518e37b60c9d0d3f5360cd1b2")) + (938000, uint256S("0x0000724d82b0c4c8861faae85dbbf518325b5542fbc7838920fdafd69a30b5dd")) + (939000, uint256S("0x00004476db07e186aba89b7dca2e49dc35c967332a4f7d7299193a6d53eac479")) + (940000, uint256S("0x0000541d565f69359359a165f2d74ce18d098b439794e158da4ee6f3e1864bfb")) + (941000, uint256S("0x000058c831cee1349919ac75d2f98d7bc12358a2557cd875f0f57b8f3b7c6d17")) + (942000, uint256S("0x00007c99fb783ee71082d325fdd8ae1d181a4f05cd0034dccf3ff3ef695f1401")) + (943000, uint256S("0x00006596355090e9854b2f22ddf3ae1d1c6308e432311a26e03c92468d69c863")) + (944000, uint256S("0x0000b6659b828fa64d5a9556ded1fae73dbb81ea5d79cb91dc7077147016547c")) + (945000, uint256S("0x00002c0dfb6f97e2b7d1b18133469657a47d51c0daaa1a4925dd5f3708d8b10a")) + (946000, uint256S("0x00007f682e30326b11491e948162ac5c1f3633f52728136af8e961186871adce")) + (947000, uint256S("0x000074ee3cebb3ac37f141363939a33f60b28aebb78af26be86894fc38cc1399")) + (948000, uint256S("0x00001240ad57e861e4c7e06ce22b0c3d3fa1691ad8fd300645d4884d2b325450")) + (949000, uint256S("0x000003b2db4e1c8e07040d8eda6e8ee46faf7ea913610c04faeac8dc9b2a22fd")) + (950000, uint256S("0x000034fc8d33f91264f615b269dc33b5d47b426fc6754273ff7a459081b732dd")) + (951000, uint256S("0x000010b65debabd9db50513314df344d0bd3ea876d9fbb402f16437a8cb51552")) + (952000, uint256S("0x00008e3bd560f59d7b0b3cdac452aa844dc09c43e98f40b0a2c9c58fac76eb01")) + (953000, uint256S("0x000023685660a930b3d9832bad49e3af9415243efad5ab0dd4ed10d90449c36a")) + (954000, uint256S("0x000033172e6d0498112cdee86320a2e629615718e55a19dd26ab86f95e818b11")) + (955000, uint256S("0x00005bf6c2a199b4fab81bfd45a67fd8ce708f16792150450fda4c9918509bef")) + (956000, uint256S("0x00001216493d2732103fca24f1d291cd0c6b60bf6c38dbad1264fa67cfa5647f")) + (957000, uint256S("0x00006e78f92fbf4b78dfd02a7225465819f2dbfd211df95735c8a38ecae597d3")) + (958000, uint256S("0x000083a03bc5814718a089b49e5a8fc3e085a8ff6ea10d4429f0eccb6652cfea")) + (959000, uint256S("0x00005a66f76f9308b9ea2d4449d63bc054996b503d2fdff0c9327be670df82ff")) + (960000, uint256S("0x00001a07190de23bd4d3dd7c80d47b921c6814558afd639dee206d59db732432")) + (961000, uint256S("0x000037169673714f5b3730d71ae455852689ebfe5feecabf9e840fa3e6c81491")) + (962000, uint256S("0x0000406673e36aa298cbb04bf8e0dd663ad704b40db787791e196bb33827654a")) + (963000, uint256S("0x000003433d6f9cae3bef1393fbf0b5fdc8e6a0b694dcf7785b4297559fcd828c")) + (964000, uint256S("0x000068c78f3e12851372f11ea70b1162e7ec8dc8fee907782402a03b167b86c9")) + (965000, uint256S("0x00002343460755213710071c8e51565d7ec1d86dcb5b71b5e59ddd24f7a4344e")) + (966000, uint256S("0x0000772de803cd7c4ac8aa7f2ed1cd7ef13a59151424eef8f43e13798e9d7bda")) + (967000, uint256S("0x000083cbc5c8d1338caef2fdc4cea6b3ed1cd63f2eec1e81067c9fc657caf042")) + (968000, uint256S("0x00000f469df04f873d3a8c65c79dddb4a4bac26d5c4c2f38948350135bacb050")) + (969000, uint256S("0x000003aabfde9a844a47f0801fb8cc433af4143dd1d4b4f9763c20793493a267")) + (970000, uint256S("0x00000611c1529817df9ae09b4198578d920e2abced48945c4a366aee86e54f84")) + (971000, uint256S("0x000021f10926f8d23a1f093c1dc32d10f02b448296e265abcf1399f66d588a7b")) + (972000, uint256S("0x0000371066a71e81ade6c024361b3ea36dcd4a4d71e6fb1792670fd22cbf2651")) + (973000, uint256S("0x000003f7bd4e713edcc45931d57183da16842f3cee8ee424c037bd5db8c56eeb")) + (974000, uint256S("0x000089352ebd5def5f0c5f45c44bb202050a5bd8eb5f7be8afb2acff24ddaa95")) + (975000, uint256S("0x000024b561197358ab92e2c2f535207d81664b66b8bb4b2b4a6a02268570813e")) + (976000, uint256S("0x00006a53ed79e17b40cc042fd0a9e69947e9c46d4d543dcdc8c04e8bb8a120ba")) + (977000, uint256S("0x00001126e98094e28fc99747307f3614a81293ad48e0cf21615119148e4f023c")) + (978000, uint256S("0x00003ed71e9504cf37e0211f649efdbbe54e774a0e066e922a4b14a78499a747")) + (979000, uint256S("0x000028cab68c0404292dcd89f04cdcedd68fd8e66ea85fea84ac0fd978ec4429")) + (980000, uint256S("0x0000017214698c757c38cee40a6c14c6d2f5000dcfdb2de65e47956443d03be4")) + (981000, uint256S("0x000017d35857c636c16c765afbbd5755303270f5a4c4f4f3baa1c6ffcc07f25c")) + (982000, uint256S("0x0000290a27f6add114ab8f49812f57c606c2e3ae9ae8830d6fbb19d81a38c6b5")) + (983000, uint256S("0x00005ead64a87b9c14831a782517a7759b5bf05f28ca54b10fcacc7c626f28ad")) + (984000, uint256S("0x000022fafeb4da74660c4b44c2c6916151f7e158fdb8d9b4b238e74eb5e83641")) + (985000, uint256S("0x00000fedd91f10cf512535147e9706993fdcd7d5609c6d47fc8a2b9a2efd0f50")) + (986000, uint256S("0x000065dbfba59de0e52b772507169b0ebdac9f73369f794c0799738df30ea2a0")) + (987000, uint256S("0x00002723abb80e9ece84055c113e0caa507177ddc88cb6b8011ecba39b490dd8")) + (988000, uint256S("0x00001938e724c8033d1f60ddd27512f6f358847e96c63def28e85bd40616117c")) + (989000, uint256S("0x00003071ff9188d27f744395aefb1d406cccc15f61b7f79bba0ea9d100475a63")) + ,(int64_t) 1704021429, // time of last checkpointed block + (int64_t) 1010830, // total txs + (double) 2419 // txs in the last day before block 989271 }; } else { // all other HSC's with no checkpoints diff --git a/src/clientversion.h b/src/clientversion.h index ff530f64c..aa97c4a57 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -30,7 +30,7 @@ // Must be kept in sync with configure.ac , ugh! #define CLIENT_VERSION_MAJOR 3 #define CLIENT_VERSION_MINOR 10 -#define CLIENT_VERSION_REVISION 0 +#define CLIENT_VERSION_REVISION 1 #define CLIENT_VERSION_BUILD 50 //! Set to true for release, false for prerelease or test build @@ -40,7 +40,7 @@ * Copyright year (2009-this) * Todo: update this when changing our copyright comments in the source */ -#define COPYRIGHT_YEAR 2023 +#define COPYRIGHT_YEAR 2024 #endif //HAVE_CONFIG_H diff --git a/src/deprecation.cpp b/src/deprecation.cpp deleted file mode 100644 index 8d20b87b5..000000000 --- a/src/deprecation.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2017 The Zcash developers -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html - -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#include "deprecation.h" -#include "clientversion.h" -#include "init.h" -#include "ui_interface.h" -#include "util.h" -#include "chainparams.h" - -static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION); -extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN]; - -void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) { - - // Do not enforce deprecation in regtest or on testnet - std::string networkID = Params().NetworkIDString(); - std::string msg; - - if (networkID != "main" || SMART_CHAIN_SYMBOL[0] != 0 ) return; - - int blocksToDeprecation = DEPRECATION_HEIGHT - nHeight; - if (blocksToDeprecation <= 0) { - // In order to ensure we only log once per process when deprecation is - // disabled (to avoid log spam), we only need to log in two cases: - // - The deprecating block just arrived - // - This can be triggered more than once if a block chain reorg - // occurs, but that's an irregular event that won't cause spam. - // - The node is starting - if (blocksToDeprecation == 0 || forceLogging) { - msg = strprintf(_("This version has been deprecated as of block height %d."), - DEPRECATION_HEIGHT) + " " + - _("You should upgrade to the latest version of Hush."); - LogPrintf("*** %s\n", msg); - uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR); - } - StartShutdown(); - } else if (blocksToDeprecation == DEPRECATION_WARN_LIMIT || (blocksToDeprecation < DEPRECATION_WARN_LIMIT && forceLogging)) { - msg = strprintf(_("This version will be deprecated at block height %d, and will automatically shut down."), - DEPRECATION_HEIGHT) + " " + - _("You should upgrade to the latest version of Hush."); - LogPrintf("*** %s\n", msg); - uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_WARNING); - } -} diff --git a/src/deprecation.h b/src/deprecation.h deleted file mode 100644 index 8cd724229..000000000 --- a/src/deprecation.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2017 The Zcash developers -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html - -/****************************************************************************** - * Copyright © 2014-2019 The SuperNET Developers. * - * * - * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * - * the top-level directory of this distribution for the individual copyright * - * holder information and the developer policies on copyright and licensing. * - * * - * Unless otherwise agreed in a custom licensing agreement, no part of the * - * SuperNET software, including this file may be copied, modified, propagated * - * or distributed except according to the terms contained in the LICENSE file * - * * - * Removal or modification of this copyright notice is prohibited. * - * * - ******************************************************************************/ - -#ifndef ZCASH_DEPRECATION_H -#define ZCASH_DEPRECATION_H - -// Deprecation policy: -// * Shut down WEEKS_UNTIL_DEPRECATION weeks' worth of blocks after the estimated release block height. -// * A warning is shown during the DEPRECATION_WARN_LIMIT worth of blocks prior to shut down. -static const int WEEKS_UNTIL_DEPRECATION = 52; -static const int DEPRECATION_HEIGHT = 5555555; -static const int APPROX_RELEASE_HEIGHT = DEPRECATION_HEIGHT - (WEEKS_UNTIL_DEPRECATION * 7 * 24 * 60); - -// Number of blocks before deprecation to warn users -static const int DEPRECATION_WARN_LIMIT = 60 * 24 * 60; // 2 months - -/** - * Checks whether the node is deprecated based on the current block height, and - * shuts down the node with an error if so (and deprecation is not disabled for - * the current client version). - */ -void EnforceNodeDeprecation(int nHeight, bool forceLogging=false, bool fThread=true); - -#endif // ZCASH_DEPRECATION_H diff --git a/src/gtest/test_deprecation.cpp b/src/gtest/test_deprecation.cpp deleted file mode 100644 index 454afe40c..000000000 --- a/src/gtest/test_deprecation.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2016-2023 The Hush developers -// Distributed under the GPLv3 software license, see the accompanying -// Released under the GPLv3 - -#include -#include - -#include "chainparams.h" -#include "clientversion.h" -#include "deprecation.h" -#include "init.h" -#include "ui_interface.h" -#include "util.h" -#include "util/strencodings.h" - -#include -#include - -using ::testing::StrictMock; - -static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION); -extern std::atomic fRequestShutdown; - -class MockUIInterface { -public: - MOCK_METHOD3(ThreadSafeMessageBox, bool(const std::string& message, - const std::string& caption, - unsigned int style)); -}; - -static bool ThreadSafeMessageBox(MockUIInterface *mock, - const std::string& message, - const std::string& caption, - unsigned int style) -{ - return mock->ThreadSafeMessageBox(message, caption, style); -} - -class DeprecationTest : public ::testing::Test { -protected: - virtual void SetUp() { - uiInterface.ThreadSafeMessageBox.disconnect_all_slots(); - uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, &mock_, _1, _2, _3)); - SelectParams(CBaseChainParams::MAIN); - - } - - virtual void TearDown() { - fRequestShutdown = false; - mapArgs.clear(); - } - - StrictMock mock_; - - static std::vector read_lines(boost::filesystem::path filepath) { - std::vector result; - - std::ifstream f(filepath.string().c_str()); - std::string line; - while (std::getline(f,line)) { - result.push_back(line); - } - - return result; - } -}; - -TEST_F(DeprecationTest, NonDeprecatedNodeKeepsRunning) { - EXPECT_FALSE(ShutdownRequested()); - EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT - 1); - EXPECT_FALSE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, NodeNearDeprecationIsWarned) { - EXPECT_FALSE(ShutdownRequested()); - EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_WARNING)); - EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT); - EXPECT_FALSE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, NodeNearDeprecationWarningIsNotDuplicated) { - EXPECT_FALSE(ShutdownRequested()); - EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT + 1); - EXPECT_FALSE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, NodeNearDeprecationWarningIsRepeatedOnStartup) { - EXPECT_FALSE(ShutdownRequested()); - EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_WARNING)); - EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT + 1, true); - EXPECT_FALSE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, DeprecatedNodeShutsDown) { - EXPECT_FALSE(ShutdownRequested()); - EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_ERROR)); - EnforceNodeDeprecation(DEPRECATION_HEIGHT); - EXPECT_TRUE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, DeprecatedNodeErrorIsNotDuplicated) { - EXPECT_FALSE(ShutdownRequested()); - EnforceNodeDeprecation(DEPRECATION_HEIGHT + 1); - EXPECT_TRUE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, DeprecatedNodeErrorIsRepeatedOnStartup) { - EXPECT_FALSE(ShutdownRequested()); - EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_ERROR)); - EnforceNodeDeprecation(DEPRECATION_HEIGHT + 1, true); - EXPECT_TRUE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, DeprecatedNodeIgnoredOnRegtest) { - SelectParams(CBaseChainParams::REGTEST); - EXPECT_FALSE(ShutdownRequested()); - EnforceNodeDeprecation(DEPRECATION_HEIGHT+1); - EXPECT_FALSE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, DeprecatedNodeIgnoredOnTestnet) { - SelectParams(CBaseChainParams::TESTNET); - EXPECT_FALSE(ShutdownRequested()); - EnforceNodeDeprecation(DEPRECATION_HEIGHT+1); - EXPECT_FALSE(ShutdownRequested()); -} - -TEST_F(DeprecationTest, AlertNotify) { - boost::filesystem::path temp = GetTempPath() / - boost::filesystem::unique_path("alertnotify-%%%%.txt"); - - mapArgs["-alertnotify"] = std::string("echo %s >> ") + temp.string(); - - EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_WARNING)); - EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT, false, false); - - std::vector r = read_lines(temp); - EXPECT_EQ(r.size(), 1u); - - // -alertnotify restricts the message to safe characters. - auto expectedMsg = strprintf( - "This version will be deprecated at block height %d, and will automatically shut down. You should upgrade to the latest version of Hush.", - DEPRECATION_HEIGHT); - - // Windows built-in echo semantics are different than posixy shells. Quotes and - // whitespace are printed literally. -#ifndef WIN32 - EXPECT_EQ(r[0], expectedMsg); -#else - EXPECT_EQ(r[0], strprintf("'%s' ", expectedMsg)); -#endif - boost::filesystem::remove(temp); -} diff --git a/src/hush_bitcoind.h b/src/hush_bitcoind.h index 9c17dad6b..f709ae9cd 100644 --- a/src/hush_bitcoind.h +++ b/src/hush_bitcoind.h @@ -551,34 +551,6 @@ CScript hush_makeopret(CBlock *pblock, bool fNew) return(opret); } -/*uint256 hush_getblockhash(int32_t height) - { - uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32]; - memset(&hash,0,sizeof(hash)); - sprintf(params,"[%d]",height); - if ( (jsonstr= hush_issuemethod(HUSHUSERPASS,(char *)"getblockhash",params,BITCOIND_RPCPORT)) != 0 ) - { - if ( (result= cJSON_Parse(jsonstr)) != 0 ) - { - if ( (hexstr= jstr(result,(char *)"result")) != 0 ) - { - if ( is_hexstr(hexstr,0) == 64 ) - { - decode_hex(revbuf,32,hexstr); - for (i=0; i<32; i++) - ((uint8_t *)&hash)[i] = revbuf[31-i]; - } - } - free_json(result); - } - printf("HUSH3 hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash); - free(jsonstr); - } - return(hash); - } - - uint256 _hush_getblockhash(int32_t height);*/ - uint64_t hush_seed(int32_t height) { uint64_t seed = 0; @@ -724,6 +696,7 @@ int32_t hush_block2height(CBlock *block) return(height); } +// return true if the first output of the first tx in a block is valid int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block) { int32_t n; @@ -976,7 +949,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams); // 10% of all block rewards go towards Hush core team // If you do not like this, you are encouraged to fork the chain // or start your own Hush Smart Chain: https://git.hush.is/hush/hush-smart-chains -// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves. +// HUSH supply curve cannot be exactly represented via CLI args, so we do it ourselves. // You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25 // but to tell the AC params, I need to say "11% of 11.25" is 1.25 // 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually @@ -1619,7 +1592,10 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height) if(fDebug) fprintf(stderr,"%s at height=%d\n",__func__,height); int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; static bool didinit = false; - ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(height); + + // Create a local variable instead of modifying the global ASSETCHAINS_SCRIPTPUB + auto assetchains_scriptpub = devtax_scriptpub_for_height(height); + if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 ) { checktoshis = the_commission(pblock,height); @@ -1639,19 +1615,22 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height) fprintf(stderr,"%02x",script[i]); fprintf(stderr," vout[1] %.8f vs %.8f\n",(double)checktoshis/COIN,(double)pblock->vtx[0].vout[1].nValue/COIN); } - if ( ASSETCHAINS_SCRIPTPUB.size() > 1 ) + if ( assetchains_scriptpub.size() > 1 ) { static bool didinit = false; if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() ) { - fprintf(stderr, "appended CC_op_return to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str()); + fprintf(stderr, "appended CC_op_return to assetchains_scriptpub.%s\n", assetchains_scriptpub.c_str()); didinit = true; } - if ( ASSETCHAINS_SCRIPTPUB.size()/2 == scriptlen && scriptlen < sizeof(scripthex) ) + if ( assetchains_scriptpub.size()/2 == scriptlen && scriptlen < sizeof(scripthex) ) { - decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str()); - if ( memcmp(scripthex,script,scriptlen) == 0 ) + decode_hex(scripthex,scriptlen,(char *)assetchains_scriptpub.c_str()); + if ( memcmp(scripthex,script,scriptlen) == 0 ) { matched = scriptlen; + } else { + fprintf(stderr, "%s: assetchains_scriptpub != scripthex scriptlen=%d\n", __func__, scriptlen); + } } } else if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) == 0 ) @@ -1660,13 +1639,19 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height) matched = 25; if ( matched == 0 ) { - if ( 0 && ASSETCHAINS_SCRIPTPUB.size() > 1 ) + if ( assetchains_scriptpub.size() > 1 ) { int32_t i; - for (i=0; i bnTarget ) { failed = 1; - if ( height > 0 && SMART_CHAIN_SYMBOL[0] == 0 ) // for the fast case - { - if ( (n= hush_notaries(pubkeys,height,pblock->nTime)) > 0 ) - { - for (i=0; i 1 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()] != 49 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()-1] != 51 ) { + // Create a local variable instead of modifying the global assetchains_scriptpub + auto assetchains_scriptpub = devtax_scriptpub_for_height(height); + if ( assetchains_scriptpub.size() > 1 && assetchains_scriptpub[assetchains_scriptpub.back()] != 49 && assetchains_scriptpub[assetchains_scriptpub.back()-1] != 51 ) { int32_t scriptlen; uint8_t scripthex[10000]; script = (uint8_t *)&pblock->vtx[0].vout[0].scriptPubKey[0]; scriptlen = (int32_t)pblock->vtx[0].vout[0].scriptPubKey.size(); - if ( ASSETCHAINS_SCRIPTPUB.size()/2 == scriptlen && scriptlen < sizeof(scripthex) ) { - decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str()); + if ( assetchains_scriptpub.size()/2 == scriptlen && scriptlen < sizeof(scripthex) ) { + decode_hex(scripthex,scriptlen,(char *)assetchains_scriptpub.c_str()); if ( memcmp(scripthex,script,scriptlen) != 0 ) return(-1); } else return(-1); diff --git a/src/hush_utils.h b/src/hush_utils.h index d03c1e055..de03f73ba 100644 --- a/src/hush_utils.h +++ b/src/hush_utils.h @@ -858,7 +858,7 @@ int32_t unhex(char c) int32_t hex; if ( (hex= _unhex(c)) < 0 ) { - //printf("unhex: illegal hexchar.(%c)\n",c); + fprintf(stderr,"unhex: illegal hexchar.(%c)\n",c); } return(hex); } @@ -1513,14 +1513,6 @@ int32_t hush_whoami(char *pubkeystr,int32_t height,uint32_t timestamp) return(notaryid); } -char *argv0suffix[] = { - (char *)"fuckjl777d", (char *)"fuckjl777-cli", (char *)"fuckjl777d.exe", (char *)"fuckjl777-cli.exe", (char *)"btchd", (char *)"btch-cli", (char *)"btchd.exe", (char *)"btch-cli.exe" -}; - -char *argv0names[] = { - (char *)"FUCKJL777", (char *)"FUCKJL777", (char *)"FUCKJL777", (char *)"FUCKJL777", (char *)"BTCH", (char *)"BTCH", (char *)"BTCH", (char *)"BTCH" -}; - // Large total supplies lead to numerical errors, beware! uint64_t hush_max_money() { @@ -1528,7 +1520,7 @@ uint64_t hush_max_money() } // This implements the Hush Emission Curve, the miner subsidy part, -// and must be kept in sync with hush_commision() in komoto_bitcoind.h! +// and must be kept in sync with hush_commision() in hush_bitcoind.h! // Changing these functions are consensus changes! // Here Be Dragons! -- Duke Leto uint64_t hush_block_subsidy(int height) @@ -1803,21 +1795,6 @@ void hush_args(char *argv0) name = GetArg("-ac_name","HUSH3"); fprintf(stderr,".oO Starting %s Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",name.c_str(),HUSH_MININGTHREADS, IS_HUSH_NOTARY); - if ( argv0 != 0 ) - { - len = (int32_t)strlen(argv0); - for (i=0; i matches suffix (%s) -> ac_name.(%s)\n",argv0,argv0suffix[i],argv0names[i]); - name = argv0names[i]; - break; - } - } - } - vector HUSH_nodes= {"node1.hush.is","node2.hush.is","node3.hush.is", "node4.hush.is","node5.hush.is","node6.hush.is", "node7.hush.is","node8.hush.is","node1.hush.land", "node2.hush.land", "node3.hush.land", "node4.hush.land", "node5.hush.land"}; @@ -1899,7 +1876,7 @@ void hush_args(char *argv0) printf("ASSETCHAINS_ALGO, %s not supported. using equihash\n", selectedAlgo.c_str()); } - // Set our symobl from -ac_name value + // Set our symbol from -ac_name value strncpy(SMART_CHAIN_SYMBOL,name.c_str(),sizeof(SMART_CHAIN_SYMBOL)-1); bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false; diff --git a/src/init.cpp b/src/init.cpp index c27639725..2fd970547 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1633,7 +1633,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) return InitError(strprintf("User Agent comment (%s) contains unsafe characters.", cmt)); uacomments.push_back(SanitizeString(cmt, SAFE_CHARS_UA_COMMENT)); } - strSubVersion = FormatSubVersion(GetArg("-clientname","GoldenSandrout"), CLIENT_VERSION, uacomments); + strSubVersion = FormatSubVersion(GetArg("-clientname","GoldenSandtrout"), CLIENT_VERSION, uacomments); if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) { return InitError(strprintf("Total length of network version string %i exceeds maximum of %i characters. Reduce the number and/or size of uacomments.", strSubVersion.size(), MAX_SUBVERSION_LENGTH)); diff --git a/src/main.cpp b/src/main.cpp index 714dc36e6..8cbb35efc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,7 +27,6 @@ #include "checkqueue.h" #include "consensus/upgrades.h" #include "consensus/validation.h" -#include "deprecation.h" #include "init.h" #include "merkleblock.h" #include "metrics.h" @@ -3713,9 +3712,12 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) { // Now that we have written the block indices to the database, we do not // need to store solutions for these CBlockIndex objects in memory. // cs_main must be held here. + uint32_t nTrimmed = 0; for (CBlockIndex *pblockindex : vBlocks) { pblockindex->TrimSolution(); + ++nTrimmed; } + LogPrintf("%s: trimmed %d solutions from block index mode=%d\n", __func__, nTrimmed, mode); } // Finally remove any pruned files if (fFlushForPrune) @@ -4027,8 +4029,6 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * recentlyConflictedTxs.insert(std::make_pair(pindexNew, txConflicted)); nRecentlyConflictedSequence += 1; - EnforceNodeDeprecation(pindexNew->GetHeight()); - int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1; LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); @@ -5992,7 +5992,6 @@ bool static LoadBlockIndexDB() DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.LastTip()->GetBlockTime()), progress); - EnforceNodeDeprecation(chainActive.Height(), true); CBlockIndex *pindex; if ( (pindex= chainActive.LastTip()) != 0 ) { diff --git a/src/miner.cpp b/src/miner.cpp index 94033bc32..5b0544200 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -660,27 +660,29 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32 pblock->vtx[0] = txNew; - ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(nHeight); - if ( nHeight > 1 && SMART_CHAIN_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0) && (commission= the_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 ) + // Create a local variable instead of modifying the global ASSETCHAINS_SCRIPTPUB + auto assetchains_scriptpub = devtax_scriptpub_for_height(nHeight); + + if ( nHeight > 1 && SMART_CHAIN_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || assetchains_scriptpub.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0) && (commission= the_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 ) { int32_t i; uint8_t *ptr; txNew.vout.resize(2); txNew.vout[1].nValue = commission; - if ( ASSETCHAINS_SCRIPTPUB.size() > 1 ) + if ( assetchains_scriptpub.size() > 1 ) { static bool didinit = false; if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() ) { - fprintf(stderr, "appended ccopreturn to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str()); + fprintf(stderr, "appended ccopreturn to assetchains_scriptpub.%s\n", assetchains_scriptpub.c_str()); didinit = true; } //fprintf(stderr,"mine to -ac_script\n"); //txNew.vout[1].scriptPubKey = CScript() << ParseHex(); - int32_t len = strlen(ASSETCHAINS_SCRIPTPUB.c_str()); + int32_t len = strlen(assetchains_scriptpub.c_str()); len >>= 1; txNew.vout[1].scriptPubKey.resize(len); ptr = (uint8_t *)&txNew.vout[1].scriptPubKey[0]; - decode_hex(ptr,len,(char *)ASSETCHAINS_SCRIPTPUB.c_str()); + decode_hex(ptr,len,(char *)assetchains_scriptpub.c_str()); } else { txNew.vout[1].scriptPubKey.resize(35); ptr = (uint8_t *)&txNew.vout[1].scriptPubKey[0]; @@ -850,8 +852,10 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, { CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i,len; // fprintf(stderr,"%s: with nHeight=%d\n", __func__, nHeight); - ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(nHeight); - if ( nHeight == 1 && ASSETCHAINS_COMMISSION != 0 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()] != 49 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()-1] != 51 ) + + // Create a local variable instead of modifying the global assetchains_scriptpub + auto assetchains_scriptpub = devtax_scriptpub_for_height(nHeight); + if ( nHeight == 1 && ASSETCHAINS_COMMISSION != 0 && assetchains_scriptpub[assetchains_scriptpub.back()] != 49 && assetchains_scriptpub[assetchains_scriptpub.back()-1] != 51 ) { if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) { @@ -859,11 +863,11 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG; // fprintf(stderr,"%s: with pubkey=%s\n", __func__, HexStr(pubkey).c_str() ); } else { - len = strlen(ASSETCHAINS_SCRIPTPUB.c_str()); + len = strlen(assetchains_scriptpub.c_str()); len >>= 1; scriptPubKey.resize(len); ptr = (uint8_t *)&scriptPubKey[0]; - decode_hex(ptr,len,(char *)ASSETCHAINS_SCRIPTPUB.c_str()); + decode_hex(ptr,len,(char *)assetchains_scriptpub.c_str()); } } else if ( USE_EXTERNAL_PUBKEY != 0 ) { //fprintf(stderr,"use notary pubkey\n"); @@ -1266,7 +1270,6 @@ void static RandomXMiner() LogPrintf("Running HushRandomXMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION)); // Search - uint8_t pubkeys[66][33]; arith_uint256 bnMaxPoSdiff; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime(); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus()); @@ -1613,7 +1616,7 @@ void static BitcoinMiner() LogPrintf("Running HushMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION)); // Search - uint8_t pubkeys[66][33]; arith_uint256 bnMaxPoSdiff; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime(); + uint32_t savebits; int64_t nStart = GetTime(); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus()); savebits = pblock->nBits; HASHTarget = arith_uint256().SetCompact(savebits); diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index beea9dad7..2c977e43c 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -544,7 +544,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& myp "\nArguments:\n" "1. \"jsonrequestobject\" (string, optional) A json object in the following spec\n" " {\n" - " \"mode\":\"template\" (string, optional) This must be set to \"template\" or omitted\n" + " \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal\", \"disablecb\". Default is \"template\" \n" " \"capabilities\":[ (array, optional) A list of strings\n" " \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'\n" " ,...\n" @@ -572,7 +572,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& myp " ,...\n" " ],\n" // " \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in Satoshis)\n" - " \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n" + " \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction. Not present when mode=disablecb\n" " \"target\" : \"xxxx\", (string) The hash target\n" " \"mintime\" : xxx, (numeric) The minimum timestamp appropriate for next block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"mutable\" : [ (array of string) list of ways the block template may be changed \n" diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 67812ddb6..5f84ff23f 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -27,7 +27,6 @@ #include "timedata.h" #include "util.h" #include "version.h" -#include "deprecation.h" #include "hush/utiltls.h" #include #include @@ -495,33 +494,6 @@ static UniValue GetNetworksInfo() return networks; } -UniValue getdeprecationinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) -{ - const CChainParams& chainparams = Params(); - if (fHelp || params.size() != 0 || chainparams.NetworkIDString() != "main") - throw runtime_error( - "getdeprecationinfo\n" - "Returns an object containing current version and deprecation block height. Applicable only on mainnet.\n" - "\nResult:\n" - "{\n" - " \"version\": xxxxx, (numeric) the server version\n" - " \"subversion\": \"/GoldenSandtrout:x.y.z[-v]/\", (string) the server subversion string\n" - " \"deprecationheight\": xxxxx, (numeric) the block height at which this version will deprecate and shut down\n" - "}\n" - "\nExamples:\n" - + HelpExampleCli("getdeprecationinfo", "") - + HelpExampleRpc("getdeprecationinfo", "") - ); - - UniValue obj(UniValue::VOBJ); - obj.push_back(Pair("version", CLIENT_VERSION)); - obj.push_back(Pair("subversion", - FormatSubVersion(GetArg("-clientname","GoldenSandtrout"), CLIENT_VERSION, std::vector()))); - obj.push_back(Pair("deprecationheight", DEPRECATION_HEIGHT)); - - return obj; -} - UniValue getnetworkinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) { if (fHelp || params.size() != 0) @@ -710,7 +682,6 @@ static const CRPCCommand commands[] = { // category name actor (function) okSafeMode // --------------------- ------------------------ ----------------------- ---------- { "network", "getconnectioncount", &getconnectioncount, true }, - { "network", "getdeprecationinfo", &getdeprecationinfo, true }, { "network", "ping", &ping, true }, { "network", "getpeerlist", &getpeerlist, true }, { "network", "getpeerinfo", &getpeerinfo, true }, diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index bb4570418..a9a27ad8d 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -21,7 +21,6 @@ #include "consensus/validation.h" #include "core_io.h" #include "init.h" -#include "deprecation.h" #include "key_io.h" #include "keystore.h" #include "main.h" diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 679e6ffc2..9eb9076e7 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -299,7 +299,6 @@ static const CRPCCommand vRPCCommands[] = /* P2P networking */ { "network", "getnetworkinfo", &getnetworkinfo, true }, - { "network", "getdeprecationinfo", &getdeprecationinfo, true }, { "network", "addnode", &addnode, true }, { "network", "disconnectnode", &disconnectnode, true }, { "network", "getaddednodeinfo", &getaddednodeinfo, true }, diff --git a/src/rpc/server.h b/src/rpc/server.h index 3bfc0654e..8f88cb238 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -391,7 +391,6 @@ extern UniValue setstakingsplit(const UniValue& params, bool fHelp, const CPubKe extern UniValue getwalletinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue getnetworkinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); -extern UniValue getdeprecationinfo(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue setmocktime(const UniValue& params, bool fHelp, const CPubKey& mypk); extern UniValue resendwallettransactions(const UniValue& params, bool fHelp, const CPubKey& mypk);