diff -Nru bitcoinabc-0.19.11-uahf/arcanist/linter/CheckRpcMappingsLinter.php bitcoinabc-0.19.12-uahf/arcanist/linter/CheckRpcMappingsLinter.php --- bitcoinabc-0.19.11-uahf/arcanist/linter/CheckRpcMappingsLinter.php 1970-01-01 00:00:00.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/arcanist/linter/CheckRpcMappingsLinter.php 2019-08-16 12:22:07.000000000 +0000 @@ -0,0 +1,82 @@ +getProjectRoot()); + } + + public function shouldUseInterpreter() { + return true; + } + + public function getDefaultInterpreter() { + return "python3"; + } + + public function getInstallInstructions() { + return pht('The test/lint/check-rpc-mappings.py script is part of the '. + 'bitcoin-abc project'); + } + + public function shouldExpectCommandErrors() { + return false; + } + + protected function getMandatoryFlags() { + return array($this->getProjectRoot()); + } + + protected function parseGlobalLinterOutput($err, $stdout, $stderr) { + $messages = array(); + + // Find errors + if (preg_match_all('/ERROR:\s*(.*)/', $stdout, $errors, PREG_SET_ORDER)) { + foreach ($errors as $error) { + $messages[] = id(new ArcanistLintMessage()) + ->setGranularity(ArcanistLinter::GRANULARITY_GLOBAL) + ->setCode('RPC_MAPPING_ERROR') + ->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR) + ->setName('RPC mapping error') + ->setDescription($error[1]); + } + } + + // Find warnings + if (preg_match_all('/WARNING:\s*(.*)/', $stdout, $warnings, + PREG_SET_ORDER)) { + foreach ($warnings as $warning) { + $messages[] = id(new ArcanistLintMessage()) + ->setGranularity(ArcanistLinter::GRANULARITY_GLOBAL) + ->setCode('RPC_MAPPING_WARNING') + ->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING) + ->setBypassChangedLineFiltering(true) + ->setName('RPC mapping warning') + ->setDescription($warning[1]); + } + } + + return $messages; + } +} diff -Nru bitcoinabc-0.19.11-uahf/arcanist/linter/ClangFormatLinter.php bitcoinabc-0.19.12-uahf/arcanist/linter/ClangFormatLinter.php --- bitcoinabc-0.19.11-uahf/arcanist/linter/ClangFormatLinter.php 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/arcanist/linter/ClangFormatLinter.php 2019-08-16 12:22:07.000000000 +0000 @@ -40,10 +40,25 @@ $matches = array(); $regex = '/^clang-format version (?P\d+\.\d+)\./'; if (preg_match($regex, $stdout, $matches)) { - return $matches['version']; + $version = $matches['version']; } else { return false; } + + /* + * FIXME: This is a hack to only allow for clang-format version 7.x. + * The .arclint `version` field only allow to filter versions using `=`, + * `>`, `<`, `>=` or `<=`. There is no facility to define that the required + * version should be >= 7.0 and < 8.0. + */ + if ($version[0] != '7') { + throw new Exception(pht('Linter %s requires clang-format version 7.x. '. + 'You have version %s.', + ClangFormatLinter::class, + $version)); + } + + return $version; } public function getInstallInstructions() { diff -Nru bitcoinabc-0.19.11-uahf/arcanist/linter/PythonOpenFileEncodingLinter.php bitcoinabc-0.19.12-uahf/arcanist/linter/PythonOpenFileEncodingLinter.php --- bitcoinabc-0.19.11-uahf/arcanist/linter/PythonOpenFileEncodingLinter.php 1970-01-01 00:00:00.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/arcanist/linter/PythonOpenFileEncodingLinter.php 2019-08-16 12:22:07.000000000 +0000 @@ -0,0 +1,70 @@ + ArcanistLintSeverity::SEVERITY_ERROR, + ); + } + + public function getLintNameMap() { + return array( + self::ENCODING_NOT_FOUND => pht('Encoding should be specified when '. + 'opening a text file.'), + ); + } + + public function lintPath($path) { + $path = Filesystem::resolvePath($path, $this->getProjectRoot()); + $fileContent = Filesystem::readFile($path); + + $pattern = "/[(\s]open(\(((?>[^()]+)|(?1))*\))/"; + if (!preg_match_all($pattern, $fileContent, $matches, + PREG_OFFSET_CAPTURE)) { + return; + } + + foreach ($matches[0] as $match) { + list($open, $offset) = $match; + + $isBin = preg_match("/open\([^,]*, ['\"][^'\"]*b[^'\"]*['\"]/", $open); + $hasEncoding = preg_match("/encoding=.(ascii|utf8|utf-8)./", $open); + + if (!$isBin && !$hasEncoding) { + $this->raiseLintAtOffset( + $offset + 1, + self::ENCODING_NOT_FOUND, + pht("Python's open(...) seems to be used to open text files without ". + "explicitly specifying encoding, or with an invalid encoding. ". + "Encoding should be 'ascii', 'utf-8' or 'utf8' (e.g.: ". + "`open(f, 'r', encoding='utf-8')`)."), + substr($open, 1), + null); + } + } + } +} diff -Nru bitcoinabc-0.19.11-uahf/arcanist/phpcs.xml bitcoinabc-0.19.12-uahf/arcanist/phpcs.xml --- bitcoinabc-0.19.11-uahf/arcanist/phpcs.xml 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/arcanist/phpcs.xml 2019-08-16 12:22:07.000000000 +0000 @@ -17,6 +17,8 @@ + + diff -Nru bitcoinabc-0.19.11-uahf/arcanist/__phutil_library_map__.php bitcoinabc-0.19.12-uahf/arcanist/__phutil_library_map__.php --- bitcoinabc-0.19.11-uahf/arcanist/__phutil_library_map__.php 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/arcanist/__phutil_library_map__.php 2019-08-16 12:22:07.000000000 +0000 @@ -14,6 +14,7 @@ 'BoostDependenciesLinter' => 'linter/BoostDependenciesLinter.php', 'CHeaderLinter' => 'linter/CHeaderLinter.php', 'CheckDocLinter' => 'linter/CheckDocLinter.php', + 'CheckRpcMappingsLinter' => 'linter/CheckRpcMappingsLinter.php', 'ClangFormatLinter' => 'linter/ClangFormatLinter.php', 'ExtendedConfigurationDrivenLintEngine' => 'engine/ExtendedConfigurationDrivenLintEngine.php', 'FileNameLinter' => 'linter/FileNameLinter.php', @@ -25,6 +26,7 @@ 'IncludeSourceLinter' => 'linter/IncludeSourceLinter.php', 'LocaleDependenceLinter' => 'linter/LocaleDependenceLinter.php', 'PythonFormatLinter' => 'linter/PythonFormatLinter.php', + 'PythonOpenFileEncodingLinter' => 'linter/PythonOpenFileEncodingLinter.php', 'StdintLinter' => 'linter/StdintLinter.php', 'TestsLinter' => 'linter/TestsLinter.php', ), @@ -35,6 +37,7 @@ 'BoostDependenciesLinter' => 'GlobalExternalLinter', 'CHeaderLinter' => 'ArcanistLinter', 'CheckDocLinter' => 'GlobalExternalLinter', + 'CheckRpcMappingsLinter' => 'GlobalExternalLinter', 'ClangFormatLinter' => 'ArcanistExternalLinter', 'ExtendedConfigurationDrivenLintEngine' => 'ArcanistLintEngine', 'FileNameLinter' => 'ArcanistLinter', @@ -48,6 +51,7 @@ 'IncludeSourceLinter' => 'ArcanistLinter', 'LocaleDependenceLinter' => 'ArcanistLinter', 'PythonFormatLinter' => 'ArcanistExternalLinter', + 'PythonOpenFileEncodingLinter' => 'ArcanistLinter', 'StdintLinter' => 'ArcanistLinter', 'TestsLinter' => 'ArcanistExternalLinter', ), diff -Nru bitcoinabc-0.19.11-uahf/arcanist/.phutil_module_cache bitcoinabc-0.19.12-uahf/arcanist/.phutil_module_cache --- bitcoinabc-0.19.11-uahf/arcanist/.phutil_module_cache 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/arcanist/.phutil_module_cache 2019-08-16 12:22:07.000000000 +0000 @@ -1 +1 @@ -{"__symbol_cache_version__":11,"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"6af7410cfea496ff1d4dcc2624b6b8ea":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":1653},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":1660,"Filesystem":1504,"ArcanistLinter":1767,"ArcanistLintSeverity":1845}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"75579a609dd975aa0226add52700c622":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":307},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":662,"Filesystem":968}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"1f9bac7956f4f948a187828dcc6ba2d0":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":368},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":721,"Filesystem":970}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"ce5dee893bedb5d93466655eede8ac47":{"have":{"class":{"LocaleDependenceLinter":160}},"need":{"function":{"pht":5429},"class":{"ArcanistLinter":191,"ArcanistLintSeverity":5932,"Filesystem":6178}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"09a933fbbf135320585be52750d93831":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":280},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":589,"Filesystem":897}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"25781df78f6eebfb223296b8265e9d19":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2629},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2636,"Filesystem":776,"ArcanistLinter":2684,"ArcanistLintSeverity":2792}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}}} \ No newline at end of file +{"__symbol_cache_version__":11,"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"63d19a8745cb2e1200cc26488dc7ad25":{"have":{"class":{"CheckRpcMappingsLinter":131}},"need":{"function":{"pht":310,"id":1386},"class":{"GlobalExternalLinter":162,"ArcanistLintMessage":1393,"Filesystem":573,"ArcanistLinter":1443,"ArcanistLintSeverity":1544}},"xmap":{"CheckRpcMappingsLinter":["GlobalExternalLinter"]}},"6af7410cfea496ff1d4dcc2624b6b8ea":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":1653},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":1660,"Filesystem":1504,"ArcanistLinter":1767,"ArcanistLintSeverity":1845}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"75579a609dd975aa0226add52700c622":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":307},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":662,"Filesystem":968}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"1f9bac7956f4f948a187828dcc6ba2d0":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":368},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":721,"Filesystem":970}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"ce5dee893bedb5d93466655eede8ac47":{"have":{"class":{"LocaleDependenceLinter":160}},"need":{"function":{"pht":5429},"class":{"ArcanistLinter":191,"ArcanistLintSeverity":5932,"Filesystem":6178}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"09a933fbbf135320585be52750d93831":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":280},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":589,"Filesystem":897}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"25781df78f6eebfb223296b8265e9d19":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2629},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2636,"Filesystem":776,"ArcanistLinter":2684,"ArcanistLintSeverity":2792}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"03cf226fe177a9fce7dc046816cc466b":{"have":{"class":{"PythonOpenFileEncodingLinter":111}},"need":{"function":{"pht":325},"class":{"ArcanistLinter":148,"ArcanistLintSeverity":687,"Filesystem":991}},"xmap":{"PythonOpenFileEncodingLinter":["ArcanistLinter"]}}} \ No newline at end of file diff -Nru bitcoinabc-0.19.11-uahf/.arclint bitcoinabc-0.19.12-uahf/.arclint --- bitcoinabc-0.19.11-uahf/.arclint 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/.arclint 2019-08-16 12:22:07.000000000 +0000 @@ -5,7 +5,7 @@ }, "clang-format": { "type": "clang-format", - "version": "7.0", + "version": ">=7.0", "bin": ["clang-format-7", "clang-format"], "include": "(^src/.*\\.(h|c|cpp|mm)$)", "exclude": [ @@ -21,7 +21,7 @@ "type": "flake8", "include": "(\\.py$)", "flags": [ - "--select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E271,E272,E273,E274,E275,E304,E306,E502,E702,E703,E714,E721,E741,E742,E743,F401,F402,F403,F404,F405,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F822,F823,F831,W292,W601,W602,W603,W604,W605" + "--select=E112,E113,E115,E116,E125,E131,E133,E223,E224,E242,E266,E271,E272,E273,E274,E275,E304,E306,E401,E402,E502,E701,E702,E703,E714,E721,E741,E742,E743,E901,E902,F401,F402,F403,F404,F405,F406,F407,F601,F602,F621,F622,F631,F701,F702,F703,F704,F705,F706,F707,F811,F812,F821,F822,F823,F831,F841,W292,W293,W601,W602,W603,W604,W605,W606" ] }, "lint-format-strings": { @@ -127,6 +127,14 @@ "lint-boost-dependencies": { "type": "lint-boost-dependencies", "include": "(^src/.*\\.(h|cpp)$)" + }, + "check-rpc-mappings": { + "type": "check-rpc-mappings", + "include": "(^src/(rpc/|wallet/rpc).*\\.cpp$)" + }, + "lint-python-encoding": { + "type": "lint-python-encoding", + "include": "(\\.py$)" } } } diff -Nru bitcoinabc-0.19.11-uahf/build-aux/m4/bitcoin_find_bdb53.m4 bitcoinabc-0.19.12-uahf/build-aux/m4/bitcoin_find_bdb53.m4 --- bitcoinabc-0.19.11-uahf/build-aux/m4/bitcoin_find_bdb53.m4 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/build-aux/m4/bitcoin_find_bdb53.m4 2019-08-16 12:22:07.000000000 +0000 @@ -45,7 +45,7 @@ if test "x$BDB_LIBS" = "x"; then # TODO: Ideally this could find the library version and make sure it matches the headers being used - for searchlib in db_cxx-5.3 db_cxx; do + for searchlib in db_cxx-5.3 db_cxx db5_cxx; do AC_CHECK_LIB([$searchlib],[main],[ BDB_LIBS="-l${searchlib}" break diff -Nru bitcoinabc-0.19.11-uahf/cmake/modules/AddCompilerFlags.cmake bitcoinabc-0.19.12-uahf/cmake/modules/AddCompilerFlags.cmake --- bitcoinabc-0.19.11-uahf/cmake/modules/AddCompilerFlags.cmake 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/cmake/modules/AddCompilerFlags.cmake 2019-08-16 12:22:07.000000000 +0000 @@ -4,7 +4,7 @@ include(SanitizeHelper) function(check_compiler_flag RESULT LANGUAGE FLAG) - sanitize_variable("have_${LANGUAGE}_" ${FLAG} TEST_NAME) + sanitize_c_cxx_definition("have_${LANGUAGE}_" ${FLAG} TEST_NAME) if("${LANGUAGE}" STREQUAL "C") CHECK_C_COMPILER_FLAG(${FLAG} ${TEST_NAME}) @@ -16,58 +16,56 @@ set(${RESULT} ${${TEST_NAME}} PARENT_SCOPE) endfunction() -function(add_c_compiler_flag) +function(add_compiler_flags_to_var TARGET LANGUAGE) foreach(f ${ARGN}) - check_compiler_flag(FLAG_IS_SUPPORTED C ${f}) - if(${FLAG_IS_SUPPORTED}) - string(APPEND CMAKE_C_FLAGS " ${f}") + # If the flag is already set, avoid duplicating it + string(FIND "${${TARGET}}" "${f}" FLAG_POSITION) + if(${FLAG_POSITION} LESS 0) + check_compiler_flag(FLAG_IS_SUPPORTED ${LANGUAGE} ${f}) + if(${FLAG_IS_SUPPORTED}) + string(APPEND ${TARGET} " ${f}") + endif() endif() endforeach() - set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} PARENT_SCOPE) + set(${TARGET} ${${TARGET}} PARENT_SCOPE) endfunction() -function(add_cxx_compiler_flag) - foreach(f ${ARGN}) - check_compiler_flag(FLAG_IS_SUPPORTED CXX ${f}) - if(${FLAG_IS_SUPPORTED}) - string(APPEND CMAKE_CXX_FLAGS " ${f}") - endif() - endforeach() - set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE) -endfunction() +macro(add_c_compiler_flags) + add_compiler_flags_to_var(CMAKE_C_FLAGS C ${ARGN}) +endmacro() -macro(add_compiler_flag) - add_c_compiler_flag(${ARGN}) - add_cxx_compiler_flag(${ARGN}) +macro(add_cxx_compiler_flags) + add_compiler_flags_to_var(CMAKE_CXX_FLAGS CXX ${ARGN}) endmacro() -macro(remove_c_compiler_flags) - if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") - string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE) - set(BUILD_TYPE_C_FLAGS "CMAKE_C_FLAGS_${BUILD_TYPE}") - endif() - +macro(add_compiler_flags) + add_c_compiler_flags(${ARGN}) + add_cxx_compiler_flags(${ARGN}) +endmacro() + +macro(remove_compiler_flags_from_var TARGET) foreach(f ${ARGN}) - string(REGEX REPLACE "${f}( |$)" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") - string(REGEX REPLACE "${f}( |$)" "" ${BUILD_TYPE_C_FLAGS} "${${BUILD_TYPE_C_FLAGS}}") - endif() + string(REGEX REPLACE "${f}( |$)" "" ${TARGET} "${${TARGET}}") endforeach() endmacro() -macro(remove_cxx_compiler_flags) +function(remove_c_compiler_flags) + remove_compiler_flags_from_var(CMAKE_C_FLAGS ${ARGN}) if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") - string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE) - set(BUILD_TYPE_CXX_FLAGS "CMAKE_CXX_FLAGS_${BUILD_TYPE}") + string(TOUPPER "CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}" BUILD_TYPE_FLAGS) + remove_compiler_flags_from_var(${BUILD_TYPE_FLAGS} ${ARGN}) endif() - - foreach(f ${ARGN}) - string(REGEX REPLACE "${f}( |$)" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") - string(REGEX REPLACE "${f}( |$)" "" ${BUILD_TYPE_CXX_FLAGS} "${${BUILD_TYPE_CXX_FLAGS}}") - endif() - endforeach() -endmacro() + set(${BUILD_TYPE_FLAGS} ${${BUILD_TYPE_FLAGS}} PARENT_SCOPE) +endfunction() + +function(remove_cxx_compiler_flags) + remove_compiler_flags_from_var(CMAKE_CXX_FLAGS ${ARGN}) + if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "") + string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" BUILD_TYPE_FLAGS) + remove_compiler_flags_from_var(${BUILD_TYPE_FLAGS} ${ARGN}) + endif() + set(${BUILD_TYPE_FLAGS} ${${BUILD_TYPE_FLAGS}} PARENT_SCOPE) +endfunction() macro(remove_compiler_flags) remove_c_compiler_flags(${ARGN}) @@ -78,18 +76,15 @@ # Remove the fallback flag if it exists, so that the main flag will override # it if it was previously added. remove_cxx_compiler_flags(${FALLBACK}) - + set(FLAG_CANDIDATE ${FLAG}) check_compiler_flag(FLAG_IS_SUPPORTED CXX ${FLAG_CANDIDATE}) if(NOT ${FLAG_IS_SUPPORTED}) set(FLAG_CANDIDATE ${FALLBACK}) - check_compiler_flag(FLAG_IS_SUPPORTED CXX ${FLAG_CANDIDATE}) - endif() - - if(${FLAG_IS_SUPPORTED}) - string(APPEND ${TARGET_VAR} " ${FLAG_CANDIDATE}") - set(${TARGET_VAR} ${${TARGET_VAR}} PARENT_SCOPE) endif() + + add_compiler_flags_to_var(${TARGET_VAR} CXX ${FLAG_CANDIDATE}) + set(${TARGET_VAR} ${${TARGET_VAR}} PARENT_SCOPE) endfunction() # Note that CMake does not provide any facility to check that a linker flag is @@ -97,17 +92,40 @@ # However since CMake 3.2 introduced the CMP0056 policy, the # CMAKE_EXE_LINKER_FLAGS variable is used by the try_compile function, so there # is a workaround that allow for testing the linker flags. -function(add_linker_flag) +function(add_linker_flags) foreach(f ${ARGN}) - sanitize_variable("have_linker_" ${f} FLAG_IS_SUPPORTED) - + sanitize_c_cxx_definition("have_linker_" ${f} FLAG_IS_SUPPORTED) + + # Some linkers (e.g.: Clang) will issue a -Wunused-command-line-argument + # warning when an unknown linker flag is set. + # Using -Werror will promote these warnings to errors so + # CHECK_CXX_COMPILER_FLAG() will return false, preventing the flag from + # being set. + add_compiler_flags_to_var( + CMAKE_REQUIRED_FLAGS + CXX + "-Werror=unused-command-line-argument" + ) + # Save the current linker flags set(SAVE_CMAKE_EXE_LINKERFLAGS ${CMAKE_EXE_LINKER_FLAGS}) - string(APPEND CMAKE_EXE_LINKER_FLAGS " ${f}") + + # If the flag is already set, avoid duplicating it + string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${f}" FLAG_POSITION) + if(${FLAG_POSITION} LESS 0) + string(APPEND CMAKE_EXE_LINKER_FLAGS " ${f}") + endif() + # CHECK_CXX_COMPILER_FLAG calls CHECK_CXX_SOURCE_COMPILES which in turn # calls try_compile, so it will check our flag CHECK_CXX_COMPILER_FLAG("" ${FLAG_IS_SUPPORTED}) - + + # Unset the -Werror=unused-command-line-argument flag if it is set. + remove_compiler_flags_from_var( + CMAKE_REQUIRED_FLAGS + "-Werror=unused-command-line-argument" + ) + # If the flag is not supported restore CMAKE_EXE_LINKER_FLAGS if(NOT ${FLAG_IS_SUPPORTED}) set(CMAKE_EXE_LINKER_FLAGS ${SAVE_CMAKE_EXE_LINKERFLAGS}) diff -Nru bitcoinabc-0.19.11-uahf/cmake/modules/FindBerkeleyDB.cmake bitcoinabc-0.19.12-uahf/cmake/modules/FindBerkeleyDB.cmake --- bitcoinabc-0.19.11-uahf/cmake/modules/FindBerkeleyDB.cmake 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/cmake/modules/FindBerkeleyDB.cmake 2019-08-16 12:22:07.000000000 +0000 @@ -22,7 +22,7 @@ HINTS ${BREW_HINT} ) find_library(BDBXX_LIBRARY - NAMES db_cxx libdb_cxx + NAMES db_cxx libdb_cxx db5_cxx HINTS ${BREW_HINT} ) diff -Nru bitcoinabc-0.19.11-uahf/cmake/modules/SanitizeHelper.cmake bitcoinabc-0.19.12-uahf/cmake/modules/SanitizeHelper.cmake --- bitcoinabc-0.19.11-uahf/cmake/modules/SanitizeHelper.cmake 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/cmake/modules/SanitizeHelper.cmake 2019-08-16 12:22:07.000000000 +0000 @@ -1,3 +1,8 @@ +macro(_sanitize REPLACEMENT_REGEX REPLACEMENT_STRING RAW_VAR SANITIZED_VAR) + string(REGEX REPLACE + "${REPLACEMENT_REGEX}" "${REPLACEMENT_STRING}" ${SANITIZED_VAR} "${RAW_VAR}") +endmacro() + # Sanitize a variable according to cmake rules # https://cmake.org/cmake/help/v3.10/manual/cmake-language.7.html#variable-references # The NUL and ';' characters cannot be escaped in this context (see CMP0053) @@ -14,6 +19,14 @@ # rather to replace them with a known supported one, here '_' is chosen. # Not: this could lead to name collision in some rare case. These case can # be handled manually by using a different prefix. - string(REGEX REPLACE - "([^a-zA-Z0-9/_.+-])" "_" ${SANITIZED_VAR} "${PREFIX}${RAW_VAR}") + _sanitize("([^a-zA-Z0-9/_.+-])" "_" "${PREFIX}${RAW_VAR}" ${SANITIZED_VAR}) +endmacro() + +# Sanitize a variable intended to be used in a C/CXX #define statement. +# This is useful when using CHECK__COMPILER_FLAG or similar functions. +macro(sanitize_c_cxx_definition PREFIX RAW_VAR SANITIZED_VAR) + # Only allow for alphanum chars plus underscore. This will prevent the + # compiler to issue a warning like: + # `ISO C99 requires whitespace after the macro name [-Wc99-extensions]` + _sanitize("([^a-zA-Z0-9_])" "_" "${PREFIX}${RAW_VAR}" ${SANITIZED_VAR}) endmacro() diff -Nru bitcoinabc-0.19.11-uahf/configure.ac bitcoinabc-0.19.12-uahf/configure.ac --- bitcoinabc-0.19.11-uahf/configure.ac 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/configure.ac 2019-08-16 12:22:07.000000000 +0000 @@ -2,7 +2,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 19) -define(_CLIENT_VERSION_REVISION, 11) +define(_CLIENT_VERSION_REVISION, 12) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2019) @@ -253,6 +253,7 @@ AX_CHECK_PREPROC_FLAG([-DDEBUG],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG"]],,[[$CXXFLAG_WERROR]]) AX_CHECK_PREPROC_FLAG([-DDEBUG_LOCKORDER],[[DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DDEBUG_LOCKORDER"]],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-ftrapv],[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"],,[[$CXXFLAG_WERROR]]) fi if test x$use_sanitizers != x; then @@ -285,20 +286,22 @@ fi if test "x$CXXFLAGS_overridden" = "xno"; then - AX_CHECK_COMPILE_FLAG([-Wall],[CXXFLAGS="$CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wextra],[CXXFLAGS="$CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wformat],[CXXFLAGS="$CXXFLAGS -Wformat"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wvla],[CXXFLAGS="$CXXFLAGS -Wvla"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wformat-security],[CXXFLAGS="$CXXFLAGS -Wformat-security"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wthread-safety-analysis],[CXXFLAGS="$CXXFLAGS -Wthread-safety-analysis"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wshadow],[CXXFLAGS="$CXXFLAGS -Wshadow"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wmissing-braces],[CXXFLAGS="$CXXFLAGS -Wmissing-braces"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wall],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wextra],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wformat],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wvla],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wvla"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wformat-security],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wformat-security"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wthread-safety-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wthread-safety-analysis"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wshadow],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wshadow"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wmissing-braces],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wmissing-braces"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wrange-loop-analysis],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wrange-loop-analysis"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]]) ## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all ## unknown options if any other warning is produced. Test the -Wfoo case, and ## set the -Wno-foo case if it works. - AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[CXXFLAGS="$CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"],,[[$CXXFLAG_WERROR]]) fi # Check for optional instruction set support. Enabling these does _not_ imply that all code will @@ -412,25 +415,25 @@ use_pkgconfig=no TARGET_OS=windows - AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) - AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([mingwthrd], [main],, AC_MSG_ERROR(libmingwthrd missing)) + AC_CHECK_LIB([kernel32], [main],, AC_MSG_ERROR(libkernel32 missing)) + AC_CHECK_LIB([user32], [main],, AC_MSG_ERROR(libuser32 missing)) + AC_CHECK_LIB([gdi32], [main],, AC_MSG_ERROR(libgdi32 missing)) + AC_CHECK_LIB([comdlg32], [main],, AC_MSG_ERROR(libcomdlg32 missing)) + AC_CHECK_LIB([winspool], [main],, AC_MSG_ERROR(libwinspool missing)) + AC_CHECK_LIB([winmm], [main],, AC_MSG_ERROR(libwinmm missing)) + AC_CHECK_LIB([shell32], [main],, AC_MSG_ERROR(libshell32 missing)) + AC_CHECK_LIB([comctl32], [main],, AC_MSG_ERROR(libcomctl32 missing)) + AC_CHECK_LIB([ole32], [main],, AC_MSG_ERROR(libole32 missing)) + AC_CHECK_LIB([oleaut32], [main],, AC_MSG_ERROR(liboleaut32 missing)) + AC_CHECK_LIB([uuid], [main],, AC_MSG_ERROR(libuuid missing)) + AC_CHECK_LIB([rpcrt4], [main],, AC_MSG_ERROR(librpcrt4 missing)) + AC_CHECK_LIB([advapi32], [main],, AC_MSG_ERROR(libadvapi32 missing)) + AC_CHECK_LIB([ws2_32], [main],, AC_MSG_ERROR(libws2_32 missing)) + AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(libmswsock missing)) + AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(libshlwapi missing)) + AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(libiphlpapi missing)) + AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(libcrypt32 missing)) # -static is interpreted by libtool, where it has a different meaning. # In libtool-speak, it's -all-static. @@ -534,20 +537,37 @@ CPPFLAGS="$CPPFLAGS -DMAC_OSX" OBJCXXFLAGS="$CXXFLAGS" ;; + *android*) + dnl make sure android stays above linux for hosts like *linux-android* + LEVELDB_TARGET_FLAGS="-DOS_ANDROID" + ;; *linux*) TARGET_OS=linux LEVELDB_TARGET_FLAGS="-DOS_LINUX" ;; + *kfreebsd*) + LEVELDB_TARGET_FLAGS="-DOS_KFREEBSD" + ;; *freebsd*) LEVELDB_TARGET_FLAGS="-DOS_FREEBSD" ;; *openbsd*) LEVELDB_TARGET_FLAGS="-DOS_OPENBSD" ;; + *netbsd*) + LEVELDB_TARGET_FLAGS="-DOS_NETBSD" + ;; + *dragonfly*) + LEVELDB_TARGET_FLAGS="-DOS_DRAGONFLYBSD" + ;; + *solaris*) + LEVELDB_TARGET_FLAGS="-DOS_SOLARIS" + ;; + *hpux*) + LEVELDB_TARGET_FLAGS="-DOS_HPUX" + ;; *) - OTHER_OS=`echo ${host_os} | awk '{print toupper($0)}'` - AC_MSG_WARN([Guessing LevelDB OS as OS_${OTHER_OS}, please check whether this is correct, if not add an entry to configure.ac.]) - LEVELDB_TARGET_FLAGS="-DOS_${OTHER_OS}" + AC_MSG_ERROR(Cannot build leveldb for $host. Please file a bug report.) ;; esac @@ -626,7 +646,7 @@ #glibc absorbed clock_gettime in 2.17. librt (its previous location) is safe to link #in anyway for back-compat. - AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(librt missing)) #__fdelt_chk's params and return type have changed from long unsigned int to long int. # See which one is present here. @@ -676,7 +696,7 @@ case $host in *mingw*) - AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([ssp], [main],, AC_MSG_ERROR(libssp missing)) ;; esac fi @@ -688,6 +708,10 @@ AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h]) +AC_CHECK_DECLS([getifaddrs, freeifaddrs],,, + [#include + #include ] +) AC_CHECK_DECLS([strnlen]) # Check for daemon(3), unrelated to --with-daemon (although used by it) @@ -774,6 +798,14 @@ [ AC_MSG_RESULT(no)] ) +AC_MSG_CHECKING(for if type char equals int8_t) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include + #include ]], + [[ static_assert(std::is_same::value, ""); ]])], + [ AC_MSG_RESULT(yes); AC_DEFINE(CHAR_EQUALS_INT8, 1,[Define this symbol if type char equals int8_t]) ], + [ AC_MSG_RESULT(no)] +) + # Check for reduced exports if test x$use_reduce_exports = xyes; then AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"], @@ -1186,6 +1218,8 @@ AC_SUBST(RELDFLAGS) AC_SUBST(DEBUG_CPPFLAGS) +AC_SUBST(WARN_CXXFLAGS) +AC_SUBST(NOWARN_CXXFLAGS) AC_SUBST(DEBUG_CXXFLAGS) AC_SUBST(COMPAT_LDFLAGS) AC_SUBST(ERROR_CXXFLAGS) @@ -1222,6 +1256,7 @@ AC_CONFIG_FILES([src/config/version.h]) AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) AC_CONFIG_LINKS([test/util/bitcoin-util-test.py:test/util/bitcoin-util-test.py]) +AC_CONFIG_LINKS([test/util/rpcauth-test.py:test/util/rpcauth-test.py]) dnl boost's m4 checks do something really nasty: they export these vars. As a dnl result, they leak into secp256k1's configure and crazy things happen. @@ -1297,7 +1332,7 @@ echo " CFLAGS = $CFLAGS" echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS" echo " CXX = $CXX" -echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $ERROR_CXXFLAGS $CXXFLAGS" +echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $CXXFLAGS" echo " LDFLAGS = $PTHREAD_CFLAGS $HARDENED_LDFLAGS $LDFLAGS" echo " ARFLAGS = $ARFLAGS" echo diff -Nru bitcoinabc-0.19.11-uahf/contrib/debian/copyright bitcoinabc-0.19.12-uahf/contrib/debian/copyright --- bitcoinabc-0.19.11-uahf/contrib/debian/copyright 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/debian/copyright 2019-08-16 12:22:07.000000000 +0000 @@ -18,6 +18,14 @@ 2017, freetrader License: GPL-2+ +Files: src/secp256k1/build-aux/m4/ax_jni_include_dir.m4 +Copyright: 2008 Don Anderson +License: GNU-All-permissive-License + +Files: src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4 +Copyright: 2008 Paolo Bonzini +License: GNU-All-permissive-License + Files: src/qt/res/icons/add.png src/qt/res/icons/address-book.png src/qt/res/icons/chevron.png @@ -111,6 +119,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +License: GNU-All-permissive-License + Copying and distribution of this file, with or without modification, are + permitted in any medium without royalty provided the copyright notice + and this notice are preserved. This file is offered as-is, without any + warranty. + License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff -Nru bitcoinabc-0.19.11-uahf/contrib/devtools/circular-dependencies.py bitcoinabc-0.19.12-uahf/contrib/devtools/circular-dependencies.py --- bitcoinabc-0.19.11-uahf/contrib/devtools/circular-dependencies.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/devtools/circular-dependencies.py 2019-08-16 12:22:07.000000000 +0000 @@ -39,7 +39,7 @@ # TODO: implement support for multiple include directories for arg in sorted(files.keys()): module = files[arg] - with open(arg, 'r') as f: + with open(arg, 'r', encoding="utf8") as f: for line in f: match = RE.match(line) if match: diff -Nru bitcoinabc-0.19.11-uahf/contrib/devtools/copyright_header.py bitcoinabc-0.19.12-uahf/contrib/devtools/copyright_header.py --- bitcoinabc-0.19.11-uahf/contrib/devtools/copyright_header.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/devtools/copyright_header.py 2019-08-16 12:22:07.000000000 +0000 @@ -160,7 +160,7 @@ def read_file(filename): - return open(os.path.abspath(filename), 'r').read() + return open(os.path.abspath(filename), 'r', encoding="utf8").read() def gather_file_info(filename): @@ -352,14 +352,14 @@ def read_file_lines(filename): - f = open(os.path.abspath(filename), 'r') + f = open(os.path.abspath(filename), 'r', encoding="utf8") file_lines = f.readlines() f.close() return file_lines def write_file_lines(filename, file_lines): - f = open(os.path.abspath(filename), 'w') + f = open(os.path.abspath(filename), 'w', encoding="utf8") f.write(''.join(file_lines)) f.close() diff -Nru bitcoinabc-0.19.11-uahf/contrib/devtools/test-security-check.py bitcoinabc-0.19.12-uahf/contrib/devtools/test-security-check.py --- bitcoinabc-0.19.11-uahf/contrib/devtools/test-security-check.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/devtools/test-security-check.py 2019-08-16 12:22:07.000000000 +0000 @@ -11,7 +11,7 @@ def write_testcode(filename): - with open(filename, 'w') as f: + with open(filename, 'w', encoding="utf8") as f: f.write(''' #include int main() diff -Nru bitcoinabc-0.19.11-uahf/contrib/filter-lcov.py bitcoinabc-0.19.12-uahf/contrib/filter-lcov.py --- bitcoinabc-0.19.11-uahf/contrib/filter-lcov.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/filter-lcov.py 2019-08-16 12:22:07.000000000 +0000 @@ -16,8 +16,8 @@ outfile = args.outfile in_remove = False -with open(tracefile, 'r') as f: - with open(outfile, 'w') as wf: +with open(tracefile, 'r', encoding="utf8") as f: + with open(outfile, 'w', encoding="utf8") as wf: for line in f: for p in pattern: if line.startswith("SF:") and p in line: diff -Nru bitcoinabc-0.19.11-uahf/contrib/linearize/example-linearize.cfg bitcoinabc-0.19.12-uahf/contrib/linearize/example-linearize.cfg --- bitcoinabc-0.19.11-uahf/contrib/linearize/example-linearize.cfg 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/linearize/example-linearize.cfg 2019-08-16 12:22:07.000000000 +0000 @@ -3,9 +3,16 @@ rpcpassword=somepassword #datadir=~/.bitcoin host=127.0.0.1 + +#mainnet default port=8332 + +#testnet default #port=18332 +#regtest default +#port=18443 + # bootstrap.dat hashlist settings (linearize-hashes) max_height=313000 diff -Nru bitcoinabc-0.19.11-uahf/contrib/linearize/linearize-data.py bitcoinabc-0.19.12-uahf/contrib/linearize/linearize-data.py --- bitcoinabc-0.19.11-uahf/contrib/linearize/linearize-data.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/linearize/linearize-data.py 2019-08-16 12:22:07.000000000 +0000 @@ -21,8 +21,6 @@ settings = {} -##### Switch endian-ness ##### - def hex_switchEndian(s): """ Switches the endianness of a hex string (in pairs of hex chars) """ @@ -87,7 +85,7 @@ def get_block_hashes(settings): blkindex = [] - f = open(settings['hashlist'], "r") + f = open(settings['hashlist'], "r", encoding="utf8") for line in f: line = line.rstrip() if settings['rev_hash_bytes'] == 'true': @@ -281,7 +279,7 @@ print("Usage: linearize-data.py CONFIG-FILE") sys.exit(1) - f = open(sys.argv[1]) + f = open(sys.argv[1], encoding="utf8") for line in f: # skip comment lines m = re.search(r'^\s*#', line) diff -Nru bitcoinabc-0.19.11-uahf/contrib/linearize/linearize-hashes.py bitcoinabc-0.19.12-uahf/contrib/linearize/linearize-hashes.py --- bitcoinabc-0.19.11-uahf/contrib/linearize/linearize-hashes.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/linearize/linearize-hashes.py 2019-08-16 12:22:07.000000000 +0000 @@ -21,8 +21,6 @@ settings = {} -##### Switch endian-ness ##### - def hex_switchEndian(s): """ Switches the endianness of a hex string (in pairs of hex chars) """ @@ -104,7 +102,7 @@ def get_rpc_cookie(): # Open the cookie file - with open(os.path.join(os.path.expanduser(settings['datadir']), '.cookie'), 'r') as f: + with open(os.path.join(os.path.expanduser(settings['datadir']), '.cookie'), 'r', encoding="ascii") as f: combined = f.readline() combined_split = combined.split(":") settings['rpcuser'] = combined_split[0] @@ -116,7 +114,7 @@ print("Usage: linearize-hashes.py CONFIG-FILE") sys.exit(1) - f = open(sys.argv[1]) + f = open(sys.argv[1], encoding="utf8") for line in f: # skip comment lines m = re.search(r'^\s*#', line) diff -Nru bitcoinabc-0.19.11-uahf/contrib/rpm/bitcoin.spec bitcoinabc-0.19.12-uahf/contrib/rpm/bitcoin.spec --- bitcoinabc-0.19.11-uahf/contrib/rpm/bitcoin.spec 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/rpm/bitcoin.spec 2019-08-16 12:22:07.000000000 +0000 @@ -336,6 +336,8 @@ %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 8333 %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18332 %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18333 +%{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18443 +%{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18444 %{_sbindir}/fixfiles -R bitcoin-server restore &> /dev/null || : %{_sbindir}/restorecon -R %{_localstatedir}/lib/bitcoin || : fi @@ -355,6 +357,8 @@ %{_sbindir}/semanage port -d -p tcp 8333 %{_sbindir}/semanage port -d -p tcp 18332 %{_sbindir}/semanage port -d -p tcp 18333 + %{_sbindir}/semanage port -d -p tcp 18443 + %{_sbindir}/semanage port -d -p tcp 18444 for selinuxvariant in %{selinux_variants}; do %{_sbindir}/semodule -s ${selinuxvariant} -r bitcoin &> /dev/null || : done diff -Nru bitcoinabc-0.19.11-uahf/contrib/seeds/generate-seeds.py bitcoinabc-0.19.12-uahf/contrib/seeds/generate-seeds.py --- bitcoinabc-0.19.11-uahf/contrib/seeds/generate-seeds.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/seeds/generate-seeds.py 2019-08-16 12:22:07.000000000 +0000 @@ -48,7 +48,7 @@ if len(addr) > 6 and addr.endswith('.onion'): vchAddr = b32decode(addr[0:-6], True) if len(vchAddr) != 16 - len(pchOnionCat): - raise ValueError('Invalid onion {}'.format(s)) + raise ValueError('Invalid onion {}'.format(vchAddr)) return pchOnionCat + vchAddr elif '.' in addr: # IPv4 return pchIPv4 + bytearray((int(x) for x in addr.split('.'))) @@ -133,10 +133,10 @@ g.write( ' * IPv4 as well as onion addresses are wrapped inside an IPv6 address accordingly.\n') g.write(' */\n') - with open(os.path.join(indir, 'nodes_main.txt'), 'r') as f: + with open(os.path.join(indir, 'nodes_main.txt'), 'r', encoding="utf8") as f: process_nodes(g, f, 'pnSeed6_main', 8333) g.write('\n') - with open(os.path.join(indir, 'nodes_test.txt'), 'r') as f: + with open(os.path.join(indir, 'nodes_test.txt'), 'r', encoding="utf8") as f: process_nodes(g, f, 'pnSeed6_test', 18333) g.write('#endif // BITCOIN_CHAINPARAMSSEEDS_H\n') diff -Nru bitcoinabc-0.19.11-uahf/contrib/seeds/makeseeds.py bitcoinabc-0.19.12-uahf/contrib/seeds/makeseeds.py --- bitcoinabc-0.19.11-uahf/contrib/seeds/makeseeds.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/seeds/makeseeds.py 2019-08-16 12:22:07.000000000 +0000 @@ -8,8 +8,9 @@ import collections import dns.resolver -import sys import re +import sys + NSEEDS = 512 MAX_SEEDS_PER_ASN = 2 diff -Nru bitcoinabc-0.19.11-uahf/contrib/seeds/nodes_main.txt bitcoinabc-0.19.12-uahf/contrib/seeds/nodes_main.txt --- bitcoinabc-0.19.11-uahf/contrib/seeds/nodes_main.txt 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/seeds/nodes_main.txt 2019-08-16 12:22:07.000000000 +0000 @@ -1,15 +1,16 @@ +3.16.127.222:8333 3.85.112.62:8333 3.113.172.57:48433 5.39.169.117:9334 5.39.174.125:8333 -5.188.104.245:8333 -18.185.211.222:8333 23.239.65.83:8333 +23.253.160.111:8333 24.192.60.220:8333 31.25.241.224:8333 31.220.56.195:8333 34.235.37.107:8333 35.195.168.18:8333 +35.211.37.184:8333 37.59.32.10:8433 37.157.193.121:8333 37.221.209.222:23333 @@ -28,50 +29,47 @@ 52.243.44.176:8333 60.249.215.221:8333 62.210.110.181:8333 -62.233.65.179:8333 63.143.32.126:8433 +63.224.56.249:8333 66.96.199.249:8333 66.151.242.154:8333 -66.187.65.6:8333 66.206.13.51:8335 67.239.3.146:8333 69.181.246.223:8333 70.174.210.133:8333 71.67.65.230:12502 -78.97.206.149:8333 78.129.229.69:8333 81.98.216.212:8333 81.174.133.68:8333 81.237.206.224:8353 -82.75.64.15:8333 +82.117.166.77:8331 82.200.205.30:8331 82.221.128.33:8364 83.221.211.116:8333 84.112.174.5:8222 -84.213.145.196:8333 84.234.96.41:8333 84.234.96.81:8333 +87.125.66.198:8333 88.208.3.195:8331 89.179.247.236:8333 89.238.77.69:8334 -91.148.141.242:8333 91.197.44.144:8333 92.206.113.127:8333 92.222.180.14:8343 -93.115.28.24:8333 +94.199.178.17:8343 94.244.97.244:8533 94.247.134.76:8333 94.247.134.186:8333 95.79.35.133:7333 -95.172.230.70:8333 -95.174.66.211:8334 95.213.171.117:8333 +96.70.42.232:8333 100.1.209.114:8333 100.11.114.130:8333 101.92.39.116:8334 104.172.190.165:8333 -104.199.220.66:8333 +104.196.255.91:8333 104.215.29.209:8333 +104.219.250.140:8633 104.237.4.202:8333 107.175.46.159:8334 107.191.117.175:8333 @@ -83,15 +81,13 @@ 136.144.215.219:8133 136.243.204.71:8333 139.59.72.4:8333 -141.0.152.69:8333 -141.239.183.148:8333 142.68.56.141:8333 -146.90.44.252:8333 +146.90.44.188:8333 149.210.238.31:8333 +151.106.29.126:8333 162.220.47.150:8333 +162.221.89.109:31451 162.242.168.36:8333 -162.242.168.55:8333 -163.172.142.149:10020 170.106.66.186:8333 172.96.161.245:8333 172.105.233.17:8333 @@ -101,16 +97,19 @@ 173.224.240.45:8333 173.249.58.36:8333 176.9.122.3:8333 -176.223.137.37:8335 +176.198.120.197:8333 178.21.118.33:8333 179.218.80.242:8333 183.111.234.221:8333 185.25.60.199:8331 185.81.164.38:8333 +185.88.29.208:8333 185.138.8.46:8333 185.154.156.58:8333 185.154.159.164:9991 185.157.160.219:8333 +185.219.223.108:8333 +185.247.117.230:8333 188.134.90.224:8333 188.166.12.12:8333 190.2.130.27:8333 @@ -119,9 +118,11 @@ 193.138.218.67:8333 193.169.244.189:8333 194.14.246.205:8444 -194.14.247.116:8333 +194.14.247.123:8333 194.67.222.6:8333 +194.135.81.28:8333 195.122.150.173:8333 +195.154.168.129:8333 198.204.229.34:8333 199.201.110.56:8334 203.132.95.10:8334 @@ -131,7 +132,6 @@ 209.160.33.233:8333 209.188.18.204:8334 211.43.8.168:8335 -212.32.230.219:8333 212.107.44.171:10333 213.165.68.218:8333 213.227.140.194:8333 diff -Nru bitcoinabc-0.19.11-uahf/contrib/seeds/nodes_test.txt bitcoinabc-0.19.12-uahf/contrib/seeds/nodes_test.txt --- bitcoinabc-0.19.11-uahf/contrib/seeds/nodes_test.txt 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/seeds/nodes_test.txt 2019-08-16 12:22:07.000000000 +0000 @@ -4,23 +4,25 @@ 35.208.33.200:18333 35.240.206.73:18333 47.90.87.95:18333 -51.15.47.58:18333 +47.112.107.138:18333 51.254.176.217:18333 52.50.169.97:8333 52.211.211.11:18333 54.164.241.129:8333 +63.224.56.249:18333 70.36.125.75:18333 74.208.103.223:18533 +81.174.133.68:18333 94.237.73.18:18333 94.237.73.111:18333 103.76.36.113:18331 106.10.34.74:18333 107.191.117.175:18333 +109.70.144.165:19333 116.125.120.98:18333 116.203.106.98:18333 -118.31.42.71:18337 120.77.82.190:18443 -159.203.10.216:18333 +157.230.240.58:18333 163.172.131.26:18333 167.86.77.23:18333 171.25.222.56:28333 @@ -28,8 +30,9 @@ 172.105.233.17:18333 178.195.36.68:18333 188.165.218.73:18333 +188.166.81.103:11333 193.35.108.107:18333 193.135.10.219:18333 194.14.247.130:18333 194.14.247.131:18333 -206.189.188.192:18333 +195.154.177.49:18333 diff -Nru bitcoinabc-0.19.11-uahf/contrib/teamcity/build-configurations.sh bitcoinabc-0.19.12-uahf/contrib/teamcity/build-configurations.sh --- bitcoinabc-0.19.11-uahf/contrib/teamcity/build-configurations.sh 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/teamcity/build-configurations.sh 2019-08-16 12:22:07.000000000 +0000 @@ -14,7 +14,12 @@ case "$ABC_BUILD_NAME" in build-asan) - export CONFIGURE_FLAGS="--with-sanitizers=address --disable-ccache" + export CONFIGURE_FLAGS="--enable-debug --with-sanitizers=address --disable-ccache" + ./build.sh + ;; + + build-ubsan) + export CONFIGURE_FLAGS="--enable-debug --with-sanitizers=undefined --disable-ccache CC=clang CXX=clang++" ./build.sh ;; diff -Nru bitcoinabc-0.19.11-uahf/contrib/teamcity/build.sh bitcoinabc-0.19.12-uahf/contrib/teamcity/build.sh --- bitcoinabc-0.19.11-uahf/contrib/teamcity/build.sh 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/contrib/teamcity/build.sh 2019-08-16 12:22:07.000000000 +0000 @@ -42,7 +42,7 @@ rm -rf "${SAN_LOG_DIR}"/* # Sanitizers options, not used if sanitizers are not enabled -export ASAN_OPTIONS="log_path=${SAN_LOG_DIR}/asan.log" +export ASAN_OPTIONS="malloc_context_size=0:log_path=${SAN_LOG_DIR}/asan.log" export LSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/lsan:log_path=${SAN_LOG_DIR}/lsan.log" export TSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/tsan:log_path=${SAN_LOG_DIR}/tsan.log" export UBSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/ubsan:print_stacktrace=1:halt_on_error=1:log_path=${SAN_LOG_DIR}/ubsan.log" diff -Nru bitcoinabc-0.19.11-uahf/CONTRIBUTING.md bitcoinabc-0.19.12-uahf/CONTRIBUTING.md --- bitcoinabc-0.19.11-uahf/CONTRIBUTING.md 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/CONTRIBUTING.md 2019-08-16 12:22:07.000000000 +0000 @@ -127,7 +127,7 @@ During submission of patches, arcanist will automatically run `arc lint` to enforce Bitcoin ABC code formatting standards, and often suggests changes. If code formatting tools do not install automatically on your system, you -will have to install clang-format-7, autopep8 and flake8. +will have to install clang-format-7, autopep8, flake8 and phpcs. To install clang-format-7 on Ubuntu (>= 18.04+updates) or Debian (>= 10): ``` @@ -136,9 +136,9 @@ If not available in the distribution, clang-format-7 can be installed from https://releases.llvm.org/download.html or https://apt.llvm.org -To install autopep8 and flake8 on Ubuntu: +To install autopep8, flake8 and phpcs on Ubuntu: ``` -sudo apt-get install python-autopep8 flake8 +sudo apt-get install python-autopep8 flake8 php-codesniffer ``` diff -Nru bitcoinabc-0.19.11-uahf/debian/changelog bitcoinabc-0.19.12-uahf/debian/changelog --- bitcoinabc-0.19.11-uahf/debian/changelog 2019-08-01 11:33:40.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/debian/changelog 2019-08-16 12:27:38.000000000 +0000 @@ -1,8 +1,14 @@ -bitcoinabc (0.19.11-uahf-bionic3) bionic; urgency=medium +bitcoinabc (0.19.12-uahf-bionic1) bionic; urgency=medium + + * Bitcoin ABC 0.19.12-uahf release. + + -- Andrea Suisani (sickpig) Fri, 16 Aug 2019 14:30:00 +0200 + +bitcoinabc (0.19.11-uahf-bionic1) bionic; urgency=medium * Bitcoin ABC 0.19.11-uahf release. - -- Andrea Suisani (sickpig) Thu, 01 Aug 2019 13:35:00 +0200 + -- Andrea Suisani (sickpig) Thu, 01 Aug 2019 10:50:00 +0200 bitcoinabc (0.19.10-uahf-bionic1) bionic; urgency=medium diff -Nru bitcoinabc-0.19.11-uahf/doc/man/bitcoin-cli.1 bitcoinabc-0.19.12-uahf/doc/man/bitcoin-cli.1 --- bitcoinabc-0.19.11-uahf/doc/man/bitcoin-cli.1 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/man/bitcoin-cli.1 2019-08-16 12:22:07.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-CLI "1" "July 2019" "bitcoin-cli v0.19.11.0" "User Commands" +.TH BITCOIN-CLI "1" "August 2019" "bitcoin-cli v0.19.12.0" "User Commands" .SH NAME -bitcoin-cli \- manual page for bitcoin-cli v0.19.11.0 +bitcoin-cli \- manual page for bitcoin-cli v0.19.12.0 .SH SYNOPSIS .B bitcoin-cli [\fI\,options\/\fR] \fI\, \/\fR[\fI\,params\/\fR] \fI\,Send command to Bitcoin ABC\/\fR @@ -15,7 +15,7 @@ .B bitcoin-cli [\fI\,options\/\fR] \fI\,help Get help for a command\/\fR .SH DESCRIPTION -Bitcoin ABC RPC client version v0.19.11.0 +Bitcoin ABC RPC client version v0.19.12.0 .SH OPTIONS .HP \-? diff -Nru bitcoinabc-0.19.11-uahf/doc/man/bitcoind.1 bitcoinabc-0.19.12-uahf/doc/man/bitcoind.1 --- bitcoinabc-0.19.11-uahf/doc/man/bitcoind.1 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/man/bitcoind.1 2019-08-16 12:22:07.000000000 +0000 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIND "1" "July 2019" "bitcoind v0.19.11.0" "User Commands" +.TH BITCOIND "1" "August 2019" "bitcoind v0.19.12.0" "User Commands" .SH NAME -bitcoind \- manual page for bitcoind v0.19.11.0 +bitcoind \- manual page for bitcoind v0.19.12.0 .SH SYNOPSIS .B bitcoind [\fI\,options\/\fR] \fI\,Start Bitcoin ABC Daemon\/\fR .SH DESCRIPTION -Bitcoin ABC Daemon version v0.19.11.0 +Bitcoin ABC Daemon version v0.19.12.0 .SH OPTIONS .HP \-? @@ -23,9 +23,9 @@ 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: -00000000000000000351a488f34e8d5f4e215836fc6022ef271eb57024968eaa, +0000000000000000025e589b280d1d947cded3c29a7881ad9bdea722269452be, testnet: -000000000000074e1e01f86773c740a6ad576f253b26d3f337b4f07c4c5209d4) +00000000fbabb53ec6eddb3d56d3262f30dbb6549b391255090d351eccd01c24) .HP \fB\-blocknotify=\fR .IP diff -Nru bitcoinabc-0.19.11-uahf/doc/man/bitcoin-qt.1 bitcoinabc-0.19.12-uahf/doc/man/bitcoin-qt.1 --- bitcoinabc-0.19.11-uahf/doc/man/bitcoin-qt.1 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/man/bitcoin-qt.1 2019-08-16 12:22:07.000000000 +0000 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-QT "1" "July 2019" "bitcoin-qt v0.19.11.0" "User Commands" +.TH BITCOIN-QT "1" "August 2019" "bitcoin-qt v0.19.12.0" "User Commands" .SH NAME -bitcoin-qt \- manual page for bitcoin-qt v0.19.11.0 +bitcoin-qt \- manual page for bitcoin-qt v0.19.12.0 .SH SYNOPSIS .B bitcoin-qt [\fI\,command-line options\/\fR] .SH DESCRIPTION -Bitcoin ABC version v0.19.11.0 (64\-bit) +Bitcoin ABC version v0.19.12.0 (64\-bit) .SH OPTIONS .HP \-? @@ -23,9 +23,9 @@ 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: -00000000000000000351a488f34e8d5f4e215836fc6022ef271eb57024968eaa, +0000000000000000025e589b280d1d947cded3c29a7881ad9bdea722269452be, testnet: -000000000000074e1e01f86773c740a6ad576f253b26d3f337b4f07c4c5209d4) +00000000fbabb53ec6eddb3d56d3262f30dbb6549b391255090d351eccd01c24) .HP \fB\-blocknotify=\fR .IP diff -Nru bitcoinabc-0.19.11-uahf/doc/man/bitcoin-tx.1 bitcoinabc-0.19.12-uahf/doc/man/bitcoin-tx.1 --- bitcoinabc-0.19.11-uahf/doc/man/bitcoin-tx.1 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/man/bitcoin-tx.1 2019-08-16 12:22:07.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH BITCOIN-TX "1" "July 2019" "bitcoin-tx v0.19.11.0" "User Commands" +.TH BITCOIN-TX "1" "August 2019" "bitcoin-tx v0.19.12.0" "User Commands" .SH NAME -bitcoin-tx \- manual page for bitcoin-tx v0.19.11.0 +bitcoin-tx \- manual page for bitcoin-tx v0.19.12.0 .SH SYNOPSIS .B bitcoin-tx [\fI\,options\/\fR] \fI\, \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded bitcoin transaction\/\fR @@ -9,7 +9,7 @@ .B bitcoin-tx [\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded bitcoin transaction\/\fR .SH DESCRIPTION -Bitcoin ABC bitcoin\-tx utility version v0.19.11.0 +Bitcoin ABC bitcoin\-tx utility version v0.19.12.0 .SH OPTIONS .HP \-? diff -Nru bitcoinabc-0.19.11-uahf/doc/release-notes/release-notes-0.19.11.md bitcoinabc-0.19.12-uahf/doc/release-notes/release-notes-0.19.11.md --- bitcoinabc-0.19.11-uahf/doc/release-notes/release-notes-0.19.11.md 1970-01-01 00:00:00.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/release-notes/release-notes-0.19.11.md 2019-08-16 12:22:07.000000000 +0000 @@ -0,0 +1,14 @@ +Bitcoin ABC version 0.19.11 is now available from: + + + +This release includes the following features and fixes: + +Dynamic loading of wallets +-------------------------- + +Previously, wallets could only be loaded at startup, by specifying `-wallet` parameters on the command line or in the bitcoin.conf file. It is now possible to load wallets dynamically at runtime by calling the `loadwallet` RPC. + +The wallet can be specified as file/directory basename (which must be located in the `walletdir` directory), or as an absolute path to a file/directory. + +This feature is currently only available through the RPC interface. Wallets loaded in this way will not display in the bitcoin-qt GUI. diff -Nru bitcoinabc-0.19.11-uahf/doc/release-notes.md bitcoinabc-0.19.12-uahf/doc/release-notes.md --- bitcoinabc-0.19.11-uahf/doc/release-notes.md 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/release-notes.md 2019-08-16 12:22:07.000000000 +0000 @@ -1,14 +1,9 @@ -Bitcoin ABC version 0.19.11 is now available from: +Bitcoin ABC version 0.19.12 is now available from: - + This release includes the following features and fixes: - -Dynamic loading of wallets --------------------------- - -Previously, wallets could only be loaded at startup, by specifying `-wallet` parameters on the command line or in the bitcoin.conf file. It is now possible to load wallets dynamically at runtime by calling the `loadwallet` RPC. - -The wallet can be specified as file/directory basename (which must be located in the `walletdir` directory), or as an absolute path to a file/directory. - -This feature is currently only available through the RPC interface. Wallets loaded in this way will not display in the bitcoin-qt GUI. + - Add the `getblockstats` RPC to get statistics on a block or a block range. + - Logging improvements to reduce noisy network messages. + - Logging added during wallet rescans. + - Minor bug fixes, stability improvements, and typo corrections. diff -Nru bitcoinabc-0.19.11-uahf/doc/REST-interface.md bitcoinabc-0.19.12-uahf/doc/REST-interface.md --- bitcoinabc-0.19.11-uahf/doc/REST-interface.md 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/doc/REST-interface.md 2019-08-16 12:22:07.000000000 +0000 @@ -3,7 +3,7 @@ The REST API can be enabled with the `-rest` option. -The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet and port 18332 for testnet. +The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet, port 18332 for testnet, and port 18443 for regtest. Supported API ------------- diff -Nru bitcoinabc-0.19.11-uahf/.git/config bitcoinabc-0.19.12-uahf/.git/config --- bitcoinabc-0.19.11-uahf/.git/config 2019-08-01 08:42:39.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/.git/config 2019-08-16 12:22:04.000000000 +0000 @@ -5,4 +5,4 @@ logallrefupdates = true [remote "origin"] url = https://github.com/Bitcoin-ABC/bitcoin-abc.git - fetch = +refs/tags/v0.19.11:refs/tags/v0.19.11 + fetch = +refs/tags/v0.19.12:refs/tags/v0.19.12 diff -Nru bitcoinabc-0.19.11-uahf/.git/HEAD bitcoinabc-0.19.12-uahf/.git/HEAD --- bitcoinabc-0.19.11-uahf/.git/HEAD 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/.git/HEAD 2019-08-16 12:22:07.000000000 +0000 @@ -1 +1 @@ -f8cbc0e2b439aa4030430a7b1ecbdafede0dd072 +29ec9c3571bedb79bb79bf297da189f82302ca36 Binary files /tmp/tmpRnuMro/BCpoeDCw23/bitcoinabc-0.19.11-uahf/.git/index and /tmp/tmpRnuMro/LR8F_I2b0w/bitcoinabc-0.19.12-uahf/.git/index differ diff -Nru bitcoinabc-0.19.11-uahf/.git/logs/HEAD bitcoinabc-0.19.12-uahf/.git/logs/HEAD --- bitcoinabc-0.19.11-uahf/.git/logs/HEAD 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/.git/logs/HEAD 2019-08-16 12:22:07.000000000 +0000 @@ -1 +1 @@ -0000000000000000000000000000000000000000 f8cbc0e2b439aa4030430a7b1ecbdafede0dd072 Andrea Suisani 1564648962 +0200 clone: from https://github.com/Bitcoin-ABC/bitcoin-abc.git +0000000000000000000000000000000000000000 29ec9c3571bedb79bb79bf297da189f82302ca36 Andrea Suisani 1565958127 +0200 clone: from https://github.com/Bitcoin-ABC/bitcoin-abc.git Binary files /tmp/tmpRnuMro/BCpoeDCw23/bitcoinabc-0.19.11-uahf/.git/objects/pack/pack-177d0195f0c14dabb50b1b73927f6efe14d9aece.idx and /tmp/tmpRnuMro/LR8F_I2b0w/bitcoinabc-0.19.12-uahf/.git/objects/pack/pack-177d0195f0c14dabb50b1b73927f6efe14d9aece.idx differ Binary files /tmp/tmpRnuMro/BCpoeDCw23/bitcoinabc-0.19.11-uahf/.git/objects/pack/pack-177d0195f0c14dabb50b1b73927f6efe14d9aece.pack and /tmp/tmpRnuMro/LR8F_I2b0w/bitcoinabc-0.19.12-uahf/.git/objects/pack/pack-177d0195f0c14dabb50b1b73927f6efe14d9aece.pack differ Binary files /tmp/tmpRnuMro/BCpoeDCw23/bitcoinabc-0.19.11-uahf/.git/objects/pack/pack-d1d34662f0bb8a4d2a19e5befdfe4824c58f0812.idx and /tmp/tmpRnuMro/LR8F_I2b0w/bitcoinabc-0.19.12-uahf/.git/objects/pack/pack-d1d34662f0bb8a4d2a19e5befdfe4824c58f0812.idx differ Binary files /tmp/tmpRnuMro/BCpoeDCw23/bitcoinabc-0.19.11-uahf/.git/objects/pack/pack-d1d34662f0bb8a4d2a19e5befdfe4824c58f0812.pack and /tmp/tmpRnuMro/LR8F_I2b0w/bitcoinabc-0.19.12-uahf/.git/objects/pack/pack-d1d34662f0bb8a4d2a19e5befdfe4824c58f0812.pack differ diff -Nru bitcoinabc-0.19.11-uahf/.git/packed-refs bitcoinabc-0.19.12-uahf/.git/packed-refs --- bitcoinabc-0.19.11-uahf/.git/packed-refs 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/.git/packed-refs 2019-08-16 12:22:07.000000000 +0000 @@ -1,2 +1,2 @@ # pack-refs with: peeled fully-peeled sorted -f8cbc0e2b439aa4030430a7b1ecbdafede0dd072 refs/tags/v0.19.11 +29ec9c3571bedb79bb79bf297da189f82302ca36 refs/tags/v0.19.12 diff -Nru bitcoinabc-0.19.11-uahf/.git/shallow bitcoinabc-0.19.12-uahf/.git/shallow --- bitcoinabc-0.19.11-uahf/.git/shallow 2019-08-01 08:42:40.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/.git/shallow 2019-08-16 12:22:04.000000000 +0000 @@ -1 +1 @@ -f8cbc0e2b439aa4030430a7b1ecbdafede0dd072 +29ec9c3571bedb79bb79bf297da189f82302ca36 diff -Nru bitcoinabc-0.19.11-uahf/Makefile.am bitcoinabc-0.19.12-uahf/Makefile.am --- bitcoinabc-0.19.11-uahf/Makefile.am 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/Makefile.am 2019-08-16 12:22:07.000000000 +0000 @@ -262,7 +262,8 @@ test/util/data/txcreatescript2.json \ test/util/data/txcreatesignv1.hex \ test/util/data/txcreatesignv1.json \ - test/util/data/txcreatesignv2.hex + test/util/data/txcreatesignv2.hex \ + test/util/rpcauth-test.py CLEANFILES = $(OSX_DMG) $(BITCOIN_WIN_INSTALLER) diff -Nru bitcoinabc-0.19.11-uahf/share/qt/extract_strings_qt.py bitcoinabc-0.19.12-uahf/share/qt/extract_strings_qt.py --- bitcoinabc-0.19.11-uahf/share/qt/extract_strings_qt.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/share/qt/extract_strings_qt.py 2019-08-16 12:22:07.000000000 +0000 @@ -67,7 +67,7 @@ messages = parse_po(out.decode('utf-8')) -f = open(OUT_CPP, 'w') +f = open(OUT_CPP, 'w', encoding="utf8") f.write(""" #include diff -Nru bitcoinabc-0.19.11-uahf/share/rpcauth/README.md bitcoinabc-0.19.12-uahf/share/rpcauth/README.md --- bitcoinabc-0.19.11-uahf/share/rpcauth/README.md 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/share/rpcauth/README.md 2019-08-16 12:22:07.000000000 +0000 @@ -3,8 +3,16 @@ ### [RPCAuth](/share/rpcauth) ### -Create login credentials for a JSON-RPC user. +``` +usage: rpcauth.py [-h] username [password] -Usage: +Create login credentials for a JSON-RPC user - ./rpcauth.py +positional arguments: + username the username for authentication + password leave empty to generate a random password or specify "-" to + prompt for password + +optional arguments: + -h, --help show this help message and exit + ``` diff -Nru bitcoinabc-0.19.11-uahf/share/rpcauth/rpcauth.py bitcoinabc-0.19.12-uahf/share/rpcauth/rpcauth.py --- bitcoinabc-0.19.11-uahf/share/rpcauth/rpcauth.py 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/share/rpcauth/rpcauth.py 2019-08-16 12:22:07.000000000 +0000 @@ -1,34 +1,54 @@ #!/usr/bin/env python3 -# Copyright (c) 2015-2017 The Bitcoin Core developers +# Copyright (c) 2015-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -import sys -import os -from random import SystemRandom -import base64 +from argparse import ArgumentParser +from base64 import urlsafe_b64encode +from binascii import hexlify +from getpass import getpass +from os import urandom + import hmac -if len(sys.argv) < 2: - sys.stderr.write('Please include username as an argument.\n') - sys.exit(0) -username = sys.argv[1] +def generate_salt(size): + """Create size byte hex salt""" + return hexlify(urandom(size)).decode() + + +def generate_password(): + """Create 32 byte b64 password""" + return urlsafe_b64encode(urandom(32)).decode('utf-8') + + +def password_to_hmac(salt, password): + m = hmac.new(bytearray(salt, 'utf-8'), + bytearray(password, 'utf-8'), 'SHA256') + return m.hexdigest() + + +def main(): + parser = ArgumentParser( + description='Create login credentials for a JSON-RPC user') + parser.add_argument('username', help='the username for authentication') + parser.add_argument( + 'password', help='leave empty to generate a random password or specify "-" to prompt for password', nargs='?') + args = parser.parse_args() -# This uses os.urandom() underneath -cryptogen = SystemRandom() + if not args.password: + args.password = generate_password() + elif args.password == '-': + args.password = getpass() -# Create 16 byte hex salt -salt_sequence = [cryptogen.randrange(256) for i in range(16)] -hexseq = list(map(hex, salt_sequence)) -salt = "".join([x[2:] for x in hexseq]) + # Create 16 byte hex salt + salt = generate_salt(16) + password_hmac = password_to_hmac(salt, args.password) -# Create 32 byte b64 password -password = base64.urlsafe_b64encode(os.urandom(32)).decode("utf-8") + print('String to be appended to bitcoin.conf:') + print('rpcauth={0}:{1}${2}'.format(args.username, salt, password_hmac)) + print('Your password:\n{0}'.format(args.password)) -m = hmac.new(bytearray(salt, 'utf-8'), bytearray(password, 'utf-8'), "SHA256") -result = m.hexdigest() -print("String to be appended to bitcoin.conf:") -print("rpcauth=" + username + ":" + salt + "$" + result) -print("Your password:\n" + password) +if __name__ == '__main__': + main() diff -Nru bitcoinabc-0.19.11-uahf/src/arith_uint256.cpp bitcoinabc-0.19.12-uahf/src/arith_uint256.cpp --- bitcoinabc-0.19.11-uahf/src/arith_uint256.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/arith_uint256.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -63,16 +63,16 @@ template base_uint &base_uint::operator*=(const base_uint &b) { - base_uint a = *this; - *this = 0; + base_uint a; for (int j = 0; j < WIDTH; j++) { uint64_t carry = 0; for (int i = 0; i + j < WIDTH; i++) { - uint64_t n = carry + pn[i + j] + (uint64_t)a.pn[j] * b.pn[i]; - pn[i + j] = n & 0xffffffff; + uint64_t n = carry + a.pn[i + j] + (uint64_t)pn[j] * b.pn[i]; + a.pn[i + j] = n & 0xffffffff; carry = n >> 32; } } + *this = a; return *this; } diff -Nru bitcoinabc-0.19.11-uahf/src/bench/bench_bitcoin.cpp bitcoinabc-0.19.12-uahf/src/bench/bench_bitcoin.cpp --- bitcoinabc-0.19.11-uahf/src/bench/bench_bitcoin.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/bench/bench_bitcoin.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -76,12 +76,12 @@ if (!gArgs.ParseParameters(argc, argv, error)) { fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str()); - return false; + return EXIT_FAILURE; } if (HelpRequested(gArgs)) { std::cout << gArgs.GetHelpMessage(); - return 0; + return EXIT_SUCCESS; } SHA256AutoDetect(); @@ -113,4 +113,6 @@ regex_filter, is_list_only); ECC_Stop(); + + return EXIT_SUCCESS; } diff -Nru bitcoinabc-0.19.11-uahf/src/chainparamsbase.cpp bitcoinabc-0.19.12-uahf/src/chainparamsbase.cpp --- bitcoinabc-0.19.11-uahf/src/chainparamsbase.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/chainparamsbase.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -24,36 +24,6 @@ OptionsCategory::CHAINPARAMS); } -/** - * Main network - */ -class CBaseMainParams : public CBaseChainParams { -public: - CBaseMainParams() { nRPCPort = 8332; } -}; - -/** - * Testnet (v3) - */ -class CBaseTestNetParams : public CBaseChainParams { -public: - CBaseTestNetParams() { - nRPCPort = 18332; - strDataDir = "testnet3"; - } -}; - -/* - * Regression test - */ -class CBaseRegTestParams : public CBaseChainParams { -public: - CBaseRegTestParams() { - nRPCPort = 18332; - strDataDir = "regtest"; - } -}; - static std::unique_ptr globalChainBaseParams; const CBaseChainParams &BaseParams() { @@ -64,11 +34,11 @@ std::unique_ptr CreateBaseChainParams(const std::string &chain) { if (chain == CBaseChainParams::MAIN) - return std::unique_ptr(new CBaseMainParams()); + return std::make_unique("", 8332); else if (chain == CBaseChainParams::TESTNET) - return std::unique_ptr(new CBaseTestNetParams()); + return std::make_unique("testnet3", 18332); else if (chain == CBaseChainParams::REGTEST) - return std::unique_ptr(new CBaseRegTestParams()); + return std::make_unique("regtest", 18443); else throw std::runtime_error( strprintf("%s: Unknown chain %s.", __func__, chain)); diff -Nru bitcoinabc-0.19.11-uahf/src/chainparamsbase.h bitcoinabc-0.19.12-uahf/src/chainparamsbase.h --- bitcoinabc-0.19.11-uahf/src/chainparamsbase.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/chainparamsbase.h 2019-08-16 12:22:07.000000000 +0000 @@ -24,9 +24,11 @@ const std::string &DataDir() const { return strDataDir; } int RPCPort() const { return nRPCPort; } -protected: - CBaseChainParams() {} + CBaseChainParams() = delete; + CBaseChainParams(const std::string &data_dir, int rpc_port) + : nRPCPort(rpc_port), strDataDir(data_dir) {} +private: int nRPCPort; std::string strDataDir; }; diff -Nru bitcoinabc-0.19.11-uahf/src/chainparams.cpp bitcoinabc-0.19.12-uahf/src/chainparams.cpp --- bitcoinabc-0.19.11-uahf/src/chainparams.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/chainparams.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -105,12 +105,12 @@ // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S( - "000000000000000000000000000000000000000000f6201b2867470678a5a3a4"); + "000000000000000000000000000000000000000000f82892fe397d90089a49a5"); // By default assume that the signatures in ancestors of this block are // valid. consensus.defaultAssumeValid = uint256S( - "00000000000000000351a488f34e8d5f4e215836fc6022ef271eb57024968eaa"); + "0000000000000000025e589b280d1d947cded3c29a7881ad9bdea722269452be"); // August 1, 2017 hard fork consensus.uahfHeight = 478558; @@ -268,12 +268,12 @@ // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S( - "00000000000000000000000000000000000000000000005112a96011b35bdd86"); + "0000000000000000000000000000000000000000000000512031dc9900995ec4"); // By default assume that the signatures in ancestors of this block are // valid. consensus.defaultAssumeValid = uint256S( - "000000000000074e1e01f86773c740a6ad576f253b26d3f337b4f07c4c5209d4"); + "00000000fbabb53ec6eddb3d56d3262f30dbb6549b391255090d351eccd01c24"); // August 1, 2017 hard fork consensus.uahfHeight = 1155875; diff -Nru bitcoinabc-0.19.11-uahf/src/chainparamsseeds.h bitcoinabc-0.19.12-uahf/src/chainparamsseeds.h --- bitcoinabc-0.19.11-uahf/src/chainparamsseeds.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/chainparamsseeds.h 2019-08-16 12:22:07.000000000 +0000 @@ -8,18 +8,19 @@ * IPv4 as well as onion addresses are wrapped inside an IPv6 address accordingly. */ static SeedSpec6 pnSeed6_main[] = { + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x10,0x7f,0xde}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x55,0x70,0x3e}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x03,0x71,0xac,0x39}, 48433}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x05,0x27,0xa9,0x75}, 9334}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x05,0x27,0xae,0x7d}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x05,0xbc,0x68,0xf5}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x12,0xb9,0xd3,0xde}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x17,0xef,0x41,0x53}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x17,0xfd,0xa0,0x6f}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x18,0xc0,0x3c,0xdc}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x1f,0x19,0xf1,0xe0}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x1f,0xdc,0x38,0xc3}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x22,0xeb,0x25,0x6b}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x23,0xc3,0xa8,0x12}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x23,0xd3,0x25,0xb8}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x25,0x3b,0x20,0x0a}, 8433}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x25,0x9d,0xc1,0x79}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x25,0xdd,0xd1,0xde}, 23333}, @@ -38,50 +39,47 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x34,0xf3,0x2c,0xb0}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3c,0xf9,0xd7,0xdd}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3e,0xd2,0x6e,0xb5}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3e,0xe9,0x41,0xb3}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3f,0x8f,0x20,0x7e}, 8433}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3f,0xe0,0x38,0xf9}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x42,0x60,0xc7,0xf9}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x42,0x97,0xf2,0x9a}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x42,0xbb,0x41,0x06}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x42,0xce,0x0d,0x33}, 8335}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x43,0xef,0x03,0x92}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x45,0xb5,0xf6,0xdf}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x46,0xae,0xd2,0x85}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x47,0x43,0x41,0xe6}, 12502}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4e,0x61,0xce,0x95}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4e,0x81,0xe5,0x45}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x51,0x62,0xd8,0xd4}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x51,0xae,0x85,0x44}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x51,0xed,0xce,0xe0}, 8353}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x52,0x4b,0x40,0x0f}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x52,0x75,0xa6,0x4d}, 8331}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x52,0xc8,0xcd,0x1e}, 8331}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x52,0xdd,0x80,0x21}, 8364}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x53,0xdd,0xd3,0x74}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x54,0x70,0xae,0x05}, 8222}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x54,0xd5,0x91,0xc4}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x54,0xea,0x60,0x29}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x54,0xea,0x60,0x51}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x57,0x7d,0x42,0xc6}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x58,0xd0,0x03,0xc3}, 8331}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x59,0xb3,0xf7,0xec}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x59,0xee,0x4d,0x45}, 8334}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5b,0x94,0x8d,0xf2}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5b,0xc5,0x2c,0x90}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5c,0xce,0x71,0x7f}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5c,0xde,0xb4,0x0e}, 8343}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5d,0x73,0x1c,0x18}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5e,0xc7,0xb2,0x11}, 8343}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5e,0xf4,0x61,0xf4}, 8533}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5e,0xf7,0x86,0x4c}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5e,0xf7,0x86,0xba}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0x4f,0x23,0x85}, 7333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xac,0xe6,0x46}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xae,0x42,0xd3}, 8334}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5f,0xd5,0xab,0x75}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x60,0x46,0x2a,0xe8}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x64,0x01,0xd1,0x72}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x64,0x0b,0x72,0x82}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x65,0x5c,0x27,0x74}, 8334}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xac,0xbe,0xa5}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xc7,0xdc,0x42}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xc4,0xff,0x5b}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xd7,0x1d,0xd1}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xdb,0xfa,0x8c}, 8633}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x68,0xed,0x04,0xca}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xaf,0x2e,0x9f}, 8334}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xbf,0x75,0xaf}, 8333}, @@ -93,15 +91,13 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x88,0x90,0xd7,0xdb}, 8133}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x88,0xf3,0xcc,0x47}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8b,0x3b,0x48,0x04}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8d,0x00,0x98,0x45}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8d,0xef,0xb7,0x94}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x8e,0x44,0x38,0x8d}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x92,0x5a,0x2c,0xfc}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x92,0x5a,0x2c,0xbc}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x95,0xd2,0xee,0x1f}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x97,0x6a,0x1d,0x7e}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xdc,0x2f,0x96}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xdd,0x59,0x6d}, 31451}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xf2,0xa8,0x24}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xf2,0xa8,0x37}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa3,0xac,0x8e,0x95}, 10020}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xaa,0x6a,0x42,0xba}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xac,0x60,0xa1,0xf5}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xac,0x69,0xe9,0x11}, 8333}, @@ -111,16 +107,19 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xad,0xe0,0xf0,0x2d}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xad,0xf9,0x3a,0x24}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb0,0x09,0x7a,0x03}, 8333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb0,0xdf,0x89,0x25}, 8335}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb0,0xc6,0x78,0xc5}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb2,0x15,0x76,0x21}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb3,0xda,0x50,0xf2}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb7,0x6f,0xea,0xdd}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x19,0x3c,0xc7}, 8331}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x51,0xa4,0x26}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x58,0x1d,0xd0}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x8a,0x08,0x2e}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x9a,0x9c,0x3a}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x9a,0x9f,0xa4}, 9991}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0x9d,0xa0,0xdb}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0xdb,0xdf,0x6c}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb9,0xf7,0x75,0xe6}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xbc,0x86,0x5a,0xe0}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xbc,0xa6,0x0c,0x0c}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xbe,0x02,0x82,0x1b}, 8333}, @@ -129,9 +128,11 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc1,0x8a,0xda,0x43}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc1,0xa9,0xf4,0xbd}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x0e,0xf6,0xcd}, 8444}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x0e,0xf7,0x74}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x0e,0xf7,0x7b}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x43,0xde,0x06}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x87,0x51,0x1c}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc3,0x7a,0x96,0xad}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc3,0x9a,0xa8,0x81}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc6,0xcc,0xe5,0x22}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc7,0xc9,0x6e,0x38}, 8334}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xcb,0x84,0x5f,0x0a}, 8334}, @@ -141,7 +142,6 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd1,0xa0,0x21,0xe9}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd1,0xbc,0x12,0xcc}, 8334}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd3,0x2b,0x08,0xa8}, 8335}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd4,0x20,0xe6,0xdb}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd4,0x6b,0x2c,0xab}, 10333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd5,0xa5,0x44,0xda}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xd5,0xe3,0x8c,0xc2}, 8333}, @@ -155,23 +155,25 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x23,0xd0,0x21,0xc8}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x23,0xf0,0xce,0x49}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2f,0x5a,0x57,0x5f}, 18333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x33,0x0f,0x2f,0x3a}, 18333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2f,0x70,0x6b,0x8a}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x33,0xfe,0xb0,0xd9}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x34,0x32,0xa9,0x61}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x34,0xd3,0xd3,0x0b}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x36,0xa4,0xf1,0x81}, 8333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x3f,0xe0,0x38,0xf9}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x46,0x24,0x7d,0x4b}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x4a,0xd0,0x67,0xdf}, 18533}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x51,0xae,0x85,0x44}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5e,0xed,0x49,0x12}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x5e,0xed,0x49,0x6f}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x67,0x4c,0x24,0x71}, 18331}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6a,0x0a,0x22,0x4a}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6b,0xbf,0x75,0xaf}, 18333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x6d,0x46,0x90,0xa5}, 19333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0x7d,0x78,0x62}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x74,0xcb,0x6a,0x62}, 18333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x76,0x1f,0x2a,0x47}, 18337}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x78,0x4d,0x52,0xbe}, 18443}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9f,0xcb,0x0a,0xd8}, 18333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x9d,0xe6,0xf0,0x3a}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa3,0xac,0x83,0x1a}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa7,0x56,0x4d,0x17}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xab,0x19,0xde,0x38}, 28333}, @@ -179,10 +181,11 @@ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xac,0x69,0xe9,0x11}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xb2,0xc3,0x24,0x44}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xbc,0xa5,0xda,0x49}, 18333}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xbc,0xa6,0x51,0x67}, 11333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc1,0x23,0x6c,0x6b}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc1,0x87,0x0a,0xdb}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x0e,0xf7,0x82}, 18333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc2,0x0e,0xf7,0x83}, 18333}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xce,0xbd,0xbc,0xc0}, 18333} + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xc3,0x9a,0xb1,0x31}, 18333} }; #endif // BITCOIN_CHAINPARAMSSEEDS_H diff -Nru bitcoinabc-0.19.11-uahf/src/CMakeLists.txt bitcoinabc-0.19.12-uahf/src/CMakeLists.txt --- bitcoinabc-0.19.11-uahf/src/CMakeLists.txt 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/CMakeLists.txt 2019-08-16 12:22:07.000000000 +0000 @@ -61,13 +61,16 @@ # type is selected. string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DDEBUG -DDEBUG_LOCKORDER") +# Add -ftrapv when building in Debug +add_compiler_flags_to_var(CMAKE_CXX_FLAGS_DEBUG CXX -ftrapv) + # Ensure that WINDRES_PREPROC is enabled when using windres. if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") # Ensure that WINDRES_PREPROC is enabled when using windres. list(APPEND CMAKE_RC_FLAGS "-DWINDRES_PREPROC") # Build all static so there is no dll file to distribute. - add_compiler_flag(-static) + add_compiler_flags(-static) endif() if(ENABLE_REDUCE_EXPORTS) @@ -81,31 +84,31 @@ endif() # Also hide symbols from static libraries - add_linker_flag(-Wl,--exclude-libs,ALL) + add_linker_flags(-Wl,--exclude-libs,ALL) endif() # Enable statically linking libstdc++ if(ENABLE_STATIC_LIBSTDCXX) - add_linker_flag(-static-libstdc++) + add_linker_flags(-static-libstdc++) endif() # All windows code is PIC, forcing it on just adds useless compile warnings if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - add_compiler_flag(-fPIC) + add_compiler_flags(-fPIC) endif() if(ENABLE_HARDENING) # Enable stack protection - add_cxx_compiler_flag(-fstack-protector-all -Wstack-protector) + add_cxx_compiler_flags(-fstack-protector-all -Wstack-protector) # Enable some buffer overflow checking - add_compiler_flag(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) + add_compiler_flags(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) # Enable ASLR (these flags are primarily targeting MinGw) - add_linker_flag(-Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va) + add_linker_flags(-Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va) # Make the relocated sections read-only - add_linker_flag(-Wl,-z,relro -Wl,-z,now) + add_linker_flags(-Wl,-z,relro -Wl,-z,now) # CMake provides the POSITION_INDEPENDENT_CODE property to set PIC/PIE. # Unfortunately setting the -pie linker flag this way require CMake >= 3.14, @@ -121,8 +124,8 @@ endif() # Enable warning -add_c_compiler_flag(-Wnested-externs -Wstrict-prototypes) -add_compiler_flag( +add_c_compiler_flags(-Wnested-externs -Wstrict-prototypes) +add_compiler_flags( -Wall -Wextra -Wformat @@ -131,17 +134,18 @@ -Wcast-align -Wunused-parameter -Wmissing-braces - # FIXME: Activating this flag cause cmake to fail on leveldb. - # -Wthread-safety-analysis + -Wthread-safety-analysis -Wshadow + -Wrange-loop-analysis + -Wredundant-decls ) option(EXTRA_WARNINGS "Enable extra warnings" OFF) if(EXTRA_WARNINGS) - add_cxx_compiler_flag(-Wsuggest-override) + add_cxx_compiler_flags(-Wsuggest-override) else() - add_compiler_flag(-Wno-unused-parameter) - add_compiler_flag(-Wno-implicit-fallthrough) + add_compiler_flags(-Wno-unused-parameter) + add_compiler_flags(-Wno-implicit-fallthrough) endif() # Create a target for OpenSSL @@ -229,8 +233,8 @@ target_compile_definitions(util PRIVATE "-DFDELT_TYPE=${FDELT_TYPE}") # Wrap some glibc functions with ours - add_linker_flag(-Wl,--wrap=__divmoddi4) - add_linker_flag(-Wl,--wrap=log2f) + add_linker_flags(-Wl,--wrap=__divmoddi4) + add_linker_flags(-Wl,--wrap=log2f) target_sources(util PRIVATE compat/glibc_compat.cpp) endif() diff -Nru bitcoinabc-0.19.11-uahf/src/config/bitcoin-config.h.cmake.in bitcoinabc-0.19.12-uahf/src/config/bitcoin-config.h.cmake.in --- bitcoinabc-0.19.11-uahf/src/config/bitcoin-config.h.cmake.in 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/config/bitcoin-config.h.cmake.in 2019-08-16 12:22:07.000000000 +0000 @@ -45,11 +45,15 @@ #cmakedefine HAVE_DECL_STRNLEN 1 #cmakedefine HAVE_DECL_DAEMON 1 +#cmakedefine HAVE_DECL_GETIFADDRS 1 +#cmakedefine HAVE_DECL_FREEIFADDRS 1 #cmakedefine HAVE_GETENTROPY 1 #cmakedefine HAVE_GETENTROPY_RAND 1 #cmakedefine HAVE_SYS_GETRANDOM 1 #cmakedefine HAVE_SYSCTL_ARND 1 +#cmakedefine CHAR_EQUALS_INT8 0 + #cmakedefine HAVE_DECL_EVP_MD_CTX_NEW 1 #cmakedefine ENABLE_WALLET 1 diff -Nru bitcoinabc-0.19.11-uahf/src/config/CMakeLists.txt bitcoinabc-0.19.12-uahf/src/config/CMakeLists.txt --- bitcoinabc-0.19.11-uahf/src/config/CMakeLists.txt 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/config/CMakeLists.txt 2019-08-16 12:22:07.000000000 +0000 @@ -13,7 +13,7 @@ # Version set(CLIENT_VERSION_MAJOR 0 CACHE STRING "Major version number") set(CLIENT_VERSION_MINOR 19 CACHE STRING "Minor version number") -set(CLIENT_VERSION_REVISION 11 CACHE STRING "Revision version number") +set(CLIENT_VERSION_REVISION 12 CACHE STRING "Revision version number") set(CLIENT_VERSION_BUILD 0 CACHE STRING "Build version number") option(CLIENT_VERSION_IS_RELEASE "Build a release version" OFF) @@ -127,6 +127,10 @@ check_symbol_exists(getentropy "unistd.h" HAVE_GETENTROPY) check_symbol_exists(getentropy "sys/random.h" HAVE_GETENTROPY_RAND) +# getifaddrs and freeifaddrs may be unavailable with some Android versions +check_symbol_exists(getifaddrs "sys/types.h;ifaddrs.h" HAVE_DECL_GETIFADDRS) +check_symbol_exists(freeifaddrs "sys/types.h;ifaddrs.h" HAVE_DECL_FREEIFADDRS) + check_cxx_source_compiles(" #include /* for syscall */ #include /* for SYS_getrandom */ @@ -146,6 +150,15 @@ } " HAVE_SYSCTL_ARND) +check_cxx_source_compiles(" + #include + #include + int main() { + static_assert(std::is_same::value, \"\"); + return 0; + } +" CHAR_EQUALS_INT8) + # OpenSSL functionality set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_CRYPTO_INCLUDES}) set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) diff -Nru bitcoinabc-0.19.11-uahf/src/init.cpp bitcoinabc-0.19.12-uahf/src/init.cpp --- bitcoinabc-0.19.11-uahf/src/init.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/init.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -698,7 +698,7 @@ "-checkblockindex", strprintf("Do a full consistency check for mapBlockIndex, " "setBlockIndexCandidates, chainActive and mapBlocksUnlinked " - "occasionally. Also sets -checkmempool (default: %u)", + "occasionally. (default: %u)", defaultChainParams->DefaultConsistencyChecks()), true, OptionsCategory::DEBUG_TEST); gArgs.AddArg("-checkmempool=", @@ -1105,7 +1105,7 @@ // a separate counter. Once we hit a gap (or if 0 doesn't exist) start // removing block files. int nContigCounter = 0; - for (const std::pair &item : mapBlockFiles) { + for (const std::pair &item : mapBlockFiles) { if (atoi(item.first) == nContigCounter) { nContigCounter++; continue; diff -Nru bitcoinabc-0.19.11-uahf/src/key.cpp bitcoinabc-0.19.12-uahf/src/key.cpp --- bitcoinabc-0.19.11-uahf/src/key.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/key.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -1,4 +1,5 @@ // Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2017 The Zcash developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -20,47 +21,68 @@ * These functions are taken from the libsecp256k1 distribution and are very * ugly. */ + +/** + * This parses a format loosely based on a DER encoding of the ECPrivateKey type + * from section C.4 of SEC 1 , with the + * following caveats: + * + * * The octet-length of the SEQUENCE must be encoded as 1 or 2 octets. It is + * not required to be encoded as one octet if it is less than 256, as DER would + * require. + * * The octet-length of the SEQUENCE must not be greater than the remaining + * length of the key encoding, but need not match it (i.e. the encoding may + * contain junk after the encoded SEQUENCE). + * * The privateKey OCTET STRING is zero-filled on the left to 32 octets. + * * Anything after the encoding of the privateKey OCTET STRING is ignored, + * whether or not it is validly encoded DER. + * + * out32 must point to an output buffer of length at least 32 bytes. + */ static int ec_privkey_import_der(const secp256k1_context *ctx, uint8_t *out32, const uint8_t *privkey, size_t privkeylen) { const uint8_t *end = privkey + privkeylen; - int lenb = 0; - int len = 0; memset(out32, 0, 32); /* sequence header */ - if (end < privkey + 1 || *privkey != 0x30) { + if (end - privkey < 1 || *privkey != 0x30u) { return 0; } privkey++; /* sequence length constructor */ - if (end < privkey + 1 || !(*privkey & 0x80)) { + if (end - privkey < 1 || !(*privkey & 0x80u)) { return 0; } - lenb = *privkey & ~0x80; + ptrdiff_t lenb = *privkey & ~0x80u; privkey++; if (lenb < 1 || lenb > 2) { return 0; } - if (end < privkey + lenb) { + if (end - privkey < lenb) { return 0; } /* sequence length */ - len = privkey[lenb - 1] | (lenb > 1 ? privkey[lenb - 2] << 8 : 0); + ptrdiff_t len = + privkey[lenb - 1] | (lenb > 1 ? privkey[lenb - 2] << 8 : 0u); privkey += lenb; - if (end < privkey + len) { + if (end - privkey < len) { return 0; } /* sequence element 0: version number (=1) */ - if (end < privkey + 3 || privkey[0] != 0x02 || privkey[1] != 0x01 || - privkey[2] != 0x01) { + if (end - privkey < 3 || privkey[0] != 0x02u || privkey[1] != 0x01u || + privkey[2] != 0x01u) { return 0; } privkey += 3; /* sequence element 1: octet string, up to 32 bytes */ - if (end < privkey + 2 || privkey[0] != 0x04 || privkey[1] > 0x20 || - end < privkey + 2 + privkey[1]) { + if (end - privkey < 2 || privkey[0] != 0x04u) { return 0; } - memcpy(out32 + 32 - privkey[1], privkey + 2, privkey[1]); + ptrdiff_t oslen = privkey[1]; + privkey += 2; + if (oslen > 32 || end - privkey < oslen) { + return 0; + } + memcpy(out32 + (32 - oslen), privkey, oslen); if (!secp256k1_ec_seckey_verify(ctx, out32)) { memset(out32, 0, 32); return 0; @@ -68,9 +90,20 @@ return 1; } +/** + * This serializes to a DER encoding of the ECPrivateKey type from section C.4 + * of SEC 1 . The optional parameters and + * publicKey fields are included. + * + * privkey must point to an output buffer of length at least + * CKey::PRIVATE_KEY_SIZE bytes. privkeylen must initially be set to the size of + * the privkey buffer. Upon return it will be set to the number of bytes used in + * the buffer. key32 must point to a 32-byte raw private key. + */ static int ec_privkey_export_der(const secp256k1_context *ctx, uint8_t *privkey, size_t *privkeylen, const uint8_t *key32, int compressed) { + assert(*privkeylen >= CKey::PRIVATE_KEY_SIZE); secp256k1_pubkey pubkey; size_t pubkeylen = 0; if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) { @@ -102,11 +135,12 @@ ptr += 32; memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle); - pubkeylen = 33; + pubkeylen = CPubKey::COMPRESSED_PUBLIC_KEY_SIZE; secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED); ptr += pubkeylen; *privkeylen = ptr - privkey; + assert(*privkeylen == CKey::COMPRESSED_PRIVATE_KEY_SIZE); } else { static const uint8_t begin[] = {0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20}; @@ -134,11 +168,12 @@ ptr += 32; memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle); - pubkeylen = 65; + pubkeylen = CPubKey::PUBLIC_KEY_SIZE; secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED); ptr += pubkeylen; *privkeylen = ptr - privkey; + assert(*privkeylen == CKey::PRIVATE_KEY_SIZE); } return 1; } @@ -160,8 +195,8 @@ CPrivKey privkey; int ret; size_t privkeylen; - privkey.resize(279); - privkeylen = 279; + privkey.resize(PRIVATE_KEY_SIZE); + privkeylen = PRIVATE_KEY_SIZE; ret = ec_privkey_export_der( secp256k1_context_sign, (uint8_t *)privkey.data(), &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED); @@ -173,7 +208,7 @@ CPubKey CKey::GetPubKey() const { assert(fValid); secp256k1_pubkey pubkey; - size_t clen = 65; + size_t clen = CPubKey::PUBLIC_KEY_SIZE; CPubKey result; int ret = secp256k1_ec_pubkey_create(secp256k1_context_sign, &pubkey, begin()); @@ -191,8 +226,8 @@ if (!fValid) { return false; } - vchSig.resize(72); - size_t nSigLen = 72; + vchSig.resize(CPubKey::SIGNATURE_SIZE); + size_t nSigLen = CPubKey::SIGNATURE_SIZE; uint8_t extra_entropy[32] = {0}; WriteLE32(extra_entropy, test_case); secp256k1_ecdsa_signature sig; @@ -244,7 +279,7 @@ if (!fValid) { return false; } - vchSig.resize(65); + vchSig.resize(CPubKey::COMPACT_SIGNATURE_SIZE); int rec = -1; secp256k1_ecdsa_recoverable_signature sig; int ret = secp256k1_ecdsa_sign_recoverable( @@ -281,10 +316,10 @@ std::vector> vout(64); if ((nChild >> 31) == 0) { CPubKey pubkey = GetPubKey(); - assert(pubkey.begin() + 33 == pubkey.end()); + assert(pubkey.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE); BIP32Hash(cc, nChild, *pubkey.begin(), pubkey.begin() + 1, vout.data()); } else { - assert(begin() + 32 == end()); + assert(size() == 32); BIP32Hash(cc, nChild, 0, begin(), vout.data()); } memcpy(ccChild.begin(), vout.data() + 32, 32); diff -Nru bitcoinabc-0.19.11-uahf/src/key.h bitcoinabc-0.19.12-uahf/src/key.h --- bitcoinabc-0.19.11-uahf/src/key.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/key.h 2019-08-16 12:22:07.000000000 +0000 @@ -1,5 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2017 The Zcash developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -15,24 +16,28 @@ #include /** - * secp256k1: - * const unsigned int PRIVATE_KEY_SIZE = 279; - * const unsigned int PUBLIC_KEY_SIZE = 65; - * const unsigned int SIGNATURE_SIZE = 72; - * - * see www.keylength.com - * script supports up to 75 for single byte push - */ - -/** * secure_allocator is defined in allocators.h - * CPrivKey is a serialized private key, with all parameters included (279 - * bytes) + * CPrivKey is a serialized private key, with all parameters included + * (PRIVATE_KEY_SIZE bytes) */ typedef std::vector> CPrivKey; /** An encapsulated secp256k1 private key. */ class CKey { +public: + /** + * secp256k1: + */ + static const unsigned int PRIVATE_KEY_SIZE = 279; + static const unsigned int COMPRESSED_PRIVATE_KEY_SIZE = 214; + /** + * see www.keylength.com + * script supports up to 75 for single byte push + */ + static_assert( + PRIVATE_KEY_SIZE >= COMPRESSED_PRIVATE_KEY_SIZE, + "COMPRESSED_PRIVATE_KEY_SIZE is larger than PRIVATE_KEY_SIZE"); + private: //! Whether this private key is valid. We check for correctness when //! modifying the key data, so fValid should always correspond to the actual diff -Nru bitcoinabc-0.19.11-uahf/src/keystore.cpp bitcoinabc-0.19.12-uahf/src/keystore.cpp --- bitcoinabc-0.19.11-uahf/src/keystore.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/keystore.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -118,7 +118,7 @@ CScript::const_iterator pc = dest.begin(); opcodetype opcode; std::vector vch; - if (!dest.GetOp(pc, opcode, vch) || vch.size() < 33 || vch.size() > 65) { + if (!dest.GetOp(pc, opcode, vch) || !CPubKey::ValidSize(vch)) { return false; } pubKeyOut = CPubKey(vch); diff -Nru bitcoinabc-0.19.11-uahf/src/leveldb/CMakeLists.txt bitcoinabc-0.19.12-uahf/src/leveldb/CMakeLists.txt --- bitcoinabc-0.19.11-uahf/src/leveldb/CMakeLists.txt 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/leveldb/CMakeLists.txt 2019-08-16 12:22:07.000000000 +0000 @@ -9,8 +9,8 @@ set(CMAKE_CXX_STANDARD 11) # Remove some warnings for leveldb as they can get noisy. -add_compiler_flag(-Wno-sign-compare -Wno-implicit-fallthrough) -add_c_compiler_flag(-Wno-strict-prototypes) +add_compiler_flags(-Wno-sign-compare -Wno-implicit-fallthrough) +add_c_compiler_flags(-Wno-strict-prototypes) remove_compiler_flags(-Wstrict-prototypes) include(CheckIncludeFileCXX) @@ -101,6 +101,8 @@ set(LEVELDB_OS SOLARIS) elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") set(LEVELDB_OS FREEBSD) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "KFreeBSD") + set(LEVELDB_OS KFREEBSD) elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") set(LEVELDB_OS NETBSD) elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") @@ -116,8 +118,7 @@ # No idea what's the proper system name is here. set(LEVELDB_OS IOS) else() - # Unknown plateform, assume linux. - set(LEVELDB_OS LINUX) + message(FATAL_ERROR "Cannot build leveldb for ${CMAKE_SYSTEM_NAME}. Please file a bug report.") endif() endif() diff -Nru bitcoinabc-0.19.11-uahf/src/Makefile.am bitcoinabc-0.19.12-uahf/src/Makefile.am --- bitcoinabc-0.19.11-uahf/src/Makefile.am 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/Makefile.am 2019-08-16 12:22:07.000000000 +0000 @@ -5,7 +5,7 @@ DIST_SUBDIRS = secp256k1 univalue AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(SANITIZER_LDFLAGS) -AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS) $(SANITIZER_CXXFLAGS) +AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(SANITIZER_CXXFLAGS) AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS) AM_LIBTOOLFLAGS = --preserve-dup-deps EXTRA_LIBRARIES = diff -Nru bitcoinabc-0.19.11-uahf/src/Makefile.test.include bitcoinabc-0.19.12-uahf/src/Makefile.test.include --- bitcoinabc-0.19.11-uahf/src/Makefile.test.include 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/Makefile.test.include 2019-08-16 12:22:07.000000000 +0000 @@ -201,6 +201,8 @@ check-local: $(BITCOIN_TESTS:.cpp=.cpp.test) @echo "Running test/util/bitcoin-util-test.py..." $(top_builddir)/test/util/bitcoin-util-test.py + @echo "Running test/util/rpcauth-test.py..." + $(top_builddir)/test/util/rpcauth-test.py $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check if EMBEDDED_UNIVALUE $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check diff -Nru bitcoinabc-0.19.11-uahf/src/miner.cpp bitcoinabc-0.19.12-uahf/src/miner.cpp --- bitcoinabc-0.19.11-uahf/src/miner.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/miner.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -289,7 +289,7 @@ bool BlockAssembler::TestPackageTransactions( const CTxMemPool::setEntries &package) { uint64_t nPotentialBlockSize = nBlockSize; - for (const CTxMemPool::txiter it : package) { + for (CTxMemPool::txiter it : package) { CValidationState state; if (!ContextualCheckTransaction(*config, it->GetTx(), state, nHeight, nLockTimeCutoff, nMedianTimePast)) { @@ -378,7 +378,7 @@ const CTxMemPool::setEntries &alreadyAdded, indexed_modified_transaction_set &mapModifiedTx) { int nDescendantsUpdated = 0; - for (const CTxMemPool::txiter it : alreadyAdded) { + for (CTxMemPool::txiter it : alreadyAdded) { CTxMemPool::setEntries descendants; mempool->CalculateDescendants(it, descendants); // Insert all descendants (not yet in block) into the modified set. @@ -420,7 +420,7 @@ } void BlockAssembler::SortForBlock( - const CTxMemPool::setEntries &package, CTxMemPool::txiter entry, + const CTxMemPool::setEntries &package, std::vector &sortedEntries) { // Sort package by ancestor count. If a transaction A depends on transaction // B, then A's ancestor count must be greater than B's. So this is @@ -495,7 +495,8 @@ // Try to compare the mapTx entry to the mapModifiedTx entry. iter = mempool->mapTx.project<0>(mi); if (modit != mapModifiedTx.get().end() && - CompareModifiedEntry()(*modit, CTxMemPoolModifiedEntry(iter))) { + CompareTxMemPoolEntryByAncestorFee()( + *modit, CTxMemPoolModifiedEntry(iter))) { // The best entry in mapModifiedTx has higher score than the one // from mapTx. Switch which transaction (package) to consider iter = modit->iter; @@ -569,7 +570,7 @@ // Package can be added. Sort the entries in a valid order. std::vector sortedEntries; - SortForBlock(ancestors, iter, sortedEntries); + SortForBlock(ancestors, sortedEntries); for (auto &entry : sortedEntries) { AddToBlock(entry); diff -Nru bitcoinabc-0.19.11-uahf/src/miner.h bitcoinabc-0.19.12-uahf/src/miner.h --- bitcoinabc-0.19.11-uahf/src/miner.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/miner.h 2019-08-16 12:22:07.000000000 +0000 @@ -53,6 +53,12 @@ nSigOpCountWithAncestors = entry->GetSigOpCountWithAncestors(); } + Amount GetModifiedFee() const { return iter->GetModifiedFee(); } + uint64_t GetSizeWithAncestors() const { return nSizeWithAncestors; } + Amount GetModFeesWithAncestors() const { return nModFeesWithAncestors; } + size_t GetTxSize() const { return iter->GetTxSize(); } + const CTransaction &GetTx() const { return iter->GetTx(); } + CTxMemPool::txiter iter; uint64_t nSizeWithAncestors; Amount nModFeesWithAncestors; @@ -79,21 +85,6 @@ } }; -// This matches the calculation in CompareTxMemPoolEntryByAncestorFee, -// except operating on CTxMemPoolModifiedEntry. -// TODO: refactor to avoid duplication of this logic. -struct CompareModifiedEntry { - bool operator()(const CTxMemPoolModifiedEntry &a, - const CTxMemPoolModifiedEntry &b) const { - double f1 = b.nSizeWithAncestors * (a.nModFeesWithAncestors / SATOSHI); - double f2 = a.nSizeWithAncestors * (b.nModFeesWithAncestors / SATOSHI); - if (f1 == f2) { - return CTxMemPool::CompareIteratorByHash()(a.iter, b.iter); - } - return f1 > f2; - } -}; - // A comparator that sorts transactions based on number of ancestors. // This is sufficient to sort an ancestor package in an order that is valid // to appear in a block. @@ -117,7 +108,7 @@ // Reuse same tag from CTxMemPool's similar index boost::multi_index::tag, boost::multi_index::identity, - CompareModifiedEntry>>> + CompareTxMemPoolEntryByAncestorFee>>> indexed_modified_transaction_set; typedef indexed_modified_transaction_set::nth_index<0>::type::iterator @@ -184,7 +175,7 @@ // Methods for how to add transactions to a block. /** Add transactions based on tx "priority" */ - void addPriorityTxs(); + void addPriorityTxs() EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); /** * Add transactions based on feerate including unconfirmed ancestors. * Increments nPackagesSelected / nDescendantsUpdated with corresponding @@ -204,7 +195,8 @@ /** Test if tx will still "fit" in the block */ TestForBlockResult TestForBlock(CTxMemPool::txiter iter); /** Test if tx still has unconfirmed parents not yet in block */ - bool isStillDependent(CTxMemPool::txiter iter); + bool isStillDependent(CTxMemPool::txiter iter) + EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); // helper functions for addPackageTxs() /** Remove confirmed (inBlock) entries from given set */ @@ -228,7 +220,6 @@ EXCLUSIVE_LOCKS_REQUIRED(mempool->cs); /** Sort the package in an order that is valid to appear in a block */ void SortForBlock(const CTxMemPool::setEntries &package, - CTxMemPool::txiter entry, std::vector &sortedEntries); /** * Add descendants of given transactions to mapModifiedTx with ancestor diff -Nru bitcoinabc-0.19.11-uahf/src/netbase.cpp bitcoinabc-0.19.12-uahf/src/netbase.cpp --- bitcoinabc-0.19.11-uahf/src/netbase.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/netbase.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -12,6 +12,8 @@ #include #include +#include + #include #ifndef WIN32 @@ -522,8 +524,19 @@ return hSocket; } +template +static void LogConnectFailure(bool manual_connection, const char *fmt, + const Args &... args) { + std::string error_message = tfm::format(fmt, args...); + if (manual_connection) { + LogPrintf("%s\n", error_message); + } else { + LogPrint(BCLog::NET, "%s\n", error_message); + } +} + bool ConnectSocketDirectly(const CService &addrConnect, const SOCKET &hSocket, - int nTimeout) { + int nTimeout, bool manual_connection) { struct sockaddr_storage sockaddr; socklen_t len = sizeof(sockaddr); if (hSocket == INVALID_SOCKET) { @@ -567,8 +580,10 @@ return false; } if (nRet != 0) { - LogPrintf("connect() to %s failed after select(): %s\n", - addrConnect.ToString(), NetworkErrorString(nRet)); + LogConnectFailure(manual_connection, + "connect() to %s failed after select(): %s", + addrConnect.ToString(), + NetworkErrorString(nRet)); return false; } } @@ -578,8 +593,9 @@ else #endif { - LogPrintf("connect() to %s failed: %s\n", addrConnect.ToString(), - NetworkErrorString(WSAGetLastError())); + LogConnectFailure(manual_connection, "connect() to %s failed: %s", + addrConnect.ToString(), + NetworkErrorString(WSAGetLastError())); return false; } } @@ -643,7 +659,7 @@ int port, const SOCKET &hSocket, int nTimeout, bool *outProxyConnectionFailed) { // first connect to proxy server - if (!ConnectSocketDirectly(proxy.proxy, hSocket, nTimeout)) { + if (!ConnectSocketDirectly(proxy.proxy, hSocket, nTimeout, true)) { if (outProxyConnectionFailed) { *outProxyConnectionFailed = true; } @@ -663,6 +679,7 @@ } return true; } + bool LookupSubNet(const char *pszName, CSubNet &ret) { std::string strSubnet(pszName); size_t slash = strSubnet.find_last_of('/'); diff -Nru bitcoinabc-0.19.11-uahf/src/netbase.h bitcoinabc-0.19.12-uahf/src/netbase.h --- bitcoinabc-0.19.11-uahf/src/netbase.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/netbase.h 2019-08-16 12:22:07.000000000 +0000 @@ -57,7 +57,8 @@ bool LookupSubNet(const char *pszName, CSubNet &subnet); SOCKET CreateSocket(const CService &addrConnect); bool ConnectSocketDirectly(const CService &addrConnect, - const SOCKET &hSocketRet, int nTimeout); + const SOCKET &hSocketRet, int nTimeout, + bool manual_connection); bool ConnectThroughProxy(const proxyType &proxy, const std::string &strDest, int port, const SOCKET &hSocketRet, int nTimeout, bool *outProxyConnectionFailed); diff -Nru bitcoinabc-0.19.11-uahf/src/net.cpp bitcoinabc-0.19.12-uahf/src/net.cpp --- bitcoinabc-0.19.11-uahf/src/net.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/net.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -361,7 +361,7 @@ } CNode *CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, - bool fCountFailure) { + bool fCountFailure, bool manual_connection) { if (pszDest == nullptr) { if (IsLocal(addrConnect)) { return nullptr; @@ -433,8 +433,8 @@ if (hSocket == INVALID_SOCKET) { return nullptr; } - connected = - ConnectSocketDirectly(addrConnect, hSocket, nConnectTimeout); + connected = ConnectSocketDirectly( + addrConnect, hSocket, nConnectTimeout, manual_connection); } if (!proxyConnectionFailed) { // If a connection to the node was attempted, and failure (if any) @@ -2120,7 +2120,8 @@ return; } - CNode *pnode = ConnectNode(addrConnect, pszDest, fCountFailure); + CNode *pnode = + ConnectNode(addrConnect, pszDest, fCountFailure, manual_connection); if (!pnode) { return; @@ -2300,7 +2301,7 @@ } } } -#else +#elif (HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS) // Get local host ip struct ifaddrs *myaddrs; if (getifaddrs(&myaddrs) == 0) { diff -Nru bitcoinabc-0.19.11-uahf/src/net.h bitcoinabc-0.19.12-uahf/src/net.h --- bitcoinabc-0.19.11-uahf/src/net.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/net.h 2019-08-16 12:22:07.000000000 +0000 @@ -353,7 +353,7 @@ bool AttemptToEvictConnection(); CNode *ConnectNode(CAddress addrConnect, const char *pszDest, - bool fCountFailure); + bool fCountFailure, bool manual_connection); bool IsWhitelistedRange(const CNetAddr &addr); void DeleteNode(CNode *pnode); diff -Nru bitcoinabc-0.19.11-uahf/src/net_processing.cpp bitcoinabc-0.19.12-uahf/src/net_processing.cpp --- bitcoinabc-0.19.11-uahf/src/net_processing.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/net_processing.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -1830,6 +1830,7 @@ LogPrint(BCLog::NET, "Unparseable reject message received\n"); } } + return true; } else if (strCommand == NetMsgType::VERSION) { diff -Nru bitcoinabc-0.19.11-uahf/src/policy/policy.cpp bitcoinabc-0.19.12-uahf/src/policy/policy.cpp --- bitcoinabc-0.19.11-uahf/src/policy/policy.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/policy/policy.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -38,20 +38,6 @@ return (txout.nValue < GetDustThreshold(txout, dustRelayFeeIn)); } -/** - * Check transaction inputs to mitigate two potential denial-of-service attacks: - * - * 1. scriptSigs with extra data stuffed into them, not consumed by scriptPubKey - * (or P2SH script) - * 2. P2SH scripts with a crazy number of expensive CHECKSIG/CHECKMULTISIG - * operations - * - * Why bother? To avoid denial-of-service attacks; an attacker can submit a - * standard HASH... OP_EQUAL transaction, which will get accepted into blocks. - * The redemption script can be anything; an attacker could use a very - * expensive-to-check-upon-redemption script like: - * DUP CHECKSIG DROP ... repeated 100 times... OP_1 - */ bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType) { std::vector> vSolutions; if (!Solver(scriptPubKey, whichType, vSolutions)) { @@ -134,6 +120,22 @@ return true; } +/** + * Check transaction inputs to mitigate two + * potential denial-of-service attacks: + * + * 1. scriptSigs with extra data stuffed into them, + * not consumed by scriptPubKey (or P2SH script) + * 2. P2SH scripts with a crazy number of expensive + * CHECKSIG/CHECKMULTISIG operations + * + * Why bother? To avoid denial-of-service attacks; an attacker + * can submit a standard HASH... OP_EQUAL transaction, + * which will get accepted into blocks. The redemption + * script can be anything; an attacker could use a very + * expensive-to-check-upon-redemption script like: + * DUP CHECKSIG DROP ... repeated 100 times... OP_1 + */ bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs) { if (tx.IsCoinBase()) { diff -Nru bitcoinabc-0.19.11-uahf/src/pubkey.cpp bitcoinabc-0.19.12-uahf/src/pubkey.cpp --- bitcoinabc-0.19.11-uahf/src/pubkey.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/pubkey.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -1,4 +1,5 @@ // Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2017 The Zcash developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -50,7 +51,7 @@ lenbyte = input[pos++]; if (lenbyte & 0x80) { lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { + if (lenbyte > inputlen - pos) { return 0; } pos += lenbyte; @@ -69,14 +70,15 @@ lenbyte = input[pos++]; if (lenbyte & 0x80) { lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { + if (lenbyte > inputlen - pos) { return 0; } while (lenbyte > 0 && input[pos] == 0) { pos++; lenbyte--; } - if (lenbyte >= sizeof(size_t)) { + static_assert(sizeof(size_t) >= 4, "size_t too small"); + if (lenbyte >= 4) { return 0; } rlen = 0; @@ -107,14 +109,15 @@ lenbyte = input[pos++]; if (lenbyte & 0x80) { lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { + if (lenbyte > inputlen - pos) { return 0; } while (lenbyte > 0 && input[pos] == 0) { pos++; lenbyte--; } - if (lenbyte >= sizeof(size_t)) { + static_assert(sizeof(size_t) >= 4, "size_t too small"); + if (lenbyte >= 4) { return 0; } slen = 0; @@ -214,7 +217,7 @@ bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector &vchSig) { - if (vchSig.size() != 65) { + if (vchSig.size() != COMPACT_SIGNATURE_SIZE) { return false; } @@ -230,8 +233,8 @@ hash.begin())) { return false; } - uint8_t pub[65]; - size_t publen = 65; + uint8_t pub[PUBLIC_KEY_SIZE]; + size_t publen = PUBLIC_KEY_SIZE; secp256k1_ec_pubkey_serialize( secp256k1_context_verify, pub, &publen, &pubkey, fComp ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED); @@ -257,8 +260,8 @@ &(*this)[0], size())) { return false; } - uint8_t pub[65]; - size_t publen = 65; + uint8_t pub[PUBLIC_KEY_SIZE]; + size_t publen = PUBLIC_KEY_SIZE; secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, &pubkey, SECP256K1_EC_UNCOMPRESSED); Set(pub, pub + publen); @@ -269,7 +272,7 @@ unsigned int nChild, const ChainCode &cc) const { assert(IsValid()); assert((nChild >> 31) == 0); - assert(begin() + 33 == end()); + assert(size() == COMPRESSED_PUBLIC_KEY_SIZE); uint8_t out[64]; BIP32Hash(cc, nChild, *begin(), begin() + 1, out); memcpy(ccChild.begin(), out + 32, 32); @@ -282,8 +285,8 @@ out)) { return false; } - uint8_t pub[33]; - size_t publen = 33; + uint8_t pub[COMPRESSED_PUBLIC_KEY_SIZE]; + size_t publen = COMPRESSED_PUBLIC_KEY_SIZE; secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, &pubkey, SECP256K1_EC_COMPRESSED); pubkeyChild.Set(pub, pub + publen); @@ -298,8 +301,8 @@ code[7] = (nChild >> 8) & 0xFF; code[8] = (nChild >> 0) & 0xFF; memcpy(code + 9, chaincode.begin(), 32); - assert(pubkey.size() == 33); - memcpy(code + 41, pubkey.begin(), 33); + assert(pubkey.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE); + memcpy(code + 41, pubkey.begin(), CPubKey::COMPRESSED_PUBLIC_KEY_SIZE); } void CExtPubKey::Decode(const uint8_t code[BIP32_EXTKEY_SIZE]) { diff -Nru bitcoinabc-0.19.11-uahf/src/pubkey.h bitcoinabc-0.19.12-uahf/src/pubkey.h --- bitcoinabc-0.19.11-uahf/src/pubkey.h 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/pubkey.h 2019-08-16 12:22:07.000000000 +0000 @@ -1,5 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2017 The Zcash developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -15,16 +16,6 @@ #include #include -/** - * secp256k1: - * const unsigned int PRIVATE_KEY_SIZE = 279; - * const unsigned int PUBLIC_KEY_SIZE = 65; - * const unsigned int SIGNATURE_SIZE = 72; - * - * see www.keylength.com - * script supports up to 75 for single byte push - */ - const unsigned int BIP32_EXTKEY_SIZE = 74; /** A reference to a CKey: the Hash160 of its serialized public key */ @@ -36,22 +27,37 @@ typedef uint256 ChainCode; -/** An encapsulated secp256k1 public key. */ +/** An encapsulated public key. */ class CPubKey { +public: + /** + * secp256k1: + */ + static constexpr unsigned int PUBLIC_KEY_SIZE = 65; + static constexpr unsigned int COMPRESSED_PUBLIC_KEY_SIZE = 33; + static constexpr unsigned int SIGNATURE_SIZE = 72; + static constexpr unsigned int COMPACT_SIGNATURE_SIZE = 65; + /** + * see www.keylength.com + * script supports up to 75 for single byte push + */ + static_assert(PUBLIC_KEY_SIZE >= COMPRESSED_PUBLIC_KEY_SIZE, + "COMPRESSED_PUBLIC_KEY_SIZE is larger than PUBLIC_KEY_SIZE"); + private: /** * Just store the serialized data. * Its length can very cheaply be computed from the first byte. */ - uint8_t vch[65]; + uint8_t vch[PUBLIC_KEY_SIZE]; //! Compute the length of a pubkey with a given first byte. static unsigned int GetLen(uint8_t chHeader) { if (chHeader == 2 || chHeader == 3) { - return 33; + return COMPRESSED_PUBLIC_KEY_SIZE; } if (chHeader == 4 || chHeader == 6 || chHeader == 7) { - return 65; + return PUBLIC_KEY_SIZE; } return 0; } @@ -60,6 +66,10 @@ void Invalidate() { vch[0] = 0xFF; } public: + bool static ValidSize(const std::vector &vch) { + return vch.size() > 0 && GetLen(vch[0]) == vch.size(); + } + //! Construct an invalid public key. CPubKey() { Invalidate(); } @@ -109,7 +119,7 @@ } template void Unserialize(Stream &s) { unsigned int len = ::ReadCompactSize(s); - if (len <= 65) { + if (len <= PUBLIC_KEY_SIZE) { s.read((char *)vch, len); } else { // invalid pubkey, skip available data @@ -139,7 +149,7 @@ bool IsFullyValid() const; //! Check whether this is a compressed public key. - bool IsCompressed() const { return size() == 33; } + bool IsCompressed() const { return size() == COMPRESSED_PUBLIC_KEY_SIZE; } /** * Verify a DER-serialized ECDSA signature (~72 bytes). diff -Nru bitcoinabc-0.19.11-uahf/src/qt/CMakeLists.txt bitcoinabc-0.19.12-uahf/src/qt/CMakeLists.txt --- bitcoinabc-0.19.11-uahf/src/qt/CMakeLists.txt 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/qt/CMakeLists.txt 2019-08-16 12:22:07.000000000 +0000 @@ -145,6 +145,12 @@ ) set_property(TARGET bitcoin-qt-base PROPERTY AUTOMOC_MOC_OPTIONS "-DQ_OS_MAC") + + target_link_libraries(bitcoin-qt-base + "-framework Foundation" + "-framework ApplicationServices" + "-framework AppKit" + ) endif() # Find out more about Qt. This is similar to diff -Nru bitcoinabc-0.19.11-uahf/src/qt/coincontroldialog.cpp bitcoinabc-0.19.12-uahf/src/qt/coincontroldialog.cpp --- bitcoinabc-0.19.11-uahf/src/qt/coincontroldialog.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/qt/coincontroldialog.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -458,7 +458,7 @@ Amount nPayAmount = Amount::zero(); bool fDust = false; CMutableTransaction txDummy; - for (const Amount amount : CoinControlDialog::payAmounts) { + for (const Amount &amount : CoinControlDialog::payAmounts) { nPayAmount += amount; if (amount > Amount::zero()) { diff -Nru bitcoinabc-0.19.11-uahf/src/qt/platformstyle.cpp bitcoinabc-0.19.12-uahf/src/qt/platformstyle.cpp --- bitcoinabc-0.19.11-uahf/src/qt/platformstyle.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/qt/platformstyle.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -45,7 +45,7 @@ QIcon ColorizeIcon(const QIcon &ico, const QColor &colorbase) { QIcon new_ico; - for (QSize sz : ico.availableSizes()) { + for (const QSize &sz : ico.availableSizes()) { QImage img(ico.pixmap(sz).toImage()); MakeSingleColorImage(img, colorbase); new_ico.addPixmap(QPixmap::fromImage(img)); diff -Nru bitcoinabc-0.19.11-uahf/src/qt/recentrequeststablemodel.cpp bitcoinabc-0.19.12-uahf/src/qt/recentrequeststablemodel.cpp --- bitcoinabc-0.19.11-uahf/src/qt/recentrequeststablemodel.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/qt/recentrequeststablemodel.cpp 2019-08-16 12:22:07.000000000 +0000 @@ -134,12 +134,12 @@ Q_UNUSED(parent); if (count > 0 && row >= 0 && (row + count) <= list.size()) { - const RecentRequestEntry *rec; for (int i = 0; i < count; ++i) { - rec = &list[row + i]; + const RecentRequestEntry *rec = &list[row + i]; if (!walletModel->saveReceiveRequest( - rec->recipient.address.toStdString(), rec->id, "")) + rec->recipient.address.toStdString(), rec->id, "")) { return false; + } } beginRemoveRows(parent, row, row + count - 1); diff -Nru bitcoinabc-0.19.11-uahf/src/rest.cpp bitcoinabc-0.19.12-uahf/src/rest.cpp --- bitcoinabc-0.19.11-uahf/src/rest.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/rest.cpp 2019-08-16 12:22:08.000000000 +0000 @@ -546,30 +546,35 @@ std::vector hits; bitmap.resize((vOutPoints.size() + 7) / 8); { - LOCK2(cs_main, g_mempool.cs); - - CCoinsView viewDummy; - CCoinsViewCache view(&viewDummy); - - CCoinsViewCache &viewChain = *pcoinsTip; - CCoinsViewMemPool viewMempool(&viewChain, g_mempool); + auto process_utxos = [&vOutPoints, &outs, + &hits](const CCoinsView &view, + const CTxMemPool &mempool) { + for (const COutPoint &vOutPoint : vOutPoints) { + Coin coin; + bool hit = !mempool.isSpent(vOutPoint) && + view.GetCoin(vOutPoint, coin); + hits.push_back(hit); + if (hit) { + outs.emplace_back(std::move(coin)); + } + } + }; if (fCheckMemPool) { - // switch cache backend to db+mempool in case user likes to query - // mempool. - view.SetBackend(viewMempool); + // use db+mempool as cache backend in case user likes to query + // mempool + LOCK2(cs_main, g_mempool.cs); + CCoinsViewCache &viewChain = *pcoinsTip; + CCoinsViewMemPool viewMempool(&viewChain, g_mempool); + process_utxos(viewMempool, g_mempool); + } else { + // no need to lock mempool! + LOCK(cs_main); + process_utxos(*pcoinsTip, CTxMemPool()); } - for (size_t i = 0; i < vOutPoints.size(); i++) { - Coin coin; - bool hit = false; - if (view.GetCoin(vOutPoints[i], coin) && - !g_mempool.isSpent(vOutPoints[i])) { - hit = true; - outs.emplace_back(std::move(coin)); - } - - hits.push_back(hit); + for (size_t i = 0; i < hits.size(); ++i) { + const bool hit = hits[i]; // form a binary string representation (human-readable for json // output) bitmapStringRepresentation.append(hit ? "1" : "0"); diff -Nru bitcoinabc-0.19.11-uahf/src/rpc/blockchain.cpp bitcoinabc-0.19.12-uahf/src/rpc/blockchain.cpp --- bitcoinabc-0.19.11-uahf/src/rpc/blockchain.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/rpc/blockchain.cpp 2019-08-16 12:22:08.000000000 +0000 @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include +#include #include // boost::thread::interrupt #include @@ -816,6 +818,25 @@ return blockheaderToJSON(chainActive.Tip(), pblockindex); } +static CBlock GetBlockChecked(const Config &config, + const CBlockIndex *pblockindex) { + CBlock block; + if (fHavePruned && !pblockindex->nStatus.hasData() && + pblockindex->nTx > 0) { + throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)"); + } + + if (!ReadBlockFromDisk(block, pblockindex, config)) { + // Block not found on disk. This could be because we have the block + // header in our index but don't have the block (for example if a + // non-whitelisted node sends us an unrequested long chain of valid + // blocks, we add the headers to our index, but don't accept the block). + throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); + } + + return block; +} + static UniValue getblock(const Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { @@ -901,19 +922,7 @@ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); } - CBlock block; - if (fHavePruned && !pblockindex->nStatus.hasData() && - pblockindex->nTx > 0) { - throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)"); - } - - if (!ReadBlockFromDisk(block, pblockindex, config)) { - // Block not found on disk. This could be because we have the block - // header in our index but don't have the block (for example if a - // non-whitelisted node sends us an unrequested long chain of valid - // blocks, we add the headers to our index, but don't accept the block). - throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); - } + const CBlock block = GetBlockChecked(config, pblockindex); if (verbosity <= 0) { CDataStream ssBlock(SER_NETWORK, @@ -948,7 +957,7 @@ ss << VARINT(outputs.begin()->second.GetHeight() * 2 + outputs.begin()->second.IsCoinBase()); stats.nTransactions++; - for (const auto output : outputs) { + for (const auto &output : outputs) { ss << VARINT(output.first + 1); ss << output.second.GetTxOut().scriptPubKey; ss << VARINT(output.second.GetTxOut().nValue / SATOSHI); @@ -1892,6 +1901,324 @@ return ret; } +template +static T CalculateTruncatedMedian(std::vector &scores) { + size_t size = scores.size(); + if (size == 0) { + return T(); + } + + std::sort(scores.begin(), scores.end()); + if (size % 2 == 0) { + return (scores[size / 2 - 1] + scores[size / 2]) / 2; + } else { + return scores[size / 2]; + } +} + +template static inline bool SetHasKeys(const std::set &set) { + return false; +} +template +static inline bool SetHasKeys(const std::set &set, const Tk &key, + const Args &... args) { + return (set.count(key) != 0) || SetHasKeys(set, args...); +} + +// outpoint (needed for the utxo index) + nHeight + fCoinBase +static constexpr size_t PER_UTXO_OVERHEAD = + sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool); + +static UniValue getblockstats(const Config &config, + const JSONRPCRequest &request) { + if (request.fHelp || request.params.size() < 1 || + request.params.size() > 4) { + throw std::runtime_error( + "getblockstats hash_or_height ( stats )\n" + "\nCompute per block statistics for a given window. All amounts " + "are in " + + CURRENCY_UNIT + + ".\n" + "It won't work for some heights with pruning.\n" + "It won't work without -txindex for utxo_size_inc, *fee or " + "*feerate stats.\n" + "\nArguments:\n" + "1. \"hash_or_height\" (string or numeric, required) The block " + "hash or height of the target block\n" + "2. \"stats\" (array, optional) Values to plot, by " + "default all values (see result below)\n" + " [\n" + " \"height\", (string, optional) Selected statistic\n" + " \"time\", (string, optional) Selected statistic\n" + " ,...\n" + " ]\n" + "\nResult:\n" + "{ (json object)\n" + " \"avgfee\": x.xxx, (numeric) Average fee in the block\n" + " \"avgfeerate\": x.xxx, (numeric) Average feerate (in " + + CURRENCY_UNIT + + " per byte)\n" + " \"avgtxsize\": xxxxx, (numeric) Average transaction size\n" + " \"blockhash\": xxxxx, (string) The block hash (to check " + "for potential reorgs)\n" + " \"height\": xxxxx, (numeric) The height of the block\n" + " \"ins\": xxxxx, (numeric) The number of inputs " + "(excluding coinbase)\n" + " \"maxfee\": xxxxx, (numeric) Maximum fee in the block\n" + " \"maxfeerate\": xxxxx, (numeric) Maximum feerate (in " + + CURRENCY_UNIT + + " per byte)\n" + " \"maxtxsize\": xxxxx, (numeric) Maximum transaction size\n" + " \"medianfee\": x.xxx, (numeric) Truncated median fee in " + "the block\n" + " \"medianfeerate\": x.xxx, (numeric) Truncated median feerate " + "(in " + + CURRENCY_UNIT + + " per byte)\n" + " \"mediantime\": xxxxx, (numeric) The block median time " + "past\n" + " \"mediantxsize\": xxxxx, (numeric) Truncated median " + "transaction size\n" + " \"minfee\": x.xxx, (numeric) Minimum fee in the block\n" + " \"minfeerate\": xx.xx, (numeric) Minimum feerate (in " + + CURRENCY_UNIT + + " per byte)\n" + " \"mintxsize\": xxxxx, (numeric) Minimum transaction size\n" + " \"outs\": xxxxx, (numeric) The number of outputs\n" + " \"subsidy\": x.xxx, (numeric) The block subsidy\n" + " \"time\": xxxxx, (numeric) The block time\n" + " \"total_out\": x.xxx, (numeric) Total amount in all " + "outputs (excluding coinbase and thus reward [ie subsidy + " + "totalfee])\n" + " \"total_size\": xxxxx, (numeric) Total size of all " + "non-coinbase transactions\n" + " \"totalfee\": x.xxx, (numeric) The fee total\n" + " \"txs\": xxxxx, (numeric) The number of " + "transactions (excluding coinbase)\n" + " \"utxo_increase\": xxxxx, (numeric) The increase/decrease in " + "the number of unspent outputs\n" + " \"utxo_size_inc\": xxxxx, (numeric) The increase/decrease in " + "size for the utxo index (not discounting op_return and similar)\n" + "}\n" + "\nExamples:\n" + + HelpExampleCli("getblockstats", + "1000 '[\"minfeerate\",\"avgfeerate\"]'") + + HelpExampleRpc("getblockstats", + "1000 '[\"minfeerate\",\"avgfeerate\"]'")); + } + + LOCK(cs_main); + + CBlockIndex *pindex; + if (request.params[0].isNum()) { + const int height = request.params[0].get_int(); + const int current_tip = chainActive.Height(); + if (height < 0) { + throw JSONRPCError( + RPC_INVALID_PARAMETER, + strprintf("Target block height %d is negative", height)); + } + if (height > current_tip) { + throw JSONRPCError( + RPC_INVALID_PARAMETER, + strprintf("Target block height %d after current tip %d", height, + current_tip)); + } + + pindex = chainActive[height]; + } else { + const std::string strHash = request.params[0].get_str(); + const uint256 hash(uint256S(strHash)); + pindex = LookupBlockIndex(hash); + if (!pindex) { + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); + } + if (!chainActive.Contains(pindex)) { + throw JSONRPCError(RPC_INVALID_PARAMETER, + strprintf("Block is not in chain %s", + Params().NetworkIDString())); + } + } + + assert(pindex != nullptr); + + std::set stats; + if (!request.params[1].isNull()) { + const UniValue stats_univalue = request.params[1].get_array(); + for (unsigned int i = 0; i < stats_univalue.size(); i++) { + const std::string stat = stats_univalue[i].get_str(); + stats.insert(stat); + } + } + + const CBlock block = GetBlockChecked(config, pindex); + + // Calculate everything if nothing selected (default) + const bool do_all = stats.size() == 0; + const bool do_mediantxsize = do_all || stats.count("mediantxsize") != 0; + const bool do_medianfee = do_all || stats.count("medianfee") != 0; + const bool do_medianfeerate = do_all || stats.count("medianfeerate") != 0; + const bool loop_inputs = + do_all || do_medianfee || do_medianfeerate || + SetHasKeys(stats, "utxo_size_inc", "totalfee", "avgfee", "avgfeerate", + "minfee", "maxfee", "minfeerate", "maxfeerate"); + const bool loop_outputs = do_all || loop_inputs || stats.count("total_out"); + const bool do_calculate_size = + do_mediantxsize || loop_inputs || + SetHasKeys(stats, "total_size", "avgtxsize", "mintxsize", "maxtxsize"); + + const int64_t blockMaxSize = config.GetMaxBlockSize(); + Amount maxfee = Amount::zero(); + Amount maxfeerate = Amount::zero(); + Amount minfee = MAX_MONEY; + Amount minfeerate = MAX_MONEY; + Amount total_out = Amount::zero(); + Amount totalfee = Amount::zero(); + int64_t inputs = 0; + int64_t maxtxsize = 0; + int64_t mintxsize = blockMaxSize; + int64_t outputs = 0; + int64_t total_size = 0; + int64_t utxo_size_inc = 0; + std::vector fee_array; + std::vector feerate_array; + std::vector txsize_array; + + for (const auto &tx : block.vtx) { + outputs += tx->vout.size(); + Amount tx_total_out = Amount::zero(); + if (loop_outputs) { + for (const CTxOut &out : tx->vout) { + tx_total_out += out.nValue; + utxo_size_inc += + GetSerializeSize(out, SER_NETWORK, PROTOCOL_VERSION) + + PER_UTXO_OVERHEAD; + } + } + + if (tx->IsCoinBase()) { + continue; + } + + // Don't count coinbase's fake input + inputs += tx->vin.size(); + // Don't count coinbase reward + total_out += tx_total_out; + + int64_t tx_size = 0; + if (do_calculate_size) { + + tx_size = tx->GetTotalSize(); + if (do_mediantxsize) { + txsize_array.push_back(tx_size); + } + maxtxsize = std::max(maxtxsize, tx_size); + mintxsize = std::min(mintxsize, tx_size); + total_size += tx_size; + } + + if (loop_inputs) { + + if (!g_txindex) { + throw JSONRPCError(RPC_INVALID_PARAMETER, + "One or more of the selected stats requires " + "-txindex enabled"); + } + Amount tx_total_in = Amount::zero(); + for (const CTxIn &in : tx->vin) { + CTransactionRef tx_in; + uint256 hashBlock; + if (!GetTransaction(config, in.prevout.GetTxId(), tx_in, + hashBlock, false)) { + throw JSONRPCError(RPC_INTERNAL_ERROR, + std::string("Unexpected internal error " + "(tx index seems corrupt)")); + } + + CTxOut prevoutput = tx_in->vout[in.prevout.GetN()]; + + tx_total_in += prevoutput.nValue; + utxo_size_inc -= GetSerializeSize(prevoutput, SER_NETWORK, + PROTOCOL_VERSION) + + PER_UTXO_OVERHEAD; + } + + Amount txfee = tx_total_in - tx_total_out; + assert(MoneyRange(txfee)); + if (do_medianfee) { + fee_array.push_back(txfee); + } + maxfee = std::max(maxfee, txfee); + minfee = std::min(minfee, txfee); + totalfee += txfee; + + Amount feerate = txfee / tx_size; + if (do_medianfeerate) { + feerate_array.push_back(feerate); + } + maxfeerate = std::max(maxfeerate, feerate); + minfeerate = std::min(minfeerate, feerate); + } + } + + UniValue ret_all(UniValue::VOBJ); + ret_all.pushKV("avgfee", + ValueFromAmount((block.vtx.size() > 1) + ? totalfee / int((block.vtx.size() - 1)) + : Amount::zero())); + ret_all.pushKV("avgfeerate", + ValueFromAmount((total_size > 0) ? totalfee / total_size + : Amount::zero())); + ret_all.pushKV("avgtxsize", (block.vtx.size() > 1) + ? total_size / (block.vtx.size() - 1) + : 0); + ret_all.pushKV("blockhash", pindex->GetBlockHash().GetHex()); + ret_all.pushKV("height", (int64_t)pindex->nHeight); + ret_all.pushKV("ins", inputs); + ret_all.pushKV("maxfee", ValueFromAmount(maxfee)); + ret_all.pushKV("maxfeerate", ValueFromAmount(maxfeerate)); + ret_all.pushKV("maxtxsize", maxtxsize); + ret_all.pushKV("medianfee", + ValueFromAmount(CalculateTruncatedMedian(fee_array))); + ret_all.pushKV("medianfeerate", + ValueFromAmount(CalculateTruncatedMedian(feerate_array))); + ret_all.pushKV("mediantime", pindex->GetMedianTimePast()); + ret_all.pushKV("mediantxsize", CalculateTruncatedMedian(txsize_array)); + ret_all.pushKV( + "minfee", + ValueFromAmount((minfee == MAX_MONEY) ? Amount::zero() : minfee)); + ret_all.pushKV("minfeerate", + ValueFromAmount((minfeerate == MAX_MONEY) ? Amount::zero() + : minfeerate)); + ret_all.pushKV("mintxsize", mintxsize == blockMaxSize ? 0 : mintxsize); + ret_all.pushKV("outs", outputs); + ret_all.pushKV("subsidy", ValueFromAmount(GetBlockSubsidy( + pindex->nHeight, Params().GetConsensus()))); + ret_all.pushKV("time", pindex->GetBlockTime()); + ret_all.pushKV("total_out", ValueFromAmount(total_out)); + ret_all.pushKV("total_size", total_size); + ret_all.pushKV("totalfee", ValueFromAmount(totalfee)); + ret_all.pushKV("txs", (int64_t)block.vtx.size()); + ret_all.pushKV("utxo_increase", outputs - inputs); + ret_all.pushKV("utxo_size_inc", utxo_size_inc); + + if (do_all) { + return ret_all; + } + + UniValue ret(UniValue::VOBJ); + for (const std::string &stat : stats) { + const UniValue &value = ret_all[stat]; + if (value.isNull()) { + throw JSONRPCError( + RPC_INVALID_PARAMETER, + strprintf("Invalid selected statistic %s", stat)); + } + ret.pushKV(stat, value); + } + return ret; +} + static UniValue savemempool(const Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() != 0) { @@ -1918,14 +2245,15 @@ static const ContextFreeRPCCommand commands[] = { // category name actor (function) argNames // ------------------- ------------------------ ---------------------- ---------- - { "blockchain", "getblockchaininfo", getblockchaininfo, {} }, - { "blockchain", "getchaintxstats", &getchaintxstats, {"nblocks", "blockhash"} }, { "blockchain", "getbestblockhash", getbestblockhash, {} }, - { "blockchain", "getblockcount", getblockcount, {} }, { "blockchain", "getblock", getblock, {"blockhash","verbosity|verbose"} }, + { "blockchain", "getblockchaininfo", getblockchaininfo, {} }, + { "blockchain", "getblockcount", getblockcount, {} }, { "blockchain", "getblockhash", getblockhash, {"height"} }, { "blockchain", "getblockheader", getblockheader, {"blockhash","verbose"} }, + { "blockchain", "getblockstats", getblockstats, {"hash_or_height","stats"} }, { "blockchain", "getchaintips", getchaintips, {} }, + { "blockchain", "getchaintxstats", getchaintxstats, {"nblocks", "blockhash"} }, { "blockchain", "getdifficulty", getdifficulty, {} }, { "blockchain", "getmempoolancestors", getmempoolancestors, {"txid","verbose"} }, { "blockchain", "getmempooldescendants", getmempooldescendants, {"txid","verbose"} }, diff -Nru bitcoinabc-0.19.11-uahf/src/rpc/client.cpp bitcoinabc-0.19.12-uahf/src/rpc/client.cpp --- bitcoinabc-0.19.11-uahf/src/rpc/client.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/rpc/client.cpp 2019-08-16 12:22:08.000000000 +0000 @@ -114,6 +114,8 @@ {"importmulti", 1, "options"}, {"verifychain", 0, "checklevel"}, {"verifychain", 1, "nblocks"}, + {"getblockstats", 0, "hash_or_height"}, + {"getblockstats", 1, "stats"}, {"pruneblockchain", 0, "height"}, {"keypoolrefill", 0, "newsize"}, {"getrawmempool", 0, "verbose"}, diff -Nru bitcoinabc-0.19.11-uahf/src/rpc/net.cpp bitcoinabc-0.19.12-uahf/src/rpc/net.cpp --- bitcoinabc-0.19.11-uahf/src/rpc/net.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/rpc/net.cpp 2019-08-16 12:22:08.000000000 +0000 @@ -110,7 +110,7 @@ " \"pingwait\": n, (numeric) ping wait (if " "non-zero)\n" " \"version\": v, (numeric) The peer version, such " - "as 7001\n" + "as 70001\n" " \"subver\": \"/Satoshi:0.8.5/\", (string) The string " "version\n" " \"inbound\": true|false, (boolean) Inbound (true) or " @@ -596,7 +596,8 @@ UniValue localAddresses(UniValue::VARR); { LOCK(cs_mapLocalHost); - for (const std::pair &item : mapLocalHost) { + for (const std::pair &item : + mapLocalHost) { UniValue rec(UniValue::VOBJ); rec.pushKV("address", item.first.ToString()); rec.pushKV("port", item.second.nPort); diff -Nru bitcoinabc-0.19.11-uahf/src/rpc/rawtransaction.cpp bitcoinabc-0.19.12-uahf/src/rpc/rawtransaction.cpp --- bitcoinabc-0.19.11-uahf/src/rpc/rawtransaction.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/rpc/rawtransaction.cpp 2019-08-16 12:22:08.000000000 +0000 @@ -918,9 +918,6 @@ if (is_temp_keystore && scriptPubKey.IsPayToScriptHash()) { RPCTypeCheckObj( prevOut, { - {"txid", UniValueType(UniValue::VSTR)}, - {"vout", UniValueType(UniValue::VNUM)}, - {"scriptPubKey", UniValueType(UniValue::VSTR)}, {"redeemScript", UniValueType(UniValue::VSTR)}, }); UniValue v = find_value(prevOut, "redeemScript"); diff -Nru bitcoinabc-0.19.11-uahf/src/script/interpreter.cpp bitcoinabc-0.19.12-uahf/src/script/interpreter.cpp --- bitcoinabc-0.19.11-uahf/src/script/interpreter.cpp 2019-08-01 08:42:42.000000000 +0000 +++ bitcoinabc-0.19.12-uahf/src/script/interpreter.cpp 2019-08-16 12:22:08.000000000 +0000 @@ -11,10 +11,12 @@ #include #include #include +#include