From 89ade3e340225ccaa612eea652fd5916fbd80447 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 11 Jul 2024 11:17:18 +0000 Subject: [PATCH] rpc: disallow `coinjoin stop` if there's no CoinJoin session to stop --- doc/release-notes-6107.md | 4 ++++ src/rpc/coinjoin.cpp | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 doc/release-notes-6107.md diff --git a/doc/release-notes-6107.md b/doc/release-notes-6107.md new file mode 100644 index 0000000000..d8299b2ee4 --- /dev/null +++ b/doc/release-notes-6107.md @@ -0,0 +1,4 @@ +RPC changes +----------- + +- `coinjoin stop` will now return an error if there is no CoinJoin mixing session to stop diff --git a/src/rpc/coinjoin.cpp b/src/rpc/coinjoin.cpp index 1e239edd5f..29cf8fbb41 100644 --- a/src/rpc/coinjoin.cpp +++ b/src/rpc/coinjoin.cpp @@ -172,6 +172,9 @@ static RPCHelpMan coinjoin_stop() auto cj_clientman = node.coinjoin_loader->walletman().Get(wallet->GetName()); CHECK_NONFATAL(cj_clientman); + if (!cj_clientman->IsMixing()) { + throw JSONRPCError(RPC_INTERNAL_ERROR, "No mix session to stop"); + } cj_clientman->StopMixing(); return "Mixing was stopped";