rpc: disallow coinjoin stop if there's no CoinJoin session to stop

This commit is contained in:
Kittywhiskers Van Gogh 2024-07-11 11:17:18 +00:00
parent 51b6b94fc0
commit 89ade3e340
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,4 @@
RPC changes
-----------
- `coinjoin stop` will now return an error if there is no CoinJoin mixing session to stop

View File

@ -172,6 +172,9 @@ static RPCHelpMan coinjoin_stop()
auto cj_clientman = node.coinjoin_loader->walletman().Get(wallet->GetName()); auto cj_clientman = node.coinjoin_loader->walletman().Get(wallet->GetName());
CHECK_NONFATAL(cj_clientman); CHECK_NONFATAL(cj_clientman);
if (!cj_clientman->IsMixing()) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "No mix session to stop");
}
cj_clientman->StopMixing(); cj_clientman->StopMixing();
return "Mixing was stopped"; return "Mixing was stopped";