rpc: remove keypool replenishment stat and warning for descriptor wallet

This commit is contained in:
Kittywhiskers Van Gogh 2024-07-11 11:27:40 +00:00
parent 1f113587fb
commit b7c7bff6e0
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,4 @@
RPC changes
-----------
- `getcoinjoininfo` will no longer report `keys_left` and will not incorrectly warn about keypool depletion with descriptor wallets

View File

@ -137,7 +137,7 @@ static RPCHelpMan getcoinjoininfo()
{RPCResult::Type::NUM, "entries_count", "The number of entries in the mixing session"}, {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::Type::STR, "warnings", "Warnings if any"},
}}, }},
RPCResult{"for masternodes", RPCResult{"for masternodes",
@ -177,9 +177,14 @@ static RPCHelpMan getcoinjoininfo()
CHECK_NONFATAL(manager != nullptr); CHECK_NONFATAL(manager != nullptr);
manager->GetJsonInfo(obj); manager->GetJsonInfo(obj);
std::string warning_msg{""};
if (wallet->IsLegacy()) {
obj.pushKV("keys_left", wallet->nKeysLeftSinceAutoBackup); obj.pushKV("keys_left", wallet->nKeysLeftSinceAutoBackup);
obj.pushKV("warnings", wallet->nKeysLeftSinceAutoBackup < COINJOIN_KEYS_THRESHOLD_WARNING if (wallet->nKeysLeftSinceAutoBackup < COINJOIN_KEYS_THRESHOLD_WARNING) {
? "WARNING: keypool is almost depleted!" : ""); warning_msg = "WARNING: keypool is almost depleted!";
}
}
obj.pushKV("warnings", warning_msg);
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
return obj; return obj;