diff --git a/.cirrus.yml b/.cirrus.yml index b107d7b94e..acc8ee6178 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -164,7 +164,7 @@ task: task: name: 'macOS 11 native [gui] [no depends]' brew_install_script: - - brew install boost libevent berkeley-db4 qt@5 miniupnpc ccache zeromq qrencode sqlite libtool automake pkg-config gnu-getopt + - brew install boost libevent berkeley-db@4 qt@5 miniupnpc ccache zeromq qrencode sqlite libtool automake pkg-config gnu-getopt << : *GLOBAL_TASK_TEMPLATE macos_instance: # Use latest image, but hardcode version to avoid silent upgrades (and breaks) diff --git a/configure.ac b/configure.ac index ec2b59a234..929d264229 100644 --- a/configure.ac +++ b/configure.ac @@ -746,8 +746,8 @@ case $host in dnl It's safe to add these paths even if the functionality is disabled by dnl the user (--without-wallet or --without-gui for example). - if test "x$use_bdb" != xno && $BREW list --versions berkeley-db4 >/dev/null && test "x$BDB_CFLAGS" = "x" && test "x$BDB_LIBS" = "x"; then - bdb_prefix=$($BREW --prefix berkeley-db4 2>/dev/null) + if test "x$use_bdb" != xno && $BREW list --versions berkeley-db@4 >/dev/null && test "x$BDB_CFLAGS" = "x" && test "x$BDB_LIBS" = "x"; then + bdb_prefix=$($BREW --prefix berkeley-db@4 2>/dev/null) dnl This must precede the call to BITCOIN_FIND_BDB48 below. BDB_CFLAGS="-I$bdb_prefix/include" BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8" @@ -757,8 +757,8 @@ case $host in export PKG_CONFIG_PATH="$($BREW --prefix sqlite3 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH" fi - if $BREW list --versions qt5 >/dev/null; then - export PKG_CONFIG_PATH="$($BREW --prefix qt5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH" + if $BREW list --versions qt@5 >/dev/null; then + export PKG_CONFIG_PATH="$($BREW --prefix qt@5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH" fi gmp_prefix=$($BREW --prefix gmp 2>/dev/null) diff --git a/doc/REST-interface.md b/doc/REST-interface.md index ca88ce0c6d..e5cca2ac85 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -52,6 +52,20 @@ With the /notxdetails/ option JSON response will only contain the transaction ha Given a block hash: returns amount of blockheaders in upward direction. Returns empty if the block doesn't exist or it isn't in the active chain. +#### Blockfilter Headers +`GET /rest/blockfilterheaders///.` + +Given a block hash: returns amount of blockfilter headers in upward +direction for the filter type . +Returns empty if the block doesn't exist or it isn't in the active chain. + +#### Blockfilters +`GET /rest/blockfilter//.` + +Given a block hash: returns the block filter of the given block of type +. +Responds with 404 if the block doesn't exist. + #### Blockhash by height `GET /rest/blockhashbyheight/.` diff --git a/doc/release-notes-6297.md b/doc/release-notes-6297.md new file mode 100644 index 0000000000..970e02ad6a --- /dev/null +++ b/doc/release-notes-6297.md @@ -0,0 +1,5 @@ +RPC changes +----------- + +- `quorum dkgsimerror` will no longer accept a decimal value between 0 and 1 for the `rate` argument, it will now + expect an integer between 0 to 100. diff --git a/src/core_read.cpp b/src/core_read.cpp index 6482860aa7..6a6b75e6f8 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -19,32 +19,43 @@ #include namespace { - -opcodetype ParseOpCode(const std::string& s) +class OpCodeParser { - static std::map mapOpNames; +private: + std::map mapOpNames; - if (mapOpNames.empty()) +public: + OpCodeParser() { - for (unsigned int op = 0; op <= MAX_OPCODE; op++) - { + for (unsigned int op = 0; op <= MAX_OPCODE; ++op) { // Allow OP_RESERVED to get into mapOpNames - if (op < OP_NOP && op != OP_RESERVED) + if (op < OP_NOP && op != OP_RESERVED) { continue; + } std::string strName = GetOpName(static_cast(op)); - if (strName == "OP_UNKNOWN") + if (strName == "OP_UNKNOWN") { continue; + } mapOpNames[strName] = static_cast(op); // Convenience: OP_ADD and just ADD are both recognized: - if (strName.compare(0, 3, "OP_") == 0) { // strName starts with "OP_" + if (strName.compare(0, 3, "OP_") == 0) { // strName starts with "OP_" mapOpNames[strName.substr(3)] = static_cast(op); } } } - auto it = mapOpNames.find(s); - if (it == mapOpNames.end()) throw std::runtime_error("script parse error: unknown opcode"); - return it->second; + opcodetype Parse(const std::string& s) const + { + auto it = mapOpNames.find(s); + if (it == mapOpNames.end()) throw std::runtime_error("script parse error: unknown opcode"); + return it->second; + } +}; + +opcodetype ParseOpCode(const std::string& s) +{ + static const OpCodeParser ocp; + return ocp.Parse(s); } } // namespace @@ -56,44 +67,35 @@ CScript ParseScript(const std::string& s) std::vector words = SplitString(s, " \t\n"); - for (std::vector::const_iterator w = words.begin(); w != words.end(); ++w) - { - if (w->empty()) - { + for (const std::string& w : words) { + if (w.empty()) { // Empty string, ignore. (SplitString doesn't combine multiple separators) - } - else if (std::all_of(w->begin(), w->end(), ::IsDigit) || - (w->front() == '-' && w->size() > 1 && std::all_of(w->begin()+1, w->end(), ::IsDigit))) + } else if (std::all_of(w.begin(), w.end(), ::IsDigit) || + (w.front() == '-' && w.size() > 1 && std::all_of(w.begin() + 1, w.end(), ::IsDigit))) { // Number - int64_t n = LocaleIndependentAtoi(*w); + const auto num{ToIntegral(w)}; - //limit the range of numbers ParseScript accepts in decimal - //since numbers outside -0xFFFFFFFF...0xFFFFFFFF are illegal in scripts - if (n > int64_t{0xffffffff} || n < -1 * int64_t{0xffffffff}) { + // limit the range of numbers ParseScript accepts in decimal + // since numbers outside -0xFFFFFFFF...0xFFFFFFFF are illegal in scripts + if (!num.has_value() || num > int64_t{0xffffffff} || num < -1 * int64_t{0xffffffff}) { throw std::runtime_error("script parse error: decimal numeric value only allowed in the " "range -0xFFFFFFFF...0xFFFFFFFF"); } - result << n; - } - else if (w->substr(0,2) == "0x" && w->size() > 2 && IsHex(std::string(w->begin()+2, w->end()))) - { + result << num.value(); + } else if (w.substr(0, 2) == "0x" && w.size() > 2 && IsHex(std::string(w.begin() + 2, w.end()))) { // Raw hex data, inserted NOT pushed onto stack: - std::vector raw = ParseHex(std::string(w->begin()+2, w->end())); + std::vector raw = ParseHex(std::string(w.begin() + 2, w.end())); result.insert(result.end(), raw.begin(), raw.end()); - } - else if (w->size() >= 2 && w->front() == '\'' && w->back() == '\'') - { + } else if (w.size() >= 2 && w.front() == '\'' && w.back() == '\'') { // Single-quoted string, pushed as data. NOTE: this is poor-man's // parsing, spaces/tabs/newlines in single-quoted strings won't work. - std::vector value(w->begin()+1, w->end()-1); + std::vector value(w.begin() + 1, w.end() - 1); result << value; - } - else - { + } else { // opcode, e.g. OP_ADD or ADD: - result << ParseOpCode(*w); + result << ParseOpCode(w); } } diff --git a/src/flat-database.h b/src/flat-database.h index 31938eee24..e36f9f7585 100644 --- a/src/flat-database.h +++ b/src/flat-database.h @@ -117,9 +117,9 @@ class CFlatDB } - unsigned char pchMsgTmp[4]; - std::string strMagicMessageTmp; try { + unsigned char pchMsgTmp[4]; + std::string strMagicMessageTmp; // de-serialize file header (file specific magic message) and .. ssObj >> strMagicMessageTmp; @@ -178,11 +178,11 @@ class CFlatDB } public: - CFlatDB(std::string strFilenameIn, std::string strMagicMessageIn) + CFlatDB(std::string&& strFilenameIn, std::string&& strMagicMessageIn) : + pathDB{gArgs.GetDataDirNet() / strFilenameIn}, + strFilename{strFilenameIn}, + strMagicMessage{strMagicMessageIn} { - pathDB = gArgs.GetDataDirNet() / strFilenameIn; - strFilename = strFilenameIn; - strMagicMessage = strMagicMessageIn; } bool Load(T& objToLoad) @@ -191,7 +191,7 @@ class CFlatDB return Read(objToLoad); } - bool Store(T& objToSave) + bool Store(const T& objToSave) { LogPrintf("Verifying %s format...\n", strFilename); T tmpObjToLoad; diff --git a/src/governance/classes.cpp b/src/governance/classes.cpp index 43270d509a..e26d412e0d 100644 --- a/src/governance/classes.cpp +++ b/src/governance/classes.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include