From b7c7bff6e04d22eac33b954bb3e599e2d8033648 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 11 Jul 2024 11:27:40 +0000 Subject: [PATCH] rpc: remove keypool replenishment stat and warning for descriptor wallet --- doc/release-notes-6108.md | 4 ++++ src/rpc/coinjoin.cpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 doc/release-notes-6108.md diff --git a/doc/release-notes-6108.md b/doc/release-notes-6108.md new file mode 100644 index 0000000000..13b81240fc --- /dev/null +++ b/doc/release-notes-6108.md @@ -0,0 +1,4 @@ +RPC changes +----------- + +- `getcoinjoininfo` will no longer report `keys_left` and will not incorrectly warn about keypool depletion with descriptor wallets diff --git a/src/rpc/coinjoin.cpp b/src/rpc/coinjoin.cpp index 6bf4d8f9b3..a963b2babd 100644 --- a/src/rpc/coinjoin.cpp +++ b/src/rpc/coinjoin.cpp @@ -137,7 +137,7 @@ static RPCHelpMan getcoinjoininfo() {RPCResult::Type::NUM, "entries_count", "The number of entries in the mixing session"}, }}, }}, - {RPCResult::Type::NUM, "keys_left", "How many new keys are left since last automatic backup"}, + {RPCResult::Type::NUM, "keys_left", /* optional */ true, "How many new keys are left since last automatic backup (if applicable)"}, {RPCResult::Type::STR, "warnings", "Warnings if any"}, }}, RPCResult{"for masternodes", @@ -177,9 +177,14 @@ static RPCHelpMan getcoinjoininfo() CHECK_NONFATAL(manager != nullptr); manager->GetJsonInfo(obj); - obj.pushKV("keys_left", wallet->nKeysLeftSinceAutoBackup); - obj.pushKV("warnings", wallet->nKeysLeftSinceAutoBackup < COINJOIN_KEYS_THRESHOLD_WARNING - ? "WARNING: keypool is almost depleted!" : ""); + std::string warning_msg{""}; + if (wallet->IsLegacy()) { + obj.pushKV("keys_left", wallet->nKeysLeftSinceAutoBackup); + if (wallet->nKeysLeftSinceAutoBackup < COINJOIN_KEYS_THRESHOLD_WARNING) { + warning_msg = "WARNING: keypool is almost depleted!"; + } + } + obj.pushKV("warnings", warning_msg); #endif // ENABLE_WALLET return obj;