Compare commits

...

7 Commits

Author SHA1 Message Date
Kittywhiskers Van Gogh
4770e9c24c
Merge 0577b4d9de into ad7a373529 2024-12-19 22:22:52 +00:00
pasta
ad7a373529
Merge #6498: docs: fixes for Release Notes v22.0.0 and v21.0.0
Some checks failed
Label Merge Conflicts / main (push) Failing after 11s
Guix Build / build-image (push) Failing after 1m30s
Guix Build / build (aarch64-linux-gnu) (push) Has been skipped
Guix Build / build (arm-linux-gnueabihf) (push) Has been skipped
Guix Build / build (arm64-apple-darwin) (push) Has been skipped
Guix Build / build (powerpc64-linux-gnu) (push) Has been skipped
Guix Build / build (riscv64-linux-gnu) (push) Has been skipped
Guix Build / build (x86_64-apple-darwin) (push) Has been skipped
Guix Build / build (x86_64-linux-gnu) (push) Has been skipped
Guix Build / build (x86_64-w64-mingw32) (push) Has been skipped
Check Merge Fast-Forward Only / check_merge (push) Successful in 1m21s
CI / Build Image (push) Failing after 2m3s
CI / Build Dependencies (arm-linux, arm-linux-gnueabihf) (push) Has been skipped
CI / Build Dependencies (linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (arm-linux, arm-linux, arm-linux-gnueabihf) (push) Has been skipped
CI / Build (linux64, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_cxx20, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_fuzz, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_nowallet, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_sqlite, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_tsan, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
CI / Build (linux64_ubsan, linux64, x86_64-pc-linux-gnu) (push) Has been skipped
d75ee3a9e1 docs: fixes for Release Notes v22.0.0 and v21.0.0 (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  I noticed that we announced in current release new RPC `quorum platformsign` which has been actually released with v21.
  Though, in release notes for v21 it has a wrong name.

  ## What was done?
  Removed `quorum platformsign` from v22 release notes; fixed name in v21.
  Also mentioned build for Freebsd and minor typo `s/MN_R/MN_RR/` with name of forks on regtest.

  ## How Has This Been Tested?
  N/A

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    utACK d75ee3a9e1

Tree-SHA512: 2d2309e81607c25a512577c96f15ee36b04b585c5751dc1500f2b432d90fc19e70f1b72cf1f7bf843abf854b7869481765902c7c61e9ea7e21b087a126c49a99
2024-12-19 16:22:31 -06:00
Konstantin Akimov
d75ee3a9e1
docs: fixes for Release Notes v22.0.0 and v21.0.0
platformsign has been released in v21 and name there is wrong: platformsign vs signplatform
2024-12-19 21:22:09 +07:00
Kittywhiskers Van Gogh
0577b4d9de
refactor: make namespace ranges mostly an alias of std::ranges 2024-11-02 21:02:22 +00:00
Kittywhiskers Van Gogh
4717fe8045
refactor: avoid convoluted casting by not using std::time_t
std::clock_cast is a part of C++20, hence the original TODO comment but
it's still not implemented in Clang, as of this writing. We can sidestep
the cast by not using time_t to begin with.
2024-11-01 14:06:59 +00:00
Kittywhiskers Van Gogh
acda80ed4f
refactor: use constexpr std::{copy, fill} in V2ShortIDs 2024-11-01 11:54:19 +00:00
Kittywhiskers Van Gogh
d8e04255e0
refactor: remove rfind workaround with starts_with 2024-11-01 11:42:42 +00:00
7 changed files with 31 additions and 74 deletions

View File

@ -86,10 +86,10 @@ likely require a reindex.
- **glibc Requirement**
- The minimum required glibc to run Dash Core is now **2.31**. This means that **RHEL 8** and **Ubuntu 18.04 (Bionic)** are no longer supported.
## New RPCs
- **FreeBSD Improvements**
- Fixed issues with building Dash Core on FreeBSD.
- **`quorum platformsign`**
- A new subcommand has been introduced, offering a structured way to perform platform-related quorum signing operations.
## New RPCs
- **`coinjoinsalt`**
- Allows manipulation of a CoinJoin salt stored in a wallet.
@ -153,7 +153,7 @@ likely require a reindex.
## Devnet Breaking Changes
- **Hardfork Activation Changes**
- `BRR` (`realloc`), `DIP0020`, `DIP0024`, `V19`, `V20`, and `MN_R` hardforks are now activated at **block 2** instead of block **300** on devnets.
- `BRR` (`realloc`), `DIP0020`, `DIP0024`, `V19`, `V20`, and `MN_RR` hardforks are now activated at **block 2** instead of block **300** on devnets.
- **Implications:**
- Breaking change.
- Inability to sync on devnets created with earlier Dash Core versions and vice versa.

View File

@ -235,7 +235,7 @@ Remote Procedure Calls (RPCs)
support for coin selection and a custom fee rate. The `send` RPC is experimental
and may change in subsequent releases. Using it is encouraged once it's no
longer experimental: `sendmany` and `sendtoaddress` may be deprecated in a future release.
- A new `quorum signplatform` RPC is added for Platform needs. This composite command limits Platform to only request signatures from the Platform quorum type. It is equivalent to `quorum sign <platform type>`.
- A new `quorum platformsign` RPC is added for Platform needs. This composite command limits Platform to only request signatures from the Platform quorum type. It is equivalent to `quorum sign <platform type>`.
### RPC changes
- `createwallet` has an updated argument list: `createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse descriptors load_on_startup )`

View File

@ -556,7 +556,7 @@ public:
peer.is_outbound ? "out" : "in",
ConnectionTypeForNetinfo(peer.conn_type),
peer.network,
peer.transport_protocol_type.rfind('v', 0) == 0 ? peer.transport_protocol_type[1] : ' ',
peer.transport_protocol_type.starts_with('v') == 0 ? peer.transport_protocol_type[1] : ' ',
PingTimeToString(peer.min_ping),
PingTimeToString(peer.ping),
peer.last_send ? ToString(time_now - peer.last_send) : "",

View File

@ -1120,16 +1120,9 @@ constexpr std::array<std::string_view, 256> V2ShortIDs() {
static_assert(std::size(V2_DASH_IDS) <= 128);
std::array<std::string_view, 256> ret{};
for (size_t idx{0}; idx < std::size(ret); idx++) {
if (idx < 128 && idx < std::size(V2_BITCOIN_IDS)) {
ret[idx] = V2_BITCOIN_IDS[idx];
} else if (idx >= 128 && idx - 128 < std::size(V2_DASH_IDS)) {
ret[idx] = V2_DASH_IDS[idx - 128];
} else {
ret[idx] = "";
}
}
std::fill(ret.begin(), ret.end(), "");
std::copy(V2_BITCOIN_IDS.begin(), V2_BITCOIN_IDS.end(), ret.begin());
std::copy(V2_DASH_IDS.begin(), V2_DASH_IDS.end(), ret.begin() + 128);
return ret;
}

View File

@ -357,9 +357,7 @@ FUZZ_TARGET_INIT(rpc, initialize_rpc)
rpc_testing_setup->CallRPC(rpc_command, arguments);
} catch (const UniValue& json_rpc_error) {
const std::string error_msg{find_value(json_rpc_error, "message").get_str()};
// Once c++20 is allowed, starts_with can be used.
// if (error_msg.starts_with("Internal bug detected")) {
if (0 == error_msg.rfind("Internal bug detected", 0)) {
if (error_msg.starts_with("Internal bug detected")) {
// Only allow the intentional internal bug
assert(error_msg.find("trigger_internal_bug") != std::string::npos);
}

View File

@ -5,40 +5,20 @@
#ifndef BITCOIN_UTIL_RANGES_H
#define BITCOIN_UTIL_RANGES_H
#include <algorithm>
#include <ranges>
#include <optional>
//#if __cplusplus > 201703L // C++20 compiler
//namespace ranges = std::ranges;
//#else
#define MK_RANGE(FUN) \
template <typename X, typename Z> \
inline auto FUN(const X& ds, const Z& fn) { \
return std::FUN(cbegin(ds), cend(ds), fn); \
} \
template <typename X, typename Z> \
inline auto FUN(X& ds, const Z& fn) { \
return std::FUN(begin(ds), end(ds), fn); \
}
namespace ranges {
MK_RANGE(all_of)
MK_RANGE(any_of)
MK_RANGE(count_if)
MK_RANGE(find_if)
using namespace std::ranges;
template <typename X, typename Z>
constexpr inline auto find_if_opt(const X& ds, const Z& fn) {
const auto it = ranges::find_if(ds, fn);
if (it != end(ds)) {
return std::make_optional(*it);
}
return std::optional<std::decay_t<decltype(*it)>>{};
template <typename X, typename Z>
constexpr inline auto find_if_opt(const X& ds, const Z& fn) {
const auto it = std::ranges::find_if(ds, fn);
if (it != std::end(ds)) {
return std::make_optional(*it);
}
return std::optional<std::decay_t<decltype(*it)>>{};
}
}
//#endif // C++20 compiler
#endif // BITCOIN_UTIL_RANGES_H

View File

@ -22,6 +22,7 @@
#include <policy/settings.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <reverse_iterator.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/sign.h>
@ -5324,44 +5325,29 @@ bool CWallet::AutoBackupWallet(const fs::path& wallet_path, bilingual_str& error
}
// Keep only the last 10 backups, including the new one of course
typedef std::multimap<std::time_t, fs::path> folder_set_t;
folder_set_t folder_set;
fs::directory_iterator end_iter;
std::multimap<fs::file_time_type, fs::path> folder_set;
// Build map of backup files for current(!) wallet sorted by last write time
fs::path currentFile;
for (fs::directory_iterator dir_iter(backupsDir); dir_iter != end_iter; ++dir_iter)
{
for (const auto& entry : fs::directory_iterator(backupsDir)) {
// Only check regular files
if ( fs::is_regular_file(dir_iter->status()))
{
currentFile = dir_iter->path().filename();
if (entry.is_regular_file()) {
currentFile = entry.path().filename();
// Only add the backups for the current wallet, e.g. wallet.dat.*
if (fs::PathToString(dir_iter->path().stem()) == strWalletName) {
folder_set.insert(folder_set_t::value_type(
// TODO: C++17 compliant time conversion code is abominable, switch to C++20
// compliant code when C++17 support is dropped
std::chrono::system_clock::to_time_t(
std::chrono::time_point_cast<std::chrono::system_clock::duration>(
fs::last_write_time(dir_iter->path()) - fs::file_time_type::clock::now() + std::chrono::system_clock::now()
)
),
*dir_iter
));
if (fs::PathToString(entry.path().stem()) == strWalletName) {
folder_set.insert(decltype(folder_set)::value_type(fs::last_write_time(entry.path()), entry));
}
}
}
// Loop backward through backup files and keep the N newest ones (1 <= N <= 10)
int counter = 0;
for(auto it = folder_set.rbegin(); it != folder_set.rend(); ++it) {
std::pair<const std::time_t, fs::path> file = *it;
int counter{0};
for (const auto& [entry_time, entry] : reverse_iterate(folder_set)) {
counter++;
if (counter > nWalletBackups)
{
if (counter > nWalletBackups) {
// More than nWalletBackups backups: delete oldest one(s)
try {
fs::remove(file.second);
WalletLogPrintf("Old backup deleted: %s\n", fs::PathToString(file.second));
fs::remove(entry);
WalletLogPrintf("Old backup deleted: %s\n", fs::PathToString(entry));
} catch(fs::filesystem_error &error) {
warnings.push_back(strprintf(_("Failed to delete backup, error: %s"), fsbridge::get_filesystem_error_message(error)));
WalletLogPrintf("%s\n", Join(warnings, Untranslated("\n")).original);